Exemplo n.º 1
0
        private void InitializeConfig()
        {
            var frame = new ProcessingFrame
            {
                Rectangle = new DRect
                {
                    X      = -1.0,
                    Y      = -1.0,
                    Width  = 2.0,
                    Height = 2.0
                }
            };

            _stack.Push(frame);
        }
Exemplo n.º 2
0
        private void PictureBoxMouseDoubleClick(object sender, MouseEventArgs e)
        {
            var fr    = _stack.Peek();
            var r     = fr.Rectangle;
            var pixWd = r.Width / pictureBox.Width;
            var pixHt = r.Height / pictureBox.Height;
            var newX  = r.X + e.X * pixWd;
            var newY  = r.Y + e.Y * pixHt;

            if (_pointSelecting)
            {
                var c1 = newX;
                var c2 = newY;
                var rd = c1 * c1 + c2 * c2;
                var c0 = 1 - rd;
                if (rd <= 1)
                {
                    c0 = Math.Sqrt(c0);
                    var cpt = new CPoint(c0, c1, c2);
                    _pointSelected = cpt;
                    PointNumber    = 0;
                    DrawPoint();
                }
                _pointSelecting = false;
                var tr = new TrackPoint(this, PointTrack.Count);
                tr.Show(this);
                track.Lines = PointTrack.Select(p => string.Format("{0} {1}", p, p.RG(CProjection.C1C2))).ToArray();
            }
            else
            {
                var newW    = 20 * pixWd;
                var newH    = 20 * pixHt;
                var newRect = new DRect {
                    X = newX, Y = newY, Width = newW, Height = newH
                };
                var newFr = new ProcessingFrame {
                    Rectangle = newRect
                };
                _stack.Push(newFr);
                Redraw();
            }
        }