public static boolean contains(Geometry arg0, Geometry arg1) { if (arg0 == null || arg1 == null) return false; Geometry _this = arg0; return _this.contains(arg1); }
public boolean contains(Geometry g) { return geometry.contains(g); }
/** * Tests if the interior of the <code>Shape</code> entirely contains the specified <code> * Rectangle2D</code>. This method might conservatively return <code>false</code> when: * * <ul> * <li>the <code>intersect</code> method returns <code>true</code> and * <li>the calculations to determine whether or not the <code>Shape</code> entirely contains * the <code>Rectangle2D</code> are prohibitively expensive. * </ul> * * This means that this method might return <code>false</code> even though the <code>Shape * </code> contains the <code>Rectangle2D</code>. The <code>Area</code> class can be used to * perform more accurate computations of geometric intersection for any <code>Shape</code> * object if a more precise answer is required. * * @param r The specified <code>Rectangle2D</code> * @return <code>true</code> if the interior of the <code>Shape</code> entirely contains the * <code>Rectangle2D</code>; <code>false</code> otherwise or, if the <code>Shape</code> * contains the <code>Rectangle2D</code> and the <code>intersects</code> method returns * <code>true</code> and the containment calculations would be too expensive to perform. * @see #contains(double, double, double, double) */ public boolean contains(Rectangle2D r) { Geometry rect = rectangleToGeometry(r); return geometry.contains(rect); }
/** * Tests if the interior of the <code>Shape</code> entirely contains the specified <code> * Rectangle2D</code>. This method might conservatively return <code>false</code> when: * * <ul> * <li>the <code>intersect</code> method returns <code>true</code> and * <li>the calculations to determine whether or not the <code>Shape</code> entirely contains * the <code>Rectangle2D</code> are prohibitively expensive. * </ul> * * This means that this method might return <code>false</code> even though the <code>Shape * </code> contains the <code>Rectangle2D</code>. The <code>Area</code> class can be used to * perform more accurate computations of geometric intersection for any <code>Shape</code> * object if a more precise answer is required. * * @param r The specified <code>Rectangle2D</code> * @return <code>true</code> if the interior of the <code>Shape</code> entirely contains the * <code>Rectangle2D</code>; <code>false</code> otherwise or, if the <code>Shape</code> * contains the <code>Rectangle2D</code> and the <code>intersects</code> method returns * <code>true</code> and the containment calculations would be too expensive to perform. * @see #contains(double, double, double, double) */ public boolean contains(Rectangle2D r) { Geometry rect = rectangleToGeometry(r); return geometry.contains(rect); }
Geometry rect = createRectangle(x, y, w, h); return geometry.contains(rect);
/** * Tests if a specified {@link Point2D}is inside the boundary of the <code>Shape</code>. * * @param p a specified <code>Point2D</code> * @return <code>true</code> if the specified <code>Point2D</code> is inside the boundary of the * <code>Shape</code>; <code>false</code> otherwise. */ public boolean contains(Point2D p) { Coordinate coord = new Coordinate(p.getX(), p.getY()); Geometry point = geometry.getFactory().createPoint(coord); return geometry.contains(point); }
Geometry rect = createRectangle(x, y, w, h); return geometry.contains(rect);
/** * Tests if a specified {@link Point2D} is inside the boundary of the <code>Shape</code>. * * @param p a specified <code>Point2D</code> * @return <code>true</code> if the specified <code>Point2D</code> is inside the boundary of the * <code>Shape</code>; <code>false</code> otherwise. */ public boolean contains(Point2D p) { Coordinate coord = new Coordinate(p.getX(), p.getY()); Geometry point = geometry.getFactory().createPoint(coord); return geometry.contains(point); }
@Override protected boolean basicEvaluate(Geometry left, Geometry right) { Envelope envLeft = left.getEnvelopeInternal(); Envelope envRight = right.getEnvelopeInternal(); if (envLeft.contains(envRight)) return left.contains(right); return false; }
/** * Tests if the specified coordinates are inside the boundary of the <code>Shape</code>. * * @param x the specified coordinates, x value * @param y the specified coordinates, y value * @return <code>true</code> if the specified coordinates are inside the <code>Shape</code> * boundary; <code>false</code> otherwise. */ public boolean contains(double x, double y) { Coordinate coord = new Coordinate(x, y); Geometry point = geometry.getFactory().createPoint(coord); return geometry.contains(point); }
/** * Tests if the specified coordinates are inside the boundary of the <code>Shape</code>. * * @param x the specified coordinates, x value * @param y the specified coordinates, y value * @return <code>true</code> if the specified coordinates are inside the <code>Shape</code> * boundary; <code>false</code> otherwise. */ public boolean contains(double x, double y) { Coordinate coord = new Coordinate(x, y); Geometry point = geometry.getFactory().createPoint(coord); return geometry.contains(point); }
@DescribeProcess( title = "Contains Test", description = "Tests if no points of the second geometry lie in the exterior of the first geometry and at least one point of the interior of second geometry lies in the interior of first geometry." ) @DescribeResult(description = "True if the first input contains the second input") public static boolean contains( @DescribeParameter(name = "a", description = "First input geometry") Geometry a, @DescribeParameter( name = "b", description = "Second input geometry, tested to be contained in first geometry" ) Geometry b) { return a.contains(b); }
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; }
/** * TODO: should we use a spatial index? Would be warranted only if the input has a very * large amount of sub-lines * * @param ls * @return */ private LineString getOriginator(LineString ls) { LineString original = null; for (LineString ol : originalLines) { if (ls.equals(ol) || ls.overlaps(ol) || ol.contains(ls)) { original = ol; break; } } if (original == null) { // sigh, there might be a small difference in the coordinate values, // go for a more expensive, but tolerant search for (LineString ol : originalLines) { if (ol.buffer(PointDistance.EPS_METERS).contains(ls)) { original = ol; break; } } } return original; } }
@DescribeProcess(title = "Split Polygon", description = "Splits a polygon by a linestring") @DescribeResult(description = "The collection of split polygons") public static Geometry splitPolygon( @DescribeParameter(name = "polygon", description = "Polygon to split") Geometry polygon, @DescribeParameter(name = "line", description = "Linestring to split by") LineString line) { Geometry nodedLinework = polygon.getBoundary().union(line); Geometry polys = polygonize(nodedLinework); // Only keep polygons which are inside the input List<Polygon> output = new ArrayList<Polygon>(); for (int i = 0; i < polys.getNumGeometries(); i++) { Polygon candpoly = (Polygon) polys.getGeometryN(i); // use interior point to test for inclusion in parent if (polygon.contains(candpoly.getInteriorPoint())) { output.add(candpoly); } } return polygon.getFactory() .createGeometryCollection(GeometryFactory.toGeometryArray(output)); }
if (envelope.contains(polyGeom.getEnvelopeInternal())) { if (Polygon.class.isAssignableFrom(polyGeom.getClass())) { if (!polyGeom.contains(lineGeom)) { results.error( poly, "Polygon does not contain the specified Line.");
if (!lineGeom.contains(p1)) {
if (Polygon.class.isAssignableFrom(polyGeom.getClass())) { Geometry polyGeomBoundary = polyGeom.getBoundary(); if (!polyGeomBoundary.contains(lineGeom)) { results.error( poly, "Boundary does not contain the specified Line.");
if (!ls.getBoundary().contains(pt)) { r = true;
if (g1.overlaps(g2) != expected || g1.contains(g2) != expected) { results.error( f1,