2010-06-16 08:52:59 +00:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file opmapgadgetwidget.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @brief
|
|
|
|
* @see The GNU Public License (GPL) Version 3
|
|
|
|
* @defgroup opmap
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OPMAP_GADGETWIDGET_H_
|
|
|
|
#define OPMAP_GADGETWIDGET_H_
|
|
|
|
|
|
|
|
#include "opmapcontrol/opmapcontrol.h"
|
2010-06-24 16:22:08 +00:00
|
|
|
|
2010-06-16 08:52:59 +00:00
|
|
|
#include <QtGui/QWidget>
|
2010-06-20 16:27:18 +00:00
|
|
|
#include <QtGui/QMenu>
|
2010-06-26 12:44:28 +00:00
|
|
|
#include <QStringList>
|
2010-06-25 16:18:33 +00:00
|
|
|
#include <QStandardItemModel>
|
2010-06-29 00:40:02 +00:00
|
|
|
#include <QList>
|
|
|
|
#include <QMutex>
|
2010-06-24 16:22:08 +00:00
|
|
|
|
2010-06-16 08:52:59 +00:00
|
|
|
#include "uavobjects/uavobjectmanager.h"
|
|
|
|
#include "uavobjects/positionactual.h"
|
|
|
|
|
2010-06-27 18:59:40 +00:00
|
|
|
#include "opmap_mapoverlaywidget.h"
|
2010-06-24 16:22:08 +00:00
|
|
|
#include "opmap_waypointeditor_dialog.h"
|
2010-06-29 11:11:35 +00:00
|
|
|
#include "opmap_edit_waypoint_dialog.h"
|
2010-06-24 16:22:08 +00:00
|
|
|
|
2010-06-27 18:59:40 +00:00
|
|
|
namespace Ui
|
|
|
|
{
|
2010-06-23 17:50:27 +00:00
|
|
|
class OPMap_Widget;
|
|
|
|
}
|
2010-06-17 14:57:37 +00:00
|
|
|
|
2010-06-16 08:52:59 +00:00
|
|
|
using namespace mapcontrol;
|
|
|
|
|
2010-06-29 00:40:02 +00:00
|
|
|
// ******************************************************
|
|
|
|
|
|
|
|
// waypoint structure
|
|
|
|
typedef struct t_waypoint
|
|
|
|
{
|
|
|
|
mapcontrol::WayPointItem *item;
|
|
|
|
int time_seconds;
|
|
|
|
int hold_time_seconds;
|
|
|
|
} t_waypoint;
|
|
|
|
|
|
|
|
// ******************************************************
|
|
|
|
|
2010-06-16 08:52:59 +00:00
|
|
|
class OPMapGadgetWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
OPMapGadgetWidget(QWidget *parent = 0);
|
|
|
|
~OPMapGadgetWidget();
|
|
|
|
|
2010-06-29 11:11:35 +00:00
|
|
|
/**
|
|
|
|
* @brief public functions
|
|
|
|
*
|
|
|
|
* @param
|
|
|
|
*/
|
|
|
|
void setZoom(int value);
|
|
|
|
void setPosition(QPointF pos);
|
|
|
|
void setMapProvider(QString provider);
|
|
|
|
void setUseOpenGL(bool useOpenGL);
|
|
|
|
void setShowTileGridLines(bool showTileGridLines);
|
|
|
|
void setAccessMode(QString accessMode);
|
2010-06-18 19:07:04 +00:00
|
|
|
void setUseMemoryCache(bool useMemoryCache);
|
|
|
|
void setCacheLocation(QString cacheLocation);
|
2010-06-16 08:52:59 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *event);
|
2010-06-19 22:16:10 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent *event);
|
2010-06-20 16:27:18 +00:00
|
|
|
void contextMenuEvent(QContextMenuEvent *event);
|
2010-06-16 13:12:28 +00:00
|
|
|
void keyPressEvent(QKeyEvent* event);
|
2010-06-16 08:52:59 +00:00
|
|
|
|
|
|
|
private slots:
|
2010-06-19 22:16:10 +00:00
|
|
|
void updatePosition();
|
|
|
|
|
2010-06-21 13:06:48 +00:00
|
|
|
void updateMousePos();
|
2010-06-16 08:52:59 +00:00
|
|
|
|
2010-06-18 07:29:49 +00:00
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
|
|
|
|
2010-06-29 00:40:02 +00:00
|
|
|
/**
|
|
|
|
* @brief signals received from the various map plug-in widget user controls
|
|
|
|
*
|
|
|
|
* @param
|
|
|
|
*/
|
2010-06-26 12:44:28 +00:00
|
|
|
void on_comboBoxFindPlace_returnPressed();
|
2010-06-21 12:16:25 +00:00
|
|
|
void on_toolButtonFindPlace_clicked();
|
2010-06-20 16:27:18 +00:00
|
|
|
void on_toolButtonZoomM_clicked();
|
|
|
|
void on_toolButtonZoomP_clicked();
|
2010-06-25 16:18:33 +00:00
|
|
|
void on_toolButtonWaypointsTreeViewShowHide_clicked();
|
2010-06-22 08:41:49 +00:00
|
|
|
void on_toolButtonFlightControlsShowHide_clicked();
|
2010-06-23 07:35:00 +00:00
|
|
|
void on_toolButtonMapHome_clicked();
|
|
|
|
void on_toolButtonMapUAV_clicked();
|
2010-06-23 17:50:27 +00:00
|
|
|
void on_horizontalSliderZoom_sliderMoved(int position);
|
2010-06-29 00:40:02 +00:00
|
|
|
void on_toolButtonAddWaypoint_clicked();
|
2010-06-24 16:22:08 +00:00
|
|
|
void on_toolButtonWaypointEditor_clicked();
|
2010-06-25 16:18:33 +00:00
|
|
|
void on_treeViewWaypoints_clicked(QModelIndex index);
|
2010-06-23 07:35:00 +00:00
|
|
|
void on_toolButtonHome_clicked();
|
2010-06-29 00:40:02 +00:00
|
|
|
void on_toolButtonNextWaypoint_clicked();
|
|
|
|
void on_toolButtonPrevWaypoint_clicked();
|
2010-06-23 07:35:00 +00:00
|
|
|
void on_toolButtonHoldPosition_clicked();
|
|
|
|
void on_toolButtonGo_clicked();
|
2010-06-16 08:52:59 +00:00
|
|
|
|
2010-06-29 00:40:02 +00:00
|
|
|
/**
|
|
|
|
* @brief signals received from the map object
|
|
|
|
*
|
|
|
|
* @param
|
|
|
|
*/
|
2010-06-18 19:07:04 +00:00
|
|
|
void zoomChanged(double zoom);
|
2010-06-20 08:51:18 +00:00
|
|
|
void OnCurrentPositionChanged(internals::PointLatLng point);
|
|
|
|
void OnTileLoadComplete();
|
|
|
|
void OnTileLoadStart();
|
|
|
|
void OnMapDrag();
|
|
|
|
void OnMapZoomChanged();
|
|
|
|
void OnMapTypeChanged(MapType::Types type);
|
|
|
|
void OnEmptyTileError(int zoom, core::Point pos);
|
2010-06-18 19:07:04 +00:00
|
|
|
void OnTilesStillToLoad(int number);
|
2010-06-29 00:40:02 +00:00
|
|
|
void WPNumberChanged(int const& oldnumber,int const& newnumber, WayPointItem* waypoint);
|
|
|
|
void WPValuesChanged(WayPointItem* waypoint);
|
|
|
|
void WPInserted(int const& number, WayPointItem* waypoint);
|
|
|
|
void WPDeleted(int const& number);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief mouse right click context menu signals
|
|
|
|
*
|
|
|
|
* @param
|
|
|
|
*/
|
2010-06-20 16:27:18 +00:00
|
|
|
void reload();
|
|
|
|
void findPlace();
|
2010-06-30 08:09:46 +00:00
|
|
|
void on_showCompassAct_toggled(bool show_compass);
|
2010-06-20 18:18:04 +00:00
|
|
|
void goZoomIn();
|
|
|
|
void goZoomOut();
|
|
|
|
void goMouseClick();
|
2010-06-20 16:27:18 +00:00
|
|
|
void goHome();
|
|
|
|
void goUAV();
|
2010-06-23 09:24:36 +00:00
|
|
|
void on_followUAVpositionAct_toggled(bool checked);
|
|
|
|
void on_followUAVheadingAct_toggled(bool checked);
|
2010-06-20 16:27:18 +00:00
|
|
|
void openWayPointEditor();
|
|
|
|
void addWayPoint();
|
2010-06-29 11:11:35 +00:00
|
|
|
void editWayPoint();
|
2010-06-20 16:27:18 +00:00
|
|
|
void deleteWayPoint();
|
|
|
|
void clearWayPoints();
|
|
|
|
void zoom2() { setZoom(2); }
|
|
|
|
void zoom3() { setZoom(3); }
|
|
|
|
void zoom4() { setZoom(4); }
|
|
|
|
void zoom5() { setZoom(5); }
|
|
|
|
void zoom6() { setZoom(6); }
|
|
|
|
void zoom7() { setZoom(7); }
|
|
|
|
void zoom8() { setZoom(8); }
|
|
|
|
void zoom9() { setZoom(9); }
|
|
|
|
void zoom10() { setZoom(10); }
|
|
|
|
void zoom11() { setZoom(11); }
|
|
|
|
void zoom12() { setZoom(12); }
|
|
|
|
void zoom13() { setZoom(13); }
|
|
|
|
void zoom14() { setZoom(14); }
|
|
|
|
void zoom15() { setZoom(15); }
|
|
|
|
void zoom16() { setZoom(16); }
|
|
|
|
void zoom17() { setZoom(17); }
|
2010-06-21 13:06:48 +00:00
|
|
|
void zoom18() { setZoom(18); }
|
|
|
|
void zoom19() { setZoom(19); }
|
2010-06-16 08:52:59 +00:00
|
|
|
|
2010-06-20 16:27:18 +00:00
|
|
|
private:
|
2010-06-19 16:59:51 +00:00
|
|
|
double m_heading; // uav heading
|
2010-06-16 08:52:59 +00:00
|
|
|
|
2010-06-19 22:16:10 +00:00
|
|
|
internals::PointLatLng mouse_lat_lon;
|
|
|
|
|
2010-06-26 12:44:28 +00:00
|
|
|
int prev_tile_number;
|
|
|
|
|
|
|
|
QStringList findPlaceWordList;
|
|
|
|
QCompleter *findPlaceCompleter;
|
|
|
|
|
2010-06-16 08:52:59 +00:00
|
|
|
QTimer *m_updateTimer;
|
2010-06-19 22:16:10 +00:00
|
|
|
QTimer *m_statusUpdateTimer;
|
2010-06-16 08:52:59 +00:00
|
|
|
|
|
|
|
PositionActual *m_positionActual;
|
|
|
|
|
2010-06-23 17:50:27 +00:00
|
|
|
Ui::OPMap_Widget *m_widget;
|
2010-06-19 16:59:51 +00:00
|
|
|
|
2010-06-20 16:27:18 +00:00
|
|
|
mapcontrol::OPMapWidget *m_map;
|
2010-06-18 07:29:49 +00:00
|
|
|
|
2010-06-29 11:11:35 +00:00
|
|
|
opmap_waypointeditor_dialog waypoint_editor_dialog;
|
|
|
|
|
|
|
|
opmap_edit_waypoint_dialog waypoint_edit_dialog;
|
2010-06-24 16:22:08 +00:00
|
|
|
|
2010-06-27 18:59:40 +00:00
|
|
|
QGraphicsScene *m_map_graphics_scene;
|
|
|
|
QGraphicsProxyWidget *m_map_scene_proxy;
|
|
|
|
OPMap_MapOverlayWidget *m_map_overlay_widget;
|
2010-06-25 16:18:33 +00:00
|
|
|
|
|
|
|
QStandardItemModel *wayPoint_treeView_model;
|
2010-06-29 19:41:13 +00:00
|
|
|
|
|
|
|
mapcontrol::WayPointItem *m_mouse_waypoint;
|
2010-06-25 16:18:33 +00:00
|
|
|
|
2010-06-29 00:40:02 +00:00
|
|
|
QList<t_waypoint> m_waypoint_list;
|
|
|
|
QMutex m_waypoint_list_mutex;
|
|
|
|
|
2010-06-20 16:27:18 +00:00
|
|
|
void createActions();
|
|
|
|
|
|
|
|
QAction *closeAct;
|
|
|
|
QAction *reloadAct;
|
|
|
|
QAction *findPlaceAct;
|
2010-06-30 08:09:46 +00:00
|
|
|
QAction *showCompassAct;
|
2010-06-20 16:27:18 +00:00
|
|
|
QAction *zoomInAct;
|
|
|
|
QAction *zoomOutAct;
|
2010-06-20 18:18:04 +00:00
|
|
|
QAction *goMouseClickAct;
|
2010-06-20 16:27:18 +00:00
|
|
|
QAction *goHomeAct;
|
|
|
|
QAction *goUAVAct;
|
2010-06-23 09:24:36 +00:00
|
|
|
QAction *followUAVpositionAct;
|
|
|
|
QAction *followUAVheadingAct;
|
2010-06-20 16:27:18 +00:00
|
|
|
QAction *wayPointEditorAct;
|
|
|
|
QAction *addWayPointAct;
|
2010-06-29 11:11:35 +00:00
|
|
|
QAction *editWayPointAct;
|
2010-06-20 16:27:18 +00:00
|
|
|
QAction *deleteWayPointAct;
|
|
|
|
QAction *clearWayPointsAct;
|
|
|
|
|
|
|
|
QActionGroup *zoomActGroup;
|
|
|
|
QAction *zoom2Act;
|
|
|
|
QAction *zoom3Act;
|
|
|
|
QAction *zoom4Act;
|
|
|
|
QAction *zoom5Act;
|
|
|
|
QAction *zoom6Act;
|
|
|
|
QAction *zoom7Act;
|
|
|
|
QAction *zoom8Act;
|
|
|
|
QAction *zoom9Act;
|
|
|
|
QAction *zoom10Act;
|
|
|
|
QAction *zoom11Act;
|
|
|
|
QAction *zoom12Act;
|
|
|
|
QAction *zoom13Act;
|
|
|
|
QAction *zoom14Act;
|
|
|
|
QAction *zoom15Act;
|
|
|
|
QAction *zoom16Act;
|
|
|
|
QAction *zoom17Act;
|
2010-06-21 13:06:48 +00:00
|
|
|
QAction *zoom18Act;
|
|
|
|
QAction *zoom19Act;
|
2010-06-16 08:52:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* OPMAP_GADGETWIDGET_H_ */
|