Unverified Commit 112580d8 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8114 from DonLakeFlyer/PreviousPosition

Plan: Support move item to previous item position
parents fd3b7623 b9b28d03
......@@ -2243,6 +2243,7 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
_isROIActive = false;
_isROIBeginCurrentItem = false;
_flyThroughCommandsAllowed = true;
_previousCoordinate = QGeoCoordinate();
for (int viIndex=0; viIndex<_visualItems->count(); viIndex++) {
VisualMissionItem* pVI = qobject_cast<VisualMissionItem*>(_visualItems->get(viIndex));
......@@ -2282,8 +2283,13 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
}
}
// ROI state handling
if (simpleItem) {
// Remember previous coordinate
if (pVI->sequenceNumber() < sequenceNumber && simpleItem->specifiesCoordinate() && !simpleItem->isStandaloneCoordinate()) {
_previousCoordinate = simpleItem->coordinate();
}
// ROI state handling
if (pVI->sequenceNumber() <= sequenceNumber) {
if (_isROIActive) {
if (_isROICancelItem(simpleItem)) {
......@@ -2351,6 +2357,7 @@ void MissionController::setCurrentPlanViewSeqNum(int sequenceNumber, bool force)
emit isROIActiveChanged();
emit isROIBeginCurrentItemChanged();
emit flyThroughCommandsAllowedChanged();
emit previousCoordinateChanged();
}
}
......
......@@ -72,6 +72,7 @@ public:
Q_PROPERTY(QmlObjectListModel* directionArrows READ directionArrows CONSTANT)
Q_PROPERTY(QStringList complexMissionItemNames READ complexMissionItemNames NOTIFY complexMissionItemNamesChanged)
Q_PROPERTY(QGeoCoordinate plannedHomePosition READ plannedHomePosition NOTIFY plannedHomePositionChanged)
Q_PROPERTY(QGeoCoordinate previousCoordinate MEMBER _previousCoordinate NOTIFY previousCoordinateChanged)
Q_PROPERTY(CoordinateVector* splitSegment MEMBER _splitSegment NOTIFY splitSegmentChanged) ///< Segment which show show + split ui element
Q_PROPERTY(double progressPct READ progressPct NOTIFY progressPctChanged)
Q_PROPERTY(int missionItemCount READ missionItemCount NOTIFY missionItemCountChanged) ///< True mission item command count (only valid in Fly View)
......@@ -266,6 +267,7 @@ signals:
void isROIActiveChanged (void);
void isROIBeginCurrentItemChanged (void);
void flyThroughCommandsAllowedChanged (void);
void previousCoordinateChanged (void);
private slots:
void _newMissionItemsAvailableFromVehicle(bool removeAllRequested);
......@@ -344,6 +346,7 @@ private:
QTimer _updateTimer;
QGCGeoBoundingCube _travelBoundingCube;
QGeoCoordinate _takeoffCoordinate;
QGeoCoordinate _previousCoordinate;
CoordinateVector* _splitSegment;
bool _isInsertTakeoffValid = true;
bool _isInsertLandValid = true;
......
......@@ -40,6 +40,7 @@ Rectangle {
property real _sectionSpacer: ScreenTools.defaultFontPixelWidth / 2 // spacing between section headings
property bool _singleComplexItem: _missionController.complexMissionItemNames.length === 1
property bool _readyForSave: missionItem.readyForSaveState === VisualMissionItem.ReadyForSave
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 12)
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
......@@ -137,6 +138,19 @@ Rectangle {
QGCMenu {
id: hamburgerMenu
QGCMenuItem {
text: qsTr("Move to vehicle position")
visible: missionItem.specifiesCoordinate
enabled: _activeVehicle
onTriggered: missionItem.coordinate = _activeVehicle.coordinate
}
QGCMenuItem {
text: qsTr("Move to previous item position")
visible: _missionController.previousCoordinate.isValid
onTriggered: missionItem.coordinate = _missionController.previousCoordinate
}
QGCMenuItem {
text: qsTr("Edit position...")
visible: missionItem.specifiesCoordinate
......
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