Package es.situm.sdk.model.directions
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 java.lang.Object implements es.situm.sdk.model.directions.graph.Graph<Point,RouteStep>, android.os.Parcelable, MapperInterface
Route between two points.Instances are immutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Route.Builder
Helper class to create well formed instances of @{link es.situm.
-
Field Summary
Fields Modifier and Type Field Description static android.os.Parcelable.Creator<Route>
CREATOR
-
Fields inherited from interface es.situm.sdk.model.MapperInterface
ACCESSIBILITY_MODE, ACCURACY, ADDRESS, ALTITUDE, BEARING, BEARING_FROM, BEARING_QUALITY, BOUNDS, BOUNDS_ROTATED, BUILDING, BUILDING_IDENTIFIER, BUILDING_NAME, CARTESIAN_BEARING, CARTESIAN_COORDINATE, CENTER, CLOSEST_LOCATION_IN_ROUTE, CODE, CONVERSION, COORDINATE, CREATED_AT, CURRENT_INDICATION, CURRENT_STEP_INDEX, CUSTOM_FIELDS, dateFormat, DEGREES, DEGREES_CLOCKWISE, DEVICE_ID, DIMENSIONS, DISTANCE, DISTANCE_TO_CHANGE_FLOOR_THRESHOLD, DISTANCE_TO_CHANGE_INDICATION_THRESHOLD, DISTANCE_TO_CLOSEST_POINT_IN_ROUTE, DISTANCE_TO_END_STEP, DISTANCE_TO_GOAL, DISTANCE_TO_GOAL_THRESHOLD, DISTANCE_TO_IGNORE_FIRST_INDICATION, DISTANCE_TO_NEXT_LEVEL, EDGES, EVENTS, EXCLUDED_TAGS, EXTERNAL_NAVIGATION_PAYLOAD, EXTERNAL_NAVIGATION_TYPE, FIRST_STEP, FLOOR, FLOOR_IDENTIFIER, FLOORS, FOREGROUND_SERVICE_NOTIFICATION_MESSAGE, FOREGROUND_SERVICE_NOTIFICATION_SHOW_STOP_ACTION, FOREGROUND_SERVICE_NOTIFICATION_STOP_ACTION_TEXT, FOREGROUND_SERVICE_NOTIFICATION_TAP_ACTION, FOREGROUND_SERVICE_NOTIFICATION_TITLE, FROM, GEOFENCES, HAS_BEARING, HAS_CARTESIAN_BEARING, HEIGHT, HUMAN_READABLE_MESSAGE, ID, IDENTIFIER, IGNORE_LOW_QUALITY_LOCATIONS, INCLUDED_TAGS, INDICATION_TYPE, INDICATIONS, INDICATIONS_INTERVAL, INDOOR_POIS, INFO_HTML, IS_FIRST, IS_INDOOR, IS_LAST, IS_OUTDOOR, IS_PUBLIC, LAST_STEP, LATITUDE, LONGITUDE, MAP_URL, MINIMIZE_FLOOR_CHANGES, NAME, NEEDED_LEVEL_CHANGE, NEXT_INDICATION, NEXT_LEVEL, NODES, NORTH_EAST, NORTH_WEST, ORIENTATION, ORIENTATION_TYPE, OUTDOOR_BUILDING_DETECTOR_BLE, OUTDOOR_POIS, OUTSIDE_ROUTE_THRESHOLD, PICTURE_THUMB_URL, PICTURE_URL, POI_CATEGORIES, POI_CATEGORY, POI_CATEGORY_CODE, POI_CATEGORY_ICON_SELECTED, POI_CATEGORY_ICON_UNSELECTED, POI_CATEGORY_IDENTIFIER, POI_CATEGORY_IDENTIFIERS, POI_CATEGORY_iNAME, POI_CATEGORY_NAME, POI_NAME, POI_TO, POI_TO_IDENTIFIER, POINTS, POLYGON_POINTS, POSITION, PROVIDER, QUALITY, RADIANS, RADIANS_MINUS_PI_PI, RADIUS, ROTATION, ROUND_INDICATIONS_STEP, ROUTE, ROUTE_STEP, SCALE, SEGMENTS, SOUTH_EAST, SOUTH_WEST, STATUS_NAME, STATUS_ORDINAL, STEP_IDX_DESTINATION, STEP_IDX_ORIGIN, STEPS, TIME_TO_END_STEP, TIME_TO_FIRST_INDICATION, TIME_TO_GOAL, TIME_TO_IGNORE_UNEXPECTED_FLOOR_CHANGES, TIMESTAMP, TO, TO_LEGACY, TRIGGER, UPDATED_AT, USER_IDENTIFIER, WIDTH, X, Y
-
-
Constructor Summary
Constructors Constructor Description Route(DirectionsRequest request, java.util.List<RouteStep> steps, java.util.List<Indication> indications, Building building, java.util.Collection<Floor> buildingFloors)
Just for internal SDK use
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
describeContents()
boolean
equals(java.lang.Object o)
static Route
fromMap(java.util.Map<java.lang.String,java.lang.Object> map)
DirectionsRequest.AccessibilityMode
getAccessibilityMode()
Returns the current route accessibility mode.double
getDistance()
Returns the route distance (in meters)java.util.Collection<RouteStep>
getEdges()
Equal togetSteps()
.RouteStep
getFirstStep()
Returns first stepPoint
getFrom()
Point where the route starts.java.util.List<Indication>
getIndications()
Return ordered list of instructions to go to the destinationRouteStep
getLastStep()
Returns last stepjava.util.Collection<Point>
getNodes()
Returns a collection of points of the route (not ordered)java.util.List<Point>
getPoints()
Returns list of ordered points of the route.Poi
getPoiTo()
The POI you created the route to.DirectionsRequest
getRequest()
Returns the search criteria, provided toDirectionsManager
, whose result is the currentRoute
.java.util.List<Restriction>
getRestrictions()
Returns a list ofRestriction
instances in case the route does not conform with one or manyDirectionsModifier
indicated on Directions APIDirectionsManager.requestDirections(DirectionsRequest, Handler)
.es.situm.sdk.model.directions.internal.route.InternalRouteInfo
getRouteInfo()
Just for internal SDK use.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.RouteStep
getStep(int stepId)
Returns a route step by itsRouteStep.getId()
java.util.List<RouteStep>
getSteps()
Returns ordered list of steps to go to the goal pointlong
getTimestamp()
Point
getTo()
Last point and goal of the route.int
hashCode()
Indication
indicationForNextStep(int routeStepIndex)
Returns the next indication to a given step.boolean
isAccessible()
Deprecated.java.util.List<Point>
points()
Returns the list of points of the complete route for all the steps from beginning to finishvoid
setTimestamp(long timestamp)
java.util.Map<java.lang.String,java.lang.Object>
toMap()
Method to transform object into Mapjava.lang.String
toString()
void
writeToParcel(android.os.Parcel dest, int flags)
-
-
-
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 togetSteps()
.
-
getNodes
@NonNull public java.util.Collection<Point> getNodes()
Returns a collection of points of the route (not ordered)
-
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 usegetSegments()
- 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
-
getFirstStep
@NonNull public RouteStep getFirstStep()
Returns first step- Returns:
- step whose
RouteStep.getFrom()
is the request parameterDirectionsRequest.getFrom()
-
getLastStep
@NonNull public RouteStep getLastStep()
Returns last step- Returns:
- step whose
RouteStep.getTo()
is the request parameterDirectionsRequest.getTo()
-
getStep
@Nullable public RouteStep getStep(@IntRange(from=1L) int stepId)
Returns a route step by itsRouteStep.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
-
getRequest
@NonNull public DirectionsRequest getRequest()
Returns the search criteria, provided toDirectionsManager
, whose result is the currentRoute
.- Returns:
- original
DirectionsRequest
-
isAccessible
@Deprecated public boolean isAccessible()
Deprecated.Returns whether the current route is suitable to wheel chairs (true) or not (false). WrapsDirectionsRequest.isAccessible()
fromgetRequest()
.- Returns:
- true if the route is suitable to wheel chairs
-
getAccessibilityMode
public DirectionsRequest.AccessibilityMode getAccessibilityMode()
Returns the current route accessibility mode. WrapsDirectionsRequest.getAccessibilityMode()
()} fromgetRequest()
.- Returns:
DirectionsRequest.AccessibilityMode
-
getFrom
@NonNull public Point getFrom()
Point where the route starts. The same asDirectionsRequest.getFrom()
fromgetRequest()
.- Returns:
Point
-
getTo
@NonNull public Point getTo()
Last point and goal of the route. The same asDirectionsRequest.getTo()
fromgetTo()
.- Returns:
Point
-
getPoiTo
@Nullable public Poi getPoiTo()
The POI you created the route to. The same asDirectionsRequest.getPoiToIdentifier()
fromgetPoiTo()
.- 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 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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
describeContents
public int describeContents()
- Specified by:
describeContents
in interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags)
- Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
-
getRestrictions
public java.util.List<Restriction> getRestrictions()
Returns a list ofRestriction
instances in case the route does not conform with one or manyDirectionsModifier
indicated on Directions APIDirectionsManager.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 interfaceMapperInterface
- 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
-
-