Ejemplo n.º 1
0
        public void AddQuill(double angle, double shift, Pen pen)
        {
            Quill quill = new Quill();

            quill.AngularPosition = angle;
            quill.RadialPosition  = shift;
            quill.Pen             = pen;
            _quills.Add(quill);
        }
Ejemplo n.º 2
0
        private PointF QuillPosition(Quill quill)
        {
            PointF result = new PointF();
            double alpha  = Utils.Degrees2Radians(_currentAngle);
            PointF B      = new PointF();
            int    distance;
            double theta;

            if (_fixedRing.Touch == Edges.Outer)
            {
                if (_movingRing.Touch == Edges.Outer)
                {
                    distance = _fixedRing.OuterRadius + _movingRing.OuterRadius;
                    theta    = alpha * _fixedRing.OuterRadius / _movingRing.OuterRadius
                               + Utils.Degrees2Radians(quill.AngularPosition + _startAngle);
                }
                else
                {
                    distance = _fixedRing.OuterRadius - _movingRing.InnerRadius;
                    theta    = alpha * _fixedRing.OuterRadius / _movingRing.InnerRadius
                               + Utils.Degrees2Radians(quill.AngularPosition + _startAngle);
                }
            }
            else
            {
                if (_movingRing.Touch == Edges.Outer)
                {
                    distance = _fixedRing.InnerRadius - _movingRing.OuterRadius;
                    theta    = alpha * _fixedRing.InnerRadius / _movingRing.OuterRadius
                               + Utils.Degrees2Radians(quill.AngularPosition + _startAngle);
                }
                else
                {
                    distance = _fixedRing.InnerRadius - _movingRing.InnerRadius;
                    theta    = alpha * _fixedRing.InnerRadius / _movingRing.InnerRadius
                               + Utils.Degrees2Radians(quill.AngularPosition + _startAngle);
                }
            }
            B.X      = (float)(distance * Math.Cos(alpha));
            B.Y      = (float)(distance * Math.Sin(alpha));
            result.X = B.X +
                       (float)((_movingRing.InnerRadius + quill.RadialPosition *
                                (_movingRing.OuterRadius - _movingRing.InnerRadius) / 100
                                + _movingRing.InnerRadius) * Math.Cos(theta) + _bounds.Width / 2);
            result.Y = B.Y +
                       (float)((_movingRing.InnerRadius + quill.RadialPosition *
                                (_movingRing.OuterRadius - _movingRing.InnerRadius) / 100
                                + _movingRing.InnerRadius) * Math.Sin(theta) + _bounds.Height / 2);
            return(result);
        }
Ejemplo n.º 3
0
        private void BtnAddQuill_Click(object sender, EventArgs e)
        {
            Quill       q;
            dlgNewQuill dlg = new dlgNewQuill();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                q = new Quill();
                q.AngularPosition = dlg.AngularPosition;
                q.RadialPosition  = dlg.RadialPosition;
                q.Pen             = new Pen(dlg.PenColor);
                quills.Add(q);
                lstQuills.Update();
                UpdatePreview(sender, e);
            }
        }