Skip to content

Commit d722eda

Browse files
committed
added road objects to step intersections
1 parent 54cc7f3 commit d722eda

3 files changed

Lines changed: 65 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Mapbox welcomes participation and contributions from everyone.
44

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

89
### v6.6.0 - Jun 30, 2022
910
- 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)

services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/StepIntersection.java

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,33 @@ public Point location() {
214214
@SerializedName("railway_crossing")
215215
public abstract Boolean railwayCrossing();
216216

217+
/**
218+
* Indicates whether there is a traffic signal at the intersection.
219+
*
220+
* @return whether there is a traffic signal at the intersection
221+
*/
222+
@Nullable
223+
@SerializedName("traffic_signal")
224+
public abstract Boolean trafficSignal();
225+
226+
/**
227+
* Indicates whether there is a stop sign at the intersection.
228+
*
229+
* @return whether there is a stop sign at the intersection
230+
*/
231+
@Nullable
232+
@SerializedName("stop_sign")
233+
public abstract Boolean stopSign();
234+
235+
/**
236+
* Indicates whether there is a yield sign at the intersection.
237+
*
238+
* @return whether there is a yield sign at the intersection
239+
*/
240+
@Nullable
241+
@SerializedName("yield_sign")
242+
public abstract Boolean yieldSign();
243+
217244
/**
218245
* Convert the current {@link StepIntersection} to its builder holding the currently assigned
219246
* values. This allows you to modify a single property and then rebuild the object resulting in
@@ -426,6 +453,33 @@ public abstract static class Builder extends DirectionsJsonObject.Builder<Builde
426453
@NonNull
427454
public abstract Builder railwayCrossing(@Nullable Boolean railwayCrossing);
428455

456+
/**
457+
* Indicates whether there is a traffic signal at the intersection.
458+
*
459+
* @param trafficSignal whether there is a traffic signal at the intersection.
460+
* @return this builder for chaining options together
461+
*/
462+
@NonNull
463+
public abstract Builder trafficSignal(@Nullable Boolean trafficSignal);
464+
465+
/**
466+
* Indicates whether there is a stop sign at the intersection.
467+
*
468+
* @param stopSign whether there is a stop sign at the intersection.
469+
* @return this builder for chaining options together
470+
*/
471+
@NonNull
472+
public abstract Builder stopSign(@Nullable Boolean stopSign);
473+
474+
/**
475+
* Indicates whether there is a yield sign at the intersection.
476+
*
477+
* @param yieldSign whether there is a yield sign at the intersection.
478+
* @return this builder for chaining options together
479+
*/
480+
@NonNull
481+
public abstract Builder yieldSign(@Nullable Boolean yieldSign);
482+
429483
/**
430484
* The rawLocation as a double array. Once the {@link StepIntersection} object's created,
431485
* this raw location gets converted into a {@link Point} object and is public exposed as such.

services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/StepIntersectionTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public void testToFromJson1() {
4949
.restStop(RestStop.builder().type("rest_area").name("stop_name").build())
5050
.tollCollection(TollCollection.builder().type("toll_gantry").name("toll_name").build())
5151
.adminIndex(2)
52+
.stopSign(true)
53+
.yieldSign(true)
54+
.trafficSignal(true)
5255
.mapboxStreetsV8(MapboxStreetsV8.builder().roadClass("street").build())
5356
.tunnelName("tunnel_name")
5457
.build();
@@ -88,7 +91,10 @@ public void testFromJson() {
8891
+ "\"is_urban\": true,"
8992
+ "\"mapbox_streets_v8\": {\"class\": \"street\"},"
9093
+ "\"tunnel_name\": \"test tunnel name\","
91-
+ "\"railway_crossing\": true"
94+
+ "\"railway_crossing\": true,"
95+
+ "\"traffic_signal\": true,"
96+
+ "\"stop_sign\": true,"
97+
+ "\"yield_sign\": true"
9298
+ "}";
9399

94100
StepIntersection stepIntersection = StepIntersection.fromJson(stepIntersectionJsonString);
@@ -97,6 +103,9 @@ public void testFromJson() {
97103
assertEquals("street", stepIntersection.mapboxStreetsV8().roadClass());
98104
assertEquals("test tunnel name", stepIntersection.tunnelName());
99105
assertTrue(stepIntersection.railwayCrossing());
106+
assertTrue(stepIntersection.trafficSignal());
107+
assertTrue(stepIntersection.stopSign());
108+
assertTrue(stepIntersection.yieldSign());
100109

101110
Point location = stepIntersection.location();
102111
assertEquals(13.426579, location.longitude(), 0.0001);

0 commit comments

Comments
 (0)