diff --git a/src/onlinemap.cpp b/src/onlinemap.cpp index 5b6c114d..2fc10d45 100644 --- a/src/onlinemap.cpp +++ b/src/onlinemap.cpp @@ -12,6 +12,7 @@ #define ZOOM_MAX 18 #define ZOOM_MIN 3 +#define TILE_SIZE 256 static QPoint mercator2tile(const QPointF &m, int z) { @@ -23,19 +24,9 @@ static QPoint mercator2tile(const QPointF &m, int z) return tile; } -static QPointF tile2mercator(const QPoint &tile, int z) -{ - QPointF m; - - m.setX(((360.0 * tile.x()) / (qreal)(1< &list) void OnlineMap::fillTile(Tile &tile) { - tile.pixmap() = QPixmap(Tile::size(), Tile::size()); + tile.pixmap() = QPixmap(TILE_SIZE, TILE_SIZE); tile.pixmap().fill(); } @@ -178,7 +169,7 @@ QRectF OnlineMap::bounds() const qreal OnlineMap::zoomFit(const QSize &size, const QRectF &br) { if (br.isNull()) - _scale = ((360.0/(qreal)(1< tiles; QSizeF s(rect.right() - tl.x(), rect.bottom() - tl.y()); - for (int i = 0; i < ceil(s.width() / Tile::size()); i++) - for (int j = 0; j < ceil(s.height() / Tile::size()); j++) + for (int i = 0; i < ceil(s.width() / TILE_SIZE); i++) + for (int j = 0; j < ceil(s.height() / TILE_SIZE); j++) tiles.append(Tile(QPoint(tile.x() + i, tile.y() + j), zoom)); if (_block) @@ -236,8 +226,8 @@ void OnlineMap::draw(QPainter *painter, const QRectF &rect) for (int i = 0; i < tiles.count(); i++) { Tile &t = tiles[i]; - QPoint tp(tl.x() + (t.xy().x() - tile.x()) * Tile::size(), - tl.y() + (t.xy().y() - tile.y()) * Tile::size()); + QPoint tp(tl.x() + (t.xy().x() - tile.x()) * TILE_SIZE, + tl.y() + (t.xy().y() - tile.y()) * TILE_SIZE); painter->drawPixmap(tp, t.pixmap()); } } diff --git a/src/tile.h b/src/tile.h index 3cf5082c..383d2e31 100644 --- a/src/tile.h +++ b/src/tile.h @@ -14,8 +14,6 @@ public: const QPoint& xy() const {return _xy;} QPixmap& pixmap() {return _pixmap;} - static int size() {return 256;} - private: int _zoom; QPoint _xy;