Add incomplete stops to cached indexes

This commit is contained in:
Victor Shcherb 2020-05-16 19:57:11 +02:00
parent a00011693a
commit 15ce3fa998
3 changed files with 7589 additions and 2660 deletions

View file

@ -26,7 +26,6 @@ import net.osmand.binary.OsmandIndex.PoiPart;
import net.osmand.binary.OsmandIndex.RoutingPart;
import net.osmand.binary.OsmandIndex.RoutingSubregion;
import net.osmand.binary.OsmandIndex.TransportPart;
import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log;
@ -131,6 +130,10 @@ public class CachedOsmandIndexes {
transport.setBottom(index.getBottom());
transport.setStopsTableLength(index.stopsFileLength);
transport.setStopsTableOffset(index.stopsFileOffset);
// if(index.incompleteRoutesLength > 0) {
transport.setIncompleteRoutesLength(index.incompleteRoutesLength);
transport.setIncompleteRoutesOffset(index.incompleteRoutesOffset);
// }
transport.setStringTableLength(index.stringTable.length);
transport.setStringTableOffset(index.stringTable.fileOffset);
fileIndex.addTransportIndex(transport);
@ -269,6 +272,8 @@ public class CachedOsmandIndexes {
mi.bottom = index.getBottom();
mi.stopsFileLength = index.getStopsTableLength();
mi.stopsFileOffset = index.getStopsTableOffset();
mi.incompleteRoutesLength = index.getIncompleteRoutesLength();
mi.incompleteRoutesOffset = index.getIncompleteRoutesOffset();
mi.stringTable = new IndexStringTable();
mi.stringTable.fileOffset = index.getStringTableOffset();
mi.stringTable.length = index.getStringTableLength();

File diff suppressed because it is too large Load diff

View file

@ -726,7 +726,6 @@ public class TransportRoutePlanner {
private final int walkRadiusIn31;
private final int walkChangeRadiusIn31;
private final int missingStopRadiusIn31;
@ -734,7 +733,6 @@ public class TransportRoutePlanner {
this.cfg = cfg;
walkRadiusIn31 = (int) (cfg.walkRadius / MapUtils.getTileDistanceWidth(31));
walkChangeRadiusIn31 = (int) (cfg.walkChangeRadius / MapUtils.getTileDistanceWidth(31));
missingStopRadiusIn31 = (int) (MISSING_STOP_SEARCH_RADIUS / MapUtils.getTileDistanceWidth(31));
quadTree = new TLongObjectHashMap<List<TransportRouteSegment>>();
this.library = library;
for (BinaryMapIndexReader r : readers) {
@ -755,7 +753,6 @@ public class TransportRoutePlanner {
private List<TransportRouteSegment> loadNativeTransportStops(int sx, int sy, boolean change, List<TransportRouteSegment> res) throws IOException {
long nanoTime = System.nanoTime();
int d = change ? walkChangeRadiusIn31 : walkRadiusIn31;
int lx = (sx - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES);
int rx = (sx + d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES);
int ty = (sy - d ) >> (31 - cfg.ZOOM_TO_LOAD_TILES);
@ -770,7 +767,6 @@ public class TransportRoutePlanner {
}
for(TransportRouteSegment r : list) {
TransportStop st = r.getStop(r.segStart);
if (Math.abs(st.x31 - sx) > walkRadiusIn31 || Math.abs(st.y31 - sy) > walkRadiusIn31) {
wrongLoadedWays++;
} else {