Class ResponsePath

java.lang.Object
com.graphhopper.ResponsePath

public class ResponsePath extends Object
This class holds the data like points and instructions of a Path.

Author:
Peter Karich
  • Constructor Details

    • ResponsePath

      public ResponsePath()
  • Method Details

    • 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 ResponsePath setDescription(List<String> names)
    • addDebugInfo

      public ResponsePath addDebugInfo(String debugInfo)
    • getDebugInfo

      public String getDebugInfo()
    • setPointsOrder

      public ResponsePath setPointsOrder(List<Integer> list)
    • getPointsOrder

      public List<Integer> getPointsOrder()
    • getPoints

      public PointList getPoints()
      This method returns all points on the path. Keep in mind that calculating the distance from these points might yield different results compared to getDistance as points could have been simplified on import or after querying.
    • setPoints

      public ResponsePath setPoints(PointList points)
    • getWaypoints

      public PointList getWaypoints()
      This method returns the input points snapped to the road network.
    • setWaypoints

      public ResponsePath setWaypoints(PointList wpList)
      This method initializes this path with the snapped input points.
    • getWaypointIndices

      public List<Integer> getWaypointIndices()
    • setWaypointIndices

      public ResponsePath setWaypointIndices(List<Integer> waypointIndices)
    • getDistance

      public double getDistance()
      This method returns the distance of the path. Always prefer this method over getPoints().calcDistance

      Returns:
      distance in meter
    • setDistance

      public ResponsePath setDistance(double distance)
    • getAscend

      public double getAscend()
      This method returns the total elevation change (going upwards) in meter.

      Returns:
      ascend in meter
    • setAscend

      public ResponsePath setAscend(double ascend)
    • getDescend

      public double getDescend()
      This method returns the total elevation change (going downwards) in meter.

      Returns:
      decline in meter
    • setDescend

      public ResponsePath setDescend(double descend)
    • getTime

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

      public ResponsePath setTime(long timeInMillis)
    • getRouteWeight

      public double getRouteWeight()
      This method returns a double value which is better than the time for comparison of routes but only if you know what you are doing, e.g. only to compare routes gained with the same query parameters like vehicle.
    • setRouteWeight

      public ResponsePath setRouteWeight(double weight)
    • calcBBox2D

      public org.locationtech.jts.geom.Envelope calcBBox2D()
      Calculates the 2D bounding box of this route
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getInstructions

      public InstructionList getInstructions()
    • setInstructions

      public void setInstructions(InstructionList instructions)
    • addPathDetails

      public void addPathDetails(Map<String,List<PathDetail>> details)
      Adds the given PathDetails to the existing ones. If there are already PathDetails set, the number details has to be equal to details.
      Parameters:
      details - The PathDetails to add
    • getPathDetails

      public Map<String,List<PathDetail>> getPathDetails()
    • hasErrors

      public boolean hasErrors()
      Returns:
      true if this alternative response contains one or more errors
    • getErrors

      public List<Throwable> getErrors()
    • addError

      public ResponsePath addError(Throwable error)
    • addErrors

      public ResponsePath addErrors(List<Throwable> errors)
    • setNumChanges

      public void setNumChanges(int numChanges)
    • getNumChanges

      public int getNumChanges()
    • getLegs

      public List<Trip.Leg> getLegs()
    • setFare

      public void setFare(BigDecimal fare)
    • getFare

      public BigDecimal getFare()
    • isImpossible

      public boolean isImpossible()
    • setImpossible

      public void setImpossible(boolean impossible)