Пример #1
0
        void RenderCurve(Curve curve)
        {
            var       color = ColorTheme.Current.TimelineCurveEditor.Curves[curve.Component];
            IKeyframe key   = null;

            foreach (var nextKey in curve.Animator.ReadonlyKeys)
            {
                Renderer.DrawRound(CalcPosition(curve, nextKey.Frame), 2.5f, 10, color);
                if (key != null)
                {
                    if (key.Function == KeyFunction.Linear || key.Function == KeyFunction.Steep)
                    {
                        var p0 = CalcPosition(curve, key.Frame);
                        var p1 = CalcPosition(curve, nextKey.Frame);
                        if (key.Function == KeyFunction.Steep)
                        {
                            p1.Y = p0.Y;
                        }
                        Renderer.DrawLine(p0, p1, color);
                    }
                    else
                    {
                        // Render spline segment
                        var p0 = CalcPosition(curve, key.Frame);
                        for (int f = key.Frame + 1; f <= nextKey.Frame; f++)
                        {
                            var p1 = CalcPosition(curve, f);
                            Renderer.DrawLine(p0, p1, color);
                            p0 = p1;
                        }
                    }
                }
                key = nextKey;
            }
        }
Пример #2
0
 private SetKeyframe(IAnimable animable, string propertyName, string animationId, IKeyframe keyframe)
 {
     Animable     = animable;
     PropertyName = propertyName;
     Keyframe     = keyframe;
     AnimationId  = animationId;
 }
Пример #3
0
        public static void AddKeyframe(string sequenceName, IKeyframe newKeyframe)
        {
            AnimationSequence.AnimationSequenceType sequenceTypeFromKeyframe = AnimationSequence.AnimationSequenceType.Transformation;
            if (newKeyframe is SpriteSheetKeyframe)
            {
                sequenceTypeFromKeyframe = AnimationSequence.AnimationSequenceType.SpriteSheet;
            }
            if (newKeyframe is ColourKeyframe)
            {
                sequenceTypeFromKeyframe = AnimationSequence.AnimationSequenceType.Colour;
            }
            if (newKeyframe is SkeletalKeyframe)
            {
                sequenceTypeFromKeyframe = AnimationSequence.AnimationSequenceType.Skeletal;
            }

            if (!Sequences.ContainsKey(sequenceName))
            {
                AddSequence(sequenceName, sequenceTypeFromKeyframe, false);
            }

            if (Sequences[sequenceName].SequenceType == sequenceTypeFromKeyframe)
            {
                Sequences[sequenceName].Keyframes.Add(newKeyframe);
            }
        }
Пример #4
0
        void SetKeyframe(bool value)
        {
            int currentFrame = Document.Current.AnimationFrame;

            foreach (var animable in editorParams.Objects.OfType <IAnimable>())
            {
                IAnimator animator;
                bool      hasKey = false;

                if (animable.Animators.TryFind(editorParams.PropertyName, out animator, Document.Current.AnimationId))
                {
                    hasKey = animator.ReadonlyKeys.Any(i => i.Frame == currentFrame);
                    if (hasKey && !value)
                    {
                        Core.Operations.RemoveKeyframe.Perform(animator, currentFrame);
                    }
                }

                if (!hasKey && value)
                {
                    var propValue = new Property(animable, editorParams.PropertyName).Getter();
                    if (animator == null)
                    {
                        animator = AnimatorRegistry.Instance.CreateAnimator(editorParams.PropertyInfo.PropertyType);
                        animator.TargetProperty = editorParams.PropertyName;
                        animator.AnimationId    = Document.Current.AnimationId;
                        Core.Operations.SetAnimator.Perform(animable, animator);
                    }
                    var       keyFunction = animator.Keys.LastOrDefault(k => k.Frame < currentFrame)?.Function ?? KeyFunction.Linear;
                    IKeyframe keyframe    = Keyframe.CreateForType(editorParams.PropertyInfo.PropertyType, currentFrame, propValue, keyFunction);

                    Core.Operations.SetKeyframe.Perform(animable, editorParams.PropertyName, Document.Current.AnimationId, keyframe);
                }
            }
        }
