本文整理了Java中org.locationtech.jts.geom.Geometry.covers()
方法的一些代码示例,展示了Geometry.covers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.covers()
方法的具体详情如下:
包路径:org.locationtech.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: geotools/geotools
public boolean covers(Geometry g) {
return geometry.covers(g);
}
代码示例来源:origin: mapsforge/mapsforge
/**
* @param geometry a JTS {@link Geometry} object representing the OSM entity
* @param tile the tile
* @param enlargementInMeter the enlargement of the tile in meters
* @return true, if the geometry is covered completely by this tile
*/
public static boolean coveredByTile(final Geometry geometry, final TileCoordinate tile, final int enlargementInMeter) {
Geometry bbox = tileToJTSGeometry(tile.getX(), tile.getY(), tile.getZoomlevel(), enlargementInMeter);
if (bbox.covers(geometry)) {
return true;
}
return false;
}
代码示例来源:origin: locationtech/jts
/**
* Default implementation.
*/
public boolean covers(Geometry g)
{
return baseGeom.covers(g);
}
代码示例来源:origin: locationtech/geowave
@Override
public boolean apply(Geometry geom1, Geometry geom2) {
return geom1.covers(geom2);
}
}
代码示例来源:origin: locationtech/jts
public boolean isTrue(Geometry g) {
return g.covers(mask);
}
});
代码示例来源:origin: locationtech/jts
public static boolean covers(Geometry a, Geometry b) { return a.covers(b); }
public static boolean coveredBy(Geometry a, Geometry b) { return a.coveredBy(b); }
代码示例来源:origin: 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: locationtech/jts
return g.covers(this);
代码示例来源:origin: locationtech/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: locationtech/jts
private void checkContainment(Geometry geom, Geometry buffer)
{
boolean isCovered = true;
String errMsg = "";
if (distance > 0) {
isCovered = buffer.covers(geom);
errMsg = "Geometry is not contained in (positive) buffer";
}
else if (distance < 0) {
errMsg = "Geometry does not contain (negative) buffer";
// covers is always false for empty geometries, so don't bother testing them
if (buffer.isEmpty()) {
isCovered = true;
}
else {
isCovered = geom.covers(buffer);
}
}
if (! isCovered) {
reportError(errMsg, null);
}
}
代码示例来源:origin: locationtech/jts
private void checkCovers(PreparedGeometry pg, Geometry g2)
{
boolean pgResult = pg.covers(g2);
boolean expected = pg.getGeometry().covers(g2);
if (pgResult != expected)
throw new IllegalStateException("PreparedGeometry.covers result does not match expected");
// System.out.println("Results match!");
}
代码示例来源:origin: no.ecc.vectortile/java-vector-tile
/**
* A short circuit clip to the tile extent (tile boundary + buffer) for
* points to improve performance. This method can be overridden to change
* clipping behavior. See also {@link #clipGeometry(Geometry)}.
*
* @see https://github.com/ElectronicChartCentre/java-vector-tile/issues/13
*/
protected boolean clipCovers(Geometry geom) {
if (geom instanceof Point) {
Point p = (Point) geom;
return clipGeometry.getEnvelopeInternal().covers(p.getCoordinate());
}
return clipGeometry.covers(geom);
}
代码示例来源:origin: ElectronicChartCentre/java-vector-tile
/**
* A short circuit clip to the tile extent (tile boundary + buffer) for
* points to improve performance. This method can be overridden to change
* clipping behavior. See also {@link #clipGeometry(Geometry)}.
*
* @see https://github.com/ElectronicChartCentre/java-vector-tile/issues/13
*/
protected boolean clipCovers(Geometry geom) {
if (geom instanceof Point) {
Point p = (Point) geom;
return clipGeometry.getEnvelopeInternal().covers(p.getCoordinate());
}
return clipGeometry.covers(geom);
}
代码示例来源:origin: locationtech/geowave
&& finalShape.covers(
new GeometryFactory().toGeometry(new Envelope(0, width, 0, height)))) {
代码示例来源:origin: 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: locationtech/geowave
gridToCRS);
if (footprintWithinTileScreenGeom.covers(
new GeometryFactory().toGeometry(fullTileEnvelope))) {
内容来源于网络,如有侵权,请联系作者删除!