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

expose snapping_include_static_closures #1469

Merged
merged 3 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Mapbox welcomes participation and contributions from everyone.

### main
- Fixed an issue where the `RouteOptions#...List` parameters were not reset correctly (for example, `routeOptions.toBuilder().bearingsList(null).build()` did not reset bearings to null). [#1469](https://github.com/mapbox/mapbox-java/pull/1469)
- Added `RouteOptions.snappingIncludeStaticClosures` and `RouteOptions.snappingIncludeStaticClosuresList`. [#1469](https://github.com/mapbox/mapbox-java/pull/1469)

### v6.7.0-beta.1 - Jul 22, 2022
- Added `Incident.affectedRoadNames`. [#1457](https://github.com/mapbox/mapbox-java/pull/1457)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,25 @@ public List<Point> waypointTargetsList() {
@Nullable
public abstract String snappingIncludeClosures();

/**
* A semicolon-separated list of booleans affecting snapping of
* waypoint locations to road segments.
* If true, road segments statically closed, that is long-term, will be considered for snapping
* (for example, road under construction).
* If false, they will not be considered for snapping.
* If provided, the number of snappingIncludeStaticClosures must be the same
* as the number of waypoints.
* However, you can skip a coordinate and show its position in the list with the ; separator.
* If null, this parameter defaults to false.
* <p>
* Only available with the {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC}.
*
* @return a String representing a list of booleans
*/
@SerializedName("snapping_include_static_closures")
@Nullable
public abstract String snappingIncludeStaticClosures();

/**
* A list of booleans affecting snapping of waypoint locations to road segments.
* If true, road segments closed due to live-traffic closures will be considered for snapping.
Expand All @@ -761,6 +780,25 @@ public List<Boolean> snappingIncludeClosuresList() {
return ParseUtils.parseToBooleans(snappingIncludeClosures());
}

/**
* A list of booleans affecting snapping of waypoint locations to road segments.
* If true, road segments statically closed, that is long-term, will be considered for snapping
* (for example, road under construction).
* If false, they will not be considered for snapping.
* If provided, the number of snappingIncludeStaticClosures must be the same
* as the number of waypoints.
* However, you can skip a coordinate and show its position in the list with the null.
* If null, this parameter defaults to false.
* <p>
* Only available with the {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC}.
*
* @return a list of booleans
*/
@Nullable
public List<Boolean> snappingIncludeStaticClosuresList() {
return ParseUtils.parseToBooleans(snappingIncludeStaticClosures());
}

/**
* The desired arrival time, formatted as a timestamp in ISO-8601 format
* in the local time at the route destination.
Expand Down Expand Up @@ -975,6 +1013,7 @@ public URL toUrl(@NonNull String accessToken) {
appendQueryParameter(sb, "walkway_bias", walkwayBias());
appendQueryParameter(sb, "alley_bias", alleyBias());
appendQueryParameter(sb, "snapping_include_closures", snappingIncludeClosures());
appendQueryParameter(sb, "snapping_include_static_closures", snappingIncludeStaticClosures());
appendQueryParameter(sb, "arrive_by", arriveBy());
appendQueryParameter(sb, "depart_at", departAt());
appendQueryParameter(sb, "max_height", maxHeight());
Expand Down Expand Up @@ -1136,9 +1175,10 @@ public abstract static class Builder extends DirectionsJsonObject.Builder<Builde
@NonNull
public Builder coordinatesList(@NonNull List<Point> coordinates) {
String result = FormatUtils.formatPointsList(coordinates);
if (result != null) {
coordinates(result);
if (result == null) {
result = "";
}
coordinates(result);
return this;
}

Expand Down Expand Up @@ -1202,9 +1242,7 @@ public Builder coordinatesList(@NonNull List<Point> coordinates) {
@NonNull
public Builder radiusesList(@Nullable List<Double> radiuses) {
String result = FormatUtils.formatRadiuses(radiuses);
if (result != null) {
radiuses(result);
}
radiuses(result);
return this;
}

Expand Down Expand Up @@ -1246,9 +1284,7 @@ public Builder radiusesList(@Nullable List<Double> radiuses) {
@NonNull
public Builder bearingsList(@Nullable List<Bearing> bearings) {
String result = FormatUtils.formatBearings(bearings);
if (result != null) {
bearings(result);
}
bearings(result);
return this;
}

Expand Down Expand Up @@ -1297,9 +1333,7 @@ public abstract Builder avoidManeuverRadius(
@NonNull
public Builder layersList(@Nullable List<Integer> layers) {
String result = FormatUtils.formatIntegers(layers);
if (result != null) {
layers(result);
}
layers(result);
return this;
}

Expand Down Expand Up @@ -1423,9 +1457,7 @@ public abstract Builder overview(
@NonNull
public Builder annotationsList(@Nullable List<String> annotations) {
String result = FormatUtils.join(",", annotations);
if (result != null) {
annotations(result);
}
annotations(result);
return this;
}

Expand Down Expand Up @@ -1512,9 +1544,7 @@ public Builder annotationsList(@Nullable List<String> annotations) {
@NonNull
public Builder excludeList(@Nullable List<String> exclude) {
String result = FormatUtils.join(",", exclude);
if (result != null) {
exclude(result);
}
exclude(result);
return this;
}

Expand Down Expand Up @@ -1583,9 +1613,7 @@ public Builder excludeObject(@Nullable Exclude exclude) {
@NonNull
public Builder includeList(@Nullable List<String> include) {
String result = FormatUtils.join(",", include);
if (result != null) {
include(result);
}
include(result);
return this;
}

Expand Down Expand Up @@ -1630,9 +1658,7 @@ public Builder includeList(@Nullable List<String> include) {
@NonNull
public Builder approachesList(@Nullable List<String> approaches) {
String result = FormatUtils.join(";", approaches);
if (result != null) {
approaches(result);
}
approaches(result);
return this;
}

Expand Down Expand Up @@ -1695,9 +1721,7 @@ public Builder approachesList(@Nullable List<String> approaches) {
@NonNull
public Builder waypointIndicesList(@Nullable List<Integer> indices) {
String result = FormatUtils.join(";", indices);
if (result != null) {
waypointIndices(result);
}
waypointIndices(result);
return this;
}

Expand Down Expand Up @@ -1733,9 +1757,7 @@ public Builder waypointIndicesList(@Nullable List<Integer> indices) {
@NonNull
public Builder waypointNamesList(@Nullable List<String> waypointNames) {
String result = FormatUtils.join(";", waypointNames);
if (result != null) {
waypointNames(result);
}
waypointNames(result);
return this;
}

Expand Down Expand Up @@ -1852,9 +1874,50 @@ public abstract Builder walkwayBias(
@NonNull
public Builder snappingIncludeClosuresList(@Nullable List<Boolean> snappingClosures) {
String result = FormatUtils.join(";", snappingClosures);
if (result != null) {
snappingIncludeClosures(result);
}
snappingIncludeClosures(result);
return this;
}

/**
* A semicolon-separated list of booleans affecting snapping of
* waypoint locations to road segments.
* If true, road segments statically closed, that is long-term, will be considered for snapping
* (for example, road under construction).
* If false, they will not be considered for snapping.
* If provided, the number of snappingIncludeStaticClosures must be the same
* as the number of waypoints.
* However, you can skip a coordinate and show its position in the list with the ; separator.
* If null, this parameter defaults to false.
* <p>
* Only available with the {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC}.
*
* @param snappingStaticClosures a String representing a list of booleans
* @return this builder for chaining options together
*/
@NonNull
public abstract Builder snappingIncludeStaticClosures(@Nullable String snappingStaticClosures);

/**
* A list of booleans affecting snapping of waypoint locations to road segments.
* If true, road segments statically closed, that is long-term, will be considered for snapping
* (for example, road under construction).
* If false, they will not be considered for snapping.
* If provided, the number of snappingIncludeStaticClosures must be the same
* as the number of waypoints.
* However, you can skip a coordinate and show its position in the list with the null.
* If null, this parameter defaults to false.
* <p>
* Only available with the {@link DirectionsCriteria#PROFILE_DRIVING_TRAFFIC}.
*
* @param snappingStaticClosures a list of booleans
* @return this builder for chaining options together
*/
@NonNull
public Builder snappingIncludeStaticClosuresList(
dzinad marked this conversation as resolved.
Show resolved Hide resolved
@Nullable List<Boolean> snappingStaticClosures
) {
String result = FormatUtils.join(";", snappingStaticClosures);
snappingIncludeStaticClosures(result);
return this;
}

Expand Down
Loading