Skip to content

Commit fdfb5ba

Browse files
author
Cameron Mace
authored
Updated direction fixtures, added weight and weightName apis (#438)
* updated fixtures, added weight and weightName apis * cleaned up fixture
1 parent ba76b49 commit fdfb5ba

7 files changed

Lines changed: 1809 additions & 1253 deletions

File tree

mapbox/libjava-services/src/main/java/com/mapbox/services/api/directions/v5/DirectionsCriteria.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ public class DirectionsCriteria {
8383
*/
8484
public static final String OVERVIEW_FALSE = "false";
8585

86+
public static final String WEIGHT_NAME_ROUTABILITY = "routability";
87+
88+
public static final String WEIGHT_NAME_DISTANCE = "distance";
89+
public static final String WEIGHT_NAME_DURATION = "duration";
90+
91+
8692
/**
8793
* The duration, in seconds, between each pair of coordinates.
8894
*

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.mapbox.services.api.directions.v5.models;
22

3+
import com.google.gson.annotations.SerializedName;
4+
35
import java.util.List;
46

57
/**
@@ -12,6 +14,9 @@ public class DirectionsRoute {
1214
private double distance;
1315
private double duration;
1416
private String geometry;
17+
private double weight;
18+
@SerializedName("weight_name")
19+
private String weightName;
1520
private List<RouteLeg> legs;
1621

1722
public DirectionsRoute() {
@@ -38,6 +43,22 @@ public void setDistance(double distance) {
3843
this.distance = distance;
3944
}
4045

46+
public String getWeightName() {
47+
return weightName;
48+
}
49+
50+
public void setWeightName(String weightName) {
51+
this.weightName = weightName;
52+
}
53+
54+
public double getWeight() {
55+
return weight;
56+
}
57+
58+
public void setWeight(double weight) {
59+
this.weight = weight;
60+
}
61+
4162
/**
4263
* The estimated travel time from origin to destination.
4364
*

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public class LegStep {
2424
@SerializedName("rotary_pronunciation")
2525
private String rotaryPronunciation;
2626
private StepManeuver maneuver;
27+
28+
private double weight;
2729
private List<StepIntersection> intersections;
2830

2931
public LegStep() {
@@ -39,6 +41,26 @@ public LegStep(String name, String rotaryName, StepManeuver maneuver) {
3941
this.maneuver = maneuver;
4042
}
4143

44+
/**
45+
* Specifies a decimal precision of edge weights, default value 1.
46+
*
47+
* @return a decimal precision double value.
48+
* @since 2.1.0
49+
*/
50+
public double getWeight() {
51+
return weight;
52+
}
53+
54+
/**
55+
* Specifies a decimal precision of edge weights, default value 1.
56+
*
57+
* @param weight double value representing the edge weight.
58+
* @since 2.1.0
59+
*/
60+
public void setWeight(double weight) {
61+
this.weight = weight;
62+
}
63+
4264
/**
4365
* The distance traveled from the maneuver to the next {@link LegStep}.
4466
*

0 commit comments

Comments
 (0)