org.locationtech.jts.geom.Geometry.getBoundary()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(358)

本文整理了Java中org.locationtech.jts.geom.Geometry.getBoundary()方法的一些代码示例,展示了Geometry.getBoundary()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.getBoundary()方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称:Geometry
方法名:getBoundary

Geometry.getBoundary介绍

[英]Returns the boundary, or an empty geometry of appropriate dimension if this Geometry is empty. (In the case of zero-dimensional geometries, ' an empty GeometryCollection is returned.) For a discussion of this function, see the OpenGIS Simple Features Specification. As stated in SFS Section 2.1.13.1, "the boundary of a Geometry is a set of Geometries of the next lower dimension."
[中]返回边界,如果Geometry为空,则返回相应维度的空几何体。(对于零维几何图形,将返回一个空的GeometryCollection。)有关此功能的讨论,请参阅OpenGIS简单功能规范。如SFS第2.1.13.1节所述,“几何体的边界是一组下一个较低尺寸的几何体。”

代码示例

代码示例来源:origin: geotools/geotools

  1. public static Geometry boundary(Geometry arg0) {
  2. if (arg0 == null) return null;
  3. Geometry _this = arg0;
  4. return _this.getBoundary();
  5. }

代码示例来源:origin: geotools/geotools

  1. public Geometry getBoundary() {
  2. return geometry.getBoundary();
  3. }

代码示例来源:origin: geotools/geotools

  1. @DescribeProcess(
  2. title = "Boundary",
  3. description =
  4. "Returns a geometry boundary. For polygons, returns a linear ring or multi-linestring equal to the boundary of the polygon(s). For linestrings, returns a multipoint equal to the endpoints of the linestring. For points, returns an empty geometry collection."
  5. )
  6. @DescribeResult(description = "Boundary of the input geometry")
  7. public static Geometry boundary(
  8. @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) {
  9. return geom.getBoundary();
  10. }

代码示例来源:origin: geotools/geotools

  1. g = g.getBoundary(); // line or multiline m

代码示例来源:origin: geotools/geotools

  1. @DescribeProcess(title = "Split Polygon", description = "Splits a polygon by a linestring")
  2. @DescribeResult(description = "The collection of split polygons")
  3. public static Geometry splitPolygon(
  4. @DescribeParameter(name = "polygon", description = "Polygon to split") Geometry polygon,
  5. @DescribeParameter(name = "line", description = "Linestring to split by")
  6. LineString line) {
  7. Geometry nodedLinework = polygon.getBoundary().union(line);
  8. Geometry polys = polygonize(nodedLinework);
  9. // Only keep polygons which are inside the input
  10. List<Polygon> output = new ArrayList<Polygon>();
  11. for (int i = 0; i < polys.getNumGeometries(); i++) {
  12. Polygon candpoly = (Polygon) polys.getGeometryN(i);
  13. // use interior point to test for inclusion in parent
  14. if (polygon.contains(candpoly.getInteriorPoint())) {
  15. output.add(candpoly);
  16. }
  17. }
  18. return polygon.getFactory()
  19. .createGeometryCollection(GeometryFactory.toGeometryArray(output));
  20. }

代码示例来源:origin: locationtech/jts

  1. public static Geometry boundary(Geometry g) { return g.getBoundary(); }
  2. public static Geometry convexHull(Geometry g) { return g.convexHull(); }

代码示例来源:origin: geotools/geotools

  1. if (envelope.contains(polyGeom.getEnvelopeInternal())) {
  2. if (Polygon.class.isAssignableFrom(polyGeom.getClass())) {
  3. Geometry polyGeomBoundary = polyGeom.getBoundary();
  4. if (!polyGeomBoundary.contains(lineGeom)) {
  5. results.error(

代码示例来源:origin: orbisgis/h2gis

  1. /**
  2. * @param geometry Geometry instance
  3. * @return Geometry envelope
  4. */
  5. public static Geometry getBoundary(Geometry geometry, int srid) {
  6. if(geometry==null) {
  7. return null;
  8. }
  9. Geometry geometryEnvelope = geometry.getBoundary();
  10. geometryEnvelope.setSRID(srid);
  11. return geometryEnvelope;
  12. }

代码示例来源:origin: locationtech/jts

  1. /**
  2. * Gets the computed boundary.
  3. *
  4. * @return the boundary geometry
  5. */
  6. public Geometry getBoundary()
  7. {
  8. if (geom instanceof LineString) return boundaryLineString((LineString) geom);
  9. if (geom instanceof MultiLineString) return boundaryMultiLineString((MultiLineString) geom);
  10. return geom.getBoundary();
  11. }

代码示例来源:origin: Geomatys/geotoolkit

  1. /**
  2. * {@inheritDoc }
  3. */
  4. @Override
  5. public double getPerimeter() {
  6. return getJTSGeometry().getBoundary().getLength();
  7. }

代码示例来源:origin: locationtech/jts

  1. private void checkPositiveValid()
  2. {
  3. Geometry bufCurve = result.getBoundary();
  4. checkMinimumDistance(input, bufCurve, minValidDistance);
  5. if (! isValid) return;
  6. checkMaximumDistance(input, bufCurve, maxValidDistance);
  7. }

代码示例来源:origin: locationtech/jts

  1. /**
  2. * @todo Enable when #isSimple implemented
  3. */
  4. // public void testMultiPointIsSimple1() throws Exception {
  5. // Geometry g = reader.read("MULTIPOINT(10 10, 20 20, 30 30)");
  6. // assertTrue(g.isSimple());
  7. // }
  8. public void testMultiPointGetBoundary() throws Exception {
  9. Geometry g = reader.read("MULTIPOINT(10 10, 20 20, 30 30)");
  10. assertTrue(g.getBoundary().isEmpty());
  11. }

代码示例来源:origin: locationtech/jts

  1. public void testMultiPolygonGetBoundary1() throws Exception {
  2. Geometry g = reader.read("MULTIPOLYGON("
  3. + "( (0 0, 40 0, 40 40, 0 40, 0 0),"
  4. + " (10 10, 30 10, 30 30, 10 30, 10 10) ),"
  5. + "( (200 200, 210 200, 210 210, 200 200) ) )");
  6. Geometry b = reader.read("MULTILINESTRING("
  7. + "(0 0, 40 0, 40 40, 0 40, 0 0),"
  8. + "(10 10, 30 10, 30 30, 10 30, 10 10),"
  9. + "(200 200, 210 200, 210 210, 200 200))");
  10. assertTrue(b.equalsExact(g.getBoundary()));
  11. }

代码示例来源:origin: locationtech/jts

  1. public void test(int nPts)
  2. {
  3. builder.setTestDimension(1);
  4. Geometry target = builder.createSineStar(nPts).getBoundary();
  5. List lines = builder.createTestGeoms(target.getEnvelopeInternal(),
  6. NUM_LINES, 1.0, NUM_LINE_PTS);
  7. System.out.println();
  8. //System.out.println("Running with " + nPts + " points");
  9. test(target, lines);
  10. }

代码示例来源:origin: locationtech/jts

  1. public void testMultiLineStringGetBoundary2() throws Exception {
  2. Geometry g = reader.read("MULTILINESTRING("
  3. + "(0 0, 100 0, 50 50),"
  4. + "(50 50, 50 0))");
  5. Geometry m = reader.read("MULTIPOINT(0 0, 50 0)");
  6. assertTrue(m.equalsExact(g.getBoundary()));
  7. }

代码示例来源:origin: locationtech/jts

  1. public void testPolygonGetBoundary() throws Exception {
  2. Geometry g = reader.read("POLYGON("
  3. + "(0 0, 40 0, 40 40, 0 40, 0 0),"
  4. + "(10 10, 30 10, 30 30, 10 30, 10 10))");
  5. Geometry b = reader.read("MULTILINESTRING("
  6. + "(0 0, 40 0, 40 40, 0 40, 0 0),"
  7. + "(10 10, 30 10, 30 30, 10 30, 10 10))");
  8. assertTrue(b.equalsExact(g.getBoundary()));
  9. }

代码示例来源:origin: locationtech/jts

  1. Geometry[] createSineStars(int nPts)
  2. {
  3. SineStarFactory gsf = new SineStarFactory();
  4. gsf.setCentre(new Coordinate(0, 0));
  5. gsf.setSize(100);
  6. gsf.setNumPoints(nPts);
  7. Geometry g = gsf.createSineStar().getBoundary();
  8. gsf.setCentre(new Coordinate(0, separationDist));
  9. Geometry g2 = gsf.createSineStar().getBoundary();
  10. return new Geometry[] { g, g2 };
  11. }
  12. }

代码示例来源:origin: locationtech/jts

  1. LineString createTestLine(Coordinate base, double size, int nPts)
  2. {
  3. GeometricShapeFactory gsf = new GeometricShapeFactory();
  4. gsf.setCentre(base);
  5. gsf.setSize(size);
  6. gsf.setNumPoints(nPts);
  7. Geometry circle = gsf.createCircle();
  8. // System.out.println(circle);
  9. return (LineString) circle.getBoundary();
  10. }

代码示例来源:origin: locationtech/jts

  1. Geometry createLine(Coordinate base, double size, int nPts)
  2. {
  3. SineStarFactory gsf = new SineStarFactory();
  4. gsf.setCentre(base);
  5. gsf.setSize(size);
  6. gsf.setNumPoints(nPts);
  7. Geometry circle = gsf.createSineStar();
  8. // System.out.println(circle);
  9. return circle.getBoundary();
  10. }

代码示例来源:origin: locationtech/jts

  1. Geometry createLine(Coordinate base, double size, int nPts)
  2. {
  3. GeometricShapeFactory gsf = new GeometricShapeFactory();
  4. gsf.setCentre(base);
  5. gsf.setSize(size);
  6. gsf.setNumPoints(nPts);
  7. Geometry circle = gsf.createCircle();
  8. // System.out.println(circle);
  9. return circle.getBoundary();
  10. }

相关文章