diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java index 4ebd3d21ad..e0b73de262 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java @@ -123,12 +123,14 @@ public class TransportStopController extends MenuController { private void processTransportStop(List routesOnTheSameExit, List routesNearby) { MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { - List reps = mapActivity.getMyApplication() - .getResourceManager().searchTransportRepositories(transportStop.getLocation().getLatitude(), - transportStop.getLocation().getLongitude()); - - boolean useEnglishNames = mapActivity.getMyApplication().getSettings().usingEnglishNames(); + OsmandApplication app = mapActivity.getMyApplication(); + List reps = app.getResourceManager().searchTransportRepositories(transportStop.getLocation().getLatitude(), + transportStop.getLocation().getLongitude()); + boolean useEnglishNames = app.getSettings().usingEnglishNames(); + if (transportStop.getTransportStopAggregated() == null) { + processTransportStopAggregated(app, transportStop); + } for (TransportIndexRepository t : reps) { if (t.acceptTransportStop(transportStop)) { ArrayList transportStopsSameExit = new ArrayList(transportStop.getLocalTransportStops()); @@ -273,6 +275,19 @@ public class TransportStopController extends MenuController { return null; } + public static void processTransportStopAggregated(OsmandApplication app, TransportStop transportStop) { + TransportStopAggregated stopAggregated = new TransportStopAggregated(); + transportStop.setTransportStopAggregated(stopAggregated); + stopAggregated.addLocalTransportStop(transportStop); + + LatLon loc = transportStop.getLocation(); + List transportStops = findTransportStopsAt(app, loc.getLatitude(), loc.getLongitude(), SHOW_STOPS_RADIUS_METERS); + + for (TransportStop stop : transportStops) { + stopAggregated.addNearbyTransportStop(stop); + } + } + public static TransportStopAggregated processTransportStopsForAmenity(List transportStops, Amenity amenity) { TransportStopAggregated stopAggregated = new TransportStopAggregated(); stopAggregated.setAmenity(amenity);