Browse Source

Support Keep map centered on vehicle

QGC4.4
DonLakeFlyer 5 years ago
parent
commit
b308d72db7
  1. 10
      src/FlightDisplay/FlightDisplayViewMap.qml
  2. 6
      src/Settings/FlyView.SettingsGroup.json
  3. 1
      src/Settings/FlyViewSettings.cc
  4. 1
      src/Settings/FlyViewSettings.h
  5. 8
      src/ui/preferences/GeneralSettings.qml

10
src/FlightDisplay/FlightDisplayViewMap.qml

@ -48,6 +48,8 @@ FlightMap { @@ -48,6 +48,8 @@ FlightMap {
property var _activeVehicleCoordinate: activeVehicle ? activeVehicle.coordinate : QtPositioning.coordinate()
property real _toolButtonTopMargin: parent.height - mainWindow.height + (ScreenTools.defaultFontPixelHeight / 2)
property bool _airspaceEnabled: QGroundControl.airmapSupported ? (QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue && QGroundControl.airspaceManager.connected): false
property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings
property bool _keepMapCenteredOnVehicle: _flyViewSettings.keepMapCenteredOnVehicle.rawValue
property bool _disableVehicleTracking: false
property bool _keepVehicleCentered: mainIsMap ? false : true
@ -129,7 +131,7 @@ FlightMap { @@ -129,7 +131,7 @@ FlightMap {
function updateMapToVehiclePosition() {
// We let FlightMap handle first vehicle position
if (firstVehiclePositionReceived && _activeVehicleCoordinate.isValid && !_disableVehicleTracking) {
if (!_keepMapCenteredOnVehicle && firstVehiclePositionReceived && _activeVehicleCoordinate.isValid && !_disableVehicleTracking) {
if (_keepVehicleCentered) {
flightMap.center = _activeVehicleCoordinate
} else {
@ -140,6 +142,12 @@ FlightMap { @@ -140,6 +142,12 @@ FlightMap {
}
}
on_ActiveVehicleCoordinateChanged: {
if (_keepMapCenteredOnVehicle && _activeVehicleCoordinate.isValid && !_disableVehicleTracking) {
flightMap.center = _activeVehicleCoordinate
}
}
Timer {
id: panRecenterTimer
interval: 10000

6
src/Settings/FlyView.SettingsGroup.json

@ -38,6 +38,12 @@ @@ -38,6 +38,12 @@
"defaultValue": false
},
{
"name": "keepMapCenteredOnVehicle",
"shortDescription": "Keep map centered on vehicle",
"type": "bool",
"defaultValue": false
},
{
"name": "maxGoToLocationDistance",
"shortDescription": "Maximum distance allowed for Go To Location.",
"type": "double",

1
src/Settings/FlyViewSettings.cc

@ -24,3 +24,4 @@ DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel) @@ -24,3 +24,4 @@ DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel)
DECLARE_SETTINGSFACT(FlyViewSettings, showAdditionalIndicatorsCompass)
DECLARE_SETTINGSFACT(FlyViewSettings, lockNoseUpCompass)
DECLARE_SETTINGSFACT(FlyViewSettings, maxGoToLocationDistance)
DECLARE_SETTINGSFACT(FlyViewSettings, keepMapCenteredOnVehicle)

1
src/Settings/FlyViewSettings.h

@ -26,4 +26,5 @@ public: @@ -26,4 +26,5 @@ public:
DEFINE_SETTINGFACT(showAdditionalIndicatorsCompass)
DEFINE_SETTINGFACT(lockNoseUpCompass)
DEFINE_SETTINGFACT(maxGoToLocationDistance)
DEFINE_SETTINGFACT(keepMapCenteredOnVehicle)
};

8
src/ui/preferences/GeneralSettings.qml

@ -469,6 +469,14 @@ Rectangle { @@ -469,6 +469,14 @@ Rectangle {
}
FactCheckBox {
text: qsTr("Keep Map Centered On Vehicle")
fact: _keepMapCenteredOnVehicle
visible: _keepMapCenteredOnVehicle.visible
property Fact _keepMapCenteredOnVehicle: QGroundControl.settingsManager.flyViewSettings.keepMapCenteredOnVehicle
}
FactCheckBox {
text: qsTr("Show Telemetry Log Replay Status Bar")
fact: _showLogReplayStatusBar
visible: _showLogReplayStatusBar.visible

Loading…
Cancel
Save