CorridorScanComplexItem.h 3.58 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8 9 10 11
 *
 * 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
DonLakeFlyer's avatar
DonLakeFlyer committed
51 52 53 54 55
    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"); }
    ReadyForSaveState   readyForSaveState   (void) const final;
    double              additionalTimeDelay (void) const final { return 0; }
56 57 58

    static const char* jsonComplexItemTypeValue;

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

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

    // Overrides from TransectStyleComplexItem
67
    void _rebuildTransectsPhase1    (void) final;
68 69
    void _recalcComplexDistance     (void) final;
    void _recalcCameraShots         (void) final;
70 71

private:
72 73 74 75
    double  _transectSpacing            (void) const;
    int     _transectCount              (void) const;
    void    _buildAndAppendMissionItems (QList<MissionItem*>& items, QObject* missionItemParent);
    void    _appendLoadedMissionItems   (QList<MissionItem*>& items, QObject* missionItemParent);
76

77 78
    QGCMapPolyline                  _corridorPolyline;
    QList<QList<QGeoCoordinate>>    _transectSegments;      ///< Internal transect segments including grid exit, turnaround and internal camera points
79

DonLakeFlyer's avatar
DonLakeFlyer committed
80
    int                             _entryPoint;
81

82 83
    QMap<QString, FactMetaData*>    _metaDataMap;
    SettingsFact                    _corridorWidthFact;
84

85
    static const char* _jsonEntryPointKey;
86
};