Fix road only maps

This commit is contained in:
Victor Shcherb 2015-05-13 22:07:38 +02:00
parent 32f4f47e79
commit 6ba1768018
2 changed files with 14 additions and 1 deletions

View file

@ -289,6 +289,18 @@ public class BinaryMapIndexReader {
return routingIndexes.size() > 0;
}
public boolean containsRouteData(int left31x, int top31y, int right31x, int bottom31y, int zoom) {
for (RouteRegion ri : routingIndexes) {
List<RouteSubregion> sr = ri.getSubregions();
for (RouteSubregion r : sr) {
if (right31x >= r.left && left31x <= r.right && r.top <= bottom31y && r.bottom >= top31y) {
return true;
}
}
}
return false;
}
public boolean containsPoiData(double latitude, double longitude) {
for (PoiRegion index : poiIndexes) {
if (index.rightLongitude >= longitude && index.leftLongitude <= longitude &&

View file

@ -260,7 +260,8 @@ public class MapRenderRepositories {
// check that everything is initialized
for (String mapName : files.keySet()) {
BinaryMapIndexReader fr = files.get(mapName);
if (fr != null && fr.containsMapData(leftX, topY, rightX, bottomY, zoom)) {
if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) ||
fr.containsRouteData(leftX, topY, rightX, bottomY, zoom))) {
if (!nativeFiles.contains(mapName)) {
long time = System.currentTimeMillis();
nativeFiles.add(mapName);