1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-21 22:34:23 +02:00

RectC now uses the expected axis direction

+ some more refactoring
This commit is contained in:
2018-04-16 20:26:10 +02:00
parent b26a10a5b3
commit 9e36451001
19 changed files with 90 additions and 115 deletions

View File

@ -122,13 +122,14 @@ QRectF WMTSMap::bounds() const
return _bounds.isValid() ? tileBounds.intersected(bounds) : tileBounds;
}
int WMTSMap::zoomFit(const QSize &size, const RectC &br)
int WMTSMap::zoomFit(const QSize &size, const RectC &rect)
{
if (br.isValid()) {
QRectF tbr(_projection.ll2xy(br.topLeft()).toPointF(),
_projection.ll2xy(br.bottomRight()).toPointF());
QPointF sc(tbr.width() / size.width(), tbr.height() / size.height());
qreal resolution = qMax(qAbs(sc.x()), qAbs(sc.y()));
if (rect.isValid()) {
PointD tl(_projection.ll2xy(rect.topLeft()));
PointD br(_projection.ll2xy(rect.bottomRight()));
PointD sc((br.x() - tl.x()) / size.width(), (tl.y() - br.y())
/ size.height());
double resolution = qMax(qAbs(sc.x()), qAbs(sc.y()));
if (_projection.isGeographic())
resolution *= deg2rad(WGS84_RADIUS);