mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Fixed DEM display glitches
This commit is contained in:
parent
f6f9e4146d
commit
6ef6644260
@ -2,6 +2,8 @@
|
||||
|
||||
using namespace IMG;
|
||||
|
||||
#define DELTA 1e-9 /* ensure col+1/row+1 is in the next tile */
|
||||
|
||||
static double interpolate(double dx, double dy, double p0, double p1, double p2,
|
||||
double p3)
|
||||
{
|
||||
@ -55,16 +57,16 @@ double DEM::elevation(const DEMTRee &tree, const MapData::Elevation *e,
|
||||
|
||||
double p0 = val(e->m, row, col);
|
||||
double p1 = (col == e->m.w() - 1)
|
||||
? edge(tree, Coordinates(e->rect.left() + (col + 1) * e->xr + e->xr/2,
|
||||
? edge(tree, Coordinates(e->rect.left() + (col + 1) * e->xr + DELTA,
|
||||
e->rect.top() - row * e->yr))
|
||||
: val(e->m, row, col + 1);
|
||||
double p2 = (row == e->m.h() - 1)
|
||||
? edge(tree, Coordinates(e->rect.left() + col * e->xr,
|
||||
e->rect.top() - (row + 1) * e->yr - e->yr/2))
|
||||
e->rect.top() - (row + 1) * e->yr - DELTA))
|
||||
: val(e->m, row + 1, col);
|
||||
double p3 = ((col == e->m.w() - 1) || (row == e->m.h() - 1))
|
||||
? edge(tree, Coordinates(e->rect.left() + (col + 1) * e->xr + e->xr/2,
|
||||
e->rect.top() - (row + 1) * e->yr - e->yr/2))
|
||||
? edge(tree, Coordinates(e->rect.left() + (col + 1) * e->xr + DELTA,
|
||||
e->rect.top() - (row + 1) * e->yr - DELTA))
|
||||
: val(e->m, row + 1, col + 1);
|
||||
|
||||
return interpolate(x - col, y - row, p0, p1, p2, p3);
|
||||
|
@ -28,6 +28,7 @@ using namespace IMG;
|
||||
#define ROAD 0
|
||||
#define WATER 1
|
||||
|
||||
#define DELTA 0.05 /* DEM3 resolution in degrees */
|
||||
|
||||
static const QColor textColor(Qt::black);
|
||||
static const QColor haloColor(Qt::white);
|
||||
@ -475,7 +476,8 @@ MatrixD RasterTile::elevation() const
|
||||
for (int i = 0; i < ll.size(); i++)
|
||||
rect = rect.united(ll.at(i));
|
||||
// Extra margin for edge()
|
||||
rect = rect.united(xy2ll(QPointF(right + 1, bottom + 1)));
|
||||
rect = rect.united(Coordinates(rect.right() + DELTA,
|
||||
rect.bottom() - DELTA));
|
||||
|
||||
_data->elevations(rect, _zoom, &tiles);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user