6import QGroundControl.Controls
7import QGroundControl.FactControls
9/// Inspector of the selected fence or the breach return point
13 required property var page
14 property bool drillIn: false
18 readonly property string _kind: page.selectedKind
19 readonly property var _fence: page.selectedObject
20 readonly property var _controller: page.controller
22 QGCPalette { id: qgcPal }
24 Fact { id: emptyFact }
28 anchors.margins: ScreenTools.defaultFontPixelWidth / 2
29 spacing: ScreenTools.defaultFontPixelHeight * 0.5
32 Layout.fillWidth: true
33 namePrefix: "planPanel_fenceInspector"
35 deletable: root._kind !== "breach"
36 canStepPrevious: root.page.selectedEntryIndex > 0
37 canStepNext: root.page.selectedEntryIndex >= 0 && root.page.selectedEntryIndex < root.page.entries.length - 1
41 return qsTr("Polygon %1").arg(root.page.selectedIndex + 1)
43 return qsTr("Circle %1").arg(root.page.selectedIndex + 1)
45 return qsTr("Breach return point")
50 onBackRequested: root.backRequested()
51 onPreviousRequested: root.page.step(-1)
52 onNextRequested: root.page.step(1)
54 if (mainWindow.allowViewSwitch()) {
55 root.page.deleteSelected()
63 Layout.fillWidth: true
64 Layout.fillHeight: true
65 contentHeight: bodyColumn.height
71 width: flickable.width
72 spacing: ScreenTools.defaultFontPixelHeight * 0.5
75 objectName: "planPanel_fenceInclusion"
76 model: [ qsTr("Include"), qsTr("Exclude") ]
77 currentIndex: root._fence && root._fence.inclusion ? 0 : 1
78 visible: root._kind === "polygon" || root._kind === "circle"
80 onActivated: (index) => {
82 root._fence.inclusion = index === 0
88 objectName: "planPanel_fenceHint"
89 Layout.fillWidth: true
90 visible: root._kind === "polygon" || root._kind === "circle"
91 wrapMode: Text.WordWrap
92 color: qgcPal.textSecondary
93 font.pointSize: ScreenTools.smallFontPointSize
94 text: root._kind === "polygon" ?
95 qsTr("Drag the vertices on the map to reshape the fence.") :
96 qsTr("Drag the center on the map to move the fence.")
100 Layout.fillWidth: true
101 active: root._kind === "circle" && root._fence !== null
103 sourceComponent: LabelledFactTextField {
104 objectName: "planPanel_fenceRadius"
105 label: qsTr("Radius")
106 // The selection can change to a fence without a radius before this field is torn down
107 fact: root._fence && root._fence.radius ? root._fence.radius : emptyFact
112 Layout.fillWidth: true
113 visible: root._kind === "breach"
114 wrapMode: Text.WordWrap
115 color: qgcPal.textSecondary
116 font.pointSize: ScreenTools.smallFontPointSize
117 text: qsTr("Optional point the vehicle flies to after a fence breach.")
120 LabelledFactTextField {
121 objectName: "planPanel_fenceBreachAltitude"
122 Layout.fillWidth: true
123 label: qsTr("Altitude")
124 fact: root._controller.breachReturnAltitude
125 visible: root._kind === "breach" && root._controller.breachReturnPoint.isValid
129 objectName: "planPanel_fenceBreachToggle"
130 Layout.fillWidth: true
131 visible: root._kind === "breach"
132 text: root._controller.breachReturnPoint.isValid ? qsTr("Remove breach return point") : qsTr("Set at map center")
135 if (!mainWindow.allowViewSwitch()) {
138 if (root._controller.breachReturnPoint.isValid) {
139 root._controller.breachReturnPoint = QtPositioning.coordinate()
141 root._controller.breachReturnPoint = root.page.editorMap.center