Package com.graphhopper.routing
Class Path
java.lang.Object
com.graphhopper.routing.Path
This class represents the result of a shortest path calculation. It also provides methods to extract further
information about the found path, like instructions etc.
- Author:
- Peter Karich, Ottavio Campana, jan soe, easbar
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe callback used in forEveryEdge. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDistance(double distance) voidaddEdge(int edge) addTime(long time) Returns the list of all edges.com.carrotsearch.hppc.IntIndexedContainerThis method calculated a list of points for this pathvoidforEveryEdge(Path.EdgeVisitor visitor) Iterates over all edges in this path sorted from start to end and calls the visitor callback for every edge.doubleintcom.carrotsearch.hppc.IntArrayListgetEdges()intYields the final edge of the pathintgetGraph()longgetTime()doubleThis weight will be updated during the algorithm.booleanisFound()voidsetDebugInfo(String debugInfo) setDescription(List<String> description) setDistance(double distance) voidsetEdges(com.carrotsearch.hppc.IntArrayList edgeIds) setEndNode(int end) setFound(boolean found) setFromNode(int from) We need to remember fromNode explicitly as its not saved in one edgeId of edgeIds.setTime(long time) setWeight(double w) toString()
-
Constructor Details
-
Path
-
-
Method Details
-
getGraph
-
getDescription
- Returns:
- the description of this route alternative to make it meaningful for the user e.g. it displays one or two main roads of the route.
-
setDescription
-
getEdges
public com.carrotsearch.hppc.IntArrayList getEdges() -
setEdges
public void setEdges(com.carrotsearch.hppc.IntArrayList edgeIds) -
addEdge
public void addEdge(int edge) -
getEdgeCount
public int getEdgeCount() -
getEndNode
public int getEndNode() -
setEndNode
-
getFromNode
public int getFromNode() -
setFromNode
We need to remember fromNode explicitly as its not saved in one edgeId of edgeIds. -
isFound
public boolean isFound() -
setFound
-
setDistance
-
addDistance
-
getDistance
public double getDistance()- Returns:
- distance in meter
-
getTime
public long getTime()- Returns:
- time in millis
-
setTime
-
addTime
-
getWeight
public double getWeight()This weight will be updated during the algorithm. The initial value is maximum double. -
setWeight
-
getFinalEdge
Yields the final edge of the path -
setDebugInfo
-
getDebugInfo
-
forEveryEdge
Iterates over all edges in this path sorted from start to end and calls the visitor callback for every edge.- Parameters:
visitor- callback to handle every edge. The edge is decoupled from the iterator and can be stored.
-
calcEdges
Returns the list of all edges. -
calcNodes
public com.carrotsearch.hppc.IntIndexedContainer calcNodes()- Returns:
- the uncached node indices of the tower nodes in this path.
-
calcPoints
This method calculated a list of points for this path- Returns:
- the geometry of this path
-
toString
-