本文整理了Java中com.vividsolutions.jts.geom.Geometry.covers()
方法的一些代码示例,展示了Geometry.covers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.covers()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:covers
[英]Tests whether this geometry covers the argument geometry.
The covers
predicate has the following equivalent definitions:
Every point of the other geometry is a point of this geometry.
The DE-9IM Intersection Matrix for the two geometries matches at least one of the following patterns:
[T*****FF*]
[*T****FF*]
[***T**FF*]
[****T*FF*]
g.coveredBy(this) = true
(covers
is the converse of #coveredBy)
If either geometry is empty, the value of this predicate is false
.
This predicate is similar to #contains, but is more inclusive (i.e. returns true
for more cases). In particular, unlike contains
it does not distinguish between points in the boundary and in the interior of geometries. For most situations, covers
should be used in preference to contains
. As an added benefit, covers
is more amenable to optimization, and hence should be more performant.
[中]测试此几何图形是否包含参数几何图形。covers
谓词具有以下等效定义:
*其他几何图形的每个点都是此几何图形的一个点。
*两种几何图形的DE-9IM相交矩阵至少匹配以下模式之一:
[T*****FF*]
[*T****FF*]
[***T**FF*]
[****T*FF*]
g.coveredBy(this) = true
covers
是#coveredBy的反义词)false
。true
)。特别是,与contains
不同,它不区分几何体边界和内部的点。对于大多数情况,covers
应该优先于contains
使用。作为一个额外的好处,covers
更易于优化,因此应该更高效。代码示例来源:origin: com.vividsolutions/jts
/**
* Default implementation.
*/
public boolean covers(Geometry g)
{
return baseGeom.covers(g);
}
代码示例来源:origin: com.vividsolutions/jts
return g.covers(this);
代码示例来源:origin: com.vividsolutions/jts
/**
* Computes the full topological <tt>covers</tt> predicate.
* Used when short-circuit tests are not conclusive.
*
* @param geom the test geometry
* @return true if this prepared polygon covers the test geometry
*/
protected boolean fullTopologicalPredicate(Geometry geom)
{
boolean result = prepPoly.getGeometry().covers(geom);
return result;
}
代码示例来源:origin: com.vividsolutions/jts-core
/**
* Default implementation.
*/
public boolean covers(Geometry g)
{
return baseGeom.covers(g);
}
代码示例来源:origin: org.geotools/gt-render
public boolean covers(Geometry g) {
return geometry.covers(g);
}
代码示例来源:origin: org.orbisgis/h2gis-functions
/**
* Returns true if no point in geometry B is outside geometry A.
*
* @param geomA Geometry A
* @param geomB Geometry B
* @return True if no point in geometry B is outside geometry A
*/
public static Boolean covers(Geometry geomA, Geometry geomB) {
if(geomA == null||geomB == null){
return null;
}
return geomA.covers(geomB);
}
}
代码示例来源:origin: org.orbisgis/h2gis
/**
* Returns true if no point in geometry B is outside geometry A.
*
* @param geomA Geometry A
* @param geomB Geometry B
* @return True if no point in geometry B is outside geometry A
*/
public static Boolean covers(Geometry geomA, Geometry geomB) {
if(geomA == null||geomB == null){
return null;
}
return geomA.covers(geomB);
}
}
代码示例来源:origin: com.vividsolutions/jts-core
return g.covers(this);
代码示例来源:origin: DataSystemsLab/GeoSpark
public boolean match(Geometry spatialObject, Geometry queryWindow)
{
if (considerBoundaryIntersection) {
if (queryWindow.intersects(spatialObject)) { return true; }
}
else {
if (queryWindow.covers(spatialObject)) { return true; }
}
return false;
}
}
代码示例来源:origin: DataSystemsLab/GeoSpark
private boolean geoMatch(Geometry left, Geometry right)
{
//log.warn("Check "+left.toText()+" with "+right.toText());
return considerBoundaryIntersection ? left.intersects(right) : left.covers(right);
}
}
代码示例来源:origin: com.vividsolutions/jts-core
/**
* Computes the full topological <tt>covers</tt> predicate.
* Used when short-circuit tests are not conclusive.
*
* @param geom the test geometry
* @return true if this prepared polygon covers the test geometry
*/
protected boolean fullTopologicalPredicate(Geometry geom)
{
boolean result = prepPoly.getGeometry().covers(geom);
return result;
}
代码示例来源:origin: org.datasyslab/geospark
private boolean geoMatch(Geometry left, Geometry right)
{
//log.warn("Check "+left.toText()+" with "+right.toText());
return considerBoundaryIntersection ? left.intersects(right) : left.covers(right);
}
}
代码示例来源:origin: org.datasyslab/geospark
public boolean match(Geometry spatialObject, Geometry queryWindow)
{
if (considerBoundaryIntersection) {
if (queryWindow.intersects(spatialObject)) { return true; }
}
else {
if (queryWindow.covers(spatialObject)) { return true; }
}
return false;
}
}
代码示例来源:origin: NationalSecurityAgency/datawave
public static boolean covers(Object fieldValue, String geoString) {
Geometry otherGeom = GeometryNormalizer.parseGeometry(geoString);
Geometry thisGeom = getGeometryFromFieldValue(fieldValue);
return thisGeom.covers(otherGeom);
}
代码示例来源:origin: matsim-org/matsim
if (geometry.covers(geometryFactory.createPoint(CoordUtils.createGeotoolsCoordinate(coord)))) {
if (!measurePointPolygons.containsKey(measurePointId)) {
measurePointPolygons.put(measurePointId, geometry);
代码示例来源:origin: org.orbisgis/h2gis
/**
*
* @param g1 Geometry instance or null
* @param g2 Geometry instance or null
* @return minimum distance in meters between two geometries
*/
private static Double distancePolygonPolygon(Geometry g1, Geometry g2) {
Double distance = Double.MAX_VALUE;
Double ringDistance;
if (g1.covers(g2) || g2.covers(g1)) {
return 0.0;
}
for (int i = 0; i < ((Polygon) g1).getExteriorRing().getNumPoints(); i++) {
for (int j = 0; j < ((Polygon) g2).getExteriorRing().getNumPoints(); j++) {
ringDistance = distancePointToPoint(((Polygon) g1).getExteriorRing().getPointN(i), ((Polygon) g2).getExteriorRing().getPointN(j));
if (ringDistance < distance) {
distance = ringDistance;
}
}
}
return distance;
}
代码示例来源:origin: org.orbisgis/h2gis-functions
/**
*
* @param g1 Geometry instance or null
* @param g2 Geometry instance or null
* @return minimum distance in meters between two geometries
*/
private static Double distancePolygonPolygon(Geometry g1, Geometry g2) {
Double distance = Double.MAX_VALUE;
Double ringDistance;
if (g1.covers(g2) || g2.covers(g1)) {
return 0.0;
}
for (int i = 0; i < ((Polygon) g1).getExteriorRing().getNumPoints(); i++) {
for (int j = 0; j < ((Polygon) g2).getExteriorRing().getNumPoints(); j++) {
ringDistance = distancePointToPoint(((Polygon) g1).getExteriorRing().getPointN(i), ((Polygon) g2).getExteriorRing().getPointN(j));
if (ringDistance < distance) {
distance = ringDistance;
}
}
}
return distance;
}
代码示例来源:origin: org.integratedmodelling/klab-engine
public double getCoverage(Cell cell, boolean simpleIntersection) {
checkPreparedShape();
if (preparedShape == null) {
if (simpleIntersection) {
Geometry gm = makePoint(cell);
return gm.intersects(value) ? 1.0 : 0.0;
}
Geometry gm = makeCell(cell.getMinX(), cell.getMinY(), cell.getMaxX(), cell
.getMaxY());
return gm.covers(value) ? 1.0
: (gm.intersection(value).getArea() / gm.getArea());
}
if (simpleIntersection) {
return preparedShape.covers(makePoint(cell)) ? 1 : 0;
}
Geometry gm = makeCell(cell.getMinX(), cell.getMinY(), cell.getMaxX(), cell
.getMaxY());
return preparedShape.covers(gm) ? 1.0
: (gm.intersection(value).getArea() / gm.getArea());
}
内容来源于网络,如有侵权,请联系作者删除!