@Override public boolean filter(Individual individual) { Coordinate coord = new Coordinate(individual.lon, individual.lat); Point pt = gf.createPoint(coord); boolean accept = hull.contains(pt); //LOG.debug("label {} accept {}", individual.label, accept); return accept; }
@Override public String resolve(double x, double y) { System.out.println("x="+x+", y="+y); FeatureIterator<Feature> iterator = collection.features(); while( iterator.hasNext() ){ SimpleFeature feature = (SimpleFeature) iterator.next(); Geometry geom = (Geometry) feature.getDefaultGeometry(); GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); Coordinate coord = new Coordinate(x, y); Point point = geometryFactory.createPoint(coord); //System.out.println("checking "+point.toString()); if(geom.contains(point)) { return feature.getAttribute(this.nameField).toString(); } } return null; }
/** * Safely add a vertex to this area. This creates edges to all other vertices unless those edges would cross one of the original edges. */ public void addVertex(IntersectionVertex newVertex, Graph graph) { GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory(); if (edges.size() == 0) { throw new RuntimeException("Can't add a vertex to an empty area"); } @SuppressWarnings("unchecked") HashSet<IntersectionVertex> verticesCopy = (HashSet<IntersectionVertex>) vertices.clone(); VERTEX: for (IntersectionVertex v : verticesCopy) { LineString newGeometry = geometryFactory.createLineString(new Coordinate[] { newVertex.getCoordinate(), v.getCoordinate() }); // ensure that new edge does not leave the bounds of the original area, or // fall into any holes if (!originalEdges.union(originalEdges.getBoundary()).contains(newGeometry)) { continue VERTEX; } // check to see if this splits multiple NamedAreas. This code is rather similar to // code in OSMGBI, but the data structures are different createSegments(newVertex, v, areas, graph); } vertices.add(newVertex); }
/** * Default implementation. */ public boolean contains(Geometry g) { return baseGeom.contains(g); }
return g.contains(this);
LineString segment = (LineString) mls.getGeometryN(i); if (segment.contains(startPoint) || segment.getBoundary().contains(startPoint)) { edgeCoordinate = segment.getEndPoint().getCoordinate();
/** * Computes the full topological <tt>contains</tt> predicate. * Used when short-circuit tests are not conclusive. * * @param geom the test geometry * @return true if this prepared polygon contains the test geometry */ protected boolean fullTopologicalPredicate(Geometry geom) { boolean isContained = prepPoly.getGeometry().contains(geom); return isContained; }
|| segment.getBoundary().contains(startPoint)) { found = true; if (segment.getLength() > 0.000001) {
static public boolean contains(Geometry arg0,Geometry arg1) { if (arg0 == null || arg1 == null) return false; Geometry _this = arg0; return _this.contains(arg1); }
/** * Default implementation. */ public boolean contains(Geometry g) { return baseGeom.contains(g); }
private static LocalPage findCountry(Map<LocalPage, Geometry> countryShapes, Geometry point) { for (LocalPage country : countryShapes.keySet()) { if (countryShapes.get(country).contains(point)) { return country; } } return null; } }
/** * Computes the full topological <tt>contains</tt> predicate. * Used when short-circuit tests are not conclusive. * * @param geom the test geometry * @return true if this prepared polygon contains the test geometry */ protected boolean fullTopologicalPredicate(Geometry geom) { boolean isContained = prepPoly.getGeometry().contains(geom); return isContained; }
private TransitStopFacility drawRandomStop(Geometry buffer, PRouteProvider pRouteProvider, Set<Id<TransitStopFacility>> stopsUsed) { List<TransitStopFacility> choiceSet = new LinkedList<>(); // find choice-set for (TransitStopFacility stop : pRouteProvider.getAllPStops()) { if (!stopsUsed.contains(stop.getId())) { if (buffer.contains(MGC.coord2Point(stop.getCoord()))) { choiceSet.add(stop); } } } return pRouteProvider.drawRandomStopFromList(choiceSet); }
@Override public void handleEntity(Object bean) { Stop stop = (Stop) bean; Point point = _factory.createPoint(new Coordinate(stop.getLat(),stop.getLon())); if (_geometry.contains(point)) System.out.println(stop.getLat() + " " + stop.getLon() + " " + stop.getId()); }
@Override public void handleEntity(Object bean) { Stop stop = (Stop) bean; Point point = _factory.createPoint(new Coordinate(stop.getLat(),stop.getLon())); if (_geometry.contains(point)) System.out.println(stop.getLat() + " " + stop.getLon() + " " + stop.getId()); }
@SuppressWarnings("unchecked") private List<Zone<T>> getZones(Point point) { if(point.getSRID() != srid) point = transformPoint(point); List<Zone<T>> result = quadtree.query(point.getEnvelopeInternal()); List<Zone<T>> zones = new ArrayList<Zone<T>>(result.size()); for(Zone<T> z : result) { if(z.getGeometry().contains(point)) zones.add(z); } return zones; }
@Override public Item item(final QueryContext qc, final InputInfo ii) throws QueryException { return Bln.get(checkGeo(0, qc).contains(checkGeo(1, qc))); } }
@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; } public Object accept(FilterVisitor visitor, Object extraData) {