public boolean contains(Circle c) { return contains(c.getBounds()); }
private void checkIfPointsAreInBounds(List<GHPoint> points) { BBox bounds = getGraphHopperStorage().getBounds(); for (int i = 0; i < points.size(); i++) { GHPoint point = points.get(i); if (!bounds.contains(point.getLat(), point.getLon())) { throw new PointOutOfBoundsException("Point " + i + " is out of bounds: " + point, i); } } }
public boolean contains(BBox b) { if (bbox.contains(b)) { return contains(b.maxLat, b.minLon) && contains(b.minLat, b.minLon) && contains(b.maxLat, b.maxLon) && contains(b.minLat, b.maxLon); } return false; }
public static void printGraphForUnitTest(Graph g, FlagEncoder encoder, BBox bBox) { NodeAccess na = g.getNodeAccess(); for (int node = 0; node < g.getNodes(); ++node) { if (bBox.contains(na.getLat(node), na.getLon(node))) { System.out.printf(Locale.ROOT, "na.setNode(%d, %f, %f);\n", node, na.getLat(node), na.getLon(node)); } } AllEdgesIterator iter = g.getAllEdges(); while (iter.next()) { if (bBox.contains(na.getLat(iter.getBaseNode()), na.getLon(iter.getBaseNode())) && bBox.contains(na.getLat(iter.getAdjNode()), na.getLon(iter.getAdjNode()))) { printUnitTestEdge(encoder, iter); } } }
@Test public void testBounds() throws IOException { final FileReader reader = new FileReader(COUNTRIES_FILE); SpatialRuleLookup spatialRuleLookup = SpatialRuleLookupBuilder.buildIndex(Jackson.newObjectMapper().readValue(reader, JsonFeatureCollection.class), "ISO_A3", new CountriesSpatialRuleFactory(), .1, new BBox(-180, 180, -90, 90)); BBox almostWorldWide = new BBox(-179, 179, -89, 89); // Might fail if a polygon is defined outside the above coordinates assertTrue("BBox seems to be not contracted", almostWorldWide.contains(spatialRuleLookup.getBounds())); }
@Test public void testIntersection() throws IOException { /* We are creating a BBox smaller than Germany. We have the German Spatial rule activated by default. So the BBox should not contain a Point lying somewhere close in Germany. */ final FileReader reader = new FileReader(COUNTRIES_FILE); SpatialRuleLookup spatialRuleLookup = SpatialRuleLookupBuilder.buildIndex(Jackson.newObjectMapper().readValue(reader, JsonFeatureCollection.class), "ISO_A3", new CountriesSpatialRuleFactory(), .1, new BBox(9, 10, 51, 52)); assertFalse("BBox seems to be incorrectly contracted", spatialRuleLookup.getBounds().contains(49.9, 8.9)); }
LandmarkSuggestion selectedSuggestion = null; for (LandmarkSuggestion lmsugg : landmarkSuggestions) { if (lmsugg.getBox().contains(lat, lon)) { selectedSuggestion = lmsugg; break;
public boolean contains(Circle c) { return contains(c.getBounds()); }
public boolean contains(Circle c) { return contains(c.getBounds()); }
public boolean contains( Circle c ) { return contains(c.getBounds()); }
private void checkIfPointsAreInBounds(List<GHPoint> points) { BBox bounds = getGraphHopperStorage().getBounds(); for (int i = 0; i < points.size(); i++) { GHPoint point = points.get(i); if (!bounds.contains(point.getLat(), point.getLon())) { throw new PointOutOfBoundsException("Point " + i + " is out of bounds: " + point, i); } } }
private void checkIfPointsAreInBounds(List<GHPoint> points) { BBox bounds = getGraphHopperStorage().getBounds(); for (int i = 0; i < points.size(); i++) { GHPoint point = points.get(i); if (!bounds.contains(point.getLat(), point.getLon())) { throw new PointOutOfBoundsException("Point " + i + " is ouf of bounds: " + point, i); } } }
public boolean contains(BBox b) { if (bbox.contains(b)) { return contains(b.maxLat, b.minLon) && contains(b.minLat, b.minLon) && contains(b.maxLat, b.maxLon) && contains(b.minLat, b.maxLon); } return false; }
public boolean contains(BBox b) { if (bbox.contains(b)) { return contains(b.maxLat, b.minLon) && contains(b.minLat, b.minLon) && contains(b.maxLat, b.maxLon) && contains(b.minLat, b.maxLon); } return false; }
public boolean contains( BBox b ) { if (bbox.contains(b)) { return contains(b.maxLat, b.minLon) && contains(b.minLat, b.minLon) && contains(b.maxLat, b.maxLon) && contains(b.minLat, b.maxLon); } return false; }