Exemple #1
0
        /// <summary>
        /// 内插中间贞函数,只需给出第一帧和最后一帧的状态信息,即可内插出中间帧状态
        /// </summary>
        /// <param name="pGlobe"></param>
        /// <param name="doubleX1_Tar">第一帧目标点X坐标</param>
        /// <param name="doubleY1_Tar">第一帧目标点Y坐标</param>
        /// <param name="doubleZ1_Tar">第一帧目标点Z坐标</param>
        /// <param name="doubleX1_Obs">第一帧观察点X坐标</param>
        /// <param name="doubleY1_Obs">第一帧观察点Y坐标</param>
        /// <param name="doubleZ1_Obs">第一帧观察点Z坐标</param>
        /// <param name="doubleX2_Tar">第二帧目标点X坐标</param>
        /// <param name="doubleY2_Tar">第二帧目标点Y坐标</param>
        /// <param name="doubleZ2_Tar">第二帧目标点Z坐标</param>
        /// <param name="doubleX2_Obs">第二帧观察点X坐标</param>
        /// <param name="doubleY2_Obs">第二帧观察点Y坐标</param>
        /// <param name="doubleZ2_Obs">第二帧观察点Z坐标</param>
        /// <returns></returns>
        private static IKeyframe CreateMiddleKeyframe(IGlobe pGlobe, double doubleX1_Tar, double doubleY1_Tar, double doubleZ1_Tar,
                                                      double doubleX1_Obs, double doubleY1_Obs, double doubleZ1_Obs,
                                                      double doubleX2_Tar, double doubleY2_Tar, double doubleZ2_Tar,
                                                      double doubleX2_Obs, double doubleY2_Obs, double doubleZ2_Obs)
        {
            IUnitConverter         unitConverter         = new UnitConverterClass();
            IGlobeDisplayRendering globeDisplayRendering = (IGlobeDisplayRendering)pGlobe.GlobeDisplay;
            IKeyframe pMidKeyframe = new GlobeCameraKeyframeClass();

            try
            {
                pMidKeyframe.set_PropertyValueInt(0, 0);
                pMidKeyframe.set_PropertyValueDouble(1, (doubleY1_Tar + doubleY2_Tar) / 2);                                                                           //doubleY_mid);
                pMidKeyframe.set_PropertyValueDouble(2, (doubleX1_Tar + doubleX2_Tar) / 2);                                                                           //doubleX_mid);
                pMidKeyframe.set_PropertyValueDouble(3, (doubleZ1_Tar + doubleZ2_Tar) / 2);                                                                           //doubleZ1_Tar/2);//// (globeDisplayRendering.GlobeRadius / -1000));
                pMidKeyframe.set_PropertyValueDouble(4, (doubleY1_Obs + doubleY2_Obs) / 2);                                                                           //doubleY_mid);
                pMidKeyframe.set_PropertyValueDouble(5, (doubleX1_Obs + doubleX2_Obs) / 2);                                                                           //doubleX_mid);
                //改善中间过程用户体验,增加中间点Observer的高度,让高度约等于两点间距离+海拔高度
                double doubleAltitide_mid = ReturnProjectDistance(pGlobe, doubleX1_Obs, doubleY1_Obs, doubleZ1_Obs, doubleX2_Obs, doubleY2_Obs, doubleZ2_Obs) / 1000; //KM
                //加入地表高程
                doubleAltitide_mid += GetGlobeElevation(pGlobe.GlobeDisplay, (doubleX1_Obs + doubleX2_Obs) / 2, (doubleY1_Obs + doubleY2_Obs) / 2, true);

                pMidKeyframe.set_PropertyValueDouble(6, doubleAltitide_mid);
                pMidKeyframe.set_PropertyValueDouble(7, 30);
                pMidKeyframe.set_PropertyValueDouble(8, 0);
            }
            catch
            { }
            return(pMidKeyframe);
        }
        /// <summary>
        /// 书签创建关键帧
        /// </summary>
        /// <param name="_pGlobe"></param>
        /// <param name="_pBook3D"></param>
        /// <returns></returns>
        public static IAGKeyframe CreateKeyframefromBook(IGlobe _pGlobe, IBookmark3D _pBook3D)
        {
            IScene _pScene = _pGlobe.GlobeDisplay.Scene;

            IAGAnimationContainer pAGAnimationContainer = _pScene as IAGAnimationContainer;
            IAGAnimationTracks pAGAnimationTracks = _pGlobe as IAGAnimationTracks;
            IAGAnimationUtils pAGAutils = new AGAnimationUtilsClass();
            ESRI.ArcGIS.Animation.IAGAnimationType pAGType = new AnimationTypeGlobeCameraClass();
            IAGKeyframe pGlobeKey = new GlobeCameraKeyframeClass();
            pAGAutils.KeyframeFromBookmark(pAGAnimationContainer, _pBook3D as ISpatialBookmark, out pGlobeKey);

            return pGlobeKey;
        }
