本文整理了Java中com.vividsolutions.jts.geom.Geometry.getArea()
方法的一些代码示例,展示了Geometry.getArea()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.getArea()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:getArea
[英]Returns the area of this Geometry
. Areal Geometries have a non-zero area. They override this function to compute the area. Others return 0.0
[中]返回此Geometry
的区域。面积几何图形具有非零面积。它们覆盖此函数以计算面积。其他人返回0.0
代码示例来源:origin: osmandapp/Osmand
@Override
public boolean accept(Geometry geometry) {
boolean accept = true;
if((geometry instanceof Polygon || geometry instanceof MultiPolygon)
&& geometry.getArea() < minArea) {
accept = false;
} else if((geometry instanceof LineString || geometry instanceof MultiLineString)
&& geometry.getLength() < minLength) {
accept = false;
}
return accept;
}
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Returns the area of this <code>GeometryCollection</code>
*
* @return the area of the polygon
*/
public double getArea()
{
double area = 0.0;
for (int i = 0; i < geometries.length; i++) {
area += geometries[i].getArea();
}
return area;
}
代码示例来源:origin: com.vividsolutions/jts
static double area(Collection geoms)
{
double area = 0.0;
for (Iterator i = geoms.iterator(); i.hasNext(); ) {
Geometry geom = (Geometry) i.next();
area += geom.getArea();
}
return area;
}
代码示例来源:origin: com.vividsolutions/jts
private void checkArea()
{
double inputArea = input.getArea();
double resultArea = result.getArea();
if (distance > 0.0
&& inputArea > resultArea) {
isValid = false;
errorMsg = "Area of positive buffer is smaller than input";
errorIndicator = result;
}
if (distance < 0.0
&& inputArea < resultArea) {
isValid = false;
errorMsg = "Area of negative buffer is larger than input";
errorIndicator = result;
}
report("Area");
}
代码示例来源:origin: com.vividsolutions/jts
public double measure(Geometry g1, Geometry g2)
{
double areaInt = g1.intersection(g2).getArea();
double areaUnion = g1.union(g2).getArea();
return areaInt / areaUnion;
}
代码示例来源:origin: opentripplanner/OpenTripPlanner
private void createNamedAreas(AreaEdgeList edgeList, Ring ring, Collection<Area> areas) {
Polygon containingArea = ring.toJtsPolygon();
for (Area area : areas) {
Geometry intersection = containingArea.intersection(area.toJTSMultiPolygon());
if (intersection.getArea() == 0) {
continue;
}
NamedArea namedArea = new NamedArea();
OSMWithTags areaEntity = area.parent;
int cls = StreetEdge.CLASS_OTHERPATH;
cls |= OSMFilter.getStreetClasses(areaEntity);
namedArea.setStreetClass(cls);
String id = "way (area) " + areaEntity.getId() + " (splitter linking)";
I18NString name = handler.getNameForWay(areaEntity, id);
namedArea.setName(name);
WayProperties wayData = wayPropertySet.getDataForWay(areaEntity);
Double safety = wayData.getSafetyFeatures().first;
namedArea.setBicycleSafetyMultiplier(safety);
namedArea.setOriginalEdges(intersection);
StreetTraversalPermission permission = OSMFilter.getPermissionsForEntity(areaEntity,
StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE);
namedArea.setPermission(permission);
edgeList.addArea(namedArea);
}
}
代码示例来源:origin: org.geotools/gt-main
static public double area(Geometry arg0)
{
if (arg0 == null) return -1d;
Geometry _this = arg0;
return _this.getArea();
}
代码示例来源:origin: org.orbisgis/h2gis
public static Double getArea(Geometry geometry) {
if(geometry==null) {
return null;
}
return geometry.getArea();
}
}
代码示例来源:origin: org.geotools/gt2-main
static public double area(Geometry arg0)
{
Geometry _this = arg0;
return _this.getArea();
}
代码示例来源:origin: org.orbisgis/h2spatial
public static Double getArea(Geometry geometry) {
if(geometry==null) {
return null;
}
return geometry.getArea();
}
}
代码示例来源:origin: org.orbisgis/h2gis-functions
public static Double getArea(Geometry geometry) {
if(geometry==null) {
return null;
}
return geometry.getArea();
}
}
代码示例来源:origin: com.vividsolutions/jts-example
static double area(Collection geoms)
{
double area = 0.0;
for (Iterator i = geoms.iterator(); i.hasNext(); ) {
Geometry geom = (Geometry) i.next();
area += geom.getArea();
}
return area;
}
代码示例来源:origin: com.vividsolutions/jts-core
public double measure(Geometry g1, Geometry g2)
{
double areaInt = g1.intersection(g2).getArea();
double areaUnion = g1.union(g2).getArea();
return areaInt / areaUnion;
}
代码示例来源:origin: org.jboss.teiid/teiid-engine
public static double area(GeometryType geom) throws FunctionExecutionException {
Geometry g = getGeometry(geom);
return g.getArea();
}
代码示例来源:origin: org.geotools/gt-jts-wrapper
public final double getArea() {
com.vividsolutions.jts.geom.Geometry jtsGeom = getJTSGeometry();
return jtsGeom.getArea();
}
代码示例来源:origin: org.geotools/gt2-jts-wrapper
public final double getArea() {
com.vividsolutions.jts.geom.Geometry jtsGeom = getJTSGeometry();
return jtsGeom.getArea();
}
代码示例来源:origin: BaseXdb/basex
@Override
public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
return Dbl.get(checkGeo(0, qc).getArea());
}
}
代码示例来源:origin: org.geoserver/wms
@Override
protected Double getSortAttributeValue(SimpleFeature f) {
Geometry g = (Geometry) f.getAttribute(attribute);
if (g instanceof MultiPoint)
return (double) ((MultiPoint) g).getNumGeometries();
if (g instanceof Polygon || g instanceof MultiPolygon)
return g.getArea();
else
return g.getLength();
}
代码示例来源:origin: org.geoserver/kml
@Override
protected Double getSortAttributeValue(SimpleFeature f) {
Geometry g = (Geometry) f.getAttribute(attribute);
if (g instanceof MultiPoint)
return (double) ((MultiPoint) g).getNumGeometries();
if (g instanceof Polygon || g instanceof MultiPolygon)
return g.getArea();
else
return g.getLength();
}
代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig
public double getArea(Geometry geometry, AreaUnit targetUnit) {
double area = transformGeometry(geometry).getArea();
if (targetUnit == AreaUnit.Default) {
return area;
}
return UnitConverter.convertArea(Measure.valueOf(area, areaUnit), targetUnit);
}
内容来源于网络,如有侵权,请联系作者删除!