Пример #5
0
        void SetKeyframe(bool value)
        {
            int currentFrame = Document.Current.AnimationFrame;

            foreach (var(animable, owner) in editorParams.RootObjects.Zip(editorParams.Objects, (ro, o) => (ro as IAnimationHost, o)))
            {
                bool hasKey = false;
                if (animable.Animators.TryFind(editorParams.PropertyPath, out IAnimator animator, Document.Current.AnimationId))
                {
                    hasKey = animator.ReadonlyKeys.Any(i => i.Frame == currentFrame);
                    if (hasKey && !value)
                    {
                        Core.Operations.RemoveKeyframe.Perform(animator, currentFrame);
                    }
                }

                if (!hasKey && value)
                {
                    var propValue = editorParams.IndexInList == -1
                                                ? new Property(owner, editorParams.PropertyName).Getter()
                                                : new IndexedProperty(owner, editorParams.PropertyName, editorParams.IndexInList).Getter();
                    var keyFunction = animator?.Keys.LastOrDefault(k => k.Frame <= currentFrame)?.Function ??
                                      CoreUserPreferences.Instance.DefaultKeyFunction;
                    IKeyframe keyframe = Keyframe.CreateForType(editorParams.PropertyInfo.PropertyType, currentFrame, propValue, keyFunction);
                    Core.Operations.SetKeyframe.Perform(animable, editorParams.PropertyPath, Document.Current.AnimationId, keyframe);
                }
            }
        }
Пример #6
0
 private SetKeyframe(IAnimationHost animationHost, string propertyPath, string animationId, IKeyframe keyframe)
 {
     AnimationHost = animationHost;
     PropertyPath  = propertyPath;
     Keyframe      = keyframe;
     AnimationId   = animationId;
 }
Пример #7
0
 public override float?GetValue(IKeyframe <float?> keyframe, float keyframeProgress)
 {
     if (keyframe.StartValue == null || keyframe.EndValue == null)
     {
         throw new System.InvalidOperationException("Missing values for keyframe.");
     }
     return(MathExt.Lerp(keyframe.StartValue.Value, keyframe.EndValue.Value, keyframeProgress));
 }
Пример #8
0
        public override Path GetValue(IKeyframe <ShapeData> keyframe, float keyframeProgress)
        {
            var startShapeData = keyframe.StartValue;
            var endShapeData   = keyframe.EndValue;

            _tempShapeData.InterpolateBetween(startShapeData, endShapeData, keyframeProgress);
            MiscUtils.GetPathFromData(_tempShapeData, _tempPath);
            return(_tempPath);
        }
Пример #9
0
 /// <summary>
 /// 从关键桢中获取观察点和目标点参数
 /// </summary>
 /// <param name="pKeyframe">关键桢</param>
 /// <param name="dX_Tar">目标点X</param>
 /// <param name="dY_Tar">目标点Y</param>
 /// <param name="dZ_Tar">目标点Z</param>
 /// <param name="dX_Obs">观察点X</param>
 /// <param name="dY_Obs">观察点Y</param>
 /// <param name="dZ_Obs">观察点Z</param>
 private static void GetParametersFromKeyFrame(IKeyframe pKeyframe, out double dX_Tar, out double dY_Tar, out double dZ_Tar,
                                               out double dX_Obs, out double dY_Obs, out double dZ_Obs)
 {
     dY_Tar = pKeyframe.get_PropertyValueDouble(1);
     dX_Tar = pKeyframe.get_PropertyValueDouble(2);
     dZ_Tar = pKeyframe.get_PropertyValueDouble(3);
     dY_Obs = pKeyframe.get_PropertyValueDouble(4);
     dX_Obs = pKeyframe.get_PropertyValueDouble(5);
     dZ_Obs = pKeyframe.get_PropertyValueDouble(6);
     return;
 }
        public static void AddKeyframe(string sequenceName, IKeyframe newKeyframe)
        {
            AnimationSequence.AnimationSequenceType sequenceTypeFromKeyframe = AnimationSequence.AnimationSequenceType.Transformation;
            if (newKeyframe is SpriteSheetKeyframe) { sequenceTypeFromKeyframe = AnimationSequence.AnimationSequenceType.SpriteSheet; }
            if (newKeyframe is ColourKeyframe) { sequenceTypeFromKeyframe = AnimationSequence.AnimationSequenceType.Colour; }
            if (newKeyframe is SkeletalKeyframe) { sequenceTypeFromKeyframe = AnimationSequence.AnimationSequenceType.Skeletal; }

            if (!Sequences.ContainsKey(sequenceName)) { AddSequence(sequenceName, sequenceTypeFromKeyframe, false); }

            if (Sequences[sequenceName].SequenceType == sequenceTypeFromKeyframe) { Sequences[sequenceName].Keyframes.Add(newKeyframe); }
        }
