Navigation Helper
This contains several single purpose methods that help out when a new location update occurs and calculations need to be performed on it.
Functions
Checks whether the user's bearing matches the next step's maneuver provided bearingAfter variable. This is one of the criteria's required for the user location to be recognized as being on the next step or potentially arriving.
This method runs through the list of milestones in MapLibreNavigation.milestones and returns a list of occurring milestones (if any), based on their individual criteria.
Given a list of distance annotations, find the current annotation index. This index retrieves the current annotation from any provided annotation list in LegAnnotation.
Creates a list of pairs StepIntersection and double distance in meters along a step.
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).
Given the current DirectionsRoute and leg / step index, return a list of Point representing the current step.
Based on the list of measured intersections and the step distance traveled, finds the current intersection a user is traveling along.
Based on the current intersection index, add one and try to get the upcoming.
This is used when a user has completed a step maneuver and the indices need to be incremented. The main purpose of this class is to determine if an additional leg exist and the step index has met the first legs total size, a leg index needs to occur and step index should be reset. Otherwise, the step index is incremented while the leg index remains the same.
This method checks if off route detection is enabled or disabled.
Takes in the already calculated step distance and iterates through the step list from the step index value plus one till the end of the leg.
Takes in the leg distance remaining value already calculated and if additional legs need to be traversed along after the current one, adds those distances and returns the new distance. Otherwise, if the route only contains one leg or the users on the last leg, this value will equal the leg distance remaining.
Calculates the distance remaining in the step from the current users snapped position, to the next maneuver position.