QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
TransformPositionController.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QMap>
4#include <QtCore/QObject>
5#include <QtCore/QString>
6#include <QtPositioning/QGeoCoordinate>
7#include <QtQmlIntegration/QtQmlIntegration>
8
9class Fact;
10class FactMetaData;
11
12class TransformPositionController : public QObject
13{
14 Q_OBJECT
15 QML_ELEMENT
16 Q_MOC_INCLUDE("Fact.h")
17 Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
18 Q_PROPERTY(Fact *latitude READ latitude CONSTANT)
19 Q_PROPERTY(Fact *longitude READ longitude CONSTANT)
20 Q_PROPERTY(Fact *latitudeDMS READ latitudeDMS CONSTANT)
21 Q_PROPERTY(Fact *longitudeDMS READ longitudeDMS CONSTANT)
22 Q_PROPERTY(Fact *zone READ zone CONSTANT)
23 Q_PROPERTY(Fact *hemisphere READ hemisphere CONSTANT)
24 Q_PROPERTY(Fact *easting READ easting CONSTANT)
25 Q_PROPERTY(Fact *northing READ northing CONSTANT)
26 Q_PROPERTY(Fact *mgrs READ mgrs CONSTANT)
27 Q_PROPERTY(Fact *offsetEast READ offsetEast CONSTANT)
28 Q_PROPERTY(Fact *offsetNorth READ offsetNorth CONSTANT)
29 Q_PROPERTY(Fact *offsetUp READ offsetUp CONSTANT)
30 Q_PROPERTY(Fact *rotateDegreesCW READ rotateDegreesCW CONSTANT)
31 Q_PROPERTY(int defaultCoordinateSystem READ defaultCoordinateSystem CONSTANT)
32
33public:
34 explicit TransformPositionController(QObject *parent = nullptr);
36
37 Q_INVOKABLE void initValues();
38 Q_INVOKABLE void setFromGeo();
39 Q_INVOKABLE bool setFromDMS();
40 Q_INVOKABLE bool setFromUTM();
41 Q_INVOKABLE bool setFromMGRS();
42 Q_INVOKABLE void setFromVehicle();
43
44 void setCoordinate(QGeoCoordinate coordinate);
45 QGeoCoordinate coordinate() const { return _coordinate; }
46
47 Fact *latitude() { return _latitudeFact; }
48 Fact *longitude() { return _longitudeFact; }
49 Fact *latitudeDMS() { return _latitudeDMSFact; }
50 Fact *longitudeDMS() { return _longitudeDMSFact; }
51 Fact *zone() { return _zoneFact; }
52 Fact *hemisphere() { return _hemisphereFact; }
53 Fact *easting() { return _eastingFact; }
54 Fact *northing() { return _northingFact; }
55 Fact *mgrs() { return _mgrsFact; }
56 Fact *offsetEast() { return _offsetEastFact; }
57 Fact *offsetNorth() { return _offsetNorthFact; }
58 Fact *offsetUp() { return _offsetUpFact; }
59 Fact *rotateDegreesCW() { return _rotateDegreesCWFact; }
60
62 static int defaultCoordinateSystem();
63
64signals:
65 void coordinateChanged(QGeoCoordinate coordinate);
66
67private:
68 QGeoCoordinate _coordinate;
69
70 Fact *_latitudeFact = nullptr;
71 Fact *_longitudeFact = nullptr;
72 Fact *_latitudeDMSFact = nullptr;
73 Fact *_longitudeDMSFact = nullptr;
74 Fact *_zoneFact = nullptr;
75 Fact *_hemisphereFact = nullptr;
76 Fact *_eastingFact = nullptr;
77 Fact *_northingFact = nullptr;
78 Fact *_mgrsFact = nullptr;
79 Fact *_offsetEastFact = nullptr;
80 Fact *_offsetNorthFact = nullptr;
81 Fact *_offsetUpFact = nullptr;
82 Fact *_rotateDegreesCWFact = nullptr;
83
84 static QMap<QString, FactMetaData*> _metaDataMap;
85
86 static constexpr const char *_latitudeFactName = "Latitude";
87 static constexpr const char *_longitudeFactName = "Longitude";
88 static constexpr const char *_latitudeDMSFactName = "LatitudeDMS";
89 static constexpr const char *_longitudeDMSFactName = "LongitudeDMS";
90 static constexpr const char *_zoneFactName = "Zone";
91 static constexpr const char *_hemisphereFactName = "Hemisphere";
92 static constexpr const char *_eastingFactName = "Easting";
93 static constexpr const char *_northingFactName = "Northing";
94 static constexpr const char *_mgrsFactName = "MGRS";
95 static constexpr const char *_offsetEastFactName = "OffsetEast";
96 static constexpr const char *_offsetNorthFactName = "OffsetNorth";
97 static constexpr const char *_offsetUpFactName = "OffsetUp";
98 static constexpr const char *_rotateDegreesCWFactName = "RotateDegreesCW";
99};
Holds the meta data associated with a Fact.
A Fact is used to hold a single value within the system.
Definition Fact.h:15
void coordinateChanged(QGeoCoordinate coordinate)
TransformPositionController(QObject *parent=nullptr)
static int defaultCoordinateSystem()
UnitsSettings::coordinateFormat, which matches the coordinate system combo index in the position dial...
void setCoordinate(QGeoCoordinate coordinate)