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
11class QGCMapCircle : public QObject
12{
13 Q_OBJECT
14 QML_ELEMENT
15
16public:
17 QGCMapCircle(QObject* parent = nullptr);
18 QGCMapCircle(const QGeoCoordinate& center, double radius, QObject* parent = nullptr);
19 QGCMapCircle(const QGeoCoordinate& center, double radius, bool showRotation, bool clockwiseRotation, QObject* parent = nullptr);
20 QGCMapCircle(const QGCMapCircle& other, QObject* parent = nullptr);
21
22 const QGCMapCircle& operator=(const QGCMapCircle& other);
23
24 Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged)
25 Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged)
26 Q_PROPERTY(Fact* radius READ radius CONSTANT)
27 Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged)
28 Q_PROPERTY(bool showRotation READ showRotation WRITE setShowRotation NOTIFY showRotationChanged)
30
31
33 void saveToJson(QJsonObject& json);
34
39 bool loadFromJson(const QJsonObject& json, QString& errorString);
40
41 // Property methods
42
43 bool dirty (void) const { return _dirty; }
44 QGeoCoordinate center (void) const { return _center; }
45 Fact* radius (void) { return &_radius; }
46 bool interactive (void) const { return _interactive; }
47 bool showRotation (void) const { return _showRotation; }
48 bool clockwiseRotation (void) const { return _clockwiseRotation; }
49
50 void setDirty (bool dirty);
51 void setCenter (QGeoCoordinate newCenter);
52 void setInteractive (bool interactive);
53 void setShowRotation (bool showRotation);
55
56 static constexpr const char* jsonCircleKey = "circle";
57
58signals:
59 void dirtyChanged (bool dirty);
60 void centerChanged (QGeoCoordinate center);
64
65private slots:
66 void _setDirty(void);
67
68private:
69 void _init(void);
70
71 bool _dirty;
72 QGeoCoordinate _center;
73 Fact _radius;
74 bool _interactive;
75 bool _showRotation;
76 bool _clockwiseRotation;
77
78 QMap<QString, FactMetaData*> _nameToMetaDataMap;
79
80 static constexpr const char* _jsonCenterKey = "center";
81 static constexpr const char* _jsonRadiusKey = "radius";
82 static constexpr const char* _radiusFactName = "Radius";
83};
QString errorString
A Fact is used to hold a single value within the system.
Definition Fact.h:17
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)
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 saveToJson(QJsonObject &json)
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