最近在做地图切片方面的研究,昨天浏览
E
都市时突然想到
ArcSence
中三维图片输出的问题。记得以前自己好像用
VB
做过这方面的开发,还因为找不到输出接口而心烦不已,好像现在又忘记了。早上跑到公司,找到以前写的代码,赶快记录下来,说不定哪一天还可以派上大用场
^-^
。
代码极其简单,可是如果稍加变化,可以做出很漂亮的东西哦!不知道大家想到怎么样去用它没有,我倒是有了一个很好的想法,呵呵!
下面请看代码:
1
'
输出三维图片
2
Private
Sub
menuExportImage_Click()
3
'
设置保存对话框属性
4
With
CommonDialog1
5
'
设置标题
6
.DialogTitle
=
"
保存三维图片
"
7
'
只能输入文件名文本框已经存在的文件名 ,隐藏只读,对存在的文件提示是否覆盖
8
.flags
=
cdlOFNPathMustExist
+
cdlOFNExplorer
+
cdlOFNHideReadOnly
+
cdlOFNOverwritePrompt
9
'
默认的扩展名
10
.DefaultExt
=
"
jpg
"
11
'
文件筛选器
12
.Filter
=
"
jpg文件|*.jpg|bmp文件|*.bmp
"
13
.CancelError
=
False
14
.fileName
=
""
15
'
保存
16
.ShowSave
17
End
With
18
If
Trim
(CommonDialog1.fileName
<>
""
)
Then
19
If
CommonDialog1.FilterIndex
=
1
Then
20
SceneControl1.SceneViewer.GetScreenShot JPEG, CommonDialog1.fileName
21
Else
22
SceneControl1.SceneViewer.GetScreenShot BMP, CommonDialog1.fileName
23
End
If
24
25
MsgBox
"
图片导出成功!
"
, vbOKOnly,
"
信息提示!
"
26
End
If
27
End Sub
1
'
输出三维图片
2
Private
Sub
menuExportImage_Click()
3
'
设置保存对话框属性
4
With
CommonDialog1
5
'
设置标题
6
.DialogTitle
=
"
保存三维图片
"
7
'
只能输入文件名文本框已经存在的文件名 ,隐藏只读,对存在的文件提示是否覆盖
8
.flags
=
cdlOFNPathMustExist
+
cdlOFNExplorer
+
cdlOFNHideReadOnly
+
cdlOFNOverwritePrompt
9
'
默认的扩展名
10
.DefaultExt
=
"
jpg
"
11
'
文件筛选器
12
.Filter
=
"
jpg文件|*.jpg|bmp文件|*.bmp
"
13
.CancelError
=
False
14
.fileName
=
""
15
'
保存
16
.ShowSave
17
End
With
18
If
Trim
(CommonDialog1.fileName
<>
""
)
Then
19
If
CommonDialog1.FilterIndex
=
1
Then
20
SceneControl1.SceneViewer.GetScreenShot JPEG, CommonDialog1.fileName
21
Else
22
SceneControl1.SceneViewer.GetScreenShot BMP, CommonDialog1.fileName
23
End
If
24
25
MsgBox
"
图片导出成功!
"
, vbOKOnly,
"
信息提示!
"
26
End
If
27
End Sub