com.vividsolutions.jts.triangulate.quadedge.QuadEdgeSubdivision.getVoronoiCellPolygons()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(94)

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

QuadEdgeSubdivision.getVoronoiCellPolygons介绍

[英]Gets a List of Polygons for the Voronoi cells of this triangulation.

The userData of each polygon is set to be the Coordinateof the cell site. This allows easily associating external data associated with the sites to the cells.
[中]

代码示例

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

/**
  * Gets the cells in the Voronoi diagram for this triangulation.
  * The cells are returned as a {@link GeometryCollection} of {@link Polygon}s
 * <p>
 * The userData of each polygon is set to be the {@link Coordinate}
 * of the cell site.  This allows easily associating external 
 * data associated with the sites to the cells.
  * 
  * @param geomFact a geometry factory
  * @return a GeometryCollection of Polygons
  */
public Geometry getVoronoiDiagram(GeometryFactory geomFact)
{
 List vorCells = getVoronoiCellPolygons(geomFact);
 return geomFact.createGeometryCollection(GeometryFactory.toGeometryArray(vorCells));   
}

代码示例来源:origin: matsim-org/matsim

public static void main(String[] args) {
    GeometryFactory geometryFactory = new GeometryFactory();
    
    Collection<Coordinate> sites = new ArrayList<>();
    sites.add(new Coordinate(70, 70));
    sites.add(new Coordinate(50, 150));
    sites.add(new Coordinate(150, 50));
    sites.add(new Coordinate(150, 150));
    sites.add(new Coordinate(250, 50));
    sites.add(new Coordinate(250, 150));
    sites.add(new Coordinate(350, 50));
    sites.add(new Coordinate(370, 170));
    
    VoronoiDiagramBuilder voronoiDiagramBuilder = new VoronoiDiagramBuilder();
    voronoiDiagramBuilder.setSites(sites);        
        
    List<Polygon> polygons = voronoiDiagramBuilder.getSubdivision().getVoronoiCellPolygons(geometryFactory);
    
    BoundingBox boundingBox = BoundingBox.createBoundingBox(0, 0, 400, 200);
    Polygon boundingPolygon = VoronoiGeometryUtils.createBoundingPolygon(boundingBox);
    Collection<Geometry> cutGeometries = VoronoiGeometryUtils.cutPolygonsByBoundary(polygons, boundingPolygon);
    Collection<SimpleFeature> features = VoronoiGeometryUtils.createFeaturesFromPolygons(cutGeometries);
    ShapeFileWriter.writeGeometries(features, "/Users/dominik/voronoi_test.shp");
  }
}

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

/**
  * Gets the cells in the Voronoi diagram for this triangulation.
  * The cells are returned as a {@link GeometryCollection} of {@link Polygon}s
 * <p>
 * The userData of each polygon is set to be the {@link Coordinate}
 * of the cell site.  This allows easily associating external 
 * data associated with the sites to the cells.
  * 
  * @param geomFact a geometry factory
  * @return a GeometryCollection of Polygons
  */
public Geometry getVoronoiDiagram(GeometryFactory geomFact)
{
 List vorCells = getVoronoiCellPolygons(geomFact);
 return geomFact.createGeometryCollection(GeometryFactory.toGeometryArray(vorCells));   
}

代码示例来源:origin: matsim-org/matsim

static Collection<Geometry> determineVoronoiShapes(ActivityFacilities measuringPoints, BoundingBox box) {
  LOG.warn("Started creating Voronoi shapes.");
  Collection<Coordinate> sites = new ArrayList<>();
  
  for (ActivityFacility measuringPoint : measuringPoints.getFacilities().values()) {
    Coordinate coordinate = new Coordinate(measuringPoint.getCoord().getX(), measuringPoint.getCoord().getY());
    sites.add(coordinate);
  }
  
  VoronoiDiagramBuilder voronoiDiagramBuilder = new VoronoiDiagramBuilder();
  voronoiDiagramBuilder.setSites(sites);        
  List<Polygon> polygons = voronoiDiagramBuilder.getSubdivision().getVoronoiCellPolygons(geometryFactory);
  Polygon boundingPolygon = createBoundingPolygon(box);
  Collection<Geometry> geometries = cutPolygonsByBoundary(polygons, boundingPolygon);
  
  LOG.warn("Finished creating Voronoi shapes.");
  return geometries;
}

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

@SuppressWarnings("unchecked")
Collection<Polygon> cityVoronoiPolygons = 
  subdivision.getVoronoiCellPolygons(fatory);

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

.getVoronoiCellPolygons(fatory);

相关文章