CircularSurveyComplexItem.h 4.56 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 22 23 24 25 26
    Q_PROPERTY(QGeoCoordinate refPoint  READ refPoint           WRITE setRefPoint   NOTIFY refPointChanged)
    Q_PROPERTY(Fact* deltaR             READ deltaR                                 CONSTANT)
    Q_PROPERTY(Fact* deltaAlpha         READ deltaAlpha                             CONSTANT)
    Q_PROPERTY(Fact* transectMinLength  READ transectMinLength                      CONSTANT)
    Q_PROPERTY(Fact* isSnakePath        READ isSnakePath                            CONSTANT)
    Q_PROPERTY(bool autoGenerated       READ autoGenerated                          NOTIFY autoGeneratedChanged)
27

28 29
    Q_INVOKABLE void resetReference(void);

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

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

44 45 46 47 48 49 50 51 52 53 54 55
    // 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
56 57 58
    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."); }
59 60 61
    bool    readyForSave        (void) const final;
    double  additionalTimeDelay (void) const final;

62 63 64
    static const char* settingsGroup;    
    static const char* deltaRName;
    static const char* deltaAlphaName;
65
    static const char* transectMinLengthName;
66
    static const char* isSnakePathName;
67

Valentin Platzgummer's avatar
Valentin Platzgummer committed
68 69 70
    static const char* jsonComplexItemTypeValue;
    static const char* jsonDeltaRKey;
    static const char* jsonDeltaAlphaKey;
71 72
    static const char* jsonTransectMinLengthKey;    
    static const char* jsonIsSnakePathKey;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
73 74 75 76
    static const char* jsonReferencePointLongKey;
    static const char* jsonReferencePointLatKey;
    static const char* jsonReferencePointAltKey;

77 78
signals:
    void refPointChanged();
Valentin Platzgummer's avatar
Valentin Platzgummer committed
79
    void autoGeneratedChanged();
80

81 82 83 84 85
private slots:
    // Overrides from TransectStyleComplexItem
    void _rebuildTransectsPhase1    (void) final;
    void _recalcComplexDistance     (void) final;
    void _recalcCameraShots         (void) final;
86 87

signals:
88

89
private:
Valentin Platzgummer's avatar
Valentin Platzgummer committed
90 91 92 93 94
    void _appendLoadedMissionItems(QList<MissionItem*>& items, QObject* missionItemParent);
    void _buildAndAppendMissionItems(QList<MissionItem*>& items, QObject* missionItemParent);



95
    QGeoCoordinate _referencePoint; // center of the circular lanes, e.g. base station
96 97 98

    QMap<QString, FactMetaData*> _metaDataMap;

99 100 101 102
    SettingsFact            _deltaR; // distance between two neighbour circles
    SettingsFact            _deltaAlpha; // angle discretisation of the circles
    SettingsFact            _transectMinLength; // minimal transect lenght, transects are rejected if they are shorter than this value
    SettingsFact            _isSnakePath; // bool value, determining if transects are connected in a snake like or zig zag like manner
103 104

    QTimer _updateTimer;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
105 106

    bool _autoGenerated; // set to true if survey was automatically generated, prevents initialisation from gui
107 108 109 110
};