CorridorScanComplexItem.h 2.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#pragma once

12
#include "TransectStyleComplexItem.h"
13 14 15 16 17 18 19 20 21
#include "MissionItem.h"
#include "SettingsFact.h"
#include "QGCLoggingCategory.h"
#include "QGCMapPolyline.h"
#include "QGCMapPolygon.h"
#include "CameraCalc.h"

Q_DECLARE_LOGGING_CATEGORY(CorridorScanComplexItemLog)

22
class CorridorScanComplexItem : public TransectStyleComplexItem
23 24 25 26 27 28
{
    Q_OBJECT

public:
    CorridorScanComplexItem(Vehicle* vehicle, QObject* parent = NULL);

29 30 31
    Q_PROPERTY(CameraCalc*      cameraCalc          READ cameraCalc         CONSTANT)
    Q_PROPERTY(QGCMapPolyline*  corridorPolyline    READ corridorPolyline   CONSTANT)
    Q_PROPERTY(Fact*            corridorWidth       READ corridorWidth      CONSTANT)
32

33 34
    Fact*           corridorWidth   (void) { return &_corridorWidthFact; }
    QGCMapPolyline* corridorPolyline(void) { return &_corridorPolyline; }
35 36 37 38

    Q_INVOKABLE void rotateEntryPoint(void);

    // Overrides from ComplexMissionItem
39 40
    bool    load                (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) final;
    QString mapVisualQML        (void) const final { return QStringLiteral("CorridorScanMapVisual.qml"); }
41 42

    // Overrides from TransectStyleComplexItem
43 44 45 46
    void    save                (QJsonArray&  planItems) final;
    bool    specifiesCoordinate (void) const final;
    void    appendMissionItems  (QList<MissionItem*>& items, QObject* missionItemParent) final;
    void    applyNewAltitude    (double newAltitude) final;
47

48 49
    // Overrides from VisualMissionionItem
    bool    readyForSave        (void) const;
50 51 52

    static const char* jsonComplexItemTypeValue;

53 54
    static const char* settingsGroup;
    static const char* corridorWidthName;
55 56

private slots:
57
    void _polylineDirtyChanged      (bool dirty);
58
    void _rebuildCorridorPolygon    (void);
59 60

    // Overrides from TransectStyleComplexItem
61 62
    void _rebuildTransectsPhase1    (void) final;
    void _rebuildTransectsPhase2    (void) final;
63 64

private:
65 66 67
    int _transectCount              (void) const;
    void _buildAndAppendMissionItems(QList<MissionItem*>& items, QObject* missionItemParent);
    void _appendLoadedMissionItems  (QList<MissionItem*>& items, QObject* missionItemParent);
68

69 70
    QGCMapPolyline                  _corridorPolyline;
    QList<QList<QGeoCoordinate>>    _transectSegments;      ///< Internal transect segments including grid exit, turnaround and internal camera points
71

DonLakeFlyer's avatar
DonLakeFlyer committed
72
    int                             _entryPoint;
73

74 75
    QMap<QString, FactMetaData*>    _metaDataMap;
    SettingsFact                    _corridorWidthFact;
76

77
    static const char* _jsonEntryPointKey;
78
};