Skip to content
QGCMapWidget.h 2.78 KiB
Newer Older
lm's avatar
lm committed
#ifndef QGCMAPWIDGET_H
#define QGCMAPWIDGET_H

lm's avatar
lm committed
#include "opmapcontrol.h"

lm's avatar
lm committed
class UASInterface;
class UASWaypointManager;
class Waypoint;
lm's avatar
lm committed

/**
 * @brief Class representing a 2D map using aerial imagery
 */
lm's avatar
lm committed
class QGCMapWidget : public mapcontrol::OPMapWidget
lm's avatar
lm committed
{
    Q_OBJECT
public:
    explicit QGCMapWidget(QWidget *parent = 0);
lm's avatar
lm committed
    ~QGCMapWidget();
//    /** @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

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

public slots:
    /** @brief Add system to map view */
lm's avatar
lm committed
    void addUAS(UASInterface* uas);
    /** @brief Update the global position of a system */
lm's avatar
lm committed
    void updateGlobalPosition(UASInterface* uas, double lat, double lon, double alt, quint64 usec);
    /** @brief Update the global position of all systems */
    void updateGlobalPosition();
    /** @brief Update the type, size, etc. of this system */
    void updateSystemSpecs(int uas);
    /** @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);
    /** @brief Set update rate limit */
    void setUpdateRateLimit(float seconds);
protected slots:
    /** @brief Convert a map edit into a QGC waypoint event */
    void handleMapWaypointEdit(WayPointItem* waypoint);

    /** @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;
    QTimer updateTimer;
    float maxUpdateInterval;
//    enum editMode {
//        NONE,
//        WAYPOINTS,
//        SWEEP,
//        UAVS,
//        HOME,
//        SAFE_AREA
//    };
    //editMode currEditMode;            ///< The current edit mode on the map
lm's avatar
lm committed

};

#endif // QGCMAPWIDGET_H