diff --git a/src/map/atlas.cpp b/src/map/atlas.cpp index 01318e8f..076b87b6 100644 --- a/src/map/atlas.cpp +++ b/src/map/atlas.cpp @@ -22,12 +22,12 @@ static bool resCmp(OfflineMap *m1, OfflineMap *m2) return r1 > r2; } -static bool xCmp(const OfflineMap *m1, const OfflineMap *m2) +static bool xCmp(OfflineMap *m1, OfflineMap *m2) { return TL(m1).x() < TL(m2).x(); } -static bool yCmp(const OfflineMap *m1, const OfflineMap *m2) +static bool yCmp(OfflineMap *m1, OfflineMap *m2) { return TL(m1).y() > TL(m2).y(); } @@ -147,7 +147,7 @@ Atlas::Atlas(const QString &fileName, QObject *parent) _valid = true; } -QRectF Atlas::bounds() const +QRectF Atlas::bounds() { QSizeF s(0, 0); diff --git a/src/map/atlas.h b/src/map/atlas.h index f3a2f78b..fda52370 100644 --- a/src/map/atlas.h +++ b/src/map/atlas.h @@ -13,9 +13,9 @@ class Atlas : public Map public: Atlas(const QString &fileName, QObject *parent = 0); - const QString &name() const {return _name;} + QString name() const {return _name;} - QRectF bounds() const; + QRectF bounds(); int zoom() const {return _zoom;} void setZoom(int zoom); diff --git a/src/map/emptymap.cpp b/src/map/emptymap.cpp index bbdc1986..967d86a1 100644 --- a/src/map/emptymap.cpp +++ b/src/map/emptymap.cpp @@ -46,7 +46,7 @@ EmptyMap::EmptyMap(QObject *parent) : Map(parent) _zoom = ZOOM_MAX; } -QRectF EmptyMap::bounds() const +QRectF EmptyMap::bounds() { return QRectF(ll2xy(Coordinates(-180, 85)), ll2xy(Coordinates(180, -85))); } @@ -92,14 +92,14 @@ void EmptyMap::draw(QPainter *painter, const QRectF &rect, bool block) Q_UNUSED(block); } -QPointF EmptyMap::ll2xy(const Coordinates &c) const +QPointF EmptyMap::ll2xy(const Coordinates &c) { qreal scale = zoom2scale(_zoom); QPointF m = ll2m(c); return QPointF(m.x() / scale, m.y() / -scale); } -Coordinates EmptyMap::xy2ll(const QPointF &p) const +Coordinates EmptyMap::xy2ll(const QPointF &p) { qreal scale = zoom2scale(_zoom); return m2ll(QPointF(p.x() * scale, -p.y() * scale)); diff --git a/src/map/emptymap.h b/src/map/emptymap.h index d16725aa..3e190c23 100644 --- a/src/map/emptymap.h +++ b/src/map/emptymap.h @@ -10,9 +10,9 @@ class EmptyMap : public Map public: EmptyMap(QObject *parent = 0); - const QString &name() const {return _name;} + QString name() const {return QString();} - QRectF bounds() const; + QRectF bounds(); qreal resolution(const QRectF &rect); int zoom() const {return _zoom;} @@ -21,18 +21,12 @@ public: int zoomIn(); int zoomOut(); - QPointF ll2xy(const Coordinates &c) - {return static_cast(*this).ll2xy(c);} - Coordinates xy2ll(const QPointF &p) - {return static_cast(*this).xy2ll(p);} + QPointF ll2xy(const Coordinates &c); + Coordinates xy2ll(const QPointF &p); void draw(QPainter *painter, const QRectF &rect, bool block); private: - QPointF ll2xy(const Coordinates &c) const; - Coordinates xy2ll(const QPointF &p) const; - - QString _name; int _zoom; }; diff --git a/src/map/jnxmap.cpp b/src/map/jnxmap.cpp index 2f30acf6..55dd2772 100644 --- a/src/map/jnxmap.cpp +++ b/src/map/jnxmap.cpp @@ -158,7 +158,7 @@ Coordinates JNXMap::xy2ll(const QPointF &p) return Coordinates(pp.x(), pp.y()); } -QRectF JNXMap::bounds() const +QRectF JNXMap::bounds() { const Transform &t = _zooms.at(_zoom).transform; diff --git a/src/map/jnxmap.h b/src/map/jnxmap.h index 7461a5ba..db5a6d69 100644 --- a/src/map/jnxmap.h +++ b/src/map/jnxmap.h @@ -16,9 +16,9 @@ public: public: JNXMap(const QString &fileName, QObject *parent = 0); - const QString &name() const {return _name;} + QString name() const {return _name;} - QRectF bounds() const; + QRectF bounds(); int zoom() const {return _zoom;} void setZoom(int zoom) {_zoom = zoom;} diff --git a/src/map/map.h b/src/map/map.h index 3b96c81e..dc9c8473 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -18,9 +18,9 @@ public: Map(QObject *parent = 0) : QObject(parent) {} virtual ~Map() {} - virtual const QString &name() const = 0; + virtual QString name() const = 0; - virtual QRectF bounds() const = 0; + virtual QRectF bounds() = 0; virtual qreal resolution(const QRectF &rect); virtual int zoom() const = 0; diff --git a/src/map/offlinemap.cpp b/src/map/offlinemap.cpp index b4732747..a1f2f8e9 100644 --- a/src/map/offlinemap.cpp +++ b/src/map/offlinemap.cpp @@ -333,7 +333,7 @@ Coordinates OfflineMap::xy2ll(const QPointF &p) : _projection.xy2ll(_transform.img2proj(p)); } -QRectF OfflineMap::bounds() const +QRectF OfflineMap::bounds() { return _ozf ? QRectF(QPointF(0, 0), _ozf->size(_zoom)) diff --git a/src/map/offlinemap.h b/src/map/offlinemap.h index ecf953be..4b7abefd 100644 --- a/src/map/offlinemap.h +++ b/src/map/offlinemap.h @@ -18,9 +18,9 @@ public: OfflineMap(const QString &fileName, Tar &tar, QObject *parent = 0); ~OfflineMap(); - const QString &name() const {return _name;} + QString name() const {return _name;} - QRectF bounds() const; + QRectF bounds(); int zoom() const {return _zoom;} void setZoom(int zoom) {_zoom = zoom;} diff --git a/src/map/onlinemap.cpp b/src/map/onlinemap.cpp index ac128917..bf8cc31a 100644 --- a/src/map/onlinemap.cpp +++ b/src/map/onlinemap.cpp @@ -64,7 +64,7 @@ OnlineMap::OnlineMap(const QString &name, const QString &url, _valid = true; } -QRectF OnlineMap::bounds() const +QRectF OnlineMap::bounds() { return QRectF(ll2xy(_bounds.topLeft()), ll2xy(_bounds.bottomRight())); } @@ -141,14 +141,14 @@ void OnlineMap::draw(QPainter *painter, const QRectF &rect, bool block) } } -QPointF OnlineMap::ll2xy(const Coordinates &c) const +QPointF OnlineMap::ll2xy(const Coordinates &c) { qreal scale = zoom2scale(_zoom); QPointF m = ll2m(c); return QPointF(m.x() / scale, m.y() / -scale); } -Coordinates OnlineMap::xy2ll(const QPointF &p) const +Coordinates OnlineMap::xy2ll(const QPointF &p) { qreal scale = zoom2scale(_zoom); return m2ll(QPointF(p.x() * scale, -p.y() * scale)); diff --git a/src/map/onlinemap.h b/src/map/onlinemap.h index d2fb45b9..f87e5143 100644 --- a/src/map/onlinemap.h +++ b/src/map/onlinemap.h @@ -15,9 +15,9 @@ public: const RectC &bounds, const Authorization &authorization, QObject *parent = 0); - const QString &name() const {return _name;} + QString name() const {return _name;} - QRectF bounds() const; + QRectF bounds(); qreal resolution(const QRectF &rect); int zoom() const {return _zoom;} @@ -26,10 +26,8 @@ public: int zoomIn(); int zoomOut(); - QPointF ll2xy(const Coordinates &c) - {return static_cast(*this).ll2xy(c);} - Coordinates xy2ll(const QPointF &p) - {return static_cast(*this).xy2ll(p);} + QPointF ll2xy(const Coordinates &c); + Coordinates xy2ll(const QPointF &p); void draw(QPainter *painter, const QRectF &rect, bool block); @@ -39,8 +37,6 @@ public: QString errorString() const {return _errorString;} private: - QPointF ll2xy(const Coordinates &c) const; - Coordinates xy2ll(const QPointF &p) const; int limitZoom(int zoom) const; TileLoader *_tileLoader; diff --git a/src/map/wmsmap.cpp b/src/map/wmsmap.cpp index efdb0c6b..37ca585e 100644 --- a/src/map/wmsmap.cpp +++ b/src/map/wmsmap.cpp @@ -127,7 +127,7 @@ void WMSMap::clearCache() qWarning("%s: %s\n", qPrintable(_name), qPrintable(_errorString)); } -QRectF WMSMap::bounds() const +QRectF WMSMap::bounds() { return QRectF(_transform.proj2img(_bbox.topLeft()), _transform.proj2img(_bbox.bottomRight())); diff --git a/src/map/wmsmap.h b/src/map/wmsmap.h index 2c44ca0a..9e70b50a 100644 --- a/src/map/wmsmap.h +++ b/src/map/wmsmap.h @@ -16,9 +16,9 @@ class WMSMap : public Map public: WMSMap(const QString &name, const WMS::Setup &setup, QObject *parent = 0); - const QString &name() const {return _name;} + QString name() const {return _name;} - QRectF bounds() const; + QRectF bounds(); int zoom() const {return _zoom;} void setZoom(int zoom); diff --git a/src/map/wmtsmap.cpp b/src/map/wmtsmap.cpp index 8ddbf26f..611f7850 100644 --- a/src/map/wmtsmap.cpp +++ b/src/map/wmtsmap.cpp @@ -91,7 +91,7 @@ void WMTSMap::updateTransform() _transform = Transform(tl, br); } -QRectF WMTSMap::bounds() const +QRectF WMTSMap::bounds() { const WMTS::Zoom &z = _zooms.at(_zoom); QRectF tileBounds, bounds; @@ -179,12 +179,12 @@ void WMTSMap::draw(QPainter *painter, const QRectF &rect, bool block) } } -QPointF WMTSMap::ll2xy(const Coordinates &c) const +QPointF WMTSMap::ll2xy(const Coordinates &c) { return _transform.proj2img(_projection.ll2xy(c)); } -Coordinates WMTSMap::xy2ll(const QPointF &p) const +Coordinates WMTSMap::xy2ll(const QPointF &p) { return _projection.xy2ll(_transform.img2proj(p)); } diff --git a/src/map/wmtsmap.h b/src/map/wmtsmap.h index e177ea55..8fd22a0b 100644 --- a/src/map/wmtsmap.h +++ b/src/map/wmtsmap.h @@ -15,9 +15,9 @@ class WMTSMap : public Map public: WMTSMap(const QString &name, const WMTS::Setup &setup, QObject *parent = 0); - const QString &name() const {return _name;} + QString name() const {return _name;} - QRectF bounds() const; + QRectF bounds(); int zoom() const {return _zoom;} void setZoom(int zoom); @@ -25,10 +25,8 @@ public: int zoomIn(); int zoomOut(); - QPointF ll2xy(const Coordinates &c) - {return static_cast(*this).ll2xy(c);} - Coordinates xy2ll(const QPointF &p) - {return static_cast(*this).xy2ll(p);} + QPointF ll2xy(const Coordinates &c); + Coordinates xy2ll(const QPointF &p); void draw(QPainter *painter, const QRectF &rect, bool block); @@ -43,9 +41,6 @@ private: QString tilesDir() const; void updateTransform(); - QPointF ll2xy(const Coordinates &c) const; - Coordinates xy2ll(const QPointF &p) const; - QString _name; WMTS::Setup _setup; TileLoader *_tileLoader;