提交 77fb2e55 编写于 作者: 丁劲犇's avatar 丁劲犇 😸

Code Struct optimise.

上级 0f1a3a1f
__pycache__
/network
*.qm
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
build/
bld/
[Bb]in/
[Oo]bj/
# Roslyn cache directories
*.ide/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
#NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
*.pubxml
# NuGet Packages
packages/*
*.nupkg
## TODO: If the tool you use requires repositories.config
## uncomment the next line
#!packages/repositories.config
# Enable "build/" folder in the NuGet Packages folder since
# NuGet packages use it for MSBuild targets.
# This line needs to be after the ignore of the build folder
# (and the packages folder if the line above has been uncommented)
!packages/build/
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.dll
*.dylib
# Qt-es
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.moc
moc_*.cpp
qrc_*.cpp
ui_*.h
Makefile*
*-build-*
# QtCreator
*.autosave
build-*-Debug
build-*-Release
*.bak
*.qm
*_Saved
\ No newline at end of file
#pragma once
#include <QVariant>
#include <QMap>
#include <QString>
#include <QVariant>
#define QTVOSM_DEBUG(MSG) qDebug()<<"QTVOSM Debug>"<< MSG <<"\n\t"<<__FUNCTION__<<":"<<__FILE__<<__LINE__
#define QTVOSM_WARNING(MSG) qWarning()<<"QTVOSM Debug>"<< MSG <<"\n\t"<<__FUNCTION__<<":"<<__FILE__<<__LINE__
#define QTVOSM_FATAL(MSG) qFatal()<<"QTVOSM Debug>"<< MSG <<"\n\t"<<__FUNCTION__<<":"<<__FILE__<<__LINE__
/**
* @brief map_to_string Convert QMap key-value paires to string
* @param m map. m["A"]=12, m["B"] = "Yes"
* @return string , eg: "A=12;B=Yes;"
*/
inline QString map_to_string(const QMap<QString, QVariant> & m)
{
QString s;
for(QMap<QString, QVariant>::const_iterator p = m.begin();p!=m.end();++p)
{
s += p.key();
s += "=";
s += p.value().toString();
s += ";";
}
return /*std::move*/(s);
}
/*!
* \brief string_to_map Convert string to key-value map
* \param s string, eg: "A=12;B=Yes;"
* \return map. map["A"]=12, map["B"] = "Yes"
*/
inline QMap<QString, QVariant> string_to_map(const QString & s)
{
QMap<QString, QVariant> res;
QStringList lst = s.split(";");
foreach (QString s, lst)
{
int t = s.indexOf("=");
if (t>0 && t< s.size())
{
QString name = s.left(t).trimmed();
QString value = s.mid(t+1).trimmed();
res[name] = value;
}
}
return /*std::move*/(res);
}
......@@ -11,7 +11,7 @@
#include <QSettings>
#include <QMessageBox>
#include "osmtiles/viewer_interface.h"
#include "interface_utils.h"
QMutex osm_frame_widget::m_mutex_proteced;
/*!
......
......@@ -2,7 +2,7 @@
#include <math.h>
namespace QTVOSM
{
/*! cProjectionMercator is a toolkit class that turns coordinates between LLA(4326) and Mercator(900913)
/*! cProjectionMercator is a toolkit class that turns coordinates between LLA(4326) and Mercator(3857 )
cProjectionMercator cProjectionMercator.h "qtviewer_planetosm/osmtiles/cProjectionMercator.h"
\author goldenhawking \date 2015-12-11
*/
......
......@@ -7,9 +7,6 @@
#include <QVariant>
#include <QMap>
#define OSMLayerInterface_iid "org.goldenhawkingStudio.OSMViewer_iid.LayerInterface"
#define QTVOSM_DEBUG(MSG) qDebug()<<"QTVOSM Debug>"<< MSG <<"\n\t"<<__FUNCTION__<<":"<<__FILE__<<__LINE__
#define QTVOSM_WARNING(MSG) qWarning()<<"QTVOSM Debug>"<< MSG <<"\n\t"<<__FUNCTION__<<":"<<__FILE__<<__LINE__
#define QTVOSM_FATAL(MSG) qFatal()<<"QTVOSM Debug>"<< MSG <<"\n\t"<<__FUNCTION__<<":"<<__FILE__<<__LINE__
class osm_frame_widget;
class qtaxviewer_planetosm;
class qtwidget_planetosm;
......@@ -95,9 +92,9 @@ namespace QTVOSM
public:
//user-def direct function calls
virtual QMap<QString, QVariant> call_func(const QMap<QString, QVariant> & /*paras*/){return ( QMap<QString, QVariant>());}
};
}
Q_DECLARE_INTERFACE(QTVOSM::layer_interface, OSMLayerInterface_iid)
#endif // LAYER_BASE_H
......@@ -8,6 +8,7 @@
#include <QFileInfo>
#include <QDir>
#include "layer_interface.h"
#include "interface_utils.h"
namespace QTVOSM{
tilesviewer::tilesviewer(QWidget *parent) :
QWidget(parent)
......@@ -707,7 +708,7 @@ namespace QTVOSM{
}
/*!
\brief convert Mercator to LLA.Mercator coord is a projection with ID 900913.
\brief convert Mercator to LLA.Mercator coord is a projection with ID 3857 .
this method is NOT Level releated.
\fn tilesviewer::CV_MK2LLA
......@@ -726,7 +727,7 @@ namespace QTVOSM{
}
/*!
\brief convert LLA to Mercator .Mercator coord is a projection with ID 900913.
\brief convert LLA to Mercator .Mercator coord is a projection with ID 3857 .
this method is NOT Level releated.
\fn tilesviewer::CV_LLA2MK
......
......@@ -8,6 +8,7 @@
#include <functional>
#include "osmtiles/tilesviewer.h"
#include "osmtiles/layer_tiles.h"
#include "interface_utils.h"
qtaxviewer_planetosm::qtaxviewer_planetosm(QWidget *parent )
:osm_frame_widget(parent)
{
......@@ -406,36 +407,6 @@ int qtaxviewer_planetosm::osm_layer_move_bottom(QString layerName)
}
return 0;
}
QString qtaxviewer_planetosm::map_to_string(const QMap<QString, QVariant> & m)
{
QString s;
for(QMap<QString, QVariant>::const_iterator p = m.begin();p!=m.end();++p)
{
s += p.key();
s += "=";
s += p.value().toString();
s += ";";
}
return /*std::move*/(s);
}
QMap<QString, QVariant> qtaxviewer_planetosm::string_to_map(const QString & s)
{
QMap<QString, QVariant> res;
QStringList lst = s.split(";");
foreach (QString s, lst)
{
int t = s.indexOf("=");
if (t>0 && t< s.size())
{
QString name = s.left(t).trimmed();
QString value = s.mid(t+1).trimmed();
res[name] = value;
}
}
return /*std::move*/(res);
}
/**
* @brief osm_layer_call_function call layers' call_func method from
* outside the ocx ctrl. Please MAKE SURE that this function is called from UI thread,
......
......@@ -17,9 +17,6 @@
class qtaxviewer_planetosm :public osm_frame_widget, public QAxBindable
{
Q_OBJECT
private:
QString map_to_string(const QMap<QString, QVariant> & m);
QMap<QString, QVariant> string_to_map(const QString & s);
protected:
QTranslator qtTranslator;
QTranslator appTranslator;
......
......@@ -30,7 +30,8 @@ HEADERS += osm_frame_widget.h \
osmtiles/layer_browser.h \
osmtiles/layer_interface.h \
osmtiles/viewer_interface.h \
osmtiles/layer_tiles_page.h
osmtiles/layer_tiles_page.h \
interface_utils.h
FORMS += osm_frame_widget.ui \
osmtiles/layer_tiles_page.ui
......
......@@ -8,7 +8,7 @@
#include <assert.h>
#include "osmtiles/tilesviewer.h"
#include "osmtiles/layer_tiles.h"
#include "interface_utils.h"
qtwidget_planetosm::qtwidget_planetosm(QWidget *parent )
:QWidget(parent)
,m_map_widget(0)
......@@ -381,35 +381,7 @@ int qtwidget_planetosm::osm_layer_move_bottom(QString layerName)
}
return 0;
}
QString qtwidget_planetosm::map_to_string(const QMap<QString, QVariant> & m)
{
QString s;
for(QMap<QString, QVariant>::const_iterator p = m.begin();p!=m.end();++p)
{
s += p.key();
s += "=";
s += p.value().toString();
s += ";";
}
return /*std::move*/(s);
}
QMap<QString, QVariant> qtwidget_planetosm::string_to_map(const QString & s)
{
QMap<QString, QVariant> res;
QStringList lst = s.split(";");
foreach (QString s, lst)
{
int t = s.indexOf("=");
if (t>0 && t< s.size())
{
QString name = s.left(t).trimmed();
QString value = s.mid(t+1).trimmed();
res[name] = value;
}
}
return /*std::move*/(res);
}
/**
* @brief osm_layer_call_function call layers' call_func method from
* outside the ocx ctrl. Please MAKE SURE that this function is called from UI thread,
......
......@@ -35,8 +35,7 @@ public:
//! slots below is designed for widget interfaces
public:
QTVOSM::viewer_interface * viewer();
QString map_to_string(const QMap<QString, QVariant> & m);
QMap<QString, QVariant> string_to_map(const QString & s);
QString osm_get_remote_address(QString layerName) const;
void osm_set_remote_address (QString layerName, QString addr);
QString osm_get_local_cache(QString layerName) const;
......
......@@ -18,6 +18,7 @@
#include "geographicspolygonitem.h"
#include "geographicspixmapitem.h"
#include "geographicsmultilineitem.h"
#include "../qtviewer_planetosm/interface_utils.h"
QMutex mutex_instances;
QMap<viewer_interface *, qtvplugin_geomarker * > map_instances;
QMap<QString, int > count_instances;
......
......@@ -13,6 +13,7 @@
#include <QMessageBox>
#include <QSettings>
#include <math.h>
#include "../qtviewer_planetosm/interface_utils.h"
/*!
* The plugin dynamic library (.dll in windows or .so in linux) will be loaded into memory only once.
* for example, a windows app like test_container will contain 2 qtaxviewer_planetosm OCX ctrls ,
......@@ -450,8 +451,8 @@ void qtvplugin_grid::CalArea()
PointX [i] = dLonCurr;
PointY [i] = dLatCurr;
}
str_Polygon += (")\n)',4326),900913)\n");
str_LineString += (")',4326),900913)\n");
str_Polygon += (")\n)',4326),3857 )\n");
str_LineString += (")',4326),3857 )\n");
if (Valid==true)
{
......
......@@ -3,6 +3,7 @@
#include <QAxBase>
#include <QDebug>
#include <QMessageBox>
#include "../qtviewer_planetosm/interface_utils.h"
testcontainer::testcontainer(QWidget *parent) :
QDialog(parent),
ui(new Ui::testcontainer)
......@@ -26,27 +27,8 @@ testcontainer::testcontainer(QWidget *parent) :
connect (ui->axWidget_map1,SIGNAL(evt_Message(QString)),this,SLOT(slot_message(QString)));
connect (ui->axWidget_map2,SIGNAL(evt_Message(QString)),this,SLOT(slot_message(QString)));
m_nAnTimer = startTimer(150);
//confirmLayerNames();
}
//void testcontainer::confirmLayerNames()
//{
// //Get Total layers
// QVariant vt_num = ui->axWidget_map1->dynamicCall("osm_layer_get_count()");
// int n_num = vt_num.toInt();
// //Get Layer names
// for (int i=0;i<n_num;++i)
// {
// QVariant vt_name = ui->axWidget_map1->dynamicCall("osm_layer_get_name(int)",i);
// QString strname = vt_name.toString();
// if (strname.indexOf("grid")>=0)
// m_str_gridLayerName = strname;
// else if (strname.indexOf("geomarker")>=0)
// m_str_markerLayerName = strname;
// }
//}
void testcontainer::show_message(QString message)
{
QList<QStandardItem *> list_newrow;
......@@ -237,35 +219,7 @@ void testcontainer::on_pushButton_QTV_test_layer_move_clicked()
av = ui->axWidget_map1->dynamicCall("osm_layer_set_active(QString,int)","OSM",av==0?-1:0).toInt();
QMessageBox::information(this,"active",QString("osm_layer_set_active(\"OSM\") returns %1").arg(av));
}
QString testcontainer::map_to_string(const QMap<QString, QVariant> & m)
{
QString s;
for(QMap<QString, QVariant>::const_iterator p = m.begin();p!=m.end();++p)
{
s += p.key();
s += "=";
s += p.value().toString();
s += ";";
}
return /*std::move*/(s);
}
QMap<QString, QVariant> testcontainer::string_to_map(const QString & s)
{
QMap<QString, QVariant> res;
QStringList lst = s.split(";");
foreach (QString s, lst)
{
int t = s.indexOf("=");
if (t>0 && t< s.size())
{
QString name = s.left(t).trimmed();
QString value = s.mid(t+1).trimmed();
res[name] = value;
}
}
return /*std::move*/(res);
}
void testcontainer::on_pushButton_QTV_test_grid_enable_clicked()
{
//Get the grid plugin's ruler status
......@@ -563,7 +517,7 @@ void testcontainer::on_osmmap_map_event(QMap<QString, QVariant> p)
{
QList<QStandardItem *> list_newrow;
list_newrow << new QStandardItem(QString("%1").arg((quint64)ui->osmmap));
QString message = this->map_to_string(p);
QString message = map_to_string(p);
if (message.contains("MOUSE_MOVE"))
{
......
......@@ -12,8 +12,6 @@ class testcontainer : public QDialog
Q_OBJECT
private:
QStandardItemModel * m_pModel;
QString map_to_string(const QMap<QString, QVariant> & m);
QMap<QString, QVariant> string_to_map(const QString & s);
public:
explicit testcontainer(QWidget *parent = 0);
~testcontainer();
......@@ -23,9 +21,6 @@ protected:
private:
Ui::testcontainer *ui;
int m_nAnTimer;
//QString m_str_gridLayerName;
//QString m_str_markerLayerName;
//void confirmLayerNames();
void show_message(QString);
protected slots:
void slot_message(QString);
......
......@@ -2,6 +2,7 @@
#include "ui_testcontainer_linux.h"
#include <QDebug>
#include <QMessageBox>
#include "../qtviewer_planetosm/interface_utils.h"
testcontainer::testcontainer(QWidget *parent) :
QDialog(parent),
ui(new Ui::testcontainer)
......@@ -22,26 +23,7 @@ testcontainer::testcontainer(QWidget *parent) :
m_nAnTimer = startTimer(150);
//confirmLayerNames();
}
//void testcontainer::confirmLayerNames()
//{
// //Get Total layers
// int n_num = ui->osmmap->osm_layer_get_count();
// //Get Layer names
// for (int i=0;i<n_num;++i)
// {
// QString strname = ui->osmmap->osm_layer_get_name(i);
// if (strname.indexOf("grid")>=0)
// m_str_gridLayerName = strname;
// else if (strname.indexOf("geomarker")>=0)
// m_str_markerLayerName = strname;
// }
//}
testcontainer::~testcontainer()
{
delete ui;
......@@ -185,35 +167,7 @@ void testcontainer::on_pushButton_QTV_test_layer_move_clicked()
av = ui->osmmap->osm_layer_set_active("OSM",av==0?-1:0);
QMessageBox::information(this,"active",QString("osm_layer_set_active(\"OSM\") returns %1").arg(av));
}
QString testcontainer::map_to_string(const QMap<QString, QVariant> & m)
{
QString s;
for(QMap<QString, QVariant>::const_iterator p = m.begin();p!=m.end();++p)
{
s += p.key();
s += "=";
s += p.value().toString();
s += ";";
}
return /*std::move*/(s);
}
QMap<QString, QVariant> testcontainer::string_to_map(const QString & s)
{
QMap<QString, QVariant> res;
QStringList lst = s.split(";");
foreach (QString s, lst)
{
int t = s.indexOf("=");
if (t>0 && t< s.size())
{
QString name = s.left(t).trimmed();
QString value = s.mid(t+1).trimmed();
res[name] = value;
}
}
return /*std::move*/(res);
}
void testcontainer::on_pushButton_QTV_test_grid_enable_clicked()
{
//Get the grid plugin's ruler status
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册