本文整理匯總了Java中com.vividsolutions.jts.geom.GeometryFactory.createGeometryCollection方法的典型用法代碼示例。如果您正苦於以下問題:Java GeometryFactory.createGeometryCollection方法的具體用法?Java GeometryFactory.createGeometryCollection怎麽用?Java GeometryFactory.createGeometryCollection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vividsolutions.jts.geom.GeometryFactory
的用法示例。
在下文中一共展示了GeometryFactory.createGeometryCollection方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: repair
import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
/**
*
* @param geom
* @return
*/
public static Geometry repair (Geometry geom) {
GeometryFactory factory = geom.getFactory();
if (geom instanceof MultiPolygon) {
MultiPolygon mp = (MultiPolygon)geom;
Polygon[] polys = new Polygon[mp.getNumGeometries()];
for (int i = 0; i < mp.getNumGeometries(); i += 1) {
polys[i] = repair((Polygon)mp.getGeometryN(i));
}
return factory.createMultiPolygon(polys);
} else if (geom instanceof Polygon) {
return repair((Polygon)geom);
} else if (geom.getGeometryType().equals("GeometryCollection")) {
GeometryCollection gc = (GeometryCollection)geom;
Geometry[] geoms = new Geometry[gc.getNumGeometries()];
for (int i = 0; i < gc.getNumGeometries(); i += 1) {
geoms[i] = repair(gc.getGeometryN(i));
}
Thread.dumpStack();
return factory.createGeometryCollection(geoms);
} else {
return(geom);
}
}
示例2: smoothGeometryCollection
import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
private static Geometry smoothGeometryCollection(GeometryFactory factory,
GeometrySmoother smoother, Geometry geom, double fit) {
final int N = geom.getNumGeometries();
Geometry[] smoothed = new Geometry[N];
for (int i = 0; i < N; i++) {
smoothed[i] = smooth(geom.getGeometryN(i), fit, factory, smoother);
}
return factory.createGeometryCollection(smoothed);
}
示例3: getTriangles
import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
/**
* Gets the geometry for the triangles in a triangulated subdivision as a {@link GeometryCollection}
* of triangular {@link Polygon}s.
*
* @param geomFact the GeometryFactory to use
* @return a GeometryCollection of triangular Polygons
*/
public Geometry getTriangles(GeometryFactory geomFact) {
List triPtsList = this.getTriangleCoordinates(false);
Polygon[] tris = new Polygon[triPtsList.size()];
int i = 0;
for (Object aTriPtsList : triPtsList) {
Coordinate[] triPt = (Coordinate[]) aTriPtsList;
tris[i++] = geomFact
.createPolygon(geomFact.createLinearRing(triPt), null);
}
return geomFact.createGeometryCollection(tris);
}
示例4: createGeometryCollection
import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
public static GeometryCollection createGeometryCollection(
GeometryFactory factory, Geometry... parts) {
return factory.createGeometryCollection(parts);
}
示例5: bufferUnion
import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
private Geometry bufferUnion(Geometry g0, Geometry g1) {
GeometryFactory factory = g0.getFactory();
Geometry gColl = factory.createGeometryCollection(new Geometry[] { g0, g1 });
Geometry unionAll = gColl.buffer(0.0);
return unionAll;
}
示例6: createEmptyResult
import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
/**
* Creates an empty result geometry of the appropriate dimension,
* based on the dimensions of the inputs.
* The created geometry is always an atomic geometry,
* not a collection.
* <p>
* Implements the following rules:
* <ul>
* <li><code>intersection</code> - result has the dimension of the lowest input dimension
* <li><code>union</code> - result has the dimension of the highest input dimension
* <li><code>difference</code> - result has the dimension of the left-hand input
* <li><code>symDifference</code> - result has the dimension of the highest input dimension
* (since symDifference is the union of the differences).
* <li>
*
* @param opCode the overlay operation being performed
* @param a an input geometry
* @param b an input geometry
* @param geomFact the geometry factory being used for the operation
* @return an empty atomic geometry of the appropriate dimension
*/
public static Geometry createEmptyResult(int opCode, Geometry a, Geometry b, GeometryFactory geomFact) {
Geometry result = null;
switch (resultDimension(opCode, a, b)) {
case -1:
result = geomFact.createGeometryCollection(new Geometry[0]);
break;
case 0:
result = geomFact.createPoint((Coordinate) null);
break;
case 1:
result = geomFact.createLineString((Coordinate[]) null);
break;
case 2:
result = geomFact.createPolygon(null, null);
break;
}
return result;
}
示例7: getVoronoiDiagram
import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
/**
* 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 = this.getVoronoiCellPolygons(geomFact);
return geomFact.createGeometryCollection(GeometryFactory.toGeometryArray(vorCells));
}