Skip to content

Commit 78369ef

Browse files
committed
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)
1 parent be3e6a2 commit 78369ef

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

src/MissionManager/FixedWingLandingComplexItem.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,6 @@ void FixedWingLandingComplexItem::_calcGlideSlope(void)
135135
_glideSlopeFact.setRawValue(qRadiansToDegrees(qAtan(landingAltDifference / landingDistance)));
136136
}
137137

138-
void FixedWingLandingComplexItem::moveLandingPosition(const QGeoCoordinate& coordinate)
139-
{
140-
double savedHeading = landingHeading()->rawValue().toDouble();
141-
double savedDistance = landingDistance()->rawValue().toDouble();
142-
143-
setLandingCoordinate(coordinate);
144-
landingHeading()->setRawValue(savedHeading);
145-
landingDistance()->setRawValue(savedDistance);
146-
}
147-
148138
bool FixedWingLandingComplexItem::_isValidLandItem(const MissionItem& missionItem)
149139
{
150140
if (missionItem.command() != MAV_CMD_NAV_LAND ||

src/MissionManager/FixedWingLandingComplexItem.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class FixedWingLandingComplexItem : public LandingComplexItem
3131
Q_PROPERTY(Fact* valueSetIsDistance READ valueSetIsDistance CONSTANT)
3232
Q_PROPERTY(Fact* glideSlope READ glideSlope CONSTANT)
3333

34-
Q_INVOKABLE void moveLandingPosition(const QGeoCoordinate& coordinate); // Maintains the current landing distance and heading
35-
3634
Fact* glideSlope (void) { return &_glideSlopeFact; }
3735
Fact* valueSetIsDistance (void) { return &_valueSetIsDistanceFact; }
3836

src/MissionManager/LandingComplexItem.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,19 @@ void LandingComplexItem::_setDirty(void)
643643
setDirty(true);
644644
}
645645

646+
void LandingComplexItem::setCoordinate(const QGeoCoordinate& coordinate) {
647+
if (!_landingCoordSet) {
648+
setLandingCoordinate(coordinate);
649+
return;
650+
}
651+
652+
// Move entire complex item, preserving heading and distance
653+
_ignoreRecalcSignals = true;
654+
setLandingCoordinate(coordinate);
655+
_ignoreRecalcSignals = false;
656+
_recalcFromHeadingAndDistanceChange();
657+
}
658+
646659
void LandingComplexItem::setSequenceNumber(int sequenceNumber)
647660
{
648661
if (_sequenceNumber != sequenceNumber) {

src/MissionManager/LandingComplexItem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class LandingComplexItem : public ComplexMissionItem
110110
ReadyForSaveState readyForSaveState (void) const final;
111111
bool exitCoordinateSameAsEntry (void) const final { return false; }
112112
void setDirty (bool dirty) final;
113-
void setCoordinate (const QGeoCoordinate& coordinate) final { setFinalApproachCoordinate(coordinate); }
113+
void setCoordinate (const QGeoCoordinate& coordinate) final;
114114
void setSequenceNumber (int sequenceNumber) final;
115115
double amslEntryAlt (void) const final;
116116
double amslExitAlt (void) const final;

src/QmlControls/FWLandingPatternMapVisual.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Item {
246246
itemCoordinate: _missionItem.landingCoordinate
247247
visible: _root.interactive
248248

249-
onItemCoordinateChanged: _missionItem.moveLandingPosition(itemCoordinate)
249+
onItemCoordinateChanged: _missionItem.coordinate = itemCoordinate
250250
}
251251
}
252252

0 commit comments

Comments
 (0)