mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
OP-37 GCS/MapPlugin testproject dropdown box for map provider choice.
New map widget is able to display maps from: GoogleMap,GoogleSatellite,GoogleLabels,GoogleTerrain,GoogleHybrid,GoogleMapChina,GoogleSatelliteChina,GoogleLabelsChina,GoogleTerrainChina,GoogleHybridChina, OpenStreetMap,OpenStreetOsm,OpenStreetMapSurfer,OpenStreetMapSurferTerrain,YahooMap,YahooSatellite,YahooLabels,YahooHybrid,BingMap,BingSatellite,BingHybrid, ArcGIS_Map,ArcGIS_Satellite,ArcGIS_ShadedRelief,ArcGIS_Terrain,ArcGIS_MapsLT_Map, ArcGIS_MapsLT_OrtoFoto,ArcGIS_MapsLT_Map_Labels,ArcGIS_MapsLT_Map_Hybrid, PergoTurkeyMap,SigPacSpainMap,GoogleMapKorea,GoogleSatelliteKorea, GoogleLabelsKorea,GoogleHybridKorea,YandexMapRu git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@753 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
5f78ee2f1c
commit
8efae87949
@ -27,11 +27,16 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef MAPTYPE_H
|
#ifndef MAPTYPE_H
|
||||||
#define MAPTYPE_H
|
#define MAPTYPE_H
|
||||||
|
#include <QMetaObject>
|
||||||
|
#include <QMetaEnum>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
namespace core {
|
namespace core {
|
||||||
struct MapType
|
class MapType:public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_ENUMS(Types)
|
||||||
|
public:
|
||||||
enum Types
|
enum Types
|
||||||
{
|
{
|
||||||
GoogleMap=1,
|
GoogleMap=1,
|
||||||
@ -94,6 +99,32 @@ struct MapType
|
|||||||
|
|
||||||
YandexMapRu = 5000,
|
YandexMapRu = 5000,
|
||||||
};
|
};
|
||||||
|
static QString StrByType(Types const& value)
|
||||||
|
{
|
||||||
|
QMetaObject metaObject = MapType().staticMetaObject;
|
||||||
|
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
|
||||||
|
QString s=metaEnum.valueToKey(value);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
static Types TypeByStr(QString const& value)
|
||||||
|
{
|
||||||
|
QMetaObject metaObject = MapType().staticMetaObject;
|
||||||
|
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
|
||||||
|
Types s=(Types)metaEnum.keyToValue(value.toLatin1());
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
static QStringList TypesList()
|
||||||
|
{
|
||||||
|
QStringList ret;
|
||||||
|
QMetaObject metaObject = MapType().staticMetaObject;
|
||||||
|
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
|
||||||
|
for(int x=0;x<metaEnum.keyCount();++x)
|
||||||
|
{
|
||||||
|
ret.append(metaEnum.key(x));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // MAPTYPE_H
|
#endif // MAPTYPE_H
|
||||||
|
@ -6,8 +6,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::MainWindow)
|
ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
|
||||||
map=new mapcontrol::OPMapWidget();
|
map=new mapcontrol::OPMapWidget();
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->comboBox->addItems(map->MapTypes());
|
||||||
|
ui->comboBox->setCurrentIndex(map->MapTypes().indexOf("GoogleHybrid"));
|
||||||
QHBoxLayout *layout=new QHBoxLayout(parent);
|
QHBoxLayout *layout=new QHBoxLayout(parent);
|
||||||
layout->addWidget(map);
|
layout->addWidget(map);
|
||||||
layout->addWidget(ui->widget);
|
layout->addWidget(ui->widget);
|
||||||
@ -78,7 +80,7 @@ void MainWindow::on_pushButton_clicked()
|
|||||||
void MainWindow::on_pushButtonGO_clicked()
|
void MainWindow::on_pushButtonGO_clicked()
|
||||||
{
|
{
|
||||||
core::GeoCoderStatusCode::Types x=map->SetCurrentPositionByKeywords(ui->lineEdit->text());
|
core::GeoCoderStatusCode::Types x=map->SetCurrentPositionByKeywords(ui->lineEdit->text());
|
||||||
ui->label->setText( map->geodecoderstatus.StrByType(x));
|
ui->label->setText( map->StrFromGeoCoderStatusCode(x));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,3 +88,9 @@ void MainWindow::on_checkBox_2_clicked(bool checked)
|
|||||||
{
|
{
|
||||||
map->SetUseOpenGL(checked);
|
map->SetUseOpenGL(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_comboBox_currentIndexChanged(QString value)
|
||||||
|
{
|
||||||
|
if (map->isStarted())
|
||||||
|
map->SetMapType(map->MapTypeFromString(value));
|
||||||
|
}
|
||||||
|
@ -21,6 +21,7 @@ private:
|
|||||||
mapcontrol::OPMapWidget *map;
|
mapcontrol::OPMapWidget *map;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void on_comboBox_currentIndexChanged(QString );
|
||||||
void on_checkBox_2_clicked(bool checked);
|
void on_checkBox_2_clicked(bool checked);
|
||||||
void on_pushButtonGO_clicked();
|
void on_pushButtonGO_clicked();
|
||||||
void on_pushButton_clicked();
|
void on_pushButton_clicked();
|
||||||
|
@ -44,6 +44,18 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>MapType</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
** Form generated from reading UI file 'mainwindow.ui'
|
** Form generated from reading UI file 'mainwindow.ui'
|
||||||
**
|
**
|
||||||
** Created: Sat 12. Jun 21:18:37 2010
|
** Created: Sat 12. Jun 23:14:21 2010
|
||||||
** by: Qt User Interface Compiler version 4.6.2
|
** by: Qt User Interface Compiler version 4.6.2
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
@ -15,6 +15,7 @@
|
|||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QButtonGroup>
|
#include <QtGui/QButtonGroup>
|
||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QDoubleSpinBox>
|
#include <QtGui/QDoubleSpinBox>
|
||||||
#include <QtGui/QGroupBox>
|
#include <QtGui/QGroupBox>
|
||||||
#include <QtGui/QHBoxLayout>
|
#include <QtGui/QHBoxLayout>
|
||||||
@ -38,6 +39,9 @@ public:
|
|||||||
QWidget *widget;
|
QWidget *widget;
|
||||||
QVBoxLayout *verticalLayout_4;
|
QVBoxLayout *verticalLayout_4;
|
||||||
QVBoxLayout *verticalLayout_3;
|
QVBoxLayout *verticalLayout_3;
|
||||||
|
QGroupBox *groupBox_5;
|
||||||
|
QVBoxLayout *verticalLayout_8;
|
||||||
|
QComboBox *comboBox;
|
||||||
QGroupBox *groupBox;
|
QGroupBox *groupBox;
|
||||||
QVBoxLayout *verticalLayout_6;
|
QVBoxLayout *verticalLayout_6;
|
||||||
QVBoxLayout *verticalLayout_5;
|
QVBoxLayout *verticalLayout_5;
|
||||||
@ -90,6 +94,20 @@ public:
|
|||||||
verticalLayout_3 = new QVBoxLayout();
|
verticalLayout_3 = new QVBoxLayout();
|
||||||
verticalLayout_3->setSpacing(6);
|
verticalLayout_3->setSpacing(6);
|
||||||
verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3"));
|
verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3"));
|
||||||
|
groupBox_5 = new QGroupBox(widget);
|
||||||
|
groupBox_5->setObjectName(QString::fromUtf8("groupBox_5"));
|
||||||
|
verticalLayout_8 = new QVBoxLayout(groupBox_5);
|
||||||
|
verticalLayout_8->setSpacing(6);
|
||||||
|
verticalLayout_8->setContentsMargins(11, 11, 11, 11);
|
||||||
|
verticalLayout_8->setObjectName(QString::fromUtf8("verticalLayout_8"));
|
||||||
|
comboBox = new QComboBox(groupBox_5);
|
||||||
|
comboBox->setObjectName(QString::fromUtf8("comboBox"));
|
||||||
|
|
||||||
|
verticalLayout_8->addWidget(comboBox);
|
||||||
|
|
||||||
|
|
||||||
|
verticalLayout_3->addWidget(groupBox_5);
|
||||||
|
|
||||||
groupBox = new QGroupBox(widget);
|
groupBox = new QGroupBox(widget);
|
||||||
groupBox->setObjectName(QString::fromUtf8("groupBox"));
|
groupBox->setObjectName(QString::fromUtf8("groupBox"));
|
||||||
verticalLayout_6 = new QVBoxLayout(groupBox);
|
verticalLayout_6 = new QVBoxLayout(groupBox);
|
||||||
@ -242,6 +260,7 @@ public:
|
|||||||
void retranslateUi(QMainWindow *MainWindow)
|
void retranslateUi(QMainWindow *MainWindow)
|
||||||
{
|
{
|
||||||
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
|
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
|
||||||
|
groupBox_5->setTitle(QApplication::translate("MainWindow", "MapType", 0, QApplication::UnicodeUTF8));
|
||||||
groupBox->setTitle(QApplication::translate("MainWindow", "Goto Place", 0, QApplication::UnicodeUTF8));
|
groupBox->setTitle(QApplication::translate("MainWindow", "Goto Place", 0, QApplication::UnicodeUTF8));
|
||||||
pushButtonGO->setText(QApplication::translate("MainWindow", "GO", 0, QApplication::UnicodeUTF8));
|
pushButtonGO->setText(QApplication::translate("MainWindow", "GO", 0, QApplication::UnicodeUTF8));
|
||||||
label->setText(QApplication::translate("MainWindow", "GeoCoderStatusCode", 0, QApplication::UnicodeUTF8));
|
label->setText(QApplication::translate("MainWindow", "GeoCoderStatusCode", 0, QApplication::UnicodeUTF8));
|
||||||
|
@ -62,13 +62,10 @@ namespace mapcontrol
|
|||||||
|
|
||||||
namespace internals {
|
namespace internals {
|
||||||
|
|
||||||
class MouseWheelZoomType;
|
|
||||||
|
|
||||||
class Core:public QObject,public QRunnable
|
class Core:public QObject,public QRunnable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(core::GeoCoderStatusCode::Types);
|
|
||||||
Q_ENUMS(MouseWheelZoomType::Types);
|
|
||||||
friend class mapcontrol::OPMapControl;
|
friend class mapcontrol::OPMapControl;
|
||||||
friend class mapcontrol::MapGraphicItem;
|
friend class mapcontrol::MapGraphicItem;
|
||||||
public:
|
public:
|
||||||
@ -189,6 +186,8 @@ public:
|
|||||||
|
|
||||||
TileMatrix Matrix;
|
TileMatrix Matrix;
|
||||||
|
|
||||||
|
bool isStarted(){return started;}
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void OnCurrentPositionChanged(PointLatLng point);
|
void OnCurrentPositionChanged(PointLatLng point);
|
||||||
|
@ -77,6 +77,9 @@ private:
|
|||||||
void start();
|
void start();
|
||||||
void ReloadMap(){core->ReloadMap();}
|
void ReloadMap(){core->ReloadMap();}
|
||||||
GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const& keys){return core->SetCurrentPositionByKeywords(keys);}
|
GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const& keys){return core->SetCurrentPositionByKeywords(keys);}
|
||||||
|
MapType::Types GetMapType(){return core->GetMapType();}
|
||||||
|
void SetMapType(MapType::Types const& value){core->SetMapType(value);}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void Core_OnNeedInvalidation();
|
void Core_OnNeedInvalidation();
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -3,10 +3,17 @@
|
|||||||
|
|
||||||
#include "../mapwidget/mapgraphicitem.h"
|
#include "../mapwidget/mapgraphicitem.h"
|
||||||
#include "../core/geodecoderstatus.h"
|
#include "../core/geodecoderstatus.h"
|
||||||
|
#include "../core/maptype.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
namespace mapcontrol
|
namespace mapcontrol
|
||||||
{
|
{
|
||||||
|
class Helper
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class OPMapWidget:public QGraphicsView
|
class OPMapWidget:public QGraphicsView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -21,7 +28,13 @@ namespace mapcontrol
|
|||||||
Q_ENUMS(internals::MouseWheelZoomType::Types)
|
Q_ENUMS(internals::MouseWheelZoomType::Types)
|
||||||
Q_ENUMS(internals::GeoCoderStatusCode::Types)
|
Q_ENUMS(internals::GeoCoderStatusCode::Types)
|
||||||
public:
|
public:
|
||||||
GeoCoderStatusCode geodecoderstatus;
|
GeoCoderStatusCode x;
|
||||||
|
MapType y;
|
||||||
|
MapType::Types MapTypeFromString(QString const& value){return MapType::TypeByStr(value);}
|
||||||
|
QString StrFromMapType(MapType::Types const& value){return MapType::StrByType(value);}
|
||||||
|
QStringList MapTypes(){return MapType::TypesList();}
|
||||||
|
GeoCoderStatusCode::Types GeoCoderStatusCodeFromString(QString const& value){return GeoCoderStatusCode::TypeByStr(value);}
|
||||||
|
QString StrFromGeoCoderStatusCode(GeoCoderStatusCode::Types const& value){return GeoCoderStatusCode::StrByType(value);}
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
OPMapWidget(QWidget *parent=0);
|
OPMapWidget(QWidget *parent=0);
|
||||||
~OPMapWidget();
|
~OPMapWidget();
|
||||||
@ -49,6 +62,9 @@ namespace mapcontrol
|
|||||||
GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const& keys){return map->SetCurrentPositionByKeywords(keys);}
|
GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const& keys){return map->SetCurrentPositionByKeywords(keys);}
|
||||||
bool UseOpenGL(){return useOpenGL;}
|
bool UseOpenGL(){return useOpenGL;}
|
||||||
void SetUseOpenGL(bool const& value);
|
void SetUseOpenGL(bool const& value);
|
||||||
|
MapType::Types GetMapType(){return map->core->GetMapType();}
|
||||||
|
void SetMapType(MapType::Types const& value){map->core->SetMapType(value);}
|
||||||
|
bool isStarted(){return map->core->isStarted();}
|
||||||
private:
|
private:
|
||||||
Core *core;
|
Core *core;
|
||||||
MapGraphicItem *map;
|
MapGraphicItem *map;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user