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

Optimization

This commit is contained in:
Martin Tůma 2020-03-07 19:24:39 +01:00
parent eb8fc7b540
commit 23c18d4acd
2 changed files with 6 additions and 8 deletions

View File

@ -260,13 +260,6 @@ void IMGMap::unload()
_data->clear(); _data->clear();
} }
QRectF IMGMap::bounds()
{
RectD prect(_data->bounds(), _projection);
return QRectF(_transform.proj2img(prect.topLeft()),
_transform.proj2img(prect.bottomRight()));
}
int IMGMap::zoomFit(const QSize &size, const RectC &rect) int IMGMap::zoomFit(const QSize &size, const RectC &rect)
{ {
if (rect.isValid()) { if (rect.isValid()) {
@ -320,6 +313,10 @@ Transform IMGMap::transform(int zoom) const
void IMGMap::updateTransform() void IMGMap::updateTransform()
{ {
_transform = transform(_zoom); _transform = transform(_zoom);
RectD prect(_data->bounds(), _projection);
_bounds = QRectF(_transform.proj2img(prect.topLeft()),
_transform.proj2img(prect.bottomRight()));
} }
QPointF IMGMap::ll2xy(const Coordinates &c) QPointF IMGMap::ll2xy(const Coordinates &c)

View File

@ -18,7 +18,7 @@ public:
QString name() const {return _data->name();} QString name() const {return _data->name();}
QRectF bounds(); QRectF bounds() {return _bounds;}
virtual int zoom() const {return _zoom;} virtual int zoom() const {return _zoom;}
virtual void setZoom(int zoom); virtual void setZoom(int zoom);
@ -62,6 +62,7 @@ private:
int _zoom; int _zoom;
Projection _projection; Projection _projection;
Transform _transform; Transform _transform;
QRectF _bounds;
bool _valid; bool _valid;
QString _errorString; QString _errorString;