Bring RouteUtils class to simplify work with RouteLeg objects#180
Merged
Conversation
Member
Author
|
The
To use it: tap once to set the Next are tests. |
Member
Author
|
Merging. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR brings a new
RouteUtilsclass that brings some Turf-powered methods to obtain situational information from aRouteLegobject. To some extend, this a partial refactor and port to Java of @bsudekum 's work onnavigation.js.Particularly, this PR includes the following methods:
isInStep: Given a position, a route, and a step index, determines if the position is close to the given step (within a customizable threshold).getDistanceToStep: Given a position, a route, and a step index, determines the distance between the position and the closest point in the given step.getSnapToRoute: Given a position, a route, and a step index, determines the closest point in the given stepisOffRoute: Given a position and a route, determines if the position is off-route (within a customizable threshold).getClosestStep: Given a position and a route, determines the closest step in the route.It also has a basic Activity to showcase its functionality. It currently only outputs information via
Log, we should think how to better show this in the UI.Next
/cc: @cammace