CorridorScanComplexItem.h 3.34 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 27 28 29
    /// @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 kmlFile Polyline comes from this file, empty for default polyline
    CorridorScanComplexItem(Vehicle* vehicle, bool flyView, const QString& kmlFile, QObject* parent);
30

31 32
    Q_PROPERTY(QGCMapPolyline*  corridorPolyline    READ corridorPolyline   CONSTANT)
    Q_PROPERTY(Fact*            corridorWidth       READ corridorWidth      CONSTANT)
33

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

    Q_INVOKABLE void rotateEntryPoint(void);

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

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

50
    // Overrides from VisualMissionionItem
51 52 53
    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"); }
54
    bool    readyForSave        (void) const;
55 56 57

    static const char* jsonComplexItemTypeValue;

58 59
    static const char* settingsGroup;
    static const char* corridorWidthName;
60 61

private slots:
62
    void _polylineDirtyChanged      (bool dirty);
63
    void _rebuildCorridorPolygon    (void);
64 65

    // Overrides from TransectStyleComplexItem
66 67
    void _rebuildTransectsPhase1    (void) final;
    void _rebuildTransectsPhase2    (void) final;
68 69

private:
70 71 72
    int _transectCount              (void) const;
    void _buildAndAppendMissionItems(QList<MissionItem*>& items, QObject* missionItemParent);
    void _appendLoadedMissionItems  (QList<MissionItem*>& items, QObject* missionItemParent);
73

74 75
    QGCMapPolyline                  _corridorPolyline;
    QList<QList<QGeoCoordinate>>    _transectSegments;      ///< Internal transect segments including grid exit, turnaround and internal camera points
76

DonLakeFlyer's avatar
DonLakeFlyer committed
77
    int                             _entryPoint;
78

79 80
    QMap<QString, FactMetaData*>    _metaDataMap;
    SettingsFact                    _corridorWidthFact;
81

82
    static const char* _jsonEntryPointKey;
83
};