From 2f24bb5462d8737fd6801aef97d35c0d9c769f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 10 Jul 2019 21:49:46 +0200 Subject: [PATCH] Some more code cleanup --- src/map/imgmap.cpp | 16 ++++++++-------- src/map/imgmap.h | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/map/imgmap.cpp b/src/map/imgmap.cpp index 96406328..e8d5afa5 100644 --- a/src/map/imgmap.cpp +++ b/src/map/imgmap.cpp @@ -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; } diff --git a/src/map/imgmap.h b/src/map/imgmap.h index 39a0dcc7..73866266 100644 --- a/src/map/imgmap.h +++ b/src/map/imgmap.h @@ -56,7 +56,6 @@ private: IMG _img; int _zoom; - Range _zooms; Projection _projection; Transform _transform;