Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
qplanetosm
提交
2b33ba4d
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 搜索 >>
提交
2b33ba4d
编写于
2月 08, 2016
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add scale and rotate feature for icons.
上级
2afc4fb0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
87 addition
and
9 deletion
+87
-9
qtvplugin_geomarker/geographicspixmapitem.cpp
qtvplugin_geomarker/geographicspixmapitem.cpp
+5
-1
qtvplugin_geomarker/qtvplugin_geomarker.cpp
qtvplugin_geomarker/qtvplugin_geomarker.cpp
+18
-5
qtvplugin_geomarker/qtvplugin_geomarker.h
qtvplugin_geomarker/qtvplugin_geomarker.h
+1
-1
qtvplugin_geomarker/qtvplugin_geomarker.ui
qtvplugin_geomarker/qtvplugin_geomarker.ui
+31
-0
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
+25
-1
qtvplugin_geomarker/qtvplugin_geomarker_xml.cpp
qtvplugin_geomarker/qtvplugin_geomarker_xml.cpp
+7
-1
未找到文件。
qtvplugin_geomarker/geographicspixmapitem.cpp
浏览文件 @
2b33ba4d
...
...
@@ -24,6 +24,8 @@ namespace QTVP_GEOMARKER{
vi
()
->
CV_LLA2World
(
m_lat
,
m_lon
,
&
px
,
&
py
);
setOffset
(
px
-
m_pIcon
->
centerx
,
py
-
m_pIcon
->
centery
);
QGraphicsPixmapItem
::
setPixmap
(
m_pIcon
->
icon
);
QGraphicsPixmapItem
::
setTransformOriginPoint
(
px
,
py
);
QGraphicsPixmapItem
::
setTransformationMode
(
Qt
::
FastTransformation
);
}
void
geoGraphicsPixmapItem
::
adjust_coords
(
int
ncurrLevel
)
{
...
...
@@ -38,6 +40,7 @@ namespace QTVP_GEOMARKER{
double
oldlefttop_x
=
offset
.
x
()
+
m_pIcon
->
centerx
;
double
oldlefttop_y
=
offset
.
y
()
+
m_pIcon
->
centery
;
setOffset
(
oldlefttop_x
*
ratio
-
m_pIcon
->
centerx
,
oldlefttop_y
*
ratio
-
m_pIcon
->
centery
);
QGraphicsPixmapItem
::
setTransformOriginPoint
(
oldlefttop_x
*
ratio
,
oldlefttop_y
*
ratio
);
}
}
...
...
@@ -49,7 +52,7 @@ namespace QTVP_GEOMARKER{
double
px
,
py
;
vi
()
->
CV_LLA2World
(
m_lat
,
m_lon
,
&
px
,
&
py
);
setOffset
(
px
-
m_pIcon
->
centerx
,
py
-
m_pIcon
->
centery
);
QGraphicsPixmapItem
::
setTransformOriginPoint
(
px
,
py
);
}
void
geoGraphicsPixmapItem
::
setGeo
(
qreal
cent_lat
,
qreal
cent_lon
)
...
...
@@ -59,6 +62,7 @@ namespace QTVP_GEOMARKER{
double
px
,
py
;
vi
()
->
CV_LLA2World
(
cent_lat
,
cent_lon
,
&
px
,
&
py
);
setOffset
(
px
-
m_pIcon
->
centerx
,
py
-
m_pIcon
->
centery
);
QGraphicsPixmapItem
::
setTransformOriginPoint
(
px
,
py
);
adjustLabelPos
();
}
void
geoGraphicsPixmapItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
...
...
qtvplugin_geomarker/qtvplugin_geomarker.cpp
浏览文件 @
2b33ba4d
...
...
@@ -228,6 +228,7 @@ void qtvplugin_geomarker::cb_levelChanged(int level)
return
;
//Adjust new Scene rect
QRectF
rect
(
0
,
0
,
256
*
(
1
<<
level
),
256
*
(
1
<<
level
));
m_pScene
->
setSceneRect
(
QRectF
(
0
,
0
,
1
,
1
));
m_pScene
->
adjust_item_coords
(
level
);
m_pScene
->
setSceneRect
(
rect
);
}
...
...
@@ -285,10 +286,13 @@ bool qtvplugin_geomarker::cb_mouseDoubleClickEvent(QMouseEvent * e)
double
mlat
,
mlon
;
m_pVi
->
CV_DP2World
(
mouse_view_pt
.
x
(),
mouse_view_pt
.
y
(),
&
wx
,
&
wy
);
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
));
if
(
e
->
button
()
==
Qt
::
RightButton
)
{
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
;
...
...
@@ -518,7 +522,7 @@ 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
,
QString
id
)
QTVP_GEOMARKER
::
geoItemBase
*
qtvplugin_geomarker
::
update_icon
(
const
QString
&
name
,
double
lat
,
double
lon
,
qreal
scale
,
qreal
rotate
,
int
smooth
,
QString
id
)
{
QTVP_GEOMARKER
::
geoItemBase
*
res
=
0
;
//Get raw Item by name
...
...
@@ -571,5 +575,14 @@ QTVP_GEOMARKER::geoItemBase * qtvplugin_geomarker::update_icon(const QString & n
}
res
=
pitem
;
}
if
(
pitem
)
{
pitem
->
setScale
(
scale
);
pitem
->
setRotation
(
rotate
);
if
(
smooth
)
pitem
->
setTransformationMode
(
Qt
::
SmoothTransformation
);
else
pitem
->
setTransformationMode
(
Qt
::
FastTransformation
);
}
return
res
;
}
qtvplugin_geomarker/qtvplugin_geomarker.h
浏览文件 @
2b33ba4d
...
...
@@ -120,7 +120,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
,
QString
id
);
QTVP_GEOMARKER
::
geoItemBase
*
update_icon
(
const
QString
&
name
,
double
lat
,
double
lon
,
qreal
scale
,
qreal
rotate
,
int
smooth
,
QString
id
);
//update method for XML
bool
xml_update_mark
(
tag_xml_mark
&
mark
);
//update method for plugin function calls
...
...
qtvplugin_geomarker/qtvplugin_geomarker.ui
浏览文件 @
2b33ba4d
...
...
@@ -451,6 +451,13 @@
<item>
<widget
class=
"QComboBox"
name=
"comboBox_icons"
/>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"checkBox_icon_smooth"
>
<property
name=
"text"
>
<string>
smooth
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"pushButton_import_icon"
>
<property
name=
"text"
>
...
...
@@ -460,6 +467,30 @@
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_19"
>
<item>
<widget
class=
"QLabel"
name=
"label_26"
>
<property
name=
"text"
>
<string>
scale ratio
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit_icon_scale"
/>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_18"
>
<property
name=
"text"
>
<string>
rotate
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit_icon_rotate"
/>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_17"
>
<item>
...
...
qtvplugin_geomarker/qtvplugin_geomarker_uimethods.cpp
浏览文件 @
2b33ba4d
...
...
@@ -177,6 +177,8 @@ void qtvplugin_geomarker::ini_save()
settings
.
setValue
(
"ui/spinBox_fontSize"
,
ui
->
spinBox_fontSize
->
value
());
settings
.
setValue
(
"ui/lineEdit_icon_lat"
,
ui
->
lineEdit_icon_lat
->
text
());
settings
.
setValue
(
"ui/lineEdit_icon_lon"
,
ui
->
lineEdit_icon_lon
->
text
());
settings
.
setValue
(
"ui/lineEdit_icon_rotate"
,
ui
->
lineEdit_icon_rotate
->
text
());
settings
.
setValue
(
"ui/lineEdit_icon_scale"
,
ui
->
lineEdit_icon_scale
->
text
());
}
void
qtvplugin_geomarker
::
ini_load
()
...
...
@@ -264,6 +266,11 @@ void qtvplugin_geomarker::ini_load()
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
);
QString
lineEdit_icon_scale
=
settings
.
value
(
"ui/lineEdit_icon_scale"
,
"1.0"
).
toString
();
ui
->
lineEdit_icon_scale
->
setText
(
lineEdit_icon_scale
);
QString
lineEdit_icon_rotate
=
settings
.
value
(
"ui/lineEdit_icon_rotate"
,
"1.0"
).
toString
();
ui
->
lineEdit_icon_rotate
->
setText
(
lineEdit_icon_rotate
);
}
void
qtvplugin_geomarker
::
on_pushButton_update_clicked
()
{
...
...
@@ -370,8 +377,11 @@ void qtvplugin_geomarker::on_pushButton_update_clicked()
{
double
lat
=
ui
->
lineEdit_icon_lat
->
text
().
toDouble
();
double
lon
=
ui
->
lineEdit_icon_lon
->
text
().
toDouble
();
qreal
scale
=
ui
->
lineEdit_icon_scale
->
text
().
toFloat
();
qreal
rotate
=
ui
->
lineEdit_icon_rotate
->
text
().
toFloat
();
QString
iconname
=
ui
->
comboBox_icons
->
currentText
();
newitem
=
update_icon
(
name
,
lat
,
lon
,
iconname
);
int
smooth
=
ui
->
checkBox_icon_smooth
->
isChecked
()
?
1
:
0
;
newitem
=
update_icon
(
name
,
lat
,
lon
,
scale
,
rotate
,
smooth
,
iconname
);
}
else
return
;
...
...
@@ -562,6 +572,20 @@ void qtvplugin_geomarker::refreshItemUI(QString markname)
ui
->
radioButton_tool_polygon
->
setChecked
(
true
);
}
break
;
case
QTVP_GEOMARKER
::
ITEAMTYPE_PIXMAP
:
{
QTVP_GEOMARKER
::
geoGraphicsPixmapItem
*
pitem
=
dynamic_cast
<
QTVP_GEOMARKER
::
geoGraphicsPixmapItem
*>
(
item
);
if
(
!
pitem
)
break
;
ui
->
lineEdit_icon_lat
->
setText
(
QString
(
"%1"
).
arg
(
pitem
->
lat
(),
0
,
'f'
,
7
));
ui
->
lineEdit_icon_lon
->
setText
(
QString
(
"%1"
).
arg
(
pitem
->
lon
(),
0
,
'f'
,
7
));
ui
->
radioButton_tool_bitmaps
->
setChecked
(
true
);
ui
->
lineEdit_icon_rotate
->
setText
(
QString
(
"%1"
).
arg
(
pitem
->
rotation
()));
ui
->
lineEdit_icon_scale
->
setText
(
QString
(
"%1"
).
arg
(
pitem
->
scale
()));
QString
nameicon
=
pitem
->
icon
()
->
name
;
ui
->
comboBox_icons
->
setCurrentText
(
nameicon
);
}
break
;
default:
break
;
...
...
qtvplugin_geomarker/qtvplugin_geomarker_xml.cpp
浏览文件 @
2b33ba4d
...
...
@@ -141,6 +141,9 @@ bool qtvplugin_geomarker::xml_save(QString xml)
//1.2 style
stream
.
writeStartElement
(
"style"
);
stream
.
writeTextElement
(
"icon"
,
QString
(
"%1"
).
arg
(
pU
->
icon
()
->
name
));
stream
.
writeTextElement
(
"scale"
,
QString
(
"%1"
).
arg
(
pU
->
scale
()));
stream
.
writeTextElement
(
"rotate"
,
QString
(
"%1"
).
arg
(
pU
->
rotation
()));
stream
.
writeTextElement
(
"smooth"
,
QString
(
"%1"
).
arg
(
pU
->
transformationMode
()
==
Qt
::
SmoothTransformation
?
1
:
0
));
}
}
break
;
...
...
@@ -431,7 +434,10 @@ bool qtvplugin_geomarker::xml_update_mark(tag_xml_mark & mark)
double
lat
=
mark
.
geoPoints
.
first
().
y
();
double
lon
=
mark
.
geoPoints
.
first
().
x
();
QString
iconName
=
mark
.
styles
[
"icon"
];
newitem
=
update_icon
(
name
,
lat
,
lon
,
iconName
);
qreal
scale
=
mark
.
styles
[
"scale"
].
toFloat
();
qreal
rotate
=
mark
.
styles
[
"rotate"
].
toFloat
();
int
smooth
=
mark
.
styles
[
"smooth"
].
toInt
();
newitem
=
update_icon
(
name
,
lat
,
lon
,
scale
,
rotate
,
smooth
,
iconName
);
}
else
return
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录