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,
                     Building building,
                     @NonNull @Size(min=1L)
                     java.util.Collection<Floor> buildingFloors)
        Just for internal SDK use
        java.lang.IllegalArgumentException - if null value is provided to NonNull parameter, or empty list is provided to size(min = 1) parameter
    • Method Detail

      • getEdges

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

        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>
        non-empty group of points
      • getPoints

        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()
        non-empty group of points
      • getSegments

        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

        public java.util.List<RouteStep> getSteps()
        Returns ordered list of steps to go to the goal point
        non-empty list of RouteStep
      • getStep

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

        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

        public java.util.List<Indication> getIndications()
        Return ordered list of instructions to go to the destination
      • isAccessible

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

        public Indication indicationForNextStep​(int routeStepIndex)
        Returns the next indication to a given step. The indication can be associated to more than one steps.
        routeStepIndex - the index of a route step inside a route
        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
        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)
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        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.
        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
        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