CircularSurveyComplexItem.h 3.87 KB
Newer Older
1 2 3 4
# pragma once

#include "TransectStyleComplexItem.h"

5 6 7 8 9
#include "PolygonCalculus.h"
#include "PlanimetryCalculus.h"
#include "GeoUtilities.h"
#include "QVector"
#include "Circle.h"
10
#include "SettingsFact.h"
11

12 13 14 15 16 17 18 19 20
class CircularSurveyComplexItem :public TransectStyleComplexItem
{
    Q_OBJECT
public:
    /// @param vehicle Vehicle which this is being contructed for
    /// @param flyView true: Created for use in the Fly View, false: Created for use in the Plan View
    /// @param kmlOrShpFile Polygon comes from this file, empty for default polygon
    CircularSurveyComplexItem(Vehicle* vehicle, bool flyView, const QString& kmlOrShpFile, QObject* parent);

21
    Q_PROPERTY(QGeoCoordinate refPoint READ refPoint WRITE setRefPoint NOTIFY refPointChanged)
22 23
    Q_PROPERTY(Fact* deltaR READ deltaR CONSTANT)
    Q_PROPERTY(Fact* deltaAlpha READ deltaAlpha CONSTANT)
24
    Q_PROPERTY(Fact* transectMinLength READ transectMinLength CONSTANT)
Valentin Platzgummer's avatar
Valentin Platzgummer committed
25
    Q_PROPERTY(bool autoGenerated READ autoGenerated NOTIFY autoGeneratedChanged)
26 27 28

    // Property setters
    void setRefPoint(const QGeoCoordinate &refPt);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
29 30
    // Set this to true if survey was automatically generated, prevents initialisation from gui.
    void setAutoGenerated(bool autoGen);
31 32

    // Property getters
33 34 35
    QGeoCoordinate  refPoint()      const;
    Fact            *deltaR();
    Fact            *deltaAlpha();
36
    Fact            *transectMinLength();
Valentin Platzgummer's avatar
Valentin Platzgummer committed
37 38
    // Is true if survey was automatically generated, prevents initialisation from gui.
    bool            autoGenerated();
39

40 41 42 43 44 45 46 47 48 49 50 51
    // Overrides from ComplexMissionItem
    bool    load                (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) final;
    QString mapVisualQML        (void) const final { return QStringLiteral("SpericalSurveyMapVisual.qml"); }

    // Overrides from TransectStyleComplexItem
    void    save                (QJsonArray&  planItems) final;
    bool    specifiesCoordinate (void) const final { return true; }
    void    appendMissionItems  (QList<MissionItem*>& items, QObject* missionItemParent) final;
    void    applyNewAltitude    (double newAltitude) final;
    double  timeBetweenShots    (void) final;

    // Overrides from VisualMissionionItem
52 53 54
    QString commandDescription  (void) const final { return tr("Circular Survey"); }
    QString commandName         (void) const final { return tr("Circular Survey"); }
    QString abbreviation        (void) const final { return tr("C.S."); }
55 56 57
    bool    readyForSave        (void) const final;
    double  additionalTimeDelay (void) const final;

58 59 60
    static const char* settingsGroup;    
    static const char* deltaRName;
    static const char* deltaAlphaName;
61
    static const char* transectMinLengthName;
62

Valentin Platzgummer's avatar
Valentin Platzgummer committed
63 64 65
    static const char* jsonComplexItemTypeValue;
    static const char* jsonDeltaRKey;
    static const char* jsonDeltaAlphaKey;
66
    static const char* jsonTransectMinLengthKey;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
67 68 69 70
    static const char* jsonReferencePointLongKey;
    static const char* jsonReferencePointLatKey;
    static const char* jsonReferencePointAltKey;

71 72
signals:
    void refPointChanged();
Valentin Platzgummer's avatar
Valentin Platzgummer committed
73
    void autoGeneratedChanged();
74

75 76 77 78 79
private slots:
    // Overrides from TransectStyleComplexItem
    void _rebuildTransectsPhase1    (void) final;
    void _recalcComplexDistance     (void) final;
    void _recalcCameraShots         (void) final;
80 81

signals:
82

83
private:
Valentin Platzgummer's avatar
Valentin Platzgummer committed
84 85 86 87 88
    void _appendLoadedMissionItems(QList<MissionItem*>& items, QObject* missionItemParent);
    void _buildAndAppendMissionItems(QList<MissionItem*>& items, QObject* missionItemParent);



89
    QGeoCoordinate _referencePoint; // center of the circular lanes, e.g. base station
90 91 92 93 94

    QMap<QString, FactMetaData*> _metaDataMap;

    SettingsFact            _deltaR;
    SettingsFact            _deltaAlpha;
95
    SettingsFact            _transectMinLength;
96 97

    QTimer _updateTimer;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
98 99

    bool _autoGenerated; // set to true if survey was automatically generated, prevents initialisation from gui
100 101 102 103
};