diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index 4a7266b754b0250edfa10ce47161183e7612287c..6e969d9f923cfd1c061d6d639d2bb4ca873c4ae9 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -11,6 +11,7 @@ import QtQuick 2.3 import QtQuick.Controls 1.2 import QtLocation 5.3 import QtPositioning 5.3 +import QtQuick.Dialogs 1.2 import QGroundControl 1.0 import QGroundControl.FactSystem 1.0 @@ -40,6 +41,7 @@ Map { property bool firstGCSPositionReceived: false ///< true: first gcs position update was responded to property bool firstVehiclePositionReceived: false ///< true: first vehicle position update was responded to property bool planView: false ///< true: map being using for Plan view, items should be draggable + property var qgcView readonly property real maxZoomLevel: 20 @@ -62,6 +64,20 @@ Map { } } + function centerToSpecifiedLocation() { + qgcView.showDialog(specifyMapPositionDialog, qsTr("Specify Position"), qgcView.showDialogDefaultWidth, StandardButton.Cancel) + + } + + Component { + id: specifyMapPositionDialog + + EditPositionDialog { + coordinate: center + onCoordinateChanged: center = coordinate + } + } + ExclusiveGroup { id: mapTypeGroup } // Update ground station position diff --git a/src/FlightMap/Widgets/CenterMapDropButton.qml b/src/FlightMap/Widgets/CenterMapDropButton.qml index ca48c00e398a164fdcb5b336b4a847267a1534e9..5d9cca2551f5713c904232d7c93ddda89ec22a02 100644 --- a/src/FlightMap/Widgets/CenterMapDropButton.qml +++ b/src/FlightMap/Widgets/CenterMapDropButton.qml @@ -209,6 +209,17 @@ DropButton { } } + + QGCButton { + text: qsTr("Specified Location") + Layout.fillWidth: true + + onClicked: { + dropButton.hideDropDown() + map.centerToSpecifiedLocation() + } + } + QGCButton { text: qsTr("Vehicle") Layout.fillWidth: true diff --git a/src/FlightMap/Widgets/CenterMapDropPanel.qml b/src/FlightMap/Widgets/CenterMapDropPanel.qml index 90dd02b3bc0c7af12b0dd4d234ba869915b395ff..db60b88547082b01231ef5add3e8603d65272298 100644 --- a/src/FlightMap/Widgets/CenterMapDropPanel.qml +++ b/src/FlightMap/Widgets/CenterMapDropPanel.qml @@ -62,6 +62,17 @@ ColumnLayout { } } + QGCButton { + text: qsTr("Vehicle") + Layout.fillWidth: true + enabled: _activeVehicle && _activeVehicle.coordinate.isValid + + onClicked: { + dropPanel.hide() + map.center = activeVehicle.coordinate + } + } + QGCButton { text: qsTr("Current Location") Layout.fillWidth: true @@ -74,13 +85,12 @@ ColumnLayout { } QGCButton { - text: qsTr("Vehicle") + text: qsTr("Specified Location") Layout.fillWidth: true - enabled: _activeVehicle && _activeVehicle.coordinate.isValid onClicked: { dropPanel.hide() - map.center = activeVehicle.coordinate + map.centerToSpecifiedLocation() } } } // Column diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml index 412fcab841e5e7588e27b4b6012ab8499c086ed6..278f56443172cfbab7887c4d7fcd96168069ade3 100644 --- a/src/PlanView/PlanView.qml +++ b/src/PlanView/PlanView.qml @@ -411,6 +411,7 @@ QGCView { allowGCSLocationCenter: true allowVehicleLocationCenter: true planView: true + qgcView: _qgcView // This is the center rectangle of the map which is not obscured by tools property rect centerViewport: Qt.rect(_leftToolWidth, _toolbarHeight, editorMap.width - _leftToolWidth - _rightPanelWidth, editorMap.height - _statusHeight - _toolbarHeight) diff --git a/src/QtLocationPlugin/QMLControl/OfflineMap.qml b/src/QtLocationPlugin/QMLControl/OfflineMap.qml index 3bda5a4405f0e2d30cc89e9c67f825dd7198982f..e7c8c87a098dc4de217b8998c239ac7bd7f82f13 100644 --- a/src/QtLocationPlugin/QMLControl/OfflineMap.qml +++ b/src/QtLocationPlugin/QMLControl/OfflineMap.qml @@ -364,6 +364,7 @@ QGCView { allowVehicleLocationCenter: false gesture.flickDeceleration: 3000 mapName: "OfflineMap" + qgcView: offlineMapView property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1