OP-1900 have path_progress updated correctly for leg_remaining and error_below end...
[librepilot.git] / ground / openpilotgcs / src / plugins / opmap / opmapgadget.cpp
blob6facd9ef93cd5201fb81f97f73f2c100eba2c731
1 /**
2 ******************************************************************************
4 * @file opmapgadget.cpp
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
6 * @addtogroup GCSPlugins GCS Plugins
7 * @{
8 * @addtogroup OPMapPlugin OpenPilot Map Plugin
9 * @{
10 * @brief The OpenPilot Map plugin
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include "opmapgadget.h"
28 #include "opmapgadgetwidget.h"
30 OPMapGadget::OPMapGadget(QString classId, OPMapGadgetWidget *widget, QWidget *parent) :
31 IUAVGadget(classId, parent),
32 m_widget(widget), m_config(NULL)
34 connect(m_widget, SIGNAL(defaultLocationAndZoomChanged(double, double, double)), this, SLOT(saveDefaultLocation(double, double, double)));
35 connect(m_widget, SIGNAL(overlayOpacityChanged(qreal)), this, SLOT(saveOpacity(qreal)));
38 OPMapGadget::~OPMapGadget()
40 delete m_widget;
42 void OPMapGadget::saveDefaultLocation(double lng, double lat, double zoom)
44 if (m_config) {
45 m_config->setLatitude(lat);
46 m_config->setLongitude(lng);
47 m_config->setZoom(zoom);
48 m_config->saveConfig();
52 void OPMapGadget::saveOpacity(qreal value)
54 if (m_config) {
55 m_config->setOpacity(value);
58 void OPMapGadget::loadConfiguration(IUAVGadgetConfiguration *config)
60 m_config = qobject_cast<OPMapGadgetConfiguration *>(config);
61 m_widget->setMapProvider(m_config->mapProvider());
62 m_widget->setUseOpenGL(m_config->useOpenGL());
63 m_widget->setShowTileGridLines(m_config->showTileGridLines());
64 m_widget->setAccessMode(m_config->accessMode());
65 m_widget->setUseMemoryCache(m_config->useMemoryCache());
66 m_widget->setCacheLocation(m_config->cacheLocation());
67 m_widget->SetUavPic(m_config->uavSymbol());
68 m_widget->setZoom(m_config->zoom());
69 m_widget->setPosition(QPointF(m_config->longitude(), m_config->latitude()));
70 m_widget->setHomePosition(QPointF(m_config->longitude(), m_config->latitude()));
71 m_widget->setOverlayOpacity(m_config->opacity());