Пример #11
0
        public override ScaleXy GetValue(IKeyframe <ScaleXy> keyframe, float keyframeProgress)
        {
            if (keyframe.StartValue == null || keyframe.EndValue == null)
            {
                throw new InvalidOperationException("Missing values for keyframe.");
            }
            var startTransform = keyframe.StartValue;
            var endTransform   = keyframe.EndValue;

            return(new ScaleXy(MathExt.Lerp(startTransform.ScaleX, endTransform.ScaleX, keyframeProgress), MathExt.Lerp(startTransform.ScaleY, endTransform.ScaleY, keyframeProgress)));
        }
Пример #12
0
        public bool Remove(IKeyframe item)
        {
            int index = GetIndexByFrame(item.Frame);

            if (index < 0)
            {
                return(false);
            }
            source.RemoveAt(index);
            return(true);
        }
Пример #13
0
        public override Color GetValue(IKeyframe <Color> keyframe, float keyframeProgress)
        {
            if (keyframe.StartValue == null || keyframe.EndValue == null)
            {
                throw new System.InvalidOperationException("Missing values for keyframe.");
            }
            var startColor = keyframe.StartValue;
            var endColor   = keyframe.EndValue;

            return(GammaEvaluator.Evaluate(keyframeProgress, startColor, endColor));
        }
        public override PointF GetValue(IKeyframe <PointF> keyframe, float keyframeProgress)
        {
            if (keyframe.StartValue == null || keyframe.EndValue == null)
            {
                throw new System.InvalidOperationException("Missing values for keyframe.");
            }

            var startPoint = keyframe.StartValue;
            var endPoint   = keyframe.EndValue;

            _point.Set(startPoint.X + keyframeProgress * (endPoint.X - startPoint.X), startPoint.Y + keyframeProgress * (endPoint.Y - startPoint.Y));
            return(_point);
        }
Пример #15
0
        public override Vector2?GetValue(IKeyframe <Vector2?> keyframe, float keyframeProgress)
        {
            var pathKeyframe = (PathKeyframe)keyframe;
            var path         = pathKeyframe.Path;

            if (path == null || path.Contours.Count == 0)
            {
                return(keyframe.StartValue);
            }

            if (_pathMeasureKeyframe != pathKeyframe)
            {
                _pathMeasure         = new PathMeasure(path);
                _pathMeasureKeyframe = pathKeyframe;
            }

            return(_pathMeasure.GetPosTan(keyframeProgress * _pathMeasure.Length));
        }
        public override PointF GetValue(IKeyframe <PointF> keyframe, float keyframeProgress)
        {
            var pathKeyframe = (PathKeyframe)keyframe;
            var path         = pathKeyframe.Path;

            if (path == null || path.Contours.Count == 0)
            {
                return(keyframe.StartValue);
            }

            if (_pathMeasureKeyframe != pathKeyframe)
            {
                _pathMeasure         = new PathMeasure(path);
                _pathMeasureKeyframe = pathKeyframe;
            }

            _pathMeasure.GetPosTan(keyframeProgress * _pathMeasure.Length, ref _pos);
            _point.Set(_pos[0], _pos[1]);
            return(_point);
        }
