public class RouteUtils extends Object
Constructor and Description |
---|
RouteUtils() |
Modifier and Type | Method and Description |
---|---|
String[] |
calculateRemainingWaypointNames(RouteProgress routeProgress)
Given a
RouteProgress , this method will calculate the remaining waypoint names
along the given route based on route option waypoint names and the progress remaining coordinates. |
List<com.mapbox.geojson.Point> |
calculateRemainingWaypoints(RouteProgress routeProgress)
Given a
RouteProgress , this method will calculate the remaining coordinates
along the given route based on total route coordinates and the progress remaining waypoints. |
com.mapbox.api.directions.v5.models.BannerInstructions |
findCurrentBannerInstructions(com.mapbox.api.directions.v5.models.LegStep currentStep,
double stepDistanceRemaining)
Given the current step / current step distance remaining, this function will
find the current instructions to be shown.
|
boolean |
isArrivalEvent(RouteProgress routeProgress)
Looks at the current
RouteProgressState and returns if
is RouteProgressState.ROUTE_ARRIVED . |
boolean |
isLastLeg(RouteProgress routeProgress)
Looks at the current
RouteProgress list of legs and
checks if the current leg is the last leg. |
public boolean isArrivalEvent(@NonNull RouteProgress routeProgress)
RouteProgressState
and returns if
is RouteProgressState.ROUTE_ARRIVED
.routeProgress
- the current route progresspublic boolean isLastLeg(RouteProgress routeProgress)
RouteProgress
list of legs and
checks if the current leg is the last leg.routeProgress
- the current route progress@Nullable public List<com.mapbox.geojson.Point> calculateRemainingWaypoints(RouteProgress routeProgress)
RouteProgress
, this method will calculate the remaining coordinates
along the given route based on total route coordinates and the progress remaining waypoints.
If the coordinate size is less than the remaining waypoints, this method will return null.
routeProgress
- for route coordinates and remaining waypointsPoint
s@Nullable public String[] calculateRemainingWaypointNames(RouteProgress routeProgress)
RouteProgress
, this method will calculate the remaining waypoint names
along the given route based on route option waypoint names and the progress remaining coordinates.
If the waypoint names are empty, this method will return null.
routeProgress
- for route waypoint names and remaining coordinates@Nullable public com.mapbox.api.directions.v5.models.BannerInstructions findCurrentBannerInstructions(com.mapbox.api.directions.v5.models.LegStep currentStep, double stepDistanceRemaining)
currentStep
- holding the current banner instructionsstepDistanceRemaining
- to determine progress along the currentStep© 2019 Mapbox. All rights reserved.