Geometry coverageBounds = JTS.toGeometry((Envelope) new ReferencedEnvelope(grid.getEnvelope2D())); if (coverageBounds.intersects(rasterFilter)) { final ParameterValueGroup param = cropParams.clone(); param.parameter("source").setValue(grid);
public static boolean intersects(Geometry arg0, Geometry arg1) { if (arg0 == null || arg1 == null) return false; Geometry _this = arg0; return _this.intersects(arg1); }
public boolean intersects(Geometry g) { return geometry.intersects(g); }
/** * 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); }
/** * 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); }
Geometry rect = createRectangle(x, y, w, h); return geometry.intersects(rect);
/** 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; }
Geometry rect = createRectangle(x, y, w, h); return geometry.intersects(rect);
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 }
protected final boolean basicEvaluate(Geometry left, Geometry right) { Envelope envLeft = left.getEnvelopeInternal(); Envelope envRight = right.getEnvelopeInternal(); return envRight.intersects(envLeft) && left.intersects(right); } }
@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; }
if (geometry.intersects(extentGeometry)) {
@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); }
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));
/** * 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); } } }
/** * 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; }
intersects = inclusionGeometry.intersects(bb); } catch (FactoryException | MismatchedDimensionException | TransformException e) { intersects = inclusionGeometry.intersects(bb);
if (envelope.contains(rLineGeom.getEnvelopeInternal())) { if (LineString.class.isAssignableFrom(rLineGeom.getClass())) { if (lineGeom.intersects(rLineGeom)) { if (!hasPair( ((LineString) lineGeom).getCoordinateSequence(),
if (currentGeom .getEnvelope() .intersects(((Geometry) second.getDefaultGeometry()))) {
if (g1.intersects(g2) != expected) { results.error( f1,