@Override protected GraphHopperStorage newGHStorage(Directory dir, boolean is3D) { turnCostStorage = new TurnCostExtension(); return new GraphHopperStorage(dir, encodingManager, is3D, turnCostStorage); }
/** * Default graph is a {@link GraphHopperStorage} with an in memory directory and disabled storing on flush. * Afterwards you'll need to call {@link GraphHopperStorage#create} to have a usable object. Better use * {@link GraphHopperStorage#create} directly. */ public GraphHopperStorage build() { Directory dir = mmap ? new MMapDirectory(location) : new RAMDirectory(location, store); GraphHopperStorage graph; if (encodingManager.needsTurnCostsSupport() || singleCHWeighting == null) graph = new GraphHopperStorage(dir, encodingManager, elevation, new TurnCostExtension()); else graph = new GraphHopperStorage(Arrays.asList(singleCHWeighting), dir, encodingManager, elevation, new TurnCostExtension.NoOpExtension()); return graph; }
protected GraphHopperStorage newGHStorage(Directory dir, boolean enabled3D) { return new GraphHopperStorage(dir, encodingManager, enabled3D, new GraphExtension.NoOpExtension()); }
private GraphHopperStorage createStorageWithWeightings(Weighting... weightings) { return new GraphHopperStorage(Arrays.asList(weightings), new GHDirectory(defaultGraphLoc, DAType.RAM_STORE), encodingManager, false, new GraphExtension.NoOpExtension()); } }
@Override public GraphHopperStorage newGHStorage(Directory dir, boolean is3D) { return new GraphHopperStorage(Arrays.asList(new FastestWeighting(carEncoder)), dir, encodingManager, is3D, new GraphExtension.NoOpExtension()); }
GraphHopperStorage createGHStorage(Directory dir, EncodingManager encodingManager, boolean is3D) { return new GraphHopperStorage(dir, encodingManager, is3D, new GraphExtension.NoOpExtension()).create(100); }
/** * Create a new storage from the specified one without copying the data. */ public static GraphHopperStorage newStorage(GraphHopperStorage store) { Directory outdir = guessDirectory(store); boolean is3D = store.getNodeAccess().is3D(); return new GraphHopperStorage(store.getCHWeightings(), outdir, store.getEncodingManager(), is3D, store.getExtension()). create(store.getNodes()); }
protected final GraphHopperStorage newRAMGHStorage() { return new GraphHopperStorage(new RAMDirectory(), encodingManager, false, new GraphExtension.NoOpExtension()); }
@Override GraphHopperStorage createGHStorage(Directory dir, EncodingManager encodingManager, boolean is3D) { return new GraphHopperStorage(Arrays.asList(new FastestWeighting(encodingManager.getEncoder("car"))), dir, encodingManager, is3D, new GraphExtension.NoOpExtension()). create(100); }
@Override protected GraphHopperStorage createGHStorage(EncodingManager em, List<? extends Weighting> weightings, boolean is3D) { return new GraphHopperStorage(weightings, new RAMDirectory(), em, is3D, new GraphExtension.NoOpExtension()). create(1000); }
@Before public void setUp() { carEncoder = new CarFlagEncoder(); encodingManager = new EncodingManager(carEncoder); g = new GraphHopperStorage(new RAMDirectory(), encodingManager, false, new GraphExtension.NoOpExtension()).create(100); }
@Before public void setUp() { encoder = new CarFlagEncoder(); ghStorage = new GraphHopperStorage(new RAMDirectory(), new EncodingManager(encoder), false, new GraphExtension.NoOpExtension()); ghStorage.create(1000); }
@Before public void setUp() { encoder = new CarFlagEncoder(); tm = TraversalMode.NODE_BASED; GraphHopperStorage tmp = new GraphHopperStorage(new RAMDirectory(), new EncodingManager(encoder), false, new GraphExtension.NoOpExtension()); tmp.create(1000); graph = tmp; }
@Test public void testBigDataEdge() { Directory dir = new RAMDirectory(); GraphHopperStorage graph = new GraphHopperStorage(dir, encodingManager, false, new GraphExtension.NoOpExtension()); graph.create(defaultSize); ((BaseGraph) graph.getGraph(Graph.class)).setEdgeCount(Integer.MAX_VALUE / 2); assertTrue(graph.getAllEdges().next()); graph.close(); }
@SuppressWarnings("resource") @Before public void setUp() { dataFlagEncoder = new DataFlagEncoder(); graph = new GraphHopperStorage(new RAMDirectory(), new EncodingManager(Arrays.asList(dataFlagEncoder, new FootFlagEncoder()), 8), true, new GraphExtension.NoOpExtension()).create(100); edgeElevationInterpolator = createEdgeElevationInterpolator(); interpolatableWay = createInterpolatableWay(); normalWay = new ReaderWay(0); normalWay.setTag("highway", "primary"); }
private Graph initExampleGraph() { GraphHopperStorage gs = new GraphHopperStorage(new RAMDirectory(), em, true, new GraphExtension.NoOpExtension()).create(1000); NodeAccess na = gs.getNodeAccess(); // 50--(0.0001)-->49--(0.0004)-->55--(0.0005)-->60 na.setNode(0, 51.1, 12.001, 50); na.setNode(1, 51.1, 12.002, 60); EdgeIteratorState edge = gs.edge(0, 1). setWayGeometry(Helper.createPointList3D(51.1, 12.0011, 49, 51.1, 12.0015, 55)); edge.setDistance(100); edge.setFlags(encoder.setReverseSpeed(encoder.setProperties(10, true, true), 15)); return gs; }
private Graph initExampleGraph() { GraphHopperStorage gs = new GraphHopperStorage(new RAMDirectory(), em, true, new GraphExtension.NoOpExtension()).create(1000); NodeAccess na = gs.getNodeAccess(); // 50--(0.0001)-->49--(0.0004)-->55--(0.0005)-->60 na.setNode(0, 51.1, 12.001, 50); na.setNode(1, 51.1, 12.002, 60); EdgeIteratorState edge = gs.edge(0, 1). setWayGeometry(Helper.createPointList3D(51.1, 12.0011, 49, 51.1, 12.0015, 55)); edge.setDistance(100); edge.setFlags(encoder.setReverseSpeed(encoder.setProperties(10, true, true), 15)); return gs; }
@Test public void testIdentical() { GraphHopperStorage store = new GraphHopperStorage(new RAMDirectory(), encodingManager, true, new GraphExtension.NoOpExtension()); assertEquals(store.getNodes(), store.getGraph(Graph.class).getNodes()); assertEquals(store.getAllEdges().length(), store.getGraph(Graph.class).getAllEdges().length()); }
@Test public void testMultiplePreparationsDifferentView() { CarFlagEncoder tmpCarEncoder = new CarFlagEncoder(); BikeFlagEncoder tmpBikeEncoder = new BikeFlagEncoder(); EncodingManager tmpEncodingManager = new EncodingManager(tmpCarEncoder, tmpBikeEncoder); Weighting carWeighting = new FastestWeighting(tmpCarEncoder); Weighting bikeWeighting = new FastestWeighting(tmpBikeEncoder); List<Weighting> chWeightings = Arrays.asList(carWeighting, bikeWeighting); GraphHopperStorage ghStorage = new GraphHopperStorage(chWeightings, dir, tmpEncodingManager, false, new GraphExtension.NoOpExtension()).create(1000); initShortcutsGraph(ghStorage); EdgeIteratorState edge = GHUtility.getEdge(ghStorage, 9, 14); edge.setFlags(tmpBikeEncoder.setAccess(edge.getFlags(), false, false)); ghStorage.freeze(); checkPath(ghStorage, carWeighting, 7, 5, IntArrayList.from(3, 9, 14, 16, 13, 12)); // detour around blocked 9,14 checkPath(ghStorage, bikeWeighting, 9, 5, IntArrayList.from(3, 10, 14, 16, 13, 12)); }
@Test public void testRoutingFailsWithInvalidGraph_issue665() { GraphHopperStorage graph = new GraphHopperStorage( new RAMDirectory(), em, true, new GraphExtension.NoOpExtension()); graph.create(100); ReaderWay way = new ReaderWay(0); way.setTag("route", "ferry"); long includeWay = em.acceptWay(way); long relationFlags = 0; long wayFlags = em.handleWayTags(way, includeWay, relationFlags); graph.edge(0, 1).setDistance(247).setFlags(wayFlags); assertTrue(isGraphValid(graph, encoder)); }