mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Atlas ll2xy() optimization
This commit is contained in:
parent
699e4f32d5
commit
b500031713
@ -235,16 +235,29 @@ qreal Atlas::zoomOut()
|
||||
|
||||
QPointF Atlas::ll2xy(const Coordinates &c) const
|
||||
{
|
||||
int idx = _zooms.at(_zoom).first;
|
||||
static int idx = -1;
|
||||
static int zoom = -1;
|
||||
QPointF pp;
|
||||
|
||||
for (int i = _zooms.at(_zoom).first; i <= _zooms.at(_zoom).second; i++) {
|
||||
if (_bounds.at(i).first.contains(_maps.at(i)->ll2pp(c))) {
|
||||
if (zoom != _zoom) {
|
||||
idx = -1;
|
||||
zoom = _zoom;
|
||||
}
|
||||
|
||||
if (idx >= 0)
|
||||
pp = _maps.at(idx)->ll2pp(c);
|
||||
if (idx < 0 || !_bounds.at(idx).first.contains(pp)) {
|
||||
idx = _zooms.at(zoom).first;
|
||||
for (int i = _zooms.at(zoom).first; i <= _zooms.at(zoom).second; i++) {
|
||||
pp = _maps.at(i)->ll2pp(c);
|
||||
if (_bounds.at(i).first.contains(pp)) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QPointF p = _maps.at(idx)->ll2xy(c);
|
||||
QPointF p = _maps.at(idx)->pp2xy(pp);
|
||||
return p + _bounds.at(idx).second.topLeft();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user