CorridorScanComplexItem.h 3.06 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 41
    int     lastSequenceNumber  (void) const final;
    bool    load                (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) final;
    QString mapVisualQML        (void) const final { return QStringLiteral("CorridorScanMapVisual.qml"); }
42 43

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

49 50
    // Overrides from VisualMissionionItem
    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 59 60
    void _polylineDirtyChanged      (bool dirty);
    void _polylineCountChanged      (int count);
    void _rebuildCorridor           (void);
61 62

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

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

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

75 76
    bool            _ignoreRecalc;
    int             _entryPoint;
77

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

81
    static const char* _jsonEntryPointKey;
82
};