Merge pull request #7211 from osmandapp/transportStopImprovements

Fix local transport stop
This commit is contained in:
vshcherb 2019-07-09 17:16:58 +02:00 committed by GitHub
commit 1ed55dc741
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -123,12 +123,14 @@ public class TransportStopController extends MenuController {
private void processTransportStop(List<TransportStopRoute> routesOnTheSameExit, List<TransportStopRoute> routesNearby) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
List<TransportIndexRepository> reps = mapActivity.getMyApplication()
.getResourceManager().searchTransportRepositories(transportStop.getLocation().getLatitude(),
OsmandApplication app = mapActivity.getMyApplication();
List<TransportIndexRepository> reps = app.getResourceManager().searchTransportRepositories(transportStop.getLocation().getLatitude(),
transportStop.getLocation().getLongitude());
boolean useEnglishNames = mapActivity.getMyApplication().getSettings().usingEnglishNames();
boolean useEnglishNames = app.getSettings().usingEnglishNames();
if (transportStop.getTransportStopAggregated() == null) {
processTransportStopAggregated(app, transportStop);
}
for (TransportIndexRepository t : reps) {
if (t.acceptTransportStop(transportStop)) {
ArrayList<TransportStop> transportStopsSameExit = new ArrayList<TransportStop>(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<TransportStop> transportStops = findTransportStopsAt(app, loc.getLatitude(), loc.getLongitude(), SHOW_STOPS_RADIUS_METERS);
for (TransportStop stop : transportStops) {
stopAggregated.addNearbyTransportStop(stop);
}
}
public static TransportStopAggregated processTransportStopsForAmenity(List<TransportStop> transportStops, Amenity amenity) {
TransportStopAggregated stopAggregated = new TransportStopAggregated();
stopAggregated.setAmenity(amenity);