CircularSurveyComplexItem.h 5.55 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
    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)
26
    Q_PROPERTY(Fact* reverse            READ reverse                                    CONSTANT)
27
    Q_PROPERTY(bool  isInitialized      READ isInitialized      WRITE setIsInitialized  NOTIFY isInitializedChanged)
28

29
    Q_INVOKABLE void resetReference(void);
30
    Q_INVOKABLE void setReferencePointBeingChanged(bool changeing); // used by gui to indicate a changeing reference point (dagging by user)
31

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

    // Property getters
38 39
    QGeoCoordinate  refPoint()      const;
    Fact            *deltaR();
40
    Fact            *deltaAlpha();    
41
    Fact            *transectMinLength();
42
    Fact            *isSnakePath();
43
    Fact            *reverse();
Valentin Platzgummer's avatar
Valentin Platzgummer committed
44
    // Is true if survey was automatically generated, prevents initialisation from gui.
45
    bool            isInitialized();
46
    bool            referencePointBeingChanged(); // returns true if the referencepoint is being changed (dragged by user)
47

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

66 67 68
    static const char* settingsGroup;    
    static const char* deltaRName;
    static const char* deltaAlphaName;
69
    static const char* transectMinLengthName;
70
    static const char* isSnakePathName;
71
    static const char* reverseName;
72

Valentin Platzgummer's avatar
Valentin Platzgummer committed
73 74 75
    static const char* jsonComplexItemTypeValue;
    static const char* jsonDeltaRKey;
    static const char* jsonDeltaAlphaKey;
76 77
    static const char* jsonTransectMinLengthKey;    
    static const char* jsonIsSnakePathKey;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
78 79 80 81
    static const char* jsonReferencePointLongKey;
    static const char* jsonReferencePointLatKey;
    static const char* jsonReferencePointAltKey;

82 83
signals:
    void refPointChanged();
84
    void isInitializedChanged();
85

86 87
private slots:
    // Overrides from TransectStyleComplexItem
88
    void _rebuildTransectsPhase1    (void) final; // do not call this function, it is called by TransectStyleComplexItem::_rebuildTransects()
89 90
    void _recalcComplexDistance     (void) final;
    void _recalcCameraShots         (void) final;
91
    void _reverseTransects          (void);
92 93

signals:
94

95

96
private:
Valentin Platzgummer's avatar
Valentin Platzgummer committed
97 98 99 100 101
    void _appendLoadedMissionItems(QList<MissionItem*>& items, QObject* missionItemParent);
    void _buildAndAppendMissionItems(QList<MissionItem*>& items, QObject* missionItemParent);



102
    QGeoCoordinate _referencePoint; // center of the circular lanes, e.g. base station
103 104 105

    QMap<QString, FactMetaData*> _metaDataMap;

106 107 108 109
    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
110
    SettingsFact            _reverse; // reverses the _transects path
111 112

    QTimer _updateTimer;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
113

114
    bool _isInitialized; // indicates if the polygon and refpoint etc. are initialized, prevents reinitialisation from gui and execution of _rebuildTransectsPhase1 during init from gui
115 116
    bool _reverseOnly; // if this is true _rebuildTransectsPhase1() will reverse the path only, _rebuildTransectsPhase1() resets _reverseOnly
    bool _referencePointBeingChanged; // is set to true by gui, if user is changeing the reference point
117 118 119 120

    int _updateCounter;


121 122 123 124
};