/** * Does the preparation and creates the location index */ public void postProcessing() { // Later: move this into the GraphStorage.optimize method // Or: Doing it after preparation to optimize shortcuts too. But not possible yet #12 if (sortGraph) { if (ghStorage.isCHPossible() && isCHPrepared()) throw new IllegalArgumentException("Sorting a prepared CHGraph is not possible yet. See #12"); GraphHopperStorage newGraph = GHUtility.newStorage(ghStorage); GHUtility.sortDFS(ghStorage, newGraph); logger.info("graph sorted (" + getMemInfo() + ")"); ghStorage = newGraph; } if (hasElevation()) { interpolateBridgesAndOrTunnels(); } initLocationIndex(); if (chFactoryDecorator.isEnabled()) chFactoryDecorator.createPreparations(ghStorage, traversalMode); if (!isCHPrepared()) prepareCH(); if (lmFactoryDecorator.isEnabled()) lmFactoryDecorator.createPreparations(ghStorage, locationIndex); loadOrPrepareLM(); }
@Test public void testSortDirected() { Graph g = createGraph(); NodeAccess na = g.getNodeAccess(); na.setNode(0, 0, 1); na.setNode(1, 2.5, 2); na.setNode(2, 3.5, 3); g.edge(0, 1, 1.1, false); g.edge(2, 1, 1.1, false); GHUtility.sortDFS(g, createGraph()); }
@Test public void testSort2() { Graph g = initUnsorted(createGraph()); Graph newG = GHUtility.sortDFS(g, createGraph()); assertEquals(g.getNodes(), newG.getNodes()); NodeAccess na = newG.getNodeAccess(); assertEquals(0, na.getLatitude(0), 1e-4); // 0 assertEquals(2.5, na.getLatitude(1), 1e-4); // 1 assertEquals(4.5, na.getLatitude(2), 1e-4); // 2 assertEquals(4.6, na.getLatitude(3), 1e-4); // 8 }
@Test public void testSort() { Graph g = initUnsorted(createGraph()); Graph newG = GHUtility.sortDFS(g, createGraph()); assertEquals(g.getNodes(), newG.getNodes()); NodeAccess na = newG.getNodeAccess(); assertEquals(0, na.getLatitude(0), 1e-4); // 0 assertEquals(2.5, na.getLatitude(1), 1e-4); // 1 assertEquals(4.5, na.getLatitude(2), 1e-4); // 2 assertEquals(4.6, na.getLatitude(3), 1e-4); // 8 assertEquals(3.0, na.getLatitude(4), 1e-4); // 3 assertEquals(5.0, na.getLatitude(5), 1e-4); // 7 assertEquals(4.2, na.getLatitude(6), 1e-4); // 5 }
/** * Does the preparation and creates the location index */ protected void postProcessing() { // Later: move this into the GraphStorage.optimize method // Or: Doing it after preparation to optimize shortcuts too. But not possible yet #12 if (sortGraph) { if (ghStorage.isCHPossible() && isPrepared()) throw new IllegalArgumentException("Sorting a prepared CHGraph is not possible yet. See #12"); GraphHopperStorage newGraph = GHUtility.newStorage(ghStorage); GHUtility.sortDFS(ghStorage, newGraph); logger.info("graph sorted (" + Helper.getMemInfo() + ")"); ghStorage = newGraph; } initLocationIndex(); if (chFactoryDecorator.isEnabled()) createCHPreparations(); if (!isPrepared()) prepare(); }
/** * Does the preparation and creates the location index */ public void postProcessing() { // Later: move this into the GraphStorage.optimize method // Or: Doing it after preparation to optimize shortcuts too. But not possible yet #12 if (sortGraph) { if (ghStorage.isCHPossible() && isCHPrepared()) throw new IllegalArgumentException("Sorting a prepared CHGraph is not possible yet. See #12"); GraphHopperStorage newGraph = GHUtility.newStorage(ghStorage); GHUtility.sortDFS(ghStorage, newGraph); logger.info("graph sorted (" + Helper.getMemInfo() + ")"); ghStorage = newGraph; } if (hasElevation()) { interpolateBridgesAndOrTunnels(); } initLocationIndex(); if (chFactoryDecorator.isEnabled()) chFactoryDecorator.createPreparations(ghStorage, traversalMode); if (!isCHPrepared()) prepareCH(); if (lmFactoryDecorator.isEnabled()) lmFactoryDecorator.createPreparations(ghStorage, traversalMode, locationIndex); loadOrPrepareLM(); }
/** * Does the preparation and creates the location index */ public void postProcessing() { // Later: move this into the GraphStorage.optimize method // Or: Doing it after preparation to optimize shortcuts too. But not possible yet #12 if (sortGraph) { if (ghStorage.isCHPossible() && isCHPrepared()) throw new IllegalArgumentException("Sorting a prepared CHGraph is not possible yet. See #12"); GraphHopperStorage newGraph = GHUtility.newStorage(ghStorage); GHUtility.sortDFS(ghStorage, newGraph); logger.info("graph sorted (" + getMemInfo() + ")"); ghStorage = newGraph; } if (hasElevation()) { interpolateBridgesAndOrTunnels(); } initLocationIndex(); if (chFactoryDecorator.isEnabled()) chFactoryDecorator.createPreparations(ghStorage, traversalMode); if (!isCHPrepared()) prepareCH(); if (lmFactoryDecorator.isEnabled()) lmFactoryDecorator.createPreparations(ghStorage, locationIndex); loadOrPrepareLM(); }