Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
qplanetosm
提交
c752df56
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 搜索 >>
提交
c752df56
编写于
1月 08, 2016
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
geoMark function is now tested.
上级
9e8c8244
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
328 addition
and
9 deletion
+328
-9
qtvplugin_geomarker/qtvplugin_geomarker.cpp
qtvplugin_geomarker/qtvplugin_geomarker.cpp
+12
-1
qtvplugin_geomarker/qtvplugin_geomarker.h
qtvplugin_geomarker/qtvplugin_geomarker.h
+5
-1
qtvplugin_geomarker/qtvplugin_geomarker_func.cpp
qtvplugin_geomarker/qtvplugin_geomarker_func.cpp
+276
-3
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
+16
-4
test_container/testcontainer.cpp
test_container/testcontainer.cpp
+11
-0
test_container/testcontainer.h
test_container/testcontainer.h
+1
-0
test_container/testcontainer.ui
test_container/testcontainer.ui
+7
-0
未找到文件。
qtvplugin_geomarker/qtvplugin_geomarker.cpp
浏览文件 @
c752df56
...
...
@@ -73,7 +73,9 @@ qtvplugin_geomarker::qtvplugin_geomarker(QWidget *parent) :
ui
->
comboBox_fillPad
->
setModel
(
m_pFillStyleModel
);
m_bNeedRefresh
=
false
;
m_bNeedUpdateView
=
false
;
m_nTimerID_refreshUI
=
startTimer
(
2000
);
m_nTimerID_refreshMap
=
startTimer
(
100
);
}
qtvplugin_geomarker
::~
qtvplugin_geomarker
()
...
...
@@ -392,7 +394,7 @@ QString qtvplugin_geomarker::inifile()
return
QCoreApplication
::
applicationFilePath
()
+
QString
(
"/geomarker%1.ini"
).
arg
(
m_nInstance
);
}
void
qtvplugin_geomarker
::
r
efreshMarks
()
void
qtvplugin_geomarker
::
scheduleR
efreshMarks
()
{
if
(
!
m_pVi
||
!
m_pScene
)
return
;
...
...
@@ -401,6 +403,15 @@ void qtvplugin_geomarker::refreshMarks()
//We will set a flag and refresh the ui in timerEvent Instead.
m_bNeedRefresh
=
true
;
}
void
qtvplugin_geomarker
::
scheduleUpdateMap
()
{
if
(
!
m_pVi
||
!
m_pScene
)
return
;
//We do not refresh MAP immediately after each mark-insert, for these inserts is very dense ,
//BAD performence will arise if so.
//We will set a flag and refresh the ui in timerEvent Instead.
m_bNeedUpdateView
=
true
;
}
QTVP_GEOMARKER
::
geoItemBase
*
qtvplugin_geomarker
::
update_line
(
const
QString
&
name
,
double
lat1
,
double
lon1
,
double
lat2
,
double
lon2
,
QPen
pen
)
{
...
...
qtvplugin_geomarker/qtvplugin_geomarker.h
浏览文件 @
c752df56
...
...
@@ -75,7 +75,10 @@ private:
* This timer is just affects UI widgets, Map will be updated immediately otherwise.
*/
int
m_nTimerID_refreshUI
;
int
m_nTimerID_refreshMap
;
bool
m_bNeedRefresh
;
bool
m_bNeedUpdateView
;
QStandardItemModel
*
m_pLineStyleModel
;
QStandardItemModel
*
m_pFillStyleModel
;
QStandardItemModel
*
m_pGeoItemModel
;
...
...
@@ -97,7 +100,8 @@ private:
//UI refreshing functions
private:
void
refreshMarks
();
void
scheduleRefreshMarks
();
void
scheduleUpdateMap
();
void
refreshItemUI
(
QString
markname
);
void
refreshProps
(
QTVP_GEOMARKER
::
geoItemBase
*
itm
);
QColor
string2color
(
const
QString
&
s
);
...
...
qtvplugin_geomarker/qtvplugin_geomarker_func.cpp
浏览文件 @
c752df56
...
...
@@ -26,14 +26,22 @@ QMap<QString, QVariant> qtvplugin_geomarker::call_func(const QMap<QString, QVar
if
(
funct
==
"update_point"
)
{
update_point
(
paras
);
scheduleRefreshMarks
();
scheduleUpdateMap
();
}
else
if
(
funct
==
"update_line"
)
{
update_line
(
paras
);
scheduleRefreshMarks
();
scheduleUpdateMap
();
}
else
if
(
funct
==
"update_polygon"
)
{
update_polygon
(
paras
);
scheduleRefreshMarks
();
scheduleUpdateMap
();
}
else
if
(
funct
==
"update_prop"
)
{
...
...
@@ -474,13 +482,278 @@ bool qtvplugin_geomarker::update_mark(tag_xml_mark & mark)
QTVP_GEOMARKER
::
geoItemBase
*
qtvplugin_geomarker
::
update_point
(
const
QMap
<
QString
,
QVariant
>
&
paras
)
{
return
0
;
QString
name
=
paras
[
"name"
].
toString
();
if
(
name
.
size
()
==
0
)
return
0
;
QTVP_GEOMARKER
::
geoItemBase
*
base
=
m_pScene
->
geoitem_by_name
(
name
);
QPen
pen
(
Qt
::
SolidLine
);
QBrush
brush
(
QColor
(
255
,
255
,
255
,
128
));
qreal
width
=
8
;
qreal
height
=
8
;
if
(
base
)
{
if
(
base
->
item_type
()
==
QTVP_GEOMARKER
::
ITEAMTYPE_RECT_POINT
)
{
QTVP_GEOMARKER
::
geoGraphicsRectItem
*
it
=
dynamic_cast
<
QTVP_GEOMARKER
::
geoGraphicsRectItem
*
>
(
base
);
if
(
it
)
{
pen
=
it
->
pen
();
brush
=
it
->
brush
();
width
=
it
->
width
();
height
=
it
->
height
();
}
}
else
if
(
base
->
item_type
()
==
QTVP_GEOMARKER
::
ITEAMTYPE_ELLIPSE_POINT
)
{
QTVP_GEOMARKER
::
geoGraphicsEllipseItem
*
it
=
dynamic_cast
<
QTVP_GEOMARKER
::
geoGraphicsEllipseItem
*
>
(
base
);
if
(
it
)
{
pen
=
it
->
pen
();
brush
=
it
->
brush
();
width
=
it
->
width
();
height
=
it
->
height
();
}
}
}
if
(
paras
.
contains
(
"style_pen"
))
{
//Get pen and brush settings
Qt
::
PenStyle
pst
[]
=
{
Qt
::
NoPen
,
Qt
::
SolidLine
,
Qt
::
DashLine
,
Qt
::
DotLine
,
Qt
::
DashDotLine
,
Qt
::
DashDotDotLine
,
Qt
::
CustomDashLine
};
int
ptdd
=
paras
[
"style_pen"
].
toInt
();
if
(
ptdd
<
0
||
ptdd
>=
7
)
ptdd
=
1
;
pen
.
setStyle
(
pst
[
ptdd
]);
}
if
(
paras
.
contains
(
"color_pen"
))
{
QColor
penColor
=
string2color
(
paras
[
"color_pen"
].
toString
());
pen
.
setColor
(
penColor
);
}
if
(
paras
.
contains
(
"width_pen"
))
{
int
penWidth
=
paras
[
"width_pen"
].
toInt
();
if
(
penWidth
<
0
)
penWidth
=
1
;
pen
.
setWidth
(
penWidth
);
}
if
(
paras
.
contains
(
"style_brush"
))
{
Qt
::
BrushStyle
bst
[]
=
{
Qt
::
NoBrush
,
Qt
::
SolidPattern
,
Qt
::
Dense1Pattern
,
Qt
::
Dense2Pattern
,
Qt
::
Dense3Pattern
,
Qt
::
Dense4Pattern
,
Qt
::
Dense5Pattern
,
Qt
::
Dense6Pattern
,
Qt
::
Dense7Pattern
,
Qt
::
HorPattern
,
Qt
::
VerPattern
,
Qt
::
CrossPattern
,
Qt
::
BDiagPattern
,
Qt
::
FDiagPattern
,
Qt
::
DiagCrossPattern
};
int
btdd
=
paras
[
"style_brush"
].
toInt
();
if
(
btdd
<
0
||
btdd
>=
15
)
btdd
=
1
;
brush
.
setStyle
(
bst
[
btdd
]);
}
if
(
paras
.
contains
(
"color_brush"
))
{
QColor
brushColor
=
string2color
(
paras
[
"color_brush"
].
toString
());
brush
.
setColor
(
brushColor
);
}
if
(
paras
.
contains
(
"width"
))
{
width
=
paras
[
"width"
].
toReal
();
if
(
width
==
0
)
width
=
8
;
}
if
(
paras
.
contains
(
"height"
))
{
height
=
paras
[
"height"
].
toReal
();
if
(
height
==
0
)
height
=
8
;
}
QTVP_GEOMARKER
::
geoItemBase
*
newitem
=
0
;
double
lat
=
paras
[
"lat"
].
toDouble
();
double
lon
=
paras
[
"lon"
].
toDouble
();
int
tpn
=
paras
[
"type"
].
toInt
();
if
(
tpn
>
1
||
tpn
<
0
)
tpn
=
0
;
QTVP_GEOMARKER
::
geo_item_type
tpe
=
static_cast
<
QTVP_GEOMARKER
::
geo_item_type
>
(
tpn
);
if
(
tpe
==
QTVP_GEOMARKER
::
ITEAMTYPE_RECT_POINT
)
newitem
=
update_point
<
QTVP_GEOMARKER
::
geoGraphicsRectItem
>
(
name
,
lat
,
lon
,
width
,
height
,
pen
,
brush
);
else
newitem
=
update_point
<
QTVP_GEOMARKER
::
geoGraphicsEllipseItem
>
(
name
,
lat
,
lon
,
width
,
height
,
pen
,
brush
);
return
newitem
;
}
QTVP_GEOMARKER
::
geoItemBase
*
qtvplugin_geomarker
::
update_line
(
const
QMap
<
QString
,
QVariant
>
&
paras
)
{
return
0
;
QString
name
=
paras
[
"name"
].
toString
();
if
(
name
.
size
()
==
0
)
return
0
;
QTVP_GEOMARKER
::
geoItemBase
*
base
=
m_pScene
->
geoitem_by_name
(
name
);
QPen
pen
(
Qt
::
SolidLine
);
if
(
base
)
{
if
(
base
->
item_type
()
==
QTVP_GEOMARKER
::
ITEAMTYPE_LINE
)
{
QTVP_GEOMARKER
::
geoGraphicsLineItem
*
it
=
dynamic_cast
<
QTVP_GEOMARKER
::
geoGraphicsLineItem
*
>
(
base
);
pen
=
it
->
pen
();
}
}
if
(
paras
.
contains
(
"style_pen"
))
{
//Get pen and brush settings
Qt
::
PenStyle
pst
[]
=
{
Qt
::
NoPen
,
Qt
::
SolidLine
,
Qt
::
DashLine
,
Qt
::
DotLine
,
Qt
::
DashDotLine
,
Qt
::
DashDotDotLine
,
Qt
::
CustomDashLine
};
int
ptdd
=
paras
[
"style_pen"
].
toInt
();
if
(
ptdd
<
0
||
ptdd
>=
7
)
ptdd
=
1
;
pen
.
setStyle
(
pst
[
ptdd
]);
}
if
(
paras
.
contains
(
"color_pen"
))
{
QColor
penColor
=
string2color
(
paras
[
"color_pen"
].
toString
());
pen
.
setColor
(
penColor
);
}
if
(
paras
.
contains
(
"width_pen"
))
{
int
penWidth
=
paras
[
"width_pen"
].
toInt
();
if
(
penWidth
<
0
)
penWidth
=
1
;
pen
.
setWidth
(
penWidth
);
}
QTVP_GEOMARKER
::
geoItemBase
*
newitem
=
0
;
double
lat1
=
paras
[
"lat1"
].
toDouble
();
double
lon1
=
paras
[
"lon1"
].
toDouble
();
double
lat2
=
paras
[
"lat2"
].
toDouble
();
double
lon2
=
paras
[
"lon2"
].
toDouble
();
newitem
=
update_line
(
name
,
lat1
,
lon1
,
lat2
,
lon2
,
pen
);
return
newitem
;
}
QTVP_GEOMARKER
::
geoItemBase
*
qtvplugin_geomarker
::
update_polygon
(
const
QMap
<
QString
,
QVariant
>
&
paras
)
{
return
0
;
QString
name
=
paras
[
"name"
].
toString
();
if
(
name
.
size
()
==
0
)
return
0
;
QTVP_GEOMARKER
::
geoItemBase
*
base
=
m_pScene
->
geoitem_by_name
(
name
);
QPen
pen
(
Qt
::
SolidLine
);
QBrush
brush
(
QColor
(
255
,
255
,
255
,
128
));
if
(
base
)
{
if
(
base
->
item_type
()
==
QTVP_GEOMARKER
::
ITEAMTYPE_POLYGON
)
{
QTVP_GEOMARKER
::
geoGraphicsPolygonItem
*
it
=
dynamic_cast
<
QTVP_GEOMARKER
::
geoGraphicsPolygonItem
*
>
(
base
);
if
(
it
)
{
pen
=
it
->
pen
();
brush
=
it
->
brush
();
}
}
}
if
(
paras
.
contains
(
"style_pen"
))
{
//Get pen and brush settings
Qt
::
PenStyle
pst
[]
=
{
Qt
::
NoPen
,
Qt
::
SolidLine
,
Qt
::
DashLine
,
Qt
::
DotLine
,
Qt
::
DashDotLine
,
Qt
::
DashDotDotLine
,
Qt
::
CustomDashLine
};
int
ptdd
=
paras
[
"style_pen"
].
toInt
();
if
(
ptdd
<
0
||
ptdd
>=
7
)
ptdd
=
1
;
pen
.
setStyle
(
pst
[
ptdd
]);
}
if
(
paras
.
contains
(
"color_pen"
))
{
QColor
penColor
=
string2color
(
paras
[
"color_pen"
].
toString
());
pen
.
setColor
(
penColor
);
}
if
(
paras
.
contains
(
"width_pen"
))
{
int
penWidth
=
paras
[
"width_pen"
].
toInt
();
if
(
penWidth
<
0
)
penWidth
=
1
;
pen
.
setWidth
(
penWidth
);
}
if
(
paras
.
contains
(
"style_brush"
))
{
Qt
::
BrushStyle
bst
[]
=
{
Qt
::
NoBrush
,
Qt
::
SolidPattern
,
Qt
::
Dense1Pattern
,
Qt
::
Dense2Pattern
,
Qt
::
Dense3Pattern
,
Qt
::
Dense4Pattern
,
Qt
::
Dense5Pattern
,
Qt
::
Dense6Pattern
,
Qt
::
Dense7Pattern
,
Qt
::
HorPattern
,
Qt
::
VerPattern
,
Qt
::
CrossPattern
,
Qt
::
BDiagPattern
,
Qt
::
FDiagPattern
,
Qt
::
DiagCrossPattern
};
int
btdd
=
paras
[
"style_brush"
].
toInt
();
if
(
btdd
<
0
||
btdd
>=
15
)
btdd
=
1
;
brush
.
setStyle
(
bst
[
btdd
]);
}
if
(
paras
.
contains
(
"color_brush"
))
{
QColor
brushColor
=
string2color
(
paras
[
"color_brush"
].
toString
());
brush
.
setColor
(
brushColor
);
}
QTVP_GEOMARKER
::
geoItemBase
*
newitem
=
0
;
QPolygonF
pl
;
int
ct
=
0
;
QString
strKeyLat
=
QString
(
"lat%1"
).
arg
(
ct
);
QString
strKeyLon
=
QString
(
"lon%1"
).
arg
(
ct
);
while
(
paras
.
contains
(
strKeyLat
)
&&
paras
.
contains
(
strKeyLon
))
{
double
lat
=
paras
[
strKeyLat
].
toDouble
();
double
lon
=
paras
[
strKeyLon
].
toDouble
();
pl
.
push_back
(
QPointF
(
lon
,
lat
));
}
if
(
pl
.
size
()
>
2
)
newitem
=
update_polygon
(
name
,
pl
,
pen
,
brush
);
return
newitem
;
}
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
浏览文件 @
c752df56
...
...
@@ -62,6 +62,18 @@ void qtvplugin_geomarker::timerEvent(QTimerEvent * e)
m_pGeoItemModel
->
removeRows
(
c
,
rowCount
-
c
);
m_nTimerID_refreshUI
=
startTimer
(
2000
);
}
else
if
(
m_nTimerID_refreshMap
==
e
->
timerId
()
&&
m_bNeedUpdateView
==
true
)
{
m_bNeedUpdateView
=
false
;
killTimer
(
m_nTimerID_refreshMap
);
m_nTimerID_refreshMap
=
-
1
;
m_pVi
->
UpdateWindow
();
m_nTimerID_refreshMap
=
startTimer
(
100
);
}
else
{
}
}
...
...
@@ -354,7 +366,7 @@ void qtvplugin_geomarker::on_pushButton_update_clicked()
}
r
efreshMarks
();
scheduleR
efreshMarks
();
m_pVi
->
UpdateWindow
();
}
...
...
@@ -371,7 +383,7 @@ void qtvplugin_geomarker::on_pushButton_del_clicked()
if
(
b
)
m_pScene
->
removeItem
(
b
,
0
);
}
r
efreshMarks
();
scheduleR
efreshMarks
();
}
...
...
@@ -385,7 +397,7 @@ void qtvplugin_geomarker::on_pushButton_prop_update_clicked()
{
item
->
set_prop_data
(
ui
->
lineEdit_prop_name
->
text
(),
ui
->
lineEdit_prop_string
->
text
());
this
->
refreshProps
(
item
);
this
->
r
efreshMarks
();
this
->
scheduleR
efreshMarks
();
//Update Font
int
fontSz
=
ui
->
spinBox_fontSize
->
value
();
int
fontWeight
=
ui
->
spinBox_textWeight
->
value
();
...
...
@@ -614,6 +626,6 @@ void qtvplugin_geomarker::on_pushButton_load_clicked()
else
QMessageBox
::
warning
(
this
,
tr
(
"failed"
),
tr
(
"Load XML file"
)
+
newfm
+
tr
(
" Failed"
));
}
r
efreshMarks
();
scheduleR
efreshMarks
();
m_pVi
->
UpdateWindow
();
}
test_container/testcontainer.cpp
浏览文件 @
c752df56
...
...
@@ -200,3 +200,14 @@ void testcontainer::on_pushButton_test_grid_getPolygon_clicked()
QMessageBox
::
information
(
this
,
"grid1::get_polygon"
,
res
);
}
void
testcontainer
::
on_pushButton_test_mark_clicked
()
{
QString
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;style_brush=1;color_brush=0,255,0,128;"
"width=16;height=20;"
).
toString
();
QMessageBox
::
information
(
this
,
"grid1::get_polygon"
,
res
);
}
test_container/testcontainer.h
浏览文件 @
c752df56
...
...
@@ -30,6 +30,7 @@ protected slots:
void
on_pushButton_test_layer_move_clicked
();
void
on_pushButton_test_grid_enable_clicked
();
void
on_pushButton_test_grid_getPolygon_clicked
();
void
on_pushButton_test_mark_clicked
();
};
#endif // TESTCONTAINER_H
test_container/testcontainer.ui
浏览文件 @
c752df56
...
...
@@ -128,6 +128,13 @@
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"pushButton_test_mark"
>
<property
name=
"text"
>
<string>
mark
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录