Commit e7932490 authored by Andreas Bircher's avatar Andreas Bircher

cleanup

parent b91d7290
......@@ -79,6 +79,7 @@ void QGCLoggingCategoryRegister::setFilterRulesFromSettings(const QString& comma
}
// Command line rules take precedence, so they go last in the list
_commandLineLoggingOptions += "TerrainLog,TerrainTileLog";
if (!_commandLineLoggingOptions.isEmpty()) {
QStringList logList = _commandLineLoggingOptions.split(",");
......
......@@ -137,28 +137,6 @@ bool ElevationProvider::cacheTerrainTiles(const QGeoCoordinate& southWest, const
return true;
}
bool ElevationProvider::cacheTerrainTiles(const QList<QGeoCoordinate>& coordinates)
{
if (coordinates.length() == 0) {
return false;
}
for (const auto& coordinate : coordinates) {
QString uniqueTileId = _uniqueTileId(coordinate);
_tilesMutex.lock();
if (_downloadQueue.contains(uniqueTileId) || _tiles.contains(uniqueTileId)) {
_tilesMutex.unlock();
continue;
}
_downloadQueue.append(uniqueTileId);
_tilesMutex.unlock();
qCDebug(TerrainLog) << "Adding tile to download queue: " << uniqueTileId;
}
_downloadTiles();
return true;
}
void ElevationProvider::_requestFinished()
{
QNetworkReply* reply = qobject_cast<QNetworkReply*>(QObject::sender());
......@@ -265,7 +243,7 @@ void ElevationProvider::_downloadTiles(void)
connect(networkReply, &QNetworkReply::finished, this, &ElevationProvider::_requestFinishedTile);
_state = State::Downloading;
} else if (_state == State::Idle) {
} else if (_state == State::Idle && _coordinates.length() > 0) {
queryTerrainData(_coordinates);
}
}
......
......@@ -52,14 +52,6 @@ public:
*/
bool queryTerrainData(const QList<QGeoCoordinate>& coordinates);
/**
* Cache all data in rectangular region given by list of coordinates.
*
* @param coordinates
* @return true on successful scheduling for download
*/
bool cacheTerrainTiles(const QList<QGeoCoordinate>& coordinates);
/**
* Cache all data in rectangular region given by south west and north east corner.
*
......@@ -70,16 +62,17 @@ public:
bool cacheTerrainTiles(const QGeoCoordinate& southWest, const QGeoCoordinate& northEast);
signals:
/// signal returning requested elevation data
void terrainData(bool success, QList<float> altitudes);
private slots:
void _requestFinished();
void _requestFinishedTile();
void _requestFinished(); /// slot to handle download of elevation of list of coordinates
void _requestFinishedTile(); /// slot to handle download of elevation tiles
private:
QString _uniqueTileId(const QGeoCoordinate& coordinate);
void _downloadTiles(void);
QString _uniqueTileId(const QGeoCoordinate& coordinate); /// Method to create a unique string for each tile. Format: south_west_north_east as floats.
void _downloadTiles(void); /// Method to trigger download of queued tiles, eventually emitting the requested altitudes (if any).
enum class State {
Idle,
......
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