public static com.esri.core.geometry.QuadTree buildQuadTree(com.esri.core.geometry.MultiPath
                                                                    multipath)
        {
            com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D(
                );
            multipath.queryEnvelope2D(extent);
            com.esri.core.geometry.QuadTree quadTree = new com.esri.core.geometry.QuadTree(extent
                                                                                           , 8);
            int hint_index = -1;

            com.esri.core.geometry.SegmentIterator seg_iter = multipath.querySegmentIterator(
                );
            while (seg_iter.nextPath())
            {
                while (seg_iter.hasNextSegment())
                {
                    com.esri.core.geometry.Segment segment = seg_iter.nextSegment();
                    int index = seg_iter.getStartPointIndex();
                    com.esri.core.geometry.Envelope2D boundingbox = new com.esri.core.geometry.Envelope2D
                                                                        ();
                    segment.queryEnvelope2D(boundingbox);
                    hint_index = quadTree.insert(index, boundingbox, hint_index);
                }
            }
            return(quadTree);
        }
        internal virtual bool rgHelper(com.esri.core.geometry.RasterizedGeometry2D rg, com.esri.core.geometry.MultiPath
                                       mp)
        {
            com.esri.core.geometry.SegmentIterator iter = mp.querySegmentIterator();
            while (iter.nextPath())
            {
                while (iter.hasNextSegment())
                {
                    com.esri.core.geometry.Segment seg = iter.nextSegment();
                    int count = 20;
                    for (int i = 0; i < count; i++)
                    {
                        double t = (1.0 * i / count);
                        com.esri.core.geometry.Point2D pt = seg.getCoord2D(t);
                        com.esri.core.geometry.RasterizedGeometry2D.HitType hit = rg.queryPointInGeometry
                                                                                      (pt.x, pt.y);
                        if (hit != com.esri.core.geometry.RasterizedGeometry2D.HitType.Border)
                        {
                            return(false);
                        }
                    }
                }
            }
            if (mp.getType() != com.esri.core.geometry.Geometry.Type.Polygon)
            {
                return(true);
            }
            com.esri.core.geometry.Polygon    poly = (com.esri.core.geometry.Polygon)mp;
            com.esri.core.geometry.Envelope2D env  = new com.esri.core.geometry.Envelope2D();
            poly.queryEnvelope2D(env);
            int count_1 = 100;

            for (int iy = 0; iy < count_1; iy++)
            {
                double ty = 1.0 * iy / count_1;
                double y  = env.ymin * (1.0 - ty) + ty * env.ymax;
                for (int ix = 0; ix < count_1; ix++)
                {
                    double tx = 1.0 * ix / count_1;
                    double x  = env.xmin * (1.0 - tx) + tx * env.xmax;
                    com.esri.core.geometry.RasterizedGeometry2D.HitType hit = rg.queryPointInGeometry
                                                                                  (x, y);
                    com.esri.core.geometry.PolygonUtils.PiPResult res = com.esri.core.geometry.PolygonUtils
                                                                        .isPointInPolygon2D(poly, new com.esri.core.geometry.Point2D(x, y), 0);
                    if (res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPInside)
                    {
                        bool bgood = (hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Border ||
                                      hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Inside);
                        if (!bgood)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (res == com.esri.core.geometry.PolygonUtils.PiPResult.PiPOutside)
                        {
                            bool bgood = (hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Border ||
                                          hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Outside);
                            if (!bgood)
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            bool bgood = (hit == com.esri.core.geometry.RasterizedGeometry2D.HitType.Border);
                            if (!bgood)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
            return(true);
        }