Class Route

  • All Implemented Interfaces:
    android.os.Parcelable, es.situm.sdk.model.directions.graph.Graph<Point,​RouteStep>

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

    Instances are immutable.

    • Field Detail

      • CREATOR

        public static final android.os.Parcelable.Creator<Route> CREATOR
    • Method Detail

      • 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
      • getStep

        @Nullable
        public RouteStep getStep​(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
      • 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
      • getDistance

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

        public int hashCode()
        Overrides:
        hashCode 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.