diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index 304076e001..3b5ae0c006 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -316,6 +316,7 @@ public class MapRenderRepositories { searchFilter = null; } boolean ocean = false; + boolean land = false; MapIndex mi = null; searchRequest = BinaryMapIndexReader.buildSearchRequest(leftX, rightX, topY, bottomY, zoom, searchFilter); for (BinaryMapIndexReader c : files.values()) { @@ -353,8 +354,10 @@ public class MapRenderRepositories { if (searchRequest.isOcean()) { mi = c.getMapIndexes().get(0); ocean = true; - } else if (searchRequest.isLand()) { + } + if (searchRequest.isLand()) { mi = c.getMapIndexes().get(0); + land = true; } } @@ -379,7 +382,7 @@ public class MapRenderRepositories { } if(addBasemapCoastlines && mi != null){ BinaryMapDataObject o = new BinaryMapDataObject(new int[] { leftX, topY, rightX, topY, rightX, bottomY, leftX, bottomY, leftX, - topY }, new int[] { ocean ? mi.coastlineEncodingType : (mi.landEncodingType) }, null, -1); + topY }, new int[] { ocean && !land ? mi.coastlineEncodingType : (mi.landEncodingType) }, null, -1); o.setMapIndex(mi); tempResult.add(o); } diff --git a/Osmand-kernel/osmand/src/binaryRead.cpp b/Osmand-kernel/osmand/src/binaryRead.cpp index 474965d6c3..ddc90e253a 100644 --- a/Osmand-kernel/osmand/src/binaryRead.cpp +++ b/Osmand-kernel/osmand/src/binaryRead.cpp @@ -744,7 +744,7 @@ bool searchMapTreeBounds(CodedInputStream* input, MapTreeBounds* current, MapTre if(current->ocean){ req->ocean = true; } else { - req->land = true; + req->mixed = true; } break; } @@ -882,7 +882,6 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates, map::iterator i = openFiles.begin(); UNORDERED(set) ids; int count = 0; - bool ocean = false; std::vector basemapResult; std::vector tempResult; std::vector coastLines; @@ -941,9 +940,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates, } } } - if (q->ocean) { - ocean = true; - } + if (!q->publisher->isCancelled()) { std::vector::iterator r = q->publisher->result.begin(); tempResult.reserve((size_t)(q->publisher->result.size() + tempResult.size())); @@ -982,6 +979,8 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates, deleteObjects(basemapCoastLines); deleteObjects(basemapResult); } else { + bool ocean = q->ocean; + bool land = q->mixed; bool addBasemapCoastlines = true; bool emptyData = q->zoom > BASEMAP_ZOOM && tempResult.empty() && coastLines.empty(); bool basemapMissing = q->zoom <= BASEMAP_ZOOM && basemapCoastLines.empty() && !basemapExists; @@ -1006,7 +1005,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates, o->points.push_back(int_pair(q->right, q->bottom)); o->points.push_back(int_pair(q->left, q->bottom)); o->points.push_back(int_pair(q->left, q->top)); - if (ocean) { + if (ocean && !land) { o->types.push_back(tag_value("natural", "coastline")); } else { o->types.push_back(tag_value("natural", "land")); diff --git a/Osmand-kernel/osmand/src/binaryRead.h b/Osmand-kernel/osmand/src/binaryRead.h index 94c36bd741..61046d60b8 100644 --- a/Osmand-kernel/osmand/src/binaryRead.h +++ b/Osmand-kernel/osmand/src/binaryRead.h @@ -221,7 +221,7 @@ struct SearchQuery { coordinates cacheCoordinates; bool ocean; - bool land; + bool mixed; int numberOfVisitedObjects; int numberOfAcceptedObjects; @@ -232,7 +232,7 @@ struct SearchQuery { req(req), left(l), right(r), top(t), bottom(b),publisher(publisher) { numberOfAcceptedObjects = numberOfVisitedObjects = 0; numberOfAcceptedSubtrees = numberOfReadSubtrees = 0; - ocean = land = false; + ocean = mixed = false; } SearchQuery(int l, int r, int t, int b) : req(req), left(l), right(r), top(t), bottom(b) {