Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Mapbox welcomes participation and contributions from everyone.

### main
- Added `Incident.affectedRoadNames`. [#1457](https://github.com/mapbox/mapbox-java/pull/1457)
- Added `StepIntersections.trafficSignal`,`StepIntersections.stopSign` and `StepIntersections.yieldSign`. [#1464](https://github.com/mapbox/mapbox-java/pull/1464)

### v6.6.0 - Jun 30, 2022
- Fixed `RouteOptions#toUrl` for a case when `RouteOptions` was deserialized from a json generated by an old version of mapbox-java. [#1447](https://github.com/mapbox/mapbox-java/pull/1447)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,33 @@ public Point location() {
@SerializedName("railway_crossing")
public abstract Boolean railwayCrossing();

/**
* Indicates whether there is a traffic signal at the intersection.
*
* @return whether there is a traffic signal at the intersection
*/
@Nullable
@SerializedName("traffic_signal")
public abstract Boolean trafficSignal();

/**
* Indicates whether there is a stop sign at the intersection.
*
* @return whether there is a stop sign at the intersection
*/
@Nullable
@SerializedName("stop_sign")
public abstract Boolean stopSign();

/**
* Indicates whether there is a yield sign at the intersection.
*
* @return whether there is a yield sign at the intersection
*/
@Nullable
@SerializedName("yield_sign")
public abstract Boolean yieldSign();

/**
* Convert the current {@link StepIntersection} to its builder holding the currently assigned
* values. This allows you to modify a single property and then rebuild the object resulting in
Expand Down Expand Up @@ -426,6 +453,33 @@ public abstract static class Builder extends DirectionsJsonObject.Builder<Builde
@NonNull
public abstract Builder railwayCrossing(@Nullable Boolean railwayCrossing);

/**
* Indicates whether there is a traffic signal at the intersection.
*
* @param trafficSignal whether there is a traffic signal at the intersection.
* @return this builder for chaining options together
*/
@NonNull
public abstract Builder trafficSignal(@Nullable Boolean trafficSignal);

/**
* Indicates whether there is a stop sign at the intersection.
*
* @param stopSign whether there is a stop sign at the intersection.
* @return this builder for chaining options together
*/
@NonNull
public abstract Builder stopSign(@Nullable Boolean stopSign);

/**
* Indicates whether there is a yield sign at the intersection.
*
* @param yieldSign whether there is a yield sign at the intersection.
* @return this builder for chaining options together
*/
@NonNull
public abstract Builder yieldSign(@Nullable Boolean yieldSign);

/**
* The rawLocation as a double array. Once the {@link StepIntersection} object's created,
* this raw location gets converted into a {@link Point} object and is public exposed as such.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public void testToFromJson1() {
.restStop(RestStop.builder().type("rest_area").name("stop_name").build())
.tollCollection(TollCollection.builder().type("toll_gantry").name("toll_name").build())
.adminIndex(2)
.stopSign(true)
.yieldSign(true)
.trafficSignal(true)
.mapboxStreetsV8(MapboxStreetsV8.builder().roadClass("street").build())
.tunnelName("tunnel_name")
.build();
Expand Down Expand Up @@ -88,7 +91,10 @@ public void testFromJson() {
+ "\"is_urban\": true,"
+ "\"mapbox_streets_v8\": {\"class\": \"street\"},"
+ "\"tunnel_name\": \"test tunnel name\","
+ "\"railway_crossing\": true"
+ "\"railway_crossing\": true,"
+ "\"traffic_signal\": true,"
+ "\"stop_sign\": true,"
+ "\"yield_sign\": true"
+ "}";

StepIntersection stepIntersection = StepIntersection.fromJson(stepIntersectionJsonString);
Expand All @@ -97,6 +103,9 @@ public void testFromJson() {
assertEquals("street", stepIntersection.mapboxStreetsV8().roadClass());
assertEquals("test tunnel name", stepIntersection.tunnelName());
assertTrue(stepIntersection.railwayCrossing());
assertTrue(stepIntersection.trafficSignal());
assertTrue(stepIntersection.stopSign());
assertTrue(stepIntersection.yieldSign());

Point location = stepIntersection.location();
assertEquals(13.426579, location.longitude(), 0.0001);
Expand Down