예제 #1
0
        private void OnPictureBoxMouseMove(object sender, MouseEventArgs eargs)
        {
            var             currentPoint = new Point(eargs.X, eargs.Y);
            ProcessingStack stack        = null;

            if (_stacks.ContainsKey(sender))
            {
                stack = _stacks[sender];
                var pt = stack.GetCPoint(currentPoint);
                toolStripStatusLabel.Text = pt.ToString();
            }

            var pb = CheckCanDrawRect(sender, eargs);

            if (pb == null)
            {
                return;
            }

            _mouseMovingState.Current = currentPoint;

            var rect = ProcessingScene.GetRectangle(_mouseMovingState.Start, _mouseMovingState.Current);

            if (stack != null)
            {
                var image = stack.DrawRectangle(rect, Config.AreaBorderColor);
                pb.Image = image;
            }
            flowLayoutPanel.Update();
        }
예제 #2
0
        private void OnPictureBoxMouseUp(object sender, MouseEventArgs eargs)
        {
            var             currentPoint = new Point(eargs.X, eargs.Y);
            ProcessingStack stack;

            #region Track point

            #region Track direct

            if (_trackPointDirect != null)
            {
                if (_stacks.ContainsKey(sender))
                {
                    stack = _stacks[sender];
                    var pt = stack.GetCPoint(currentPoint);
                    pbC1C2.Cursor = Cursors.Default;
                    pbC0C1.Cursor = Cursors.Default;
                    pbC0C2.Cursor = Cursors.Default;

                    var trackPointSlide = new TrackPointSlide(_trackPointDirect.Iterations, pt, _trackPointDirect.N, _trackPointDirect.Alpha);
                    trackPointSlide.Show(this);
                    trackPointSlide.TrackPointChanged += ts =>
                    {
                        var act = new SceneTrackPointDirectAction
                        {
                            Alpha           = ts.Alpha,
                            N               = ts.N,
                            InitialPoint    = pt,
                            IterationsCount = ts.PointsCount,
                            DrawFullPath    = ts.ShowFullPath
                        };
                        ActionBodySimple(act, true);
                        flowLayoutPanel.Update();
                    };
                }
                _trackPointDirect = null;
                return;
            }

            #endregion

            #region Track reserse

            if (_trackPointReverse != null)
            {
                if (_stacks.ContainsKey(sender))
                {
                    stack = _stacks[sender];
                    var pt = stack.GetCPoint(currentPoint);
                    pbC1C2.Cursor = Cursors.Default;
                    pbC0C1.Cursor = Cursors.Default;
                    pbC0C2.Cursor = Cursors.Default;

                    var trackPointSlide = new TrackPointSlide(_trackPointReverse.Iterations, pt, _trackPointReverse.N, _trackPointReverse.Alpha);
                    trackPointSlide.Show(this);
                    trackPointSlide.TrackPointChanged += ts =>
                    {
                        var act = new SceneTrackPointReverseAction
                        {
                            Alpha           = ts.Alpha,
                            N               = ts.N,
                            InitialPoint    = pt,
                            IterationsCount = ts.PointsCount,
                            DrawFullPath    = ts.ShowFullPath
                        };
                        ActionBodySimple(act, true);
                        flowLayoutPanel.Update();
                    };
                }
                _trackPointReverse = null;
                return;
            }

            #endregion

            #endregion

            var pb = CheckCanDrawRect(sender, eargs);
            if (pb == null)
            {
                return;
            }

            _mouseMovingState.End = currentPoint;

            stack = _stacks[sender];
            var rect = ProcessingScene.GetRectangle(_mouseMovingState.Start, _mouseMovingState.End);
            if (rect.Width < 2 || rect.Height < 2)
            {
                _mouseMovingState = null;
                return;
            }

            var image = stack.DrawRectangle(rect, Config.AreaBorderColor);
            pb.Image = image;
            flowLayoutPanel.Update();

            stack.ZoomRectangle(rect);
            pb.Image = stack.CurrentFrame.ActualImage;
            flowLayoutPanel.Update();

            _mouseMovingState = null;
        }