Overlaps() public méthode

public Overlaps ( KeyFrame keyTest, enumFrameTimeType &iTimeType ) : bool
keyTest KeyFrame
iTimeType enumFrameTimeType
Résultat bool
        public KeyFrame Add(KeyFrame keyFrame, bool bSuspendRedraw)
        {
            if( (keyFrame.StartMillisecond > _Ruler.EndMillisecond) || (keyFrame.EndMillisecond > _Ruler.EndMillisecond) )
                throw new System.Exception("You can not add a keyframe with a start/end time greater than the end time of the ruler.");

            if(keyFrame.KeyFrameType == KeyFrame.enumKeyFrameType.Snapshot)
            {
                //First lets verify that there is not already a single frame at this time slice.
                foreach(KeyFrame frame in _arySingleFrames)
                    if(frame.StartMillisecond == keyFrame.StartMillisecond)
                        return null;

                //Now lets make sure that it does not overlap with any of the video frames.
                KeyFrame.enumFrameTimeType iTimeType = KeyFrame.enumFrameTimeType.StartTime;
                foreach(KeyFrame frame in _aryMulitFrames)
                    if(frame.Overlaps(keyFrame, ref iTimeType))
                        return null;

                _arySingleFrames.Add(keyFrame);
            }
            else if(keyFrame.KeyFrameType == KeyFrame.enumKeyFrameType.CurrentFrame)
            {
                if(_CurrentFrame != null)
                    throw new System.Exception("There is alread a current frame defined.");

                _CurrentFrame = keyFrame;
            }
            else
            {
                //First lets verify that there is not already a range frame overlapping this time slice.
                KeyFrame.enumFrameTimeType iTimeType = KeyFrame.enumFrameTimeType.StartTime;
                foreach(KeyFrame frame in _aryMulitFrames)
                    if(frame.Overlaps(keyFrame, ref iTimeType))
                    {
                        //If it overlaps because of the start time then chunk it. If it overlaps because of the end time
                        //then lets see if we can come up with an end time that will work.
                        if(iTimeType == KeyFrame.enumFrameTimeType.StartTime)
                            return null;
                        else
                            keyFrame.EndMillisecond = frame.StartMillisecond - 1;
                    }

                //Now lets verify that there is not a single frame overlapping this video range.
                foreach(KeyFrame frame in _arySingleFrames)
                    if(keyFrame.Overlaps(frame, ref iTimeType))
                    {
                        //Lets find whether the start or end point is closest and then then
                        //add the frame so it does not overlap.
                        if(Math.Abs(frame.StartMillisecond-keyFrame.StartMillisecond) < Math.Abs(frame.StartMillisecond-keyFrame.EndMillisecond) )
                        {
                            //Start millisecond is closer to the single.
                            keyFrame.StartMillisecond = frame.StartMillisecond + 1;
                        }
                        else
                        {
                            //End millisecond is closer to the single.
                            keyFrame.EndMillisecond = frame.StartMillisecond - 1;

                        }
                    }

                _aryMulitFrames.Add(keyFrame);
            }

            base.List.Add(keyFrame as object);

            if(!bSuspendRedraw) _Ruler.RedrawBitmap();

            return keyFrame;
        }