com.vividsolutions.jts.geom.Polygon.getBoundary()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(105)

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

Polygon.getBoundary介绍

[英]Computes the boundary of this geometry
[中]计算此几何体的边界

代码示例

代码示例来源:origin: opentripplanner/OpenTripPlanner

Geometry boundary = hole.getBoundary();
if (boundary instanceof LinearRing) {
  lrholelist.add((LinearRing) boundary);

代码示例来源:origin: opentripplanner/OpenTripPlanner

/**
 * Safely add a vertex to this area. This creates edges to all other vertices unless those edges would cross one of the original edges.
 */
public void addVertex(IntersectionVertex newVertex, Graph graph) {
  GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory();
  if (edges.size() == 0) {
    throw new RuntimeException("Can't add a vertex to an empty area");
  }
  @SuppressWarnings("unchecked")
  HashSet<IntersectionVertex> verticesCopy = (HashSet<IntersectionVertex>) vertices.clone();
  VERTEX: for (IntersectionVertex v : verticesCopy) {
    LineString newGeometry = geometryFactory.createLineString(new Coordinate[] {
        newVertex.getCoordinate(), v.getCoordinate() });
    // ensure that new edge does not leave the bounds of the original area, or
    // fall into any holes
    if (!originalEdges.union(originalEdges.getBoundary()).contains(newGeometry)) {
      continue VERTEX;
    }
    // check to see if this splits multiple NamedAreas. This code is rather similar to
    // code in OSMGBI, but the data structures are different
    createSegments(newVertex, v, areas, graph);
  }
  vertices.add(newVertex);
}

代码示例来源:origin: com.vividsolutions/jts

/**
 * Computes the boundary of this geometry
 *
 * @return a lineal geometry (which may be empty)
 * @see Geometry#getBoundary
 */
public Geometry getBoundary() {
 if (isEmpty()) {
  return getFactory().createMultiLineString(null);
 }
 ArrayList allRings = new ArrayList();
 for (int i = 0; i < geometries.length; i++) {
  Polygon polygon = (Polygon) geometries[i];
  Geometry rings = polygon.getBoundary();
  for (int j = 0; j < rings.getNumGeometries(); j++) {
   allRings.add(rings.getGeometryN(j));
  }
 }
 LineString[] allRingsArray = new LineString[allRings.size()];
 return getFactory().createMultiLineString((LineString[]) allRings.toArray(allRingsArray));
}

代码示例来源:origin: org.geotools/gt-render

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

代码示例来源:origin: aseldawy/spatialhadoop2

if (!bigMBRPoly.contains(p)) {
 if (p instanceof Polygon) {
  p = p.intersection(bigMBRPoly).getBoundary().difference(bigMBRPoly.getBoundary());
 } else {
  p = p.intersection(bigMBRPoly);

代码示例来源:origin: com.vividsolutions/jts-core

/**
 * Computes the boundary of this geometry
 *
 * @return a lineal geometry (which may be empty)
 * @see Geometry#getBoundary
 */
public Geometry getBoundary() {
 if (isEmpty()) {
  return getFactory().createMultiLineString(null);
 }
 ArrayList allRings = new ArrayList();
 for (int i = 0; i < geometries.length; i++) {
  Polygon polygon = (Polygon) geometries[i];
  Geometry rings = polygon.getBoundary();
  for (int j = 0; j < rings.getNumGeometries(); j++) {
   allRings.add(rings.getGeometryN(j));
  }
 }
 LineString[] allRingsArray = new LineString[allRings.size()];
 return getFactory().createMultiLineString((LineString[]) allRings.toArray(allRingsArray));
}

代码示例来源:origin: osmlab/atlas

final Geometry clipped = target.intersection(polygon.getBoundary());
final String containedCountryCode = getGeometryProperty(polygon, ISOCountryTag.KEY);

代码示例来源:origin: kiselev-dv/gazetteer

GeometryFactory f = new GeometryFactory();
Geometry nodedLinework = polygon.getBoundary().union(line);
Polygonizer polygonizer = new Polygonizer();
polygonizer.add(LineStringExtracter.getLines(nodedLinework));

相关文章