/** * Create a new contains computer for two geometries. * * @param rectangle a rectangular geometry */ public RectangleContains(Polygon rectangle) { rectEnv = rectangle.getEnvelopeInternal(); }
/** * Create a new intersects computer for a rectangle. * * @param rectangle * a rectangular Polygon */ public RectangleIntersects(Polygon rectangle) { this.rectangle = rectangle; rectEnv = rectangle.getEnvelopeInternal(); }
/** * Creates a visitor for checking rectangle intersection * with segments * * @param rectangle the query rectangle */ public RectangleIntersectsSegmentVisitor(Polygon rectangle) { rectEnv = rectangle.getEnvelopeInternal(); rectIntersector = new RectangleLineIntersector(rectEnv); }
public GeometryContainsPointVisitor(Polygon rectangle) { this.rectSeq = rectangle.getExteriorRing().getCoordinateSequence(); rectEnv = rectangle.getEnvelopeInternal(); }
/** * Create a new intersects computer for a rectangle. * * @param rectangle * a rectangular Polygon */ public RectangleIntersects(Polygon rectangle) { this.rectangle = rectangle; rectEnv = rectangle.getEnvelopeInternal(); }
/** * Create a new contains computer for two geometries. * * @param rectangle a rectangular geometry */ public RectangleContains(Polygon rectangle) { rectEnv = rectangle.getEnvelopeInternal(); }
public Object getProperty(Object object, QName name) { if (name.equals(GML.Envelope)) { if (object instanceof Envelope) { return object; } //check for a polygon if (object instanceof Polygon) { return ((Polygon) object).getEnvelopeInternal(); } } return null; } }
public Object getProperty(Object object, QName name) { if (name.equals(GML.Envelope)) { if (object instanceof Envelope) { return object; } //check for a polygon if (object instanceof Polygon) { return ((Polygon) object).getEnvelopeInternal(); } } return null; } }
/** * Creates a visitor for checking rectangle intersection * with segments * * @param rectangle the query rectangle */ public RectangleIntersectsSegmentVisitor(Polygon rectangle) { rectEnv = rectangle.getEnvelopeInternal(); rectIntersector = new RectangleLineIntersector(rectEnv); }
public SafeBisectorFinder(Polygon poly) { this.poly = poly; // initialize using extremal values hiY = poly.getEnvelopeInternal().getMaxY(); loY = poly.getEnvelopeInternal().getMinY(); centreY = avg(loY, hiY); }
Envelope env = getEnvelopeInternal(); for (int i = 0; i < 5; i++) { double x = seq.getX(i);
public Object getProperty(Object object, QName name) { //check for a polygon if (object instanceof Polygon) { object = ((Polygon) object).getEnvelopeInternal(); } Envelope e = (Envelope) object; if ("Envelope".equals(name.getLocalPart()) && !e.isNull()) { return e; } if ("Null".equals(name.getLocalPart()) && e.isNull()) { return e; } return null; } }
private void addCountry(final String country, final Polygon polygon) { this.countryNameToBoundaryMap.add(country, polygon); if (this.envelope.intersects(polygon.getEnvelopeInternal())) { this.rawIndex.insert(polygon.getEnvelopeInternal(), polygon); } }
private void many2ManyJoin(JSONObject object, Polygon polyg, Map<JSONObject, List<JSONObject>> result, SpatialIndex index) { Envelope polygonEnvelop = polyg.getEnvelopeInternal(); for (Object entry : index.query(polygonEnvelop)) { JSONArray pntg = ((JSONObject)entry).getJSONObject(GeoJsonWriter.GEOMETRY).getJSONArray(GeoJsonWriter.COORDINATES); Coordinate pnt = new Coordinate(pntg.getDouble(0), pntg.getDouble(1)); JSONObject obj = (JSONObject) entry; if(polyg.intersects(factory.createPoint(pnt))) { if(result.get(obj) == null) { result.put(obj, new ArrayList<JSONObject>()); } result.get(obj).add(object); } } }
public GeometryContainsPointVisitor(Polygon rectangle) { this.rectSeq = rectangle.getExteriorRing().getCoordinateSequence(); rectEnv = rectangle.getEnvelopeInternal(); }
private void createRawIndex() { this.rawIndex = new STRtree(); for (final Polygon boundary : this.boundaries) { this.rawIndex.insert(boundary.getEnvelopeInternal(), boundary); } }
@Override public Iterator<Tuple2<Object, Double>> call(Tuple2<Polygon, Long> spatialObject) throws Exception { GeometryFactory geometryFactory = new GeometryFactory(); List<Tuple2<Object, Double>> result = new ArrayList<Tuple2<Object, Double>>(); if (!datasetBoundary.covers(((Polygon) spatialObject._1()).getEnvelopeInternal())) { return result.iterator(); } Coordinate[] spatialCoordinates = RasterizationUtils.FindPixelCoordinates(resolutionX, resolutionY, datasetBoundary, ((Polygon) spatialObject._1()).getCoordinates(), reverseSpatialCoordinate, false, true); result.add(new Tuple2<Object, Double>(geometryFactory.createPolygon(spatialCoordinates), new Double(spatialObject._2()))); return result.iterator(); } });
@SuppressWarnings("unchecked") private void one2OneJoin(List<JSONObject> polygons, Map<JSONObject, JSONObject> result) { for(JSONObject placeV : polygons) { Polygon polyg = GeoJsonWriter.getPolygonGeometry(placeV); Envelope polygonEnvelop = polyg.getEnvelopeInternal(); for (JSONObject pnt : (List<JSONObject>)addrPointsIndex.query(polygonEnvelop)) { JSONArray pntg = pnt.getJSONObject(GeoJsonWriter.GEOMETRY).getJSONArray(GeoJsonWriter.COORDINATES); if(polyg.contains(factory.createPoint(new Coordinate(pntg.getDouble(0), pntg.getDouble(1))))){ result.put(pnt, placeV); } } } }
/** * Constructs a new {@code JoinedPolygon} from given list of ways. * @param ways The ways used to build joined polygon */ public JoinedPolygon(List<LineString> ways, List<Boolean> reversed) { this.ways = ways; this.reversed = reversed; this.nodes = this.getNodes(); this.area = factory.createPolygon(factory.createLinearRing(this.nodesAsCoords())); this.bounds = area.getEnvelopeInternal(); }
@Test public void disjointFilter() throws Exception { Envelope bounds = testNode.bounds().get(); bounds.expandBy(1); Polygon container = JTS.toGeometry(bounds); Geometry containerBounds = JTS.toGeometry(container.getEnvelopeInternal()); Disjoint filter; filter = (Disjoint) toFilter(String.format("Disjoint(the_geom, %s)", container)); Filter pre = ff.intersects(ff.property("@bounds"), ff.literal(containerBounds)); Filter post = filter; assertFilter(filter, pre, post); }