From e30078a63e1c69fc92d815ade525e7dbb86e56d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 27 Nov 2017 23:50:55 +0100 Subject: [PATCH] Code cleanup --- src/map/onlinemap.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/map/onlinemap.cpp b/src/map/onlinemap.cpp index 1bac4f48..8f10df9f 100644 --- a/src/map/onlinemap.cpp +++ b/src/map/onlinemap.cpp @@ -199,8 +199,8 @@ qreal OnlineMap::zoomFit(const QSize &size, const RectC &br) qreal OnlineMap::zoomFit(qreal resolution, const Coordinates &c) { - _zoom = limitZoom((int)(log2((WGS84_RADIUS * 2 * M_PI - * cos(deg2rad(c.lat()))) / resolution) - log2(TILE_SIZE))); + _zoom = limitZoom((int)log2((WGS84_RADIUS * 2.0 * M_PI + * cos(deg2rad(c.lat()))) / (resolution * TILE_SIZE))); return _zoom; } @@ -209,7 +209,7 @@ qreal OnlineMap::resolution(const QPointF &p) const { qreal scale = zoom2scale(_zoom); - return (WGS84_RADIUS * 2 * M_PI * scale / 360.0 + return (WGS84_RADIUS * 2.0 * M_PI * scale / 360.0 * cos(2.0 * atan(exp(deg2rad(-p.y() * scale))) - M_PI/2)); }