@Override public BBox getBounds() { return baseGraph.getBounds(); }
@Override protected Result check() { boolean valid = graphHopperStorage.getBounds().isValid(); if (valid) { return Result.healthy(); } else { return Result.unhealthy("GraphHopperStorage has invalid bounds."); } } }
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); } } }
@GET public Info getInfo() { final Info info = new Info(); // use bbox always without elevation (for backward compatibility) info.bbox = new BBox(storage.getBounds().minLon, storage.getBounds().maxLon, storage.getBounds().minLat, storage.getBounds().maxLat); info.supported_vehicles = storage.getEncodingManager().toString().split(","); for (String v : info.supported_vehicles) { Info.PerVehicle perVehicleJson = new Info.PerVehicle(); perVehicleJson.elevation = hasElevation; info.features.put(v, perVehicleJson); } info.import_date = storage.getProperties().get("datareader.import.date"); info.data_date = storage.getProperties().get("datareader.data.date"); info.prepare_ch_date = storage.getProperties().get("prepare.ch.date"); info.prepare_date = storage.getProperties().get("prepare.ch.date"); return info; } }
@Override protected Result check() { boolean valid = graphHopper.getGraphHopperStorage().getBounds().isValid(); if (valid) { return Result.healthy(); } else { return Result.unhealthy("GraphHopperStorage has invalid bounds."); } } }
@Test public void testBounds() { graph = createGHStorage(); BBox b = graph.getBounds(); assertEquals(BBox.createInverse(false).maxLat, b.maxLat, 1e-6); NodeAccess na = graph.getNodeAccess(); na.setNode(0, 10, 20); assertEquals(10, b.maxLat, 1e-6); assertEquals(20, b.maxLon, 1e-6); na.setNode(0, 15, -15); assertEquals(15, b.maxLat, 1e-6); assertEquals(20, b.maxLon, 1e-6); assertEquals(10, b.minLat, 1e-6); assertEquals(-15, b.minLon, 1e-6); }
@Test public void testCannotBeLoadedWithNormalGraphHopperStorageClass() { graph = newGHStorage(new RAMDirectory(defaultGraphLoc, true), false).create(defaultSize); graph.flush(); graph.close(); graph = new GraphBuilder(encodingManager).setLocation(defaultGraphLoc).setMmap(false).setStore(true).create(); try { graph.loadExisting(); fail(); } catch (Exception ex) { } graph = newGHStorage(new RAMDirectory(defaultGraphLoc, true), false); assertTrue(graph.loadExisting()); // empty graph still has invalid bounds assertEquals(graph.getBounds(), BBox.createInverse(false)); }
@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); }
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); } } }
bbox = graph.getBounds(); LocationIndexTree locationIndex = (LocationIndexTree) graphHopper.getLocationIndex(); AlgorithmOptions algoOpts = AlgorithmOptions.start()