Skip to content

Commit

Permalink
Add bus stop info
Browse files Browse the repository at this point in the history
  • Loading branch information
shinovon committed Sep 5, 2024
1 parent 6a625da commit b95fc2e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/mahomaps/route/RouteDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static RouteSegment[] DecodeSegments(JSONArray j, Geopoint[] line) {
throw new IllegalArgumentException();
}
final JSONObject segmd = props.getObject("SegmentMetaData");
final String descr = segmd.getString("text");
String descr = segmd.getString("text");
int dist = 0;
{
JSONObject dj = segmd.getNullableObject("Distance");
Expand All @@ -169,6 +169,15 @@ public static RouteSegment[] DecodeSegments(JSONArray j, Geopoint[] line) {
} else if (trt.equals("underground")) {
arr[i] = new MetroSegment(descr, sv, line[sv]);
} else {
JSONArray f = js.getNullableArray("features");
if (f != null && f.size() > 0) {
JSONObject t = f.getObject(f.size() - 1);
if (t.has("properties")
&& (t = t.getObject("properties")).has("StopMetaData")
&& (t = t.getObject("StopMetaData")).has("name")) {
descr = descr.concat("\nОстановка: ").concat(t.getString("name"));
}
}
arr[i] = new TransportSegment(descr, sv, line[sv]);
}
continue;
Expand Down

0 comments on commit b95fc2e

Please sign in to comment.