Unverified Commit a1cf6a3b authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8013 from DonLakeFlyer/CreatePlan

Plan: Create Plan
parents 6282fe56 134ccd28
......@@ -127,7 +127,7 @@
<file alias="pipHide.svg">src/FlightMap/Images/pipHide.svg</file>
<file alias="pipResize.svg">src/FlightMap/Images/pipResize.svg</file>
<file alias="Plan.svg">src/ui/toolbar/Images/Plan.svg</file>
<file alias="PlanCreator/CustomPlanCreator.png">src/MissionManager/CustomPlanCreator.png</file>
<file alias="PlanCreator/BlankPlanCreator.png">src/MissionManager/BlankPlanCreator.png</file>
<file alias="PlanCreator/CorridorScanPlanCreator.png">src/MissionManager/CorridorScanPlanCreator.png</file>
<file alias="PlanCreator/StructureScanPlanCreator.png">src/MissionManager/StructureScanPlanCreator.png</file>
<file alias="PlanCreator/SurveyPlanCreator.png">src/MissionManager/SurveyPlanCreator.png</file>
......
......@@ -592,7 +592,7 @@ HEADERS += \
src/MissionManager/ComplexMissionItem.h \
src/MissionManager/CorridorScanComplexItem.h \
src/MissionManager/CorridorScanPlanCreator.h \
src/MissionManager/CustomPlanCreator.h \
src/MissionManager/BlankPlanCreator.h \
src/MissionManager/FixedWingLandingComplexItem.h \
src/MissionManager/GeoFenceController.h \
src/MissionManager/GeoFenceManager.h \
......@@ -823,7 +823,7 @@ SOURCES += \
src/MissionManager/ComplexMissionItem.cc \
src/MissionManager/CorridorScanComplexItem.cc \
src/MissionManager/CorridorScanPlanCreator.cc \
src/MissionManager/CustomPlanCreator.cc \
src/MissionManager/BlankPlanCreator.cc \
src/MissionManager/FixedWingLandingComplexItem.cc \
src/MissionManager/GeoFenceController.cc \
src/MissionManager/GeoFenceManager.cc \
......
......@@ -102,7 +102,6 @@
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
<file alias="QGroundControl/Controls/PIDTuning.qml">src/QmlControls/PIDTuning.qml</file>
<file alias="QGroundControl/Controls/PlanEditToolbar.qml">src/PlanView/PlanEditToolbar.qml</file>
<file alias="QGroundControl/Controls/PlanStartOverlay.qml">src/PlanView/PlanStartOverlay.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckButton.qml">src/QmlControls/PreFlightCheckButton.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckGroup.qml">src/QmlControls/PreFlightCheckGroup.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckModel.qml">src/QmlControls/PreFlightCheckModel.qml</file>
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "BlankPlanCreator.h"
#include "PlanMasterController.h"
#include "MissionSettingsItem.h"
#include "FixedWingLandingComplexItem.h"
BlankPlanCreator::BlankPlanCreator(PlanMasterController* planMasterController, QObject* parent)
: PlanCreator(planMasterController, tr("Blank"), QStringLiteral("/qmlimages/PlanCreator/BlankPlanCreator.png"), parent)
{
}
void BlankPlanCreator::createPlan(const QGeoCoordinate& /*mapCenterCoord*/)
{
_planMasterController->removeAll();
}
......@@ -11,12 +11,12 @@
#include "PlanCreator.h"
class CustomPlanCreator : public PlanCreator
class BlankPlanCreator : public PlanCreator
{
Q_OBJECT
public:
CustomPlanCreator(PlanMasterController* planMasterController, QObject* parent = nullptr);
BlankPlanCreator(PlanMasterController* planMasterController, QObject* parent = nullptr);
Q_INVOKABLE void createPlan(const QGeoCoordinate& mapCenterCoord) final;
};
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "CustomPlanCreator.h"
#include "PlanMasterController.h"
#include "MissionSettingsItem.h"
#include "FixedWingLandingComplexItem.h"
CustomPlanCreator::CustomPlanCreator(PlanMasterController* planMasterController, QObject* parent)
: PlanCreator(planMasterController, tr("Custom"), QStringLiteral("/qmlimages/PlanCreator/CustomPlanCreator.png"), parent)
{
}
void CustomPlanCreator::createPlan(const QGeoCoordinate& mapCenterCoord)
{
_planMasterController->removeAll();
VisualMissionItem* takeoffItem = _missionController->insertSimpleMissionItem(mapCenterCoord, -1);
takeoffItem->setWizardMode(true);
_missionController->insertSimpleMissionItem(mapCenterCoord.atDistanceAndAzimuth(50, 135), -1);
_missionController->insertSimpleMissionItem(mapCenterCoord.atDistanceAndAzimuth(50, -135),-1);
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->setCurrentPlanViewIndex(takeoffItem->sequenceNumber(), true);
}
......@@ -19,7 +19,7 @@
#include "SurveyPlanCreator.h"
#include "StructureScanPlanCreator.h"
#include "CorridorScanPlanCreator.h"
#include "CustomPlanCreator.h"
#include "BlankPlanCreator.h"
#if defined(QGC_AIRMAP_ENABLED)
#include "AirspaceFlightPlanProvider.h"
#endif
......@@ -601,19 +601,19 @@ void PlanMasterController::_updatePlanCreatorsList(void)
if (!_flyView) {
if (!_planCreators) {
_planCreators = new QmlObjectListModel(this);
_planCreators->append(new BlankPlanCreator(this, this));
_planCreators->append(new SurveyPlanCreator(this, this));
_planCreators->append(new CorridorScanPlanCreator(this, this));
_planCreators->append(new CustomPlanCreator(this, this));
emit planCreatorsChanged(_planCreators);
}
if (_managerVehicle->fixedWing()) {
if (_planCreators->count() == 4) {
_planCreators->removeAt(_planCreators->count() - 2);
_planCreators->removeAt(_planCreators->count() - 1);
}
} else {
if (_planCreators->count() != 4) {
_planCreators->insert(_planCreators->count() - 1, new StructureScanPlanCreator(this, this));
_planCreators->append(new StructureScanPlanCreator(this, this));
}
}
}
......
......@@ -24,6 +24,8 @@ Column {
SectionHeader {
id: cameraSectionHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Camera")
checked: false
}
......
......@@ -124,8 +124,10 @@ Rectangle {
}
SectionHeader {
id: corridorHeader
text: qsTr("Corridor")
id: corridorHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Corridor")
}
GridLayout {
......@@ -182,9 +184,11 @@ Rectangle {
}
SectionHeader {
id: terrainHeader
text: qsTr("Terrain")
checked: missionItem.followTerrain
id: terrainHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Terrain")
checked: missionItem.followTerrain
}
ColumnLayout {
......@@ -228,8 +232,10 @@ Rectangle {
}
SectionHeader {
id: statsHeader
text: qsTr("Statistics")
id: statsHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Statistics")
}
TransectStyleComplexItemStats { }
......
......@@ -52,8 +52,10 @@ Rectangle {
visible: !editorColumnNeedLandingPoint.visible
SectionHeader {
id: loiterPointSection
text: qsTr("Loiter point")
id: loiterPointSection
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Loiter point")
}
Column {
......@@ -101,8 +103,10 @@ Rectangle {
}
SectionHeader {
id: landingPointSection
text: qsTr("Landing point")
id: landingPointSection
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Landing point")
}
Column {
......@@ -181,9 +185,11 @@ Rectangle {
}
SectionHeader {
id: cameraSection
text: qsTr("Camera")
visible: _showCameraSection
id: cameraSection
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Camera")
visible: _showCameraSection
}
Column {
......
......@@ -110,8 +110,10 @@ QGCFlickable {
}
SectionHeader {
id: insertSection
text: qsTr("Insert GeoFence")
id: insertSection
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Insert GeoFence")
}
QGCButton {
......@@ -139,8 +141,10 @@ QGCFlickable {
}
SectionHeader {
id: polygonSection
text: qsTr("Polygon Fences")
id: polygonSection
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Polygon Fences")
}
QGCLabel {
......@@ -212,8 +216,10 @@ QGCFlickable {
} // GridLayout
SectionHeader {
id: circleSection
text: qsTr("Circular Fences")
id: circleSection
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Circular Fences")
}
QGCLabel {
......@@ -302,8 +308,10 @@ QGCFlickable {
} // GridLayout
SectionHeader {
id: breachReturnSection
text: qsTr("Breach Return Point")
id: breachReturnSection
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Breach Return Point")
}
QGCButton {
......
......@@ -108,9 +108,11 @@ Rectangle {
}
SectionHeader {
id: missionEndHeader
text: qsTr("Mission End")
checked: true
id: missionEndHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Mission End")
checked: true
}
Column {
......@@ -128,10 +130,12 @@ Rectangle {
SectionHeader {
id: vehicleInfoSectionHeader
text: qsTr("Vehicle Info")
visible: _offlineEditing && !_waypointsOnlyMode
checked: false
id: vehicleInfoSectionHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Vehicle Info")
visible: _offlineEditing && !_waypointsOnlyMode
checked: false
}
GridLayout {
......@@ -192,10 +196,12 @@ Rectangle {
} // GridLayout
SectionHeader {
id: plannedHomePositionSection
text: qsTr("Planned Home Position")
visible: !_vehicleHasHomePosition
checked: false
id: plannedHomePositionSection
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Planned Home Position")
visible: !_vehicleHasHomePosition
checked: false
}
Column {
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
Item {
id: _root
property var planMasterController
property var mapControl
property real _radius: ScreenTools.defaultFontPixelWidth / 2
property real _margins: ScreenTools.defaultFontPixelWidth
function _mapCenter() {
var centerPoint = Qt.point(mapControl.centerViewport.left + (mapControl.centerViewport.width / 2), mapControl.centerViewport.top + (mapControl.centerViewport.height / 2))
return mapControl.toCoordinate(centerPoint, false /* clipToViewPort */)
}
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
Rectangle {
anchors.fill: parent
radius: _radius
color: "white"
opacity: 0.75
}
// Close Icon
QGCColoredImage {
anchors.margins: ScreenTools.defaultFontPixelWidth / 2
anchors.top: parent.top
anchors.right: parent.right
width: ScreenTools.defaultFontPixelHeight
height: width
sourceSize.height: width
source: "/res/XDelete.svg"
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
color: "black"
QGCMouseArea {
fillItem: parent
onClicked: _root.visible = false
}
}
QGCLabel {
id: title
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter
text: qsTr("Create Plan")
color: "black"
}
QGCFlickable {
id: flickable
anchors.margins: _margins
anchors.top: title.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
contentHeight: creatorFlow.height
contentWidth: creatorFlow.width
Flow {
id: creatorFlow
width: flickable.width
spacing: _margins
Repeater {
model: _planMasterController.planCreators
Rectangle {
id: button
width: ScreenTools.defaultFontPixelHeight * 10
height: width
color: button.pressed || button.highlighted ? qgcPal.buttonHighlight : qgcPal.button
property bool highlighted: mouseArea.containsMouse
property bool pressed: mouseArea.pressed
Image {
anchors.margins: _margins
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
source: object.imageResource
fillMode: Image.PreserveAspectFit
mipmap: true
}
QGCLabel {
anchors.margins: _margins
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter
text: object.name
color: button.pressed || button.highlighted ? qgcPal.buttonHighlightText : qgcPal.buttonText
}
QGCMouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
preventStealing: true
onClicked: { object.createPlan(_mapCenter()); _root.visible = false }
}
}
}
}
}
}
This diff is collapsed.
......@@ -130,8 +130,10 @@ Rectangle {
}
SectionHeader {
id: scanHeader
text: qsTr("Scan")
id: scanHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Scan")
}
Column {
......@@ -200,8 +202,10 @@ Rectangle {
} // Column - Scan
SectionHeader {
id: statsHeader
text: qsTr("Statistics")
id: statsHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Statistics")
}
Grid {
......
......@@ -124,8 +124,10 @@ Rectangle {
}
SectionHeader {
id: transectsHeader
text: qsTr("Transects")
id: transectsHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Transects")
}
GridLayout {
......@@ -233,9 +235,11 @@ Rectangle {
}
SectionHeader {
id: terrainHeader
text: qsTr("Terrain")
checked: missionItem.followTerrain
id: terrainHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Terrain")
checked: missionItem.followTerrain
}
ColumnLayout {
......@@ -280,8 +284,10 @@ Rectangle {
}
SectionHeader {
id: statsHeader
text: qsTr("Statistics")
id: statsHeader
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Statistics")
}
TransectStyleComplexItemStats {
......@@ -357,8 +363,6 @@ Rectangle {
SectionHeader {
id: presectsTransectsHeader
anchors.left: undefined
anchors.right: undefined
Layout.fillWidth: true
text: qsTr("Transects")
}
......@@ -400,11 +404,9 @@ Rectangle {
}
SectionHeader {
id: presetsStatsHeader
anchors.left: undefined
anchors.right: undefined
id: presetsStatsHeader
Layout.fillWidth: true
text: qsTr("Statistics")
text: qsTr("Statistics")
}
TransectStyleComplexItemStats {
......
......@@ -174,6 +174,8 @@ Item {
SectionHeader {
id: categoryHeader
anchors.left: parent.left
anchors.right: parent.right
text: category
checked: controller.currentCategory === text
exclusiveGroup: sectionGroup
......
......@@ -43,8 +43,10 @@ Column {
}
SectionHeader {
id: header
text: name + (passed ? qsTr(" (passed)") : "")
id: header
anchors.left: parent.left
anchors.right: parent.right
text: name + (passed ? qsTr(" (passed)") : "")
}
Column {
......
......@@ -40,7 +40,6 @@ ParameterEditor 1.0 ParameterEditor.qml
ParameterEditorDialog 1.0 ParameterEditorDialog.qml
PIDTuning 1.0 PIDTuning.qml
PlanEditToolbar 1.0 PlanEditToolbar.qml
PlanStartOverlay 1.0 PlanStartOverlay.qml
PreFlightCheckButton 1.0 PreFlightCheckButton.qml
PreFlightCheckGroup 1.0 PreFlightCheckGroup.qml
PreFlightCheckModel 1.0 PreFlightCheckModel.qml
......
......@@ -7,10 +7,8 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
FocusScope {
id: _root
anchors.left: parent.left
anchors.right: parent.right
height: column.height
id: _root
height: column.height
property alias text: label.text
property bool checked: true
......
......@@ -27,6 +27,11 @@ Rectangle {
property AbstractButton lastClickedButton: null
function simulateClick(buttonIndex) {
toolStripColumn.children[buttonIndex].checked = true
toolStripColumn.children[buttonIndex].clicked()
}
// Ensure we don't get narrower than content
property real _idealWidth: (ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 8) + toolStripColumn.anchors.margins * 2
......@@ -73,7 +78,7 @@ Rectangle {
checked: modelData.checked !== undefined ? modelData.checked : checked
ButtonGroup.group: buttonGroup
// Only drop pannel and toggleable are checkable
// Only drop panel and toggleable are checkable
checkable: modelData.dropPanelComponent !== undefined || (modelData.toggle !== undefined && modelData.toggle)
onClicked: {
......
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