Unverified Commit dda077e6 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6763 from DonLakeFlyer/TerrainNaN

Terrain: Use NaN for bad elevation value
parents dd3e9bf6 8fccae99
......@@ -412,7 +412,7 @@ bool TerrainTileManager::_getAltitudesForCoordinates(const QList<QGeoCoordinate>
if (_tiles.contains(tileHash)) {
if (_tiles[tileHash].isIn(coordinate)) {
double elevation = _tiles[tileHash].elevation(coordinate);
if (elevation < 0.0) {
if (qIsNaN(elevation)) {
error = true;
qCWarning(TerrainQueryLog) << "TerrainTileManager::_getAltitudesForCoordinates Internal Error: negative elevation in tile cache";
} else {
......@@ -421,7 +421,7 @@ bool TerrainTileManager::_getAltitudesForCoordinates(const QList<QGeoCoordinate>
altitudes.push_back(elevation);
} else {
qCWarning(TerrainQueryLog) << "TerrainTileManager::_getAltitudesForCoordinates Internal Error: coordinate not in tile region";
altitudes.push_back(-1.0);
altitudes.push_back(qQNaN());
error = true;
}
} else {
......
......@@ -121,13 +121,13 @@ double TerrainTile::elevation(const QGeoCoordinate& coordinate) const
int indexLon = _lonToDataIndex(coordinate.longitude());
if (indexLat == -1 || indexLon == -1) {
qCWarning(TerrainTileLog) << "Internal error indexLat:indexLon == -1" << indexLat << indexLon;
return -1.0;
return qQNaN();
}
qCDebug(TerrainTileLog) << "indexLat:indexLon" << indexLat << indexLon << "elevation" << _data[indexLat][indexLon];
return static_cast<double>(_data[indexLat][indexLon]);
} else {
qCWarning(TerrainTileLog) << "Asking for elevation, but no valid data.";
return -1.0;
return qQNaN();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment