From 73fa197c25e9dc43eb2381d5706b5350926b508e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 23 May 2024 22:03:42 +0200 Subject: [PATCH] Added missing fallback elevation fetch --- src/map/imgmap.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/map/imgmap.cpp b/src/map/imgmap.cpp index bff930fa..06d880ea 100644 --- a/src/map/imgmap.cpp +++ b/src/map/imgmap.cpp @@ -269,18 +269,22 @@ void IMGMap::draw(QPainter *painter, const QRectF &rect, Flags flags) double IMGMap::elevation(const Coordinates &c) { - QList tiles; - DEM::DEMTRee tree; MapData *d = _data.first(); - double ele = NAN; - d->elevations(RectC(Coordinates(c), Coordinates(c)), d->zooms().max(), - &tiles); + if (d->hasDEM()) { + QList tiles; + DEM::DEMTRee tree; + double ele = NAN; - DEM::buildTree(tiles, tree); - DEM::searchTree(tree, c, ele); + d->elevations(RectC(Coordinates(c), Coordinates(c)), d->zooms().max(), + &tiles); - return ele; + DEM::buildTree(tiles, tree); + DEM::searchTree(tree, c, ele); + + return ele; + } else + return Map::elevation(c); } Map* IMGMap::createIMG(const QString &path, const Projection &proj, bool *isDir)