Class RoutingResult

java.lang.Object
com.massifmaps.routing.RoutingResult

public class RoutingResult extends Object
A class that defines list of routing actions and path geometry.
  • Constructor Details

    • RoutingResult

      public RoutingResult(Projection projection, MapPosVector points, RoutingInstructionVector instructions, String rawResult)
      Constructs a new RoutingResult instance from projection, points and instructions.
      Parameters:
      projection - The projection of the routing result (same as the request).
      points - The point list defining the routing path. Instructions refer to this list.
      instructions - The turn-by-turn instruction list.
  • Method Details

    • equals

      public boolean equals(Object obj)
      Checks if this object is equal to the specified object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The reference object.
      Returns:
      True when objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash value of this object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash value of this object.
    • getProjection

      public Projection getProjection()
      Returns the projection of the points in the result.
      Returns:
      The projection of the result.
    • getPoints

      public MapPosVector getPoints()
      Returns the point list of the result. The list contains all the points the route must pass in correct order.
      Returns:
      The point list of the path.
    • getInstructions

      public RoutingInstructionVector getInstructions()
      Returns the turn-by-turn instruction list.
      Returns:
      The turn-by-turn instruction list.
    • getInstructionCount

      public int getInstructionCount()
      Returns the number of turn-by-turn instructions.
      Returns:
      The number of instructions in the list.
    • getInstructionsJSON

      public String getInstructionsJSON()
      Returns every turn-by-turn instruction as one JSON array.

      A maneuver is nine scalars, and reading them one instruction at a time costs a call per
      field: a mountain route has hundreds. The keys are the property names
      (`action`, `pointIndex`, `streetName`, `instruction`, `turnAngle`, `azimuth`,
      `distance`, `time`), and `action` is the enum's constant name.
      Returns:
      The instruction list as JSON.
    • getPointCount

      public int getPointCount()
      Returns the number of points in the path.
      Returns:
      The number of points in the path.
    • getTotalDistance

      public double getTotalDistance()
      Returns the total distance of the path.
      Returns:
      The total distance in meters.
    • getTotalTime

      public double getTotalTime()
      Returns the approximate total duration of the path.
      Returns:
      The total duration in seconds.
    • getRawResult

      public String getRawResult()
      Returns raw result
    • toString

      public String toString()
      Creates a string representation of this result object, useful for logging.
      Overrides:
      toString in class Object
      Returns:
      The string representation of this result object.