Пример #17
0
        private IEnumerator <object> Drag(Widget widget, IAnimator animator, IKeyframe key)
        {
            var transform    = sv.Scene.CalcTransitionToSpaceOf(widget.Parent.AsWidget);
            var initMousePos = sv.MousePosition * transform;

            using (Document.Current.History.BeginTransaction()) {
                while (sv.Input.IsMousePressed())
                {
                    Document.Current.History.RollbackTransaction();
                    Utils.ChangeCursorIfDefault(MouseCursor.Hand);
                    var curMousePos = sv.MousePosition * transform;
                    var diff        = curMousePos - initMousePos;
                    animator.ResetCache();
                    Core.Operations.SetProperty.Perform(
                        typeof(IKeyframe), key, nameof(IKeyframe.Value), (Vector2)key.Value + diff);
                    yield return(null);
                }
                sv.Input.ConsumeKey(Key.Mouse0);
                Document.Current.History.CommitTransaction();
            }
        }
Пример #18
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);
        }
Пример #19
0
 public override DocumentData GetValue(IKeyframe <DocumentData> keyframe, float keyframeProgress)
 {
     return(keyframe.StartValue);
 }
Пример #20
0
 public bool Contains(IKeyframe item)
 {
     return(source.Contains((Keyframe <T>)item));
 }
Пример #21
0
 public void AddOrdered(IKeyframe item)
 {
     source.AddOrdered((Keyframe <T>)item);
 }
Пример #22
0
 public void Insert(int index, IKeyframe item)
 {
     source.Insert(index, (Keyframe <T>)item);
 }
Пример #23
0
 private void Reset(object sender, EventArgs e)
 {
     slider.Cursor = Cursors.Hand;
     if(_draggedKeyframe!=null)
         SortFrames();
     _draggedKeyframe = null;
 }
 public override T GetValue(IKeyframe <T> keyframe, float keyframeProgress)
 {
     return(_initialValue);
 }
Пример #25
0
 public override GradientColor GetValue(IKeyframe <GradientColor> keyframe, float keyframeProgress)
 {
     _gradientColor.Lerp(keyframe.StartValue, keyframe.EndValue, keyframeProgress);
     return(_gradientColor);
 }
Пример #26
0
 public static void Perform(Curve curve, IKeyframe key, bool select)
 {
     DocumentHistory.Current.Perform(new SelectCurveKey(curve, key, select));
 }
Пример #27
0
 public static void Perform(IAnimator animator, IKeyframe keyframe)
 {
     Perform(animator.Owner, animator.TargetPropertyPath, animator.AnimationId, keyframe);
 }
Пример #28
0
 public override Vector2?GetValue(IKeyframe <Vector2?> keyframe, float keyframeProgress)
 {
     return(_point);
 }
Пример #29
0
 /// <summary>
 /// 从关键桢中获取观察点和目标点参数
 /// </summary>
 /// <param name="pKeyframe">关键桢</param>
 /// <param name="dX_Tar">目标点X</param>
 /// <param name="dY_Tar">目标点Y</param>
 /// <param name="dZ_Tar">目标点Z</param>
 /// <param name="dX_Obs">观察点X</param>
 /// <param name="dY_Obs">观察点Y</param>
 /// <param name="dZ_Obs">观察点Z</param>
 private static void GetParametersFromKeyFrame(IKeyframe pKeyframe, out double dX_Tar, out double dY_Tar, out double dZ_Tar,
         out double dX_Obs, out double dY_Obs, out double dZ_Obs)
 {
     dY_Tar = pKeyframe.get_PropertyValueDouble(1);
     dX_Tar = pKeyframe.get_PropertyValueDouble(2);
     dZ_Tar = pKeyframe.get_PropertyValueDouble(3);
     dY_Obs = pKeyframe.get_PropertyValueDouble(4);
     dX_Obs = pKeyframe.get_PropertyValueDouble(5);
     dZ_Obs = pKeyframe.get_PropertyValueDouble(6);
     return;
 }
