diff --git a/src/GUI/mapview.cpp b/src/GUI/mapview.cpp index 82771aa8..1afa5057 100644 --- a/src/GUI/mapview.cpp +++ b/src/GUI/mapview.cpp @@ -503,7 +503,6 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale, // Enter plot mode setUpdatesEnabled(false); _plot = true; - _map->setBlockingMode(true); // Compute sizes & ratios orig = viewport()->rect(); @@ -562,7 +561,6 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale, _mapScale->setPos(origPos); // Exit plot mode - _map->setBlockingMode(false); _plot = false; setUpdatesEnabled(true); } @@ -763,7 +761,7 @@ void MapView::drawBackground(QPainter *painter, const QRectF &rect) QRectF ir = rect.intersected(_map->bounds()); if (_opacity < 1.0) painter->setOpacity(_opacity); - _map->draw(painter, ir); + _map->draw(painter, ir, _plot); } } diff --git a/src/map/atlas.cpp b/src/map/atlas.cpp index 2061bda6..067cebc7 100644 --- a/src/map/atlas.cpp +++ b/src/map/atlas.cpp @@ -260,8 +260,10 @@ Coordinates Atlas::xy2ll(const QPointF &p) return _maps.at(idx)->xy2ll(p2); } -void Atlas::draw(QPainter *painter, const QRectF &rect) +void Atlas::draw(QPainter *painter, const QRectF &rect, bool block) { + Q_UNUSED(block); + // All in one map for (int i = _zooms.at(_zoom).first; i <= _zooms.at(_zoom).second; i++) { if (_bounds.at(i).second.contains(rect)) { @@ -288,7 +290,7 @@ void Atlas::draw(QPainter *painter, const QRectF &rect, int mapIndex) map->load(); painter->translate(offset); - map->draw(painter, pr); + map->draw(painter, pr, true); painter->translate(-offset); } diff --git a/src/map/atlas.h b/src/map/atlas.h index ba4ddc60..06338dfa 100644 --- a/src/map/atlas.h +++ b/src/map/atlas.h @@ -25,7 +25,7 @@ public: QPointF ll2xy(const Coordinates &c); Coordinates xy2ll(const QPointF &p); - void draw(QPainter *painter, const QRectF &rect); + void draw(QPainter *painter, const QRectF &rect, bool block); void unload(); diff --git a/src/map/emptymap.cpp b/src/map/emptymap.cpp index 8033f18c..eb0c8522 100644 --- a/src/map/emptymap.cpp +++ b/src/map/emptymap.cpp @@ -85,8 +85,9 @@ int EmptyMap::zoomOut() return _zoom; } -void EmptyMap::draw(QPainter *painter, const QRectF &rect) +void EmptyMap::draw(QPainter *painter, const QRectF &rect, bool block) { + Q_UNUSED(block); painter->fillRect(rect, _backgroundColor); } diff --git a/src/map/emptymap.h b/src/map/emptymap.h index 214a5638..09af50ea 100644 --- a/src/map/emptymap.h +++ b/src/map/emptymap.h @@ -25,7 +25,7 @@ public: Coordinates xy2ll(const QPointF &p) {return static_cast(*this).xy2ll(p);} - void draw(QPainter *painter, const QRectF &rect); + void draw(QPainter *painter, const QRectF &rect, bool block); private: QPointF ll2xy(const Coordinates &c) const; diff --git a/src/map/map.h b/src/map/map.h index 5cf67ac7..7e2c458e 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -31,9 +31,8 @@ public: virtual QPointF ll2xy(const Coordinates &c) = 0; virtual Coordinates xy2ll(const QPointF &p) = 0; - virtual void draw(QPainter *painter, const QRectF &rect) = 0; + virtual void draw(QPainter *painter, const QRectF &rect, bool block) = 0; - virtual void setBlockingMode(bool block) {Q_UNUSED(block);} virtual void clearCache() {} virtual void load() {} virtual void unload() {} diff --git a/src/map/offlinemap.cpp b/src/map/offlinemap.cpp index 21f11c56..eea0969a 100644 --- a/src/map/offlinemap.cpp +++ b/src/map/offlinemap.cpp @@ -311,8 +311,10 @@ void OfflineMap::drawImage(QPainter *painter, const QRectF &rect) const r.width(), r.height()); } -void OfflineMap::draw(QPainter *painter, const QRectF &rect) +void OfflineMap::draw(QPainter *painter, const QRectF &rect, bool block) { + Q_UNUSED(block); + if (_ozf) drawOZF(painter, rect); else if (_tile.isValid()) diff --git a/src/map/offlinemap.h b/src/map/offlinemap.h index f69543ae..31d9f44f 100644 --- a/src/map/offlinemap.h +++ b/src/map/offlinemap.h @@ -33,7 +33,7 @@ public: Coordinates xy2ll(const QPointF &p) {return static_cast(*this).xy2ll(p);} - void draw(QPainter *painter, const QRectF &rect); + void draw(QPainter *painter, const QRectF &rect, bool block); void load(); void unload(); diff --git a/src/map/onlinemap.cpp b/src/map/onlinemap.cpp index ddadee64..cb4413f2 100644 --- a/src/map/onlinemap.cpp +++ b/src/map/onlinemap.cpp @@ -44,7 +44,7 @@ static int scale2zoom(qreal scale) OnlineMap::OnlineMap(const QString &name, const QString &url, const Range &zooms, const RectC &bounds, const Authorization &authorization, QObject *parent) : Map(parent), _name(name), _zooms(zooms), _bounds(bounds), - _block(false), _valid(false) + _valid(false) { QString dir(TILES_DIR + "/" + _name); @@ -112,7 +112,7 @@ int OnlineMap::zoomOut() return _zoom; } -void OnlineMap::draw(QPainter *painter, const QRectF &rect) +void OnlineMap::draw(QPainter *painter, const QRectF &rect, bool block) { qreal scale = zoom2scale(_zoom); @@ -127,7 +127,7 @@ void OnlineMap::draw(QPainter *painter, const QRectF &rect) for (int j = 0; j < ceil(s.height() / TILE_SIZE); j++) tiles.append(Tile(QPoint(tile.x() + i, tile.y() + j), _zoom)); - if (_block) + if (block) _tileLoader->loadTilesSync(tiles); else _tileLoader->loadTilesAsync(tiles); diff --git a/src/map/onlinemap.h b/src/map/onlinemap.h index b489cdd2..1225960d 100644 --- a/src/map/onlinemap.h +++ b/src/map/onlinemap.h @@ -30,9 +30,8 @@ public: Coordinates xy2ll(const QPointF &p) {return static_cast(*this).xy2ll(p);} - void draw(QPainter *painter, const QRectF &rect); + void draw(QPainter *painter, const QRectF &rect, bool block); - void setBlockingMode(bool block) {_block = block;} void clearCache() {_tileLoader->clearCache();} bool isValid() const {return _valid;} @@ -48,7 +47,6 @@ private: Range _zooms; RectC _bounds; int _zoom; - bool _block; bool _valid; QString _errorString; diff --git a/src/map/wmsmap.cpp b/src/map/wmsmap.cpp index 67690395..9a0f2edc 100644 --- a/src/map/wmsmap.cpp +++ b/src/map/wmsmap.cpp @@ -103,8 +103,7 @@ bool WMSMap::loadWMS() } WMSMap::WMSMap(const QString &name, const WMS::Setup &setup, QObject *parent) - : Map(parent), _name(name), _setup(setup), _zoom(0), _block(false), - _valid(false) + : Map(parent), _name(name), _setup(setup), _zoom(0), _valid(false) { if (!QDir().mkpath(tilesDir())) { _errorString = "Error creating tiles dir"; @@ -187,7 +186,7 @@ Coordinates WMSMap::xy2ll(const QPointF &p) const return _projection.xy2ll(_transform.img2proj(p)); } -void WMSMap::draw(QPainter *painter, const QRectF &rect) +void WMSMap::draw(QPainter *painter, const QRectF &rect, bool block) { QPoint tl = QPoint((int)floor(rect.left() / (qreal)TILE_SIZE), (int)floor(rect.top() / (qreal)TILE_SIZE)); @@ -209,7 +208,7 @@ void WMSMap::draw(QPainter *painter, const QRectF &rect) } } - if (_block) + if (block) _tileLoader->loadTilesSync(tiles); else _tileLoader->loadTilesAsync(tiles); diff --git a/src/map/wmsmap.h b/src/map/wmsmap.h index 099123f3..482b957f 100644 --- a/src/map/wmsmap.h +++ b/src/map/wmsmap.h @@ -30,9 +30,8 @@ public: Coordinates xy2ll(const QPointF &p) {return static_cast(*this).xy2ll(p);} - void draw(QPainter *painter, const QRectF &rect); + void draw(QPainter *painter, const QRectF &rect, bool block); - void setBlockingMode(bool block) {_block = block;} void clearCache(); bool isValid() const {return _valid;} @@ -60,7 +59,6 @@ private: PointD _tl, _br; QRectF _bounds; int _zoom; - bool _block; bool _valid; QString _errorString; diff --git a/src/map/wmtsmap.cpp b/src/map/wmtsmap.cpp index f07b126a..a11da330 100644 --- a/src/map/wmtsmap.cpp +++ b/src/map/wmtsmap.cpp @@ -36,8 +36,7 @@ bool WMTSMap::loadWMTS() } WMTSMap::WMTSMap(const QString &name, const WMTS::Setup &setup, QObject *parent) - : Map(parent), _name(name), _setup(setup), _zoom(0), _block(false), - _valid(false) + : Map(parent), _name(name), _setup(setup), _zoom(0), _valid(false) { if (!QDir().mkpath(tilesDir())) { _errorString = "Error creating tiles dir"; @@ -158,7 +157,7 @@ int WMTSMap::zoomOut() return _zoom; } -void WMTSMap::draw(QPainter *painter, const QRectF &rect) +void WMTSMap::draw(QPainter *painter, const QRectF &rect, bool block) { const WMTS::Zoom &z = _zooms.at(_zoom); QPoint tl = QPoint((int)floor(rect.left() / (qreal)z.tile().width()), @@ -171,7 +170,7 @@ void WMTSMap::draw(QPainter *painter, const QRectF &rect) for (int j = tl.y(); j < br.y(); j++) tiles.append(Tile(QPoint(i, j), z.id())); - if (_block) + if (block) _tileLoader->loadTilesSync(tiles); else _tileLoader->loadTilesAsync(tiles); diff --git a/src/map/wmtsmap.h b/src/map/wmtsmap.h index 4fdb734c..c961a7cd 100644 --- a/src/map/wmtsmap.h +++ b/src/map/wmtsmap.h @@ -30,9 +30,8 @@ public: Coordinates xy2ll(const QPointF &p) {return static_cast(*this).xy2ll(p);} - void draw(QPainter *painter, const QRectF &rect); + void draw(QPainter *painter, const QRectF &rect, bool block); - void setBlockingMode(bool block) {_block = block;} void clearCache(); bool isValid() const {return _valid;} @@ -56,7 +55,6 @@ private: Transform _transform; CoordinateSystem _cs; int _zoom; - bool _block; bool _valid; QString _errorString;