Browse Source

Support for center map to specified location

QGC4.4
DonLakeFlyer 7 years ago
parent
commit
85b939db04
  1. 16
      src/FlightMap/FlightMap.qml
  2. 11
      src/FlightMap/Widgets/CenterMapDropButton.qml
  3. 16
      src/FlightMap/Widgets/CenterMapDropPanel.qml
  4. 1
      src/PlanView/PlanView.qml
  5. 1
      src/QtLocationPlugin/QMLControl/OfflineMap.qml

16
src/FlightMap/FlightMap.qml

@ -11,6 +11,7 @@ import QtQuick 2.3 @@ -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 { @@ -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 { @@ -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

11
src/FlightMap/Widgets/CenterMapDropButton.qml

@ -209,6 +209,17 @@ DropButton { @@ -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

16
src/FlightMap/Widgets/CenterMapDropPanel.qml

@ -63,6 +63,17 @@ ColumnLayout { @@ -63,6 +63,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
enabled: map.gcsPosition.isValid
@ -74,13 +85,12 @@ ColumnLayout { @@ -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

1
src/PlanView/PlanView.qml

@ -411,6 +411,7 @@ QGCView { @@ -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)

1
src/QtLocationPlugin/QMLControl/OfflineMap.qml

@ -364,6 +364,7 @@ QGCView { @@ -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

Loading…
Cancel
Save