From 66961e49f00f98df18d29cd175e5392036db80b3 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 13 May 2015 22:07:38 +0200 Subject: [PATCH] Fix road only maps --- .../src/net/osmand/binary/BinaryMapIndexReader.java | 12 ++++++++++++ .../osmand/plus/render/MapRenderRepositories.java | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java index 73d1fd2dbc..beb84615d0 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java @@ -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 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 && diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index 719f5c9b14..4922cd5f8b 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -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);