QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCMapCircle.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QObject>
4#include <QtPositioning/QGeoCoordinate>
5#include <QtQmlIntegration/QtQmlIntegration>
6
7#include "Fact.h"
8
10class QGCMapCircle : public QObject
11{
12 Q_OBJECT
13 QML_ELEMENT
14
15public:
16 QGCMapCircle(QObject* parent = nullptr);
17 QGCMapCircle(const QGeoCoordinate& center, double radius, QObject* parent = nullptr);
18 QGCMapCircle(const QGeoCoordinate& center, double radius, bool showRotation, bool clockwiseRotation, QObject* parent = nullptr);
19 QGCMapCircle(const QGCMapCircle& other, QObject* parent = nullptr);
20
21 const QGCMapCircle& operator=(const QGCMapCircle& other);
22
23 Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged)
24 Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged)
25 Q_PROPERTY(Fact* radius READ radius CONSTANT)
26 Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged)
27 Q_PROPERTY(bool showRotation READ showRotation WRITE setShowRotation NOTIFY showRotationChanged)
29
30
32 void saveToJson(QJsonObject& json);
33
38 bool loadFromJson(const QJsonObject& json, QString& errorString);
39
40 // Property methods
41
42 bool dirty (void) const { return _dirty; }
43 QGeoCoordinate center (void) const { return _center; }
44 Fact* radius (void) { return &_radius; }
45 bool interactive (void) const { return _interactive; }
46 bool showRotation (void) const { return _showRotation; }
47 bool clockwiseRotation (void) const { return _clockwiseRotation; }
48
49 void setDirty (bool dirty);
50 void setCenter (QGeoCoordinate newCenter);
51 void setInteractive (bool interactive);
52 void setShowRotation (bool showRotation);
54
55 static constexpr const char* jsonCircleKey = "circle";
56
57signals:
58 void dirtyChanged (bool dirty);
59 void centerChanged (QGeoCoordinate center);
63
64private slots:
65 void _setDirty(void);
66
67private:
68 void _init(void);
69
70 bool _dirty;
71 QGeoCoordinate _center;
72 Fact _radius;
73 bool _interactive;
74 bool _showRotation;
75 bool _clockwiseRotation;
76
77 QMap<QString, FactMetaData*> _nameToMetaDataMap;
78
79 static constexpr const char* _jsonCenterKey = "center";
80 static constexpr const char* _jsonRadiusKey = "radius";
81 static constexpr const char* _radiusFactName = "Radius";
82};
QString errorString
A Fact is used to hold a single value within the system.
Definition Fact.h:19
The QGCMapCircle represents a circular area which can be displayed on a Map control.
void dirtyChanged(bool dirty)
QGCMapCircle(const QGeoCoordinate &center, double radius, QObject *parent=nullptr)
void setInteractive(bool interactive)
bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged) 1(Fact *radius READ radius CONSTANT) 1(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged) 1(bool showRotation READ showRotation WRITE setShowRotation NOTIFY showRotationChanged) 1(bool clockwiseRotation READ clockwiseRotation WRITE setClockwiseRotation NOTIFY clockwiseRotationChanged) void saveToJson(QJsonObject &json)
void interactiveChanged(bool interactive)
bool clockwiseRotation(void) const
void setClockwiseRotation(bool clockwiseRotation)
static constexpr const char * jsonCircleKey
void clockwiseRotationChanged(bool clockwiseRotation)
bool interactive(void) const
void setShowRotation(bool showRotation)
void centerChanged(QGeoCoordinate center)
bool showRotation(void) const
void showRotationChanged(bool showRotation)
void setDirty(bool dirty)
Fact * radius(void)
void setCenter(QGeoCoordinate newCenter)
const QGCMapCircle & operator=(const QGCMapCircle &other)
QGeoCoordinate center(void) const
bool loadFromJson(const QJsonObject &json, QString &errorString)
bool dirty(void) const