Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
qplanetosm
提交
538431b7
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 搜索 >>
提交
538431b7
编写于
2月 06, 2016
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. try to add the icon mark type.
2. we will build other functions later
上级
9551e849
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
234 addition
and
15 deletion
+234
-15
qtvplugin_geomarker/geographicspixmapitem.cpp
qtvplugin_geomarker/geographicspixmapitem.cpp
+2
-1
qtvplugin_geomarker/geographicspixmapitem.h
qtvplugin_geomarker/geographicspixmapitem.h
+7
-7
qtvplugin_geomarker/geoitembase.h
qtvplugin_geomarker/geoitembase.h
+3
-1
qtvplugin_geomarker/icons/Medical.png
qtvplugin_geomarker/icons/Medical.png
+0
-0
qtvplugin_geomarker/qtvplugin_geomarker.cpp
qtvplugin_geomarker/qtvplugin_geomarker.cpp
+67
-2
qtvplugin_geomarker/qtvplugin_geomarker.h
qtvplugin_geomarker/qtvplugin_geomarker.h
+15
-0
qtvplugin_geomarker/qtvplugin_geomarker.ui
qtvplugin_geomarker/qtvplugin_geomarker.ui
+88
-2
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
+48
-1
qtvplugin_geomarker/resources.qrc
qtvplugin_geomarker/resources.qrc
+4
-1
未找到文件。
qtvplugin_geomarker/geographicspixmapitem.cpp
浏览文件 @
538431b7
...
...
@@ -23,6 +23,7 @@ namespace QTVP_GEOMARKER{
{
assert
(
vi
()
!=
0
);
this
->
setShapeMode
(
QGraphicsPixmapItem
::
BoundingRectShape
);
double
px
,
py
;
vi
()
->
CV_LLA2World
(
m_lat
,
m_lon
,
&
px
,
&
py
);
setOffset
(
px
-
m_center_offsetx
,
py
-
m_center_offsety
);
...
...
@@ -41,7 +42,7 @@ namespace QTVP_GEOMARKER{
}
}
void
geoGraphicsPixmapItem
::
setCenterOffset
(
qreal
center_offsetx
,
qreal
center_offsety
)
void
geoGraphicsPixmapItem
::
setCenterOffset
(
int
center_offsetx
,
int
center_offsety
)
{
double
px
,
py
;
vi
()
->
CV_LLA2World
(
m_lat
,
m_lon
,
&
px
,
&
py
);
...
...
qtvplugin_geomarker/geographicspixmapitem.h
浏览文件 @
538431b7
#ifndef GEOGRAPHICS
RECT
ITEM_H
#define GEOGRAPHICS
RECT
ITEM_H
#ifndef GEOGRAPHICS
PIXMAP
ITEM_H
#define GEOGRAPHICS
PIXMAP
ITEM_H
#include <QGraphicsPixmapItem>
#include "geoitembase.h"
...
...
@@ -9,8 +9,8 @@ namespace QTVP_GEOMARKER{
protected:
qreal
m_lat
;
qreal
m_lon
;
qreal
m_center_offsetx
;
qreal
m_center_offsety
;
int
m_center_offsetx
;
int
m_center_offsety
;
protected:
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
void
mouseDoubleClickEvent
(
QGraphicsSceneMouseEvent
*
event
);
...
...
@@ -24,9 +24,9 @@ namespace QTVP_GEOMARKER{
public:
qreal
lat
()
const
{
return
m_lat
;}
qreal
lon
()
const
{
return
m_lon
;}
qreal
centerx
()
const
{
return
m_center_offsetx
;}
qreal
centery
()
const
{
return
m_center_offsety
;}
void
setCenterOffset
(
qreal
center_offsetx
,
qreal
center_offsety
);
int
centerx
()
const
{
return
m_center_offsetx
;}
int
centery
()
const
{
return
m_center_offsety
;}
void
setCenterOffset
(
int
center_offsetx
,
int
center_offsety
);
void
setGeo
(
qreal
cent_lat
,
qreal
cent_lon
);
void
adjust_coords
(
int
ncurrLevel
);
QPointF
label_pos
();
...
...
qtvplugin_geomarker/geoitembase.h
浏览文件 @
538431b7
...
...
@@ -27,7 +27,9 @@ namespace QTVP_GEOMARKER{
"ELLIPSE_POINT"
,
"RECT_POINT"
,
"LINE"
,
"POLYGON"
"POLYGON"
,
"ICON"
,
"ERROR"
};
return
names
[(
int
)
tp
];
}
...
...
qtvplugin_geomarker/icons/Medical.png
0 → 100644
浏览文件 @
538431b7
4.3 KB
qtvplugin_geomarker/qtvplugin_geomarker.cpp
浏览文件 @
538431b7
...
...
@@ -15,6 +15,7 @@
#include "geographicsrectitem.h"
#include "geographicslineitem.h"
#include "geographicspolygonitem.h"
#include "geographicspixmapitem.h"
QMutex
mutex_instances
;
QMap
<
viewer_interface
*
,
qtvplugin_geomarker
*
>
map_instances
;
QMap
<
QString
,
int
>
count_instances
;
...
...
@@ -72,6 +73,20 @@ qtvplugin_geomarker::qtvplugin_geomarker(QWidget *parent) :
m_pFillStyleModel
->
appendRow
(
new
QStandardItem
(
"DiagCrossPattern"
));
ui
->
comboBox_fillPad
->
setModel
(
m_pFillStyleModel
);
//insert 2 icons
tag_icon
icon
;
icon
.
name
=
"://icons/Medical.png"
;
icon
.
filename
=
"://icons/Medical.png"
;
icon
.
centerx
=
16
;
icon
.
centery
=
16
;
if
(
icon
.
icon
.
load
(
icon
.
filename
))
m_map_icons
[
icon
.
name
]
=
icon
;
m_pIconsModel
=
new
QStandardItemModel
(
this
);
refreshIconModel
();
ui
->
comboBox_icons
->
setModel
(
m_pIconsModel
);
m_bNeedRefresh
=
false
;
m_bNeedUpdateView
=
false
;
m_nTimerID_refreshUI
=
startTimer
(
2000
);
...
...
@@ -272,6 +287,8 @@ bool qtvplugin_geomarker::cb_mouseDoubleClickEvent(QMouseEvent * e)
m_pVi
->
CV_DP2LLA
(
mouse_view_pt
.
x
(),
mouse_view_pt
.
y
(),
&
mlat
,
&
mlon
);
ui
->
lineEdit_point_lat
->
setText
(
QString
(
"%1"
).
arg
(
mlat
,
0
,
'f'
,
7
));
ui
->
lineEdit_point_lon
->
setText
(
QString
(
"%1"
).
arg
(
mlon
,
0
,
'f'
,
7
));
ui
->
lineEdit_icon_lat
->
setText
(
QString
(
"%1"
).
arg
(
mlat
,
0
,
'f'
,
7
));
ui
->
lineEdit_icon_lon
->
setText
(
QString
(
"%1"
).
arg
(
mlon
,
0
,
'f'
,
7
));
//Warp
while
(
wx
<
0
)
wx
+=
winsz
;
while
(
wx
>
winsz
-
1
)
wx
-=
winsz
;
...
...
@@ -473,8 +490,8 @@ QTVP_GEOMARKER::geoItemBase * qtvplugin_geomarker::update_polygon (const QStr
QTVP_GEOMARKER
::
geoGraphicsPolygonItem
*
pitem
=
base
?
dynamic_cast
<
QTVP_GEOMARKER
::
geoGraphicsPolygonItem
*>
(
base
)
:
0
;
if
(
!
pitem
)
pitem
=
new
QTVP_GEOMARKER
::
geoGraphicsPolygonItem
(
name
,
this
->
m_pVi
,
latlons
);
this
->
m_pVi
,
latlons
);
pitem
->
setPen
(
pen
);
pitem
->
setBrush
(
brush
);
...
...
@@ -501,3 +518,51 @@ QTVP_GEOMARKER::geoItemBase * qtvplugin_geomarker::update_polygon (const QStr
}
return
res
;
}
QTVP_GEOMARKER
::
geoItemBase
*
qtvplugin_geomarker
::
update_icon
(
const
QString
&
name
,
double
lat
,
double
lon
,
int
centerx
,
int
centery
,
QString
id
)
{
QTVP_GEOMARKER
::
geoItemBase
*
res
=
0
;
//Get raw Item by name
QTVP_GEOMARKER
::
geoItemBase
*
base
=
m_pScene
->
geoitem_by_name
(
name
);
//Get Props
QStringList
propNames
;
QVariantList
propValues
;
if
(
base
)
{
propNames
=
base
->
prop_names
();
propValues
=
base
->
prop_values
();
}
//type convertion to T
QTVP_GEOMARKER
::
geoGraphicsPixmapItem
*
pitem
=
base
?
dynamic_cast
<
QTVP_GEOMARKER
::
geoGraphicsPixmapItem
*>
(
base
)
:
0
;
if
(
!
pitem
)
{
pitem
=
new
QTVP_GEOMARKER
::
geoGraphicsPixmapItem
(
name
,
this
->
m_pVi
,
lat
,
lon
,
centerx
,
centery
);
if
(
m_map_icons
.
contains
(
id
))
pitem
->
setPixmap
(
m_map_icons
[
id
].
icon
);
}
if
(
base
==
pitem
)
{
pitem
->
setGeo
(
lat
,
lon
);
pitem
->
setCenterOffset
(
centerx
,
centery
);
res
=
pitem
;
}
else
if
(
false
==
this
->
m_pScene
->
addItem
(
pitem
,
0
))
{
if
(
base
!=
pitem
)
delete
pitem
;
}
else
{
int
cs
=
propNames
.
size
();
for
(
int
i
=
0
;
i
<
cs
&&
base
!=
pitem
;
++
i
)
{
pitem
->
set_prop_data
(
propNames
.
first
(),
propValues
.
first
());
propNames
.
pop_front
();
propValues
.
pop_front
();
}
res
=
pitem
;
}
return
res
;
}
qtvplugin_geomarker/qtvplugin_geomarker.h
浏览文件 @
538431b7
...
...
@@ -50,6 +50,15 @@ private:
QMap
<
QString
,
QString
>
styles
;
QMap
<
QString
,
QString
>
props
;
};
struct
tag_icon
{
QString
name
;
QString
filename
;
QPixmap
icon
;
int
centerx
;
int
centery
;
};
//The global icon map
QMap
<
QString
,
tag_icon
>
m_map_icons
;
public:
qtvplugin_geomarker
(
QWidget
*
parent
=
0
);
...
...
@@ -85,6 +94,7 @@ private:
QStandardItemModel
*
m_pFillStyleModel
;
QStandardItemModel
*
m_pGeoItemModel
;
QStandardItemModel
*
m_pGeoPropModel
;
QStandardItemModel
*
m_pIconsModel
;
//persistent functions
private:
...
...
@@ -107,6 +117,8 @@ private:
void
refreshProps
(
QTVP_GEOMARKER
::
geoItemBase
*
itm
);
QColor
string2color
(
const
QString
&
s
);
QString
color2string
(
const
QColor
&
c
);
void
refreshIconModel
();
//Geo mark updating functions
private:
//update methopd for UI
...
...
@@ -114,6 +126,7 @@ private:
QTVP_GEOMARKER
::
geoItemBase
*
update_point
(
const
QString
&
name
,
double
lat
,
double
lon
,
int
width
,
int
height
,
QPen
pen
,
QBrush
brush
);
QTVP_GEOMARKER
::
geoItemBase
*
update_line
(
const
QString
&
name
,
double
lat1
,
double
lon1
,
double
lat2
,
double
lon2
,
QPen
pen
);
QTVP_GEOMARKER
::
geoItemBase
*
update_polygon
(
const
QString
&
name
,
const
QPolygonF
latlons
,
QPen
pen
,
QBrush
brush
);
QTVP_GEOMARKER
::
geoItemBase
*
update_icon
(
const
QString
&
name
,
double
lat
,
double
lon
,
int
centerx
,
int
centery
,
QString
id
);
//update method for XML
bool
xml_update_mark
(
tag_xml_mark
&
mark
);
//update method for plugin function calls
...
...
@@ -155,6 +168,7 @@ protected:
void
loadTranslations
();
//ui slots
protected
slots
:
void
on_comboBox_icons_currentIndexChanged
(
int
index
);
void
on_pushButton_update_clicked
();
void
on_radioButton_tool_point_toggled
(
bool
);
void
on_radioButton_tool_line_toggled
(
bool
);
...
...
@@ -172,6 +186,7 @@ protected slots:
void
on_pushButton_getPolygon_clicked
();
void
on_pushButton_save_clicked
();
void
on_pushButton_load_clicked
();
void
on_pushButton_import_icon_clicked
();
};
template
<
class
T
>
...
...
qtvplugin_geomarker/qtvplugin_geomarker.ui
浏览文件 @
538431b7
...
...
@@ -6,7 +6,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
446
</width>
<width>
505
</width>
<height>
426
</height>
</rect>
</property>
...
...
@@ -437,7 +437,93 @@
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"page_bitmap"
/>
<widget
class=
"QWidget"
name=
"page_bitmap"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_9"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_18"
>
<item>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"text"
>
<string>
icon
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"comboBox_icons"
/>
</item>
<item>
<widget
class=
"QPushButton"
name=
"pushButton_import_icon"
>
<property
name=
"text"
>
<string>
import
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_5"
>
<item>
<widget
class=
"QLabel"
name=
"label_18"
>
<property
name=
"text"
>
<string>
center offset x=
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"spinBox_icon_cenoffx"
>
<property
name=
"minimum"
>
<number>
0
</number>
</property>
<property
name=
"maximum"
>
<number>
2147483647
</number>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_21"
>
<property
name=
"text"
>
<string>
,y=
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"spinBox_icon_cenoffy"
>
<property
name=
"minimum"
>
<number>
0
</number>
</property>
<property
name=
"maximum"
>
<number>
2147483647
</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_17"
>
<item>
<widget
class=
"QLabel"
name=
"label_22"
>
<property
name=
"text"
>
<string>
Latitude
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit_icon_lat"
/>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_17"
>
<property
name=
"text"
>
<string>
Longitude
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit_icon_lon"
/>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
...
...
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
浏览文件 @
538431b7
...
...
@@ -173,7 +173,10 @@ void qtvplugin_geomarker::ini_save()
settings
.
setValue
(
"ui/spinBox_textWeight"
,
ui
->
spinBox_textWeight
->
value
());
settings
.
setValue
(
"ui/spinBox_fontSize"
,
ui
->
spinBox_fontSize
->
value
());
settings
.
setValue
(
"ui/spinBox_icon_cenoffx"
,
ui
->
spinBox_icon_cenoffx
->
value
());
settings
.
setValue
(
"ui/spinBox_icon_cenoffy"
,
ui
->
spinBox_icon_cenoffy
->
value
());
settings
.
setValue
(
"ui/lineEdit_icon_lat"
,
ui
->
lineEdit_icon_lat
->
text
());
settings
.
setValue
(
"ui/lineEdit_icon_lon"
,
ui
->
lineEdit_icon_lon
->
text
());
}
void
qtvplugin_geomarker
::
ini_load
()
...
...
@@ -253,6 +256,16 @@ void qtvplugin_geomarker::ini_load()
int
spinBox_textWeight
=
settings
.
value
(
"ui/spinBox_textWeight"
,
16
).
toInt
();
ui
->
spinBox_textWeight
->
setValue
(
spinBox_textWeight
);
int
spinBox_icon_cenoffx
=
settings
.
value
(
"ui/spinBox_icon_cenoffx"
,
0
).
toInt
();
ui
->
spinBox_icon_cenoffx
->
setValue
(
spinBox_icon_cenoffx
);
int
spinBox_icon_cenoffy
=
settings
.
value
(
"ui/spinBox_icon_cenoffy"
,
0
).
toInt
();
ui
->
spinBox_icon_cenoffy
->
setValue
(
spinBox_icon_cenoffy
);
QString
lineEdit_icon_lat
=
settings
.
value
(
"ui/lineEdit_icon_lat"
,
"0"
).
toString
();
ui
->
lineEdit_icon_lat
->
setText
(
lineEdit_icon_lat
);
QString
lineEdit_icon_lon
=
settings
.
value
(
"ui/lineEdit_icon_lon"
,
"0"
).
toString
();
ui
->
lineEdit_icon_lon
->
setText
(
lineEdit_icon_lon
);
}
void
qtvplugin_geomarker
::
on_pushButton_update_clicked
()
{
...
...
@@ -355,6 +368,15 @@ void qtvplugin_geomarker::on_pushButton_update_clicked()
newitem
=
update_polygon
(
name
,
latlons
,
pen
,
brush
);
}
else
if
(
ui
->
radioButton_tool_bitmaps
->
isChecked
())
{
double
lat
=
ui
->
lineEdit_icon_lat
->
text
().
toDouble
();
double
lon
=
ui
->
lineEdit_icon_lon
->
text
().
toDouble
();
int
cenx
=
ui
->
spinBox_icon_cenoffx
->
value
();
int
ceny
=
ui
->
spinBox_icon_cenoffy
->
value
();
QString
iconname
=
ui
->
comboBox_icons
->
currentText
();
newitem
=
update_icon
(
name
,
lat
,
lon
,
cenx
,
ceny
,
iconname
);
}
else
return
;
if
(
newitem
)
...
...
@@ -577,6 +599,17 @@ void qtvplugin_geomarker::refreshItemUI(QString markname)
}
//end if item
}
void
qtvplugin_geomarker
::
refreshIconModel
()
{
m_pIconsModel
->
clear
();
foreach
(
QString
key
,
m_map_icons
.
keys
())
{
QStandardItem
*
item
=
new
QStandardItem
(
key
);
QIcon
icon
(
m_map_icons
[
key
].
icon
);
item
->
setIcon
(
icon
);
m_pIconsModel
->
appendRow
(
item
);
}
}
void
qtvplugin_geomarker
::
refreshProps
(
QTVP_GEOMARKER
::
geoItemBase
*
itm
)
{
...
...
@@ -633,3 +666,17 @@ void qtvplugin_geomarker::on_pushButton_load_clicked()
scheduleRefreshMarks
();
m_pVi
->
UpdateWindow
();
}
void
qtvplugin_geomarker
::
on_comboBox_icons_currentIndexChanged
(
int
index
)
{
QString
strKey
=
ui
->
comboBox_icons
->
itemText
(
index
);
if
(
m_map_icons
.
contains
(
strKey
))
{
tag_icon
&
icon
=
m_map_icons
[
strKey
];
ui
->
spinBox_icon_cenoffx
->
setValue
(
icon
.
centerx
);
ui
->
spinBox_icon_cenoffy
->
setValue
(
icon
.
centery
);
}
}
void
qtvplugin_geomarker
::
on_pushButton_import_icon_clicked
()
{
}
qtvplugin_geomarker/resources.qrc
浏览文件 @
538431b7
<RCC>
<qresource prefix="/"/>
<qresource prefix="/">
<file>icons/people.ico</file>
<file>icons/Medical.png</file>
</qresource>
</RCC>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录