2010-06-16 10:52:59 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file opmapgadgetwidget.cpp
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
#include "opmapgadgetwidget.h"
|
|
|
|
#include <QStringList>
|
2010-06-17 16:57:37 +02:00
|
|
|
#include <QtGui/QHBoxLayout>
|
2010-06-18 09:29:49 +02:00
|
|
|
#include <QtGui/QVBoxLayout>
|
2010-06-19 18:59:51 +02:00
|
|
|
#include <QDir>
|
2010-06-16 10:52:59 +02:00
|
|
|
#include "extensionsystem/pluginmanager.h"
|
|
|
|
|
2010-06-17 16:57:37 +02:00
|
|
|
#include "ui_opmap_controlpanel.h"
|
|
|
|
|
2010-06-16 10:52:59 +02:00
|
|
|
// *************************************************************************************
|
|
|
|
// constructor
|
|
|
|
|
|
|
|
OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
|
|
|
{
|
2010-06-17 16:57:37 +02:00
|
|
|
// **************
|
|
|
|
|
|
|
|
controlpanel_ui = NULL;
|
2010-06-20 18:27:18 +02:00
|
|
|
m_map = NULL;
|
2010-06-17 16:57:37 +02:00
|
|
|
|
2010-06-20 00:16:10 +02:00
|
|
|
setMouseTracking(true);
|
|
|
|
|
2010-06-17 16:57:37 +02:00
|
|
|
// **************
|
2010-06-16 10:52:59 +02:00
|
|
|
// Get required UAVObjects
|
2010-06-17 16:57:37 +02:00
|
|
|
|
2010-06-16 10:52:59 +02:00
|
|
|
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
|
|
|
|
UAVObjectManager* objManager = pm->getObject<UAVObjectManager>();
|
|
|
|
m_positionActual = PositionActual::GetInstance(objManager);
|
|
|
|
|
2010-06-17 16:57:37 +02:00
|
|
|
// **************
|
|
|
|
// create the user control panel
|
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
// controlpanel_ui = new Ui::OPMapControlPanel();
|
|
|
|
// controlpanel_ui->setupUi(this);
|
2010-06-17 16:57:37 +02:00
|
|
|
|
2010-06-18 09:29:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
QWidget *dialog = new QWidget(this, Qt::Dialog);
|
|
|
|
|
|
|
|
controlpanel_ui = new Ui::OPMapControlPanel();
|
|
|
|
controlpanel_ui->setupUi(dialog);
|
|
|
|
|
|
|
|
QHBoxLayout *d_layout = new QHBoxLayout(dialog);
|
|
|
|
d_layout->setSpacing(0);
|
|
|
|
d_layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
d_layout->addWidget(controlpanel_ui->layoutWidget);
|
|
|
|
dialog->setLayout(d_layout);
|
|
|
|
|
|
|
|
dialog->show();
|
|
|
|
*/
|
2010-06-17 16:57:37 +02:00
|
|
|
// **************
|
|
|
|
// create the map display
|
2010-06-16 10:52:59 +02:00
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
m_map = new mapcontrol::OPMapWidget();
|
|
|
|
m_map->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
|
|
m_map->setMinimumSize(64, 64);
|
2010-06-16 10:52:59 +02:00
|
|
|
|
2010-06-20 19:23:03 +02:00
|
|
|
m_map->configuration->DragButton = Qt::LeftButton;
|
|
|
|
|
2010-06-17 16:57:37 +02:00
|
|
|
// **************
|
|
|
|
// set the user control options
|
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
if (controlpanel_ui)
|
|
|
|
{
|
|
|
|
controlpanel_ui->labelZoom->setText(" " + QString::number(m_map->Zoom()));
|
|
|
|
controlpanel_ui->labelRotate->setText(" " + QString::number(m_map->Rotate()));
|
2010-06-20 00:16:10 +02:00
|
|
|
// controlpanel_ui->labelNumTilesToLoad->setText(" 0");
|
2010-06-20 18:27:18 +02:00
|
|
|
controlpanel_ui->labelStatus->setText("");
|
|
|
|
controlpanel_ui->progressBarMap->setMaximum(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// **************
|
|
|
|
|
|
|
|
createActions();
|
2010-06-17 16:57:37 +02:00
|
|
|
|
|
|
|
// **************
|
2010-06-20 18:27:18 +02:00
|
|
|
// map stuff
|
2010-06-17 16:57:37 +02:00
|
|
|
|
2010-06-20 10:51:18 +02:00
|
|
|
// get current UAV data
|
2010-06-17 16:57:37 +02:00
|
|
|
PositionActual::DataFields data = m_positionActual->getData();
|
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
connect(m_map, SIGNAL(zoomChanged(double)), this, SLOT(zoomChanged(double))); // map zoom change signals
|
|
|
|
connect(m_map, SIGNAL(OnCurrentPositionChanged(internals::PointLatLng)), this, SLOT(OnCurrentPositionChanged(internals::PointLatLng))); // map poisition change signals
|
|
|
|
connect(m_map, SIGNAL(OnTileLoadComplete()), this, SLOT(OnTileLoadComplete())); // tile loading stop signals
|
|
|
|
connect(m_map, SIGNAL(OnTileLoadStart()), this, SLOT(OnTileLoadStart())); // tile loading start signals
|
|
|
|
connect(m_map, SIGNAL(OnMapDrag()), this, SLOT(OnMapDrag())); // map drag signals
|
|
|
|
connect(m_map, SIGNAL(OnMapZoomChanged()), this, SLOT(OnMapZoomChanged())); // map zoom changed
|
|
|
|
connect(m_map, SIGNAL(OnMapTypeChanged(MapType::Types)), this, SLOT(OnMapTypeChanged(MapType::Types))); // map type changed
|
|
|
|
connect(m_map, SIGNAL(OnEmptyTileError(int, core::Point)), this, SLOT(OnEmptyTileError(int, core::Point))); // tile error
|
|
|
|
connect(m_map, SIGNAL(OnTilesStillToLoad(int)), this, SLOT(OnTilesStillToLoad(int))); // tile loading signals
|
|
|
|
|
|
|
|
m_map->SetMaxZoom(20); // increase the maximum zoom level
|
|
|
|
m_map->SetMouseWheelZoomType(internals::MouseWheelZoomType::MousePositionWithoutCenter); // set how the mouse wheel zoom functions
|
|
|
|
m_map->SetFollowMouse(true); // we want a contiuous mouse position reading
|
|
|
|
m_map->SetUseOpenGL(openGLAct->isChecked()); // enable/disable openGL
|
|
|
|
m_map->SetShowTileGridLines(gridLinesAct->isChecked()); // map grid lines on/off
|
|
|
|
m_map->SetCurrentPosition(internals::PointLatLng(data.Latitude, data.Longitude)); // set the default map position
|
2010-06-17 16:57:37 +02:00
|
|
|
|
|
|
|
// **************
|
|
|
|
|
|
|
|
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
2010-06-16 10:52:59 +02:00
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
QVBoxLayout *layout = new QVBoxLayout;
|
2010-06-16 20:50:36 +02:00
|
|
|
layout->setSpacing(0);
|
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
2010-06-20 18:27:18 +02:00
|
|
|
//if (controlpanel_ui) layout->addWidget(controlpanel_ui->layoutWidget);
|
|
|
|
layout->addWidget(m_map);
|
2010-06-16 20:50:36 +02:00
|
|
|
setLayout(layout);
|
2010-06-16 10:52:59 +02:00
|
|
|
|
2010-06-18 09:29:49 +02:00
|
|
|
// **************
|
|
|
|
// create the user controls overlayed onto the map
|
|
|
|
|
|
|
|
createMapOverlayUserControls();
|
|
|
|
|
2010-06-17 16:57:37 +02:00
|
|
|
// **************
|
2010-06-20 10:51:18 +02:00
|
|
|
// create the desired timers
|
2010-06-17 16:57:37 +02:00
|
|
|
|
|
|
|
m_updateTimer = new QTimer();
|
|
|
|
m_updateTimer->setInterval(250);
|
|
|
|
connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updatePosition()));
|
|
|
|
m_updateTimer->start();
|
|
|
|
|
2010-06-20 00:16:10 +02:00
|
|
|
m_statusUpdateTimer = new QTimer();
|
2010-06-20 10:51:18 +02:00
|
|
|
m_statusUpdateTimer->setInterval(100);
|
2010-06-20 00:16:10 +02:00
|
|
|
connect(m_statusUpdateTimer, SIGNAL(timeout()), this, SLOT(statusUpdate()));
|
|
|
|
m_statusUpdateTimer->start();
|
|
|
|
|
2010-06-17 16:57:37 +02:00
|
|
|
// **************
|
2010-06-16 10:52:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// *************************************************************************************
|
|
|
|
// destructor
|
|
|
|
|
|
|
|
OPMapGadgetWidget::~OPMapGadgetWidget()
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map) delete m_map;
|
2010-06-17 16:57:37 +02:00
|
|
|
if (controlpanel_ui) delete controlpanel_ui;
|
2010-06-16 10:52:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// *************************************************************************************
|
2010-06-20 10:51:18 +02:00
|
|
|
// widget signals
|
2010-06-16 10:52:59 +02:00
|
|
|
|
2010-06-20 00:16:10 +02:00
|
|
|
void OPMapGadgetWidget::resizeEvent(QResizeEvent *event)
|
|
|
|
{
|
|
|
|
// if (map) map->resize(QSize(width(), height()));
|
|
|
|
update();
|
|
|
|
QWidget::resizeEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::mouseMoveEvent(QMouseEvent *event)
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
2010-06-20 00:16:10 +02:00
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
// mouse_lat_lon = m_map->currentMousePosition(); // fetch the current mouse lat/longitude position
|
2010-06-20 10:51:18 +02:00
|
|
|
// if (mouse_lat_lon != lat_lon)
|
|
|
|
// { // the mouse has moved
|
|
|
|
// mouse_lat_lon = lat_lon;
|
|
|
|
//
|
|
|
|
// QString coord_str = " " + QString::number(mouse_lat_lon.Lat(), 'f', 6) + " " + QString::number(mouse_lat_lon.Lng(), 'f', 6);
|
|
|
|
//
|
|
|
|
// statusLabel.setText(coord_str);
|
|
|
|
// controlpanel_ui->labelStatus->setText(coord_str);
|
|
|
|
// }
|
2010-06-20 00:16:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (event->buttons() & Qt::LeftButton)
|
|
|
|
{
|
|
|
|
QPoint pos = event->pos();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
|
|
|
{
|
|
|
|
// ****************
|
|
|
|
|
|
|
|
QMenu zoomMenu(tr("&Zoom ") + "(" + QString::number(m_map->Zoom()) + ")", this);
|
|
|
|
zoomMenu.addAction(zoom2Act);
|
|
|
|
zoomMenu.addAction(zoom3Act);
|
|
|
|
zoomMenu.addAction(zoom4Act);
|
|
|
|
zoomMenu.addAction(zoom5Act);
|
|
|
|
zoomMenu.addAction(zoom6Act);
|
|
|
|
zoomMenu.addAction(zoom7Act);
|
|
|
|
zoomMenu.addAction(zoom8Act);
|
|
|
|
zoomMenu.addAction(zoom9Act);
|
|
|
|
zoomMenu.addAction(zoom10Act);
|
|
|
|
zoomMenu.addAction(zoom11Act);
|
|
|
|
zoomMenu.addAction(zoom12Act);
|
|
|
|
zoomMenu.addAction(zoom13Act);
|
|
|
|
zoomMenu.addAction(zoom14Act);
|
|
|
|
zoomMenu.addAction(zoom15Act);
|
|
|
|
zoomMenu.addAction(zoom16Act);
|
|
|
|
zoomMenu.addAction(zoom17Act);
|
|
|
|
|
|
|
|
// ****************
|
|
|
|
|
|
|
|
QMenu menu(this);
|
|
|
|
|
|
|
|
menu.addAction(closeAct);
|
|
|
|
|
|
|
|
menu.addSeparator();
|
|
|
|
|
|
|
|
menu.addAction(reloadAct);
|
|
|
|
|
|
|
|
menu.addSeparator();
|
|
|
|
|
|
|
|
menu.addAction(findPlaceAct);
|
|
|
|
|
|
|
|
menu.addSeparator()->setText(tr("Zoom"));
|
|
|
|
|
|
|
|
menu.addAction(zoomInAct);
|
|
|
|
menu.addAction(zoomOutAct);
|
|
|
|
menu.addMenu(&zoomMenu);
|
|
|
|
|
|
|
|
menu.addSeparator()->setText(tr("Position"));
|
|
|
|
|
|
|
|
menu.addAction(goHomeAct);
|
|
|
|
menu.addAction(goUAVAct);
|
|
|
|
menu.addAction(followUAVAct);
|
|
|
|
|
|
|
|
menu.addSeparator()->setText(tr("Waypoints"));
|
|
|
|
|
|
|
|
menu.addAction(wayPointEditorAct);
|
|
|
|
menu.addAction(addWayPointAct);
|
|
|
|
menu.addAction(deleteWayPointAct);
|
|
|
|
menu.addAction(clearWayPointsAct);
|
|
|
|
|
|
|
|
menu.addSeparator();
|
|
|
|
|
|
|
|
menu.addAction(gridLinesAct);
|
|
|
|
menu.addAction(openGLAct);
|
|
|
|
|
|
|
|
menu.exec(event->globalPos());
|
|
|
|
|
|
|
|
// ****************
|
|
|
|
}
|
|
|
|
|
2010-06-16 10:52:59 +02:00
|
|
|
void OPMapGadgetWidget::keyPressEvent(QKeyEvent* event)
|
|
|
|
{
|
|
|
|
if (event->key() == Qt::Key_Escape) // ESC
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (event->key() == Qt::Key_F1) // F1
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (event->key() == Qt::Key_F2) // F2
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (event->key() == Qt::Key_Up)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (event->key() == Qt::Key_Down)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (event->key() == Qt::Key_Left)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (event->key() == Qt::Key_Right)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (event->key() == Qt::Key_PageUp)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (event->key() == Qt::Key_PageDown)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
qDebug() << event->key() << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-18 09:29:49 +02:00
|
|
|
// *************************************************************************************
|
2010-06-20 10:51:18 +02:00
|
|
|
// timer signals
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::updatePosition()
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
PositionActual::DataFields data = m_positionActual->getData(); // get current UAV data
|
2010-06-20 10:51:18 +02:00
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map && followUAVAct)
|
2010-06-20 10:51:18 +02:00
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (followUAVAct->isChecked())
|
|
|
|
{
|
|
|
|
internals::PointLatLng uav_pos = internals::PointLatLng(data.Latitude, data.Longitude); // current UAV position
|
|
|
|
internals::PointLatLng map_pos = m_map->CurrentPosition(); // current MAP position
|
|
|
|
if (map_pos != uav_pos) m_map->SetCurrentPosition(uav_pos); // center the map onto the UAV
|
|
|
|
}
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::statusUpdate()
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
internals::PointLatLng lat_lon = m_map->currentMousePosition(); // fetch the current lat/lon mouse position
|
2010-06-20 10:51:18 +02:00
|
|
|
|
|
|
|
if (mouse_lat_lon != lat_lon)
|
|
|
|
{ // the mouse has moved
|
|
|
|
mouse_lat_lon = lat_lon;
|
|
|
|
|
|
|
|
QString coord_str = " " + QString::number(mouse_lat_lon.Lat(), 'f', 6) + " " + QString::number(mouse_lat_lon.Lng(), 'f', 6);
|
|
|
|
|
|
|
|
statusLabel.setText(coord_str);
|
2010-06-20 18:27:18 +02:00
|
|
|
if (controlpanel_ui) controlpanel_ui->labelStatus->setText(coord_str);
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// *************************************************************************************
|
|
|
|
// map signals
|
2010-06-17 16:57:37 +02:00
|
|
|
|
|
|
|
void OPMapGadgetWidget::zoomChanged(double zoom)
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
int i_zoom = (int)(zoom + 0.5);
|
|
|
|
|
|
|
|
if (controlpanel_ui)
|
|
|
|
controlpanel_ui->labelZoom->setText(" " + QString::number(zoom));
|
|
|
|
|
|
|
|
switch (i_zoom)
|
|
|
|
{
|
|
|
|
case 2: if (zoom2Act) zoom2Act->setChecked(true); break;
|
|
|
|
case 3: if (zoom3Act) zoom3Act->setChecked(true); break;
|
|
|
|
case 4: if (zoom4Act) zoom4Act->setChecked(true); break;
|
|
|
|
case 5: if (zoom4Act) zoom5Act->setChecked(true); break;
|
|
|
|
case 6: if (zoom4Act) zoom6Act->setChecked(true); break;
|
|
|
|
case 7: if (zoom4Act) zoom7Act->setChecked(true); break;
|
|
|
|
case 8: if (zoom4Act) zoom8Act->setChecked(true); break;
|
|
|
|
case 9: if (zoom4Act) zoom9Act->setChecked(true); break;
|
|
|
|
case 10: if (zoom4Act) zoom10Act->setChecked(true); break;
|
|
|
|
case 11: if (zoom4Act) zoom11Act->setChecked(true); break;
|
|
|
|
case 12: if (zoom4Act) zoom12Act->setChecked(true); break;
|
|
|
|
case 13: if (zoom4Act) zoom13Act->setChecked(true); break;
|
|
|
|
case 14: if (zoom4Act) zoom14Act->setChecked(true); break;
|
|
|
|
case 15: if (zoom4Act) zoom15Act->setChecked(true); break;
|
|
|
|
case 16: if (zoom4Act) zoom16Act->setChecked(true); break;
|
|
|
|
case 17: if (zoom4Act) zoom17Act->setChecked(true); break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2010-06-17 16:57:37 +02:00
|
|
|
}
|
|
|
|
|
2010-06-20 10:51:18 +02:00
|
|
|
void OPMapGadgetWidget::OnMapDrag()
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (followUAVAct->isChecked())
|
|
|
|
followUAVAct->setChecked(false); // disable follow UAV mode
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::OnCurrentPositionChanged(internals::PointLatLng point)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-06-18 21:07:04 +02:00
|
|
|
void OPMapGadgetWidget::OnTilesStillToLoad(int number)
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (controlpanel_ui)
|
|
|
|
{
|
|
|
|
if (controlpanel_ui->progressBarMap->maximum() < number)
|
|
|
|
controlpanel_ui->progressBarMap->setMaximum(number); // update the maximum number of tiles used
|
|
|
|
controlpanel_ui->progressBarMap->setValue(controlpanel_ui->progressBarMap->maximum() - number); // update the progress bar
|
2010-06-20 00:16:10 +02:00
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
// controlpanel_ui->labelNumTilesToLoad->setText(" " + QString::number(number));
|
|
|
|
}
|
2010-06-18 21:07:04 +02:00
|
|
|
}
|
|
|
|
|
2010-06-20 10:51:18 +02:00
|
|
|
void OPMapGadgetWidget::OnTileLoadStart()
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (controlpanel_ui) controlpanel_ui->progressBarMap->setVisible(true);
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::OnTileLoadComplete()
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (controlpanel_ui) controlpanel_ui->progressBarMap->setVisible(false);
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::OnMapZoomChanged()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::OnMapTypeChanged(MapType::Types type)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::OnEmptyTileError(int zoom, core::Point pos)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-06-18 21:07:04 +02:00
|
|
|
// *************************************************************************************
|
2010-06-20 10:51:18 +02:00
|
|
|
// user control panel signals
|
2010-06-19 10:41:56 +02:00
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
void OPMapGadgetWidget::on_toolButtonRL_clicked()
|
2010-06-17 16:57:37 +02:00
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
2010-06-17 16:57:37 +02:00
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
m_map->SetRotate(m_map->Rotate() - 1);
|
|
|
|
if (controlpanel_ui) controlpanel_ui->labelRotate->setText(" " + QString::number(m_map->Rotate()));
|
2010-06-17 16:57:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
void OPMapGadgetWidget::on_toolButtonRC_clicked()
|
2010-06-17 16:57:37 +02:00
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
2010-06-18 09:29:49 +02:00
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
m_map->SetRotate(0);
|
|
|
|
if (controlpanel_ui) controlpanel_ui->labelRotate->setText(" " + QString::number(m_map->Rotate()));
|
2010-06-18 09:29:49 +02:00
|
|
|
}
|
2010-06-17 16:57:37 +02:00
|
|
|
}
|
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
void OPMapGadgetWidget::on_toolButtonRR_clicked()
|
2010-06-17 16:57:37 +02:00
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
2010-06-18 09:29:49 +02:00
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
m_map->SetRotate(m_map->Rotate() + 1);
|
|
|
|
if (controlpanel_ui) controlpanel_ui->labelRotate->setText(" " + QString::number(m_map->Rotate()));
|
2010-06-18 09:29:49 +02:00
|
|
|
}
|
2010-06-17 16:57:37 +02:00
|
|
|
}
|
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
void OPMapGadgetWidget::on_toolButtonZoomP_clicked()
|
2010-06-17 16:57:37 +02:00
|
|
|
{
|
2010-06-19 10:41:56 +02:00
|
|
|
zoomIn();
|
2010-06-17 16:57:37 +02:00
|
|
|
}
|
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
void OPMapGadgetWidget::on_toolButtonZoomM_clicked()
|
2010-06-17 16:57:37 +02:00
|
|
|
{
|
2010-06-19 10:41:56 +02:00
|
|
|
zoomOut();
|
2010-06-17 16:57:37 +02:00
|
|
|
}
|
|
|
|
|
2010-06-17 17:48:43 +02:00
|
|
|
void OPMapGadgetWidget::on_pushButtonGeoFenceM_clicked()
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (controlpanel_ui)
|
|
|
|
{
|
|
|
|
int geo_fence_distance = controlpanel_ui->spinBoxGeoFenceDistance->value();
|
|
|
|
int step = controlpanel_ui->spinBoxGeoFenceDistance->singleStep();
|
|
|
|
controlpanel_ui->spinBoxGeoFenceDistance->setValue(geo_fence_distance - step);
|
2010-06-17 17:48:43 +02:00
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
geo_fence_distance = controlpanel_ui->spinBoxGeoFenceDistance->value();
|
|
|
|
}
|
2010-06-19 10:41:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
// to do
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-17 17:48:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::on_pushButtonGeoFenceP_clicked()
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (controlpanel_ui)
|
|
|
|
{
|
|
|
|
int geo_fence_distance = controlpanel_ui->spinBoxGeoFenceDistance->value();
|
|
|
|
int step = controlpanel_ui->spinBoxGeoFenceDistance->singleStep();
|
|
|
|
controlpanel_ui->spinBoxGeoFenceDistance->setValue(geo_fence_distance + step);
|
2010-06-19 10:41:56 +02:00
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
geo_fence_distance = controlpanel_ui->spinBoxGeoFenceDistance->value();
|
|
|
|
}
|
2010-06-19 10:41:56 +02:00
|
|
|
|
|
|
|
// to do
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-17 17:48:43 +02:00
|
|
|
}
|
|
|
|
|
2010-06-20 10:51:18 +02:00
|
|
|
// *************************************************************************************
|
|
|
|
// public functions
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::zoomIn()
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
|
|
|
m_map->SetZoom(m_map->Zoom() + 1);
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::zoomOut()
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
|
|
|
m_map->SetZoom(m_map->Zoom() - 1);
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::setZoom(int value)
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
|
|
|
m_map->SetZoom(value);
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::setPosition(QPointF pos)
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
|
|
|
m_map->SetCurrentPosition(internals::PointLatLng(pos.y(), pos.x()));
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::setMapProvider(QString provider)
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
|
|
|
if (m_map->isStarted())
|
|
|
|
m_map->SetMapType(mapcontrol::Helper::MapTypeFromString(provider));
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::setUseMemoryCache(bool useMemoryCache)
|
|
|
|
{
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
|
|
|
m_map->configuration->SetUseMemoryCache(useMemoryCache);
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::setCacheLocation(QString cacheLocation)
|
|
|
|
{
|
|
|
|
cacheLocation = cacheLocation.trimmed(); // remove any surrounding spaces
|
|
|
|
|
|
|
|
if (cacheLocation.isEmpty()) return;
|
|
|
|
|
|
|
|
#if defined(Q_WS_WIN)
|
|
|
|
if (!cacheLocation.endsWith('/')) cacheLocation += '/';
|
|
|
|
#elif defined(Q_WS_X11)
|
|
|
|
if (!cacheLocation.endsWith(QDir::separator())) cacheLocation += QDir::separator();
|
|
|
|
#elif defined(Q_WS_MAC)
|
|
|
|
if (!cacheLocation.endsWith(QDir::separator())) cacheLocation += QDir::separator();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
QDir dir;
|
|
|
|
if (!dir.exists(cacheLocation))
|
|
|
|
if (!dir.mkpath(cacheLocation))
|
|
|
|
return;
|
|
|
|
|
|
|
|
qDebug() << "map cache dir: " << cacheLocation;
|
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
if (m_map)
|
|
|
|
m_map->configuration->SetCacheLocation(cacheLocation);
|
2010-06-20 10:51:18 +02:00
|
|
|
}
|
|
|
|
|
2010-06-18 09:29:49 +02:00
|
|
|
// *************************************************************************************
|
|
|
|
// create some user controls overlayed onto the map area
|
|
|
|
|
|
|
|
QPushButton * OPMapGadgetWidget::createTransparentButton(QWidget *parent, QString text, QString icon)
|
|
|
|
{
|
|
|
|
QPixmap pix;
|
|
|
|
pix.load(icon);
|
|
|
|
|
|
|
|
QPushButton *but = new QPushButton(parent);
|
|
|
|
|
|
|
|
QColor transparent_color(0,0,0,0);
|
|
|
|
QPalette but_pal(but->palette());
|
|
|
|
|
|
|
|
but_pal.setColor(QPalette::Button, transparent_color);
|
|
|
|
but->setPalette(but_pal);
|
|
|
|
|
|
|
|
but->setIcon(pix);
|
|
|
|
but->setText(text);
|
|
|
|
but->setIconSize(pix.size());
|
|
|
|
|
|
|
|
return but;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::createMapOverlayUserControls()
|
|
|
|
{
|
2010-06-18 12:40:30 +02:00
|
|
|
QPushButton *zoomout = new QPushButton("");
|
|
|
|
zoomout->setToolTip(tr("Zoom out"));
|
|
|
|
zoomout->setCursor(Qt::OpenHandCursor);
|
2010-06-19 18:59:51 +02:00
|
|
|
zoomout->setFlat(true);
|
2010-06-18 12:40:30 +02:00
|
|
|
zoomout->setIcon(QIcon(QString::fromUtf8(":/opmap/images/minus.png")));
|
|
|
|
zoomout->setIconSize(QSize(32, 32));
|
2010-06-20 10:51:18 +02:00
|
|
|
zoomout->setFixedSize(28, 28);
|
2010-06-18 12:40:30 +02:00
|
|
|
connect(zoomout, SIGNAL(clicked(bool)), this, SLOT(zoomOut()));
|
|
|
|
|
|
|
|
// QPushButton *zoomin = createTransparentButton(map, "", QString::fromUtf8(":/core/images/plus.png"));
|
|
|
|
// zoomin->setStyleSheet("");
|
|
|
|
QPushButton *zoomin = new QPushButton("");
|
|
|
|
zoomin->setFlat(true);
|
2010-06-18 09:29:49 +02:00
|
|
|
zoomin->setToolTip(tr("Zoom in"));
|
|
|
|
zoomin->setCursor(Qt::OpenHandCursor);
|
2010-06-18 12:40:30 +02:00
|
|
|
zoomin->setIcon(QIcon(QString::fromUtf8(":/opmap/images/plus.png")));
|
|
|
|
// zoomin->setIconSize(QSize(12, 12));
|
2010-06-20 10:51:18 +02:00
|
|
|
zoomin->setIconSize(QSize(28, 28));
|
2010-06-18 12:40:30 +02:00
|
|
|
zoomin->setFixedSize(32, 32);
|
|
|
|
// zoomin->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
2010-06-18 09:29:49 +02:00
|
|
|
connect(zoomin, SIGNAL(clicked(bool)), this, SLOT(zoomIn()));
|
|
|
|
|
2010-06-20 00:16:10 +02:00
|
|
|
// statusLabel.font().setPointSize(20);
|
|
|
|
|
2010-06-18 12:40:30 +02:00
|
|
|
// add zoom buttons to the layout of the MapControl
|
|
|
|
QVBoxLayout* overlay_layout_v1 = new QVBoxLayout;
|
|
|
|
overlay_layout_v1->setMargin(4);
|
|
|
|
overlay_layout_v1->setSpacing(4);
|
|
|
|
|
|
|
|
QHBoxLayout* overlay_layout_h1 = new QHBoxLayout;
|
|
|
|
overlay_layout_h1->setMargin(0);
|
|
|
|
overlay_layout_h1->setSpacing(4);
|
|
|
|
// overlay_layout_h1->addWidget(gcsButton);
|
|
|
|
// overlay_layout_h1->addWidget(uavButton);
|
|
|
|
// overlay_layout_h1->addSpacing(10);
|
|
|
|
overlay_layout_h1->addWidget(zoomout);
|
|
|
|
overlay_layout_h1->addWidget(zoomin);
|
|
|
|
overlay_layout_h1->addStretch(0);
|
|
|
|
|
2010-06-20 00:16:10 +02:00
|
|
|
QHBoxLayout* overlay_layout_h2 = new QHBoxLayout;
|
|
|
|
overlay_layout_h2->setMargin(0);
|
|
|
|
overlay_layout_h2->setSpacing(4);
|
|
|
|
overlay_layout_h2->addStretch(0);
|
|
|
|
overlay_layout_h2->addWidget(&statusLabel);
|
|
|
|
overlay_layout_h2->addStretch(0);
|
|
|
|
|
|
|
|
overlay_layout_v1->addSpacing(10);
|
2010-06-18 12:40:30 +02:00
|
|
|
overlay_layout_v1->addLayout(overlay_layout_h1);
|
|
|
|
overlay_layout_v1->addStretch(0);
|
2010-06-20 00:16:10 +02:00
|
|
|
// overlay_layout_v1->addLayout(overlay_layout_h2);
|
|
|
|
overlay_layout_v1->addSpacing(10);
|
2010-06-18 12:40:30 +02:00
|
|
|
|
2010-06-20 18:27:18 +02:00
|
|
|
m_map->setLayout(overlay_layout_v1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// *************************************************************************************
|
|
|
|
// Context menu stuff
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::createActions()
|
|
|
|
{
|
|
|
|
// ***********************
|
|
|
|
// create the menu actions
|
|
|
|
|
|
|
|
closeAct = new QAction(tr("&Close menu"), this);
|
|
|
|
// closeAct->setShortcuts(QKeySequence::New);
|
|
|
|
closeAct->setStatusTip(tr("Close the context menu"));
|
|
|
|
|
|
|
|
reloadAct = new QAction(tr("&Reload map"), this);
|
|
|
|
reloadAct->setShortcut(tr("F5"));
|
|
|
|
reloadAct->setStatusTip(tr("Reload the map tiles"));
|
|
|
|
connect(reloadAct, SIGNAL(triggered()), this, SLOT(reload()));
|
|
|
|
|
|
|
|
findPlaceAct = new QAction(tr("&Find place"), this);
|
|
|
|
findPlaceAct->setShortcut(tr("Ctrl+F"));
|
|
|
|
findPlaceAct->setStatusTip(tr("Find a location"));
|
|
|
|
connect(findPlaceAct, SIGNAL(triggered()), this, SLOT(findPlace()));
|
|
|
|
|
|
|
|
zoomInAct = new QAction(tr("Zoom &In"), this);
|
|
|
|
zoomInAct->setShortcut(tr("PageDown"));
|
|
|
|
zoomInAct->setStatusTip(tr("Zoom the map in"));
|
|
|
|
connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn()));
|
|
|
|
|
|
|
|
zoomOutAct = new QAction(tr("Zoom &Out"), this);
|
|
|
|
zoomOutAct->setShortcut(tr("PageUp"));
|
|
|
|
zoomOutAct->setStatusTip(tr("Zoom the map out"));
|
|
|
|
connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut()));
|
|
|
|
|
|
|
|
goHomeAct = new QAction(tr("Go too &Home location"), this);
|
|
|
|
goHomeAct->setShortcut(tr("Ctrl+H"));
|
|
|
|
goHomeAct->setStatusTip(tr("Center the map onto the home location"));
|
|
|
|
connect(goHomeAct, SIGNAL(triggered()), this, SLOT(goHome()));
|
|
|
|
|
|
|
|
goUAVAct = new QAction(tr("Go too &UAV location"), this);
|
|
|
|
goUAVAct->setShortcut(tr("Ctrl+U"));
|
|
|
|
goUAVAct->setStatusTip(tr("Center the map onto the UAV location"));
|
|
|
|
connect(goUAVAct, SIGNAL(triggered()), this, SLOT(goUAV()));
|
|
|
|
|
|
|
|
followUAVAct = new QAction(tr("Follow UAV"), this);
|
|
|
|
followUAVAct->setShortcut(tr("Ctrl+F"));
|
|
|
|
followUAVAct->setStatusTip(tr("Keep the map centered onto the UAV"));
|
|
|
|
followUAVAct->setCheckable(true);
|
|
|
|
followUAVAct->setChecked(false);
|
|
|
|
connect(followUAVAct, SIGNAL(triggered()), this, SLOT(followUAV()));
|
|
|
|
|
|
|
|
wayPointEditorAct = new QAction(tr("&Way point editor"), this);
|
|
|
|
wayPointEditorAct->setShortcut(tr("Ctrl+W"));
|
|
|
|
wayPointEditorAct->setStatusTip(tr("Open the way-point editor"));
|
|
|
|
connect(wayPointEditorAct, SIGNAL(triggered()), this, SLOT(openWayPointEditor()));
|
|
|
|
|
|
|
|
addWayPointAct = new QAction(tr("&Add waypoint"), this);
|
|
|
|
addWayPointAct->setShortcut(tr("Ctrl+A"));
|
|
|
|
addWayPointAct->setStatusTip(tr("Add waypoint"));
|
|
|
|
connect(addWayPointAct, SIGNAL(triggered()), this, SLOT(addWayPoint()));
|
|
|
|
|
|
|
|
deleteWayPointAct = new QAction(tr("&Delete waypoint"), this);
|
|
|
|
deleteWayPointAct->setShortcut(tr("Ctrl+D"));
|
|
|
|
deleteWayPointAct->setStatusTip(tr("Delete waypoint"));
|
|
|
|
connect(deleteWayPointAct, SIGNAL(triggered()), this, SLOT(deleteWayPoint()));
|
|
|
|
|
|
|
|
clearWayPointsAct = new QAction(tr("&Clear waypoints"), this);
|
|
|
|
clearWayPointsAct->setShortcut(tr("Ctrl+C"));
|
|
|
|
clearWayPointsAct->setStatusTip(tr("Clear waypoints"));
|
|
|
|
connect(clearWayPointsAct, SIGNAL(triggered()), this, SLOT(clearWayPoints()));
|
|
|
|
|
|
|
|
gridLinesAct = new QAction(tr("Grid lines"), this);
|
|
|
|
gridLinesAct->setShortcut(tr("Ctrl+G"));
|
|
|
|
gridLinesAct->setStatusTip(tr("Show/Hide grid lines"));
|
|
|
|
gridLinesAct->setCheckable(true);
|
|
|
|
gridLinesAct->setChecked(false);
|
|
|
|
connect(gridLinesAct, SIGNAL(triggered()), this, SLOT(gridLines()));
|
|
|
|
|
|
|
|
openGLAct = new QAction(tr("Use OpenGL"), this);
|
|
|
|
openGLAct->setShortcut(tr("Ctrl+O"));
|
|
|
|
openGLAct->setStatusTip(tr("Enable/Disable OpenGL"));
|
|
|
|
openGLAct->setCheckable(true);
|
|
|
|
openGLAct->setChecked(false);
|
|
|
|
connect(openGLAct, SIGNAL(triggered()), this, SLOT(openGL()));
|
|
|
|
|
|
|
|
zoom2Act = new QAction(tr("2"), this);
|
|
|
|
zoom2Act->setCheckable(true);
|
|
|
|
connect(zoom2Act, SIGNAL(triggered()), this, SLOT(zoom2()));
|
|
|
|
zoom3Act = new QAction(tr("3"), this);
|
|
|
|
zoom3Act->setCheckable(true);
|
|
|
|
connect(zoom3Act, SIGNAL(triggered()), this, SLOT(zoom3()));
|
|
|
|
zoom4Act = new QAction(tr("4"), this);
|
|
|
|
zoom4Act->setCheckable(true);
|
|
|
|
connect(zoom4Act, SIGNAL(triggered()), this, SLOT(zoom4()));
|
|
|
|
zoom5Act = new QAction(tr("5"), this);
|
|
|
|
zoom5Act->setCheckable(true);
|
|
|
|
connect(zoom5Act, SIGNAL(triggered()), this, SLOT(zoom5()));
|
|
|
|
zoom6Act = new QAction(tr("6"), this);
|
|
|
|
zoom6Act->setCheckable(true);
|
|
|
|
connect(zoom6Act, SIGNAL(triggered()), this, SLOT(zoom6()));
|
|
|
|
zoom7Act = new QAction(tr("7"), this);
|
|
|
|
zoom7Act->setCheckable(true);
|
|
|
|
connect(zoom7Act, SIGNAL(triggered()), this, SLOT(zoom7()));
|
|
|
|
zoom8Act = new QAction(tr("8"), this);
|
|
|
|
zoom8Act->setCheckable(true);
|
|
|
|
connect(zoom8Act, SIGNAL(triggered()), this, SLOT(zoom8()));
|
|
|
|
zoom9Act = new QAction(tr("9"), this);
|
|
|
|
zoom9Act->setCheckable(true);
|
|
|
|
connect(zoom9Act, SIGNAL(triggered()), this, SLOT(zoom9()));
|
|
|
|
zoom10Act = new QAction(tr("10"), this);
|
|
|
|
zoom10Act->setCheckable(true);
|
|
|
|
connect(zoom10Act, SIGNAL(triggered()), this, SLOT(zoom10()));
|
|
|
|
zoom11Act = new QAction(tr("11"), this);
|
|
|
|
zoom11Act->setCheckable(true);
|
|
|
|
connect(zoom11Act, SIGNAL(triggered()), this, SLOT(zoom11()));
|
|
|
|
zoom12Act = new QAction(tr("12"), this);
|
|
|
|
zoom12Act->setCheckable(true);
|
|
|
|
connect(zoom12Act, SIGNAL(triggered()), this, SLOT(zoom12()));
|
|
|
|
zoom13Act = new QAction(tr("13"), this);
|
|
|
|
zoom13Act->setCheckable(true);
|
|
|
|
connect(zoom13Act, SIGNAL(triggered()), this, SLOT(zoom13()));
|
|
|
|
zoom14Act = new QAction(tr("14"), this);
|
|
|
|
zoom14Act->setCheckable(true);
|
|
|
|
connect(zoom14Act, SIGNAL(triggered()), this, SLOT(zoom14()));
|
|
|
|
zoom15Act = new QAction(tr("15"), this);
|
|
|
|
zoom15Act->setCheckable(true);
|
|
|
|
connect(zoom15Act, SIGNAL(triggered()), this, SLOT(zoom15()));
|
|
|
|
zoom16Act = new QAction(tr("16"), this);
|
|
|
|
zoom16Act->setCheckable(true);
|
|
|
|
connect(zoom16Act, SIGNAL(triggered()), this, SLOT(zoom16()));
|
|
|
|
zoom17Act = new QAction(tr("17"), this);
|
|
|
|
zoom17Act->setCheckable(true);
|
|
|
|
connect(zoom17Act, SIGNAL(triggered()), this, SLOT(zoom17()));
|
|
|
|
zoomActGroup = new QActionGroup(this);
|
|
|
|
zoomActGroup->addAction(zoom2Act);
|
|
|
|
zoomActGroup->addAction(zoom3Act);
|
|
|
|
zoomActGroup->addAction(zoom4Act);
|
|
|
|
zoomActGroup->addAction(zoom5Act);
|
|
|
|
zoomActGroup->addAction(zoom6Act);
|
|
|
|
zoomActGroup->addAction(zoom7Act);
|
|
|
|
zoomActGroup->addAction(zoom8Act);
|
|
|
|
zoomActGroup->addAction(zoom9Act);
|
|
|
|
zoomActGroup->addAction(zoom10Act);
|
|
|
|
zoomActGroup->addAction(zoom11Act);
|
|
|
|
zoomActGroup->addAction(zoom12Act);
|
|
|
|
zoomActGroup->addAction(zoom13Act);
|
|
|
|
zoomActGroup->addAction(zoom14Act);
|
|
|
|
zoomActGroup->addAction(zoom15Act);
|
|
|
|
zoomActGroup->addAction(zoom16Act);
|
|
|
|
zoomActGroup->addAction(zoom17Act);
|
|
|
|
|
|
|
|
// ***********************
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::reload()
|
|
|
|
{
|
|
|
|
if (m_map)
|
|
|
|
m_map->ReloadMap();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::findPlace()
|
|
|
|
{
|
|
|
|
bool ok;
|
|
|
|
QString text = QInputDialog::getText(this, tr("GCS"), tr("Find place"), QLineEdit::Normal, QString::null, &ok);
|
|
|
|
if (ok && !text.isEmpty())
|
|
|
|
{
|
|
|
|
if (m_map)
|
|
|
|
{
|
|
|
|
core::GeoCoderStatusCode::Types x = m_map->SetCurrentPositionByKeywords(text);
|
|
|
|
QString returned_text = mapcontrol::Helper::StrFromGeoCoderStatusCode(x);
|
|
|
|
|
|
|
|
int ret = QMessageBox::information(this, tr("GCS"), returned_text, QMessageBox::Ok);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::goHome()
|
|
|
|
{
|
|
|
|
followUAVAct->setChecked(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::goUAV()
|
|
|
|
{
|
|
|
|
PositionActual::DataFields data = m_positionActual->getData(); // get current UAV data
|
|
|
|
|
|
|
|
if (m_map)
|
|
|
|
{
|
|
|
|
internals::PointLatLng uav_pos = internals::PointLatLng(data.Latitude, data.Longitude); // current UAV position
|
|
|
|
internals::PointLatLng map_pos = m_map->CurrentPosition(); // current MAP position
|
|
|
|
if (map_pos != uav_pos) m_map->SetCurrentPosition(uav_pos); // center the map onto the UAV
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::followUAV()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::openWayPointEditor()
|
|
|
|
{
|
|
|
|
// to do
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::addWayPoint()
|
|
|
|
{
|
|
|
|
// to do
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::deleteWayPoint()
|
|
|
|
{
|
|
|
|
// to do
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::clearWayPoints()
|
|
|
|
{
|
|
|
|
// to do
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::gridLines()
|
|
|
|
{
|
|
|
|
if (m_map)
|
|
|
|
m_map->SetShowTileGridLines(gridLinesAct->isChecked());
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPMapGadgetWidget::openGL()
|
|
|
|
{
|
|
|
|
if (m_map)
|
|
|
|
m_map->SetUseOpenGL(openGLAct->isChecked());
|
2010-06-18 09:29:49 +02:00
|
|
|
}
|
2010-06-17 17:48:43 +02:00
|
|
|
|
2010-06-17 16:57:37 +02:00
|
|
|
// *************************************************************************************
|