mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Some more code cleanup
This commit is contained in:
parent
c1fdb21fad
commit
2f24bb5462
@ -68,6 +68,8 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static Range zooms(12, 28);
|
||||||
|
|
||||||
static QColor shieldColor(Qt::white);
|
static QColor shieldColor(Qt::white);
|
||||||
static QColor shieldBgColor1("#dd3e3e");
|
static QColor shieldBgColor1("#dd3e3e");
|
||||||
static QColor shieldBgColor2("#379947");
|
static QColor shieldBgColor2("#379947");
|
||||||
@ -186,9 +188,7 @@ IMGMap::IMGMap(const QString &fileName, QObject *parent)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_zooms = Range(12, 28);
|
_zoom = zooms.min();
|
||||||
_zoom = _zooms.min();
|
|
||||||
|
|
||||||
updateTransform();
|
updateTransform();
|
||||||
|
|
||||||
_valid = true;
|
_valid = true;
|
||||||
@ -216,8 +216,8 @@ int IMGMap::zoomFit(const QSize &size, const RectC &rect)
|
|||||||
if (rect.isValid()) {
|
if (rect.isValid()) {
|
||||||
RectD pr(rect, _projection, 10);
|
RectD pr(rect, _projection, 10);
|
||||||
|
|
||||||
_zoom = _zooms.min();
|
_zoom = zooms.min();
|
||||||
for (int i = _zooms.min() + 1; i <= _zooms.max(); i++) {
|
for (int i = zooms.min() + 1; i <= zooms.max(); i++) {
|
||||||
Transform t(transform(i));
|
Transform t(transform(i));
|
||||||
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
|
QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight()));
|
||||||
if (size.width() < r.width() || size.height() < r.height())
|
if (size.width() < r.width() || size.height() < r.height())
|
||||||
@ -225,7 +225,7 @@ int IMGMap::zoomFit(const QSize &size, const RectC &rect)
|
|||||||
_zoom = i;
|
_zoom = i;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
_zoom = _zooms.max();
|
_zoom = zooms.max();
|
||||||
|
|
||||||
updateTransform();
|
updateTransform();
|
||||||
|
|
||||||
@ -234,14 +234,14 @@ int IMGMap::zoomFit(const QSize &size, const RectC &rect)
|
|||||||
|
|
||||||
int IMGMap::zoomIn()
|
int IMGMap::zoomIn()
|
||||||
{
|
{
|
||||||
_zoom = qMin(_zoom + 1, _zooms.max());
|
_zoom = qMin(_zoom + 1, zooms.max());
|
||||||
updateTransform();
|
updateTransform();
|
||||||
return _zoom;
|
return _zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IMGMap::zoomOut()
|
int IMGMap::zoomOut()
|
||||||
{
|
{
|
||||||
_zoom = qMax(_zoom - 1, _zooms.min());
|
_zoom = qMax(_zoom - 1, zooms.min());
|
||||||
updateTransform();
|
updateTransform();
|
||||||
return _zoom;
|
return _zoom;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,6 @@ private:
|
|||||||
|
|
||||||
IMG _img;
|
IMG _img;
|
||||||
int _zoom;
|
int _zoom;
|
||||||
Range _zooms;
|
|
||||||
Projection _projection;
|
Projection _projection;
|
||||||
Transform _transform;
|
Transform _transform;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user