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 <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-07-01 11:00:12 +00:00
|
|
|
#include "opmapcontrol/opmapcontrol.h"
|
|
|
|
|
2010-06-16 08:52:59 +00:00
|
|
|
#include "uavobjects/uavobjectmanager.h"
|
|
|
|
#include "uavobjects/positionactual.h"
|
2010-07-01 11:00:12 +00:00
|
|
|
#include "extensionsystem/pluginmanager.h"
|
2010-06-16 08:52:59 +00:00
|
|
|
|
2010-07-04 09:28:52 +00:00
|
|
|
#include "opmap_overlay_widget.h"
|
|
|
|
#include "opmap_zoom_slider_widget.h"
|
|
|
|
#include "opmap_statusbar_widget.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
|
|
|
// ******************************************************
|
|
|
|
|
2010-06-30 13:26:24 +00:00
|
|
|
// local waypoint list item structure
|
2010-06-29 00:40:02 +00:00
|
|
|
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-30 20:22:18 +00:00
|
|
|
void 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-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-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-07-01 11:00:12 +00:00
|
|
|
void onReloadAct_triggered();
|
|
|
|
void onCopyMouseLatLonToClipAct_triggered();
|
|
|
|
void onCopyMouseLatToClipAct_triggered();
|
|
|
|
void onCopyMouseLonToClipAct_triggered();
|
|
|
|
void onFindPlaceAct_triggered();
|
|
|
|
void onShowCompassAct_toggled(bool show_compass);
|
|
|
|
void onGoZoomInAct_triggered();
|
|
|
|
void onGoZoomOutAct_triggered();
|
|
|
|
void onGoMouseClickAct_triggered();
|
|
|
|
void onGoHomeAct_triggered();
|
|
|
|
void onGoUAVAct_triggered();
|
|
|
|
void onFollowUAVpositionAct_toggled(bool checked);
|
|
|
|
void onFollowUAVheadingAct_toggled(bool checked);
|
|
|
|
void onOpenWayPointEditorAct_triggered();
|
|
|
|
void onAddWayPointAct_triggered();
|
|
|
|
void onEditWayPointAct_triggered();
|
|
|
|
void onLockWayPointAct_triggered();
|
|
|
|
void onDeleteWayPointAct_triggered();
|
|
|
|
void onClearWayPointsAct_triggered();
|
|
|
|
void onZoomActGroup_triggered(QAction *action);
|
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-30 13:26:24 +00:00
|
|
|
QTimer *m_updateTimer;
|
|
|
|
QTimer *m_statusUpdateTimer;
|
2010-06-16 08:52:59 +00:00
|
|
|
|
2010-07-01 11:00:12 +00:00
|
|
|
ExtensionSystem::PluginManager *m_plugin_manager;
|
|
|
|
UAVObjectManager *m_objManager;
|
2010-06-30 13:26:24 +00:00
|
|
|
PositionActual *m_positionActual;
|
2010-06-16 08:52:59 +00:00
|
|
|
|
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-07-04 09:28:52 +00:00
|
|
|
opmap_overlay_widget *m_overlay_widget;
|
|
|
|
|
2010-06-27 18:59:40 +00:00
|
|
|
QGraphicsScene *m_map_graphics_scene;
|
|
|
|
QGraphicsProxyWidget *m_map_scene_proxy;
|
2010-07-04 09:28:52 +00:00
|
|
|
opmap_zoom_slider_widget *m_zoom_slider_widget;
|
|
|
|
opmap_statusbar_widget *m_statusbar_widget;
|
2010-06-25 16:18:33 +00:00
|
|
|
|
2010-07-01 11:00:12 +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;
|
2010-07-01 11:00:12 +00:00
|
|
|
QAction *copyMouseLatLonToClipAct;
|
|
|
|
QAction *copyMouseLatToClipAct;
|
|
|
|
QAction *copyMouseLonToClipAct;
|
2010-06-20 16:27:18 +00:00
|
|
|
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-30 13:26:24 +00:00
|
|
|
QAction *lockWayPointAct;
|
2010-06-20 16:27:18 +00:00
|
|
|
QAction *deleteWayPointAct;
|
|
|
|
QAction *clearWayPointsAct;
|
|
|
|
|
|
|
|
QActionGroup *zoomActGroup;
|
2010-06-30 13:26:24 +00:00
|
|
|
QList<QAction *> zoomAct;
|
2010-06-30 16:07:26 +00:00
|
|
|
|
|
|
|
void loadComboBoxLines(QComboBox *comboBox, QString filename);
|
|
|
|
void saveComboBoxLines(QComboBox *comboBox, QString filename);
|
2010-06-16 08:52:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* OPMAP_GADGETWIDGET_H_ */
|