GlobeControl中如何实现动画效果?

在ArcGlobe中缩放至本图层时带有动画效果,而GlobeControl中没有,可否开启动画效果?
已邀请:

刘峥 - ArcGIS多面手

赞同来自:

【解决办法】:
该效果在globecontrol中没有对应的选项开启,需要自己通过IAGAnimationTrackKeyframes等接口模拟动画效果,参考代码: 


public void CreateAnimationFromKeyframes(ESRI.ArcGIS.GlobeCore.IGlobe globe) 

// get Globe Camera in the globe display 
ESRI.ArcGIS.GlobeCore.IGlobeDisplay globeDisplay = globe.GlobeDisplay; 

ESRI.ArcGIS.Analyst3D.ISceneViewer sceneViewer = globeDisplay.ActiveViewer; 
ESRI.ArcGIS.Analyst3D.ICamera camera = sceneViewer.Camera; 
ESRI.ArcGIS.GlobeCore.IGlobeCamera globeCamera = (ESRI.ArcGIS.GlobeCore.IGlobeCamera)camera; // Explicit Cast 

// create keyframe 
ESRI.ArcGIS.Animation.IAGKeyframe agKeyframe = new ESRI.ArcGIS.GlobeCore.GlobeCameraKeyframeClass(); 

// set active properties 
ESRI.ArcGIS.esriSystem.ILongArray longArray = new ESRI.ArcGIS.esriSystem.LongArrayClass(); 
longArray.Add(4); // Observer Lat. 
longArray.Add(5); // Observer Lon. 
longArray.Add(6); // Observer Alt. 
agKeyframe.ActiveProperties = longArray; 

ESRI.ArcGIS.Animation.IAGAnimationType agAnimationType = new ESRI.ArcGIS.GlobeCore.AnimationTypeGlobeCameraClass(); 
ESRI.ArcGIS.Animation.IAGAnimationTrack agAnimationTrack = new ESRI.ArcGIS.Animation.AGAnimationTrackClass(); 
agAnimationTrack.AnimationType = agAnimationType; 
ESRI.ArcGIS.Animation.IAGAnimationContainer AGAnimationContainer = (ESRI.ArcGIS.Animation.IAGAnimationContainer)globe; // Explicit Cast 

// animation loop 
//模拟球体水平旋转动画效果
System.Double longitude; 
for (longitude = startLong; longitude <= endLong ; longitude++) 

agKeyframe.set_PropertyValue(4, 0.0); // set latitude 
agKeyframe.set_PropertyValue(5, longitude); // set longitude 
agKeyframe.set_PropertyValue(6, 20000.0); // set altitude 
agKeyframe.Apply(agAnimationTrack, AGAnimationContainer, globeCamera); // apply it 
}

//模拟放大/缩小动画效果
System.Double altitude; 
for (altitude = startAlt; altitude >= endAlt; altitude--) 

agKeyframe.set_PropertyValue(4, 0.0); // set latitude 
agKeyframe.set_PropertyValue(5, longitude); // set longitude 
agKeyframe.set_PropertyValue(6, altitude); // set altitude 
agKeyframe.Apply(agAnimationTrack, AGAnimationContainer, globeCamera); // apply it 


globeDisplay.RefreshViewers(); 
}

要回复问题请先登录注册