diff --git a/src/MissionManager/TransectStyleComplexItem.cc b/src/MissionManager/TransectStyleComplexItem.cc index 0c3193e..4c9ad6d 100644 --- a/src/MissionManager/TransectStyleComplexItem.cc +++ b/src/MissionManager/TransectStyleComplexItem.cc @@ -349,7 +349,23 @@ void TransectStyleComplexItem::_rebuildTransects(void) _rebuildTransectsPhase1(); - _queryTransectsPathHeightInfo(); + if (_followTerrain) { + // Query the terrain data. Once available terrain heights will be calculated + _queryTransectsPathHeightInfo(); + } else { + // Not following terrain, just add requested altitude to coords + double requestedAltitude = _cameraCalc.distanceToSurface()->rawValue().toDouble(); + + for (int i=0; i<_transects.count(); i++) { + QList<CoordInfo_t>& transect = _transects[i]; + + for (int j=0; j<transect.count(); j++) { + QGeoCoordinate& coord = transect[j].coord; + + coord.setAltitude(requestedAltitude); + } + } + } // Generate the visuals transect representation _visualTransectPoints.clear(); @@ -455,19 +471,6 @@ void TransectStyleComplexItem::_adjustTransectsForTerrain(void) } emit lastSequenceNumberChanged(lastSequenceNumber()); - } else { - // Not following terrain show just add requested altitude to coords - double requestedAltitude = _cameraCalc.distanceToSurface()->rawValue().toDouble(); - - for (int i=0; i<_transects.count(); i++) { - QList<CoordInfo_t>& transect = _transects[i]; - - for (int j=0; j<transect.count(); j++) { - QGeoCoordinate& coord = transect[j].coord; - - coord.setAltitude(requestedAltitude); - } - } } } diff --git a/src/Terrain/TerrainQuery.cc b/src/Terrain/TerrainQuery.cc index 662501c..e4bd712 100644 --- a/src/Terrain/TerrainQuery.cc +++ b/src/Terrain/TerrainQuery.cc @@ -25,6 +25,7 @@ #include <cmath> QGC_LOGGING_CATEGORY(TerrainQueryLog, "TerrainQueryLog") +QGC_LOGGING_CATEGORY(TerrainQueryVerboseLog, "TerrainQueryVerboseLog") Q_GLOBAL_STATIC(TerrainAtCoordinateBatchManager, _TerrainAtCoordinateBatchManager) Q_GLOBAL_STATIC(TerrainTileManager, _terrainTileManager) @@ -464,7 +465,7 @@ void TerrainTileManager::_terrainDone(QByteArray responseBytes, QNetworkReply::N QString TerrainTileManager::_getTileHash(const QGeoCoordinate& coordinate) { QString ret = QGCMapEngine::getTileHash(UrlFactory::AirmapElevation, QGCMapEngine::long2elevationTileX(coordinate.longitude(), 1), QGCMapEngine::lat2elevationTileY(coordinate.latitude(), 1), 1); - qCDebug(TerrainQueryLog) << "Computing unique tile hash for " << coordinate << ret; + qCDebug(TerrainQueryVerboseLog) << "Computing unique tile hash for " << coordinate << ret; return ret; } @@ -495,6 +496,7 @@ void TerrainAtCoordinateBatchManager::_sendNextBatch(void) if (_state != State::Idle) { // Waiting for last download the complete, wait some more + qCDebug(TerrainQueryLog) << "_sendNextBatch restarting timer"; _batchTimer.start(); return; } @@ -517,8 +519,8 @@ void TerrainAtCoordinateBatchManager::_sendNextBatch(void) break; } } - qCDebug(TerrainQueryLog) << "Built request: coordinate count" << coords.count(); _requestQueue = _requestQueue.mid(requestQueueAdded); + qCDebug(TerrainQueryLog) << "TerrainAtCoordinateBatchManager::_sendNextBatch - batch count:request queue count" << coords.count() << _requestQueue.count(); _state = State::Downloading; _terrainQuery.requestCoordinateHeights(coords); @@ -579,6 +581,8 @@ void TerrainAtCoordinateBatchManager::_coordinateHeights(bool success, QList<dou { _state = State::Idle; + qCDebug(TerrainQueryLog) << "_coordinateHeights success:count" << success << heights.count(); + if (!success) { _batchFailed(); return; @@ -587,7 +591,7 @@ void TerrainAtCoordinateBatchManager::_coordinateHeights(bool success, QList<dou int currentIndex = 0; foreach (const SentRequestInfo_t& sentRequestInfo, _sentRequests) { if (!sentRequestInfo.queryObjectDestroyed) { - qCDebug(TerrainQueryLog) << "TerrainAtCoordinateBatchManager::_coordinateHeights returned TerrainCoordinateQuery:count" << sentRequestInfo.terrainAtCoordinateQuery << sentRequestInfo.cCoord; + qCDebug(TerrainQueryVerboseLog) << "TerrainAtCoordinateBatchManager::_coordinateHeights returned TerrainCoordinateQuery:count" << sentRequestInfo.terrainAtCoordinateQuery << sentRequestInfo.cCoord; disconnect(sentRequestInfo.terrainAtCoordinateQuery, &TerrainAtCoordinateQuery::destroyed, this, &TerrainAtCoordinateBatchManager::_queryObjectDestroyed); QList<double> requestAltitudes = heights.mid(currentIndex, sentRequestInfo.cCoord); sentRequestInfo.terrainAtCoordinateQuery->_signalTerrainData(true, requestAltitudes); @@ -595,6 +599,10 @@ void TerrainAtCoordinateBatchManager::_coordinateHeights(bool success, QList<dou } } _sentRequests.clear(); + + if (_requestQueue.count()) { + _batchTimer.start(); + } } TerrainAtCoordinateQuery::TerrainAtCoordinateQuery(QObject* parent) diff --git a/src/Terrain/TerrainQuery.h b/src/Terrain/TerrainQuery.h index 01c7592..f41c9be 100644 --- a/src/Terrain/TerrainQuery.h +++ b/src/Terrain/TerrainQuery.h @@ -21,6 +21,7 @@ #include <QtLocation/private/qgeotiledmapreply_p.h> Q_DECLARE_LOGGING_CATEGORY(TerrainQueryLog) +Q_DECLARE_LOGGING_CATEGORY(TerrainQueryVerboseLog) class TerrainAtCoordinateQuery;