@Override public void updateBestPath(EdgeIteratorState es, SPTEntry entry, int traversalId, boolean reverse) { if (g2 != null) { mg.plotEdge(g2, na.getLat(entry.parent.adjNode), na.getLon(entry.parent.adjNode), na.getLat(entry.adjNode), na.getLon(entry.adjNode), .8f); } // System.out.println("new node:" + currLoc); super.updateBestPath(es, entry, traversalId, reverse); } }
@Override public void initTo(int to, double weight) { currTo = createSPTEntry(to, weight); openSetTo.add(currTo); if (!traversalMode.isEdgeBased()) { bestWeightMapTo.put(to, currTo); if (currFrom != null) { bestWeightMapOther = bestWeightMapFrom; updateBestPath(GHUtility.getEdge(graph, currFrom.adjNode, to), currFrom, to); } } else if (currFrom != null && currFrom.adjNode == to) { // special case of identical start and end bestPath.sptEntry = currFrom; bestPath.edgeTo = currTo; finishedFrom = true; finishedTo = true; } }
@Override public void initFrom(int from, double weight) { currFrom = createSPTEntry(from, weight); openSetFrom.add(currFrom); if (!traversalMode.isEdgeBased()) { bestWeightMapFrom.put(from, currFrom); if (currTo != null) { bestWeightMapOther = bestWeightMapTo; updateBestPath(GHUtility.getEdge(graph, from, currTo.adjNode), currTo, from); } } else if (currTo != null && currTo.adjNode == from) { // special case of identical start and end bestPath.sptEntry = currFrom; bestPath.edgeTo = currTo; finishedFrom = true; finishedTo = true; } }
@Override public void initFrom( int from, double weight ) { currFrom = createSPTEntry(from, weight); openSetFrom.add(currFrom); if (!traversalMode.isEdgeBased()) { bestWeightMapFrom.put(from, currFrom); if (currTo != null) { bestWeightMapOther = bestWeightMapTo; updateBestPath(GHUtility.getEdge(graph, from, currTo.adjNode), currTo, from); } } else { if (currTo != null && currTo.adjNode == from) { // special case of identical start and end bestPath.sptEntry = currFrom; bestPath.edgeTo = currTo; finishedFrom = true; finishedTo = true; } } }
@Override public void initTo( int to, double weight ) { currTo = createSPTEntry(to, weight); openSetTo.add(currTo); if (!traversalMode.isEdgeBased()) { bestWeightMapTo.put(to, currTo); if (currFrom != null) { bestWeightMapOther = bestWeightMapFrom; updateBestPath(GHUtility.getEdge(graph, currFrom.adjNode, to), currFrom, to); } } else { if (currFrom != null && currFrom.adjNode == to) { // special case of identical start and end bestPath.sptEntry = currFrom; bestPath.edgeTo = currTo; finishedFrom = true; finishedTo = true; } } }
void fillEdges(SPTEntry currEdge, PriorityQueue<SPTEntry> prioQueue, IntObjectMap<SPTEntry> bestWeightMap, EdgeExplorer explorer, boolean reverse) { EdgeIterator iter = explorer.setBaseNode(currEdge.adjNode); while (iter.next()) { if (!accept(iter, currEdge.edge)) continue; int traversalId = traversalMode.createTraversalId(iter, reverse); double tmpWeight = weighting.calcWeight(iter, reverse, currEdge.edge) + currEdge.weight; if (Double.isInfinite(tmpWeight)) continue; SPTEntry ee = bestWeightMap.get(traversalId); if (ee == null) { ee = new SPTEntry(iter.getEdge(), iter.getAdjNode(), tmpWeight); ee.parent = currEdge; bestWeightMap.put(traversalId, ee); prioQueue.add(ee); } else if (ee.weight > tmpWeight) { prioQueue.remove(ee); ee.edge = iter.getEdge(); ee.weight = tmpWeight; ee.parent = currEdge; prioQueue.add(ee); } else continue; if (updateBestPath) updateBestPath(iter, ee, traversalId); } }
updateBestPath(iter, ee, traversalId);