📄 使用arcgis engine 开发自定义gis应用--第六部分(续实例二) - gis大讲堂.htm
字号:
<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#pid33846')"
href="http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=6656&extra=page%3D1###">#3</A></DIV>
<DIV style="PADDING-TOP: 4px">发表于 2007-3-13 11:30 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=33846"
name=pid33846></A><SPAN class=bold>回复 #2 北斗星 的帖子</SPAN><BR><BR>
<DIV style="FONT-SIZE: 12px"><B><FONT size=3>第四步:增加SCENECONTROL控件的
DRAPE窗帘功能和垂直扩展选项<BR>在这一节里你将增加窗帘对拖动的选择图层到3D表面上。<BR>1)
In the frm3DControls.vb window, from
the left dropdown list, click lstLayers.<BR>2)
From the right dropdown list, click
SelectedIndexChanged.<BR>3)
NOTE: Alternatively, you can double-click the
control.<BR>4) Add the
following code to
lstLayers_SelectedIndexChanged:</FONT></B><BR>Private Sub
lstlayers_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As<BR>System.EventArgs) Handles
lstLayers.SelectedIndexChanged<BR>if (lstLayers.getSelectedValue()
== null) return;<BR>Dim layer As ILayer<BR>layer
=<BR>m_scene.Layer(Functions.GetLayerIndex(lstLayers.SelectedItems.Item(0),<BR>m_scene.Layers))<BR>m_scene.ExaggerationFactor
= 2<BR>'Drape layer over surface<BR>Dim pSurface As ISurface<BR>Dim
pBands As IRasterBandCollection<BR>Dim p3DProps As
I3DProperties<BR>Dim i As Integer<BR>Dim pLayerExts As
ILayerExtensions<BR>pSurface
=<BR>Functions.GetSurfaceFromTinLayer(Functions.GetSceneLayers(m_scene))<BR>If
(pSurface Is Nothing) Then<BR>MsgBox("No 3D layer detected, please
add a tin layer")<BR>Exit Sub<BR>End If<BR>pLayerExts = layer<BR>For
i = 0 To pLayerExts.ExtensionCount - 1<BR>If TypeOf
pLayerExts.Extension(i) Is I3DProperties Then<BR>p3DProps =
pLayerExts.Extension(i)<BR>p3DProps.BaseSurface =
pSurface<BR>p3DProps.BaseOption =
esriBaseOption.esriBaseSurface<BR>Exit For<BR>End
If<BR>Next<BR>m_scene.ExaggerationFactor =
trkVerticalExaggeration.Value<BR>m_scene.SceneGraph.Invalidate(layer,
True, False)<BR>AxSceneControl1.Refresh()<BR>End Sub<BR><B><FONT
size=3>5) Save and build the
solution.<BR>6) Now you will
add the functionality to change the exaggeration of the
surface.<BR>7) In the
frm3DControls.vb window, from the left dropdown list,
click trkVerticalExaggeration.<BR>8)
From the right dropdown list, click
Scroll.<BR>a) NOTE:
Alternatively, you can double-click the control.<BR>9)
Add the following code to the
trkVerticalExaggeration_Scroll event:<BR></FONT></B>Private Sub
trkVerticalExaggeration_Scroll(ByVal sender As System.Object, ByVal
e As<BR>System.EventArgs) Handles
trkVerticalExaggeration.Scroll<BR>trkVerticalExaggeration.Minimum =
1<BR>m_scene.ExaggerationFactor =
trkVerticalExaggeration.Value<BR>AxSceneControl1.Refresh()<BR>End
Sub<BR><B><FONT size=3>10) Save
and build the solution.<BR>11)
Run the application.<BR>12)
Use the Load lyr/mxd file button to load the Death
Valley Terrain.lyr file
from \student\daae\data\scenedata\.<BR>13)
Use the Add Raster Layer button to load the
dvim3.tif file from \student\daae\data\scenedata\data.<BR>14)
Use the Navigation tool to view the
layers from the side.<BR>15)
Click the TIFF layer in the list
box.<BR></FONT></B><BR><B><FONT
size=3>第五步:在GLOBECONTROL中增加记录跟踪功能<BR>这这节里,你将增加记录跟踪功能进行回放。<BR>1)
In the frm3DControls.vb [Design],
click the Globe tab.<BR>Before you implement these controls, you
need to set some member variable values<BR>when the form loads. You
also need to load a temporary animation file to save the<BR>recorded
tracks.<BR>2) In the
frm3DControls.vb code window, add the following code
to frm3DControls_Load:<BR></FONT></B>Private Sub
frm3DControls_Load(ByVal eventSender As System.Object, ByVal
eventArgs As<BR>System.EventArgs) Handles
MyBase.Load<BR>...<BR>'Globe<BR>AxToolbarControl3.SetBuddyControl(AxGlobeControl1)<BR>AxToolbarControl3.AddItem("esriGlobeCore.ControlsGlobeGlobeToolbar",
, -1, True,
,<BR>esriCommandStyles.esriCommandStyleIconOnly)<BR>AxToolbarControl3.AddItem("esriGlobeCore.ControlsGlobeRotateToolbar",
, -1, True,
,<BR>esriCommandStyles.esriCommandStyleIconOnly)<BR>m_globe =
AxGlobeControl1.Globe<BR>m_pglbDisplay =
AxGlobeControl1.GlobeDisplay<BR>' Load or create animation
file<BR>m_strAnimationFile = System.IO.Directory.GetCurrentDirectory
+<BR>"\DaaeAnimationFile.aga"<BR>Functions.LoadAnimation(m_globe,
m_strAnimationFile)<BR>m_animTrack =
Me.GetTrackFromAnimationFile()<BR>Me.Text = "3D Controls"<BR>End
sub<BR><B><FONT size=3>3) In
the frm3DControls.vb window, add a function to get the track from
the animation file:<BR></FONT></B>Private Function
GetTrackFromAnimationFile() As IAnimationTrack<BR>' Find or create a
animation track<BR>Dim camera As ICamera<BR>camera =
m_globe.GlobeDisplay.ActiveViewer.Camera<BR>Dim animType As
IAnimationType<BR>animType = New AnimationTypeGlobeCamera<BR>Dim
animTracks As IAnimationTracks<BR>animTracks = m_globe<BR>Dim
outAnimationTrack As
IAnimationTrack<BR>animTracks.FindTrack("Capture View",
outAnimationTrack)<BR>If outAnimationTrack Is Nothing Or
animTracks.TrackCount = 0 Then<BR>outAnimationTrack = New
AnimationTrack<BR>outAnimationTrack.AnimationType =
animType<BR>outAnimationTrack.Name = "Capture
View"<BR>outAnimationTrack.AttachObject(camera)<BR>outAnimationTrack.ApplyToAllViewers
= True<BR>animTracks.AddTrack(outAnimationTrack)<BR>End If<BR>Return
outAnimationTrack<BR>End Function<BR><BR><B><FONT size=3>Now add the
functionality to start the frame captures when the check box is
checked.<BR>4) In the
frm3DControls.vb window, from the left dropdown list, click
chkStartStop.<BR>5) From the
right dropdown list, click CheckedChanged.<BR>a)
NOTE: Alternatively, you can double-click the
control.<BR>6) Add the
following code to chkStartStop_CheckedChanged:<BR></FONT></B>Private
Sub chkStartStop_CheckedChanged(ByVal sender As System.Object, ByVal
e As<BR>System.EventArgs) Handles chkStartStop.CheckedChanged<BR>If
chkStartStop.CheckState = CheckState.Checked Then<BR>m_animTrack =
Me.GetTrackFromAnimationFile()<BR>' Take a snapshot of the current
view<BR>Functions.CaptureKeyFrame(m_globe,
m_animTrack)<BR>lstKeyFrames.Items.Clear()<BR>Functions.ListKeyFrames(m_animTrack,
lstKeyFrames)<BR>End If<BR>End sub<BR><BR><B><FONT size=3>Now add
functionality to capture frames after each draw event fired by the
globe.<BR>7) In the
frm3DControls.vb window, from the left dropdown list, click
m_pglbDisplay.<BR>8) From the
right dropdown list, click AfterDraw.<BR>9)
Add the following code to
m_pglbDisplay_AfterDraw:<BR></FONT></B>Private Sub
m_pglbDisplay_AfterDraw(ByVal pViewer
As<BR>ESRI.ArcGIS.Analyst3D.ISceneViewer) Handles
m_pglbDisplay.AfterDraw<BR>If (chkStartStop.CheckState =
CheckState.Checked) Then<BR>Dim globeDisplay As
IGlobeDisplay<BR>globeDisplay = m_globe.GlobeDisplay<BR>If (Not
globeDisplay.IsNavigating) Then<BR>If (m_notCapture) Then<BR>'
Capture key frames after globe is done
drawing<BR>Functions.CaptureKeyFrame(m_globe,
m_animTrack)<BR>lstKeyFrames.Items.Add(m_animTrack.Keyframe(m_animTrack.KeyframeCount
- 1).Name)<BR>End If<BR>m_notCapture = Not m_notCapture<BR>End
If<BR>End If<BR>End Sub<BR>Save and build the solution.<BR><B><FONT
size=3>10) Run the
application.<BR>11) Click the
Globe tab.<BR>12) Use the Load
lyr/mxd button to open a the World Image.lyr file in
\student\daae\data\globedata\.<BR>13)
Check Start/Stop Recording.<BR>14)
Zoom in and out of the display and
navigate around.</FONT></B><BR><BR>[<I> 本帖最后由 北斗星 于 2007-3-13 11:32
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=33846&extra=page%3D1">引用</A>
<A
href="http://bbs.esrichina-bj.cn/ESRI/misc.php?action=report&fid=14&tid=6656&pid=33846&page=1">报告</A>
<A onclick="fastreply('回复 #3 北斗星 的帖子')"
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">[广告]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -