double lon = Double.parseDouble(splittedObject[1]); int radius = Integer.parseInt(splittedObject[2]); Circle circle = new Circle(lat, lon, radius); if (circle.calculateArea() > useEdgeIdsUntilAreaSize) { blockArea.add(circle); } else {
double tmpLon = nodeAccess.getLongitude(node); double dist = calc.calcDist(tmpLat, tmpLon, queryLat, queryLon); if (circle == null || dist < calc.calcDist(circle.getLat(), circle.getLon(), queryLat, queryLon)) { res.setClosestEdge(iter.detach(false)); res.setClosestNode(node); break; circle = new Circle(tmpLat, tmpLon, dist, calc);
public boolean intersect(Circle s) { return ((Circle) s).intersect(this); }
@Override public boolean contains(double lat1, double lon1) { return normDist(lat1, lon1) <= normedDist; }
public boolean contains(Circle c) { return contains(c.getBounds()); }
@Test public void testBlockedByShape() { EdgeIteratorState edge = graph.getEdgeIteratorState(0, 1); GraphEdgeIdFinder.BlockArea bArea = new GraphEdgeIdFinder.BlockArea(graph); BlockAreaWeighting instance = new BlockAreaWeighting(new FastestWeighting(encoder), bArea); assertEquals(94.35, instance.calcWeight(edge, false, EdgeIterator.NO_EDGE), 0.01); bArea.add(new Circle(0.01, 0.01, 100)); assertEquals(Double.POSITIVE_INFINITY, instance.calcWeight(edge, false, EdgeIterator.NO_EDGE), .01); bArea = new GraphEdgeIdFinder.BlockArea(graph); instance = new BlockAreaWeighting(new FastestWeighting(encoder), bArea); // Do not match 1,1 of edge bArea.add(new Circle(0.1, 0.1, 100)); assertEquals(94.35, instance.calcWeight(edge, false, EdgeIterator.NO_EDGE), .01); }
double tmpLon = nodeAccess.getLongitude(node); double dist = calc.calcDist(tmpLat, tmpLon, queryLat, queryLon); if (circle == null || dist < calc.calcDist(circle.getLat(), circle.getLon(), queryLat, queryLon)) { res.setClosestEdge(iter.detach(false)); res.setClosestNode(node); break; circle = new Circle(tmpLat, tmpLon, dist, calc);
public boolean intersect(BBox b) { // test top intersect if (lat > b.maxLat) { if (lon < b.minLon) { return normDist(b.maxLat, b.minLon) <= normedDist; } if (lon > b.maxLon) { return normDist(b.maxLat, b.maxLon) <= normedDist; } return b.maxLat - bbox.minLat > 0; } // test bottom intersect if (lat < b.minLat) { if (lon < b.minLon) { return normDist(b.minLat, b.minLon) <= normedDist; } if (lon > b.maxLon) { return normDist(b.minLat, b.maxLon) <= normedDist; } return bbox.maxLat - b.minLat > 0; } // test middle intersect if (lon < b.minLon) { return bbox.maxLon - b.minLon > 0; } if (lon > b.maxLon) { return b.maxLon - bbox.minLon > 0; } return true; }
public boolean contains( Circle c ) { return contains(c.getBounds()); }
blockedEdges.clear(); assertEquals(blockedEdges, blockArea.blockedEdges); blockedShapes.add(new Circle(0, 0, 1000)); assertEquals(blockedShapes, blockArea.blockedShapes);
double tmpLon = nodeAccess.getLongitude(node); double dist = calc.calcDist(tmpLat, tmpLon, queryLat, queryLon); if (circle == null || dist < calc.calcDist(circle.getLat(), circle.getLon(), queryLat, queryLon)) { res.setClosestEdge(iter.detach(false)); res.setClosestNode(node); break; circle = new Circle(tmpLat, tmpLon, dist, calc);
@Override public boolean intersect(Shape s) { if (s instanceof BBox) { return intersect((BBox) s); } else if (s instanceof Circle) { return ((Circle) s).intersect(this); } throw new UnsupportedOperationException("unsupported shape"); }
double lon = Double.parseDouble(splittedObject[1]); int radius = Integer.parseInt(splittedObject[2]); Circle circle = new Circle(lat, lon, radius); if (circle.calculateArea() > shapeArea) { blockedShapes.add(circle); } else {
@Override public boolean contains( double lat1, double lon1 ) { return normDist(lat1, lon1) <= normedDist; }
public boolean contains(Circle c) { return contains(c.getBounds()); }