CorridorScanComplexItem.h 3.03 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
#include "MissionItem.h"
#include "SettingsFact.h"
#include "QGCLoggingCategory.h"
#include "QGCMapPolyline.h"
#include "QGCMapPolygon.h"

Q_DECLARE_LOGGING_CATEGORY(CorridorScanComplexItemLog)

21
class CorridorScanComplexItem : public TransectStyleComplexItem
22 23 24 25
{
    Q_OBJECT

public:
26
    CorridorScanComplexItem(Vehicle* vehicle, bool flyView, QObject* parent);
27

28 29
    Q_PROPERTY(QGCMapPolyline*  corridorPolyline    READ corridorPolyline   CONSTANT)
    Q_PROPERTY(Fact*            corridorWidth       READ corridorWidth      CONSTANT)
30

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

    Q_INVOKABLE void rotateEntryPoint(void);

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

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

46
    // Overrides from VisualMissionionItem
47 48 49
    QString commandDescription  (void) const final { return tr("Corridor Scan"); }
    QString commandName         (void) const final { return tr("Corridor Scan"); }
    QString abbreviation        (void) const final { return tr("C"); }
50
    bool    readyForSave        (void) const;
51 52 53

    static const char* jsonComplexItemTypeValue;

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

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

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

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

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

DonLakeFlyer's avatar
DonLakeFlyer committed
73
    int                             _entryPoint;
74

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

78
    static const char* _jsonEntryPointKey;
79
};