QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
StructureScanComplexItem.h
Go to the documentation of this file.
1#pragma once
2
4#include "MissionItem.h"
5#include "SettingsFact.h"
6#include "QGCMapPolygon.h"
7#include "CameraCalc.h"
8
9#include <QtCore/QLoggingCategory>
10
11Q_DECLARE_LOGGING_CATEGORY(StructureScanComplexItemLog)
12
14
16{
17 Q_OBJECT
18
19public:
22 StructureScanComplexItem(PlanMasterController* masterController, bool flyView, const QString& kmlOrSHPFile);
23
24 Q_PROPERTY(CameraCalc* cameraCalc READ cameraCalc CONSTANT)
25 Q_PROPERTY(Fact* entranceAlt READ entranceAlt CONSTANT)
28 Q_PROPERTY(Fact* layers READ layers CONSTANT)
29 Q_PROPERTY(Fact* gimbalPitch READ gimbalPitch CONSTANT)
30 Q_PROPERTY(Fact* startFromTop READ startFromTop CONSTANT)
31 Q_PROPERTY(double bottomFlightAlt READ bottomFlightAlt NOTIFY bottomFlightAltChanged)
32 Q_PROPERTY(double topFlightAlt READ topFlightAlt NOTIFY topFlightAltChanged)
33 Q_PROPERTY(int cameraShots READ cameraShots NOTIFY cameraShotsChanged)
34 Q_PROPERTY(double timeBetweenShots READ timeBetweenShots NOTIFY timeBetweenShotsChanged)
37
38 CameraCalc* cameraCalc (void) { return &_cameraCalc; }
39 Fact* entranceAlt (void) { return &_entranceAltFact; }
40 Fact* scanBottomAlt (void) { return &_scanBottomAltFact; }
41 Fact* structureHeight (void) { return &_structureHeightFact; }
42 Fact* layers (void) { return &_layersFact; }
43 Fact* gimbalPitch (void) { return &_gimbalPitchFact; }
44 Fact* startFromTop (void) { return &_startFromTopFact; }
45
46 double bottomFlightAlt (void) const;
47 double topFlightAlt (void) const;
48 int cameraShots (void) const;
49 double timeBetweenShots (void);
50 QGCMapPolygon* structurePolygon (void) { return &_structurePolygon; }
51 QGCMapPolygon* flightPolygon (void) { return &_flightPolygon; }
52
53 Q_INVOKABLE void rotateEntryPoint(void);
54
55 // Overrides from ComplexMissionItem
56 QString patternName (void) const final { return name; }
57 double complexDistance (void) const final { return _scanDistance; }
58 int lastSequenceNumber (void) const final;
59 bool load (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) final;
60 double greatestDistanceTo (const QGeoCoordinate &other) const final;
61 QString mapVisualQML (void) const final { return QStringLiteral("StructureScanMapVisual.qml"); }
62
63 // Overrides from VisualMissionItem
64 bool dirty (void) const final { return _dirty; }
65 bool isSimpleItem (void) const final { return false; }
66 bool isStandaloneCoordinate (void) const final { return false; }
67 bool specifiesCoordinate (void) const final { return true; }
68 bool specifiesAltitudeOnly (void) const final { return false; }
69 QString commandDescription (void) const final { return tr("Structure Scan"); }
70 QString commandName (void) const final { return tr("Structure Scan"); }
71 QString abbreviation (void) const final { return "S"; }
72 QGeoCoordinate coordinate (void) const final;
73 QGeoCoordinate entryCoordinate (void) const final { return coordinate(); }
74 QGeoCoordinate exitCoordinate (void) const final { return coordinate(); }
75 int sequenceNumber (void) const final { return _sequenceNumber; }
76 double specifiedFlightSpeed (void) final { return std::numeric_limits<double>::quiet_NaN(); }
77 double specifiedGimbalYaw (void) final { return std::numeric_limits<double>::quiet_NaN(); }
78 double specifiedGimbalPitch (void) final { return std::numeric_limits<double>::quiet_NaN(); }
79 void appendMissionItems (QList<MissionItem*>& items, QObject* missionItemParent) final;
81 void applyNewAltitude (double newAltitude) final;
82 double additionalTimeDelay (void) const final { return 0; }
83 ReadyForSaveState readyForSaveState (void) const final;
84 bool exitCoordinateSameAsEntry (void) const final { return true; }
85 void setDirty (bool dirty) final;
86 void setCoordinate (const QGeoCoordinate& coordinate) final;
87 void setSequenceNumber (int sequenceNumber) final;
88 void save (QJsonArray& missionItems) final;
89 double editableAlt (void) const final;
90 double amslEntryAlt (void) const final;
91 double amslExitAlt (void) const final { return amslEntryAlt(); };
92 double minAMSLAltitude (void) const final;
93 double maxAMSLAltitude (void) const final;
94
95 static const QString name;
96
97 static constexpr const char* settingsGroup = "StructureScan";
98 static constexpr const char* scanBottomAltName = "ScanBottomAlt";
99 static constexpr const char* structureHeightName = "StructureHeight";
100 static constexpr const char* layersName = "Layers";
101 static constexpr const char* gimbalPitchName = "GimbalPitch";
102 static constexpr const char* startFromTopName = "StartFromTop";
103
104 static constexpr const char* jsonComplexItemTypeValue = "StructureScan";
105
106signals:
112
113private slots:
114 void _segmentTerrainCollisionChanged (bool terrainCollision) final;
115 void _setDirty (void);
116 void _polygonDirtyChanged (bool dirty);
117 void _flightPathChanged (void);
118 void _clearInternal (void);
119 void _updateCoordinateAltitudes (void);
120 void _rebuildFlightPolygon (void);
121 void _recalcCameraShots (void);
122 void _recalcLayerInfo (void);
123 void _updateLastSequenceNumber (void);
124 void _updateGimbalPitch (void);
125 void _signalTopBottomAltChanged (void);
126 void _recalcScanDistance (void);
127 void _updateWizardMode (void);
128 void _updateFlightPathSegmentsDontCallDirectly (void);
129
130private:
131 void _setCameraShots (int cameraShots);
132 double _triggerDistance (void) const;
133
134 QMap<QString, FactMetaData*> _metaDataMap;
135
136 int _sequenceNumber;
137 QGCMapPolygon _structurePolygon;
138 QGCMapPolygon _flightPolygon;
139 int _entryVertex; // Polygon vertex which is used as the mission entry point
140 bool _ignoreRecalc;
141 double _scanDistance;
142 int _cameraShots;
143 double _timeBetweenShots;
144 double _vehicleSpeed;
145 CameraCalc _cameraCalc;
146
147
148 SettingsFact _scanBottomAltFact;
149 SettingsFact _structureHeightFact;
150 SettingsFact _layersFact;
151 SettingsFact _gimbalPitchFact;
152 SettingsFact _startFromTopFact;
153 SettingsFact _entranceAltFact;
154
155 static constexpr const char* _jsonCameraCalcKey = "CameraCalc";
156
157 static constexpr const char* _entranceAltName = "EntranceAltitude"; // This value cannot be overriden
158
159#ifdef QGC_UNITTEST_BUILD
160 friend class StructureScanComplexItemTest;
161#endif
162};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
QString errorString
virtual bool terrainCollision(void) const
A Fact is used to hold a single value within the system.
Definition Fact.h:19
Master controller for mission, fence, rally.
A SettingsFact is Fact which holds a QSettings value.
int lastSequenceNumber(void) const final
QString commandName(void) const final
void setCoordinate(const QGeoCoordinate &coordinate) final
void bottomFlightAltChanged(void)
bool isStandaloneCoordinate(void) const final
bool specifiesAltitudeOnly(void) const final
CameraCalc *cameraCalc READ cameraCalc CONSTANT(Fact *entranceAlt READ entranceAlt CONSTANT) 1(Fact *structureHeight READ structureHeight CONSTANT) 1(Fact *scanBottomAlt READ scanBottomAlt CONSTANT) 1(Fact *layers READ layers CONSTANT) 1(Fact *gimbalPitch READ gimbalPitch CONSTANT) 1(Fact *startFromTop READ startFromTop CONSTANT) 1(double bottomFlightAlt READ bottomFlightAlt NOTIFY bottomFlightAltChanged) 1(double topFlightAlt READ topFlightAlt NOTIFY topFlightAltChanged) 1(int cameraShots READ cameraShots NOTIFY cameraShotsChanged) 1(double timeBetweenShots READ timeBetweenShots NOTIFY timeBetweenShotsChanged) 1(QGCMapPolygon *structurePolygon READ structurePolygon CONSTANT) 1(QGCMapPolygon *flightPolygon READ flightPolygon CONSTANT) CameraCalc *cameraCalc(void)
double amslExitAlt(void) const final
bool specifiesCoordinate(void) const final
void applyNewAltitude(double newAltitude) final
Adjust the altitude of the item if appropriate to the new altitude.
QGCMapPolygon * structurePolygon(void)
bool load(const QJsonObject &complexObject, int sequenceNumber, QString &errorString) final
QGeoCoordinate coordinate(void) const final
void save(QJsonArray &missionItems) final
QGeoCoordinate exitCoordinate(void) const final
static constexpr const char * structureHeightName
QGCMapPolygon * flightPolygon(void)
void timeBetweenShotsChanged(void)
double specifiedGimbalPitch(void) final
void setMissionFlightStatus(MissionController::MissionFlightStatus_t &missionFlightStatus) final
void cameraShotsChanged(int cameraShots)
static constexpr const char * layersName
bool exitCoordinateSameAsEntry(void) const final
double additionalTimeDelay(void) const final
static constexpr const char * jsonComplexItemTypeValue
void topFlightAltChanged(void)
QString mapVisualQML(void) const final
void setSequenceNumber(int sequenceNumber) final
static constexpr const char * scanBottomAltName
ReadyForSaveState readyForSaveState(void) const final
double complexDistance(void) const final
double editableAlt(void) const final
static constexpr const char * gimbalPitchName
double minAMSLAltitude(void) const final
void _updateFlightPathSegmentsSignal(void)
double greatestDistanceTo(const QGeoCoordinate &other) const final
double amslEntryAlt(void) const final
double maxAMSLAltitude(void) const final
void appendMissionItems(QList< MissionItem * > &items, QObject *missionItemParent) final
QString commandDescription(void) const final
static constexpr const char * startFromTopName
QGeoCoordinate entryCoordinate(void) const final
QString patternName(void) const final
QString abbreviation(void) const final
static constexpr const char * settingsGroup
bool isSimpleItem(void) const final
double specifiedFlightSpeed(void) final
int sequenceNumber(void) const final
bool flyView(void) const
PlanMasterController * masterController(void)