/** * Appends all paths from another multipath. * * @param src * The multipath to append to this multipath. * @param bReversePaths * TRUE if the multipath is added should be added with its paths * reversed. */ public void add(MultiPath src, boolean bReversePaths) { m_impl.add((MultiPathImpl) src._getImpl(), bReversePaths); }
/** * Appends all paths from another multipath. * * @param src * The multipath to append to this multipath. * @param bReversePaths * TRUE if the multipath is added should be added with its paths * reversed. */ public void add(MultiPath src, boolean bReversePaths) { m_impl.add((MultiPathImpl) src._getImpl(), bReversePaths); }
/** * Copies a path from another multipath. * * @param src * The multipath to copy from. * @param srcPathIndex * The index of the path in the the source MultiPath. * @param bForward * When FALSE, the points are inserted in reverse order. */ public void addPath(MultiPath src, int srcPathIndex, boolean bForward) { m_impl.addPath((MultiPathImpl) src._getImpl(), srcPathIndex, bForward); }
/** * Copies a path from another multipath. * * @param src * The multipath to copy from. * @param srcPathIndex * The index of the path in the the source MultiPath. * @param bForward * When FALSE, the points are inserted in reverse order. */ public void addPath(MultiPath src, int srcPathIndex, boolean bForward) { m_impl.addPath((MultiPathImpl) src._getImpl(), srcPathIndex, bForward); }
/** * Inserts a path from another multipath. * * @param pathIndex * The start index of the multipath to insert. * @param src * The multipath to insert into this multipath. Can be the same * as the multipath being modified. * @param srcPathIndex * The start index to insert the path into the multipath. * @param bForward * When FALSE, the points are inserted in reverse order. */ public void insertPath(int pathIndex, MultiPath src, int srcPathIndex, boolean bForward) { m_impl.insertPath(pathIndex, (MultiPathImpl) src._getImpl(), srcPathIndex, bForward); }
/** * Inserts a path from another multipath. * * @param pathIndex * The start index of the multipath to insert. * @param src * The multipath to insert into this multipath. Can be the same * as the multipath being modified. * @param srcPathIndex * The start index to insert the path into the multipath. * @param bForward * When FALSE, the points are inserted in reverse order. */ public void insertPath(int pathIndex, MultiPath src, int srcPathIndex, boolean bForward) { m_impl.insertPath(pathIndex, (MultiPathImpl) src._getImpl(), srcPathIndex, bForward); }
int srcPointCount, boolean bForward) { m_impl.insertPoints(pathIndex, beforePointIndex, (MultiPathImpl) src._getImpl(), srcPathIndex, srcPointIndexFrom, srcPointCount, bForward);
m_impl.addSegmentsFromPath((MultiPathImpl) src._getImpl(), srcPathIndex, srcSegmentFrom, srcSegmentCount, bStartNewPath);
int srcPointCount, boolean bForward) { m_impl.insertPoints(pathIndex, beforePointIndex, (MultiPathImpl) src._getImpl(), srcPathIndex, srcPointIndexFrom, srcPointCount, bForward);
m_impl.addSegmentsFromPath((MultiPathImpl) src._getImpl(), srcPathIndex, srcSegmentFrom, srcSegmentCount, bStartNewPath);
void shiftPath(MultiPath inputGeom, int iPath, double shift) { MultiVertexGeometryImpl vertexGeometryImpl = (MultiVertexGeometryImpl) inputGeom ._getImpl(); AttributeStreamOfDbl xyStream = (AttributeStreamOfDbl) vertexGeometryImpl .getAttributeStreamRef(VertexDescription.Semantics.POSITION); int i1 = inputGeom.getPathStart(iPath); int i2 = inputGeom.getPathEnd(iPath); Point2D pt = new Point2D(); while (i1 < i2) { xyStream.read(i1, pt); pt.x += shift; xyStream.write(i1, pt); i1++; } }
void shiftPath(MultiPath inputGeom, int iPath, double shift) { MultiVertexGeometryImpl vertexGeometryImpl = (MultiVertexGeometryImpl) inputGeom ._getImpl(); AttributeStreamOfDbl xyStream = (AttributeStreamOfDbl) vertexGeometryImpl .getAttributeStreamRef(VertexDescription.Semantics.POSITION); int i1 = inputGeom.getPathStart(iPath); int i2 = inputGeom.getPathEnd(iPath); Point2D pt = new Point2D(); while (i1 < i2) { xyStream.read(i1, pt); pt.x += shift; xyStream.write(i1, pt); i1++; } }
private static boolean linearPathIntersectsLinearPath_( MultiPath multipathA, MultiPath multipathB, double tolerance) { MultiPathImpl multi_path_impl_a = (MultiPathImpl) multipathA._getImpl(); MultiPathImpl multi_path_impl_b = (MultiPathImpl) multipathB._getImpl(); SegmentIteratorImpl segIterA = multi_path_impl_a.querySegmentIterator(); SegmentIteratorImpl segIterB = multi_path_impl_b.querySegmentIterator(); PairwiseIntersectorImpl intersector = new PairwiseIntersectorImpl(multi_path_impl_a, multi_path_impl_b, tolerance, false); while (intersector.next()) { int vertex_a = intersector.getRedElement(); int vertex_b = intersector.getBlueElement(); segIterA.resetToVertex(vertex_a); segIterB.resetToVertex(vertex_b); Segment segmentA = segIterA.nextSegment(); Segment segmentB = segIterB.nextSegment(); int result = segmentB.intersect(segmentA, null, null, null, tolerance); if (result > 0) { return true; } } return false; }
private static boolean linearPathIntersectsLinearPath_( MultiPath multipathA, MultiPath multipathB, double tolerance) { MultiPathImpl multi_path_impl_a = (MultiPathImpl) multipathA._getImpl(); MultiPathImpl multi_path_impl_b = (MultiPathImpl) multipathB._getImpl(); SegmentIteratorImpl segIterA = multi_path_impl_a.querySegmentIterator(); SegmentIteratorImpl segIterB = multi_path_impl_b.querySegmentIterator(); PairwiseIntersectorImpl intersector = new PairwiseIntersectorImpl(multi_path_impl_a, multi_path_impl_b, tolerance, false); while (intersector.next()) { int vertex_a = intersector.getRedElement(); int vertex_b = intersector.getBlueElement(); segIterA.resetToVertex(vertex_a); segIterB.resetToVertex(vertex_b); Segment segmentA = segIterA.nextSegment(); Segment segmentB = segIterB.nextSegment(); int result = segmentB.intersect(segmentA, null, null, null, tolerance); if (result > 0) { return true; } } return false; }
private Geometry Generalize(Geometry geom) { Geometry.Type gt = geom.getType(); if (Geometry.isPoint(gt.value())) return geom; if (gt == Geometry.Type.Envelope) { Polygon poly = new Polygon(geom.getDescription()); poly.addEnvelope((Envelope) geom, false); return Generalize(poly); } if (geom.isEmpty()) return geom; MultiPath mp = (MultiPath) geom; MultiPath dstmp = (MultiPath) geom.createInstance(); Line line = new Line(); for (int ipath = 0, npath = mp.getPathCount(); ipath < npath; ipath++) { GeneralizePath((MultiPathImpl) mp._getImpl(), ipath, (MultiPathImpl) dstmp._getImpl(), line); } return dstmp; }
private Geometry Generalize(Geometry geom) { Geometry.Type gt = geom.getType(); if (Geometry.isPoint(gt.value())) return geom; if (gt == Geometry.Type.Envelope) { Polygon poly = new Polygon(geom.getDescription()); poly.addEnvelope((Envelope) geom, false); return Generalize(poly); } if (geom.isEmpty()) return geom; MultiPath mp = (MultiPath) geom; MultiPath dstmp = (MultiPath) geom.createInstance(); Line line = new Line(); for (int ipath = 0, npath = mp.getPathCount(); ipath < npath; ipath++) { GeneralizePath((MultiPathImpl) mp._getImpl(), ipath, (MultiPathImpl) dstmp._getImpl(), line); } return dstmp; }
static boolean _isRingInRing2D(MultiPath polygon, int iRing1, int iRing2, double tolerance, QuadTree quadTree) { MultiPathImpl polygonImpl = (MultiPathImpl) polygon._getImpl(); SegmentIteratorImpl segIter = polygonImpl.querySegmentIterator(); segIter.resetToPath(iRing1); if (!segIter.nextPath() || !segIter.hasNextSegment()) throw new GeometryException("corrupted geometry"); int res = 2; while (res == 2 && segIter.hasNextSegment()) { Segment segment = segIter.nextSegment(); Point2D point = segment.getCoord2D(0.5); res = PointInPolygonHelper.isPointInRing(polygonImpl, iRing2, point, tolerance, quadTree); } if (res == 2) throw GeometryException.GeometryInternalError(); if (res == 1) return true; return false; }
static boolean _isRingInRing2D(MultiPath polygon, int iRing1, int iRing2, double tolerance, QuadTree quadTree) { MultiPathImpl polygonImpl = (MultiPathImpl) polygon._getImpl(); SegmentIteratorImpl segIter = polygonImpl.querySegmentIterator(); segIter.resetToPath(iRing1); if (!segIter.nextPath() || !segIter.hasNextSegment()) throw new GeometryException("corrupted geometry"); int res = 2; while (res == 2 && segIter.hasNextSegment()) { Segment segment = segIter.nextSegment(); Point2D point = segment.getCoord2D(0.5); res = PointInPolygonHelper.isPointInRing(polygonImpl, iRing2, point, tolerance, quadTree); } if (res == 2) throw GeometryException.GeometryInternalError(); if (res == 1) return true; return false; }
: Geometry.Type.Polyline, multi_path.getDescription()); MultiPathImpl mp_impl = (MultiPathImpl) multi_path._getImpl(); if (multi_path.getPathSize(ipath) < 2) return newgeom; //return empty geometry
: Geometry.Type.Polyline, multi_path.getDescription()); MultiPathImpl mp_impl = (MultiPathImpl) multi_path._getImpl(); if (multi_path.getPathSize(ipath) < 2) return newgeom; //return empty geometry