Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/PlanView/GeoFenceEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Rectangle {
property var myGeoFenceController
property var flightMap

/// Emitted when the user interacts with the editor, so the plan view can make
/// GeoFence the active editing layer (required for the map visuals to be interactive).
signal requestEditingLayer()

readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 15)
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
Expand Down Expand Up @@ -112,6 +116,7 @@ Rectangle {
text: qsTr("Polygon Fence")

onClicked: {
geoFenceEditorRect.requestEditingLayer()
var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height)
var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */)
var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */)
Expand All @@ -124,6 +129,7 @@ Rectangle {
text: qsTr("Circular Fence")

onClicked: {
geoFenceEditorRect.requestEditingLayer()
var rect = Qt.rect(flightMap.centerViewport.x, flightMap.centerViewport.y, flightMap.centerViewport.width, flightMap.centerViewport.height)
var topLeftCoord = flightMap.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */)
var bottomRightCoord = flightMap.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */)
Expand Down Expand Up @@ -183,6 +189,7 @@ Rectangle {
on_InteractiveChanged: checked = _interactive

onClicked: {
geoFenceEditorRect.requestEditingLayer()
myGeoFenceController.clearAllInteractive()
object.interactive = checked
}
Expand Down Expand Up @@ -223,7 +230,7 @@ Rectangle {
anchors.right: parent.right
columns: 4
flow: GridLayout.TopToBottom
visible: polygonSection.checked && myGeoFenceController.circles.count > 0
visible: circleSection.checked && myGeoFenceController.circles.count > 0

QGCLabel {
text: qsTr("Inclusion")
Expand Down Expand Up @@ -259,6 +266,7 @@ Rectangle {
on_InteractiveChanged: checked = _interactive

onClicked: {
geoFenceEditorRect.requestEditingLayer()
myGeoFenceController.clearAllInteractive()
object.interactive = checked
}
Expand Down
17 changes: 17 additions & 0 deletions src/PlanView/PlanTreeView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,25 @@ TreeView {
}

onLoaded: {
if (delegateRoot.nodeType === "fenceEditor" && item) {
// Interacting with the GeoFence editor makes the fence the active
// editing layer so its map visuals become interactive.
item.requestEditingLayer.connect(function() {
root.editingLayerChangeRequested(root._layerFence)
})
}
if (delegateRoot.nodeType === "rallyItem" && item) {
// Selecting a rally point makes Rally the active editing layer so its
// map visuals become interactive.
item.requestEditingLayer.connect(function() {
root.editingLayerChangeRequested(root._layerRally)
})
}
Comment on lines +288 to +301
if (delegateRoot.nodeType === "missionItem" && item) {
item.clicked.connect(function() {
// Selecting a mission item makes Mission the active editing layer so its
// map visuals (e.g. survey polygon tools) become interactive.
root.editingLayerChangeRequested(root._layerMission)
root._missionController.setCurrentPlanViewSeqNum(delegateRoot.nodeObject.sequenceNumber, false)
})
item.remove.connect(function() {
Expand Down
5 changes: 5 additions & 0 deletions src/PlanView/RallyPointItemEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Rectangle {
property var rallyPoint ///< RallyPoint object associated with editor
property var controller ///< RallyPointController

/// Emitted when the user interacts with the editor, so the plan view can make
/// Rally the active editing layer (required for the map visuals to be interactive).
signal requestEditingLayer()

property bool _currentItem: rallyPoint ? rallyPoint === controller.currentRallyPoint : false
property color _outerTextColor: qgcPal.text

Expand Down Expand Up @@ -58,6 +62,7 @@ Rectangle {
anchors.right: titleLayout.right
onClicked: {
if (mainWindow.allowViewSwitch()) {
root.requestEditingLayer()
controller.currentRallyPoint = rallyPoint
}
}
Expand Down
Loading