internal static com.esri.core.geometry.QuadTree BuildQuadTree_(com.esri.core.geometry.MultiPathImpl multipathImpl) { com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D(); multipathImpl.QueryEnvelope2D(extent); com.esri.core.geometry.QuadTree quadTree = new com.esri.core.geometry.QuadTree(extent, 8); int hint_index = -1; com.esri.core.geometry.Envelope2D boundingbox = new com.esri.core.geometry.Envelope2D(); com.esri.core.geometry.SegmentIteratorImpl seg_iter = multipathImpl.QuerySegmentIterator(); while (seg_iter.NextPath()) { while (seg_iter.HasNextSegment()) { com.esri.core.geometry.Segment segment = seg_iter.NextSegment(); int index = seg_iter.GetStartPointIndex(); 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; }