📄 使用arcgis engine 开发自定义gis应用--第六部分(续实例二) - gis大讲堂.htm
字号:
href="http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=5193&extra=page%3D1"
target=_blank>恭喜社区单日发帖接近500,查看详情!
</A></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV>
<DIV class=spaceborder style="MARGIN-BOTTOM: 4px; WIDTH: 98%">
<TABLE class=t_row cellSpacing=0 cellPadding=4 width="100%" align=center>
<TBODY>
<TR style="HEIGHT: 100%">
<TD class=t_user vAlign=top width="18%"><A class=bold
href="http://bbs.esrichina-bj.cn/ESRI/viewpro.php?uid=5624"
target=_blank>北斗星</A> <SPAN class=smalltxt>(北斗星)</SPAN> <BR>
<DIV class=smalltxt>超级版主<BR><IMG alt="Rank: 8"
src="使用ArcGIS Engine 开发自定义GIS应用--第六部分(续实例二) - GIS大讲堂.files/star_level3.gif"><IMG
alt="Rank: 8"
src="使用ArcGIS Engine 开发自定义GIS应用--第六部分(续实例二) - GIS大讲堂.files/star_level3.gif"><BR><BR>
<TABLE style="TABLE-LAYOUT: fixed; OVERFLOW: hidden" cellSpacing=0
cellPadding=0 width="95%" border=0>
<TBODY>
<TR>
<TD align=middle>
<DIV class=avatar style="WIDTH: 120px"><IMG height=89 alt=""
src="使用ArcGIS Engine 开发自定义GIS应用--第六部分(续实例二) - GIS大讲堂.files/5624.jpg"
width=120 border=0></DIV></TD></TR></TBODY></TABLE><BR><IMG alt=优秀讲师勋章
src="使用ArcGIS Engine 开发自定义GIS应用--第六部分(续实例二) - GIS大讲堂.files/medal9.gif"
border=0> <IMG alt=优秀版主勋章
src="使用ArcGIS Engine 开发自定义GIS应用--第六部分(续实例二) - GIS大讲堂.files/medal2.gif"
border=0> <BR>UID 5624<BR>精华 <A
href="http://bbs.esrichina-bj.cn/ESRI/digest.php?authorid=5624">10</A>
<BR>积分 3658<BR>帖子 1602<BR>金钱 3158 <BR>威望 50 <BR>阅读权限 201<BR>注册
2006-11-1<BR>状态 离线 </DIV></TD>
<TD
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"
vAlign=top width="82%">
<TABLE class=t_msg cellSpacing=0 cellPadding=4 border=0>
<TBODY>
<TR>
<TD>
<DIV>
<DIV class="right t_number"><A class=bold
onclick="window.clipboardData.setData('text','http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=6656&page=1#pid33845')"
href="http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=6656&extra=page%3D1###">#2</A></DIV>
<DIV style="PADDING-TOP: 4px">发表于 2007-3-13 11:22 PM <A
href="http://bbs.esrichina-bj.cn/ESRI/viewpro.php?uid=5624">资料</A>
<A href="http://bbs.esrichina-bj.cn/ESRI/blog.php?uid=5624"
target=_blank>文集</A> <A
href="http://bbs.esrichina-bj.cn/ESRI/pm.php?action=send&uid=5624"
target=_blank>短消息</A> </DIV></DIV></TD></TR>
<TR>
<TD class=line style="PADDING-TOP: 10px" vAlign=top height="100%"><A
title="评分 0"
href="http://bbs.esrichina-bj.cn/ESRI/misc.php?action=viewratings&tid=6656&pid=33845"
name=pid33845></A><SPAN class=bold>回复 #1 北斗星 的帖子</SPAN><BR><BR>
<DIV style="FONT-SIZE: 12px"><B><FONT
size=3>第二步:增加功能来导入.lyr文件及.MXD文件<BR>在这节里你将增加一个功能来导入图层和地图文档,这些图层是基于2D文件格式并且导入到3D控件中。<BR>1)
Open the frm3DControls.vb code
window.<BR>2) From the left
dropdown list, click btnLoadlyrmxd events.<BR>3)
From the right dropdown list, click Click.NOTE:
Alternatively, you can double-click the control.<BR>4)
In the btnLoadlyrmxd_Click event
procedure, add the following code:</FONT></B><BR>Private Sub
btnLoadlyrmxd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLoadlyrmxd.Click<BR>
' Open a file dialog for selecting map
documents<BR>
OpenFileDialog1.Title = "Add Data"<BR>
OpenFileDialog1.Filter = "Layer Files
(*.lyr)|*.lyr|Map Documents"<BR>(*.mxd)|*.mxd"<BR>
OpenFileDialog1.InitialDirectory =
"c:\student\daae\data\"<BR> If
(OpenFileDialog1.ShowDialog() <> DialogResult.OK) Then Exit
Sub<BR> Dim sFilePath As
String<BR> sFilePath =
OpenFileDialog1.FileName<BR>
Dim mapDocument As IMapDocument<BR>
mapDocument = New
MapDocument<BR> If (Not
mapDocument.IsMapDocument(sFilePath)) Then Exit Sub<BR>
mapDocument.Open(sFilePath)<BR>
Dim scene As IScene<BR>
If TabControl1.SelectedTab Is
tbpgSceneCtrl Then<BR>
'Scene<BR>
scene = AxSceneControl1.Scene<BR>
scene.AddLayers(mapDocument.Map(0).Layers, False)<BR>
ElseIf TabControl1.SelectedTab Is
tbpgGlobeCtrl Then<BR>
'Globe<BR>
scene = AxGlobeControl1.GlobeDisplay.Scene<BR>
scene.AddLayers(mapDocument.Map(0).Layers, False)<BR>
End If<BR>
Me.Text = "3D Controls - " & sFilePath<BR>End
Sub<BR><B><FONT size=3>5) Save
and build the solution.<BR>6)
Run the application.<BR>7)
Click the Scene tab.<BR>8)
Click the Load lyr/mxd button. From the
\student\daae\data\SceneData\ directory,<BR>9)
load the Death Valley Terrain.lyr.<BR>10)
Click the Globe tab.<BR>11)
Click the Load lyr/mxd button. From
the \student\daae\data\GlobeData\ directory,load the
Countries.lyr.<BR></FONT></B><BR><B><FONT
size=3>第三步:在SCENECONTROL控件中加入栅格图层<BR>通过SceneControl的一些属性及方法你将增加栅格影像到你的三维系统中。<BR>1)
Open the frm3DControls.vb code
window.<BR>2) In the
frm3DControls.vb window, from the left dropdown list,
click btnAddRasterLayer.<BR>3)
From the right dropdown list, click
Click.<BR>a) NOTE:
Alternatively, you can double-click the control.<BR>4)
Add the following code to the
btnAddRasterLayer_Click event:<BR><BR></FONT></B>Private Sub
btnAddRasterLayer_Click(ByVal sender As System.Object, ByVal e
As<BR>System.EventArgs) Handles btnAddRasterLayer.Click<BR>Dim file,
filePath, fileName, fileExtension As String<BR>Dim layer As
ILayer<BR>Dim WSFact As IWorkspaceFactory<BR>Dim RasterWorkspace As
IRasterWorkspace<BR>Dim RasterDataset As IRasterDataset<BR>Dim
Rasterlayer As IRasterLayer<BR>'Open a file dialog to add
data<BR>OpenFileDialog1.Filter = "Raster Files (*.tif)|*.tif|All
files (*.*)|*.*"<BR>If (OpenFileDialog1.ShowDialog() <>
DialogResult.OK) Then Exit Sub<BR>file =
OpenFileDialog1.FileName<BR>Try<BR>filePath = file.Substring(0,
file.LastIndexOf("\"))<BR>fileName =
file.Substring(file.LastIndexOf("\") + 1)<BR>fileExtension =
file.Substring(file.LastIndexOf(".") + 1).ToLower<BR>WSFact = New
RasterWorkspaceFactory<BR>RasterWorkspace =
WSFact.OpenFromFile(filePath, 0)<BR>RasterDataset =
RasterWorkspace.OpenRasterDataset(fileName)<BR>Rasterlayer = New
RasterLayer<BR>Rasterlayer.CreateFromDataset(RasterDataset)<BR>layer
= Rasterlayer<BR>m_scene.AddLayer(layer)<BR>Catch ex As
Exception<BR>MsgBox(file + " " + ex.Message)<BR>End
Try<BR>Functions.AddLayerToList(lstLayers,
Functions.GetSceneLayers(m_scene))<BR>End Sub<BR><B><FONT
size=3>5) Save and build the
solution.<BR>6) Now update
tabCotnro11_Click to populate the list when the tab is
activated:<BR></FONT></B>Private Sub TabControl1_Click(ByVal sender
As Object, ByVal e As System.EventArgs)<BR>Handles
TabControl1.Click<BR>If TabControl1.SelectedIndex = 0
Then<BR>AxToolbarControl1.SetBuddyControl(AxSceneControl1)<BR>AxToolbarControl1.RemoveAll()<BR>AxToolbarControl1.AddItem("esri3DAnalyst.ControlsSceneOpenDocCommand",
, -1, False,
,<BR>esriCommandStyles.esriCommandStyleIconAndText)<BR>AxTOCControl1.SetBuddyControl(AxSceneControl1)
' Buddy the Scene<BR>Me.Text = "3D Controls - " +
AxSceneControl1.DocumentFilename<BR>Functions.AddLayerToList(lstLayers,
Functions.GetSceneLayers(m_scene))<BR>Else<BR>AxToolbarControl1.SetBuddyControl(AxGlobeControl1)<BR>AxToolbarControl1.RemoveAll()<BR>AxToolbarControl1.AddItem("esriGlobeCore.ControlsGlobeOpenDocCommand",
, -1, False,
,<BR>esriCommandStyles.esriCommandStyleIconAndText)<BR>AxTOCControl1.SetBuddyControl(AxGlobeControl1)
' Buddy the Globe<BR>Me.Text = "3D Controls - " +
AxGlobeControl1.DocumentFilename<BR>End If<BR>End sub<BR><B><FONT
size=3>7) Save and build the
solution.<BR>8) Run the
application and test the code. Try adding the dvim3.tif file file
from the \student\daae\data\scenedata\data
directory.</FONT></B><BR><BR>[<I> 本帖最后由 北斗星 于 2007-3-13 11:30 PM 编辑
</I>]</DIV></TD></TR>
<TR>
<TD vAlign=bottom><BR><BR><BR><IMG alt=""
src="使用ArcGIS Engine 开发自定义GIS应用--第六部分(续实例二) - GIS大讲堂.files/sigline.gif"><BR>
<DIV class=signature
style="OVERFLOW: hidden; max-height: 20em; maxHeight: 245px">欢迎参加ESRI2007巡展</DIV></TD></TR>
<TR>
<TD align=right> <A
href="http://bbs.esrichina-bj.cn/ESRI/post.php?action=reply&fid=14&tid=6656&repquote=33845&extra=page%3D1">引用</A>
<A
href="http://bbs.esrichina-bj.cn/ESRI/misc.php?action=report&fid=14&tid=6656&pid=33845&page=1">报告</A>
<A onclick="fastreply('回复 #2 北斗星 的帖子')"
href="http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=6656&extra=page%3D1###">回复</A>
<A onclick=scroll(0,0)
href="http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=6656&extra=page%3D1###"><IMG
alt=顶部
src="使用ArcGIS Engine 开发自定义GIS应用--第六部分(续实例二) - GIS大讲堂.files/top.gif"
border=0></A> </TD></TR>
<TR class=t_infoline>
<TD class=line
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; PADDING-TOP: 5px">[广告]
<A
href="http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=10492&extra=page%3D1"
target=_blank>献爱心,迎特奥——ESRI助上海残联造福残疾人事业</A></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV>
<DIV class=spaceborder style="MARGIN-BOTTOM: 4px; WIDTH: 98%">
<TABLE class=t_row cellSpacing=0 cellPadding=4 width="100%" align=center>
<TBODY>
<TR style="HEIGHT: 100%">
<TD class=t_user vAlign=top width="18%"><A class=bold
href="http://bbs.esrichina-bj.cn/ESRI/viewpro.php?uid=5624"
target=_blank>北斗星</A> <SPAN class=smalltxt>(北斗星)</SPAN> <BR>
<DIV class=smalltxt>超级版主<BR><IMG alt="Rank: 8"
src="使用ArcGIS Engine 开发自定义GIS应用--第六部分(续实例二) - GIS大讲堂.files/star_level3.gif"><IMG
alt="Rank: 8"
src="使用ArcGIS Engine 开发自定义GIS应用--第六部分(续实例二) - GIS大讲堂.files/star_level3.gif"><BR><BR>
<TABLE style="TABLE-LAYOUT: fixed; OVERFLOW: hidden" cellSpacing=0
cellPadding=0 width="95%" border=0>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -