本文整理匯總了Java中com.vividsolutions.jts.geom.Geometry.getGeometryN方法的典型用法代碼示例。如果您正苦於以下問題:Java Geometry.getGeometryN方法的具體用法?Java Geometry.getGeometryN怎麽用?Java Geometry.getGeometryN使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vividsolutions.jts.geom.Geometry
的用法示例。
在下文中一共展示了Geometry.getGeometryN方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: polyStats
import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
private static FeatureStats polyStats(Geometry geom) {
final FeatureStats featureStats = new FeatureStats();
for (int i = 0; i < geom.getNumGeometries(); ++i) {
final Polygon nextPoly = (Polygon) geom.getGeometryN(i);
// Stats: exterior ring
final LineString exteriorRing = nextPoly.getExteriorRing();
featureStats.totalPts += exteriorRing.getNumPoints();
featureStats.repeatedPts += checkRepeatedPoints2d(exteriorRing);
// Stats: interior rings
for (int ringIndex = 0; ringIndex < nextPoly.getNumInteriorRing(); ++ringIndex) {
final LineString nextInteriorRing = nextPoly.getInteriorRingN(ringIndex);
featureStats.totalPts += nextInteriorRing.getNumPoints();
featureStats.repeatedPts += checkRepeatedPoints2d(nextInteriorRing);
}
}
return featureStats;
}
示例2: splitMultiPolygons
import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
private void splitMultiPolygons(){
List<Geometry>clone=new ArrayList<>(maskGeometries);
for(Geometry gt:clone){
if(gt instanceof MultiPolygon){
int n=gt.getNumGeometries();
for(int i=0;i<n;i++){
Polygon pp=(Polygon)gt.getGeometryN(i);
maskGeometries.add(pp);
}
maskGeometries.remove(gt);
}
}
}
示例3: splitMultiPolygons
import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
/**
*
*/
public void splitMultiPolygons(){
List<Geometry>clone=new ArrayList<>(this.geoms);
for(Geometry gt:clone){
if(gt instanceof MultiPolygon){
int n=gt.getNumGeometries();
for(int i=0;i<n;i++){
Polygon pp=(Polygon)gt.getGeometryN(i);
put(pp,(AttributesGeometry)pp.getUserData());
}
geoms.remove(gt);
}
}
}
示例4: pointStats
import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
private static FeatureStats pointStats(Geometry geom) {
final FeatureStats featureStats = new FeatureStats();
final HashSet<Point> pointSet = new HashSet<>(geom.getNumPoints());
featureStats.totalPts = geom.getNumPoints();
for (int i = 0; i < geom.getNumGeometries(); ++i) {
final Point p = (Point) geom.getGeometryN(i);
featureStats.repeatedPts += pointSet.add(p) ? 0 : 1;
}
return featureStats;
}
示例5: lineStats
import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
private static FeatureStats lineStats(Geometry geom) {
final FeatureStats featureStats = new FeatureStats();
for (int i = 0; i < geom.getNumGeometries(); ++i) {
final LineString lineString = (LineString) geom.getGeometryN(i);
featureStats.totalPts += lineString.getNumPoints();
featureStats.repeatedPts += checkRepeatedPoints2d(lineString);
}
return featureStats;
}
示例6: clusterizeGeometry
import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
private static Geometry clusterizeGeometry(final Geometry geometry,
final double distance_ratio)
{
if (geometry == null)
{
return null;
}
int number_geometries = geometry.getNumGeometries();
if (number_geometries > 1)
{
Geometry [] clustered_geometries =
new Geometry [number_geometries];
for (int igeom=0; igeom<number_geometries-1; igeom++)
{
Geometry current_geometry = geometry.getGeometryN(igeom);
Point current_centroid = current_geometry.getCentroid();
if ((current_geometry == null) ||
(current_centroid == null))
{
// TODO Warning
continue;
}
ArrayList<Geometry> current_cluster = new ArrayList<Geometry>();
current_cluster.add(current_geometry);
for (int jgeom=igeom+1; jgeom<number_geometries; jgeom++)
{
Geometry next_geometry = geometry.getGeometryN(jgeom);
Point next_centroid = next_geometry.getCentroid();
if ((next_geometry == null) ||
(next_centroid == null))
{
// TODO Warning
continue;
}
double distance = current_geometry.distance(next_geometry);
double centroids_distance =
current_centroid.distance(next_centroid);
if (distance < (centroids_distance * distance_ratio))
{
current_cluster.add(next_geometry);
}
}
Geometry [] current_cluster_array =
new Geometry [current_cluster.size()];
clustered_geometries[igeom] =
geometry.getFactory().createGeometryCollection(
current_cluster.toArray(current_cluster_array));
}
clustered_geometries[number_geometries-1] =
geometry.getGeometryN(number_geometries-1);
return convexHullOneLevel(
geometry.getFactory().createGeometryCollection(
clustered_geometries)).union();
}
else
{
return geometry;
}
}