Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
qplanetosm
提交
6bc305d6
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 搜索 >>
提交
6bc305d6
编写于
1月 11, 2016
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add delete functions to geomarker
上级
c2d6defb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
155 addition
and
6 deletion
+155
-6
qtvplugin_geomarker/qtvplugin_geomarker.h
qtvplugin_geomarker/qtvplugin_geomarker.h
+5
-2
qtvplugin_geomarker/qtvplugin_geomarker_func.cpp
qtvplugin_geomarker/qtvplugin_geomarker_func.cpp
+122
-4
test_container/testcontainer.cpp
test_container/testcontainer.cpp
+28
-0
未找到文件。
qtvplugin_geomarker/qtvplugin_geomarker.h
浏览文件 @
6bc305d6
...
...
@@ -128,8 +128,11 @@ private:
QMap
<
QString
,
QVariant
>
(
const
QMap
<
QString
,
QVariant
>
&
)
>
>
m_map_pluginFunctions
;
QMap
<
QString
,
QVariant
>
func_exists
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_exists
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_delete_marks
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_delete_props
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_mark_names
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_mark
(
const
QMap
<
QString
,
QVariant
>
&
);
//overloaded virtual funtions
protected:
...
...
qtvplugin_geomarker/qtvplugin_geomarker_func.cpp
浏览文件 @
6bc305d6
...
...
@@ -15,6 +15,8 @@
* 1.function=update_point
* 2.function=update_line
* 3.function=update_polygon
* 4.function=update_props
* 5.function=exists
* @param paras the key-value style paraments.
* @return QMap<QString, QVariant> the key-value style return values.
*/
...
...
@@ -41,15 +43,25 @@ void qtvplugin_geomarker::initialBindPluginFuntions()
m_map_pluginFunctions
[
"update_polygon"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_update_polygon
,
this
,
std
::
placeholders
::
_1
);
m_map_pluginFunctions
[
"update_props"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_update_props
,
this
,
std
::
placeholders
::
_1
);
m_map_pluginFunctions
[
"exists"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_exists
,
this
,
std
::
placeholders
::
_1
);
m_map_pluginFunctions
[
"delete_marks"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_delete_marks
,
this
,
std
::
placeholders
::
_1
);
m_map_pluginFunctions
[
"delete_props"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_delete_props
,
this
,
std
::
placeholders
::
_1
);
m_map_pluginFunctions
[
"mark_names"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_mark_names
,
this
,
std
::
placeholders
::
_1
);
m_map_pluginFunctions
[
"mark"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_mark
,
this
,
std
::
placeholders
::
_1
);
}
QMap
<
QString
,
QVariant
>
qtvplugin_geomarker
::
func_update_point
(
const
QMap
<
QString
,
QVariant
>
&
paras
)
{
QMap
<
QString
,
QVariant
>
res
;
if
(
paras
.
contains
(
"name"
)
==
false
||
paras
.
contains
(
"lat"
)
==
false
||
paras
.
contains
(
"lon"
)
==
false
)
{
res
[
"error"
]
=
tr
(
"name, lat, lon must exist in paraments."
);
return
std
::
move
(
res
);
}
QString
name
=
paras
[
"name"
].
toString
();
if
(
name
.
size
()
==
0
)
{
res
[
"error"
]
=
tr
(
"name
does not exist in paraments
."
);
res
[
"error"
]
=
tr
(
"name
could not be empty
."
);
return
std
::
move
(
res
);
}
QTVP_GEOMARKER
::
geoItemBase
*
base
=
m_pScene
->
geoitem_by_name
(
name
);
...
...
@@ -196,10 +208,17 @@ QMap<QString, QVariant> qtvplugin_geomarker::func_update_point (const QMap<QStr
QMap
<
QString
,
QVariant
>
qtvplugin_geomarker
::
func_update_line
(
const
QMap
<
QString
,
QVariant
>
&
paras
)
{
QMap
<
QString
,
QVariant
>
res
;
if
(
paras
.
contains
(
"name"
)
==
false
||
paras
.
contains
(
"lat0"
)
==
false
||
paras
.
contains
(
"lon0"
)
==
false
||
paras
.
contains
(
"lat1"
)
==
false
||
paras
.
contains
(
"lon1"
)
==
false
)
{
res
[
"error"
]
=
tr
(
"name, lat0, lon0,lat1,lon1 must exist in paraments."
);
return
std
::
move
(
res
);
}
QString
name
=
paras
[
"name"
].
toString
();
if
(
name
.
size
()
==
0
)
{
res
[
"error"
]
=
tr
(
"name
does not exist in paraments
."
);
res
[
"error"
]
=
tr
(
"name
could not be empty
."
);
return
std
::
move
(
res
);
}
QTVP_GEOMARKER
::
geoItemBase
*
base
=
m_pScene
->
geoitem_by_name
(
name
);
...
...
@@ -283,10 +302,18 @@ QMap<QString, QVariant> qtvplugin_geomarker::func_update_line (const QMap<QStr
QMap
<
QString
,
QVariant
>
qtvplugin_geomarker
::
func_update_polygon
(
const
QMap
<
QString
,
QVariant
>
&
paras
)
{
QMap
<
QString
,
QVariant
>
res
;
if
(
paras
.
contains
(
"name"
)
==
false
)
{
res
[
"error"
]
=
tr
(
"name must exist in paraments."
);
return
std
::
move
(
res
);
}
QString
name
=
paras
[
"name"
].
toString
();
if
(
name
.
size
()
==
0
)
{
res
[
"error"
]
=
tr
(
"name
does not exist in paraments
."
);
res
[
"error"
]
=
tr
(
"name
could not be empty
."
);
return
std
::
move
(
res
);
}
QTVP_GEOMARKER
::
geoItemBase
*
base
=
m_pScene
->
geoitem_by_name
(
name
);
...
...
@@ -383,6 +410,8 @@ QMap<QString, QVariant> qtvplugin_geomarker::func_update_polygon (const QMap<QS
}
if
(
pl
.
size
()
>
2
)
newitem
=
update_polygon
(
name
,
pl
,
pen
,
brush
);
else
res
[
"error"
]
=
tr
(
"polygon must contain at least 3 points,lat0,lat1,lat2 and lon0,lon1, lon2."
);
if
(
newitem
)
{
...
...
@@ -427,7 +456,7 @@ QMap<QString, QVariant> qtvplugin_geomarker::func_update_props(const QMap<QStrin
{
foreach
(
QString
key
,
paras
.
keys
())
{
if
(
key
!=
"name"
)
if
(
key
!=
"name"
&&
key
!=
"function"
)
base
->
set_prop_data
(
key
,
paras
[
key
]);
}
scheduleRefreshMarks
();
...
...
@@ -456,3 +485,92 @@ QMap<QString, QVariant> qtvplugin_geomarker::func_exists (const QMap<QString,
res
[
"return"
]
=
0
;
return
std
::
move
(
res
);
}
QMap
<
QString
,
QVariant
>
qtvplugin_geomarker
::
func_delete_marks
(
const
QMap
<
QString
,
QVariant
>
&
paras
)
{
QMap
<
QString
,
QVariant
>
res
;
QSet
<
QString
>
set_names
;
int
ct
=
0
;
do
{
QString
keystr
=
QString
(
"name%1"
).
arg
(
ct
++
);
if
(
paras
.
contains
(
keystr
)
==
false
)
break
;
set_names
.
insert
(
paras
[
keystr
].
toString
());
}
while
(
ct
<
1024
*
1024
*
1024
);
if
(
set_names
.
size
())
{
ct
=
0
;
foreach
(
QString
key
,
set_names
)
{
QString
keystr
=
QString
(
"name%1"
).
arg
(
ct
++
);
QTVP_GEOMARKER
::
geoItemBase
*
base
=
m_pScene
->
geoitem_by_name
(
key
);
if
(
base
)
{
m_pScene
->
removeItem
(
base
,
0
);
res
[
keystr
]
=
1
;
}
else
res
[
keystr
]
=
0
;
}
}
else
{
QList
<
QTVP_GEOMARKER
::
geoItemBase
*
>
lst
=
m_pScene
->
geo_items
();
foreach
(
QTVP_GEOMARKER
::
geoItemBase
*
key
,
lst
)
m_pScene
->
removeItem
(
key
,
0
);
res
[
"ALL"
]
=
1
;
}
return
std
::
move
(
res
);
}
QMap
<
QString
,
QVariant
>
qtvplugin_geomarker
::
func_delete_props
(
const
QMap
<
QString
,
QVariant
>
&
paras
)
{
QMap
<
QString
,
QVariant
>
res
;
if
(
paras
.
contains
(
"name"
)
==
false
)
{
res
[
"error"
]
=
tr
(
"name must exist in paraments."
);
return
std
::
move
(
res
);
}
QString
name
=
paras
[
"name"
].
toString
();
if
(
name
.
size
()
==
0
)
{
res
[
"error"
]
=
tr
(
"name could not be empty."
);
return
std
::
move
(
res
);
}
QTVP_GEOMARKER
::
geoItemBase
*
base
=
m_pScene
->
geoitem_by_name
(
name
);
if
(
base
)
{
int
ct
=
0
;
do
{
QString
keystr
=
QString
(
"prop%1"
).
arg
(
ct
++
);
if
(
paras
.
contains
(
keystr
)
==
false
)
break
;
QString
prop_name
=
paras
[
keystr
].
toString
();
base
->
del_prop
(
prop_name
);
}
while
(
ct
<
1024
*
1024
*
1024
);
}
else
res
[
"error"
]
=
tr
(
"the mark name."
)
+
name
+
tr
(
" does not exist in current scene."
);
return
std
::
move
(
res
);
}
QMap
<
QString
,
QVariant
>
qtvplugin_geomarker
::
func_mark_names
(
const
QMap
<
QString
,
QVariant
>
&
/*paras*/
)
{
QMap
<
QString
,
QVariant
>
res
;
QList
<
QTVP_GEOMARKER
::
geoItemBase
*
>
lst
=
m_pScene
->
geo_items
();
int
ct
=
0
;
foreach
(
QTVP_GEOMARKER
::
geoItemBase
*
key
,
lst
)
{
QString
keystr
=
QString
(
"name%1"
).
arg
(
ct
++
);
res
[
keystr
]
=
key
->
item_name
();
}
return
std
::
move
(
res
);
}
QMap
<
QString
,
QVariant
>
qtvplugin_geomarker
::
func_mark
(
const
QMap
<
QString
,
QVariant
>
&
paras
)
{
QMap
<
QString
,
QVariant
>
res
;
return
std
::
move
(
res
);
}
test_container/testcontainer.cpp
浏览文件 @
6bc305d6
...
...
@@ -255,6 +255,11 @@ void testcontainer::on_pushButton_test_grid_getPolygon_clicked()
void
testcontainer
::
on_pushButton_test_mark_clicked
()
{
QString
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
"function=delete_marks;name0=ID3;name1=ID4;"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::delete_marks"
,
res
);
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
"function=update_point;name=ID1;type=1;"
"lat=31.3737;lon=121.3783474;"
"style_pen=2;color_pen=0,0,255,128;width_pen=3;"
...
...
@@ -296,6 +301,11 @@ void testcontainer::on_pushButton_test_mark_clicked()
void
testcontainer
::
on_pushButton_test_line_clicked
()
{
QString
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
"function=delete_marks;name0=ID1;name1=ID2;name2=ID4;"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::delete_marks"
,
res
);
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
"function=update_line;name=ID3;type=3;"
"lat0=31.3737;lon0=121.3783474;"
"lat1=40.3737;lon1=111.34347;"
...
...
@@ -303,11 +313,23 @@ void testcontainer::on_pushButton_test_line_clicked()
"width_pen=2;"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::update_line"
,
res
);
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
"function=update_props;name=ID3;"
"LABEL=HighWay;"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::update_point"
,
res
);
}
void
testcontainer
::
on_pushButton_test_polygon_clicked
()
{
QString
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
"function=delete_marks;name0=ID1;name1=ID2;name2=ID3;"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::delete_marks"
,
res
);
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
"function=update_polygon;name=ID4;type=4;"
"lat0=12.2;lon0=67.3;"
"lat1=14.3;lon1=62.8;"
...
...
@@ -318,6 +340,12 @@ void testcontainer::on_pushButton_test_polygon_clicked()
"width_pen=3;style_brush=1;color_brush=0,255,0,128;"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::update_polygon"
,
res
);
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
"function=update_props;name=ID4;"
"LABEL=Region;"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::update_point"
,
res
);
}
void
testcontainer
::
timerEvent
(
QTimerEvent
*
e
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录