From c82e97b1ca0f419c9da694a0355bbad3e9bf375f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 5 Feb 2021 21:58:34 +0100 Subject: [PATCH] Code cleanup --- src/map/aqmmap.cpp | 11 ++--------- src/map/osm.cpp | 7 +++++++ src/map/osm.h | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/map/aqmmap.cpp b/src/map/aqmmap.cpp index af415444..b00cc8c4 100644 --- a/src/map/aqmmap.cpp +++ b/src/map/aqmmap.cpp @@ -100,13 +100,6 @@ static bool parseLevel(const QByteArray &data, int &zoom, int &tileSize, return true; } -static Coordinates tile2ll(const QPoint &p, int z) -{ - double n = M_PI - 2.0 * M_PI * p.y() / (double)(1 << z); - return Coordinates(p.x() / (double)(1 << z) * 360.0 - 180, - 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n)))); -} - bool AQMMap::readSize(size_t &size) { @@ -200,8 +193,8 @@ bool AQMMap::readHeader() if (!parseLevel(data, zoom, tileSize, bounds)) return false; - _bounds = RectC(tile2ll(bounds.topLeft(), zoom), - tile2ll(bounds.bottomRight(), zoom)); + _bounds = RectC(OSM::tile2ll(bounds.topLeft(), zoom), + OSM::tile2ll(bounds.bottomRight(), zoom)); _zooms.append(Zoom(zoom, tileSize)); } else if (files.at(i).name == "@LEVEL") { li = i; diff --git a/src/map/osm.cpp b/src/map/osm.cpp index 6d8585a7..c12480eb 100644 --- a/src/map/osm.cpp +++ b/src/map/osm.cpp @@ -21,6 +21,13 @@ QPoint OSM::mercator2tile(const QPointF &m, int zoom) qFloor((1.0 - (m.y() / 180.0)) / 2.0 * (1<