Exemple #3
0
        /// <summary>
        /// 书签创建关键帧
        /// </summary>
        /// <param name="_pGlobe"></param>
        /// <param name="_pBook3D"></param>
        /// <returns></returns>
        public static IAGKeyframe CreateKeyframefromBook(IGlobe _pGlobe, IBookmark3D _pBook3D)
        {
            IScene _pScene = _pGlobe.GlobeDisplay.Scene;

            IAGAnimationContainer pAGAnimationContainer = _pScene as IAGAnimationContainer;
            IAGAnimationTracks    pAGAnimationTracks    = _pGlobe as IAGAnimationTracks;
            IAGAnimationUtils     pAGAutils             = new AGAnimationUtilsClass();

            ESRI.ArcGIS.Animation.IAGAnimationType pAGType = new AnimationTypeGlobeCameraClass();
            IAGKeyframe pGlobeKey = new GlobeCameraKeyframeClass();

            pAGAutils.KeyframeFromBookmark(pAGAnimationContainer, _pBook3D as ISpatialBookmark, out pGlobeKey);

            return(pGlobeKey);
        }
		private void PlayAnimationFast(int cycles, int iteration)
		{
			IGlobe globe = axGlobeControl1.Globe;
			IGlobeDisplay globeDisplay = globe.GlobeDisplay;
			Scene scene = (Scene) globeDisplay.Scene;
			IAnimationTracks sceneTracks = (IAnimationTracks) scene;

			IArray trackCamArray = new ArrayClass();
			IArray trackGlbArray = new ArrayClass();
			IArray trackLyrArray = new ArrayClass();

			string sError;
			if (sceneTracks.TrackCount == 0)
			{
				sError = m_AnimFilePath;
				if (sError == "")
				{
					sError = "To get a Sample animation file, Developer Kit Samples need to be installed!";
					System.Windows.Forms.MessageBox.Show("The current document doesn't contain animation file." + 0x000A  + sError);
				}
				else
				{
					System.Windows.Forms.MessageBox.Show("The current document doesn't contain animation file." + 0x000A  + "Load " + m_AnimFilePath + @"\AnimationSample.aga for sample.");
				}
				return;
			}
			
			IAnimationTrack track;
			IAnimationTrack trackLayer;
			IAnimationTrack trackGlobe = null;
			IAnimationType animType;
			IAnimationType animLayer;
			IAnimationType animGlobeCam = null;
			IKeyframe kFGlbCam;
			IKeyframe kFGlbLayer;
			int k;
			int[] count = new int[1000];

			//get each track from the scene and store tracks of the same kind in an Array
			for (int i=0; i<=sceneTracks.TrackCount-1;i++)
			{
				track = (IAnimationTrack) sceneTracks.Tracks.get_Element(i);
				k = i;
				animType = track.AnimationType;

				if (animType.CLSID.Value.ToString() == "{7CCBA704-3933-4D7A-8E89-4DFEE88AA937}")
				{
					//GlobeLayer
					trackLayer = new AnimationTrackClass();
					trackLayer = track;
					trackLayer.AnimationType = animType;
					kFGlbLayer = new GlobeLayerKeyframeClass();
					animLayer = animType;
					//Store the keyframe count of each track in an array
					count[i] = trackLayer.KeyframeCount;
					trackLyrArray.Add(trackLayer);
				}
				else if (animType.CLSID.Value.ToString() == "{D4565495-E2F9-4D89-A8A7-D0B69FD7A424}")
				{
					//Globe Camera type
					trackGlobe = new AnimationTrackClass();
					trackGlobe = track;
					trackGlobe.AnimationType = animType;
					kFGlbCam = new GlobeCameraKeyframeClass();
					animGlobeCam = animType;
					//Store the keyframe count of each track in an array
					count[i] = trackGlobe.KeyframeCount;
					trackGlbArray.Add(trackGlobe);
				}
				else
				{
					System.Windows.Forms.MessageBox.Show("Animation Type " + animType.Name + " Not Supported. Check if the animation File is Valid!");
					return;
				}
			}

			int larger = Greatest(ref count);
			//if nothing gets passed by the argument it takes the max no of keyframes
			if (iteration == 0) iteration = larger;

			IAnimationTrack trackCamera;
			IAnimationType animCam = null;
			IKeyframe kFBkmark;
			double time = 0;
			int keyFrameLayerCount; int keyFrameCameraCount; int keyFrameCount;

			for (int i=1; i<=cycles; i++) //no of cycles...
			{
				for (int start=0; start<=iteration; start++) //no of iterations...
				{
					for (int j=0; j<=trackCamArray.Count-1; j++)
					{
						trackCamera = (IAnimationTrack) trackCamArray.get_Element(j);
						if (trackCamera != null)
						{
							if (time >= trackCamera.BeginTime)
							{
								keyFrameCameraCount = trackGlobe.KeyframeCount;
								kFBkmark = trackCamera.get_Keyframe(keyFrameCameraCount - keyFrameCameraCount);
								//reset object
								animCam.ResetObject(scene, kFBkmark);
								//interpolate by using track
								trackCamera.InterpolateObjectProperties(scene, time);
								keyFrameCameraCount = keyFrameCameraCount - 1;
							}
						}
					}

					for (k=0; k<=trackGlbArray.Count-1;k++)
					{
						trackGlobe = (IAnimationTrack) trackGlbArray.get_Element(k);
						if (trackGlobe != null)
						{
							if (time >= trackGlobe.BeginTime)
							{
								keyFrameCount = trackGlobe.KeyframeCount;
								kFGlbCam = trackGlobe.get_Keyframe(trackGlobe.KeyframeCount - keyFrameCount);
								//reset object
								animGlobeCam.ResetObject(scene, kFGlbCam);
								//interpolate by using track
								trackGlobe.InterpolateObjectProperties(scene, time);
								keyFrameCount = keyFrameCount - 1;
							}
						}
					}

					for (int t=0; t<=trackLyrArray.Count-1; t++)
					{
						trackLayer = (IAnimationTrack) trackLyrArray.get_Element(t);
						if (trackLayer != null)
						{
							if (time >= trackLayer.BeginTime)
							{
								keyFrameLayerCount = trackLayer.KeyframeCount;
								kFGlbLayer = trackLayer.get_Keyframe(trackLayer.KeyframeCount - keyFrameLayerCount);
								//interpolate by using track
								trackLayer.InterpolateObjectProperties(scene, time);
								keyFrameLayerCount = keyFrameLayerCount - 1;
							}
						}
					}

					//reset interpolation Point
					time = start / iteration;
					//refresh the globeviewer(s)
					globeDisplay.RefreshViewers();
				}
			}
		}
