diff --git a/src/common/range.h b/src/common/range.h index 226f889f..c8987f86 100644 --- a/src/common/range.h +++ b/src/common/range.h @@ -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);} diff --git a/src/map/IMG/gmapdata.cpp b/src/map/IMG/gmapdata.cpp index c0c0c601..becdd9f9 100644 --- a/src/map/IMG/gmapdata.cpp +++ b/src/map/IMG/gmapdata.cpp @@ -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; } diff --git a/src/map/IMG/imgdata.cpp b/src/map/IMG/imgdata.cpp index b6b22787..112e13ff 100644 --- a/src/map/IMG/imgdata.cpp +++ b/src/map/IMG/imgdata.cpp @@ -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 diff --git a/src/map/IMG/trefile.cpp b/src/map/IMG/trefile.cpp index df89d711..533607ca 100644 --- a/src/map/IMG/trefile.cpp +++ b/src/map/IMG/trefile.cpp @@ -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; } diff --git a/src/map/IMG/trefile.h b/src/map/IMG/trefile.h index e8347238..4161a807 100644 --- a/src/map/IMG/trefile.h +++ b/src/map/IMG/trefile.h @@ -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 _subdivs; }; diff --git a/src/map/IMG/vectortile.h b/src/map/IMG/vectortile.h index f8edebca..a0d818ff 100644 --- a/src/map/IMG/vectortile.h +++ b/src/map/IMG/vectortile.h @@ -20,7 +20,6 @@ public: } bool init(); - void markAsBasemap() {_tre->markAsBasemap();} void clear(); const RectC &bounds() const {return _tre->bounds();}