Merge pull request #11499 from osmandapp/fix_transport_exit

Fix #11362 name of underground station
This commit is contained in:
Vitaliy 2021-04-22 13:32:03 +03:00 committed by GitHub
commit fe9a5c43bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -189,7 +189,24 @@ public class TransportStopController extends MenuController {
} }
} }
private static void sortTransportStops(@NonNull LatLon latLon, List<TransportStop> transportStops) { private static void sortTransportStopsExits(@NonNull LatLon latLon, @NonNull List<TransportStop> transportStops) {
for (TransportStop transportStop : transportStops) {
for (TransportStopExit exit : transportStop.getExits()) {
int distance = (int) MapUtils.getDistance(latLon, exit.getLocation());
if (transportStop.distance > distance) {
transportStop.distance = distance;
}
}
}
Collections.sort(transportStops, new Comparator<TransportStop>() {
@Override
public int compare(TransportStop s1, TransportStop s2) {
return Algorithms.compare(s1.distance, s2.distance);
}
});
}
private static void sortTransportStops(@NonNull LatLon latLon, @NonNull List<TransportStop> transportStops) {
for (TransportStop transportStop : transportStops) { for (TransportStop transportStop : transportStops) {
transportStop.distance = (int) MapUtils.getDistance(latLon, transportStop.getLocation()); transportStop.distance = (int) MapUtils.getDistance(latLon, transportStop.getLocation());
} }
@ -227,6 +244,8 @@ public class TransportStopController extends MenuController {
if (isSubwayEntrance) { if (isSubwayEntrance) {
stopAggregated = processTransportStopsForAmenity(transportStops, amenity); stopAggregated = processTransportStopsForAmenity(transportStops, amenity);
sortTransportStopsExits(loc, stopAggregated.getLocalTransportStops());
sortTransportStopsExits(loc, stopAggregated.getNearbyTransportStops());
} else { } else {
stopAggregated = new TransportStopAggregated(); stopAggregated = new TransportStopAggregated();
stopAggregated.setAmenity(amenity); stopAggregated.setAmenity(amenity);