Commit 8a995243 authored by Valentin Platzgummer's avatar Valentin Platzgummer

FlyAreaItemEditor.qml edited

parent 3bc2c3a0
...@@ -48,9 +48,7 @@ void WimaFlyArea::setCurrentPolygon(int index) ...@@ -48,9 +48,7 @@ void WimaFlyArea::setCurrentPolygon(int index)
{ {
if(index >= 0 && index < _polygons->count()) { if(index >= 0 && index < _polygons->count()) {
if(index == _currentPolygonIndex){
return;
}
for (int i = 0; i < _polygons->count(); i++) { for (int i = 0; i < _polygons->count(); i++) {
QGCMapPolygon* polygon = qobject_cast<QGCMapPolygon*>(_polygons->get(i)); QGCMapPolygon* polygon = qobject_cast<QGCMapPolygon*>(_polygons->get(i));
...@@ -61,8 +59,11 @@ void WimaFlyArea::setCurrentPolygon(int index) ...@@ -61,8 +59,11 @@ void WimaFlyArea::setCurrentPolygon(int index)
_currentPolygonItem = qobject_cast<QGCMapPolygon*>(_polygons->get(index)); _currentPolygonItem = qobject_cast<QGCMapPolygon*>(_polygons->get(index));
_currentPolygonItem->setInteractive(true); _currentPolygonItem->setInteractive(true);
emit currentPolygonItemChanged(_currentPolygonItem); if(index != _currentPolygonIndex){
emit currentPolygonIndexChanged(index); emit currentPolygonItemChanged(_currentPolygonItem);
emit currentPolygonIndexChanged(index);
}
} }
} }
...@@ -28,7 +28,7 @@ Rectangle { ...@@ -28,7 +28,7 @@ Rectangle {
property real _margin: ScreenTools.defaultFontPixelWidth / 2 property real _margin: ScreenTools.defaultFontPixelWidth / 2
property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5 property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5
property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
property real _cameraMinTriggerInterval: missionItem.cameraCalc.minTriggerInterval.rawValue
......
...@@ -12,7 +12,7 @@ import QGroundControl.FactControls 1.0 ...@@ -12,7 +12,7 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
/// Fly Area edit control /// Mission item edit control
Rectangle { Rectangle {
id: _root id: _root
height: editorLoader.visible ? (editorLoader.y + editorLoader.height + (_margin * 2)) : (commandPicker.y + commandPicker.height + _margin / 2) height: editorLoader.visible ? (editorLoader.y + editorLoader.height + (_margin * 2)) : (commandPicker.y + commandPicker.height + _margin / 2)
...@@ -20,11 +20,11 @@ Rectangle { ...@@ -20,11 +20,11 @@ Rectangle {
radius: _radius radius: _radius
property var map ///< Map control property var map ///< Map control
property var flyArea
property var masterController 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 bool readOnly ///< true: read only view, false: full editing view
property var rootQgcView property var rootQgcView
property var flyArea
signal clicked signal clicked
signal remove signal remove
...@@ -39,7 +39,7 @@ Rectangle { ...@@ -39,7 +39,7 @@ Rectangle {
readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 12) readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 12)
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _radius: 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 readonly property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly
QGCPalette { QGCPalette {
...@@ -61,13 +61,12 @@ Rectangle { ...@@ -61,13 +61,12 @@ Rectangle {
} }
QGCLabel { QGCLabel {
id: label id: label
anchors.verticalCenter: commandPicker.verticalCenter anchors.verticalCenter: commandPicker.verticalCenter
anchors.leftMargin: _margin anchors.leftMargin: _margin
anchors.left: parent.left anchors.left: parent.left
text: index+1 text: index
color: _outerTextColor color: _outerTextColor
} }
...@@ -80,7 +79,7 @@ Rectangle { ...@@ -80,7 +79,7 @@ Rectangle {
height: _hamburgerSize height: _hamburgerSize
sourceSize.height: _hamburgerSize sourceSize.height: _hamburgerSize
source: "qrc:/qmlimages/Hamburger.svg" source: "qrc:/qmlimages/Hamburger.svg"
visible: flyArea.currentPolygonIndex === index visible: _currentItem
color: qgcPal.text color: qgcPal.text
} }
...@@ -99,10 +98,17 @@ Rectangle { ...@@ -99,10 +98,17 @@ Rectangle {
text: qsTr("Insert Fly Area") text: qsTr("Insert Fly Area")
onTriggered: flyArea.appendFlyAreaPolygon() onTriggered: flyArea.appendFlyAreaPolygon()
} }
MenuItem { MenuItem {
text: qsTr("Delete") text: qsTr("Delete")
onTriggered: remove() onTriggered: remove()
} }
} }
} }
...@@ -113,26 +119,18 @@ Rectangle { ...@@ -113,26 +119,18 @@ Rectangle {
anchors.rightMargin: ScreenTools.defaultFontPixelWidth anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.left: label.right anchors.left: label.right
anchors.top: parent.top anchors.top: parent.top
visible: !commandPicker.visible visible: !commandLabel.visible
text: missionItem.commandName text: "Fly Area"
Component {
id: commandDialog
MissionCommandDialog {
missionItem: _root.missionItem
}
}
//onClicked: qgcView.showDialog(commandDialog, qsTr("Select Mission Command"), qgcView.showDialogDefaultWidth, StandardButton.Cancel)
} }
QGCLabel { QGCLabel {
id: commandLabel id: commandLabel
anchors.fill: parent anchors.fill: commandPicker
verticalAlignment: Text.AlignVCenter visible: _currentItem
text: "Fly Area" verticalAlignment: Text.AlignVCenter
color: _outerTextColor text: "Fly Area"
color: _outerTextColor
} }
Loader { Loader {
......
...@@ -808,7 +808,7 @@ QGCView { ...@@ -808,7 +808,7 @@ QGCView {
map: editorMap map: editorMap
masterController: _planMasterController masterController: _planMasterController
flyArea: _flyArea flyArea: _flyArea
missionItem: object polygon: object
width: parent.width width: parent.width
readOnly: false readOnly: false
rootQgcView: _qgcView rootQgcView: _qgcView
...@@ -986,48 +986,6 @@ 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 { Component {
id: syncDropPanel id: syncDropPanel
......
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