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
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ public class DirectionsCriteria {
*/
public static final String ANNOTATION_SPEED = "speed";

/**
* The congestion, provided as a String, between each pair of coordinates
*
* @since 2.2.0
*/
public static final String ANNOTATION_CONGESTION = "congestion";

/**
* Server responds with no errors.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,9 @@ public T setContinueStraight(Boolean continueStraight) {

/**
* Whether or not to return additional metadata along the route. Possible values are:
* {@link DirectionsCriteria#ANNOTATION_DISTANCE}, {@link DirectionsCriteria#ANNOTATION_DURATION}, and
* {@link DirectionsCriteria#ANNOTATION_SPEED}. Several annotation can be used by separating them with {@code ,}.
* {@link DirectionsCriteria#ANNOTATION_DISTANCE}, {@link DirectionsCriteria#ANNOTATION_DURATION},
* {@link DirectionsCriteria#ANNOTATION_DURATION} and {@link DirectionsCriteria#ANNOTATION_CONGESTION}. Several
* annotation can be used by separating them with {@code ,}.
*
* @param annotation String referencing one of the annotation direction criteria's.
* @return Builder
Expand Down Expand Up @@ -648,7 +649,8 @@ public MapboxDirections build() throws ServicesException {
for (String annotationEntry : annotation) {
if (!annotationEntry.equals(DirectionsCriteria.ANNOTATION_DISTANCE)
&& !annotationEntry.equals(DirectionsCriteria.ANNOTATION_DURATION)
&& !annotationEntry.equals(DirectionsCriteria.ANNOTATION_SPEED)) {
&& !annotationEntry.equals(DirectionsCriteria.ANNOTATION_SPEED)
&& !annotationEntry.equals(DirectionsCriteria.ANNOTATION_CONGESTION)) {
throw new ServicesException(
"Annotation value must be one of the constant values found inside DirectionsCriteria");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class LegAnnotation {
private double[] distance;
private double[] duration;
private double[] speed;
private String[] congestion;

public LegAnnotation() {
}
Expand All @@ -25,6 +26,17 @@ public double[] getDistance() {
return distance;
}

/**
* Set the duration, in seconds, between each pair of coordinates.
*
* @param distance a double array with each entry being a duration value between two of the routeLeg geometry
* coordinates.
* @since 2.2.0
*/
public void setDistance(double[] distance) {
this.distance = distance;
}

/**
* The duration, in seconds, between each pair of coordinates.
*
Expand All @@ -35,6 +47,17 @@ public double[] getDuration() {
return duration;
}

/**
* Set the duration, in seconds, between each pair of coordinates.
*
* @param duration a double array with each entry being a duration value between two of the routeLeg geometry
* coordinates.
* @since 2.2.0
*/
public void setDuration(double[] duration) {
this.duration = duration;
}

/**
* The speed, in meters per second, between each pair of coordinates.
*
Expand All @@ -44,4 +67,35 @@ public double[] getDuration() {
public double[] getSpeed() {
return speed;
}

/**
* Set the speed, in meters per second, between each pair of coordinates.
*
* @param speed a double array with each entry being a speed value between two of the routeLeg geometry coordinates.
* @since 2.2.0
*/
public void setSpeed(double[] speed) {
this.speed = speed;
}

/**
* The congestion between each pair of coordinates.
*
* @return a String array with each entry being a congestion value between two of the routeLeg geometry coordinates.
* @since 2.2.0
*/
public String[] getCongestion() {
return congestion;
}

/**
* Set the congestion between each pair of coordinates.
*
* @param congestion a String array with each entry being a congestion value between two of the routeLeg geometry
* coordinates.
* @since 2.2.0
*/
public void setCongestion(String[] congestion) {
this.congestion = congestion;
}
}