Class Route

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

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

    Instances are immutable.

    • Field Detail

      • CREATOR

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

      • Route

        public Route​(@NonNull
                     DirectionsRequest request,
                     @NonNull @Size(min=1L)
                     java.util.List<RouteStep> steps,
                     java.util.List<Indication> indications,
                     @NonNull
                     Building building,
                     @NonNull @Size(min=1L)
                     java.util.Collection<Floor> buildingFloors)
        Just for internal SDK use
        Throws:
        java.lang.IllegalArgumentException - if null value is provided to NonNull parameter, or empty list is provided to size(min = 1) parameter
    • Method Detail

      • getEdges

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

        @NonNull
        public java.util.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 java.util.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 java.util.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 java.util.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​(@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 java.util.List<Indication> getIndications()
        Return ordered list of instructions to go to the destination
      • 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
      • 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 java.util.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​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.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 java.util.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 java.util.Map<java.lang.String,​java.lang.Object> toMap()
        Description copied from interface: MapperInterface
        Method to transform object into Map
        Specified by:
        toMap in interface MapperInterface
        Returns:
        Map with the information of the object mapped
      • fromMap

        public static Route fromMap​(java.util.Map<java.lang.String,​java.lang.Object> map)
                             throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException