12#include <QtCore/QVariant>
29 if (_displayMode == mode) {
40 qCDebug(Viewer3DManagerLog) <<
"Display mode changed to" << (mode ==
DisplayMode::View3D ?
"View3D" :
"Map");
44void Viewer3DManager::_onActiveVehicleChanged(
Vehicle *vehicle)
50 _activeVehicle = vehicle;
51 if (!_activeVehicle) {
52 if (_gpsRefSource == GpsRefSource::Vehicle) {
53 _gpsRefSource = GpsRefSource::None;
54 _gpsRef = QGeoCoordinate();
58 _onActiveVehicleCoordinateChanged(_activeVehicle->
coordinate());
63void Viewer3DManager::_onActiveVehicleCoordinateChanged(
const QGeoCoordinate &newCoordinate)
65 if (_gpsRefSource == GpsRefSource::None) {
66 if (newCoordinate.isValid()) {
67 _gpsRef = newCoordinate;
68 _gpsRef.setAltitude(0);
69 _gpsRefSource = GpsRefSource::Vehicle;
72 qCDebug(Viewer3DManagerLog) <<
"GPS ref set by vehicle:" << _gpsRef.latitude() << _gpsRef.longitude() << _gpsRef.altitude();
77void Viewer3DManager::_onGpsRefChanged(
const QGeoCoordinate &newGpsRef,
bool isRefSet)
81 _gpsRefSource = GpsRefSource::Map;
83 qCDebug(Viewer3DManagerLog) <<
"GPS ref set by map provider:" << _gpsRef.latitude() << _gpsRef.longitude() << _gpsRef.altitude();
85 if (_gpsRefSource != GpsRefSource::Map) {
89 _gpsRefSource = GpsRefSource::None;
90 if (_activeVehicle && _activeVehicle->
coordinate().isValid()) {
92 _gpsRef.setAltitude(0);
93 _gpsRefSource = GpsRefSource::Vehicle;
95 _gpsRef = QGeoCoordinate();
101void Viewer3DManager::_onEnabledChanged(
const QVariant &value)
103 if (!value.toBool()) {
#define QGC_LOGGING_CATEGORY(name, categoryStr)
void rawValueChanged(const QVariant &value)
static MultiVehicleManager * instance()
void activeVehicleChanged(Vehicle *activeVehicle)
static SettingsManager * instance()
void coordinateChanged(QGeoCoordinate coordinate)
QGeoCoordinate coordinate()
void displayModeChanged()
Q_INVOKABLE void setDisplayMode(DisplayMode mode)
void gpsRefChanged(QGeoCoordinate newGpsRef, bool isRefSet)