static void testPointsOnLine2D(Geometry line, Point2D[] input_points, int count, double tolerance, PolygonUtils.PiPResult[] test_results) { Geometry.Type gt = line.getType(); if (gt == Geometry.Type.Polyline) testPointsOnPolyline2D_((Polyline) line, input_points, count, tolerance, test_results); else if (Geometry.isSegment(gt.value())) { testPointsOnSegment_((Segment) line, input_points, count, tolerance, test_results); } else throw new GeometryException("Invalid call."); }
static void testPointsOnLine2D(Geometry line, Point2D[] input_points, int count, double tolerance, PolygonUtils.PiPResult[] test_results) { Geometry.Type gt = line.getType(); if (gt == Geometry.Type.Polyline) testPointsOnPolyline2D_((Polyline) line, input_points, count, tolerance, test_results); else if (Geometry.isSegment(gt.value())) { testPointsOnSegment_((Segment) line, input_points, count, tolerance, test_results); } else throw new GeometryException("Invalid call."); }
private static int get_vertex_count_(Geometry geom) { int gt = geom.getType().value(); if (Geometry.isMultiVertex(gt)) { return ((MultiVertexGeometry) geom).getPointCount(); } else if (gt == Geometry.GeometryType.Point) { return 1; } else if (gt == Geometry.GeometryType.Envelope) { return 4; } else if (Geometry.isSegment(gt)) { return 2; } else { throw GeometryException.GeometryInternalError(); } }
private static int get_vertex_count_(Geometry geom) { int gt = geom.getType().value(); if (Geometry.isMultiVertex(gt)) { return ((MultiVertexGeometry) geom).getPointCount(); } else if (gt == Geometry.GeometryType.Point) { return 1; } else if (gt == Geometry.GeometryType.Envelope) { return 4; } else if (Geometry.isSegment(gt)) { return 2; } else { throw GeometryException.GeometryInternalError(); } }
m_b_linear = Geometry.isSegment(type);
m_b_linear = Geometry.isSegment(type);
/** * Returns count of geometry vertices: 1 for Point, 4 for Envelope, * get_point_count for MultiVertexGeometry types, 2 for segment types Returns 0 * if geometry is empty. * @param geom The geometry to get the vertex count for. * @return The vertex count. */ public static int vertex_count(Geometry geom) { Geometry.Type gt = geom.getType(); if (Geometry.isMultiVertex(gt.value())) return ((MultiVertexGeometry) geom).getPointCount(); if (geom.isEmpty()) return 0; if (gt == Geometry.Type.Envelope) return 4; if (gt == Geometry.Type.Point) return 1; if (Geometry.isSegment(gt.value())) return 2; throw new GeometryException("missing type"); }
/** * Returns count of geometry vertices: 1 for Point, 4 for Envelope, * get_point_count for MultiVertexGeometry types, 2 for segment types Returns 0 * if geometry is empty. * @param geom The geometry to get the vertex count for. * @return The vertex count. */ public static int vertex_count(Geometry geom) { Geometry.Type gt = geom.getType(); if (Geometry.isMultiVertex(gt.value())) return ((MultiVertexGeometry) geom).getPointCount(); if (geom.isEmpty()) return 0; if (gt == Geometry.Type.Envelope) return 4; if (gt == Geometry.Type.Point) return 1; if (Geometry.isSegment(gt.value())) return 2; throw new GeometryException("missing type"); }
private Geometry densifyByLength(Geometry geom) { if (geom.isEmpty() || geom.getDimension() < 1) return geom; int geometryType = geom.getType().value(); // TODO implement IsMultiPath and remove Polygon and Polyline call to // match Native // if (Geometry.IsMultiPath(geometryType)) if (geometryType == Geometry.GeometryType.Polygon) return densifyMultiPath((MultiPath) geom); else if (Geometry.GeometryType.Polyline == geometryType) return densifyMultiPath((MultiPath) geom); else if (Geometry.isSegment(geometryType)) return densifySegment((Segment) geom); else if (geometryType == Geometry.GeometryType.Envelope) return densifyEnvelope((Envelope) geom); else // TODO fix geometry exception to match native implementation throw GeometryException.GeometryInternalError();// GEOMTHROW(internal_error); // unreachable in java // return null; }
private Geometry densifyByLength(Geometry geom) { if (geom.isEmpty() || geom.getDimension() < 1) return geom; int geometryType = geom.getType().value(); // TODO implement IsMultiPath and remove Polygon and Polyline call to // match Native // if (Geometry.IsMultiPath(geometryType)) if (geometryType == Geometry.GeometryType.Polygon) return densifyMultiPath((MultiPath) geom); else if (Geometry.GeometryType.Polyline == geometryType) return densifyMultiPath((MultiPath) geom); else if (Geometry.isSegment(geometryType)) return densifySegment((Segment) geom); else if (geometryType == Geometry.GeometryType.Envelope) return densifyEnvelope((Envelope) geom); else // TODO fix geometry exception to match native implementation throw GeometryException.GeometryInternalError();// GEOMTHROW(internal_error); // unreachable in java // return null; }
static boolean hasNonEmptyBoundary(Geometry geom, ProgressTracker progress_tracker) { if (geom.isEmpty()) return false; Geometry.Type gt = geom.getType(); if (gt == Geometry.Type.Polygon) { if (geom.calculateArea2D() == 0) return false; return true; } else if (gt == Geometry.Type.Polyline) { boolean[] b = new boolean[1]; b[0] = false; calculatePolylineBoundary_(geom._getImpl(), progress_tracker, true, b); return b[0]; } else if (gt == Geometry.Type.Envelope) { return true; } else if (Geometry.isSegment(gt.value())) { if (!((Segment) geom).isClosed()) { return true; } return false; } else if (Geometry.isPoint(gt.value())) { return false; } return false; }
static boolean hasNonEmptyBoundary(Geometry geom, ProgressTracker progress_tracker) { if (geom.isEmpty()) return false; Geometry.Type gt = geom.getType(); if (gt == Geometry.Type.Polygon) { if (geom.calculateArea2D() == 0) return false; return true; } else if (gt == Geometry.Type.Polyline) { boolean[] b = new boolean[1]; b[0] = false; calculatePolylineBoundary_(geom._getImpl(), progress_tracker, true, b); return b[0]; } else if (gt == Geometry.Type.Envelope) { return true; } else if (Geometry.isSegment(gt.value())) { if (!((Segment) geom).isClosed()) { return true; } return false; } else if (Geometry.isPoint(gt.value())) { return false; } return false; }
Geometry _ConstructOffset() { int gt = m_inputGeometry.getType().value(); if (gt == Geometry.GeometryType.Line) { return _OffsetLine(); } if (gt == Geometry.GeometryType.Envelope) { return _OffsetEnvelope(); } if (Geometry.isSegment(gt)) { Polyline poly = new Polyline(); poly.addSegment((Segment) m_inputGeometry, true); m_inputGeometry = poly; return _ConstructOffset(); } if (gt == Geometry.GeometryType.Polyline) { Polyline polyline = new Polyline(); _OffsetMultiPath(polyline); return polyline; } if (gt == Geometry.GeometryType.Polygon) { Polygon polygon = new Polygon(); _OffsetMultiPath(polygon); return polygon; } // throw new GeometryException("not implemented"); return null; } }
Geometry _ConstructOffset() { int gt = m_inputGeometry.getType().value(); if (gt == Geometry.GeometryType.Line) { return _OffsetLine(); } if (gt == Geometry.GeometryType.Envelope) { return _OffsetEnvelope(); } if (Geometry.isSegment(gt)) { Polyline poly = new Polyline(); poly.addSegment((Segment) m_inputGeometry, true); m_inputGeometry = poly; return _ConstructOffset(); } if (gt == Geometry.GeometryType.Polyline) { Polyline polyline = new Polyline(); _OffsetMultiPath(polyline); return polyline; } if (gt == Geometry.GeometryType.Polygon) { Polygon polygon = new Polygon(); _OffsetMultiPath(polygon); return polygon; } // throw new GeometryException("not implemented"); return null; } }
} else if (Geometry.isSegment(gt)) { MultiPoint mp = new MultiPoint(geom.getDescription()); if (!geom.isEmpty() && !((Segment) geom).isClosed()) {
} else if (Geometry.isSegment(gt.value())) {
} else if (Geometry.isSegment(gt.value())) { Segment seg = (Segment) geometry; Polyline polyline = new Polyline(seg.getDescription());
} else if (Geometry.isSegment(gt)) { MultiPoint mp = new MultiPoint(geom.getDescription()); if (!geom.isEmpty() && !((Segment) geom).isClosed()) {
private static Geometry convertGeometry_(Geometry geometry, double tolerance) { int gt = geometry.getType().value(); if (Geometry.isSegment(gt)) { Polyline polyline = new Polyline(geometry.getDescription()); polyline.addSegment((Segment) geometry, true);
private static Geometry convertGeometry_(Geometry geometry, double tolerance) { int gt = geometry.getType().value(); if (Geometry.isSegment(gt)) { Polyline polyline = new Polyline(geometry.getDescription()); polyline.addSegment((Segment) geometry, true);