@Override public BBox getBounds() { return mainGraph.getBounds(); }
@Override public BBox getBounds() { return baseGraph.getBounds(); }
public GraphicsWrapper(Graph g) { this.na = g.getNodeAccess(); BBox b = g.getBounds(); scaleX = scaleY = 0.002 * (b.maxLat - b.minLat); offsetY = b.maxLat - 90; offsetX = -b.minLon; }
void addNode(final int nodeA, final int nodeB, final double lat1, final double lon1, final double lat2, final double lon2) { PointEmitter pointEmitter = new PointEmitter() { @Override public void set(double lat, double lon) { long key = keyAlgo.encode(lat, lon); long keyPart = createReverseKey(key); // no need to feed both nodes as we search neighbors in fillIDs addNode(root, nodeA, 0, keyPart, key); } }; if (!distCalc.isCrossBoundary(lon1, lon2)) { BresenhamLine.calcPoints(lat1, lon1, lat2, lon2, pointEmitter, graph.getBounds().minLat, graph.getBounds().minLon, deltaLat, deltaLon); } }
private void printLocationIndexQuery(Graph g, final LocationIndex idx, int count) { count *= 2; final BBox bbox = g.getBounds(); final double latDelta = bbox.maxLat - bbox.minLat; final double lonDelta = bbox.maxLon - bbox.minLon; final Random rand = new Random(seed); MiniPerfTest miniPerf = new MiniPerfTest() { @Override public int doCalc(boolean warmup, int run) { double lat = rand.nextDouble() * latDelta + bbox.minLat; double lon = rand.nextDouble() * lonDelta + bbox.minLon; int val = idx.findClosest(lat, lon, EdgeFilter.ALL_EDGES).getClosestNode(); // if (!warmup && val >= 0) // list.add(val); return val; } }.setIterations(count).start(); print("location_index", miniPerf); }
void initAlgo(int lat, int lon) { this.latSize = lat; this.lonSize = lon; BBox b = graph.getBounds(); keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b); double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon), distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon)); maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2); // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0) }
BBox bounds = graph.getBounds(); if (graph.getNodes() == 0) throw new IllegalStateException("Cannot create location index of empty graph!");
@Test public void testClone() { graph = createGHStorage(); graph.edge(1, 2, 10, true); NodeAccess na = graph.getNodeAccess(); na.setNode(0, 12, 23); na.setNode(1, 8, 13); na.setNode(2, 2, 10); na.setNode(3, 5, 9); graph.edge(1, 3, 10, true); Graph cloneGraph = graph.copyTo(AbstractGraphStorageTester.this.createGHStorage(locationParent + "/clone", false)); assertEquals(graph.getNodes(), cloneGraph.getNodes()); assertEquals(count(carOutExplorer.setBaseNode(1)), count(cloneGraph.createEdgeExplorer(carOutFilter).setBaseNode(1))); cloneGraph.edge(1, 4, 10, true); assertEquals(3, count(cloneGraph.createEdgeExplorer(carOutFilter).setBaseNode(1))); assertEquals(graph.getBounds(), cloneGraph.getBounds()); Helper.close((Closeable) cloneGraph); }
@Override public BBox getBounds() { return mainGraph.getBounds(); }
@Override public BBox getBounds() { return mainGraph.getBounds(); }
@Override public BBox getBounds() { return mainGraph.getBounds(); }
void addNode(final int nodeA, final int nodeB, final double lat1, final double lon1, final double lat2, final double lon2) { PointEmitter pointEmitter = new PointEmitter() { @Override public void set(double lat, double lon) { long key = keyAlgo.encode(lat, lon); long keyPart = createReverseKey(key); // no need to feed both nodes as we search neighbors in fillIDs addNode(root, nodeA, 0, keyPart, key); } }; if (!distCalc.isCrossBoundary(lon1, lon2)) { BresenhamLine.calcPoints(lat1, lon1, lat2, lon2, pointEmitter, graph.getBounds().minLat, graph.getBounds().minLon, deltaLat, deltaLon); } }
void addNode(final int nodeA, final int nodeB, final double lat1, final double lon1, final double lat2, final double lon2) { PointEmitter pointEmitter = new PointEmitter() { @Override public void set(double lat, double lon) { long key = keyAlgo.encode(lat, lon); long keyPart = createReverseKey(key); // no need to feed both nodes as we search neighbors in fillIDs addNode(root, nodeA, 0, keyPart, key); } }; if (!distCalc.isCrossBoundary(lon1, lon2)) { BresenhamLine.calcPoints(lat1, lon1, lat2, lon2, pointEmitter, graph.getBounds().minLat, graph.getBounds().minLon, deltaLat, deltaLon); } }
void addNode( final int nodeA, final int nodeB, final double lat1, final double lon1, final double lat2, final double lon2 ) { PointEmitter pointEmitter = new PointEmitter() { @Override public void set( double lat, double lon ) { long key = keyAlgo.encode(lat, lon); long keyPart = createReverseKey(key); // no need to feed both nodes as we search neighbors in fillIDs addNode(root, nodeA, 0, keyPart, key); } }; if (!distCalc.isCrossBoundary(lon1, lon2)) { BresenhamLine.calcPoints(lat1, lon1, lat2, lon2, pointEmitter, graph.getBounds().minLat, graph.getBounds().minLon, deltaLat, deltaLon); } }
void initAlgo(int lat, int lon) { this.latSize = lat; this.lonSize = lon; BBox b = graph.getBounds(); keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b); double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon), distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon)); maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2); // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0) }
void initAlgo( int lat, int lon ) { this.latSize = lat; this.lonSize = lon; BBox b = graph.getBounds(); keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b); double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon), distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon)); maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2); // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0) }
void initAlgo(int lat, int lon) { this.latSize = lat; this.lonSize = lon; BBox b = graph.getBounds(); keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b); double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon), distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon)); maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2); // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0) }
BBox bounds = graph.getBounds(); if (graph.getNodes() == 0) throw new IllegalStateException("Cannot create location index of empty graph!");
BBox bounds = graph.getBounds(); if (graph.getNodes() == 0) throw new IllegalStateException("Cannot create location index of empty graph!");