11package com .mapbox .api .directions .v5 .models ;
22
33import androidx .annotation .NonNull ;
4+ import androidx .annotation .Nullable ;
45import com .google .auto .value .AutoValue ;
56import com .google .gson .Gson ;
67import com .google .gson .GsonBuilder ;
@@ -37,7 +38,7 @@ public static Builder builder() {
3738 public abstract String name ();
3839
3940 /**
40- * A {@link Point} representing this waypoint location.
41+ * A {@link Point} representing this waypoint location. This point is snapped to the road network.
4142 *
4243 * @return GeoJson Point representing this waypoint location
4344 * @since 3.0.0
@@ -47,17 +48,18 @@ public Point location() {
4748 return Point .fromLngLat (rawLocation ()[0 ], rawLocation ()[1 ]);
4849 }
4950
50- /**
51- * A {@link Point} representing this waypoint location.
52- *
53- * @return GeoJson Point representing this waypoint location
54- * @since 3.0.0
55- */
5651 @ NonNull
5752 @ SerializedName ("location" )
5853 @ SuppressWarnings ("mutable" )
5954 abstract double [] rawLocation ();
6055
56+ /**
57+ * The straight-line distance from the coordinate specified in the query
58+ * to the location it was snapped to.
59+ */
60+ @ Nullable
61+ public abstract Double distance ();
62+
6163 /**
6264 * Convert the current {@link DirectionsWaypoint} to its builder holding the currently assigned
6365 * values. This allows you to modify a single property and then rebuild the object resulting in
@@ -112,7 +114,8 @@ public abstract static class Builder {
112114 public abstract Builder name (@ NonNull String name );
113115
114116 /**
115- * The rawLocation as a double array. Once the {@link DirectionsWaypoint} objects created,
117+ * The rawLocation as a double array representing a location snapped to the road network.
118+ * Once the {@link DirectionsWaypoint} objects created,
116119 * this raw location gets converted into a {@link Point} object and is public exposed as such.
117120 * The double array should have a length of two, index 0 being the longitude and index 1 being
118121 * latitude.
@@ -124,6 +127,15 @@ public abstract static class Builder {
124127 */
125128 public abstract Builder rawLocation (@ NonNull double [] rawLocation );
126129
130+ /**
131+ * The straight-line distance from the coordinate specified in the query
132+ * to the location it was snapped to.
133+ *
134+ * @param distance distance from original requested location
135+ */
136+ @ Nullable
137+ public abstract Builder distance (@ Nullable Double distance );
138+
127139 /**
128140 * Build a new {@link DirectionsWaypoint} object.
129141 *
0 commit comments