1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-04-21 20:59:11 +02:00

Compare commits

..

2 Commits

Author SHA1 Message Date
a281a68cbd Decreased map zoom level treshold to 80%
There are evidently more maps that have bigger diferences in bounding box
latitudes which lead to differnt resolutions for the same zoom level in
Mercator projection than maps that would have zoom level differences < 20%.
2023-09-15 23:28:55 +02:00
2e7f8dc341 Fixed map resolution computation for maps > world/2 2023-09-15 23:28:16 +02:00
2 changed files with 12 additions and 4 deletions

View File

@ -7,7 +7,7 @@
#include "atlas.h"
#define ZOOM_THRESHOLD 0.9
#define ZOOM_THRESHOLD 0.8
#define TL(m) ((m)->xy2pp((m)->bounds().topLeft()))
#define BR(m) ((m)->xy2pp((m)->bounds().bottomRight()))

View File

@ -62,9 +62,17 @@ RectC Map::llBounds()
qreal Map::resolution(const QRectF &rect)
{
qreal cy = rect.center().y();
QPointF cl(rect.left(), cy);
QPointF cr(rect.right(), cy);
/* The haversine formula used in Coordinates::distanceTo() only gives
"half world" distances and shorter so we have to use only the center
"half rectangle" in case e.g. world map bounds are on the input */
QRectF halfRect(QPointF(rect.left() + (rect.width() / 4.0),
rect.top() + (rect.height() / 4.0)),
QPointF(rect.right() - (rect.width() / 4.0),
rect.bottom() - (rect.height() / 4.0)));
qreal cy = halfRect.center().y();
QPointF cl(halfRect.left(), cy);
QPointF cr(halfRect.right(), cy);
qreal ds = xy2ll(cl).distanceTo(xy2ll(cr));
qreal ps = QLineF(cl, cr).length();