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