QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
EditPositionDialogController.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QObject>
4#include <QtCore/QLoggingCategory>
5#include <QtPositioning/QGeoCoordinate>
6#include <QtQmlIntegration/QtQmlIntegration>
7
8#include "Fact.h"
9
10Q_DECLARE_LOGGING_CATEGORY(EditPositionDialogControllerLog)
11
12class EditPositionDialogController : public QObject
13{
14 Q_OBJECT
15 QML_ELEMENT
16 Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged REQUIRED)
17 Q_PROPERTY(Fact *latitude READ latitude CONSTANT)
18 Q_PROPERTY(Fact *longitude READ longitude CONSTANT)
19 Q_PROPERTY(Fact *zone READ zone CONSTANT)
20 Q_PROPERTY(Fact *hemisphere READ hemisphere CONSTANT)
21 Q_PROPERTY(Fact *easting READ easting CONSTANT)
22 Q_PROPERTY(Fact *northing READ northing CONSTANT)
23 Q_PROPERTY(Fact *mgrs READ mgrs CONSTANT)
24
25public:
26 explicit EditPositionDialogController(QObject *parent = nullptr);
28
29 Q_INVOKABLE void initValues();
30 Q_INVOKABLE void setFromGeo();
31 Q_INVOKABLE void setFromUTM();
32 Q_INVOKABLE void setFromMGRS();
33 Q_INVOKABLE void setFromVehicle();
34
35 void setCoordinate(QGeoCoordinate coordinate);
36 QGeoCoordinate coordinate() const { return _coordinate; }
37
38 Fact *latitude() { return _latitudeFact; }
39 Fact *longitude() { return _longitudeFact; }
40 Fact *zone() { return _zoneFact; }
41 Fact *hemisphere() { return _hemisphereFact; }
42 Fact *easting() { return _eastingFact; }
43 Fact *northing() { return _northingFact; }
44 Fact *mgrs() { return _mgrsFact; }
45
46signals:
47 void coordinateChanged(QGeoCoordinate coordinate);
48
49private:
50 QGeoCoordinate _coordinate;
51
52 Fact *_latitudeFact = nullptr;
53 Fact *_longitudeFact = nullptr;
54 Fact *_zoneFact = nullptr;
55 Fact *_hemisphereFact = nullptr;
56 Fact *_eastingFact = nullptr;
57 Fact *_northingFact = nullptr;
58 Fact *_mgrsFact = nullptr;
59
60 static QMap<QString, FactMetaData*> _metaDataMap;
61
62 static constexpr const char *_latitudeFactName = "Latitude";
63 static constexpr const char *_longitudeFactName = "Longitude";
64 static constexpr const char *_zoneFactName = "Zone";
65 static constexpr const char *_hemisphereFactName = "Hemisphere";
66 static constexpr const char *_eastingFactName = "Easting";
67 static constexpr const char *_northingFactName = "Northing";
68 static constexpr const char *_mgrsFactName = "MGRS";
69};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
void coordinateChanged(QGeoCoordinate coordinate)
A Fact is used to hold a single value within the system.
Definition Fact.h:19