Exemple #5
0
        private void PlayAnimationFast(int cycles, int iteration)
        {
            IGlobe           globe        = axGlobeControl1.Globe;
            IGlobeDisplay    globeDisplay = globe.GlobeDisplay;
            Scene            scene        = (Scene)globeDisplay.Scene;
            IAnimationTracks sceneTracks  = (IAnimationTracks)scene;

            IArray trackCamArray = new ArrayClass();
            IArray trackGlbArray = new ArrayClass();
            IArray trackLyrArray = new ArrayClass();

            string sError;

            if (sceneTracks.TrackCount == 0)
            {
                sError = m_AnimFilePath;
                if (sError == "")
                {
                    sError = "To get a Sample animation file, Developer Kit Samples need to be installed!";
                    System.Windows.Forms.MessageBox.Show("The current document doesn't contain animation file." + 0x000A + sError);
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("The current document doesn't contain animation file." + 0x000A + "Load " + m_AnimFilePath + @"\AnimationSample.aga for sample.");
                }
                return;
            }

            IAnimationTrack track;
            IAnimationTrack trackLayer;
            IAnimationTrack trackGlobe = null;
            IAnimationType  animType;
            IAnimationType  animLayer;
            IAnimationType  animGlobeCam = null;
            IKeyframe       kFGlbCam;
            IKeyframe       kFGlbLayer;
            int             k;

            int[] count = new int[1000];

            //get each track from the scene and store tracks of the same kind in an Array
            for (int i = 0; i <= sceneTracks.TrackCount - 1; i++)
            {
                track    = (IAnimationTrack)sceneTracks.Tracks.get_Element(i);
                k        = i;
                animType = track.AnimationType;

                if (animType.CLSID.Value.ToString() == "{7CCBA704-3933-4D7A-8E89-4DFEE88AA937}")
                {
                    //GlobeLayer
                    trackLayer = new AnimationTrackClass();
                    trackLayer = track;
                    trackLayer.AnimationType = animType;
                    kFGlbLayer = new GlobeLayerKeyframeClass();
                    animLayer  = animType;
                    //Store the keyframe count of each track in an array
                    count[i] = trackLayer.KeyframeCount;
                    trackLyrArray.Add(trackLayer);
                }
                else if (animType.CLSID.Value.ToString() == "{D4565495-E2F9-4D89-A8A7-D0B69FD7A424}")
                {
                    //Globe Camera type
                    trackGlobe = new AnimationTrackClass();
                    trackGlobe = track;
                    trackGlobe.AnimationType = animType;
                    kFGlbCam     = new GlobeCameraKeyframeClass();
                    animGlobeCam = animType;
                    //Store the keyframe count of each track in an array
                    count[i] = trackGlobe.KeyframeCount;
                    trackGlbArray.Add(trackGlobe);
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Animation Type " + animType.Name + " Not Supported. Check if the animation File is Valid!");
                    return;
                }
            }

            int larger = Greatest(ref count);

            //if nothing gets passed by the argument it takes the max no of keyframes
            if (iteration == 0)
            {
                iteration = larger;
            }

            IAnimationTrack trackCamera;
            IAnimationType  animCam = null;
            IKeyframe       kFBkmark;
            double          time = 0;
            int             keyFrameLayerCount; int keyFrameCameraCount; int keyFrameCount;

            for (int i = 1; i <= cycles; i++)                    //no of cycles...
            {
                for (int start = 0; start <= iteration; start++) //no of iterations...
                {
                    for (int j = 0; j <= trackCamArray.Count - 1; j++)
                    {
                        trackCamera = (IAnimationTrack)trackCamArray.get_Element(j);
                        if (trackCamera != null)
                        {
                            if (time >= trackCamera.BeginTime)
                            {
                                keyFrameCameraCount = trackGlobe.KeyframeCount;
                                kFBkmark            = trackCamera.get_Keyframe(keyFrameCameraCount - keyFrameCameraCount);
                                //reset object
                                animCam.ResetObject(scene, kFBkmark);
                                //interpolate by using track
                                trackCamera.InterpolateObjectProperties(scene, time);
                                keyFrameCameraCount = keyFrameCameraCount - 1;
                            }
                        }
                    }

                    for (k = 0; k <= trackGlbArray.Count - 1; k++)
                    {
                        trackGlobe = (IAnimationTrack)trackGlbArray.get_Element(k);
                        if (trackGlobe != null)
                        {
                            if (time >= trackGlobe.BeginTime)
                            {
                                keyFrameCount = trackGlobe.KeyframeCount;
                                kFGlbCam      = trackGlobe.get_Keyframe(trackGlobe.KeyframeCount - keyFrameCount);
                                //reset object
                                animGlobeCam.ResetObject(scene, kFGlbCam);
                                //interpolate by using track
                                trackGlobe.InterpolateObjectProperties(scene, time);
                                keyFrameCount = keyFrameCount - 1;
                            }
                        }
                    }

                    for (int t = 0; t <= trackLyrArray.Count - 1; t++)
                    {
                        trackLayer = (IAnimationTrack)trackLyrArray.get_Element(t);
                        if (trackLayer != null)
                        {
                            if (time >= trackLayer.BeginTime)
                            {
                                keyFrameLayerCount = trackLayer.KeyframeCount;
                                kFGlbLayer         = trackLayer.get_Keyframe(trackLayer.KeyframeCount - keyFrameLayerCount);
                                //interpolate by using track
                                trackLayer.InterpolateObjectProperties(scene, time);
                                keyFrameLayerCount = keyFrameLayerCount - 1;
                            }
                        }
                    }

                    //reset interpolation Point
                    time = start / iteration;
                    //refresh the globeviewer(s)
                    globeDisplay.RefreshViewers();
                }
            }
        }
        public static IAnimationTrack CreateZoomOverLocationAnimation(IGlobeDisplay globeDisplay, double doubleX, double doubleY, double doubleAltitide)
        {
            // Set Mouse Cursor
            //IMouseCursor mouseCursor = new MouseCursorClass();
            //mouseCursor.SetCursor(2);
            // 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();
            try
            {
                IAnimationType animationType = new AnimationTypeGlobeCameraClass();
                animationTrack.AnimationType = animationType;
                // Create First KeyFrame At Current Location
                IKeyframe keyframe1 = new GlobeCameraKeyframeClass();
                keyframe1.CaptureProperties((IScene)globe, globeCamera);
                animationTrack.InsertKeyframe(keyframe1, animationTrack.KeyframeCount);
                // Create Last KeyFrame Over Desired Location
                IKeyframe keyframe3 = new GlobeCameraKeyframeClass();
                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);

                #region 获取第一帧和第三帧的参数
                double dX1_Tar, dY1_Tar, dZ1_Tar, dX1_Obs, dY1_Obs, dZ1_Obs;
                GetParametersFromKeyFrame(keyframe1, out dX1_Tar, out dY1_Tar, out dZ1_Tar, out dX1_Obs, out dY1_Obs, out dZ1_Obs);
                double dX3_Tar, dY3_Tar, dZ3_Tar, dX3_Obs, dY3_Obs, dZ3_Obs;
                GetParametersFromKeyFrame(keyframe3, out dX3_Tar, out dY3_Tar, out dZ3_Tar, out dX3_Obs, out dY3_Obs, out dZ3_Obs);
                #endregion

                ////=========================================== 创建中间帧    == == == == == == == == == == == == == == == == == == == == == =
                IKeyframe keyframe2 = CreateMiddleKeyframe(globeDisplay.Globe, dX1_Tar,
                                      dY1_Tar, dZ1_Tar, dX1_Obs, dY1_Obs, dZ1_Obs,
                                      dX3_Tar, dY3_Tar, dZ3_Tar, dX3_Obs, dY3_Obs, dZ3_Obs);  //头晕、高血压、糖尿病患者调用该函数请慎重!
                //=========================================== 创建中间帧    == == == == == == == == == == == == == == == == == == == == == =
                //animationTrack.InsertKeyframe(keyframe2, animationTrack.KeyframeCount);
                animationTrack.InsertKeyframe(keyframe3, animationTrack.KeyframeCount);
                // Set The Animation Track Name
                animationTrack.Name = "Zoom Over Location";
                // Set Track Attachments
                animationTrack.AttachObject(globeCamera);
                animationTrack.ApplyToAllViewers = true;
                // Add The New Track To The Scene
                animationTracks.AddTrack(animationTrack);
                // Return The Newly Create Aninmation Track
            }
            catch { }
            return animationTrack;
        }
        /// <summary>
        /// 内插中间贞函数,只需给出第一帧和最后一帧的状态信息,即可内插出中间帧状态
        /// </summary>
        /// <param name="pGlobe"></param>
        /// <param name="doubleX1_Tar">第一帧目标点X坐标</param>
        /// <param name="doubleY1_Tar">第一帧目标点Y坐标</param>
        /// <param name="doubleZ1_Tar">第一帧目标点Z坐标</param>
        /// <param name="doubleX1_Obs">第一帧观察点X坐标</param>
        /// <param name="doubleY1_Obs">第一帧观察点Y坐标</param>
        /// <param name="doubleZ1_Obs">第一帧观察点Z坐标</param>
        /// <param name="doubleX2_Tar">第二帧目标点X坐标</param>
        /// <param name="doubleY2_Tar">第二帧目标点Y坐标</param>
        /// <param name="doubleZ2_Tar">第二帧目标点Z坐标</param>
        /// <param name="doubleX2_Obs">第二帧观察点X坐标</param>
        /// <param name="doubleY2_Obs">第二帧观察点Y坐标</param>
        /// <param name="doubleZ2_Obs">第二帧观察点Z坐标</param>
        /// <returns></returns>
        private static IKeyframe CreateMiddleKeyframe(IGlobe pGlobe, double doubleX1_Tar, double doubleY1_Tar, double doubleZ1_Tar,
                                                                    double doubleX1_Obs, double doubleY1_Obs, double doubleZ1_Obs,
                                                                    double doubleX2_Tar, double doubleY2_Tar, double doubleZ2_Tar,
                                                                    double doubleX2_Obs, double doubleY2_Obs, double doubleZ2_Obs)
        {
            IUnitConverter unitConverter = new UnitConverterClass();
            IGlobeDisplayRendering globeDisplayRendering = (IGlobeDisplayRendering)pGlobe.GlobeDisplay;
            IKeyframe pMidKeyframe = new GlobeCameraKeyframeClass();
            try
            {
                pMidKeyframe.set_PropertyValueInt(0, 0);
                pMidKeyframe.set_PropertyValueDouble(1, (doubleY1_Tar + doubleY2_Tar) / 2);//doubleY_mid);
                pMidKeyframe.set_PropertyValueDouble(2, (doubleX1_Tar + doubleX2_Tar) / 2);//doubleX_mid);
                pMidKeyframe.set_PropertyValueDouble(3, (doubleZ1_Tar + doubleZ2_Tar) / 2); //doubleZ1_Tar/2);//// (globeDisplayRendering.GlobeRadius / -1000));
                pMidKeyframe.set_PropertyValueDouble(4, (doubleY1_Obs + doubleY2_Obs) / 2);//doubleY_mid);
                pMidKeyframe.set_PropertyValueDouble(5, (doubleX1_Obs + doubleX2_Obs) / 2);//doubleX_mid);
                //改善中间过程用户体验,增加中间点Observer的高度,让高度约等于两点间距离+海拔高度
                double doubleAltitide_mid = ReturnProjectDistance(pGlobe, doubleX1_Obs, doubleY1_Obs, doubleZ1_Obs, doubleX2_Obs, doubleY2_Obs, doubleZ2_Obs) / 1000; //KM
                //加入地表高程
                doubleAltitide_mid += GetGlobeElevation(pGlobe.GlobeDisplay, (doubleX1_Obs + doubleX2_Obs) / 2, (doubleY1_Obs + doubleY2_Obs) / 2, true);

                pMidKeyframe.set_PropertyValueDouble(6, doubleAltitide_mid);
                pMidKeyframe.set_PropertyValueDouble(7, 30);
                pMidKeyframe.set_PropertyValueDouble(8, 0);
            }
            catch { }
            return pMidKeyframe;
        }
        public static IAnimationTrack CreateZoomOverLocationAnimation(IGlobeDisplay globeDisplay, IBookmark3D pBookmark3D)
        {
            // Set Mouse Cursor
            //IMouseCursor mouseCursor = new MouseCursorClass();
            //mouseCursor.SetCursor(2);

            // 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();
            try
            {
                IAnimationType animationType = new AnimationTypeGlobeCameraClass();
                animationTrack.AnimationType = animationType;

                // Create First KeyFrame At Current Location
                IKeyframe keyframe1 = new GlobeCameraKeyframeClass();
                keyframe1.CaptureProperties((IScene)globe, globeCamera);
                animationTrack.InsertKeyframe(keyframe1, animationTrack.KeyframeCount);

                //// Create Last KeyFrame Over Desired Location
                //pBookmark3D.Apply(globeDisplay.ActiveViewer as ISceneViewer, false, 0);

                //IKeyframe keyframe3 = new GlobeCameraKeyframeClass();
                //keyframe3.CaptureProperties((IScene)globe, globeCamera);

                IKeyframe keyframe3 = CreateKeyframefromBook(globeDisplay.Globe, pBookmark3D) as IKeyframe;

                #region 获取第一帧和第三帧的参数
                double dX1_Tar, dY1_Tar, dZ1_Tar, dX1_Obs, dY1_Obs, dZ1_Obs;
                GetParametersFromKeyFrame(keyframe1, out dX1_Tar, out dY1_Tar, out dZ1_Tar, out dX1_Obs, out dY1_Obs, out dZ1_Obs);
                double dX3_Tar, dY3_Tar, dZ3_Tar, dX3_Obs, dY3_Obs, dZ3_Obs;
                GetParametersFromKeyFrame(keyframe3, out dX3_Tar, out dY3_Tar, out dZ3_Tar, out dX3_Obs, out dY3_Obs, out dZ3_Obs);
                #endregion

                //=========================================== 创建中间帧 ===========================================
                //IKeyframe keyframe2 = CreateMiddleKeyframe(globeDisplay.Globe, dX1_Tar, dY1_Tar, dZ1_Tar, dX1_Obs, dY1_Obs, dZ1_Obs,
                //    dX3_Tar, dY3_Tar, dZ3_Tar, dX3_Obs, dY3_Obs, dZ3_Obs);          //头晕、高血压、糖尿病患者调用该函数请慎重!
                //=========================================== 创建中间帧 ===========================================
                //animationTrack.InsertKeyframe(keyframe2, animationTrack.KeyframeCount);

                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);

                // Return The Newly Create Aninmation Track
            }
            catch { }
            return animationTrack;
        }
