private static Polygon setWeakSimple_(Polygon poly) { ((MultiPathImpl) poly._getImpl()).setIsSimple( MultiVertexGeometryImpl.GeometryXSimple.Weak, 0.0, false); return poly; }
private static Polygon setWeakSimple_(Polygon poly) { ((MultiPathImpl) poly._getImpl()).setIsSimple( MultiVertexGeometryImpl.GeometryXSimple.Weak, 0.0, false); return poly; }
/** * Returns TRUE when this geometry has exactly same type, properties, and * coordinates as the other geometry. */ @Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; if (other.getClass() != getClass()) return false; return m_impl.equals(((Polygon) other)._getImpl()); }
/** * Returns TRUE when this geometry has exactly same type, properties, and * coordinates as the other geometry. */ @Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; if (other.getClass() != getClass()) return false; return m_impl.equals(((Polygon) other)._getImpl()); }
/** * Tests if Point is inside the Polygon's ring. Returns PiPOutside if not in * ring, PiPInside if in the ring, PiPBoundary is if on the border. It tests * border only if the tolerance is greater than 0, otherwise PiPBoundary cannot be * returned. Note: If the tolerance is not 0, the test is more expensive * because it calculates closest distance from a point to each segment. * * O(n) complexity, where n is the number of ring segments. */ public static PiPResult isPointInRing2D(Polygon polygon, int iRing, Point2D inputPoint, double tolerance) { MultiPathImpl polygonImpl = (MultiPathImpl) polygon._getImpl(); int res = PointInPolygonHelper.isPointInRing(polygonImpl, iRing, inputPoint, tolerance, null); if (res == 0) return PiPResult.PiPOutside; if (res == 1) return PiPResult.PiPInside; // return PiPResult.PiPBoundary; return PiPResult.PiPInside; // we do not return PiPBoundary. Overwise, // we would have to do more complex // calculations to differentiat between // internal and external boundaries. }
/** * Tests if Point is inside the Polygon's ring. Returns PiPOutside if not in * ring, PiPInside if in the ring, PiPBoundary is if on the border. It tests * border only if the tolerance is greater than 0, otherwise PiPBoundary cannot be * returned. Note: If the tolerance is not 0, the test is more expensive * because it calculates closest distance from a point to each segment. * * O(n) complexity, where n is the number of ring segments. */ public static PiPResult isPointInRing2D(Polygon polygon, int iRing, Point2D inputPoint, double tolerance) { MultiPathImpl polygonImpl = (MultiPathImpl) polygon._getImpl(); int res = PointInPolygonHelper.isPointInRing(polygonImpl, iRing, inputPoint, tolerance, null); if (res == 0) return PiPResult.PiPOutside; if (res == 1) return PiPResult.PiPInside; // return PiPResult.PiPBoundary; return PiPResult.PiPInside; // we do not return PiPBoundary. Overwise, // we would have to do more complex // calculations to differentiat between // internal and external boundaries. }
private Geometry bufferPoint_(Point point) { assert (m_distance > 0); Polygon resultPolygon = new Polygon(point.getDescription()); addCircle_((MultiPathImpl) resultPolygon._getImpl(), point); return setStrongSimple_(resultPolygon); }
private Geometry bufferPoint_(Point point) { assert (m_distance > 0); Polygon resultPolygon = new Polygon(point.getDescription()); addCircle_((MultiPathImpl) resultPolygon._getImpl(), point); return setStrongSimple_(resultPolygon); }
private static int _isPointInPolygonInternal(Polygon inputPolygon, Point2D inputPoint, double tolerance) { boolean bAltenate = inputPolygon.getFillRule() == Polygon.FillRule.enumFillRuleOddEven; PointInPolygonHelper helper = new PointInPolygonHelper(bAltenate, inputPoint, tolerance); MultiPathImpl mpImpl = (MultiPathImpl) inputPolygon._getImpl(); SegmentIteratorImpl iter = mpImpl.querySegmentIterator(); while (iter.nextPath()) { while (iter.hasNextSegment()) { Segment segment = iter.nextSegment(); if (helper.processSegment(segment)) return -1; // point on boundary } } return helper.result(); }
private static int _isPointInPolygonInternal(Polygon inputPolygon, Point2D inputPoint, double tolerance) { boolean bAltenate = inputPolygon.getFillRule() == Polygon.FillRule.enumFillRuleOddEven; PointInPolygonHelper helper = new PointInPolygonHelper(bAltenate, inputPoint, tolerance); MultiPathImpl mpImpl = (MultiPathImpl) inputPolygon._getImpl(); SegmentIteratorImpl iter = mpImpl.querySegmentIterator(); while (iter.nextPath()) { while (iter.hasNextSegment()) { Segment segment = iter.nextSegment(); if (helper.processSegment(segment)) return -1; // point on boundary } } return helper.result(); }
static int isPointInPolygon(Polygon inputPolygon, double inputPointXVal, double inputPointYVal, double tolerance) { if (inputPolygon.isEmpty()) return 0; Envelope2D env = new Envelope2D(); inputPolygon.queryLooseEnvelope(env); env.inflate(tolerance, tolerance); if (!env.contains(inputPointXVal, inputPointYVal)) return 0; MultiPathImpl mpImpl = (MultiPathImpl) inputPolygon._getImpl(); GeometryAccelerators accel = mpImpl._getAccelerators(); if (accel != null) { RasterizedGeometry2D rgeom = accel.getRasterizedGeometry(); if (rgeom != null) { RasterizedGeometry2D.HitType hit = rgeom.queryPointInGeometry( inputPointXVal, inputPointYVal); if (hit == RasterizedGeometry2D.HitType.Inside) return 1; else if (hit == RasterizedGeometry2D.HitType.Outside) return 0; } } return _isPointInPolygonInternal(inputPolygon, new Point2D( inputPointXVal, inputPointYVal), tolerance); }
static int isPointInPolygon(Polygon inputPolygon, double inputPointXVal, double inputPointYVal, double tolerance) { if (inputPolygon.isEmpty()) return 0; Envelope2D env = new Envelope2D(); inputPolygon.queryLooseEnvelope(env); env.inflate(tolerance, tolerance); if (!env.contains(inputPointXVal, inputPointYVal)) return 0; MultiPathImpl mpImpl = (MultiPathImpl) inputPolygon._getImpl(); GeometryAccelerators accel = mpImpl._getAccelerators(); if (accel != null) { RasterizedGeometry2D rgeom = accel.getRasterizedGeometry(); if (rgeom != null) { RasterizedGeometry2D.HitType hit = rgeom.queryPointInGeometry( inputPointXVal, inputPointYVal); if (hit == RasterizedGeometry2D.HitType.Inside) return 1; else if (hit == RasterizedGeometry2D.HitType.Outside) return 0; } } return _isPointInPolygonInternal(inputPolygon, new Point2D( inputPointXVal, inputPointYVal), tolerance); }
public static int isPointInPolygon(Polygon inputPolygon, Point2D inputPoint, double tolerance) { if (inputPolygon.isEmpty()) return 0; Envelope2D env = new Envelope2D(); inputPolygon.queryLooseEnvelope(env); env.inflate(tolerance, tolerance); if (!env.contains(inputPoint)) return 0; MultiPathImpl mpImpl = (MultiPathImpl) inputPolygon._getImpl(); GeometryAccelerators accel = mpImpl._getAccelerators(); if (accel != null) { // geometry has spatial indices built. Try using them. RasterizedGeometry2D rgeom = accel.getRasterizedGeometry(); if (rgeom != null) { RasterizedGeometry2D.HitType hit = rgeom.queryPointInGeometry( inputPoint.x, inputPoint.y); if (hit == RasterizedGeometry2D.HitType.Inside) return 1; else if (hit == RasterizedGeometry2D.HitType.Outside) return 0; } QuadTreeImpl qtree = accel.getQuadTree(); if (qtree != null) { return _isPointInPolygonInternalWithQuadTree(inputPolygon, qtree, inputPoint, tolerance); } } return _isPointInPolygonInternal(inputPolygon, inputPoint, tolerance); }
public static int isPointInPolygon(Polygon inputPolygon, Point2D inputPoint, double tolerance) { if (inputPolygon.isEmpty()) return 0; Envelope2D env = new Envelope2D(); inputPolygon.queryLooseEnvelope(env); env.inflate(tolerance, tolerance); if (!env.contains(inputPoint)) return 0; MultiPathImpl mpImpl = (MultiPathImpl) inputPolygon._getImpl(); GeometryAccelerators accel = mpImpl._getAccelerators(); if (accel != null) { // geometry has spatial indices built. Try using them. RasterizedGeometry2D rgeom = accel.getRasterizedGeometry(); if (rgeom != null) { RasterizedGeometry2D.HitType hit = rgeom.queryPointInGeometry( inputPoint.x, inputPoint.y); if (hit == RasterizedGeometry2D.HitType.Inside) return 1; else if (hit == RasterizedGeometry2D.HitType.Outside) return 0; } QuadTreeImpl qtree = accel.getQuadTree(); if (qtree != null) { return _isPointInPolygonInternalWithQuadTree(inputPolygon, qtree, inputPoint, tolerance); } } return _isPointInPolygonInternal(inputPolygon, inputPoint, tolerance); }
PointInPolygonHelper helper = new PointInPolygonHelper(bAltenate, inputPoint, tolerance); MultiPathImpl mpImpl = (MultiPathImpl) inputPolygon._getImpl(); SegmentIteratorImpl iter = mpImpl.querySegmentIterator(); while (iter.nextPath()) {
inputPoint, tolerance); MultiPathImpl mpImpl = (MultiPathImpl) inputPolygon._getImpl(); SegmentIteratorImpl iter = mpImpl.querySegmentIterator(); Envelope2D queryEnv = new Envelope2D();
inputPoint, tolerance); MultiPathImpl mpImpl = (MultiPathImpl) inputPolygon._getImpl(); SegmentIteratorImpl iter = mpImpl.querySegmentIterator(); Envelope2D queryEnv = new Envelope2D();
MultiPathImpl result_mp = (MultiPathImpl) resultPolygon._getImpl();