Update transport rotues

This commit is contained in:
Victor Shcherb 2020-05-16 16:51:51 +02:00
parent e5bd6cb065
commit 4873ab04a9

View file

@ -803,13 +803,14 @@ public class TransportRoutePlanner {
mergeTransportStops(r, loadedTransportStops, stops, localFileRoutes, routeMap.get(r)); mergeTransportStops(r, loadedTransportStops, stops, localFileRoutes, routeMap.get(r));
for (TransportStop stop : stops) { for (TransportStop stop : stops) {
//skip missing stops // skip missing stops
if (stop.isMissingStop()) { if (stop.isMissingStop()) {
continue; continue;
} }
long stopId = stop.getId(); long stopId = stop.getId();
TransportStop multifileStop = loadedTransportStops.get(stopId); TransportStop multifileStop = loadedTransportStops.get(stopId);
int[] rrs = stop.getReferencesToRoutes(); int[] rrs = stop.getReferencesToRoutes();
// TODO what is this?
if (multifileStop == stop) { if (multifileStop == stop) {
// clear up so it won't be used as it is multi file stop // clear up so it won't be used as it is multi file stop
stop.setReferencesToRoutes(null); stop.setReferencesToRoutes(null);
@ -826,10 +827,7 @@ public class TransportRoutePlanner {
rr, stop)); rr, stop));
} else { } else {
TransportRoute combinedRoute = getCombinedRoute(route); TransportRoute combinedRoute = getCombinedRoute(route);
if (combinedRoute == null) { if (multifileStop == stop || (!multifileStop.hasRoute(combinedRoute.getId()) &&
System.err.println(String.format("Something went wrong by loading combined route %d for stop %s", route.getId(), stop));
} else if (multifileStop == stop ||
(!multifileStop.hasRoute(combinedRoute.getId()) &&
!multifileStop.isRouteDeleted(combinedRoute.getId()))) { !multifileStop.isRouteDeleted(combinedRoute.getId()))) {
// duplicates won't be added // duplicates won't be added
multifileStop.addRouteId(combinedRoute.getId()); multifileStop.addRouteId(combinedRoute.getId());
@ -853,16 +851,12 @@ public class TransportRoutePlanner {
List<TransportStop> stops, List<TransportStop> stops,
TIntObjectHashMap<TransportRoute> localFileRoutes, TIntObjectHashMap<TransportRoute> localFileRoutes,
TIntObjectHashMap<TransportRoute> loadedRoutes TIntObjectHashMap<TransportRoute> loadedRoutes
// boolean processMissingStop
) throws IOException { ) throws IOException {
TIntArrayList routesToLoad = new TIntArrayList(); TIntArrayList routesToLoad = new TIntArrayList();
TIntArrayList localRoutesToLoad = new TIntArrayList(); TIntArrayList localRoutesToLoad = new TIntArrayList();
Iterator<TransportStop> it = stops.iterator(); Iterator<TransportStop> it = stops.iterator();
while (it.hasNext()) { while (it.hasNext()) {
TransportStop stop = it.next(); TransportStop stop = it.next();
// if (stop.isMissingStop() && !processMissingStop) {
// continue;
// }
long stopId = stop.getId(); long stopId = stop.getId();
localRoutesToLoad.clear(); localRoutesToLoad.clear();
TransportStop multifileStop = loadedTransportStops.get(stopId); TransportStop multifileStop = loadedTransportStops.get(stopId);