Пример #30
0
 private void OnKeyframeMouseDown(object sender, MouseButtonEventArgs e)
 {
     _draggedKeyframe = (IKeyframe)((System.Windows.Shapes.Rectangle)sender).Tag;
     CurrentKeyframe = _draggedKeyframe;
     slider.Cursor = Cursors.SizeWE;
     e.Handled = true;
 }
Пример #31
0
        private void TryMergeScaleAndAspectRatioForParticleTemplate(Node node)
        {
            if (node == null)
            {
                throw new ArgumentException("node can't be null");
            }
            if (particleModifierScaleAnimator == null && particleModifierAspectRatioAnimator == null)
            {
                return;
            }
            var   scaleAnimator            = node.Animators["Scale"];
            var   zoomAnimator             = particleModifierScaleAnimator;
            var   aspectRatioAnimator      = particleModifierAspectRatioAnimator;
            int   zoomAnimatorIndex        = 0;
            int   aspectRatioAnimatorIndex = 0;
            float zoom;
            float aspectRatio;

            ParticleEmitter.DecomposeScale((node as ParticleModifier).Scale, out aspectRatio, out zoom);
            while (true)
            {
                int         state;
                int         frame;
                KeyFunction keyFunction;
                IKeyframe   aspectRatioKey = null;
                IKeyframe   zoomKey        = null;
                if (aspectRatioAnimator != null && aspectRatioAnimatorIndex == aspectRatioAnimator.Keys.Count)
                {
                    aspectRatioAnimator = null;
                }
                if (zoomAnimator != null && zoomAnimatorIndex == zoomAnimator.Keys.Count)
                {
                    zoomAnimator = null;
                }
                if (zoomAnimator == null && aspectRatioAnimator == null)
                {
                    break;
                }
                if (zoomAnimator != null)
                {
                    zoomKey = zoomAnimator.Keys[zoomAnimatorIndex];
                }
                if (aspectRatioAnimator != null)
                {
                    aspectRatioKey = aspectRatioAnimator.Keys[aspectRatioAnimatorIndex];
                }
                if (zoomAnimator == null)
                {
                    state = 1;
                }
                else if (aspectRatioAnimator == null)
                {
                    state = -1;
                }
                else
                {
                    state = zoomKey.Frame.CompareTo(aspectRatioKey.Frame);
                }
                switch (state)
                {
                case -1:
                    frame       = zoomKey.Frame;
                    keyFunction = zoomKey.Function;
                    zoom        = (float)zoomKey.Value;
                    aspectRatio = aspectRatioAnimator?.CalcValue(AnimationUtils.FramesToSeconds(frame)) ?? aspectRatio;
                    zoomAnimatorIndex++;
                    break;

                case 0:
                    frame       = aspectRatioKey.Frame;
                    keyFunction = SelectKeyFunction(aspectRatioKey.Function, zoomKey.Function);
                    aspectRatio = (float)aspectRatioKey.Value;
                    zoom        = (float)zoomKey.Value;
                    aspectRatioAnimatorIndex++;
                    zoomAnimatorIndex++;
                    break;

                case 1:
                    frame       = aspectRatioKey.Frame;
                    keyFunction = aspectRatioKey.Function;
                    aspectRatio = (float)aspectRatioKey.Value;
                    zoom        = zoomAnimator?.CalcValue(AnimationUtils.FramesToSeconds(frame)) ?? zoom;
                    aspectRatioAnimatorIndex++;
                    break;

                default: throw new InvalidOperationException();
                }
                scaleAnimator.Keys.Add(frame, ParticleEmitter.ApplyAspectRatio(zoom, aspectRatio), keyFunction);
            }
        }
Пример #32
0
 public int IndexOf(IKeyframe item)
 {
     return(source.IndexOf((Keyframe <T>)item));
 }
Пример #33
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);
        }
Пример #34
0
 private SelectCurveKey(Curve curve, IKeyframe key, bool select)
 {
     Curve  = curve;
     Key    = key;
     Select = select;
 }