Unverified Commit 38d30096 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #6572 from DonLakeFlyer/CenterMap

Plan, Offline Maps: Support for center map to specified location
parents 29458653 85b939db
......@@ -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
......
......@@ -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
......
......@@ -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
......@@ -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)
......
......@@ -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
......
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