private com.epl.geometry.Geometry DensifyMultiPath(com.epl.geometry.MultiPath geom)
 {
     com.epl.geometry.MultiPath       densifiedPoly = (com.epl.geometry.MultiPath)geom.CreateInstance();
     com.epl.geometry.SegmentIterator iter          = geom.QuerySegmentIterator();
     while (iter.NextPath())
     {
         bool bStartNewPath = true;
         while (iter.HasNextSegment())
         {
             com.epl.geometry.Segment seg = iter.NextSegment();
             if (seg.GetType().Value() != com.epl.geometry.Geometry.GeometryType.Line)
             {
                 throw new com.epl.geometry.GeometryException("not implemented");
             }
             bool   bIsClosing = iter.IsClosingSegment();
             double len        = seg.CalculateLength2D();
             if (len > m_maxLength)
             {
                 // need to split
                 double dcount = System.Math.Ceiling(len / m_maxLength);
                 com.epl.geometry.Point point = new com.epl.geometry.Point(geom.GetDescription());
                 // LOCALREFCLASS1(Point,
                 // VertexDescription,
                 // point,
                 // geom.getDescription());
                 if (bStartNewPath)
                 {
                     bStartNewPath = false;
                     seg.QueryStart(point);
                     densifiedPoly.StartPath(point);
                 }
                 double dt = 1.0 / dcount;
                 double t  = dt;
                 for (int i = 0, n = (int)dcount - 1; i < n; i++)
                 {
                     seg.QueryCoord(t, point);
                     densifiedPoly.LineTo(point);
                     t += dt;
                 }
                 if (!bIsClosing)
                 {
                     seg.QueryEnd(point);
                     densifiedPoly.LineTo(point);
                 }
                 else
                 {
                     densifiedPoly.ClosePathWithLine();
                 }
                 bStartNewPath = false;
             }
             else
             {
                 if (!bIsClosing)
                 {
                     densifiedPoly.AddSegment(seg, bStartNewPath);
                 }
                 else
                 {
                     densifiedPoly.ClosePathWithLine();
                 }
                 bStartNewPath = false;
             }
         }
     }
     return((com.epl.geometry.Geometry)densifiedPoly);
 }