1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Explicitly marking the basemaps is not required

This commit is contained in:
Martin Tůma 2022-04-24 09:17:28 +02:00
parent 959d08ba94
commit 208e31c6de
6 changed files with 11 additions and 14 deletions

View File

@ -10,6 +10,11 @@ public:
Range() {_min = 0; _max = 0;}
Range(int min, int max) : _min(min), _max(max) {}
bool operator==(const Range &other) const
{return _min == other._min && _max == other._max;}
bool operator!=(const Range &other) const
{return _min != other._min || _max != other._max;}
int min() const {return _min;}
int max() const {return _max;}
int size() const {return (_max - _min);}

View File

@ -94,10 +94,6 @@ bool GMAPData::loadTile(const QDir &dir, bool baseMap)
delete tile;
return false;
}
if (baseMap) {
tile->markAsBasemap();
_baseMap = tile->zooms();
}
double min[2], max[2];
min[0] = tile->bounds().left();
@ -110,6 +106,9 @@ bool GMAPData::loadTile(const QDir &dir, bool baseMap)
if (tile->zooms().min() < _zooms.min())
_zooms.setMin(tile->zooms().min());
if (baseMap)
_baseMap = tile->zooms();
return true;
}

View File

@ -175,10 +175,8 @@ bool IMGData::createTileTree(const TileMap &tileMap)
for (_tileTree.GetFirst(it); !_tileTree.IsNull(it);
_tileTree.GetNext(it)) {
VectorTile *tile = _tileTree.GetAt(it);
if (tile->zooms().min() == _zooms.min()) {
tile->markAsBasemap();
if (tile->zooms().min() == _zooms.min())
_baseMap = tile->zooms();
}
}
} else {
/* Allow some extra zoom out on maps without basemaps, but not too much

View File

@ -122,8 +122,6 @@ bool TREFile::init()
}
}
_isBaseMap = false;
return (_firstLevel >= 0);
}
@ -287,9 +285,9 @@ void TREFile::clear()
int TREFile::level(int bits, const Range &baseMap)
{
if (!baseMap.isNull()) {
if (!_isBaseMap && bits <= baseMap.max())
if (zooms() != baseMap && bits <= baseMap.max())
return -1;
if (_isBaseMap && bits > baseMap.max())
if (zooms() == baseMap && bits > baseMap.max())
return -1;
}

View File

@ -25,7 +25,6 @@ public:
~TREFile();
bool init();
void markAsBasemap() {_isBaseMap = true;}
void clear();
const RectC &bounds() const {return _bounds;}
@ -56,7 +55,6 @@ private:
quint32 _flags;
quint16 _extItemSize;
int _firstLevel;
bool _isBaseMap;
QMap<int, SubDivTree*> _subdivs;
};

View File

@ -20,7 +20,6 @@ public:
}
bool init();
void markAsBasemap() {_tre->markAsBasemap();}
void clear();
const RectC &bounds() const {return _tre->bounds();}