@SqlNullable @Description("Returns TRUE if the LineString or Multi-LineString's start and end points are coincident") @ScalarFunction("ST_IsClosed") @SqlType(BOOLEAN) public static Boolean stIsClosed(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_IsClosed", geometry, EnumSet.of(LINE_STRING, MULTI_LINE_STRING)); MultiPath lines = (MultiPath) geometry.getEsriGeometry(); int pathCount = lines.getPathCount(); for (int i = 0; i < pathCount; i++) { Point start = lines.getPoint(lines.getPathStart(i)); Point end = lines.getPoint(lines.getPathEnd(i) - 1); if (!end.equals(start)) { return false; } } return true; }
private static boolean multiPathExactlyEqualsMultiPath_( MultiPath multipathA, MultiPath multipathB, double tolerance, ProgressTracker progress_tracker) { if (multipathA.getPathCount() != multipathB.getPathCount() || multipathA.getPointCount() != multipathB.getPointCount()) return false; Point2D ptA = new Point2D(), ptB = new Point2D(); boolean bAllPointsEqual = true; double tolerance_sq = tolerance * tolerance; for (int ipath = 0; ipath < multipathA.getPathCount(); ipath++) { if (multipathA.getPathEnd(ipath) != multipathB.getPathEnd(ipath)) { bAllPointsEqual = false; break; } for (int i = multipathA.getPathStart(ipath); i < multipathB .getPathEnd(ipath); i++) { multipathA.getXY(i, ptA); multipathB.getXY(i, ptB); if (Point2D.sqrDistance(ptA, ptB) > tolerance_sq) { bAllPointsEqual = false; break; } } if (!bAllPointsEqual) break; } if (!bAllPointsEqual) return false; return true; }
private static boolean multiPathExactlyEqualsMultiPath_( MultiPath multipathA, MultiPath multipathB, double tolerance, ProgressTracker progress_tracker) { if (multipathA.getPathCount() != multipathB.getPathCount() || multipathA.getPointCount() != multipathB.getPointCount()) return false; Point2D ptA = new Point2D(), ptB = new Point2D(); boolean bAllPointsEqual = true; double tolerance_sq = tolerance * tolerance; for (int ipath = 0; ipath < multipathA.getPathCount(); ipath++) { if (multipathA.getPathEnd(ipath) != multipathB.getPathEnd(ipath)) { bAllPointsEqual = false; break; } for (int i = multipathA.getPathStart(ipath); i < multipathB .getPathEnd(ipath); i++) { multipathA.getXY(i, ptA); multipathB.getXY(i, ptB); if (Point2D.sqrDistance(ptA, ptB) > tolerance_sq) { bAllPointsEqual = false; break; } } if (!bAllPointsEqual) break; } if (!bAllPointsEqual) return false; return true; }
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++; } }
void _OffsetPath(MultiPath multiPath, int pathIndex, MultiPath resultingPath) { int startVertex = multiPath.getPathStart(pathIndex); int endVertex = multiPath.getPathEnd(pathIndex);
void _OffsetPath(MultiPath multiPath, int pathIndex, MultiPath resultingPath) { int startVertex = multiPath.getPathStart(pathIndex); int endVertex = multiPath.getPathEnd(pathIndex);
@SqlNullable @Description("Returns TRUE if the LineString or Multi-LineString's start and end points are coincident") @ScalarFunction("ST_IsClosed") @SqlType(BOOLEAN) public static Boolean stIsClosed(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_IsClosed", geometry, EnumSet.of(LINE_STRING, MULTI_LINE_STRING)); MultiPath lines = (MultiPath) geometry.getEsriGeometry(); int pathCount = lines.getPathCount(); for (int i = 0; i < pathCount; i++) { Point start = lines.getPoint(lines.getPathStart(i)); Point end = lines.getPoint(lines.getPathEnd(i) - 1); if (!end.equals(start)) { return false; } } return true; }
@SqlNullable @Description("Returns TRUE if the LineString or Multi-LineString's start and end points are coincident") @ScalarFunction("ST_IsClosed") @SqlType(BOOLEAN) public static Boolean stIsClosed(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_IsClosed", geometry, EnumSet.of(LINE_STRING, MULTI_LINE_STRING)); MultiPath lines = (MultiPath) geometry.getEsriGeometry(); int pathCount = lines.getPathCount(); for (int i = 0; i < pathCount; i++) { Point start = lines.getPoint(lines.getPathStart(i)); Point end = lines.getPoint(lines.getPathEnd(i) - 1); if (!end.equals(start)) { return false; } } return true; }
for (int ix = 0; rslt && ix < nPaths; ix++) { Point p0 = lines.getPoint(lines.getPathStart(ix)); Point pf = lines.getPoint(lines.getPathEnd(ix)-1);
for (int ix = 0; ix < nPath; ix++) { int curPt = lines.getPathStart(ix); int pastPt = lines.getPathEnd(ix); Point fromPt = lines.getPoint(curPt); Point toPt = null;