Commit 5ad945af authored by DonLakeFlyer's avatar DonLakeFlyer

parent 34e49eab
......@@ -36,7 +36,7 @@ Item {
readonly property string emergencyStopTitle: qsTr("EMERGENCY STOP")
readonly property string armTitle: qsTr("Arm")
readonly property string disarmTitle: qsTr("Disarm")
readonly property string rtlTitle: qsTr("RTL")
readonly property string rtlTitle: qsTr("Return")
readonly property string takeoffTitle: qsTr("Takeoff")
readonly property string landTitle: qsTr("Land")
readonly property string startMissionTitle: qsTr("Start Mission")
......
......@@ -22,15 +22,7 @@ void CorridorScanPlanCreator::createPlan(const QGeoCoordinate& mapCenterCoord)
{
_planMasterController->removeAll();
VisualMissionItem* takeoffItem = _missionController->insertTakeoffItem(mapCenterCoord, -1);
takeoffItem->setWizardMode(true);
_missionController->insertComplexMissionItem(MissionController::patternCorridorScanName, mapCenterCoord, -1)->setWizardMode(true);
if (_planMasterController->managerVehicle()->fixedWing()) {
FixedWingLandingComplexItem* landingItem = qobject_cast<FixedWingLandingComplexItem*>(_missionController->insertComplexMissionItem(MissionController::patternFWLandingName, mapCenterCoord, -1));
landingItem->setWizardMode(true);
landingItem->setLoiterDragAngleOnly(true);
} else {
MissionSettingsItem* settingsItem = _missionController->visualItems()->value<MissionSettingsItem*>(0);
settingsItem->setMissionEndRTL(true);
}
_missionController->insertComplexMissionItem(MissionController::patternCorridorScanName, mapCenterCoord, -1);
_missionController->insertLandItem(mapCenterCoord, -1);
_missionController->setCurrentPlanViewIndex(takeoffItem->sequenceNumber(), true);
}
This diff is collapsed.
......@@ -93,6 +93,7 @@ public:
Q_PROPERTY(QString corridorScanComplexItemName READ corridorScanComplexItemName CONSTANT)
Q_PROPERTY(QString structureScanComplexItemName READ structureScanComplexItemName CONSTANT)
Q_PROPERTY(bool isInsertTakeoffValid MEMBER _isInsertTakeoffValid NOTIFY isInsertTakeoffValidChanged) ///< true: Takeoff tool should be enabled
Q_PROPERTY(bool isInsertLandValid MEMBER _isInsertLandValid NOTIFY isInsertLandValidChanged) ///< true: Land tool should be enabled
Q_INVOKABLE void removeMissionItem(int index);
......@@ -110,6 +111,13 @@ public:
/// @return Newly created item
Q_INVOKABLE VisualMissionItem* insertTakeoffItem(QGeoCoordinate coordinate, int visualItemIndex, bool makeCurrentItem = false);
/// Add a new land item to the list
/// @param coordinate: Coordinate for item
/// @param visualItemIndex: index to insert at, -1 for end of list
/// @param makeCurrentItem: true: Make this item the current item
/// @return Newly created item
Q_INVOKABLE VisualMissionItem* insertLandItem(QGeoCoordinate coordinate, int visualItemIndex, bool makeCurrentItem = false);
/// Add a new ROI mission item to the list
/// @param coordinate: Coordinate for item
/// @param visualItemIndex: index to insert at, -1 for end of list
......@@ -245,6 +253,7 @@ signals:
void missionBoundingCubeChanged (void);
void missionItemCountChanged (int missionItemCount);
void isInsertTakeoffValidChanged (void);
void isInsertLandValidChanged (void);
private slots:
void _newMissionItemsAvailableFromVehicle(bool removeAllRequested);
......@@ -296,6 +305,7 @@ private:
void _initLoadedVisualItems(QmlObjectListModel* loadedVisualItems);
CoordinateVector* _addWaypointLineSegment(CoordVectHashTable& prevItemPairHashTable, VisualItemPair& pair);
void _addTimeDistance(bool vtolInHover, double hoverTime, double cruiseTime, double extraTime, double distance, int seqNum);
VisualMissionItem* _insertSimpleMissionItemWorker(QGeoCoordinate coordinate, MAV_CMD command, int visualItemIndex, bool makeCurrentItem);
void _insertComplexMissionItemWorker(ComplexMissionItem* complexItem, int visualItemIndex, bool makeCurrentItem);
void _warnIfTerrainFrameUsed(void);
......@@ -321,6 +331,7 @@ private:
QGeoCoordinate _takeoffCoordinate;
CoordinateVector* _splitSegment;
bool _isInsertTakeoffValid = true;
bool _isInsertLandValid = true;
static const char* _settingsGroup;
......
......@@ -22,15 +22,7 @@ void StructureScanPlanCreator::createPlan(const QGeoCoordinate& mapCenterCoord)
{
_planMasterController->removeAll();
VisualMissionItem* takeoffItem = _missionController->insertTakeoffItem(mapCenterCoord, -1);
takeoffItem->setWizardMode(true);
_missionController->insertComplexMissionItem(MissionController::patternStructureScanName, mapCenterCoord, -1)->setWizardMode(true);
if (_planMasterController->managerVehicle()->fixedWing()) {
FixedWingLandingComplexItem* landingItem = qobject_cast<FixedWingLandingComplexItem*>(_missionController->insertComplexMissionItem(MissionController::patternFWLandingName, mapCenterCoord, -1));
landingItem->setWizardMode(true);
landingItem->setLoiterDragAngleOnly(true);
} else {
MissionSettingsItem* settingsItem = _missionController->visualItems()->value<MissionSettingsItem*>(0);
settingsItem->setMissionEndRTL(true);
}
_missionController->insertLandItem(mapCenterCoord, -1);
_missionController->setCurrentPlanViewIndex(takeoffItem->sequenceNumber(), true);
}
......@@ -23,15 +23,7 @@ void SurveyPlanCreator::createPlan(const QGeoCoordinate& mapCenterCoord)
{
_planMasterController->removeAll();
VisualMissionItem* takeoffItem = _missionController->insertTakeoffItem(mapCenterCoord, -1);
takeoffItem->setWizardMode(true);
_missionController->insertComplexMissionItem(MissionController::patternSurveyName, mapCenterCoord, -1)->setWizardMode(true);
if (_planMasterController->managerVehicle()->fixedWing()) {
FixedWingLandingComplexItem* landingItem = qobject_cast<FixedWingLandingComplexItem*>(_missionController->insertComplexMissionItem(MissionController::patternFWLandingName, mapCenterCoord, -1));
landingItem->setWizardMode(true);
landingItem->setLoiterDragAngleOnly(true);
} else {
MissionSettingsItem* settingsItem = _missionController->visualItems()->value<MissionSettingsItem*>(0);
settingsItem->setMissionEndRTL(true);
}
_missionController->insertComplexMissionItem(MissionController::patternSurveyName, mapCenterCoord, -1);
_missionController->insertLandItem(mapCenterCoord, -1);
_missionController->setCurrentPlanViewIndex(takeoffItem->sequenceNumber(), true);
}
......@@ -629,7 +629,8 @@ Item {
readonly property int waypointButtonIndex: 3
readonly property int roiButtonIndex: 4
readonly property int patternButtonIndex: 5
readonly property int centerButtonIndex: 6
readonly property int landButtonIndex: 6
readonly property int centerButtonIndex: 7
property bool _isRally: _editingLayer == _layerRallyPoints
......@@ -677,6 +678,12 @@ Item {
buttonVisible: !_isRally,
dropPanelComponent: _singleComplexItem ? undefined : patternDropPanel
},
{
name: _planMasterController.controllerVehicle.fixedWing ? qsTr("Land") : qsTr("Return"),
iconSource: "/res/rtl.svg",
buttonEnabled: _missionController.isInsertLandValid,
buttonVisible: _editingLayer == _layerMission
},
{
name: qsTr("Center"),
iconSource: "/qmlimages/MapCenter.svg",
......@@ -714,6 +721,9 @@ Item {
addComplexItem(_missionController.complexMissionItemNames[0])
}
break
case landButtonIndex:
_missionController.insertLandItem(mapCenter(), _missionController.currentMissionIndex, true /* makeCurrentItem */)
break
}
}
}
......@@ -1027,25 +1037,6 @@ Item {
}
}
}
Rectangle {
width: parent.width * 0.8
height: 1
color: qgcPal.text
opacity: 0.5
Layout.fillWidth: true
Layout.columnSpan: 2
}
QGCButton {
text: qsTr("Load KML/SHP...")
Layout.fillWidth: true
enabled: !_planMasterController.syncInProgress
onClicked: {
_planMasterController.loadShapeFromSelectedFile()
dropPanel.hide()
}
}
} // Column
}
......
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