MAV2DIcon.h 2.31 KB
Newer Older
1 2 3
#ifndef MAV2DICON_H
#define MAV2DICON_H

4
#include <QGraphicsItem>
5
#include "qmapcontrol.h"
6

7 8
#include "UASInterface.h"

9
class MAV2DIcon : public qmapcontrol::Point
10 11
{
public:
12 13 14 15 16
    enum
    {
        MAV_ICON_GENERIC = 0,
        MAV_ICON_AIRPLANE,
        MAV_ICON_QUADROTOR,
17 18
        MAV_ICON_COAXIAL,
        MAV_ICON_HELICOPTER,
19
    } MAV_ICON_TYPE;
20 21

    //!
22 23 24 25
    /*!
     *
     * @param x longitude
     * @param y latitude
26
     * @param radius the radius of the circle
27 28 29 30
     * @param name name of the circle point
     * @param alignment alignment (Middle or TopLeft)
     * @param pen QPen for drawing
     */
31
    MAV2DIcon(UASInterface* uas, int radius = 10, int type=0, const QColor& color=QColor(Qt::red), QString name = QString(), Alignment alignment = Middle, QPen* pen=0);
32 33 34 35 36 37 38 39 40

    /*!
     *
     * @param x longitude
     * @param y latitude
     * @param name name of the circle point
     * @param alignment alignment (Middle or TopLeft)
     * @param pen QPen for drawing
     */
41 42
    MAV2DIcon(qreal x, qreal y, QString name = QString(), Alignment alignment = Middle, QPen* pen=0);

43 44 45 46 47 48 49 50 51 52
    virtual ~MAV2DIcon();

    //! sets the QPen which is used for drawing the circle
    /*!
     * A QPen can be used to modify the look of the drawn circle
     * @param pen the QPen which should be used for drawing
     * @see http://doc.trolltech.com/4.3/qpen.html
     */
    virtual void setPen(QPen* pen);

53 54
    /** @brief Mark this system as selected */
    void setSelectedUAS(bool selected);
55
    void setYaw(float yaw);
56 57
    /** @brief Set the airframe this MAV uses */
    void setAirframe(int airframe) { this->airframe = airframe; }
58

59 60 61
    /** @brief Get system id */
    int getUASId() const { return uasid; }

62
    void drawIcon(QPen* pen);
63
    void drawIcon() { drawIcon(mypen); }
64
    static void drawAirframePolygon(int airframe, QPainter& painter, int radius, QColor& iconColor, float yaw);
65 66

protected:
67 68 69
    float yaw;      ///< Yaw angle of the MAV
    int radius;     ///< Radius / width of the icon
    int type;       ///< Type of aircraft: 0: generic, 1: airplane, 2: quadrotor, 3-n: rotary wing
70
    int airframe;   ///< The specific type of airframe used
71
    QColor iconColor; ///< Color to be used for the icon
72 73
    bool selected;  ///< Wether this is the system currently in focus
    int uasid;      ///< ID of tracked system
74 75 76 77

};

#endif // MAV2DICON_H