From b95fc2e3792a2bf1240cc698077fdd38b695dc0a Mon Sep 17 00:00:00 2001 From: Shinovon Date: Thu, 5 Sep 2024 20:14:37 +0500 Subject: [PATCH] Add bus stop info --- src/mahomaps/route/RouteDecoder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mahomaps/route/RouteDecoder.java b/src/mahomaps/route/RouteDecoder.java index 23bfe29..5664f81 100644 --- a/src/mahomaps/route/RouteDecoder.java +++ b/src/mahomaps/route/RouteDecoder.java @@ -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"); @@ -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;