Beispiel #1
0
        public GrHermite(IGrObj parent, GrLine line1, GrLine line2)
            : base(parent)
        {
            _line1 = line1;
            _line2 = line2;

            Objects.Add(_line1);
            Objects.Add(_line2);

            Name = "Кривая Эрмита";
        }
Beispiel #2
0
        public void OnMouseClick(GrPanel panel, System.Windows.Forms.MouseEventArgs e)
        {
            IGrObj grobj = panel.GetObjectUnder(e.X, e.Y);

            IGrObj parent = grobj;
            if (grobj == null || grobj.IsPrimitive)
            {
                parent = panel.Root;
            }

            if (_linePnt == null)
            {
                if (grobj is GrPoint)
                {
                    _linePnt = grobj as GrPoint;
                }
                else
                {
                    _linePnt = new GrPoint(parent, e.X, e.Y);
                }
            }
            else if (parent == _linePnt.Parent)
            {
                GrLine line;
                if (grobj is GrPoint)
                {
                    line = new GrLine(null, _linePnt, grobj as GrPoint);
                }
                else
                {
                    line = new GrLine(null, _linePnt, new GrPoint(null, e.X, e.Y));
                }

                line.Color = panel.SpawnColor;
                panel.Edited.Objects.Add(line);
                _linePnt = null;
                panel.Invalidate();
            }
        }
Beispiel #3
0
        public void OnMouseClick(GrPanel panel, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
                return;

            IGrObj grobj = panel.GetObjectUnder(e.X, e.Y);

            if (_hermiteVector == null && grobj != null
                && grobj is GrLine)
            {
                _hermiteVector = grobj as GrLine;
            }
            else if (_hermiteVector != null && grobj != null
                && grobj is GrLine)
            {
                GrHermite hermite = new GrHermite(null, _hermiteVector, grobj as GrLine);
                hermite.Color = panel.SpawnColor;
                panel.Edited.Objects.Add(hermite);
                _hermiteVector = null;
            }

            panel.Invalidate();
        }
Beispiel #4
0
 public void Deactivate(GrPanel panel)
 {
     _hermiteVector = null;
 }