use of com.mapbox.api.directions.v5.models.StepIntersection in project mapbox-navigation-android by mapbox.
the class ToleranceUtils method dynamicRerouteDistanceTolerance.
public static double dynamicRerouteDistanceTolerance(Point snappedPoint, RouteProgress routeProgress) {
List<StepIntersection> intersections = routeProgress.currentLegProgress().currentStepProgress().intersections();
List<Point> intersectionsPoints = new ArrayList<>();
for (StepIntersection intersection : intersections) {
intersectionsPoints.add(intersection.location());
}
Point closestIntersection = TurfClassification.nearestPoint(snappedPoint, intersectionsPoints);
if (closestIntersection.equals(snappedPoint)) {
return NavigationConstants.MINIMUM_DISTANCE_BEFORE_REROUTING;
}
double distanceToNextIntersection = TurfMeasurement.distance(snappedPoint, closestIntersection, TurfConstants.UNIT_METERS);
if (distanceToNextIntersection <= NavigationConstants.MANEUVER_ZONE_RADIUS) {
return NavigationConstants.MINIMUM_DISTANCE_BEFORE_REROUTING / 2;
}
return NavigationConstants.MINIMUM_DISTANCE_BEFORE_REROUTING;
}
use of com.mapbox.api.directions.v5.models.StepIntersection in project mapbox-navigation-android by mapbox.
the class InstructionStepResources method intersectionTurnLanes.
private void intersectionTurnLanes(LegStep step) {
StepIntersection intersection = step.intersections().get(0);
List<IntersectionLanes> lanes = intersection.lanes();
if (checkForNoneIndications(lanes)) {
turnLanes = null;
return;
}
turnLanes = lanes;
}
Aggregations