1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Some more code cleanup

This commit is contained in:
Martin Tůma 2019-07-10 21:49:46 +02:00
parent c1fdb21fad
commit 2f24bb5462
2 changed files with 8 additions and 9 deletions

View File

@ -68,6 +68,8 @@ private:
};
static Range zooms(12, 28);
static QColor shieldColor(Qt::white);
static QColor shieldBgColor1("#dd3e3e");
static QColor shieldBgColor2("#379947");
@ -186,9 +188,7 @@ IMGMap::IMGMap(const QString &fileName, QObject *parent)
return;
}
_zooms = Range(12, 28);
_zoom = _zooms.min();
_zoom = zooms.min();
updateTransform();
_valid = true;
@ -216,8 +216,8 @@ int IMGMap::zoomFit(const QSize &size, const RectC &rect)
if (rect.isValid()) {
RectD pr(rect, _projection, 10);
_zoom = _zooms.min();
for (int i = _zooms.min() + 1; i <= _zooms.max(); i++) {
_zoom = zooms.min();
for (int i = zooms.min() + 1; i <= zooms.max(); i++) {
Transform t(transform(i));
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
if (size.width() < r.width() || size.height() < r.height())
@ -225,7 +225,7 @@ int IMGMap::zoomFit(const QSize &size, const RectC &rect)
_zoom = i;
}
} else
_zoom = _zooms.max();
_zoom = zooms.max();
updateTransform();
@ -234,14 +234,14 @@ int IMGMap::zoomFit(const QSize &size, const RectC &rect)
int IMGMap::zoomIn()
{
_zoom = qMin(_zoom + 1, _zooms.max());
_zoom = qMin(_zoom + 1, zooms.max());
updateTransform();
return _zoom;
}
int IMGMap::zoomOut()
{
_zoom = qMax(_zoom - 1, _zooms.min());
_zoom = qMax(_zoom - 1, zooms.min());
updateTransform();
return _zoom;
}

View File

@ -56,7 +56,6 @@ private:
IMG _img;
int _zoom;
Range _zooms;
Projection _projection;
Transform _transform;