@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; }
@Override public OGCPoint pointN(int n) { int nn; if (n == multiPath.getPathSize(0)) { nn = multiPath.getPathStart(0); } else nn = multiPath.getPathStart(0) + n; return (OGCPoint) OGCGeometry.createFromEsriGeometry( multiPath.getPoint(nn), esriSR); } }
@Override public OGCPoint pointN(int n) { int nn; if (n == multiPath.getPathSize(0)) { nn = multiPath.getPathStart(0); } else nn = multiPath.getPathStart(0) + n; return (OGCPoint) OGCGeometry.createFromEsriGeometry( multiPath.getPoint(nn), esriSR); } }
/** * Returns the specified Point N in this LineString. * @param n The 0 based index of the Point. */ public OGCPoint pointN(int n) { int nn; if (multiPath.isClosedPath(0) && n == multiPath.getPathSize(0)) { nn = multiPath.getPathStart(0); } else nn = n + multiPath.getPathStart(0); return (OGCPoint) OGCGeometry.createFromEsriGeometry( multiPath.getPoint(nn), esriSR); }
/** * Returns the specified Point N in this LineString. * @param n The 0 based index of the Point. */ public OGCPoint pointN(int n) { int nn; if (multiPath.isClosedPath(0) && n == multiPath.getPathSize(0)) { nn = multiPath.getPathStart(0); } else nn = n + multiPath.getPathStart(0); return (OGCPoint) OGCGeometry.createFromEsriGeometry( multiPath.getPoint(nn), esriSR); }
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++; } }
@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; }
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; }
boolean rslt = true; for (int ix = 0; rslt && ix < nPaths; ix++) { Point p0 = lines.getPoint(lines.getPathStart(ix)); Point pf = lines.getPoint(lines.getPathEnd(ix)-1);
double length = 0.; for (int ix = 0; ix < nPath; ix++) { int curPt = lines.getPathStart(ix); int pastPt = lines.getPathEnd(ix); Point fromPt = lines.getPoint(curPt);
m_vertices_mp.add(multi_path, multi_path.getPathStart(ipath), mp_impl.getPathEnd(ipath)); m_xy_stream = (AttributeStreamOfDbl) m_vertices
m_vertices_mp.add(multi_path, multi_path.getPathStart(ipath), mp_impl.getPathEnd(ipath)); m_xy_stream = (AttributeStreamOfDbl) m_vertices
MultiPathImpl src_mp = (MultiPathImpl) src._getImpl(); int path_size = src.getPathSize(ipath); int path_start = src.getPathStart(ipath); for (int i = 0, n = src.getPathSize(ipath); i < n; i++) { src_mp.getXY(path_start + i, pt_1);
MultiPathImpl src_mp = (MultiPathImpl) src._getImpl(); int path_size = src.getPathSize(ipath); int path_start = src.getPathStart(ipath); for (int i = 0, n = src.getPathSize(ipath); i < n; i++) { src_mp.getXY(path_start + i, pt_1);
int path_b = intersector.getBlueElement(); pt_b = multipath_b.getXY(multipath_b.getPathStart(path_b)); env_a_inf.setCoords(intersector.getRedEnvelope()); env_a_inf.inflate(tolerance, tolerance);
int path_b = intersector.getBlueElement(); pt_b = multipath_b.getXY(multipath_b.getPathStart(path_b)); env_a_inf.setCoords(intersector.getRedEnvelope()); env_a_inf.inflate(tolerance, tolerance);
Point2D anyPoint = multi_path_b.getXY(multi_path_b.getPathStart(ipath)); int res = PointInPolygonHelper.isPointInPolygon(p_polygon_a, anyPoint, 0); if (res == 0)