1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-31 09:05:14 +01:00

Fixed broken returning from print mode

This commit is contained in:
Martin Tůma 2018-04-28 22:18:11 +02:00
parent 9eb2e38499
commit beb966c58f
11 changed files with 29 additions and 4 deletions

View File

@ -497,7 +497,7 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
QRect orig, adj;
qreal ratio, diff, q;
QPointF origScene, origPos;
RectC origC;
int zoom;
// Enter plot mode
@ -521,8 +521,8 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
// Adjust the view for printing
if (hires) {
zoom = _map->zoom();
QRectF vr(mapToScene(orig).boundingRect());
origC = RectC(_map->xy2ll(vr.topLeft()), _map->xy2ll(vr.bottomRight()));
origScene = vr.center();
QPointF s(painter->device()->logicalDpiX()
@ -553,11 +553,11 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
// Revert view changes to display mode
if (hires) {
_map->zoomFit(orig.size(), origC);
_map->setZoom(zoom);
rescale();
centerOn(origScene);
}
_mapScale->setDigitalZoom(0);
_mapScale->setDigitalZoom(_digitalZoom);
_mapScale->setPos(origPos);
// Exit plot mode

View File

@ -208,6 +208,12 @@ int Atlas::zoomFit(const QSize &size, const RectC &br)
return _zoom;
}
void Atlas::setZoom(int zoom)
{
_mapIndex = -1;
_zoom = zoom;
}
int Atlas::zoomIn()
{
_zoom = qMin(_zoom + 1, _zooms.size() - 1);

View File

@ -18,6 +18,7 @@ public:
qreal resolution(const QRectF &rect) const;
int zoom() const {return _zoom;}
void setZoom(int zoom);
int zoomFit(const QSize &size, const RectC &br);
int zoomIn();
int zoomOut();

View File

@ -16,6 +16,7 @@ public:
qreal resolution(const QRectF &rect) const;
int zoom() const {return _zoom;}
void setZoom(int zoom) {_zoom = zoom;}
int zoomFit(const QSize &size, const RectC &rect);
int zoomIn();
int zoomOut();

View File

@ -24,6 +24,7 @@ public:
virtual qreal resolution(const QRectF &rect) const = 0;
virtual int zoom() const = 0;
virtual void setZoom(int zoom) = 0;
virtual int zoomFit(const QSize &size, const RectC &rect) = 0;
virtual int zoomIn() = 0;
virtual int zoomOut() = 0;

View File

@ -24,6 +24,7 @@ public:
qreal resolution(const QRectF &rect) const;
int zoom() const {return _zoom;}
void setZoom(int zoom) {_zoom = zoom;}
int zoomFit(const QSize &size, const RectC &rect);
int zoomIn();
int zoomOut();

View File

@ -21,6 +21,7 @@ public:
qreal resolution(const QRectF &rect) const;
int zoom() const {return _zoom;}
void setZoom(int zoom) {_zoom = zoom;}
int zoomFit(const QSize &size, const RectC &rect);
int zoomIn();
int zoomOut();

View File

@ -163,6 +163,12 @@ int WMSMap::zoomFit(const QSize &size, const RectC &rect)
return _zoom;
}
void WMSMap::setZoom(int zoom)
{
_zoom = zoom;
updateTransform();
}
int WMSMap::zoomIn()
{
_zoom = qMin(_zoom + 1, _zooms.size() - 1);

View File

@ -21,6 +21,7 @@ public:
qreal resolution(const QRectF &rect) const;
int zoom() const {return _zoom;}
void setZoom(int zoom);
int zoomFit(const QSize &size, const RectC &rect);
int zoomIn();
int zoomOut();

View File

@ -143,6 +143,12 @@ qreal WMTSMap::resolution(const QRectF &rect) const
return ds/ps;
}
void WMTSMap::setZoom(int zoom)
{
_zoom = zoom;
updateTransform();
}
int WMTSMap::zoomIn()
{
_zoom = qMin(_zoom + 1, _zooms.size() - 1);

View File

@ -21,6 +21,7 @@ public:
qreal resolution(const QRectF &rect) const;
int zoom() const {return _zoom;}
void setZoom(int zoom);
int zoomFit(const QSize &size, const RectC &rect);
int zoomIn();
int zoomOut();