Пример #1
0
 public KeyFrameModelCollectionTests()
 {
     _keyFrameModelCollection = new KeyFrameModelCollection
     {
         new MockKeyFrameModel(0),
         new MockKeyFrameModel(7),
         new MockKeyFrameModel(10),
         new MockKeyFrameModel(15),
         new MockKeyFrameModel(20),
         new MockKeyFrameModel(32),
         new MockKeyFrameModel(45),
         new MockKeyFrameModel(60),
         new MockKeyFrameModel(77),
         new MockKeyFrameModel(95),
         new MockKeyFrameModel(110),
         new MockKeyFrameModel(125),
         new MockKeyFrameModel(134),
         new MockKeyFrameModel(148),
         new MockKeyFrameModel(151),
         new MockKeyFrameModel(155),
         new MockKeyFrameModel(161),
         new MockKeyFrameModel(170),
         new MockKeyFrameModel(180)
     };
 }
        /// <inheritdoc/>
        public override SegmentViewModelBase CreateSegmentModelViewModel(SegmentViewModelBase sourceViewModel, int?trackNumber = null, int?startFrame = null, int?endFrame = null, string name = null, KeyFrameViewModelCollection keyFrameViewModels = null)
        {
            int    newTrackNumber = trackNumber.GetValueOrDefault(sourceViewModel.TrackNumber);
            int    newStartFrame  = startFrame.GetValueOrDefault(sourceViewModel.StartFrame);
            int    newEndFrame    = endFrame.GetValueOrDefault(sourceViewModel.EndFrame);
            string newName        = name ?? sourceViewModel.Name;

            KeyFrameModelCollection keyFrameModels = keyFrameViewModels != null
                                                     ? GetKeyFrameModels(keyFrameViewModels)
                                                     : GetKeyFrameModels(sourceViewModel.KeyFrameViewModels, true, newStartFrame - sourceViewModel.StartFrame);

            return(new MockSegmentViewModel(
                       new MockSegmentModel(newStartFrame, newEndFrame, newTrackNumber, keyFrameModels, newName),
                       _scriptVideoContext, _rootUndoObject, _undoService, _undoChangeFactory, _clipboardService, keyFrameViewModels
                       ));
        }
        /// <summary>
        /// Gets a <see cref="KeyFrameModelCollection"/> containing the data models of key frame view models in a <see cref="KeyFrameViewModelCollection"/>,
        /// optionally creating deep copies of the data models and offsetting the key frame numbers.
        /// </summary>
        /// <param name="keyFrameViewModels">The source <see cref="KeyFrameViewModelCollection"/>.</param>
        /// <param name="createCopies">Whether to create deep copies of the data models. Defaults to false.</param>
        /// <param name="frameOffset">The number of frames to offset the frame numbers of the data models by. Defaults to zero.</param>
        /// <returns>
        /// A <see cref="KeyFrameModelCollection"/> containing the data models of key frame view models in the <see cref="KeyFrameViewModelCollection"/>
        /// which have been deep copied and/or frame offset if so specified.
        /// </returns>
        protected KeyFrameModelCollection GetKeyFrameModels(KeyFrameViewModelCollection keyFrameViewModels, bool createCopies = false, int frameOffset = 0)
        {
            KeyFrameModelCollection keyFrameModels = new KeyFrameModelCollection();

            for (int i = 0; i < keyFrameViewModels.Count; i++)
            {
                KeyFrameModelBase keyFrameModel = createCopies ? keyFrameViewModels[i].Model.DeepCopy() : keyFrameViewModels[i].Model;
                if (frameOffset != 0)
                {
                    keyFrameModel.FrameNumber += frameOffset;
                }

                keyFrameModels.Add(keyFrameModel);
            }

            return(keyFrameModels);
        }
 /// <summary>
 /// Base constructor for classes derived from the <see cref="SegmentModelBase"/> class.
 /// </summary>
 /// <param name="startFrame">The inclusive zero-based start frame number of the segment.</param>
 /// <param name="endFrame">The inclusive zero-based end frame number of the segment.</param>
 /// <param name="trackNumber">The zero-based timeline track number of the segment. Defaults to zero.</param>
 /// <param name="keyFrames">A sorted collection of key frames in the segment. Defaults to a null <see cref="KeyFrameModelCollection"/>.</param>
 /// <param name="name">A descriptive name for the segment. Defaults to a null <see cref="string"/>.</param>
 protected SegmentModelBase(int startFrame, int endFrame, int trackNumber = 0, KeyFrameModelCollection keyFrames = null, string name = null)
 {
     StartFrame  = startFrame;
     EndFrame    = endFrame;
     TrackNumber = trackNumber;
     KeyFrames   = keyFrames ?? new KeyFrameModelCollection();
     Name        = name;
 }
Пример #5
0
 /// <summary>
 /// Creates a new instance of the <see cref="EllipseMaskShapeModel"/> class.
 /// </summary>
 /// <inheritdoc/>
 public EllipseMaskShapeModel(int startFrame, int endFrame, int trackNumber = 0, KeyFrameModelCollection keyFrames = null, string name = null) : base(startFrame, endFrame, trackNumber, keyFrames, name)
 {
 }
 public MockSegmentModel(int startFrame, int endFrame, int trackNumber = 0, KeyFrameModelCollection keyFrames = null, string name = null) : base(startFrame, endFrame, trackNumber, keyFrames, name)
 {
 }