Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
qplanetosm
提交
ac04068b
qplanetosm
项目概览
colorEagleStdio
/
qplanetosm
通知
119
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 搜索 >>
提交
ac04068b
编写于
2月 09, 2016
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
we start to realize update_icon outer functions
上级
074b9a82
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
173 addition
and
12 deletion
+173
-12
qtvplugin_geomarker/dialogselecticon.ui
qtvplugin_geomarker/dialogselecticon.ui
+1
-1
qtvplugin_geomarker/geoitembase.cpp
qtvplugin_geomarker/geoitembase.cpp
+32
-0
qtvplugin_geomarker/qtvplugin_geomarker.cpp
qtvplugin_geomarker/qtvplugin_geomarker.cpp
+1
-0
qtvplugin_geomarker/qtvplugin_geomarker.h
qtvplugin_geomarker/qtvplugin_geomarker.h
+6
-2
qtvplugin_geomarker/qtvplugin_geomarker_func.cpp
qtvplugin_geomarker/qtvplugin_geomarker_func.cpp
+113
-7
test_container/testcontainer.cpp
test_container/testcontainer.cpp
+20
-2
未找到文件。
qtvplugin_geomarker/dialogselecticon.ui
浏览文件 @
ac04068b
...
...
@@ -11,7 +11,7 @@
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
<string>
import icon resource
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
...
...
qtvplugin_geomarker/geoitembase.cpp
浏览文件 @
ac04068b
...
...
@@ -73,6 +73,12 @@ namespace QTVP_GEOMARKER{
m_pLabelItem
=
new
QGraphicsTextItem
(
v
.
toString
(),
pc
);
m_pLabelItem
->
setDefaultTextColor
(
m_LabelTextColor
);
m_pLabelItem
->
setFont
(
m_LabelTextFont
);
if
(
pc
->
scale
()
>
0
)
{
qreal
sc
=
pc
->
scale
();
m_pLabelItem
->
setScale
(
1.0
/
pc
->
scale
());
}
m_pLabelItem
->
setRotation
(
-
pc
->
rotation
());
}
else
if
(
m_bPropVisible
==
false
)
m_pLabelItem
->
setPlainText
(
v
.
toString
());
...
...
@@ -118,6 +124,13 @@ namespace QTVP_GEOMARKER{
m_pLabelItem
=
new
QGraphicsTextItem
(
str
,
pc
);
m_pLabelItem
->
setDefaultTextColor
(
m_LabelTextColor
);
m_pLabelItem
->
setFont
(
m_LabelTextFont
);
if
(
pc
->
scale
()
>
0
)
{
qreal
sc
=
pc
->
scale
();
m_pLabelItem
->
setScale
(
1.0
/
pc
->
scale
());
}
m_pLabelItem
->
setRotation
(
-
pc
->
rotation
());
}
else
m_pLabelItem
->
setPlainText
(
str
);
...
...
@@ -145,6 +158,13 @@ namespace QTVP_GEOMARKER{
m_pLabelItem
=
new
QGraphicsTextItem
(
v
.
toString
(),
pc
);
m_pLabelItem
->
setDefaultTextColor
(
m_LabelTextColor
);
m_pLabelItem
->
setFont
(
m_LabelTextFont
);
if
(
pc
->
scale
()
>
0
)
{
qreal
sc
=
pc
->
scale
();
m_pLabelItem
->
setScale
(
1.0
/
pc
->
scale
());
}
m_pLabelItem
->
setRotation
(
-
pc
->
rotation
());
}
m_pLabelItem
->
setPlainText
(
v
.
toString
());
m_pLabelItem
->
setPos
(
this
->
label_pos
());
...
...
@@ -158,6 +178,18 @@ namespace QTVP_GEOMARKER{
void
geoItemBase
::
adjustLabelPos
()
{
if
(
m_pLabelItem
)
{
QGraphicsItem
*
pc
=
dynamic_cast
<
QGraphicsItem
*>
(
this
);
if
(
pc
)
{
if
(
pc
->
scale
()
>
0
)
{
qreal
sc
=
pc
->
scale
();
m_pLabelItem
->
setScale
(
1.0
/
pc
->
scale
());
}
m_pLabelItem
->
setRotation
(
-
pc
->
rotation
());
}
m_pLabelItem
->
setPos
(
this
->
label_pos
());
}
}
}
qtvplugin_geomarker/qtvplugin_geomarker.cpp
浏览文件 @
ac04068b
...
...
@@ -583,6 +583,7 @@ QTVP_GEOMARKER::geoItemBase * qtvplugin_geomarker::update_icon(const QString & n
pitem
->
setTransformationMode
(
Qt
::
SmoothTransformation
);
else
pitem
->
setTransformationMode
(
Qt
::
FastTransformation
);
pitem
->
adjustLabelPos
();
}
return
res
;
}
qtvplugin_geomarker/qtvplugin_geomarker.h
浏览文件 @
ac04068b
...
...
@@ -130,8 +130,9 @@ private:
QMap
<
QString
,
QVariant
>
func_update_point
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_update_line
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_update_polygon
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_update_icon
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_update_props
(
const
QMap
<
QString
,
QVariant
>
&
);
//other function calls
//other
method for plugin
function calls
private:
void
initialBindPluginFuntions
();
QMap
<
QString
,
std
::
function
<
tpfunc_call
>
>
m_map_pluginFunctions
;
...
...
@@ -143,7 +144,10 @@ private:
QMap
<
QString
,
QVariant
>
func_props
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_save_xml
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_load_xml
(
const
QMap
<
QString
,
QVariant
>
&
);
//icon and its manage
QMap
<
QString
,
QVariant
>
func_add_reource
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_save_reources
(
const
QMap
<
QString
,
QVariant
>
&
);
QMap
<
QString
,
QVariant
>
func_load_reources
(
const
QMap
<
QString
,
QVariant
>
&
);
//overloaded virtual funtions
protected:
layer_interface
*
load_initial_plugin
(
QString
strSLibPath
,
viewer_interface
*
ptrviewer
);
...
...
qtvplugin_geomarker/qtvplugin_geomarker_func.cpp
浏览文件 @
ac04068b
...
...
@@ -15,13 +15,14 @@
* 1.update_point Insert or Update a point mark.
* 2.update_line Insert or Update a line mark.
* 3.update_polygon Insert or Update a polygon mark.
* 4.update_props Insert or Update a mark's user-defind properties.
* 5.exists Test whether a special mark is exist.
* 6.delete_marks Delete marks.
* 7.delete_props Delete user-defined properties for a mark.
* 8.mark_names return All mark names owned by this plugin.
* 9.mark return All styles and geo points for a special mark.
* 10.props return All user-defined properties for a special mark.
* 4.update_icon Insert or Update a icon mark.
* 5.update_props Insert or Update a mark's user-defind properties.
* 6.exists Test whether a special mark is exist.
* 7.delete_marks Delete marks.
* 8.delete_props Delete user-defined properties for a mark.
* 9.mark_names return All mark names owned by this plugin.
* 10.mark return All styles and geo points for a special mark.
* 11.props return All user-defined properties for a special mark.
* @param paras the key-value style paraments.
* @return QMap<QString, QVariant> the key-value style return values.
*/
...
...
@@ -50,6 +51,7 @@ void qtvplugin_geomarker::initialBindPluginFuntions()
m_map_pluginFunctions
[
"update_point"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_update_point
,
this
,
std
::
placeholders
::
_1
);
m_map_pluginFunctions
[
"update_line"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_update_line
,
this
,
std
::
placeholders
::
_1
);
m_map_pluginFunctions
[
"update_polygon"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_update_polygon
,
this
,
std
::
placeholders
::
_1
);
m_map_pluginFunctions
[
"update_icon"
]
=
std
::
bind
(
&
qtvplugin_geomarker
::
func_update_icon
,
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
);
...
...
@@ -237,6 +239,110 @@ QMap<QString, QVariant> qtvplugin_geomarker::func_update_point (const QMap<QStr
res
[
"error"
]
=
tr
(
"can not create graphical object, the pointer is zero."
);
return
std
::
move
(
res
);
}
/**
* @brief func_update_icon is a internal function for plugin call_func "update_icon"
*
* the paraments used by paras is listed below.
* function=update_icon;
* @param paras The key-value style paraments.
* @return QMap<QString, QVariant> if error happens, a property called "error" will store the most possible reason.
*/
QMap
<
QString
,
QVariant
>
qtvplugin_geomarker
::
func_update_icon
(
const
QMap
<
QString
,
QVariant
>
&
paras
)
{
QMap
<
QString
,
QVariant
>
res
;
//!name, lat, lon has no default values. user should specify these values or the function calll will fail;
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 could not be empty."
);
return
std
::
move
(
res
);
}
QTVP_GEOMARKER
::
geoItemBase
*
base
=
m_pScene
->
geoitem_by_name
(
name
);
QString
icon_name
=
"default"
;
qreal
scale
=
1.0
;
qreal
rot
=
0.0
;
int
smooth
=
0
;
//if the mark is already exist, we will get its orgional style as default .
if
(
base
)
{
QTVP_GEOMARKER
::
geoGraphicsPixmapItem
*
it
=
dynamic_cast
<
QTVP_GEOMARKER
::
geoGraphicsPixmapItem
*
>
(
base
);
if
(
it
)
{
icon_name
=
it
->
icon
()
->
name
;
scale
=
it
->
scale
();
rot
=
it
->
rotation
();
smooth
=
it
->
transformationMode
()
==
Qt
::
SmoothTransformation
?
1
:
0
;
}
}
//! icon is the name that this mark will use.
if
(
paras
.
contains
(
"icon"
))
{
QString
icn
=
paras
[
"icon"
].
toString
();
if
(
icn
.
length
())
icon_name
=
icn
;
}
//! scale is the zoom ratio that this icon will use, 1.0 means no zoom
if
(
paras
.
contains
(
"scale"
))
{
qreal
sc
=
paras
[
"scale"
].
toReal
();
if
(
sc
>
0
)
scale
=
sc
;
}
//! rotate is the rotate angle that this icon will use, 0.0 means no rotate
if
(
paras
.
contains
(
"rotate"
))
{
qreal
rt
=
paras
[
"rotate"
].
toReal
();
rot
=
rt
;
}
//!smooth is the transform mode that this icon will use. 0 mean not smooth, but faster. 1 mean smooth.
if
(
paras
.
contains
(
"smooth"
))
{
int
smt
=
paras
[
"smooth"
].
toInt
();
if
(
smt
==
0
)
smooth
=
0
;
else
smooth
=
1
;
}
QTVP_GEOMARKER
::
geoItemBase
*
newitem
=
0
;
/*! geo coordinate in WGS84 lattitude, longitude should be saved as lat and lon.
*/
double
lat
=
paras
[
"lat"
].
toDouble
();
double
lon
=
paras
[
"lon"
].
toDouble
();
newitem
=
update_icon
(
name
,
lat
,
lon
,
scale
,
rot
,
smooth
,
icon_name
);
if
(
newitem
)
{
QFont
f
=
newitem
->
labelFont
();
//! size_label stands for the text label font pixel size from 1 - 720, with a normal value 9.
if
(
paras
.
contains
(
"size_label"
))
{
int
fontSz
=
paras
[
"size_label"
].
toInt
();
if
(
fontSz
==
0
)
fontSz
=
9
;
f
.
setPointSize
(
fontSz
);
}
//! weight_label is the bolder rate for text renderring, from 1 ~ 99, 99 is the heaviest.
if
(
paras
.
contains
(
"weight_label"
))
{
int
fontWeight
=
paras
[
"weight_label"
].
toInt
();
f
.
setWeight
(
fontWeight
);
}
newitem
->
setLabelFont
(
f
);
//! color_label has 4 text color band values splitted by comma, r,g,b,a
if
(
paras
.
contains
(
"color_label"
))
{
QColor
textColor
=
string2color
(
paras
[
"color_label"
].
toString
());
newitem
->
setLabelColor
(
textColor
);
}
scheduleRefreshMarks
();
scheduleUpdateMap
();
}
else
res
[
"error"
]
=
tr
(
"can not create graphical object, the pointer is zero."
);
return
std
::
move
(
res
);
}
/**
* @brief func_update_line is a internal function for plugin call_func "update_line"
*
...
...
test_container/testcontainer.cpp
浏览文件 @
ac04068b
...
...
@@ -281,7 +281,7 @@ void testcontainer::on_pushButton_test_mark_clicked()
"CheckTime=2014-12-31 23:11:27;"
"From=Shanghai;To=Beijing"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::update_p
oint
"
,
res
);
QMessageBox
::
information
(
this
,
"geomarker1::update_p
rops
"
,
res
);
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
...
...
@@ -300,7 +300,25 @@ void testcontainer::on_pushButton_test_mark_clicked()
"CheckTime=2014-12-30 07:18:32;"
"From=Huhehaote;To=YinChuan"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::update_point"
,
res
);
QMessageBox
::
information
(
this
,
"geomarker1::update_props"
,
res
);
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
"function=update_icon;name=ID7;"
"lat=1.233;lon=2.28373;"
"scale=2;rotate=0;smooth=1;"
"icon=default;"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::update_icon"
,
res
);
res
=
ui
->
axWidget_map1
->
dynamicCall
(
"osm_layer_call_function(QString,QString)"
,
"geomarker1"
,
"function=update_props;name=ID7;"
"LABEL=COSCO;EXPRESS=YangChunHe;Pero=IMMD;"
"CheckTime=2012-12-30 07:18:32;"
"From=PEKING;To=YIKH"
).
toString
();
if
(
res
.
contains
(
"error"
))
QMessageBox
::
information
(
this
,
"geomarker1::update_props"
,
res
);
}
void
testcontainer
::
on_pushButton_test_line_clicked
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录