Skip to content
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

[WIP] Add roundaboutExits param to MapboxDirections #562

Merged
merged 9 commits into from
Sep 14, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public interface DirectionsService {
* route geometry. Each entry in an annotations field corresponds to a coordinate along the
* route geometry.
* @param language Language of returned turn-by-turn text instructions.
* @param roundaboutExits Define if exit on roundabout is allowed.
* @return The {@link DirectionsResponse} in a Call wrapper.
* @since 1.0.0
*/
Expand All @@ -55,6 +56,7 @@ Call<DirectionsResponse> getCall(
@Query("bearings") String bearings,
@Query("continue_straight") Boolean continueStraight,
@Query("annotations") String annotations,
@Query("language") String language
@Query("language") String language,
@Query("roundabout_exits") Boolean roundaboutExits
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ private Call<DirectionsResponse> getCall() {
builder.getBearings(),
builder.isContinueStraight(),
builder.getAnnotation(),
builder.getLanguage());
builder.getLanguage(),
builder.isRoundaboutExits());

// Done
return call;
Expand Down Expand Up @@ -149,6 +150,7 @@ public static class Builder<T extends Builder> extends MapboxBuilder {
private Position destination = null;
private String[] annotation = null;
private String language = null;
private Boolean roundaboutExits = null;

/**
* Constructor
Expand Down Expand Up @@ -373,6 +375,17 @@ public T setLanguage(String language) {
return (T) this;
}

/**
* Optionally, call if you'd like to specify if exit on a roundabout is allowed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Optionally, set this to true if you want to enable instructions while exiting roundabouts and rotaries."

*
* @param roundaboutExits true if exit on a roundabout is allowed.
* @return Builder
* @since 2.2.4
*/
public T setRoundaboutExits(Boolean roundaboutExits) {
this.roundaboutExits = roundaboutExits;
return (T) this;
}
/*
* Getters, they return the value in a format ready for the API to consume
*/
Expand Down Expand Up @@ -590,6 +603,14 @@ public T setBaseUrl(String baseUrl) {
return (T) this;
}

/**
* @return true it is possible to exit on the roundabout {@link #setRoundaboutExits(Boolean)}.
Copy link

@ericrwolfe ericrwolfe Sep 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more descriptive doc for this given the below would be "return true if you enabled additional instructions while exiting rotaries and roundabouts."

* @since 2.2.4
*/
public Boolean isRoundaboutExits() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to something like allowsRoundaboutExits()?

return roundaboutExits;
}

/**
* Build method
*
Expand Down