QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
RallyPointController.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QLoggingCategory>
4#include <QtPositioning/QGeoCoordinate>
5#include <QtQmlIntegration/QtQmlIntegration>
6
9
10Q_DECLARE_LOGGING_CATEGORY(RallyPointControllerLog)
11
12class GeoFenceManager;
14class Vehicle;
15
17{
18 Q_OBJECT
19 QML_ELEMENT
20 QML_UNCREATABLE("")
21public:
22 explicit RallyPointController(PlanMasterController* masterController, QObject* parent = nullptr);
24
26 Q_PROPERTY(QString editorQml READ editorQml CONSTANT)
28
29 Q_INVOKABLE void addPoint (QGeoCoordinate point);
30 Q_INVOKABLE void removePoint (QObject* rallyPoint);
31
32 void start (bool flyView) final;
33 bool supported (void) const final;
34 void save (QJsonObject& json) final;
35 bool load (const QJsonObject& json, QString& errorString) final;
36 void loadFromVehicle (void) final;
37 void sendToVehicle (void) final;
38 void removeAll (void) final;
39 void removeAllFromVehicle (void) final;
40 bool syncInProgress (void) const final;
41 bool dirty (void) const final { return _dirty; }
42 void setDirty (bool dirty) final;
43 bool containsItems (void) const final;
44 bool showPlanFromManagerVehicle (void) final;
45
46 QmlObjectListModel* points (void) { return &_points; }
47 QString editorQml (void) const;
48 QObject* currentRallyPoint (void) const { return _currentRallyPoint; }
49
50 void setCurrentRallyPoint (QObject* rallyPoint);
51 bool isEmpty (void) const;
52
53signals:
54 void currentRallyPointChanged(QObject* rallyPoint);
55 void loadComplete(void);
56
57private slots:
58 void _managerLoadComplete (void);
59 void _managerSendComplete (bool error);
60 void _managerRemoveAllComplete (bool error);
61 void _setFirstPointCurrent (void);
62 void _managerVehicleChanged (Vehicle* managerVehicle);
63
64private:
65 Vehicle* _managerVehicle = nullptr;
66 RallyPointManager* _rallyPointManager = nullptr;
67 bool _dirty = false;
68 QmlObjectListModel _points;
69 QObject* _currentRallyPoint = nullptr;
70 bool _itemsRequested = false;
71
72 static constexpr int _jsonCurrentVersion = 2;
73 static constexpr const char* _jsonFileTypeValue = "RallyPoints";
74 static constexpr const char* _jsonPointsKey = "points";
75};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
QString errorString
Error error
Master controller for mission, fence, rally.
bool containsItems(void) const final
void save(QJsonObject &json) final
QObject * currentRallyPoint(void) const
void loadComplete(void)
bool supported(void) const final
true: controller is waiting for the current load to complete
void setDirty(bool dirty) final
QString editorQml(void) const
bool showPlanFromManagerVehicle(void) final
bool syncInProgress(void) const final
void setCurrentRallyPoint(QObject *rallyPoint)
QmlObjectListModel *points READ points CONSTANT(QString editorQml READ editorQml CONSTANT) 1(QObject *currentRallyPoint READ currentRallyPoint WRITE setCurrentRallyPoint NOTIFY currentRallyPointChanged) 1 void addPoint(QGeoCoordinate point)
bool dirty(void) const final
void start(bool flyView) final
Should be called immediately upon Component.onCompleted.
void removeAllFromVehicle(void) final
bool load(const QJsonObject &json, QString &errorString) final
void removePoint(QObject *rallyPoint)
void removeAll(void) final
Removes all from controller only.
void currentRallyPointChanged(QObject *rallyPoint)
void loadFromVehicle(void) final
QmlObjectListModel * points(void)