Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
qplanetosm
提交
d9c3eb3a
qplanetosm
项目概览
colorEagleStdio
/
qplanetosm
通知
118
Star
10
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
qplanetosm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d9c3eb3a
编写于
1月 04, 2016
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
All grid methods been tested
上级
c2829cc8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
136 addition
and
28 deletion
+136
-28
qtviewer_planetosm/qtaxviewer_planetosm.cpp
qtviewer_planetosm/qtaxviewer_planetosm.cpp
+47
-21
qtviewer_planetosm/qtaxviewer_planetosm.h
qtviewer_planetosm/qtaxviewer_planetosm.h
+3
-0
qtvplugin_grid/qtvplugin_grid.cpp
qtvplugin_grid/qtvplugin_grid.cpp
+16
-0
test_container/testcontainer.cpp
test_container/testcontainer.cpp
+52
-0
test_container/testcontainer.h
test_container/testcontainer.h
+4
-0
test_container/testcontainer.ui
test_container/testcontainer.ui
+14
-7
未找到文件。
qtviewer_planetosm/qtaxviewer_planetosm.cpp
浏览文件 @
d9c3eb3a
...
...
@@ -50,7 +50,7 @@ qtaxviewer_planetosm::~qtaxviewer_planetosm()
}
/*!
\brief
setTileA
ddress set the address of the OSM layer.
\brief
osm_set_remote_a
ddress set the address of the OSM layer.
a Address is almost like:
http://192.168.1.127/osm/%1/%2/%3.png
or
...
...
@@ -220,7 +220,7 @@ void qtaxviewer_planetosm::_next_pending_evts()
for
(
QMap
<
QString
,
QVariant
>::
const_iterator
p
=
e
->
begin
();
p
!=
e
->
end
();
++
p
)
{
str_props
+=
p
.
key
();
str_props
+=
"
:
"
;
str_props
+=
"
=
"
;
str_props
+=
p
.
value
().
toString
();
str_props
+=
";"
;
}
...
...
@@ -348,8 +348,48 @@ 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
);
}
//function Calls
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,
* which means the same thread that OCX ctrl stays. Calling "call_func" from another thread is
* NOT SUPPORTED, and will cause strange problems.
*
* @param layerName the layer name to whom this function call will be sent
* @param args args stored in key, value strings,
* key, value is connected with "=", and each pairs splitted by ";"
* eg, function=get_region;x=38.43834784;y=16.3834754;
* @return QString the result string is also formatted with key-vaslue para strings.
*/
QString
qtaxviewer_planetosm
::
osm_layer_call_function
(
QString
layerName
,
QString
args
)
{
QString
strRes
;
...
...
@@ -358,26 +398,12 @@ QString qtaxviewer_planetosm::osm_layer_call_function(QString layerName, QString
if
(
la
)
{
QMap
<
QString
,
QVariant
>
p_in
,
p_out
;
QStringList
lst
=
args
.
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
();
p_in
[
name
]
=
value
;
}
}
p_in
=
string_to_map
(
args
);
p_out
=
la
->
call_func
(
p_in
);
for
(
QMap
<
QString
,
QVariant
>::
iterator
p
=
p_out
.
begin
();
p
!=
p_out
.
end
();
++
p
)
{
strRes
+=
p
.
key
();
strRes
+=
":"
;
strRes
+=
p
.
value
().
toString
();
strRes
+=
";"
;
}
strRes
=
map_to_string
(
p_out
);
}
else
strRes
=
QString
(
"error=Layer name
\"
%1
\"
does not exist.;"
).
arg
(
layerName
);
return
strRes
;
}
...
...
qtviewer_planetosm/qtaxviewer_planetosm.h
浏览文件 @
d9c3eb3a
...
...
@@ -17,6 +17,9 @@
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
;
...
...
qtvplugin_grid/qtvplugin_grid.cpp
浏览文件 @
d9c3eb3a
...
...
@@ -641,6 +641,22 @@ QMap<QString, QVariant> qtvplugin_grid::call_func(const QMap<QString, QVariant>
res
[
lonkey
]
=
m_list_points
[
i
].
y
();
}
}
else
if
(
funct
==
"get_ruler_status"
)
{
res
[
"status"
]
=
m_bActive
==
false
?
0
:-
1
;
}
else
if
(
funct
==
"set_ruler_status"
)
{
int
status
=
-
1
;
if
(
paras
.
contains
(
"status"
))
status
=
paras
[
"status"
].
toInt
();
set_active
(
status
==
0
?
false
:
true
);
res
[
"status"
]
=
m_bActive
==
false
?
0
:-
1
;
}
else
res
[
"error"
]
=
QString
(
"unknown function
\"
%1
\"
."
).
arg
(
funct
);
}
else
res
[
"error"
]
=
"
\"
function
\"
keyword not specified, nothing to do."
;
return
std
::
move
(
res
);
}
test_container/testcontainer.cpp
浏览文件 @
d9c3eb3a
...
...
@@ -140,3 +140,55 @@ void testcontainer::on_pushButton_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_test_grid_enable_clicked
()
{
QString
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"grid1"
,
"function=get_ruler_status;"
).
toString
();
QMessageBox
::
information
(
this
,
"grid1::get_ruler_status"
,
res
);
QMap
<
QString
,
QVariant
>
mres
=
string_to_map
(
res
);
if
(
mres
[
"status"
].
toInt
())
{
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"grid1"
,
"function=set_ruler_status;status=0;"
).
toString
();
QMessageBox
::
information
(
this
,
"grid1::set_ruler_status to false, you can call get_region to get region strings.."
,
res
);
}
else
{
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"grid1"
,
"function=set_ruler_status;status=-1;"
).
toString
();
QMessageBox
::
information
(
this
,
"grid1::set_ruler_status to true, you can draw regions on map using mouse lbutton for begin and rbutton for end."
,
res
);
}
}
void
testcontainer
::
on_pushButton_test_grid_getRegion_clicked
()
{
QString
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"grid1"
,
"function=get_region;"
).
toString
();
QMessageBox
::
information
(
this
,
"grid1::get_region"
,
res
);
}
test_container/testcontainer.h
浏览文件 @
d9c3eb3a
...
...
@@ -12,6 +12,8 @@ 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
();
...
...
@@ -26,6 +28,8 @@ protected slots:
void
on_pushButton_test_navigate_clicked
();
void
on_pushButton_test_layers_clicked
();
void
on_pushButton_test_layer_move_clicked
();
void
on_pushButton_test_grid_enable_clicked
();
void
on_pushButton_test_grid_getRegion_clicked
();
};
#endif // TESTCONTAINER_H
test_container/testcontainer.ui
浏览文件 @
d9c3eb3a
...
...
@@ -101,13 +101,6 @@
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"pushButton_test_layer_move"
>
<property
name=
"text"
>
<string>
test_layer_move
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
...
...
@@ -121,6 +114,20 @@
</property>
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"pushButton_test_grid_enable"
>
<property
name=
"text"
>
<string>
grid_measure
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"pushButton_test_grid_getRegion"
>
<property
name=
"text"
>
<string>
grid_region
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录