本文整理汇总了Java中com.vividsolutions.jts.operation.union.CascadedPolygonUnion类的典型用法代码示例。如果您正苦于以下问题:Java CascadedPolygonUnion类的具体用法?Java CascadedPolygonUnion怎么用?Java CascadedPolygonUnion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CascadedPolygonUnion类属于com.vividsolutions.jts.operation.union包,在下文中一共展示了CascadedPolygonUnion类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPolygonsFromRanges
import com.vividsolutions.jts.operation.union.CascadedPolygonUnion; //导入依赖的package包/类
public static Geometry createPolygonsFromRanges( double[] xRanges, double[] yRanges ) {
List<Geometry> geomsList = new ArrayList<>();
int cols = xRanges.length - 1;
int rows = yRanges.length - 1;
for( int x = 0; x < cols - 1; x++ ) {
double x1 = xRanges[x];
double x2 = xRanges[x + 1];
for( int y = 0; y < rows - 1; y++ ) {
double y1 = xRanges[y];
double y2 = xRanges[y + 1];
Envelope env = new Envelope(x1, x2, y1, y2);
Polygon poly = GeometryUtilities.createPolygonFromEnvelope(env);
geomsList.add(poly);
}
}
Geometry union = CascadedPolygonUnion.union(geomsList);
return union;
}
示例2: process
import com.vividsolutions.jts.operation.union.CascadedPolygonUnion; //导入依赖的package包/类
@Execute
public void process() {
// create a geometry list of the input polygons
List<Geometry> inInundationGeomsList = FeatureUtilities.featureCollectionToGeometriesList(inInundationArea, false, null);
// make the union and merge of the polygons
Geometry union = CascadedPolygonUnion.union(inInundationGeomsList);
List<Geometry> removedHoles = removeHoles(union);
// store the results in the output feature collection
outInundationArea = new DefaultFeatureCollection();
SimpleFeatureCollection outMergedAreaFC = FeatureUtilities.featureCollectionFromGeometry(inInundationArea.getBounds()
.getCoordinateReferenceSystem(), removedHoles.toArray(GeometryUtilities.TYPE_POLYGON));
((DefaultFeatureCollection) outInundationArea).addAll(outMergedAreaFC);
}
示例3: process
import com.vividsolutions.jts.operation.union.CascadedPolygonUnion; //导入依赖的package包/类
@Execute
public void process() throws Exception {
checkNull(inBankfull);
List<Geometry> geoms = FeatureUtilities.featureCollectionToGeometriesList(inBankfull, true, null);
// creates a unique feature with multipolygons
Geometry union = CascadedPolygonUnion.union(geoms);
// makes a buffer of each geometry in the feature and merges the touching geometries
Geometry buffer = union.buffer(0.05);
// splits the remaining geometries (not touching)
List<Geometry> newGeoms = new ArrayList<Geometry>();
for( int i = 0; i < buffer.getNumGeometries(); i++ ) {
Geometry geometryN = buffer.getGeometryN(i);
if (geometryN instanceof Polygon) {
newGeoms.add(geometryN);
}
}
outBankfull = FeatureUtilities.featureCollectionFromGeometry(inBankfull.getBounds().getCoordinateReferenceSystem(),
newGeoms.toArray(GeometryUtilities.TYPE_POLYGON));
}
示例4: difference
import com.vividsolutions.jts.operation.union.CascadedPolygonUnion; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static Geometry difference(STRtree tree, AtomicInteger counter, Geometry geom) {
List<Geometry> query = tree.query(geom.getEnvelopeInternal());
log.info("{} {} {}", counter.getAndDecrement(), query.size(), geom.getEnvelopeInternal());
if (!query.isEmpty()) {
List<Geometry> collect = query.stream().map(t -> t.buffer(DELTA)).collect(toList());
return geom.difference(CascadedPolygonUnion.union(collect).buffer(-1 * DELTA));
}
return geom;
}
示例5: run
import com.vividsolutions.jts.operation.union.CascadedPolygonUnion; //导入依赖的package包/类
public void run() {
File rootFolder = new File(tomtomFolder);
List<String> countries = asList(rootFolder.list(directoryFileFilter()));
log.info("Listing tomtom files for {} countries : {} ", countries.size(), countries);
List<Geometry> allPolygons = countries.stream() //
.map(country -> new File(rootFolder.getAbsolutePath() + "/" + country)) //
.filter(CoastlineGenerator::hasA0Files) //
.map(file -> new File(file, getA0Files(file))) //
.flatMap(file -> readFeatures(file).stream()) //
.map(Feature::getGeometry) //
.map(CoastlineGenerator::cropIfNeeded) //
.collect(toList());
Geometry naturalEarthPolygon = getNaturalEarthGeometry();
log.info("Merging {} tomtom polygons with naturalEarth polygon", allPolygons.size());
allPolygons.add(naturalEarthPolygon);
MultiPolygon coastlineMultipolygon = (MultiPolygon) new CascadedPolygonUnion(allPolygons).union().reverse();
log.info("Serializing coastlines.");
for (int i = 0; i < coastlineMultipolygon.getNumGeometries(); i++) {
Polygon polygon = (Polygon) coastlineMultipolygon.getGeometryN(i);
serializer.write(GEOMETRY_FACTORY.createPolygon(polygon.getExteriorRing().getCoordinateSequence()), COASTLINE_TAG);
if (polygon.getNumInteriorRing() != 0) {
for (int j = 0; j < polygon.getNumInteriorRing(); j++) {
serializer.write(GEOMETRY_FACTORY.createPolygon(polygon.getInteriorRingN(j).getCoordinateSequence()), COASTLINE_TAG);
}
}
}
serializer.close();
}
示例6: convexHulls
import com.vividsolutions.jts.operation.union.CascadedPolygonUnion; //导入依赖的package包/类
private static Geometry convexHulls(Geometry g) {
int gN = g.getNumGeometries();
List<Geometry> sG = new ArrayList<Geometry>();
for(int i = 0; i < gN; i++) {
sG.add(g.getGeometryN(i).convexHull());
}
return new CascadedPolygonUnion(sG).union();
}
示例7: unionCascaded
import com.vividsolutions.jts.operation.union.CascadedPolygonUnion; //导入依赖的package包/类
public Geometry unionCascaded(List geoms)
{
return CascadedPolygonUnion.union(geoms);
}
示例8: getFloodingArea
import com.vividsolutions.jts.operation.union.CascadedPolygonUnion; //导入依赖的package包/类
private PreparedGeometry getFloodingArea( SimpleFeatureCollection inFloodingAreas ) throws Exception {
List<Geometry> geometriesList = FeatureUtilities.featureCollectionToGeometriesList(inFloodingAreas, true, null);
Geometry polygonUnion = CascadedPolygonUnion.union(geometriesList);
PreparedGeometry preparedGeometry = PreparedGeometryFactory.prepare(polygonUnion);
return preparedGeometry;
}
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:7,代码来源:OmsLW10_SingleTree_AreaToNetpointAssociator.java
示例9: fastUnion
import com.vividsolutions.jts.operation.union.CascadedPolygonUnion; //导入依赖的package包/类
public static Geometry fastUnion(List<Geometry> gs) {
return gs.isEmpty() ?
geometryFactory.createGeometryCollection(new Geometry[] {}) :
new CascadedPolygonUnion(gs).union();
}