This commit is contained in:
MadWasp79 2020-05-15 14:39:42 +03:00
parent 3ec03040ea
commit 3c655c4f98
2 changed files with 13 additions and 6 deletions

View file

@ -304,13 +304,16 @@ public class BinaryMapTransportReaderAdapter {
dataObject.setRouteOffset(codedIS.readRawVarint32()); dataObject.setRouteOffset(codedIS.readRawVarint32());
break; break;
case OsmandOdb.IncompleteTransportRoute.OPERATOR_FIELD_NUMBER : case OsmandOdb.IncompleteTransportRoute.OPERATOR_FIELD_NUMBER :
dataObject.setOperator(regStr(stringTable)); skipUnknownField(t);
// dataObject.setOperator(regStr(stringTable));
break; break;
case OsmandOdb.IncompleteTransportRoute.REF_FIELD_NUMBER : case OsmandOdb.IncompleteTransportRoute.REF_FIELD_NUMBER :
dataObject.setRef(regStr(stringTable)); skipUnknownField(t);
// dataObject.setRef(regStr(stringTable));
break; break;
case OsmandOdb.IncompleteTransportRoute.TYPE_FIELD_NUMBER : case OsmandOdb.IncompleteTransportRoute.TYPE_FIELD_NUMBER :
dataObject.setType(regStr(stringTable)); skipUnknownField(t);
// dataObject.setType(regStr(stringTable));
break; break;
case OsmandOdb.IncompleteTransportRoute.MISSINGSTOPS_FIELD_NUMBER : case OsmandOdb.IncompleteTransportRoute.MISSINGSTOPS_FIELD_NUMBER :
//// dataObject.getMissingStops().add(codedIS.readSInt32()); //skip for now //// dataObject.getMissingStops().add(codedIS.readSInt32()); //skip for now

View file

@ -808,6 +808,10 @@ 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
if (stop.isMissingStop()) {
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();
@ -947,8 +951,7 @@ public class TransportRoutePlanner {
private TransportRoute combineRoute(TransportRoute route, String fileName) throws IOException { private TransportRoute combineRoute(TransportRoute route, String fileName) throws IOException {
//1.Get all available route parts; //1.Get all available route parts;
List<TransportRoute> result = new ArrayList<>(findIncompleteRouteParts(route)); List<TransportRoute> result = new ArrayList<>(findIncompleteRouteParts(route));
// List<TransportRoute> acceptedCandidates = new ArrayList<TransportRoute>(); List<Way> allWays = getAllWays(result); //TODO check ways for right order? Artifacts during drawing.
List<Way> allWays = getAllWays(result);
//2. Get massive of segments: //2. Get massive of segments:
List<List<TransportStop>> segments = parseRoutePartsToSegments(result); List<List<TransportStop>> segments = parseRoutePartsToSegments(result);
@ -958,9 +961,10 @@ public class TransportRoutePlanner {
//4. Check for missingStops. If they present in the middle/there more then one segment - we have a hole in the map data //4. Check for missingStops. If they present in the middle/there more then one segment - we have a hole in the map data
List<List<TransportStop>> mergedSegments = combineSegments(segments); List<List<TransportStop>> mergedSegments = combineSegments(segments);
//5. Create combined TransportRoute and return it //5. Create combined TransportRoute and return it
if (mergedSegments.size() > 1) { if (mergedSegments.size() > 1) {
//TODO what will we do with incomplete route? //TODO sort incomplete routes (and remove missingStops) and merge into one?
return null; return null;
} else { } else {
return new TransportRoute(route, mergedSegments.get(0), allWays); return new TransportRoute(route, mergedSegments.get(0), allWays);