Exemple #9
0
        public static IAnimationTrack CreateZoomOverLocationAnimation(IGlobeDisplay globeDisplay, IBookmark3D pBookmark3D)
        {
            // Set Mouse Cursor
            //IMouseCursor mouseCursor = new MouseCursorClass();
            //mouseCursor.SetCursor(2);

            // 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();

            try
            {
                IAnimationType animationType = new AnimationTypeGlobeCameraClass();
                animationTrack.AnimationType = animationType;

                // Create First KeyFrame At Current Location
                IKeyframe keyframe1 = new GlobeCameraKeyframeClass();
                keyframe1.CaptureProperties((IScene)globe, globeCamera);
                animationTrack.InsertKeyframe(keyframe1, animationTrack.KeyframeCount);


                //// Create Last KeyFrame Over Desired Location
                //pBookmark3D.Apply(globeDisplay.ActiveViewer as ISceneViewer, false, 0);


                //IKeyframe keyframe3 = new GlobeCameraKeyframeClass();
                //keyframe3.CaptureProperties((IScene)globe, globeCamera);

                IKeyframe keyframe3 = CreateKeyframefromBook(globeDisplay.Globe, pBookmark3D) as IKeyframe;

                #region 获取第一帧和第三帧的参数
                double dX1_Tar, dY1_Tar, dZ1_Tar, dX1_Obs, dY1_Obs, dZ1_Obs;
                GetParametersFromKeyFrame(keyframe1, out dX1_Tar, out dY1_Tar, out dZ1_Tar, out dX1_Obs, out dY1_Obs, out dZ1_Obs);
                double dX3_Tar, dY3_Tar, dZ3_Tar, dX3_Obs, dY3_Obs, dZ3_Obs;
                GetParametersFromKeyFrame(keyframe3, out dX3_Tar, out dY3_Tar, out dZ3_Tar, out dX3_Obs, out dY3_Obs, out dZ3_Obs);
                #endregion

                //=========================================== 创建中间帧 ===========================================
                //IKeyframe keyframe2 = CreateMiddleKeyframe(globeDisplay.Globe, dX1_Tar, dY1_Tar, dZ1_Tar, dX1_Obs, dY1_Obs, dZ1_Obs,
                //    dX3_Tar, dY3_Tar, dZ3_Tar, dX3_Obs, dY3_Obs, dZ3_Obs);          //头晕、高血压、糖尿病患者调用该函数请慎重!
                //=========================================== 创建中间帧 ===========================================
                //animationTrack.InsertKeyframe(keyframe2, animationTrack.KeyframeCount);

                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);

                // Return The Newly Create Aninmation Track
            }
            catch { }
            return(animationTrack);
        }
