public void InitAnimationByAgaFile(AxGlobeControl _axGlobeControl, string _FlyPathName, string FlyFoldPath, bool _NotFlyByPolyline, int _FlySpeedRating) { try { IsFlyByPolyline = _NotFlyByPolyline; string FlyFilePath = FlyFoldPath + "\\" + _FlyPathName + ".aga"; if (!File.Exists(FlyFilePath)) //如果此文件不存在 { return; } pAgAnimationUtils = new AGAnimationUtilsClass(); IBasicScene2 basicScene2 = (IBasicScene2)scene; // Explicit Cast pAnimationExtension = basicScene2.AnimationExtension; //飞行时长设置 switch (_FlySpeedRating) { case 1: FlyDurationTime = 40; break; case 2: FlyDurationTime = 30; break; case 3: FlyDurationTime = 20; break; case 4: FlyDurationTime = 15; break; case 5: FlyDurationTime = 10; break; default: FlyDurationTime = 20; break; } pAnimationExtension.AnimationEnvironment.AnimationDuration = FlyDurationTime; IAGAnimationContainer pContainer = pAnimationExtension.AnimationTracks.AnimationObjectContainer; pAgAnimationUtils.LoadAnimationFile(pContainer, FlyFilePath);//值不在预期的范围内; animPlayer = (IAGAnimationPlayer)pAgAnimationUtils; } catch { } }
//按预订的路径飞行 public bool InitAnimationPlay(AxGlobeControl _axGlobeControl, string _FlyPathName, string FlyFoldPath, int _FlySpeedRating, bool _IsFlyLoop, bool _IsFlyLookdown) { bool IsFoundPolyline = true; //是否能找到对应的Polyline try { scene = _axGlobeControl.GlobeDisplay.Scene; globe = _axGlobeControl.Globe; IBasicScene2 basicScene = (IBasicScene2)globe; pAgAnimationUtils = new AGAnimationUtilsClass(); //按路径飞行 ILayer layer = getLayerByName(scene, ANIMATIONPATH_LayerName); if (layer == null) { IsFoundPolyline = false; return(IsFoundPolyline); } FlyPathPolyline = getPolylineFromLayer(layer, _FlyPathName); if (FlyPathPolyline == null) { IsFoundPolyline = false; return(IsFoundPolyline); } //启用三维线 IZAware flyPathZAware = (IZAware)FlyPathPolyline; flyPathZAware.ZAware = true; pAnimationExtension = basicScene.AnimationExtension; CreateAnimationFromPath(globe, FlyPathPolyline, FlySpeedRating, IsFlyLoop, IsFlyLookdown); //配置飞行 //InitAnimationParameters(); //IAGAnimationContainer pContainer = pAnimationExtension.AnimationTracks.AnimationObjectContainer; //pAgAnimationUtils.LoadAnimationFile(pContainer, FlyFilePath);//值不在预期的范围内; animPlayer = (IAGAnimationPlayer)pAgAnimationUtils; } catch { } return(IsFoundPolyline); }
//按预订的路径飞行 public bool InitAnimationPlay(AxGlobeControl _axGlobeControl, string _FlyPathName, string FlyFoldPath, int _FlySpeedRating,bool _IsFlyLoop,bool _IsFlyLookdown) { bool IsFoundPolyline = true; //是否能找到对应的Polyline try { scene = _axGlobeControl.GlobeDisplay.Scene; globe = _axGlobeControl.Globe; IBasicScene2 basicScene = (IBasicScene2)globe; pAgAnimationUtils = new AGAnimationUtilsClass(); //按路径飞行 ILayer layer = getLayerByName(scene, ANIMATIONPATH_LayerName); if (layer == null) { IsFoundPolyline = false; return IsFoundPolyline; } FlyPathPolyline = getPolylineFromLayer(layer, _FlyPathName); if (FlyPathPolyline == null) { IsFoundPolyline = false; return IsFoundPolyline; } //启用三维线 IZAware flyPathZAware = (IZAware)FlyPathPolyline; flyPathZAware.ZAware = true; pAnimationExtension = basicScene.AnimationExtension; CreateAnimationFromPath(globe, FlyPathPolyline, FlySpeedRating, IsFlyLoop, IsFlyLookdown); //配置飞行 //InitAnimationParameters(); //IAGAnimationContainer pContainer = pAnimationExtension.AnimationTracks.AnimationObjectContainer; //pAgAnimationUtils.LoadAnimationFile(pContainer, FlyFilePath);//值不在预期的范围内; animPlayer = (IAGAnimationPlayer)pAgAnimationUtils; } catch { } return IsFoundPolyline; }