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

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

本文整理了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

public static Geometry boundary(Geometry arg0) {
  if (arg0 == null) return null;
  Geometry _this = arg0;
  return _this.getBoundary();
}

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

public Geometry getBoundary() {
  return geometry.getBoundary();
}

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

@DescribeProcess(
  title = "Boundary",
  description =
      "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."
)
@DescribeResult(description = "Boundary of the input geometry")
public static Geometry boundary(
    @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) {
  return geom.getBoundary();
}

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

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

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

@DescribeProcess(title = "Split Polygon", description = "Splits a polygon by a linestring")
@DescribeResult(description = "The collection of split polygons")
public static Geometry splitPolygon(
    @DescribeParameter(name = "polygon", description = "Polygon to split") Geometry polygon,
    @DescribeParameter(name = "line", description = "Linestring to split by")
        LineString line) {
  Geometry nodedLinework = polygon.getBoundary().union(line);
  Geometry polys = polygonize(nodedLinework);
  // Only keep polygons which are inside the input
  List<Polygon> output = new ArrayList<Polygon>();
  for (int i = 0; i < polys.getNumGeometries(); i++) {
    Polygon candpoly = (Polygon) polys.getGeometryN(i);
    // use interior point to test for inclusion in parent
    if (polygon.contains(candpoly.getInteriorPoint())) {
      output.add(candpoly);
    }
  }
  return polygon.getFactory()
      .createGeometryCollection(GeometryFactory.toGeometryArray(output));
}

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

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

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

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

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

/**
 * @param geometry Geometry instance
 * @return Geometry envelope
 */
public static Geometry getBoundary(Geometry geometry, int srid) {
  if(geometry==null) {
    return null;
  }
  Geometry geometryEnvelope = geometry.getBoundary();
  geometryEnvelope.setSRID(srid);
  return geometryEnvelope;
}

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

/**
 * Gets the computed boundary.
 * 
 * @return the boundary geometry
 */
public Geometry getBoundary()
{
 if (geom instanceof LineString) return boundaryLineString((LineString) geom);
 if (geom instanceof MultiLineString) return boundaryMultiLineString((MultiLineString) geom);
 return geom.getBoundary();
}

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

/**
 * {@inheritDoc }
 */
@Override
public double getPerimeter() {
  return getJTSGeometry().getBoundary().getLength();
}

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

private void checkPositiveValid()
{
  Geometry bufCurve = result.getBoundary();
  checkMinimumDistance(input, bufCurve, minValidDistance);
  if (! isValid) return;
  
  checkMaximumDistance(input, bufCurve, maxValidDistance);
}

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

/**
 * @todo Enable when #isSimple implemented
 */
//  public void testMultiPointIsSimple1() throws Exception {
//    Geometry g = reader.read("MULTIPOINT(10 10, 20 20, 30 30)");
//    assertTrue(g.isSimple());
//  }

 public void testMultiPointGetBoundary() throws Exception {
  Geometry g = reader.read("MULTIPOINT(10 10, 20 20, 30 30)");
  assertTrue(g.getBoundary().isEmpty());
 }

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

public void testMultiPolygonGetBoundary1() throws Exception {
 Geometry g = reader.read("MULTIPOLYGON("
    + "(  (0 0, 40 0, 40 40, 0 40, 0 0),"
    + "   (10 10, 30 10, 30 30, 10 30, 10 10)  ),"
    + "(  (200 200, 210 200, 210 210, 200 200) )  )");
 Geometry b = reader.read("MULTILINESTRING("
    + "(0 0, 40 0, 40 40, 0 40, 0 0),"
    + "(10 10, 30 10, 30 30, 10 30, 10 10),"
    + "(200 200, 210 200, 210 210, 200 200))");
 assertTrue(b.equalsExact(g.getBoundary()));
}

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

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

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

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

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

public void testPolygonGetBoundary() throws Exception {
 Geometry g = reader.read("POLYGON("
    + "(0 0, 40 0, 40 40, 0 40, 0 0),"
    + "(10 10, 30 10, 30 30, 10 30, 10 10))");
 Geometry b = reader.read("MULTILINESTRING("
    + "(0 0, 40 0, 40 40, 0 40, 0 0),"
    + "(10 10, 30 10, 30 30, 10 30, 10 10))");
 assertTrue(b.equalsExact(g.getBoundary()));
}

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

Geometry[] createSineStars(int nPts)
 {
  SineStarFactory gsf = new SineStarFactory();
  gsf.setCentre(new Coordinate(0, 0));
  gsf.setSize(100);
  gsf.setNumPoints(nPts);
  
  Geometry g = gsf.createSineStar().getBoundary();
  
  gsf.setCentre(new Coordinate(0, separationDist));

  Geometry g2 = gsf.createSineStar().getBoundary();
  
  return new Geometry[] { g, g2 };
  
 }
}

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

LineString createTestLine(Coordinate base, double size, int nPts)
 {
  GeometricShapeFactory gsf = new GeometricShapeFactory();
  gsf.setCentre(base);
  gsf.setSize(size);
  gsf.setNumPoints(nPts);
  Geometry circle = gsf.createCircle();
//    System.out.println(circle);
  return (LineString) circle.getBoundary();
 }

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

Geometry createLine(Coordinate base, double size, int nPts)
 {
  SineStarFactory gsf = new SineStarFactory();
  gsf.setCentre(base);
  gsf.setSize(size);
  gsf.setNumPoints(nPts);
  Geometry circle = gsf.createSineStar();
//    System.out.println(circle);
  return circle.getBoundary();
 }

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

Geometry createLine(Coordinate base, double size, int nPts)
 {
  GeometricShapeFactory gsf = new GeometricShapeFactory();
  gsf.setCentre(base);
  gsf.setSize(size);
  gsf.setNumPoints(nPts);
  Geometry circle = gsf.createCircle();
//    System.out.println(circle);
  return circle.getBoundary();
 }

相关文章