本文整理了Java中com.graphhopper.storage.GraphHopperStorage.flush()
方法的一些代码示例,展示了GraphHopperStorage.flush()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GraphHopperStorage.flush()
方法的具体详情如下:
包路径:com.graphhopper.storage.GraphHopperStorage
类名称:GraphHopperStorage
方法名:flush
GraphHopperStorage.flush介绍
暂无
代码示例
代码示例来源:origin: graphhopper/graphhopper
protected void flush() {
logger.info("flushing graph " + ghStorage.toString() + ", details:" + ghStorage.toDetailsString() + ", "
+ getMemInfo() + ")");
ghStorage.flush();
logger.info("flushed graph " + getMemInfo() + ")");
fullyLoaded = true;
}
代码示例来源:origin: graphhopper/graphhopper
@Test
public void testLoadingWithLessWeightings_works() {
// we start with a gh storage with two ch weightings and flush it to disk
FastestWeighting weighting1 = new FastestWeighting(carEncoder);
ShortestWeighting weighting2 = new ShortestWeighting(carEncoder);
GraphHopperStorage originalStorage = createStorageWithWeightings(weighting1, weighting2);
originalStorage.create(defaultSize);
originalStorage.flush();
// now we create a new storage but only use one of the weightings, which should be ok
GraphHopperStorage smallStorage = createStorageWithWeightings(weighting1);
smallStorage.loadExisting();
assertEquals(1, smallStorage.getCHWeightings().size());
smallStorage.flush();
// now we create yet another storage that uses both weightings again, which still works
GraphHopperStorage fullStorage = createStorageWithWeightings(weighting1, weighting2);
fullStorage.loadExisting();
assertEquals(2, fullStorage.getCHWeightings().size());
fullStorage.flush();
}
代码示例来源:origin: graphhopper/graphhopper
graphHopperStorage.flush();
return graphHopperStorage;
代码示例来源:origin: graphhopper/graphhopper
@Test(expected = IllegalStateException.class)
public void testLoadingWithWrongWeighting_throws() {
// we start with one weighting
GraphHopperStorage ghStorage = newGHStorage(new GHDirectory(defaultGraphLoc, DAType.RAM_STORE), false);
ghStorage.create(defaultSize);
ghStorage.flush();
// but then configure another weighting and try to load the graph from disk -> error
GraphHopperStorage newGHStorage = createStorageWithWeightings(new ShortestWeighting(carEncoder));
newGHStorage.loadExisting();
}
代码示例来源:origin: graphhopper/graphhopper
@Test(expected = IllegalStateException.class)
public void testLoadingWithExtraWeighting_throws() {
// we start with one weighting
GraphHopperStorage ghStorage = newGHStorage(new GHDirectory(defaultGraphLoc, DAType.RAM_STORE), false);
ghStorage.create(defaultSize);
ghStorage.flush();
// but then add an additional weighting and try to load the graph from disk -> error
GraphHopperStorage newGHStorage = createStorageWithWeightings(
new FastestWeighting(carEncoder), new ShortestWeighting(carEncoder));
newGHStorage.loadExisting();
}
代码示例来源:origin: graphhopper/graphhopper
@Test
public void testDoThrowExceptionIfDimDoesNotMatch() {
graph = newGHStorage(new RAMDirectory(defaultGraphLoc, true), false);
graph.create(1000);
graph.flush();
graph.close();
graph = newGHStorage(new RAMDirectory(defaultGraphLoc, true), true);
try {
graph.loadExisting();
assertTrue(false);
} catch (Exception ex) {
}
}
代码示例来源:origin: graphhopper/graphhopper
@Test
public void testSave_and_Freeze() throws IOException {
graph = newGHStorage(new RAMDirectory(defaultGraphLoc, true), true).create(defaultSize);
graph.edge(1, 0);
graph.freeze();
graph.flush();
graph.close();
graph = newGHStorage(new MMapDirectory(defaultGraphLoc), true);
assertTrue(graph.loadExisting());
assertEquals(2, graph.getNodes());
assertTrue(graph.isFrozen());
}
代码示例来源:origin: graphhopper/graphhopper
@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));
}
代码示例来源:origin: graphhopper/graphhopper
graph.getEdgeIteratorState(1, 2).setFlags(carFlagEncoder.handleWayTags(way_1_2, 1, 0));
graph.flush();
graph.close();
代码示例来源:origin: graphhopper/graphhopper
graph.getEdgeIteratorState(2, 0).setFlags(encoder.handleWayTags(way_2_0, 1, 0));
graph.flush();
graph.close();
代码示例来源:origin: graphhopper/graphhopper
@Test
public void testSave_and_fileFormat() throws IOException {
graph = newGHStorage(new RAMDirectory(defaultGraphLoc, true), true).create(defaultSize);
NodeAccess na = graph.getNodeAccess();
assertTrue(na.is3D());
na.setNode(0, 10, 10, 0);
na.setNode(1, 11, 20, 1);
na.setNode(2, 12, 12, 0.4);
EdgeIteratorState iter2 = graph.edge(0, 1, 100, true);
iter2.setWayGeometry(Helper.createPointList3D(1.5, 1, 0, 2, 3, 0));
EdgeIteratorState iter1 = graph.edge(0, 2, 200, true);
iter1.setWayGeometry(Helper.createPointList3D(3.5, 4.5, 0, 5, 6, 0));
graph.edge(9, 10, 200, true);
graph.edge(9, 11, 200, true);
graph.edge(1, 2, 120, false);
iter1.setName("named street1");
iter2.setName("named street2");
checkGraph(graph);
graph.flush();
graph.close();
graph = newGHStorage(new MMapDirectory(defaultGraphLoc), true);
assertTrue(graph.loadExisting());
assertEquals(12, graph.getNodes());
checkGraph(graph);
assertEquals("named street1", graph.getEdgeIteratorState(iter1.getEdge(), iter1.getAdjNode()).getName());
assertEquals("named street2", graph.getEdgeIteratorState(iter2.getEdge(), iter2.getAdjNode()).getName());
graph.edge(3, 4, 123, true).setWayGeometry(Helper.createPointList3D(4.4, 5.5, 0, 6.6, 7.7, 0));
checkGraph(graph);
}
代码示例来源:origin: graphhopper/graphhopper
graph.flush();
graph.close();
代码示例来源:origin: graphhopper/graphhopper
assertEquals(1, GHUtility.count(chGraph.createEdgeExplorer().setBaseNode(2)));
graph.flush();
graph.close();
代码示例来源:origin: com.graphhopper/graphhopper
protected void flush()
{
logger.info("flushing graph " + ghStorage.toString() + ", details:" + ghStorage.toDetailsString() + ", "
+ Helper.getMemInfo() + ")");
ghStorage.flush();
logger.info("flushed graph " + Helper.getMemInfo() + ")");
fullyLoaded = true;
}
代码示例来源:origin: com.graphhopper/graphhopper-core
protected void flush() {
logger.info("flushing graph " + ghStorage.toString() + ", details:" + ghStorage.toDetailsString() + ", "
+ getMemInfo() + ")");
ghStorage.flush();
logger.info("flushed graph " + getMemInfo() + ")");
fullyLoaded = true;
}
代码示例来源:origin: com.rgi-corp/graphhopper
protected void flush() {
logger.info("flushing graph " + ghStorage.toString() + ", details:" + ghStorage.toDetailsString() + ", "
+ Helper.getMemInfo() + ")");
ghStorage.flush();
logger.info("flushed graph " + Helper.getMemInfo() + ")");
fullyLoaded = true;
}