|
|
|
@ -499,7 +499,13 @@ FlightMap {
@@ -499,7 +499,13 @@ FlightMap {
|
|
|
|
|
checked: true |
|
|
|
|
index: -1 |
|
|
|
|
label: qsTr("ROI here", "Make this a Region Of Interest") |
|
|
|
|
onClicked: _activeVehicle.stopGuidedModeROI() |
|
|
|
|
|
|
|
|
|
onClicked: (position) => { |
|
|
|
|
var roiEditMenu = popupMenuComponent.createObject(_root, { coord: roiLocationItem.coordinate, contentItemComponent: roiEditMenuComponent }) |
|
|
|
|
var clickPoint = mapToItem(_root, position.x, position.y) |
|
|
|
|
roiEditMenu.setPosition(clickPoint.x, clickPoint.y) |
|
|
|
|
roiEditMenu.open() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//-- Visibilty controlled by actual state |
|
|
|
@ -530,27 +536,26 @@ FlightMap {
@@ -530,27 +536,26 @@ FlightMap {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handle guided mode clicks |
|
|
|
|
MouseArea { |
|
|
|
|
anchors.fill: parent |
|
|
|
|
Component { |
|
|
|
|
id: popupMenuComponent |
|
|
|
|
|
|
|
|
|
Popup { |
|
|
|
|
id: clickMenu |
|
|
|
|
id: mapClickMenu |
|
|
|
|
modal: true |
|
|
|
|
|
|
|
|
|
property var coord |
|
|
|
|
property var contentItemComponent |
|
|
|
|
|
|
|
|
|
function setCoordinates(mouseX, mouseY) { |
|
|
|
|
function setPosition(mouseX, mouseY) { |
|
|
|
|
var newX = mouseX |
|
|
|
|
var newY = mouseY |
|
|
|
|
|
|
|
|
|
// Filtering coordinates |
|
|
|
|
if (newX + clickMenu.width > _root.width) { |
|
|
|
|
newX = _root.width - clickMenu.width |
|
|
|
|
if (newX + mapClickMenu.width > _root.width) { |
|
|
|
|
newX = _root.width - mapClickMenu.width |
|
|
|
|
} |
|
|
|
|
if (newY + clickMenu.height > _root.height) { |
|
|
|
|
newY = _root.height - clickMenu.height |
|
|
|
|
if (newY + mapClickMenu.height > _root.height) { |
|
|
|
|
newY = _root.height - mapClickMenu.height |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Set coordiantes |
|
|
|
@ -564,75 +569,139 @@ FlightMap {
@@ -564,75 +569,139 @@ FlightMap {
|
|
|
|
|
border.color: qgcPal.text |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ColumnLayout { |
|
|
|
|
id: mainLayout |
|
|
|
|
spacing: ScreenTools.defaultFontPixelWidth / 2 |
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: "Go to location" |
|
|
|
|
visible: globals.guidedControllerFlyView.showGotoLocation |
|
|
|
|
onClicked: { |
|
|
|
|
if (clickMenu.opened) { |
|
|
|
|
clickMenu.close() |
|
|
|
|
} |
|
|
|
|
gotoLocationItem.show(clickMenu.coord) |
|
|
|
|
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionGoto, clickMenu.coord, gotoLocationItem) |
|
|
|
|
contentItem: Loader { |
|
|
|
|
sourceComponent: contentItemComponent |
|
|
|
|
|
|
|
|
|
property var mapClickCoord: mapClickMenu.coord |
|
|
|
|
property var popup: mapClickMenu |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
|
id: mapClickMenuComponent |
|
|
|
|
|
|
|
|
|
ColumnLayout { |
|
|
|
|
id: mainLayout |
|
|
|
|
spacing: ScreenTools.defaultFontPixelWidth / 2 |
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: qsTr("Go to location") |
|
|
|
|
visible: globals.guidedControllerFlyView.showGotoLocation |
|
|
|
|
onClicked: { |
|
|
|
|
if (popup.opened) { |
|
|
|
|
popup.close() |
|
|
|
|
} |
|
|
|
|
gotoLocationItem.show(mapClickCoord) |
|
|
|
|
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionGoto, mapClickCoord, gotoLocationItem) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: "Orbit at location" |
|
|
|
|
visible: globals.guidedControllerFlyView.showOrbit |
|
|
|
|
onClicked: { |
|
|
|
|
if (clickMenu.opened) { |
|
|
|
|
clickMenu.close() |
|
|
|
|
} |
|
|
|
|
orbitMapCircle.show(clickMenu.coord) |
|
|
|
|
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionOrbit, clickMenu.coord, orbitMapCircle) |
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: qsTr("Orbit at location") |
|
|
|
|
visible: globals.guidedControllerFlyView.showOrbit |
|
|
|
|
onClicked: { |
|
|
|
|
if (popup.opened) { |
|
|
|
|
popup.close() |
|
|
|
|
} |
|
|
|
|
orbitMapCircle.show(mapClickCoord) |
|
|
|
|
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionOrbit, mapClickCoord, orbitMapCircle) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: "ROI at location" |
|
|
|
|
visible: globals.guidedControllerFlyView.showROI |
|
|
|
|
onClicked: { |
|
|
|
|
if (clickMenu.opened) { |
|
|
|
|
clickMenu.close() |
|
|
|
|
} |
|
|
|
|
roiLocationItem.show(clickMenu.coord) |
|
|
|
|
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionROI, clickMenu.coord, roiLocationItem) |
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: qsTr("ROI at location") |
|
|
|
|
visible: globals.guidedControllerFlyView.showROI |
|
|
|
|
onClicked: { |
|
|
|
|
if (popup.opened) { |
|
|
|
|
popup.close() |
|
|
|
|
} |
|
|
|
|
roiLocationItem.show(mapClickCoord) |
|
|
|
|
globals.guidedControllerFlyView.executeAction(globals.guidedControllerFlyView.actionROI, mapClickCoord, 0, false) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: "Set home here" |
|
|
|
|
visible: globals.guidedControllerFlyView.showSetHome |
|
|
|
|
onClicked: { |
|
|
|
|
if (clickMenu.opened) { |
|
|
|
|
clickMenu.close() |
|
|
|
|
} |
|
|
|
|
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionSetHome, clickMenu.coord) |
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: qsTr("Set home here") |
|
|
|
|
visible: globals.guidedControllerFlyView.showSetHome |
|
|
|
|
onClicked: { |
|
|
|
|
if (popup.opened) { |
|
|
|
|
popup.close() |
|
|
|
|
} |
|
|
|
|
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionSetHome, mapClickCoord) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: qsTr("Set Estimator Origin") |
|
|
|
|
visible: globals.guidedControllerFlyView.showSetEstimatorOrigin |
|
|
|
|
onClicked: { |
|
|
|
|
if (popup.opened) { |
|
|
|
|
popup.close() |
|
|
|
|
} |
|
|
|
|
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionSetEstimatorOrigin, mapClickCoord) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
|
id: roiEditPositionDialogComponent |
|
|
|
|
|
|
|
|
|
onClicked: { |
|
|
|
|
if (!globals.guidedControllerFlyView.guidedUIVisible && (globals.guidedControllerFlyView.showGotoLocation || globals.guidedControllerFlyView.showOrbit || globals.guidedControllerFlyView.showROI || globals.guidedControllerFlyView.showSetHome)) { |
|
|
|
|
orbitMapCircle.hide() |
|
|
|
|
gotoLocationItem.hide() |
|
|
|
|
var clickCoord = _root.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */) |
|
|
|
|
clickMenu.coord = clickCoord |
|
|
|
|
clickMenu.setCoordinates(mouse.x, mouse.y) |
|
|
|
|
clickMenu.open() |
|
|
|
|
EditPositionDialog { |
|
|
|
|
title: qsTr("Edit ROI Position") |
|
|
|
|
coordinate: roiLocationItem.coordinate |
|
|
|
|
onCoordinateChanged: { |
|
|
|
|
roiLocationItem.coordinate = coordinate |
|
|
|
|
_activeVehicle.guidedModeROI(coordinate) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
|
id: roiEditMenuComponent |
|
|
|
|
|
|
|
|
|
ColumnLayout { |
|
|
|
|
id: mainLayout |
|
|
|
|
spacing: ScreenTools.defaultFontPixelWidth / 2 |
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: qsTr("Cancel ROI") |
|
|
|
|
onClicked: { |
|
|
|
|
_activeVehicle.stopGuidedModeROI() |
|
|
|
|
popup.close() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
text: qsTr("Edit Position") |
|
|
|
|
onClicked: { |
|
|
|
|
roiEditPositionDialogComponent.createObject(mainWindow, { showSetPositionFromVehicle: false }).open() |
|
|
|
|
popup.close() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onMapClicked: (position) => { |
|
|
|
|
if (!globals.guidedControllerFlyView.guidedUIVisible && |
|
|
|
|
(globals.guidedControllerFlyView.showGotoLocation || globals.guidedControllerFlyView.showOrbit || globals.guidedControllerFlyView.showROI || globals.guidedControllerFlyView.showSetHome || globals.guidedControllerFlyView.showSetEstimatorOrigin)) { |
|
|
|
|
orbitMapCircle.hide() |
|
|
|
|
gotoLocationItem.hide() |
|
|
|
|
var clickCoord = _root.toCoordinate(Qt.point(position.x, position.y), false /* clipToViewPort */) |
|
|
|
|
var mapClickMenu = popupMenuComponent.createObject(_root, { coord: clickCoord, contentItemComponent: mapClickMenuComponent }) |
|
|
|
|
mapClickMenu.setPosition(position.x, position.y) |
|
|
|
|
mapClickMenu.open() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MapScale { |
|
|
|
|
id: mapScale |
|
|
|
|
anchors.margins: _toolsMargin |
|
|
|
|