QGCMapWidget.h 2.79 KB
Newer Older
lm's avatar
lm committed
1 2 3
#ifndef QGCMAPWIDGET_H
#define QGCMAPWIDGET_H

4
#include <QMap>
5
#include <QTimer>
lm's avatar
lm committed
6 7
#include "opmapcontrol.h"

lm's avatar
lm committed
8
class UASInterface;
9 10
class UASWaypointManager;
class Waypoint;
11
typedef mapcontrol::WayPointItem WayPointItem;
lm's avatar
lm committed
12

13 14 15
/**
 * @brief Class representing a 2D map using aerial imagery
 */
lm's avatar
lm committed
16
class QGCMapWidget : public mapcontrol::OPMapWidget
lm's avatar
lm committed
17 18 19 20
{
    Q_OBJECT
public:
    explicit QGCMapWidget(QWidget *parent = 0);
lm's avatar
lm committed
21
    ~QGCMapWidget();
22 23 24 25
//    /** @brief Convert meters to pixels */
//    float metersToPixels(double meters);
//    double headingP1P2(internals::PointLatLng p1, internals::PointLatLng p2);
//    internals::PointLatLng targetLatLon(internals::PointLatLng source, double heading, double dist);
lm's avatar
lm committed
26 27

signals:
28
    void homePositionChanged(double latitude, double longitude, double altitude);
29 30 31
    /** @brief Signal for newly created map waypoints */
    void waypointCreated(Waypoint* wp);
    void waypointChanged(Waypoint* wp);
lm's avatar
lm committed
32 33

public slots:
34
    /** @brief Add system to map view */
lm's avatar
lm committed
35
    void addUAS(UASInterface* uas);
36
    /** @brief Update the global position of a system */
lm's avatar
lm committed
37
    void updateGlobalPosition(UASInterface* uas, double lat, double lon, double alt, quint64 usec);
38 39
    /** @brief Update the global position of all systems */
    void updateGlobalPosition();
40 41
    /** @brief Update the type, size, etc. of this system */
    void updateSystemSpecs(int uas);
42 43 44 45 46 47 48 49 50 51
    /** @brief Change current system in focus / editing */
    void activeUASSet(UASInterface* uas);
    /** @brief Show a dialog to jump to given GPS coordinates */
    void showGoToDialog();
    /** @brief Update this waypoint for this UAS */
    void updateWaypoint(int uas, Waypoint* wp);
    /** @brief Update the whole waypoint */
    void updateWaypointList(int uas);
    /** @brief Update the home position on the map */
    void updateHomePosition(double latitude, double longitude, double altitude);
52 53
    /** @brief Set update rate limit */
    void setUpdateRateLimit(float seconds);
54

55 56 57 58
protected slots:
    /** @brief Convert a map edit into a QGC waypoint event */
    void handleMapWaypointEdit(WayPointItem* waypoint);

59
protected:
60 61 62 63 64 65 66
    /** @brief Update the highlighting of the currently controlled system */
    void updateSelectedSystem(int uas);
    /** @brief Set the current mouse position on the map as new home position */

    UASWaypointManager* currWPManager; ///< The current waypoint manager
    QMap<Waypoint* , mapcontrol::WayPointItem*> waypointsToIcons;
    QMap<mapcontrol::WayPointItem*, Waypoint*> iconsToWaypoints;
67
    Waypoint* firingWaypointChange;
68 69
    QTimer updateTimer;
    float maxUpdateInterval;
70 71 72 73 74 75 76 77 78
//    enum editMode {
//        NONE,
//        WAYPOINTS,
//        SWEEP,
//        UAVS,
//        HOME,
//        SAFE_AREA
//    };
//    enum editMode currEditMode;            ///< The current edit mode on the map
lm's avatar
lm committed
79 80 81 82

};

#endif // QGCMAPWIDGET_H