Class Path

java.lang.Object
com.graphhopper.routing.Path

public class Path extends Object
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
  • Constructor Details

    • Path

      public Path(Graph graph)
  • Method Details

    • getGraph

      public Graph getGraph()
    • getDescription

      public List<String> 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

      public Path setDescription(List<String> description)
    • 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

      public Path setEndNode(int end)
    • setFromNode

      public Path setFromNode(int from)
      We need to remember fromNode explicitly as its not saved in one edgeId of edgeIds.
    • isFound

      public boolean isFound()
    • setFound

      public Path setFound(boolean found)
    • setDistance

      public Path setDistance(double distance)
    • addDistance

      public Path addDistance(double distance)
    • getDistance

      public double getDistance()
      Returns:
      distance in meter
    • getTime

      public long getTime()
      Returns:
      time in millis
    • setTime

      public Path setTime(long time)
    • addTime

      public Path addTime(long time)
    • getWeight

      public double getWeight()
      This weight will be updated during the algorithm. The initial value is maximum double.
    • setWeight

      public Path setWeight(double w)
    • getFinalEdge

      public EdgeIteratorState getFinalEdge()
      Yields the final edge of the path
    • setDebugInfo

      public void setDebugInfo(String debugInfo)
    • getDebugInfo

      public String getDebugInfo()
    • forEveryEdge

      public void forEveryEdge(Path.EdgeVisitor visitor)
      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

      public List<EdgeIteratorState> 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

      public PointList calcPoints()
      This method calculated a list of points for this path

      Returns:
      the geometry of this path
    • toString

      public String toString()
      Overrides:
      toString in class Object