本文整理了Java中org.locationtech.jts.geom.Geometry.intersects()
方法的一些代码示例,展示了Geometry.intersects()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.intersects()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称:Geometry
方法名:intersects
[英]Tests whether this geometry intersects the argument geometry.
The intersects
predicate has the following equivalent definitions:
The two geometries have at least one point in common
The DE-9IM Intersection Matrix for the two geometries matches at least one of the patterns
[T********]
[*T*******]
[***T*****]
[****T****]
! g.disjoint(this) = true
(intersects
is the inverse of disjoint
)
[中]测试此几何图形是否与参数几何图形相交。intersects
谓词具有以下等效定义:
*这两种几何图形至少有一个共同点
*两种几何图形的DE-9IM相交矩阵至少与其中一种图案匹配
[T********]
[*T*******]
[***T*****]
[****T****]
! g.disjoint(this) = true
(intersects
是disjoint
的倒数)
代码示例来源:origin: geoserver/geoserver
Geometry coverageBounds =
JTS.toGeometry((Envelope) new ReferencedEnvelope(grid.getEnvelope2D()));
if (coverageBounds.intersects(rasterFilter)) {
final ParameterValueGroup param = cropParams.clone();
param.parameter("source").setValue(grid);
代码示例来源:origin: geotools/geotools
public static boolean intersects(Geometry arg0, Geometry arg1) {
if (arg0 == null || arg1 == null) return false;
Geometry _this = arg0;
return _this.intersects(arg1);
}
代码示例来源:origin: geotools/geotools
public boolean intersects(Geometry g) {
return geometry.intersects(g);
}
代码示例来源:origin: geotools/geotools
/**
* Tests if the interior of the <code>Shape</code> intersects the interior of a specified <code>
* Rectangle2D</code>. This method might conservatively return <code>true</code> when:
*
* <ul>
* <li>there is a high probability that the <code>Rectangle2D</code> and the <code>Shape
* </code> intersect, but
* <li>the calculations to accurately determine this intersection are prohibitively expensive.
* </ul>
*
* This means that this method might return <code>true</code> even though the <code>Rectangle2D
* </code> does not intersect the <code>Shape</code>.
*
* @param r the specified <code>Rectangle2D</code>
* @return <code>true</code> if the interior of the <code>Shape</code> and the interior of the
* specified <code>Rectangle2D</code> intersect, or are both highly likely to intersect and
* intersection calculations would be too expensive to perform; <code>false</code>
* otherwise.
* @see #intersects(double, double, double, double)
*/
public boolean intersects(Rectangle2D r) {
Geometry rect = rectangleToGeometry(r);
return geometry.intersects(rect);
}
代码示例来源:origin: geotools/geotools
/**
* Tests if the interior of the <code>Shape</code> intersects the interior of a specified <code>
* Rectangle2D</code>. This method might conservatively return <code>true</code> when:
*
* <ul>
* <li>there is a high probability that the <code>Rectangle2D</code> and the <code>Shape
* </code> intersect, but
* <li>the calculations to accurately determine this intersection are prohibitively expensive.
* </ul>
*
* This means that this method might return <code>true</code> even though the <code>Rectangle2D
* </code> does not intersect the <code>Shape</code>.
*
* @param r the specified <code>Rectangle2D</code>
* @return <code>true</code> if the interior of the <code>Shape</code> and the interior of the
* specified <code>Rectangle2D</code> intersect, or are both highly likely to intersect and
* intersection calculations would be too expensive to perform; <code>false</code>
* otherwise.
* @see #intersects(double, double, double, double)
*/
public boolean intersects(Rectangle2D r) {
Geometry rect = rectangleToGeometry(r);
return geometry.intersects(rect);
}
代码示例来源:origin: geotools/geotools
Geometry rect = createRectangle(x, y, w, h);
return geometry.intersects(rect);
代码示例来源:origin: geotools/geotools
/** Helper method for {@link #intersects(Geometry, Geometry) intersects(Geometry, Geometry)} */
private static boolean intersects(GeometryCollection gc, Geometry g) {
final int size = gc.getNumGeometries();
for (int i = 0; i < size; i++) {
Geometry g1 = gc.getGeometryN(i);
if (g1.intersects(g)) return true;
}
return false;
}
代码示例来源:origin: geotools/geotools
Geometry rect = createRectangle(x, y, w, h);
return geometry.intersects(rect);
代码示例来源:origin: geotools/geotools
protected boolean basicEvaluate(Geometry left, Geometry right) {
Envelope envLeft = left.getEnvelopeInternal();
Envelope envRight = right.getEnvelopeInternal();
if (envRight.intersects(envLeft)) {
return left.intersects(right);
} else {
return false;
}
// Note that this is a pretty permissive logic
// if the type has somehow been mis-set (can't happen externally)
// then true is returned in all cases
}
代码示例来源:origin: geotools/geotools
protected final boolean basicEvaluate(Geometry left, Geometry right) {
Envelope envLeft = left.getEnvelopeInternal();
Envelope envRight = right.getEnvelopeInternal();
return envRight.intersects(envLeft) && left.intersects(right);
}
}
代码示例来源:origin: geotools/geotools
@Override
public boolean checkAndReserve(List<AffineTransform2D> transforms)
throws MismatchedDimensionException, TransformException {
List<Geometry> transformedConflictBounds = new ArrayList<Geometry>();
boolean conflict = false;
for (AffineTransform2D tx2d : transforms) {
if (conflict) {
break;
}
Geometry cbTransformed = JTS.transform(conflictBounds, tx2d);
transformedConflictBounds.add(cbTransformed);
List results = qt.query(cbTransformed.getEnvelopeInternal());
for (Iterator it = results.iterator(); it.hasNext(); ) {
Geometry candidate = (Geometry) it.next();
if (candidate.intersects(cbTransformed)) {
// location conflict
conflict = true;
break;
}
}
}
// reserve the area if no conflict
if (!conflict) {
for (Geometry tcb : transformedConflictBounds) {
qt.insert(tcb.getEnvelopeInternal(), tcb);
}
}
return !conflict;
}
代码示例来源:origin: geotools/geotools
if (geometry.intersects(extentGeometry)) {
代码示例来源:origin: geotools/geotools
@DescribeProcess(title = "Intersects Test", description = "Tests if two geometries intersect.")
@DescribeResult(description = "True if the inputs intersect")
public static boolean intersects(
@DescribeParameter(name = "a", description = "First input geometry") Geometry a,
@DescribeParameter(name = "b", description = "Second input geometry") Geometry b) {
return a.intersects(b);
}
代码示例来源:origin: mapsforge/mapsforge
for (int l = bbox[0].getY(); l <= bbox[1].getY(); l++) {
Geometry bboxGeometry = tileToJTSGeometry(k, l, baseZoomLevel, enlargementInMeter);
if (bboxGeometry.intersects(wayGeometry)) {
matchedTiles.add(new TileCoordinate(k, l, baseZoomLevel));
代码示例来源:origin: geotools/geotools
/**
* Tests whether the two geometries intersect.
*
* <p>This method relies completely on {@link Geometry#intersects(Geometry)} but also tries to
* unroll <TT>GeometryCollection</TT>s.
*
* @param g1
* @param g2
* @return true if the two geometries intersect.
*/
public static boolean intersects(Geometry g1, Geometry g2) {
Utilities.ensureNonNull("g1", g1);
Utilities.ensureNonNull("g2", g2);
if (g1 instanceof GeometryCollection) {
if (g2 instanceof GeometryCollection) {
return intersects((GeometryCollection) g1, (GeometryCollection) g2);
} else {
return intersects((GeometryCollection) g1, g2);
}
} else {
if (g2 instanceof GeometryCollection) {
return intersects((GeometryCollection) g2, g1);
} else {
return g1.intersects(g2);
}
}
}
代码示例来源:origin: mapsforge/mapsforge
/**
* A tile on zoom level <i>z</i> has exactly 16 sub tiles on zoom level <i>z+2</i>. For each of these 16 sub tiles
* it is analyzed if the given way needs to be included. The result is represented as a 16 bit short value. Each bit
* represents one of the 16 sub tiles. A bit is set to 1 if the sub tile needs to include the way. Representation is
* row-wise.
*
* @param geometry the geometry which is analyzed
* @param tile the tile which is split into 16 sub tiles
* @param enlargementInMeter amount of pixels that is used to enlarge the bounding box of the way and the tiles in the mapping
* process
* @return a 16 bit short value that represents the information which of the sub tiles needs to include the way
*/
public static short computeBitmask(final Geometry geometry, final TileCoordinate tile, final int enlargementInMeter) {
List<TileCoordinate> subtiles = tile
.translateToZoomLevel((byte) (tile.getZoomlevel() + SUBTILE_ZOOMLEVEL_DIFFERENCE));
short bitmask = 0;
int tileCounter = 0;
for (TileCoordinate subtile : subtiles) {
Geometry bbox = tileToJTSGeometry(subtile.getX(), subtile.getY(), subtile.getZoomlevel(),
enlargementInMeter);
if (bbox.intersects(geometry)) {
bitmask |= TILE_BITMASK_VALUES[tileCounter];
}
tileCounter++;
}
return bitmask;
}
代码示例来源:origin: geotools/geotools
intersects = inclusionGeometry.intersects(bb);
} catch (FactoryException | MismatchedDimensionException | TransformException e) {
intersects = inclusionGeometry.intersects(bb);
代码示例来源:origin: geotools/geotools
if (envelope.contains(rLineGeom.getEnvelopeInternal())) {
if (LineString.class.isAssignableFrom(rLineGeom.getClass())) {
if (lineGeom.intersects(rLineGeom)) {
if (!hasPair(
((LineString) lineGeom).getCoordinateSequence(),
代码示例来源:origin: geotools/geotools
if (currentGeom
.getEnvelope()
.intersects(((Geometry) second.getDefaultGeometry()))) {
代码示例来源:origin: geotools/geotools
if (g1.intersects(g2) != expected) {
results.error(
f1,
内容来源于网络,如有侵权,请联系作者删除!