use of com.graphhopper.routing.lm.LMRoutingAlgorithmFactory in project graphhopper by graphhopper.
the class MiniGraphUI method createAlgo.
private RoutingAlgorithm createAlgo(GraphHopper hopper) {
Profile profile = hopper.getProfiles().iterator().next();
if (useCH) {
RoutingCHGraph chGraph = hopper.getCHGraphs().get(profile.getName());
logger.info("CH algo, profile: " + profile.getName());
QueryGraph qGraph = QueryGraph.create(hopper.getGraphHopperStorage(), fromRes, toRes);
QueryRoutingCHGraph queryRoutingCHGraph = new QueryRoutingCHGraph(chGraph, qGraph);
return new CHDebugAlgo(queryRoutingCHGraph, mg);
} else {
LandmarkStorage landmarks = hopper.getLandmarks().get(profile.getName());
RoutingAlgorithmFactory algoFactory = (g, w, opts) -> {
RoutingAlgorithm algo = new LMRoutingAlgorithmFactory(landmarks).createAlgo(g, w, opts);
if (algo instanceof AStarBidirection) {
return new DebugAStarBi(g, w, opts.getTraversalMode(), mg).setApproximation(((AStarBidirection) algo).getApproximation());
} else if (algo instanceof AStar) {
return new DebugAStar(g, w, opts.getTraversalMode(), mg);
} else if (algo instanceof DijkstraBidirectionRef) {
return new DebugDijkstraBidirection(g, w, opts.getTraversalMode(), mg);
} else if (algo instanceof Dijkstra) {
return new DebugDijkstraSimple(g, w, opts.getTraversalMode(), mg);
}
return algo;
};
AlgorithmOptions algoOpts = new AlgorithmOptions().setAlgorithm(Algorithms.ASTAR_BI);
logger.info("algoOpts:" + algoOpts + ", weighting: " + landmarks.getWeighting() + ", profile: " + profile.getName());
QueryGraph qGraph = QueryGraph.create(graph, fromRes, toRes);
return algoFactory.createAlgo(qGraph, landmarks.getWeighting(), algoOpts);
}
}
Aggregations