没有合适的资源?快使用搜索试试~ 我知道了~
ARCGIS创建缩放到指定地点的动画
4星 · 超过85%的资源 需积分: 31 13 下载量 153 浏览量
2013-07-18
15:29:26
上传
评论 1
收藏 11KB TXT 举报
温馨提示
试读
6页
创建动画并动态缩放到指定位置,全代码
资源推荐
资源详情
资源评论
#region 创建缩放到指定范围的动画
public static IAnimationTrack CreateZoomOverEnvelopAnimation(IGlobe pGlobe, IEnvelope pEnvelope)
{
// Set Mouse Cursor
//IMouseCursor mouseCursor = new MouseCursorClass();
//mouseCursor.SetCursor(2);
IGlobeDisplay globeDisplay = pGlobe.GlobeDisplay;
// QI to GlobeDisplayRendering Interface
IGlobeDisplayRendering globeDisplayRendering = (IGlobeDisplayRendering)globeDisplay;
// Get Elevation Multiplication Factor
IUnitConverter unitConverter = new UnitConverterClass();
// Get GlobeDisplay and Camera
IGlobe globe = globeDisplay.Globe;
IAnimationTracks animationTracks = (IAnimationTracks)globe;
IGlobeCamera globeCamera = (IGlobeCamera)globeDisplay.ActiveViewer.Camera;
// Create New Animation Track
IAnimationTrack animationTrack = new AnimationTrackClass();
IAnimationType animationType = new AnimationTypeGlobeCameraClass();
animationTrack.AnimationType = animationType;
#region 创建动画的第一点
// Create First KeyFrame At Current Location
IKeyframe keyframe1 = new GlobeCameraKeyframeClass();
keyframe1.CaptureProperties((IScene)globe, globeCamera);
animationTrack.InsertKeyframe(keyframe1, animationTrack.KeyframeCount);
#endregion
public static IAnimationTrack CreateZoomOverEnvelopAnimation(IGlobe pGlobe, IEnvelope pEnvelope)
{
// Set Mouse Cursor
//IMouseCursor mouseCursor = new MouseCursorClass();
//mouseCursor.SetCursor(2);
IGlobeDisplay globeDisplay = pGlobe.GlobeDisplay;
// QI to GlobeDisplayRendering Interface
IGlobeDisplayRendering globeDisplayRendering = (IGlobeDisplayRendering)globeDisplay;
// Get Elevation Multiplication Factor
IUnitConverter unitConverter = new UnitConverterClass();
// Get GlobeDisplay and Camera
IGlobe globe = globeDisplay.Globe;
IAnimationTracks animationTracks = (IAnimationTracks)globe;
IGlobeCamera globeCamera = (IGlobeCamera)globeDisplay.ActiveViewer.Camera;
// Create New Animation Track
IAnimationTrack animationTrack = new AnimationTrackClass();
IAnimationType animationType = new AnimationTypeGlobeCameraClass();
animationTrack.AnimationType = animationType;
#region 创建动画的第一点
// Create First KeyFrame At Current Location
IKeyframe keyframe1 = new GlobeCameraKeyframeClass();
keyframe1.CaptureProperties((IScene)globe, globeCamera);
animationTrack.InsertKeyframe(keyframe1, animationTrack.KeyframeCount);
#endregion
#region 创建动画的最后一点
IKeyframe keyframe3 = new GlobeCameraKeyframeClass();
double doubleY = (pEnvelope.YMax + pEnvelope.YMin) / 2;
double doubleX = (pEnvelope.XMax + pEnvelope.XMin) / 2;
//增加地形考虑,三角形计算观察点高度
double doubleAltitide = GetObserverAltitide(globeCamera, pEnvelope) + GetGlobeElevation(globe.GlobeDisplay, doubleX, doubleY,true);// (pEnvelope.ZMax + pEnvelope.ZMin) / 2;// pEnvelope.ZMax;
keyframe3.set_PropertyValueInt(0, 0);
keyframe3.set_PropertyValueDouble(1, doubleY);
keyframe3.set_PropertyValueDouble(2, doubleX);
keyframe3.set_PropertyValueDouble(3, -1d * unitConverter.ConvertUnits(globeDisplayRendering.GlobeRadius, esriUnits.esriMeters, globe.GlobeUnits)); // (globeDisplayRendering.GlobeRadius / -1000));
keyframe3.set_PropertyValueDouble(4, doubleY);
keyframe3.set_PropertyValueDouble(5, doubleX);
keyframe3.set_PropertyValueDouble(6, doubleAltitide);
keyframe3.set_PropertyValueDouble(7, 30);
keyframe3.set_PropertyValueDouble(8, 0);
//animationTrack.InsertKeyframe(keyframe3, animationTrack.KeyframeCount);
//// Set The Animation Track Name
//animationTrack.Name = "Zoom Over Location From Bookmark";
//// Set Track Attachments
//animationTrack.AttachObject(globeCamera);
//animationTrack.ApplyToAllViewers = true;
//// Add The New Track To The Scene
//animationTracks.AddTrack(animationTrack);
#endregion
#region 创建动画的中间点
IKeyframe keyframe3 = new GlobeCameraKeyframeClass();
double doubleY = (pEnvelope.YMax + pEnvelope.YMin) / 2;
double doubleX = (pEnvelope.XMax + pEnvelope.XMin) / 2;
//增加地形考虑,三角形计算观察点高度
double doubleAltitide = GetObserverAltitide(globeCamera, pEnvelope) + GetGlobeElevation(globe.GlobeDisplay, doubleX, doubleY,true);// (pEnvelope.ZMax + pEnvelope.ZMin) / 2;// pEnvelope.ZMax;
keyframe3.set_PropertyValueInt(0, 0);
keyframe3.set_PropertyValueDouble(1, doubleY);
keyframe3.set_PropertyValueDouble(2, doubleX);
keyframe3.set_PropertyValueDouble(3, -1d * unitConverter.ConvertUnits(globeDisplayRendering.GlobeRadius, esriUnits.esriMeters, globe.GlobeUnits)); // (globeDisplayRendering.GlobeRadius / -1000));
keyframe3.set_PropertyValueDouble(4, doubleY);
keyframe3.set_PropertyValueDouble(5, doubleX);
keyframe3.set_PropertyValueDouble(6, doubleAltitide);
keyframe3.set_PropertyValueDouble(7, 30);
keyframe3.set_PropertyValueDouble(8, 0);
//animationTrack.InsertKeyframe(keyframe3, animationTrack.KeyframeCount);
//// Set The Animation Track Name
//animationTrack.Name = "Zoom Over Location From Bookmark";
//// Set Track Attachments
//animationTrack.AttachObject(globeCamera);
//animationTrack.ApplyToAllViewers = true;
//// Add The New Track To The Scene
//animationTracks.AddTrack(animationTrack);
#endregion
#region 创建动画的中间点
剩余5页未读,继续阅读
资源评论
- u0106177082015-01-29全代码,适合我这样的初学者学习使用!
- 创新部4282023-08-07代码不完整
daixin1031017817
- 粉丝: 1
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功