예제 #1
0
        private bool IsOnExtraDrawing(Metadata metadata, PointF mouseCoordinates, long currentTimestamp)
        {
            // Test if we hit an unattached drawing.

            bool isOnDrawing    = false;
            int  hitResult      = -1;
            int  currentDrawing = 0;

            while (hitResult < 0 && currentDrawing < metadata.ExtraDrawings.Count)
            {
                hitResult = metadata.ExtraDrawings[currentDrawing].HitTest(mouseCoordinates, currentTimestamp, metadata.CalibrationHelper.DistortionHelper, metadata.CoordinateSystem, metadata.CoordinateSystem.Zooming);

                if (hitResult < 0)
                {
                    currentDrawing++;
                    continue;
                }

                isOnDrawing        = true;
                selectedObjectType = SelectedObjectType.ExtraDrawing;
                metadata.SelectDrawing(metadata.ExtraDrawings[currentDrawing]);

                if (hitResult > 0)
                {
                    manipulationType = ManipulationType.Resize;
                    resizingHandle   = hitResult;
                }
                else
                {
                    manipulationType = ManipulationType.Move;
                }
            }

            return(isOnDrawing);
        }
예제 #2
0
        private bool IsOnChronometer(Metadata metadata, PointF point, long currentTimestamp)
        {
            bool isOnDrawing = false;

            foreach (AbstractDrawing drawing in metadata.ChronoManager.Drawings)
            {
                int hitResult = drawing.HitTest(point, currentTimestamp, metadata.CalibrationHelper.DistortionHelper, metadata.CoordinateSystem, metadata.CoordinateSystem.Zooming);
                if (hitResult < 0)
                {
                    continue;
                }

                isOnDrawing        = true;
                selectedObjectType = SelectedObjectType.ExtraDrawing;
                metadata.SelectDrawing(drawing);

                if (hitResult > 0)
                {
                    manipulationType = ManipulationType.Resize;
                    resizingHandle   = hitResult;
                }
                else
                {
                    manipulationType = ManipulationType.Move;
                }

                break;
            }

            return(isOnDrawing);
        }
예제 #3
0
        private bool IsOnTrack(Metadata metadata, PointF mouseCoordinates, long currentTimeStamp)
        {
            // Track have their own special hit test because we need to differenciate the interactive case from the edit case.
            bool isOnDrawing = false;

            foreach (AbstractDrawing drawing in metadata.TrackManager.Drawings)
            {
                DrawingTrack track = drawing as DrawingTrack;
                if (track == null)
                {
                    continue;
                }

                int hitResult = drawing.HitTest(mouseCoordinates, currentTimeStamp, metadata.CalibrationHelper.DistortionHelper, metadata.CoordinateSystem, metadata.CoordinateSystem.Zooming);
                if (hitResult < 0)
                {
                    continue;
                }

                isOnDrawing        = true;
                selectedObjectType = SelectedObjectType.ExtraDrawing;
                metadata.SelectDrawing(drawing);

                manipulationType = ManipulationType.Move;

                switch (track.Status)
                {
                case TrackStatus.Interactive:
                    if (hitResult == 0 || hitResult == 1)
                    {
                        manipulationType = ManipulationType.Resize;
                        resizingHandle   = hitResult;
                    }
                    break;

                case TrackStatus.Configuration:
                    if (hitResult > 1)
                    {
                        manipulationType = ManipulationType.Resize;
                        resizingHandle   = hitResult;
                    }
                    break;
                }

                break;
            }

            return(isOnDrawing);
        }
예제 #4
0
        private bool DrawingHitTest(Metadata metadata, int keyFrameIndex, PointF mouseCoordinates, long currentTimeStamp, DistortionHelper distorter, CoordinateSystem transformer)
        {
            bool isOnDrawing    = false;
            int  hitResult      = -1;
            int  currentDrawing = 0;

            Keyframe kf = metadata.Keyframes[keyFrameIndex];

            while (hitResult < 0 && currentDrawing < kf.Drawings.Count)
            {
                hitResult = kf.Drawings[currentDrawing].HitTest(mouseCoordinates, currentTimeStamp, distorter, transformer, transformer.Zooming);

                if (hitResult < 0)
                {
                    currentDrawing++;
                    continue;
                }

                isOnDrawing        = true;
                selectedObjectType = SelectedObjectType.Drawing;
                metadata.SelectDrawing(kf.Drawings[currentDrawing]);
                metadata.SelectKeyframe(kf);

                if (hitResult > 0)
                {
                    manipulationType = ManipulationType.Resize;
                    resizingHandle   = hitResult;
                }
                else
                {
                    manipulationType = ManipulationType.Move;
                }
            }

            return(isOnDrawing);
        }