Exemple #10
0
        public static IAnimationTrack CreateZoomOverLocationAnimation(IGlobeDisplay globeDisplay, double doubleX, double doubleY, double doubleAltitide)
        {
            // Set Mouse Cursor
            //IMouseCursor mouseCursor = new MouseCursorClass();
            //mouseCursor.SetCursor(2);
            // 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();

            try
            {
                IAnimationType animationType = new AnimationTypeGlobeCameraClass();
                animationTrack.AnimationType = animationType;
                // Create First KeyFrame At Current Location
                IKeyframe keyframe1 = new GlobeCameraKeyframeClass();
                keyframe1.CaptureProperties((IScene)globe, globeCamera);
                animationTrack.InsertKeyframe(keyframe1, animationTrack.KeyframeCount);
                // Create Last KeyFrame Over Desired Location
                IKeyframe keyframe3 = new GlobeCameraKeyframeClass();
                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);

                #region 获取第一帧和第三帧的参数
                double dX1_Tar, dY1_Tar, dZ1_Tar, dX1_Obs, dY1_Obs, dZ1_Obs;
                GetParametersFromKeyFrame(keyframe1, out dX1_Tar, out dY1_Tar, out dZ1_Tar, out dX1_Obs, out dY1_Obs, out dZ1_Obs);
                double dX3_Tar, dY3_Tar, dZ3_Tar, dX3_Obs, dY3_Obs, dZ3_Obs;
                GetParametersFromKeyFrame(keyframe3, out dX3_Tar, out dY3_Tar, out dZ3_Tar, out dX3_Obs, out dY3_Obs, out dZ3_Obs);
                #endregion

                ////=========================================== 创建中间帧    == == == == == == == == == == == == == == == == == == == == == =
                IKeyframe keyframe2 = CreateMiddleKeyframe(globeDisplay.Globe, dX1_Tar,
                                                           dY1_Tar, dZ1_Tar, dX1_Obs, dY1_Obs, dZ1_Obs,
                                                           dX3_Tar, dY3_Tar, dZ3_Tar, dX3_Obs, dY3_Obs, dZ3_Obs); //头晕、高血压、糖尿病患者调用该函数请慎重!
                //=========================================== 创建中间帧    == == == == == == == == == == == == == == == == == == == == == =
                //animationTrack.InsertKeyframe(keyframe2, animationTrack.KeyframeCount);
                animationTrack.InsertKeyframe(keyframe3, animationTrack.KeyframeCount);
                // Set The Animation Track Name
                animationTrack.Name = "Zoom Over Location";
                // Set Track Attachments
                animationTrack.AttachObject(globeCamera);
                animationTrack.ApplyToAllViewers = true;
                // Add The New Track To The Scene
                animationTracks.AddTrack(animationTrack);
                // Return The Newly Create Aninmation Track
            }
            catch { }
            return(animationTrack);
        }