use of com.graphhopper.storage.CHStorage in project graphhopper by graphhopper.
the class CHPreparationHandler method load.
public Map<String, RoutingCHGraph> load(GraphHopperStorage ghStorage, List<CHConfig> chConfigs) {
Map<String, RoutingCHGraph> loaded = Collections.synchronizedMap(new LinkedHashMap<>());
List<Callable<String>> callables = chConfigs.stream().map(c -> (Callable<String>) () -> {
CHStorage chStorage = ghStorage.loadCHStorage(c.getName(), c.isEdgeBased());
if (chStorage != null)
loaded.put(c.getName(), ghStorage.createCHGraph(chStorage, c));
else {
// todo: this is ugly, see comments in LMPreparationHandler
ghStorage.getDirectory().remove("nodes_ch_" + c.getName());
ghStorage.getDirectory().remove("shortcuts_" + c.getName());
}
return c.getName();
}).collect(Collectors.toList());
GHUtility.runConcurrently(callables, preparationThreads);
return loaded;
}
Aggregations