AirspaceRestriction.h 2.42 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/****************************************************************************
 *
 *   (c) 2017 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

#include <QObject>
#include <QGeoCoordinate>
Gus Grubba's avatar
Gus Grubba committed
14
#include <QVariantList>
15
#include <QColor>
16 17 18 19 20 21 22 23 24 25

/**
 * @class AirspaceRestriction
 * Base classe for an airspace restriction
 */

class AirspaceRestriction : public QObject
{
    Q_OBJECT
public:
Gus Grubba's avatar
Gus Grubba committed
26 27 28 29 30 31 32 33 34
    AirspaceRestriction(QString advisoryID, QColor color, QColor lineColor, float lineWidth, QObject* parent = nullptr);
    Q_PROPERTY(QString  advisoryID  READ advisoryID CONSTANT)
    Q_PROPERTY(QColor   color       READ color      CONSTANT)
    Q_PROPERTY(QColor   lineColor   READ lineColor  CONSTANT)
    Q_PROPERTY(float    lineWidth   READ lineWidth  CONSTANT)
    QString advisoryID  () { return _advisoryID; }
    QColor  color       () { return _color; }
    QColor  lineColor   () { return _lineColor; }
    float   lineWidth   () { return _lineWidth; }
35
protected:
Gus Grubba's avatar
Gus Grubba committed
36 37 38 39
    QString         _advisoryID;
    QColor          _color;
    QColor          _lineColor;
    float           _lineWidth;
40 41 42 43 44 45 46 47 48 49 50
};

/**
 * @class AirspacePolygonRestriction
 * Base classe for an airspace restriction defined by a polygon
 */

class AirspacePolygonRestriction : public AirspaceRestriction
{
    Q_OBJECT
public:
Gus Grubba's avatar
Gus Grubba committed
51
    AirspacePolygonRestriction(const QVariantList& polygon, QString advisoryID, QColor color, QColor lineColor, float lineWidth, QObject* parent = nullptr);
52 53
    Q_PROPERTY(QVariantList polygon READ polygon CONSTANT)
    QVariantList polygon() { return _polygon; }
54 55 56 57 58 59 60 61 62 63 64 65 66
private:
    QVariantList    _polygon;
};

/**
 * @class AirspaceRestriction
 * Base classe for an airspace restriction defined by a circle
 */

class AirspaceCircularRestriction : public AirspaceRestriction
{
    Q_OBJECT
public:
Gus Grubba's avatar
Gus Grubba committed
67
    AirspaceCircularRestriction(const QGeoCoordinate& center, double radius, QString advisoryID, QColor color, QColor lineColor, float lineWidth, QObject* parent = nullptr);
68 69 70 71
    Q_PROPERTY(QGeoCoordinate   center READ center CONSTANT)
    Q_PROPERTY(double           radius READ radius CONSTANT)
    QGeoCoordinate   center     () { return _center; }
    double           radius     () { return _radius; }
72 73 74 75 76
private:
    QGeoCoordinate  _center;
    double          _radius;
};