TransectStyleComplexItemTest.h 3.79 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 "TransectStyleComplexItemTestBase.h"
13 14
#include "MultiSignalSpy.h"
#include "CorridorScanComplexItem.h"
15
#include "PlanMasterController.h"
16 17 18 19 20

#include <QGeoCoordinate>

class TransectStyleItem;

21
class TransectStyleComplexItemTest : public TransectStyleComplexItemTestBase
22 23 24 25 26 27 28 29 30
{
    Q_OBJECT
    
public:
    TransectStyleComplexItemTest(void);

protected:
    void init(void) final;
    void cleanup(void) final;
31

32
private slots:
33 34 35 36
    void _testDirty             (void);
    void _testRebuildTransects  (void);
    void _testDistanceSignalling(void);
    void _testAltMode           (void);
37 38

private:
39 40
    void _setSurveyAreaPolygon  (void);
    void _adjustSurveAreaPolygon(void);
41 42 43 44 45

    enum {
        // These signals are from TransectStyleComplexItem
        cameraShotsChangedIndex = 0,
        timeBetweenShotsChangedIndex,
DonLakeFlyer's avatar
DonLakeFlyer committed
46
        visualTransectPointsChangedIndex,
47 48 49 50 51 52
        coveredAreaChangedIndex,
        // These signals are from ComplexItem
        dirtyChangedIndex,
        complexDistanceChangedIndex,
        greatestDistanceToChangedIndex,
        additionalTimeDelayChangedIndex,
53 54
        // These signals are from VisualMissionItem
        lastSequenceNumberChangedIndex,
55 56 57 58 59
        maxSignalIndex
    };

    enum {
        // These signals are from TransectStyleComplexItem
DonLakeFlyer's avatar
DonLakeFlyer committed
60 61 62 63
        cameraShotsChangedMask =                1 << cameraShotsChangedIndex,
        timeBetweenShotsChangedMask =           1 << timeBetweenShotsChangedIndex,
        visualTransectPointsChangedMask =       1 << visualTransectPointsChangedIndex,
        coveredAreaChangedMask =                1 << coveredAreaChangedIndex,
64
        // These signals are from ComplexItem
DonLakeFlyer's avatar
DonLakeFlyer committed
65 66 67 68
        dirtyChangedMask =                      1 << dirtyChangedIndex,
        complexDistanceChangedMask =            1 << complexDistanceChangedIndex,
        greatestDistanceToChangedMask =         1 << greatestDistanceToChangedIndex,
        additionalTimeDelayChangedMask =        1 << additionalTimeDelayChangedIndex,
69
        // These signals are from VisualMissionItem
DonLakeFlyer's avatar
DonLakeFlyer committed
70
        lastSequenceNumberChangedMask =         1 << lastSequenceNumberChangedIndex,
71 72 73 74 75
    };

    static const size_t _cSignals = maxSignalIndex;
    const char*         _rgSignals[_cSignals];

76
    MultiSignalSpy*         _multiSpy =             nullptr;
77
    QList<QGeoCoordinate>   _polygonVertices;
78
    TransectStyleItem*      _transectStyleItem =    nullptr;
79 80 81 82 83 84 85
};

class TransectStyleItem : public TransectStyleComplexItem
{
    Q_OBJECT

public:
86
    TransectStyleItem(PlanMasterController* masterController, QObject* parent = nullptr);
87 88

    // Overrides from ComplexMissionItem
89
    QString patternName         (void) const final { return QString(); }
90 91 92 93 94 95
    QString mapVisualQML        (void) const final { return QString(); }
    bool    load                (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) final { Q_UNUSED(complexObject); Q_UNUSED(sequenceNumber); Q_UNUSED(errorString); return false; }

    // Overrides from VisualMissionItem
    void    save                (QJsonArray&  missionItems) final { Q_UNUSED(missionItems); }
    bool    specifiesCoordinate (void) const final { return true; }
96
    double  additionalTimeDelay (void) const final { return 0; }
97

98
    bool rebuildTransectsPhase1Called;
99 100
    bool recalcComplexDistanceCalled;
    bool recalcCameraShotsCalled;
101

102 103
private slots:
    // Overrides from TransectStyleComplexItem
104 105
    void _rebuildTransectsPhase1    (void) final;
    void _recalcCameraShots         (void) final;
106
};