mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-17 16:20:48 +01:00
Do as much as possible in parallel
This commit is contained in:
parent
ed11bbd730
commit
3f6eca7404
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user