ComplexMissionItem.h 2.74 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (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.
 *
 ****************************************************************************/
9

10 11 12
#ifndef ComplexMissionItem_H
#define ComplexMissionItem_H

13
#include "VisualMissionItem.h"
14

15
class ComplexMissionItem : public VisualMissionItem
16 17
{
    Q_OBJECT
18

19 20 21
public:
    ComplexMissionItem(Vehicle* vehicle, QObject* parent = NULL);

22 23
    const ComplexMissionItem& operator=(const ComplexMissionItem& other);

24
    Q_PROPERTY(QString  mapVisualQML        READ mapVisualQML       CONSTANT)
25 26
    Q_PROPERTY(int      lastSequenceNumber  READ lastSequenceNumber NOTIFY lastSequenceNumberChanged)
    Q_PROPERTY(double   complexDistance     READ complexDistance    NOTIFY complexDistanceChanged)
27

28 29
    /// @return The distance covered the complex mission item in meters.
    virtual double complexDistance(void) const = 0;
30

31
    /// @return The last sequence number used by this item. Takes into account child items of the complex item
32
    virtual int lastSequenceNumber(void) const = 0;
33

34 35
    /// Returns the mission items associated with the complex item. Caller is responsible for freeing. Calling
    /// delete on returned QmlObjectListModel will free all memory including internal items.
36
    virtual QmlObjectListModel* getMissionItems(void) const = 0;
37

38 39
    /// Load the complex mission item from Json
    ///     @param complexObject Complex mission item json object
Don Gagne's avatar
Don Gagne committed
40
    ///     @param sequenceNumber Sequence number for first MISSION_ITEM in survey
41 42
    ///     @param[out] errorString Error if load fails
    /// @return true: load success, false: load failed, errorString set
Don Gagne's avatar
Don Gagne committed
43
    virtual bool load(const QJsonObject& complexObject, int sequenceNumber, QString& errorString) = 0;
44

45 46 47
    /// Get the point of complex mission item furthest away from a coordinate
    ///     @param other QGeoCoordinate to which distance is calculated
    /// @return the greatest distance from any point of the complex item to some coordinate
48
    virtual double greatestDistanceTo(const QGeoCoordinate &other) const = 0;
49

50 51 52
    /// Informs the complex item of the cruise speed it will fly at
    virtual void setCruiseSpeed(double cruiseSpeed) = 0;

Don Gagne's avatar
Don Gagne committed
53 54 55
    /// This mission item attribute specifies the type of the complex item.
    static const char* jsonComplexItemTypeKey;

56 57 58
    /// @return The QML resource file which contains the control which visualizes the item on the map.
    virtual QString mapVisualQML(void) const = 0;

59
signals:
60 61
    void lastSequenceNumberChanged  (int lastSequenceNumber);
    void complexDistanceChanged     (double complexDistance);
62 63 64
};

#endif