From 5217ee44bfbaa7bd8a02b7165b738aed0dc8844a Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Tue, 1 May 2018 09:45:37 -0700 Subject: [PATCH] Fix bug in terrain transect adjustment First and last points in transects did not have altitudes set correctly --- src/MissionManager/TransectStyleComplexItem.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/MissionManager/TransectStyleComplexItem.cc b/src/MissionManager/TransectStyleComplexItem.cc index 6f2602686..97badaf2d 100644 --- a/src/MissionManager/TransectStyleComplexItem.cc +++ b/src/MissionManager/TransectStyleComplexItem.cc @@ -611,7 +611,7 @@ void TransectStyleComplexItem::_addInterstitialTerrainPoints(QList& { QList adjustedTransect; - adjustedTransect.append(transect.first()); + double requestedAltitude = _cameraCalc.distanceToSurface()->rawValue().toDouble(); for (int i=0; i& double distance = fromCoordInfo.coord.distanceTo(toCoordInfo.coord); const TerrainPathQuery::PathHeightInfo_t& pathHeightInfo = transectPathHeightInfo[i]; - double requestedAltitude = _cameraCalc.distanceToSurface()->rawValue().toDouble(); fromCoordInfo.coord.setAltitude(pathHeightInfo.heights.first() + requestedAltitude); toCoordInfo.coord.setAltitude(pathHeightInfo.heights.last() + requestedAltitude); + if (i == 0) { + adjustedTransect.append(fromCoordInfo); + } + int cHeights = pathHeightInfo.heights.count(); for (int pathHeightIndex=1; pathHeightIndex& adjustedTransect.append(toCoordInfo); } + CoordInfo_t lastCoordInfo = transect.last(); + const TerrainPathQuery::PathHeightInfo_t& pathHeightInfo = transectPathHeightInfo.last(); + lastCoordInfo.coord.setAltitude(pathHeightInfo.heights.last() + requestedAltitude); + adjustedTransect.append(lastCoordInfo); + #if 0 qDebug() << "_addInterstitialTerrainPoints"; foreach (const TransectStyleComplexItem::CoordInfo_t& coordInfo, adjustedTransect) { -- 2.22.0