dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
opmapgadget.cpp
Go to the documentation of this file.
1 
13 /*
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  * for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  */
27 #include "opmapgadget.h"
28 #include "opmapgadgetwidget.h"
29 
30 OPMapGadget::OPMapGadget(QString classId, OPMapGadgetWidget *widget, QWidget *parent)
31  : IUAVGadget(classId, parent)
32  , m_widget(widget)
33  , m_config(NULL)
34 {
35  connect(m_widget, &OPMapGadgetWidget::defaultLocationAndZoomChanged, this,
36  &OPMapGadget::saveDefaultLocation);
37  connect(m_widget, &OPMapGadgetWidget::overlayOpacityChanged, this, &OPMapGadget::saveOpacity);
38 }
39 
41 {
42  delete m_widget;
43 }
44 void OPMapGadget::saveDefaultLocation(double lng, double lat, double zoom)
45 {
46  if (m_config) {
47  m_config->setLatitude(lat);
48  m_config->setLongitude(lng);
49  m_config->setZoom(zoom);
50  m_config->saveConfig();
51  }
52 }
53 
54 void OPMapGadget::saveOpacity(qreal value)
55 {
56  if (m_config) {
57  m_config->setOpacity(value);
58  }
59 }
60 void OPMapGadget::loadConfiguration(IUAVGadgetConfiguration *config)
61 {
62  m_config = qobject_cast<OPMapGadgetConfiguration *>(config);
63  m_widget->setMapProvider(m_config->mapProvider());
64  m_widget->setShowTileGridLines(m_config->showTileGridLines());
65  m_widget->setAccessMode(m_config->accessMode());
66  m_widget->setUseMemoryCache(m_config->useMemoryCache());
67  m_widget->setCacheLocation(m_config->cacheLocation());
70  m_widget->setUserImageLocation(m_config->getUserImageLocation());
71  m_widget->SetUavPic(m_config->uavSymbol());
72  m_widget->setZoom(m_config->zoom());
73  m_widget->setPosition(QPointF(m_config->longitude(), m_config->latitude()));
74  m_widget->setOverlayOpacity(m_config->opacity());
75  m_widget->setGeoCodingLanguage(m_config->geoLanguage());
76 }
void setUseMemoryCache(bool useMemoryCache)
void setCacheLocation(QString cacheLocation)
void SetUavPic(QString UAVPic)
void setMapProvider(QString provider)
void loadConfiguration(IUAVGadgetConfiguration *m_config)
Definition: opmapgadget.cpp:60
OPMapGadget(QString classId, OPMapGadgetWidget *widget, QWidget *parent=nullptr)
Definition: opmapgadget.cpp:30
void overlayOpacityChanged(qreal)
void saveConfig(QSettings *settings) const
void setGeoCodingLanguage(QString language)
void setShowTileGridLines(bool showTileGridLines)
void setUserImageHorizontalScale(double userImageHorizontalScale)
void setLatitude(double latitude)
void setUserImageVerticalScale(double userImageVerticalScale)
void setPosition(QPointF pos)
void defaultLocationAndZoomChanged(double lng, double lat, double zoom)
void setOverlayOpacity(qreal value)
void setLongitude(double longitude)
void setUserImageLocation(QString userImageLocation)
void setAccessMode(QString accessMode)