本文整理匯總了Java中com.vividsolutions.jts.geom.Geometry.getFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java Geometry.getFactory方法的具體用法?Java Geometry.getFactory怎麽用?Java Geometry.getFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vividsolutions.jts.geom.Geometry
的用法示例。
在下文中一共展示了Geometry.getFactory方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: repair
import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的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: transformIntoPointGeometryCollection
import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
/**
* Transform into GeometryCollection.
*
* @param geom input geometry
* @return a geometry collection
*/
private static GeometryCollection transformIntoPointGeometryCollection(Geometry geom) {
UniqueCoordinateArrayFilter filter = new UniqueCoordinateArrayFilter();
geom.apply(filter);
Coordinate[] coord = filter.getCoordinates();
Geometry[] geometries = new Geometry[coord.length];
for (int i = 0; i < coord.length; i++) {
Coordinate[] c = new Coordinate[]{coord[i]};
CoordinateArraySequence cs = new CoordinateArraySequence(c);
geometries[i] = new Point(cs, geom.getFactory());
}
return new GeometryCollection(geometries, geom.getFactory());
}
示例3: ConcaveHull
import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
/**
* Create a new concave hull construction for the input {@link Geometry}.
*
* @param geometry
* @param threshold
*/
public ConcaveHull(Geometry geometry, double threshold) {
this.geometries = transformIntoPointGeometryCollection(geometry);
this.threshold = threshold;
this.geomFactory = geometry.getFactory();
}