Skip to content

Commit

Permalink
Add more things to auto segment info
Browse files Browse the repository at this point in the history
  • Loading branch information
Feodor0090 committed May 29, 2023
1 parent ff06466 commit fd7b64c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
22 changes: 13 additions & 9 deletions src/mahomaps/route/AutoSegment.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@

public class AutoSegment extends RouteSegment {

private String descr;
private int dist;
private double angle;
private int duration;
private String actionKey;
private Geopoint actionPoint;
private int actionVertex;

public AutoSegment(String descr, int dist, double angle, int duration, String actionKey, int actionVertex,
public final String descr;
public final int dist;
public final double angle;
public final int duration;
public final String actionKey;
public final Geopoint actionPoint;
public final int actionVertex;
public final String street;
public final String actionText;

public AutoSegment(String descr, String street, int dist, double angle, int duration, String actionKey, String actionText, int actionVertex,
Geopoint actionPoint) {
this.descr = descr;
this.street = street;
this.dist = dist;
this.angle = angle;
this.duration = duration;
this.actionKey = actionKey;
this.actionText = actionText;
this.actionVertex = actionVertex;
this.actionPoint = new Geopoint(actionPoint.lat, actionPoint.lon);
this.actionPoint.type = Geopoint.POI_MARK;
Expand Down
4 changes: 3 additions & 1 deletion src/mahomaps/route/RouteDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ public static RouteSegment[] DecodeSegments(JSONArray j, Geopoint[] line) {
JSONObject action = segmd.optJSONObject("Action");
if (action != null) {
String actionKey = action.getString("value");
String actionText = action.getString("text");
String street = segmd.optString("street", "");
int angle = (int) segmd.optDouble("angle", 0);
JSONObject durObj = segmd.optJSONObject("Duration");
int dur = durObj == null ? 0 : (int) durObj.optDouble("value", 0);
int av = geoms.getJSONObject(0).getInt("lodIndex");
arr[i] = new AutoSegment(descr, dist, angle, dur, actionKey, av, line[av]);
arr[i] = new AutoSegment(descr, street, dist, angle, dur, actionKey, actionText, av, line[av]);
continue;
}

Expand Down

0 comments on commit fd7b64c

Please sign in to comment.