Do not render maps < 7 zoom

This commit is contained in:
Victor Shcherb 2012-12-20 18:40:43 +01:00
parent fcef6afe79
commit e9adad5df9

View file

@ -21,6 +21,7 @@ using google::protobuf::internal::WireFormatLite;
//using namespace google::protobuf::internal; //using namespace google::protobuf::internal;
static int zoomForBaseRouteRendering = 14; static int zoomForBaseRouteRendering = 14;
static int zoomOnlyForBasemaps = 7;
std::map< std::string, BinaryMapFile* > openFiles; std::map< std::string, BinaryMapFile* > openFiles;
OsmAndStoredIndex* cache = NULL; OsmAndStoredIndex* cache = NULL;
typedef UNORDERED(set)<long long> IDS_SET; typedef UNORDERED(set)<long long> IDS_SET;
@ -1117,16 +1118,20 @@ void readMapObjectsForRendering(SearchQuery* q, std::vector<MapDataObject*> & ba
// TODO skip duplicates doesn't work correctly with basemap ? // TODO skip duplicates doesn't work correctly with basemap ?
skipDuplicates = false; skipDuplicates = false;
} }
IDS_SET ids;
map<std::string, BinaryMapFile*>::iterator i = openFiles.begin(); map<std::string, BinaryMapFile*>::iterator i = openFiles.begin();
for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) {
BinaryMapFile* file = i->second;
basemapExists |= file->isBasemap();
}
IDS_SET ids;
i = openFiles.begin();
for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) { for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) {
BinaryMapFile* file = i->second; BinaryMapFile* file = i->second;
if (q->req != NULL) { if (q->req != NULL) {
q->req->clearState(); q->req->clearState();
} }
q->publisher->result.clear(); q->publisher->result.clear();
basemapExists |= file->isBasemap(); if((renderRouteDataFile == 1 || q->zoom < zoomOnlyForBasemaps) && !file->isBasemap()) {
if(renderRouteDataFile == 1 && !file->isBasemap()) {
continue; continue;
} else if (!q->publisher->isCancelled()) { } else if (!q->publisher->isCancelled()) {
readMapObjects(q, file); readMapObjects(q, file);
@ -1172,7 +1177,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
readMapObjectsForRendering(q, basemapResult, tempResult, coastLines, basemapCoastLines, count, readMapObjectsForRendering(q, basemapResult, tempResult, coastLines, basemapCoastLines, count,
basemapExists, renderRouteDataFile, skipDuplicates); basemapExists, renderRouteDataFile, skipDuplicates);
if (renderRouteDataFile >= 0) { if (renderRouteDataFile >= 0 && q->zoom >= zoomOnlyForBasemaps) {
IDS_SET ids; IDS_SET ids;
map<std::string, BinaryMapFile*>::iterator i = openFiles.begin(); map<std::string, BinaryMapFile*>::iterator i = openFiles.begin();
for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) { for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) {