mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-20 09:40:49 +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 top = _rect.top() - 1;
|
||||||
int bottom = _rect.bottom() + 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 y = top; y <= bottom; y++) {
|
||||||
for (int x = left; x <= right; x++)
|
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();
|
DEM::unlock();
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
|
@ -480,11 +480,16 @@ Matrix RasterTile::elevation() const
|
|||||||
int top = _rect.top() - 1;
|
int top = _rect.top() - 1;
|
||||||
int bottom = _rect.bottom() + 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 y = top; y <= bottom; y++) {
|
||||||
for (int x = left; x <= right; x++)
|
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();
|
DEM::unlock();
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
|
@ -13,6 +13,7 @@ public:
|
|||||||
|
|
||||||
int h() const {return _h;}
|
int h() const {return _h;}
|
||||||
int w() const {return _w;}
|
int w() const {return _w;}
|
||||||
|
double &m(int n) {return _m[n];}
|
||||||
double &m(int i, int j) {return _m[_w * i + j];}
|
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);}
|
double const &m(int i, int j) const {return _m.at(_w * i + j);}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user