Class Route

java.lang.Object
es.situm.sdk.model.directions.Route
All Implemented Interfaces:
android.os.Parcelable, es.situm.sdk.model.directions.graph.Graph<Point,RouteStep>, MapperInterface

public class Route extends Object implements es.situm.sdk.model.directions.graph.Graph<Point,RouteStep>, android.os.Parcelable, MapperInterface
Route between two points.

Instances are immutable.

  • Field Details

    • CREATOR

      public static final android.os.Parcelable.Creator<Route> CREATOR
  • Constructor Details

  • Method Details

    • getEdges

      @NonNull public Collection<RouteStep> getEdges()
      Equal to getSteps().
      Specified by:
      getEdges in interface es.situm.sdk.model.directions.graph.Graph<Point,RouteStep>
    • getNodes

      @NonNull public Collection<Point> getNodes()
      Returns a collection of points of the route (not ordered)
      Specified by:
      getNodes in interface es.situm.sdk.model.directions.graph.Graph<Point,RouteStep>
      Returns:
      non-empty group of points
    • getPoints

      @NonNull public List<Point> getPoints()
      Returns list of ordered points of the route. If you want the points to display them in a map use getSegments()
      Returns:
      non-empty group of points
    • getSegments

      @NonNull public List<RouteSegment> getSegments()
      Return list of ordered points split by floor, each list contains points from one floor, but can have multiple lists of the same floor. Use this method to display segments in a map, each list should be a polyline.

      For example, if there is no path to go to the other side of the same floor and you need to go up one floor and then go down again to the original floor, this method will return one segment on the current floor, one segment on the upper floor and one more segment in the current floor.

      Drawing example: if you want to draw all the points of a floor, you should draw a polyline for each list that contains the floor you want to show.

    • getSteps

      @NonNull public List<RouteStep> getSteps()
      Returns ordered list of steps to go to the goal point
      Returns:
      non-empty list of RouteStep
    • getFirstStep

      @NonNull public RouteStep getFirstStep()
      Returns first step
      Returns:
      step whose RouteStep.getFrom() is the request parameter DirectionsRequest.getFrom()
    • getLastStep

      @NonNull public RouteStep getLastStep()
      Returns last step
      Returns:
      step whose RouteStep.getTo() is the request parameter DirectionsRequest.getTo()
    • getStep

      @Nullable public RouteStep getStep(@IntRange(from=1L) int stepId)
      Returns a route step by its RouteStep.getId()
      Parameters:
      stepId - id of step (RouteStep.getId())
      Returns:
      step with provided id, or null if there is no match.
    • getRouteInfo

      @NonNull public es.situm.sdk.model.directions.internal.route.InternalRouteInfo getRouteInfo()
      Just for internal SDK use. This method can be changed at any version without previous deprecation warn.
    • getIndications

      @NonNull public List<Indication> getIndications()
      Return ordered list of instructions to go to the destination
    • getRequest

      @NonNull public DirectionsRequest getRequest()
      Returns the search criteria, provided to DirectionsManager, whose result is the current Route.
      Returns:
      original DirectionsRequest
    • isAccessible

      @Deprecated public boolean isAccessible()
      Deprecated.
      Returns whether the current route is suitable to wheel chairs (true) or not (false). Wraps DirectionsRequest.isAccessible() from getRequest().
      Returns:
      true if the route is suitable to wheel chairs
    • getAccessibilityMode

      public DirectionsRequest.AccessibilityMode getAccessibilityMode()
      Returns the current route accessibility mode. Wraps DirectionsRequest.getAccessibilityMode() ()} from getRequest().
      Returns:
      DirectionsRequest.AccessibilityMode
    • getFrom

      @NonNull public Point getFrom()
      Point where the route starts. The same as DirectionsRequest.getFrom() from getRequest().
      Returns:
      Point
    • getTo

      @NonNull public Point getTo()
      Last point and goal of the route. The same as DirectionsRequest.getTo() from getTo().
      Returns:
      Point
    • getPoiTo

      @Nullable public Poi getPoiTo()
      The POI you created the route to. The same as DirectionsRequest.getPoiToIdentifier() from getPoiTo().
      Returns:
      Point or null if you didn't set a POI as the destination
    • indicationForNextStep

      @NonNull public Indication indicationForNextStep(int routeStepIndex)
      Returns the next indication to a given step. The indication can be associated to more than one steps.
      Parameters:
      routeStepIndex - the index of a route step inside a route
      Returns:
      Indication object or empty if the routeStepIndex is not valid
    • points

      public List<Point> points()
      Returns the list of points of the complete route for all the steps from beginning to finish
      Returns:
      List of points Point object or empty list
    • getTimestamp

      public long getTimestamp()
    • setTimestamp

      public void setTimestamp(long timestamp)
    • getDistance

      public double getDistance()
      Returns the route distance (in meters)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

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

      public int describeContents()
      Specified by:
      describeContents in interface android.os.Parcelable
    • writeToParcel

      public void writeToParcel(android.os.Parcel dest, int flags)
      Specified by:
      writeToParcel in interface android.os.Parcelable
    • getRestrictions

      public List<Restriction> getRestrictions()
      Returns a list of Restriction instances in case the route does not conform with one or many DirectionsModifier indicated on Directions API DirectionsManager.requestDirections(DirectionsRequest, Handler). Every restriction indicates which @{link DirectionModifier} could not be fulfilled. This way a developer act accordingly (for example, notifying the user, computing a different route, ...). NOTE: For now this function will always be empty, as it is not implemented. This behaviour will change in future versions.
      Returns:
      list of Restriction instances.
    • toMap

      public Map<String,Object> toMap()
      Description copied from interface: MapperInterface
      Method to transform object into Map<String, Object>
      Specified by:
      toMap in interface MapperInterface
      Returns:
      Map<String, Object> with the information of the object mapped
    • fromMap

      public static Route fromMap(Map<String,Object> map) throws IllegalArgumentException
      Throws:
      IllegalArgumentException