1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 06:43:22 +02:00

Do as much as possible in parallel

This commit is contained in:
Martin Tůma 2024-02-21 18:40:28 +01:00
parent ed11bbd730
commit 3f6eca7404
3 changed files with 15 additions and 4 deletions

View File

@ -454,11 +454,16 @@ Matrix RasterTile::elevation() const
int top = _rect.top() - 1;
int bottom = _rect.bottom() + 1;
DEM::lock();
QVector<Coordinates> ll;
ll.reserve(m.w() * m.h());
for (int y = top; y <= bottom; y++) {
for (int x = left; x <= right; x++)
m.m(y - top, x - left) = DEM::elevation(xy2ll(QPointF(x, y)));
ll.append(xy2ll(QPointF(x, y)));
}
DEM::lock();
for (int i = 0; i < ll.size(); i++)
m.m(i) = DEM::elevation(ll.at(i));
DEM::unlock();
return m;

View File

@ -480,11 +480,16 @@ Matrix RasterTile::elevation() const
int top = _rect.top() - 1;
int bottom = _rect.bottom() + 1;
DEM::lock();
QVector<Coordinates> ll;
ll.reserve(m.w() * m.h());
for (int y = top; y <= bottom; y++) {
for (int x = left; x <= right; x++)
m.m(y - top, x - left) = DEM::elevation(xy2ll(QPointF(x, y)));
ll.append(xy2ll(QPointF(x, y)));
}
DEM::lock();
for (int i = 0; i < ll.size(); i++)
m.m(i) = DEM::elevation(ll.at(i));
DEM::unlock();
return m;

View File

@ -13,6 +13,7 @@ public:
int h() const {return _h;}
int w() const {return _w;}
double &m(int n) {return _m[n];}
double &m(int i, int j) {return _m[_w * i + j];}
double const &m(int i, int j) const {return _m.at(_w * i + j);}