@Override public Path extractPath() { PathNative p = new PathNative(graph, weighting, parents, edgeIds); if (endNode >= 0) p.setWeight(weights[endNode]); p.setFromNode(fromNode); // return 'not found' if invalid endNode or limit reached if (endNode < 0 || isWeightLimitExceeded()) return p; return p.setEndNode(endNode).extract(); }
@Override protected Path extractPath() { if (currEdge == null || !finished()) return createEmptyPath(); return new Path(graph, weighting). setWeight(currEdge.weight).setSPTEntry(currEdge).extract(); }
Path calcPathViaQuery(Weighting weighting, GraphHopperStorage ghStorage, double fromLat, double fromLon, double toLat, double toLon) { LocationIndex index = new LocationIndexTree(ghStorage, new RAMDirectory()); index.prepareIndex(); QueryResult from = index.findClosest(fromLat, fromLon, EdgeFilter.ALL_EDGES); QueryResult to = index.findClosest(toLat, toLon, EdgeFilter.ALL_EDGES); // correct order for CH: in factory do prepare and afterwards wrap in query graph AlgorithmOptions opts = AlgorithmOptions.start().weighting(weighting).build(); RoutingAlgorithmFactory factory = createFactory(ghStorage, opts); QueryGraph qGraph = new QueryGraph(getGraph(ghStorage, weighting)).lookup(from, to); return factory.createAlgo(qGraph, opts). calcPath(from.getClosestNode(), to.getClosestNode()); }
Path calcPath(GraphHopperStorage ghStorage, int fromNode1, int fromNode2, int toNode1, int toNode2) { // lookup two edges: fromNode1-fromNode2 and toNode1-toNode2 QueryResult from = newQR(ghStorage, fromNode1, fromNode2); QueryResult to = newQR(ghStorage, toNode1, toNode2); RoutingAlgorithmFactory factory = createFactory(ghStorage, defaultOpts); QueryGraph qGraph = new QueryGraph(getGraph(ghStorage, defaultOpts.getWeighting())).lookup(from, to); return factory.createAlgo(qGraph, defaultOpts).calcPath(from.getClosestNode(), to.getClosestNode()); }
public RoutingAlgorithm createAlgo(Graph g, AlgorithmOptions opts) { opts = AlgorithmOptions.start(opts).algorithm(algoStr).build(); return new RoutingAlgorithmFactorySimple().createAlgo(g, opts); }
protected void runAlgo() { while (!finished() && !isMaxVisitedNodesExceeded()) { if (!finishedFrom) finishedFrom = !fillEdgesFrom(); if (!finishedTo) finishedTo = !fillEdgesTo(); } }
protected final RoutingAlgorithm createAlgo(GraphHopperStorage ghStorage, AlgorithmOptions opts) { return createFactory(ghStorage, opts).createAlgo(getGraph(ghStorage, opts.getWeighting()), opts); }
public RoutingAlgorithmFactory getAlgorithmFactory(HintsMap map) { RoutingAlgorithmFactory routingAlgorithmFactory = new RoutingAlgorithmFactorySimple(); for (RoutingAlgorithmFactoryDecorator decorator : algoDecorators) { if (decorator.isEnabled()) routingAlgorithmFactory = decorator.getDecoratedAlgorithmFactory(routingAlgorithmFactory, map); } return routingAlgorithmFactory; }
@Override public RoutingAlgorithm createAlgo(Graph g, AlgorithmOptions opts) { return new DijkstraBidirectionRef(g, opts.getWeighting(), traversalMode); } };
@Override public RoutingAlgorithm createAlgo(Graph g, AlgorithmOptions opts) { return new AStarBidirection(g, opts.getWeighting(), traversalMode); } };
@Override public RoutingAlgorithm createAlgo(Graph g, AlgorithmOptions opts) { return new DijkstraOneToMany(g, opts.getWeighting(), traversalMode); } };
@Override public RoutingAlgorithm createAlgo(Graph g, AlgorithmOptions opts) { return new AStar(g, opts.getWeighting(), traversalMode); } };
@Override public RoutingAlgorithm createAlgo(Graph g, AlgorithmOptions opts) { return new Dijkstra(g, opts.getWeighting(), traversalMode); } };
Path calcPathViaQuery(GraphHopperStorage ghStorage, double fromLat, double fromLon, double toLat, double toLon) { return calcPathViaQuery(defaultOpts.getWeighting(), ghStorage, fromLat, fromLon, toLat, toLon); }
@Override public void apply(int value) { fillVirtualEdges(node2EdgeMap, value, mainExplorer); } });
@Override protected boolean finished() { if (finishedFrom || finishedTo) return true; return currFrom.weight + currTo.weight >= bestPath.getWeight(); }
@Override public double getEle(int nodeId) { return getElevation(nodeId); } };
@Override protected double calcWeight(EdgeIteratorState iter, SPTEntry currEdge, boolean reverse) { // TODO performance: check if the node is already existent in the opposite direction // then we could avoid the approximation as we already know the exact complete path! return super.calcWeight(iter, currEdge, reverse); }
@Override public String toString() { return "debugui|" + super.toString(); } }