diff --git a/src/map/IMG/rastertile.cpp b/src/map/IMG/rastertile.cpp index 743367ec..e62a30c5 100644 --- a/src/map/IMG/rastertile.cpp +++ b/src/map/IMG/rastertile.cpp @@ -466,8 +466,7 @@ MatrixD RasterTile::elevation(int extend) const int top = _rect.top() - extend; int bottom = _rect.bottom() + extend; - Matrix ll(_rect.height() + 2 * extend, - _rect.width() + 2 * extend); + MatrixC ll(_rect.height() + 2 * extend, _rect.width() + 2 * extend); for (int y = top, i = 0; y <= bottom; y++) for (int x = left; x <= right; x++, i++) ll.at(i) = xy2ll(QPointF(x, y)); @@ -486,7 +485,6 @@ MatrixD RasterTile::elevation(int extend) const DEMTree tree(tiles); MatrixD m(ll.h(), ll.w()); - for (int i = 0; i < ll.size(); i++) m.at(i) = tree.elevation(ll.at(i)); diff --git a/src/map/dem.cpp b/src/map/dem.cpp index 3bbbbe8a..fa3b8920 100644 --- a/src/map/dem.cpp +++ b/src/map/dem.cpp @@ -46,7 +46,6 @@ static double value(int col, int row, int samples, const QByteArray &data) return (val == -32768) ? NAN : val; } -QMutex DEM::_lock; DEM::Entry::Entry(const QByteArray &data) : _data(data) { @@ -70,6 +69,8 @@ QString DEM::Tile::fileName() const return QString("%1%2.hgt").arg(latStr(), lonStr()); } + +QMutex DEM::_lock; QString DEM::_dir; DEM::TileCache DEM::_data; @@ -170,7 +171,7 @@ double DEM::elevationLockFree(const Coordinates &c) return ele; } -MatrixD DEM::elevation(const Matrix &m) +MatrixD DEM::elevation(const MatrixC &m) { if (_dir.isEmpty()) return MatrixD(m.h(), m.w(), NAN); diff --git a/src/map/dem.h b/src/map/dem.h index 0848a274..87552aa0 100644 --- a/src/map/dem.h +++ b/src/map/dem.h @@ -9,8 +9,6 @@ #include "data/area.h" #include "matrix.h" -class Coordinates; - class DEM { public: @@ -39,7 +37,7 @@ public: static void clearCache(); static double elevation(const Coordinates &c); - static MatrixD elevation(const Matrix &m); + static MatrixD elevation(const MatrixC &m); static QList tiles(); diff --git a/src/map/mapsforge/rastertile.cpp b/src/map/mapsforge/rastertile.cpp index 8e5b695e..3fed7c6d 100644 --- a/src/map/mapsforge/rastertile.cpp +++ b/src/map/mapsforge/rastertile.cpp @@ -475,8 +475,7 @@ MatrixD RasterTile::elevation(int extend) const int top = _rect.top() - extend; int bottom = _rect.bottom() + extend; - Matrix ll(_rect.height() + 2 * extend, - _rect.width() + 2 * extend); + MatrixC ll(_rect.height() + 2 * extend, _rect.width() + 2 * extend); for (int y = top, i = 0; y <= bottom; y++) for (int x = left; x <= right; x++, i++) ll.at(i) = xy2ll(QPointF(x, y)); diff --git a/src/map/matrix.h b/src/map/matrix.h index 194a8b5d..abd1b1ee 100644 --- a/src/map/matrix.h +++ b/src/map/matrix.h @@ -5,6 +5,8 @@ #include #include +class Coordinates; + template class Matrix { @@ -39,6 +41,8 @@ public: MatrixD augemented(const MatrixD &M) const; }; +typedef Matrix MatrixC; + #ifndef QT_NO_DEBUG template inline QDebug operator<<(QDebug dbg, const Matrix &matrix)