本文整理了Java中com.vividsolutions.jts.geom.Geometry.getInteriorPoint()
方法的一些代码示例,展示了Geometry.getInteriorPoint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.getInteriorPoint()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:getInteriorPoint
[英]Computes an interior point of this Geometry
. An interior point is guaranteed to lie in the interior of the Geometry, if it possible to calculate such a point exactly. Otherwise, the point may lie on the boundary of the geometry.
The interior point of an empty geometry is POINT EMPTY
.
[中]计算此Geometry
的内部点。如果可以精确计算内点,则保证内点位于几何体的内部。否则,该点可能位于几何体的边界上。
空几何体的内部点为POINT EMPTY
。
代码示例来源:origin: org.geotools/gt-main
static public Geometry interiorPoint(Geometry arg0)
{
if (arg0 == null) return null;
Geometry _this = arg0;
return _this.getInteriorPoint();
}
代码示例来源:origin: org.geotools/gt2-main
static public Geometry interiorPoint(Geometry arg0)
{
Geometry _this = arg0;
return _this.getInteriorPoint();
}
代码示例来源:origin: org.orbisgis/h2gis-functions
/**
* @param geometry Valid Geometry instance
* @return A Point that lie on the surface or null if input geometry is not a surface.
*/
public static Geometry getInteriorPoint(Geometry geometry) {
if(geometry==null) {
return null;
}
return geometry.getInteriorPoint();
}
}
代码示例来源:origin: org.orbisgis/h2spatial
/**
* @param geometry Valid Geometry instance
* @return A Point that lie on the surface or null if input geometry is not a surface.
*/
public static Geometry getInteriorPoint(Geometry geometry) {
if(geometry==null) {
return null;
}
return geometry.getInteriorPoint();
}
}
代码示例来源:origin: org.orbisgis/h2gis
/**
* @param geometry Valid Geometry instance
* @return A Point that lie on the surface or null if input geometry is not a surface.
*/
public static Geometry getInteriorPoint(Geometry geometry) {
if(geometry==null) {
return null;
}
return geometry.getInteriorPoint();
}
}
代码示例来源:origin: org.geotools/gt-render
public Point getInteriorPoint() {
return geometry.getInteriorPoint();
}
代码示例来源:origin: BaseXdb/basex
@Override
public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
return toElement(checkGeo(0, qc).getInteriorPoint(), qc);
}
}
代码示例来源:origin: org.teiid/teiid-engine
public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException {
Geometry g = getGeometry(geom);
Point point = g.getInteriorPoint();
if (point == null) {
return null;
}
return getGeometryType(point, geom.getSrid());
}
代码示例来源:origin: org.geotools/gt-jts-wrapper
/**
* Returns a point interior to the geometry.
*/
public final DirectPosition getRepresentativePoint() {
com.vividsolutions.jts.geom.Geometry jtsGeom = getJTSGeometry();
com.vividsolutions.jts.geom.Point p = jtsGeom.getInteriorPoint();
return JTSUtils.pointToDirectPosition(p, getCoordinateReferenceSystem());
}
代码示例来源:origin: org.geotools/gt2-jts-wrapper
/**
* Returns a point interior to the geometry.
*/
public final DirectPosition getRepresentativePoint() {
com.vividsolutions.jts.geom.Geometry jtsGeom = getJTSGeometry();
com.vividsolutions.jts.geom.Point p = jtsGeom.getInteriorPoint();
return JTSUtils.pointToDirectPosition(p, getCoordinateReferenceSystem());
}
代码示例来源:origin: teiid/teiid
public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException {
Geometry g = getGeometry(geom);
Point point = g.getInteriorPoint();
if (point == null) {
return null;
}
return getGeometryType(point, geom.getSrid());
}
代码示例来源:origin: org.orbisgis/core-map
/**
* Return one point for each geometry
*
* @param rs
* @param fid
* @param mt
* @return
* @throws ParameterException
* @throws IOException
* @throws SQLException
*/
public Point2D getPointShape(ResultSet rs, long fid, MapTransform mt, Geometry theGeom)
throws ParameterException, IOException, SQLException {
Geometry geom = getGeometry(rs, fid, theGeom);
AffineTransform at = mt.getAffineTransform();
Point point;
try {
point = geom.getInteriorPoint();
} catch (TopologyException ex) {
LOGGER.error("getPointShape :: TopologyException: ", ex);
point = geom.getCentroid();
}
return at.transform(new Point2D.Double(point.getX(), point.getY()), null);
}
代码示例来源:origin: org.jboss.teiid/teiid-engine
public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException {
Geometry g = getGeometry(geom);
Point point = g.getInteriorPoint();
if (point == null) {
return null;
}
point.setSRID(geom.getSrid());
return getGeometryType(point);
}
代码示例来源:origin: org.geotools/gt2-render
private static Geometry pointInGeometry(Geometry g) {
if(g instanceof Polygon) {
Point p = g.getCentroid();
// if the geometry is heavily generalized centroid computation may fail and return NaN
if(Double.isNaN(p.getX()) || Double.isNaN(p.getY()))
return g.getFactory().createPoint(g.getCoordinate());
if(!g.contains(p))
try {
return g.getInteriorPoint();
} catch(Exception e) {
// generalized geometries might make interior point go bye bye
return p;
}
else
return p;
} else {
return g.getCentroid();
}
}
}
代码示例来源:origin: org.geotools/gt-render
private static Geometry pointInGeometry(Geometry g) {
Point p = g.getCentroid();
if(g instanceof Polygon) {
// if the geometry is heavily generalized centroid computation may fail and return NaN
if(Double.isNaN(p.getX()) || Double.isNaN(p.getY()))
return g.getFactory().createPoint(g.getCoordinate());
// otherwise let's check if the point is inside. Again, this check and "getInteriorPoint"
// will work only if the geometry is valid
if(g.isValid() && !g.contains(p)) {
try {
p = g.getInteriorPoint();
} catch(Exception e) {
// generalized geometries might make interior point go bye bye
return p;
}
} else {
return p;
}
}
return p;
}
代码示例来源:origin: org.n52.sensorweb.sos/inspire-api
/**
* Get the point from samplingGeometry or featureOfInterest
*
* @return The {@link Point}
*/
private Point getPoint() {
Point point = null;
if (isSetSpatialFilteringProfileParameter()) {
Geometry geometry = getSpatialFilteringProfileParameter().getValue().getValue();
point = geometry.getInteriorPoint();
point.setSRID(geometry.getSRID());
} else {
if (getObservationConstellation().getFeatureOfInterest() instanceof AbstractSamplingFeature
&& ((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest()).isSetGeometry()) {
Geometry geometry =
((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest()).getGeometry();
point = geometry.getInteriorPoint();
point.setSRID(geometry.getSRID());
}
}
return point;
}
代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig
public SimpleFeature next() throws NoSuchElementException {
SimpleFeature sourceFeature = delegate.next();
for (Object attribute : sourceFeature.getAttributes()) {
if (attribute instanceof Geometry) {
// centroid or interior point
Geometry geometry = (Geometry) attribute;
Point center = geometry.getCentroid();
if (useInside && shapeType == SimpleShapeType.POLYGON
&& !geometry.contains(center)) {
center = geometry.getInteriorPoint();
}
attribute = center;
}
builder.add(attribute);
}
SimpleFeature nextFeature = builder.buildFeature(sourceFeature.getID());
builder.reset();
return nextFeature;
}
}
代码示例来源:origin: org.n52.shetland/shetland
/**
* Get the point from samplingGeometry or featureOfInterest
*
* @return The {@link Point}
*/
private Point getPoint() {
Point point = null;
if (isSetSpatialFilteringProfileParameter()) {
Geometry geometry = getSpatialFilteringProfileParameter().getValue().getValue();
point = geometry.getInteriorPoint();
point.setSRID(geometry.getSRID());
} else {
if (getObservationConstellation().getFeatureOfInterest() instanceof AbstractSamplingFeature
&& ((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest())
.isSetGeometry()) {
Geometry geometry =
((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest()).getGeometry();
point = geometry.getInteriorPoint();
point.setSRID(geometry.getSRID());
}
}
return point;
}
代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig
public SimpleFeature next() throws NoSuchElementException {
SimpleFeature sourceFeature = delegate.next();
SimpleFeature nextFeature = builder.buildFeature(sourceFeature.getID());
// transfer attributes
transferAttribute(sourceFeature, nextFeature);
// calculate xy coordinates
Geometry g = (Geometry) sourceFeature.getDefaultGeometry();
Point center = useInside ? g.getInteriorPoint() : g.getCentroid();
if (transformer != null) {
try {
center.setUserData(sourceFeature.getFeatureType()
.getCoordinateReferenceSystem());
center = (Point) transformer.transform(center);
} catch (TransformException e) {
String msg = "Error occured transforming " + center.toString();
LOGGER.log(Level.WARNING, msg);
}
}
nextFeature.setAttribute(xField, center.getX());
nextFeature.setAttribute(yField, center.getY());
return nextFeature;
}
}
代码示例来源:origin: org.geoserver.extension/dxf-core
private void writeInsertWithAttributes(String layer, String ownerHandle, String name, SimpleFeature f) throws IOException {
writeGroup(0, "INSERT");
writeOwnerHandle(ownerHandle);
writeHandle("Geometry");
writeSubClass("AcDbEntity");
writeLayer(layer);
writeSubClass("AcDbBlockReference");
writeGroup(66, " 1");
writeName(name);
Geometry geometry = (Geometry)f.getDefaultGeometry();
Point intPoint = geometry.getInteriorPoint();
writePoint(intPoint.getX(), intPoint.getY(), 0.0);
writeAttributes(layer, ownerHandle, f);
writeGroup(0, "SEQEND");
writeHandle("Geometry");
// String handle = getNewHandle("AttDef");
// writeGroup(5, handle);
writeOwnerHandle(ownerHandle);
writeSubClass("AcDbEntity");
writeLayer(layer);
}
内容来源于网络,如有侵权,请联系作者删除!