diff --git a/src/TerrainTile.cc b/src/TerrainTile.cc index 38a1d277eea12bd586dbe51d13a128779f0ef3b5..7fd390f599c87a2b6dbf20427ac4caba9f2bbfed 100644 --- a/src/TerrainTile.cc +++ b/src/TerrainTile.cc @@ -141,8 +141,8 @@ float TerrainTile::elevation(const QGeoCoordinate& coordinate) const if (_isValid) { qCDebug(TerrainTileLog) << "elevation: " << coordinate << " , in sw " << _southWest << " , ne " << _northEast; // Get the index at resolution of 1 arc second - int indexLat = round((coordinate.latitude() - _southWest.latitude()) * (gridSize - 1) / QGCMapEngine::srtm1TileSize); - int indexLon = round((coordinate.longitude() - _southWest.longitude()) * (gridSize - 1) / QGCMapEngine::srtm1TileSize); + int indexLat = qRound(static_cast((coordinate.latitude() - _southWest.latitude()) * (gridSize - 1) / QGCMapEngine::srtm1TileSize)); + int indexLon = qRound(static_cast((coordinate.longitude() - _southWest.longitude()) * (gridSize - 1) / QGCMapEngine::srtm1TileSize)); qCDebug(TerrainTileLog) << "indexLat:indexLon" << indexLat << indexLon; // TODO (birchera): Move this down to the next debug output, once this is all properly working. Q_ASSERT(indexLat >= 0); Q_ASSERT(indexLat < gridSize);