From 8a9952435b165fd541f29da7b01ca3f7a25e4243 Mon Sep 17 00:00:00 2001 From: Valentin Platzgummer Date: Fri, 22 Mar 2019 11:38:03 +0100 Subject: [PATCH] FlyAreaItemEditor.qml edited --- src/MissionManager/WimaFlyArea.cc | 11 ++++---- src/WimaView/FlyAreaEditor.qml | 2 +- src/WimaView/FlyAreaItemEditor.qml | 44 ++++++++++++++---------------- src/WimaView/WimaView.qml | 44 +----------------------------- 4 files changed, 29 insertions(+), 72 deletions(-) diff --git a/src/MissionManager/WimaFlyArea.cc b/src/MissionManager/WimaFlyArea.cc index 920f191f2..4753c1a48 100644 --- a/src/MissionManager/WimaFlyArea.cc +++ b/src/MissionManager/WimaFlyArea.cc @@ -48,9 +48,7 @@ void WimaFlyArea::setCurrentPolygon(int index) { if(index >= 0 && index < _polygons->count()) { - if(index == _currentPolygonIndex){ - return; - } + for (int i = 0; i < _polygons->count(); i++) { QGCMapPolygon* polygon = qobject_cast(_polygons->get(i)); @@ -61,8 +59,11 @@ void WimaFlyArea::setCurrentPolygon(int index) _currentPolygonItem = qobject_cast(_polygons->get(index)); _currentPolygonItem->setInteractive(true); - emit currentPolygonItemChanged(_currentPolygonItem); - emit currentPolygonIndexChanged(index); + if(index != _currentPolygonIndex){ + emit currentPolygonItemChanged(_currentPolygonItem); + emit currentPolygonIndexChanged(index); + } + } } diff --git a/src/WimaView/FlyAreaEditor.qml b/src/WimaView/FlyAreaEditor.qml index 15da55f10..ce309d869 100644 --- a/src/WimaView/FlyAreaEditor.qml +++ b/src/WimaView/FlyAreaEditor.qml @@ -28,7 +28,7 @@ Rectangle { property real _margin: ScreenTools.defaultFontPixelWidth / 2 property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5 property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle - property real _cameraMinTriggerInterval: missionItem.cameraCalc.minTriggerInterval.rawValue + diff --git a/src/WimaView/FlyAreaItemEditor.qml b/src/WimaView/FlyAreaItemEditor.qml index 07ece3ee5..82eca3634 100644 --- a/src/WimaView/FlyAreaItemEditor.qml +++ b/src/WimaView/FlyAreaItemEditor.qml @@ -12,7 +12,7 @@ import QGroundControl.FactControls 1.0 import QGroundControl.Palette 1.0 -/// Fly Area edit control +/// Mission item edit control Rectangle { id: _root height: editorLoader.visible ? (editorLoader.y + editorLoader.height + (_margin * 2)) : (commandPicker.y + commandPicker.height + _margin / 2) @@ -20,11 +20,11 @@ Rectangle { radius: _radius property var map ///< Map control + property var flyArea property var masterController - property var missionItem ///< MissionItem associated with this editor + property var polygon ///< MissionItem associated with this editor property bool readOnly ///< true: read only view, false: full editing view property var rootQgcView - property var flyArea signal clicked signal remove @@ -39,7 +39,7 @@ Rectangle { readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 12) readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 - readonly property real _hamburgerSize: commandPicker.height + readonly property real _hamburgerSize: commandPicker.height * 0.75 readonly property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly QGCPalette { @@ -61,13 +61,12 @@ Rectangle { } - QGCLabel { id: label anchors.verticalCenter: commandPicker.verticalCenter anchors.leftMargin: _margin anchors.left: parent.left - text: index+1 + text: index color: _outerTextColor } @@ -80,7 +79,7 @@ Rectangle { height: _hamburgerSize sourceSize.height: _hamburgerSize source: "qrc:/qmlimages/Hamburger.svg" - visible: flyArea.currentPolygonIndex === index + visible: _currentItem color: qgcPal.text } @@ -99,10 +98,17 @@ Rectangle { text: qsTr("Insert Fly Area") onTriggered: flyArea.appendFlyAreaPolygon() } + + + MenuItem { text: qsTr("Delete") onTriggered: remove() } + + + + } } @@ -113,26 +119,18 @@ Rectangle { anchors.rightMargin: ScreenTools.defaultFontPixelWidth anchors.left: label.right anchors.top: parent.top - visible: !commandPicker.visible - text: missionItem.commandName - - Component { - id: commandDialog - - MissionCommandDialog { - missionItem: _root.missionItem - } - } + visible: !commandLabel.visible + text: "Fly Area" - //onClicked: qgcView.showDialog(commandDialog, qsTr("Select Mission Command"), qgcView.showDialogDefaultWidth, StandardButton.Cancel) } QGCLabel { - id: commandLabel - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - text: "Fly Area" - color: _outerTextColor + id: commandLabel + anchors.fill: commandPicker + visible: _currentItem + verticalAlignment: Text.AlignVCenter + text: "Fly Area" + color: _outerTextColor } Loader { diff --git a/src/WimaView/WimaView.qml b/src/WimaView/WimaView.qml index 3919e04c3..687876469 100644 --- a/src/WimaView/WimaView.qml +++ b/src/WimaView/WimaView.qml @@ -808,7 +808,7 @@ QGCView { map: editorMap masterController: _planMasterController flyArea: _flyArea - missionItem: object + polygon: object width: parent.width readOnly: false rootQgcView: _qgcView @@ -986,48 +986,6 @@ QGCView { } } - Component { - id: patternDropPanel - - ColumnLayout { - spacing: ScreenTools.defaultFontPixelWidth * 0.5 - - QGCLabel { text: qsTr("Create complex pattern:") } - - Repeater { - model: _missionController.complexMissionItemNames - - QGCButton { - text: modelData - Layout.fillWidth: true - - onClicked: { - addComplexItem(modelData) - dropPanel.hide() - } - } - } - - 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: !masterController.syncInProgress - onClicked: { - masterController.loadShapeFromSelectedFile() - dropPanel.hide() - } - } - } // Column - } Component { id: syncDropPanel -- 2.22.0