public class NavigationHelper extends Object
Modifier and Type | Method and Description |
---|---|
static CurrentLegAnnotation |
createCurrentAnnotation(CurrentLegAnnotation currentLegAnnotation,
com.mapbox.api.directions.v5.models.RouteLeg leg,
double legDistanceRemaining)
Given a list of distance annotations, find the current annotation index.
|
static List<Pair<com.mapbox.api.directions.v5.models.StepIntersection,Double>> |
createDistancesToIntersections(List<com.mapbox.geojson.Point> stepPoints,
List<com.mapbox.api.directions.v5.models.StepIntersection> intersections)
Creates a list of pairs
StepIntersection and double distance in meters along a step. |
static List<com.mapbox.api.directions.v5.models.StepIntersection> |
createIntersectionsList(com.mapbox.api.directions.v5.models.LegStep currentStep,
com.mapbox.api.directions.v5.models.LegStep upcomingStep)
Given a current and upcoming step, this method assembles a list of
StepIntersection
consisting of all of the current step intersections, as well as the first intersection of
the upcoming step (if the upcoming step isn't null). |
static com.mapbox.api.directions.v5.models.StepIntersection |
findCurrentIntersection(List<com.mapbox.api.directions.v5.models.StepIntersection> intersections,
List<Pair<com.mapbox.api.directions.v5.models.StepIntersection,Double>> measuredIntersections,
double stepDistanceTraveled)
Based on the list of measured intersections and the step distance traveled, finds
the current intersection a user is traveling along.
|
static com.mapbox.api.directions.v5.models.StepIntersection |
findUpcomingIntersection(List<com.mapbox.api.directions.v5.models.StepIntersection> intersections,
com.mapbox.api.directions.v5.models.LegStep upcomingStep,
com.mapbox.api.directions.v5.models.StepIntersection currentIntersection)
Based on the current intersection index, add one and try to get the upcoming.
|
@NonNull public static List<com.mapbox.api.directions.v5.models.StepIntersection> createIntersectionsList(@NonNull com.mapbox.api.directions.v5.models.LegStep currentStep, com.mapbox.api.directions.v5.models.LegStep upcomingStep)
StepIntersection
consisting of all of the current step intersections, as well as the first intersection of
the upcoming step (if the upcoming step isn't null).currentStep
- for intersections listupcomingStep
- for first intersection, if not null@NonNull public static List<Pair<com.mapbox.api.directions.v5.models.StepIntersection,Double>> createDistancesToIntersections(List<com.mapbox.geojson.Point> stepPoints, List<com.mapbox.api.directions.v5.models.StepIntersection> intersections)
StepIntersection
and double distance in meters along a step.
Each pair represents an intersection on the given step and its distance along the step geometry.
The first intersection is the same point as the first point of the list of step points, so will always be zero meters.
stepPoints
- representing the step geometryintersections
- along the step to be measuredpublic static com.mapbox.api.directions.v5.models.StepIntersection findCurrentIntersection(@NonNull List<com.mapbox.api.directions.v5.models.StepIntersection> intersections, @NonNull List<Pair<com.mapbox.api.directions.v5.models.StepIntersection,Double>> measuredIntersections, double stepDistanceTraveled)
intersections
- along the stepmeasuredIntersections
- measured intersections along the stepstepDistanceTraveled
- how far the user has traveled along the steppublic static com.mapbox.api.directions.v5.models.StepIntersection findUpcomingIntersection(@NonNull List<com.mapbox.api.directions.v5.models.StepIntersection> intersections, @Nullable com.mapbox.api.directions.v5.models.LegStep upcomingStep, com.mapbox.api.directions.v5.models.StepIntersection currentIntersection)
If there is not an upcoming intersection on the step, check for an upcoming step and return the first intersection from the upcoming step.
intersections
- for the current stepupcomingStep
- for the first intersection if neededcurrentIntersection
- being traveled along@Nullable public static CurrentLegAnnotation createCurrentAnnotation(CurrentLegAnnotation currentLegAnnotation, com.mapbox.api.directions.v5.models.RouteLeg leg, double legDistanceRemaining)
LegAnnotation
.currentLegAnnotation
- current annotation being traveled alongleg
- holding each list of annotationslegDistanceRemaining
- to determine the new set of annotations© 2019 Mapbox. All rights reserved.