From 78369eff462a4fe27d174549443cf7851cb46c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20P=C3=A9rez=20Alonso?= Date: Mon, 17 Nov 2025 17:02:02 +0100 Subject: [PATCH] Fix LandingComplexItems hamburger menu options Fixed an issue where the movement options in the MissionItemEditor's hamburger menu for both fixed wing and VTOL LandingComplexItems only moved the approach primitive instead of the entire complex item. This happened because LandingComplexItem::setCoordinate method only repositioned the approach item. Modified LandingComplexItem::setCoordinate to take over the functionality previously handled by the fixed-wing-only moveLandingPosition method. The relevant logic has also been updated to avoid unnecessary recalculations. Other movement behaviors have been verified to be correct and remain unchanged for both fixed wing and VTOL. In summary: - FW landing patterns: - Drag land primitive on map: Moves entire pattern (no change) - Hamburger menu item movement options: Moves approach primitive only (before), moves entire pattern (after) - Landing point -> Set to vehicle location: Moves land primitive only (no change) - VTOL landing patterns: - Drag land primitive on map: Moves land primitive only (no change) - Hamburger menu item movement options: Moves approach primitive only (before), moves entire pattern (after) - Landing point -> Set to vehicle location: Moves land primitive only (no change) --- src/MissionManager/FixedWingLandingComplexItem.cc | 10 ---------- src/MissionManager/FixedWingLandingComplexItem.h | 2 -- src/MissionManager/LandingComplexItem.cc | 13 +++++++++++++ src/MissionManager/LandingComplexItem.h | 2 +- src/QmlControls/FWLandingPatternMapVisual.qml | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/MissionManager/FixedWingLandingComplexItem.cc b/src/MissionManager/FixedWingLandingComplexItem.cc index 28dcd7c2e18d..bfc9cfa9e59f 100644 --- a/src/MissionManager/FixedWingLandingComplexItem.cc +++ b/src/MissionManager/FixedWingLandingComplexItem.cc @@ -135,16 +135,6 @@ void FixedWingLandingComplexItem::_calcGlideSlope(void) _glideSlopeFact.setRawValue(qRadiansToDegrees(qAtan(landingAltDifference / landingDistance))); } -void FixedWingLandingComplexItem::moveLandingPosition(const QGeoCoordinate& coordinate) -{ - double savedHeading = landingHeading()->rawValue().toDouble(); - double savedDistance = landingDistance()->rawValue().toDouble(); - - setLandingCoordinate(coordinate); - landingHeading()->setRawValue(savedHeading); - landingDistance()->setRawValue(savedDistance); -} - bool FixedWingLandingComplexItem::_isValidLandItem(const MissionItem& missionItem) { if (missionItem.command() != MAV_CMD_NAV_LAND || diff --git a/src/MissionManager/FixedWingLandingComplexItem.h b/src/MissionManager/FixedWingLandingComplexItem.h index 043f5067ab24..5de926d83b19 100644 --- a/src/MissionManager/FixedWingLandingComplexItem.h +++ b/src/MissionManager/FixedWingLandingComplexItem.h @@ -31,8 +31,6 @@ class FixedWingLandingComplexItem : public LandingComplexItem Q_PROPERTY(Fact* valueSetIsDistance READ valueSetIsDistance CONSTANT) Q_PROPERTY(Fact* glideSlope READ glideSlope CONSTANT) - Q_INVOKABLE void moveLandingPosition(const QGeoCoordinate& coordinate); // Maintains the current landing distance and heading - Fact* glideSlope (void) { return &_glideSlopeFact; } Fact* valueSetIsDistance (void) { return &_valueSetIsDistanceFact; } diff --git a/src/MissionManager/LandingComplexItem.cc b/src/MissionManager/LandingComplexItem.cc index cffb295940b5..287294e0ea8a 100644 --- a/src/MissionManager/LandingComplexItem.cc +++ b/src/MissionManager/LandingComplexItem.cc @@ -643,6 +643,19 @@ void LandingComplexItem::_setDirty(void) setDirty(true); } +void LandingComplexItem::setCoordinate(const QGeoCoordinate& coordinate) { + if (!_landingCoordSet) { + setLandingCoordinate(coordinate); + return; + } + + // Move entire complex item, preserving heading and distance + _ignoreRecalcSignals = true; + setLandingCoordinate(coordinate); + _ignoreRecalcSignals = false; + _recalcFromHeadingAndDistanceChange(); +} + void LandingComplexItem::setSequenceNumber(int sequenceNumber) { if (_sequenceNumber != sequenceNumber) { diff --git a/src/MissionManager/LandingComplexItem.h b/src/MissionManager/LandingComplexItem.h index 0cc10b27a286..e50dadd8fa33 100644 --- a/src/MissionManager/LandingComplexItem.h +++ b/src/MissionManager/LandingComplexItem.h @@ -110,7 +110,7 @@ class LandingComplexItem : public ComplexMissionItem ReadyForSaveState readyForSaveState (void) const final; bool exitCoordinateSameAsEntry (void) const final { return false; } void setDirty (bool dirty) final; - void setCoordinate (const QGeoCoordinate& coordinate) final { setFinalApproachCoordinate(coordinate); } + void setCoordinate (const QGeoCoordinate& coordinate) final; void setSequenceNumber (int sequenceNumber) final; double amslEntryAlt (void) const final; double amslExitAlt (void) const final; diff --git a/src/QmlControls/FWLandingPatternMapVisual.qml b/src/QmlControls/FWLandingPatternMapVisual.qml index f1d3ff0bd601..a8ccc868f3fd 100644 --- a/src/QmlControls/FWLandingPatternMapVisual.qml +++ b/src/QmlControls/FWLandingPatternMapVisual.qml @@ -246,7 +246,7 @@ Item { itemCoordinate: _missionItem.landingCoordinate visible: _root.interactive - onItemCoordinateChanged: _missionItem.moveLandingPosition(itemCoordinate) + onItemCoordinateChanged: _missionItem.coordinate = itemCoordinate } }