Skip to content

Bring RouteUtils class to simplify work with RouteLeg objects#180

Merged
zugaldia merged 6 commits into
masterfrom
route-utils
Aug 24, 2016
Merged

Bring RouteUtils class to simplify work with RouteLeg objects#180
zugaldia merged 6 commits into
masterfrom
route-utils

Conversation

@zugaldia

@zugaldia zugaldia commented Aug 23, 2016

Copy link
Copy Markdown
Member

This PR brings a new RouteUtils class that brings some Turf-powered methods to obtain situational information from a RouteLeg object. To some extend, this a partial refactor and port to Java of @bsudekum 's work on navigation.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 step
  • isOffRoute: 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

  • Improve TestApp's Activity UI
  • Include tests

/cc: @cammace

@mention-bot

Copy link
Copy Markdown

@zugaldia, thanks for your PR! By analyzing the annotation information on this pull request, we identified @cammace to be a potential reviewer

@zugaldia

Copy link
Copy Markdown
Member Author

The RouteUtilsV5Activity now has a better UI:

video

  1. It shows each step of the route in alternating colors to distinguish them better.
  2. Fix a bug with 1-element steps.
  3. Draws the lines to the closest point on the step.

To use it: tap once to set the from, tap a second time to set the to and compute the route. Every following tap will show information about the route in regard with the "user location" (the place where you tap the map).

Next are tests.

@zugaldia

Copy link
Copy Markdown
Member Author

Merging.

@zugaldia zugaldia merged commit 42d33b1 into master Aug 24, 2016
@zugaldia zugaldia deleted the route-utils branch August 24, 2016 20:42
@zugaldia zugaldia mentioned this pull request Aug 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants