-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added walking options #991
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b2d1e5e
Added walking options
144a4ec
Updated for feedback
86a1fd3
Added toJson and fromJson and added WalkingOptions to RouteOptions
5264d5f
Made walking options more nullable
0777275
Added more tests
2e3f758
Removed walking options from POST call
a3a60f7
Updated per feedback and updated @since annotations
b41ad6a
Updated walking options per updates
b67b61a
update the javadoc for biasing walkways and alleys
kevinkreiserMB 72d3aac
update javadoc once more for the spots i missed
kevinkreiserMB 48a0810
Addressed feedback
8016621
Updated test to reflect accurate values
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,10 +107,15 @@ private Call<DirectionsResponse> get() { | |
waypointIndices(), | ||
waypointNames(), | ||
waypointTargets(), | ||
enableRefresh()); | ||
enableRefresh(), | ||
walkingSpeed(), | ||
walkwayBias(), | ||
alleyBias() | ||
); | ||
} | ||
|
||
private Call<DirectionsResponse> post() { | ||
// todo add walking options | ||
return getService().postCall( | ||
ApiCallHelper.getHeaderUserAgent(clientAppName()), | ||
user(), | ||
|
@@ -135,7 +140,8 @@ private Call<DirectionsResponse> post() { | |
waypointIndices(), | ||
waypointNames(), | ||
waypointTargets(), | ||
enableRefresh()); | ||
enableRefresh() | ||
); | ||
} | ||
|
||
@Override | ||
|
@@ -327,6 +333,40 @@ private static String formatWaypointTargets(Point[] waypointTargets) { | |
@Nullable | ||
abstract Boolean usePostMethod(); | ||
|
||
@Nullable | ||
abstract WalkingOptions walkingOptions(); | ||
|
||
@Nullable | ||
Double walkingSpeed() { | ||
if (hasWalkingOptions()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor comment: Guard clauses normally represent the unexpected behavior i.e. if (!hasWalkingOptions()) {
return null;
}
return walkingOptions().walkingSpeed(); |
||
return walkingOptions().walkingSpeed(); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
@Nullable | ||
Double walkwayBias() { | ||
if (hasWalkingOptions()) { | ||
return walkingOptions().walkwayBias(); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
@Nullable | ||
Double alleyBias() { | ||
if (hasWalkingOptions()) { | ||
return walkingOptions().alleyBias(); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
private boolean hasWalkingOptions() { | ||
return walkingOptions() != null; | ||
} | ||
|
||
/** | ||
* Build a new {@link MapboxDirections} object with the initial values set for | ||
* {@link #baseUrl()}, {@link #profile()}, {@link #user()}, and {@link #geometries()}. | ||
|
@@ -830,6 +870,17 @@ public Builder get() { | |
return this; | ||
} | ||
|
||
/** | ||
* To be used to specify settings for use with the walking profile. | ||
* | ||
* @param walkingOptions options to use for walking profile | ||
* @return this builder for chaining options together | ||
* @since 4.8.0 | ||
*/ | ||
public abstract Builder walkingOptions(@NonNull WalkingOptions walkingOptions); | ||
|
||
abstract WalkingOptions walkingOptions(); | ||
|
||
abstract Builder usePostMethod(@NonNull Boolean usePost); | ||
|
||
abstract Boolean usePostMethod(); | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we revert these changes back? It seems walking supports
POST
too now.