private void CalculateLabelJustified(ScaleDiscreetItem item, Size textSize, double angle, int radius, Point centerPoint)
        {
            int   num   = radius + base.TextMargin;
            Point point = Math2.ToRotatedPoint(angle, (double)num, centerPoint);

            item.TextRectangle = Math2.TextRectangleAngular(textSize, point, base.TextMargin, angle);
        }
        private void CalculateLabelCenter(ScaleDiscreetItem item, Size textSize, double angle, int radius, Point centerPoint)
        {
            int   num   = radius + base.TextMargin + (int)Math.Abs(Math2.Cos(angle) * (double)textSize.Width / 2.0) + (int)Math.Abs(Math2.Sin(angle) * (double)textSize.Height / 2.0);
            Point point = Math2.ToRotatedPoint(angle, (double)num, centerPoint);

            item.TextRectangle = new Rectangle(point.X - textSize.Width / 2, point.Y - textSize.Height / 2, textSize.Width + 1, textSize.Height + 1);
        }
Example #3
0
        public void DrawGradientCircle(Color color, Point centerPoint, int radius, bool mouseDown, float rotationAngle, bool reverse)
        {
            iColors.FaceColorFlat = iColors.Darken1(color);
            if (mouseDown)
            {
                iColors.FaceColorFlat = iColors.Lighten2(iColors.FaceColorFlat);
            }
            Rectangle    rect         = new Rectangle(centerPoint.X - radius, centerPoint.Y - radius, radius * 2, radius * 2);
            GraphicsPath graphicsPath = new GraphicsPath();

            graphicsPath.AddEllipse(rect);
            PathGradientBrush pathGradientBrush = new PathGradientBrush(graphicsPath);

            pathGradientBrush.CenterColor    = Color.White;
            pathGradientBrush.SurroundColors = new Color[1]
            {
                iColors.FaceColorFlat
            };
            float num = 225f - rotationAngle;

            pathGradientBrush.CenterPoint = Math2.ToRotatedPoint((double)num, (double)((float)radius * 0.67f), centerPoint);
            this.FillPath(pathGradientBrush, graphicsPath);
            pathGradientBrush.Dispose();
            this.DrawEllipse(this.Pen(iColors.FaceColorFlat), rect);
        }
Example #4
0
        public static Point[] ToRotatedPoints(double angle, Rectangle r)
        {
            Point[] array        = new Point[4];
            Point   centerPoint  = Math2.ToCenterPoint(r);
            Point   centerPoint2 = Math2.ToRotatedPoint(angle, (double)(r.Width / 2), centerPoint);
            Point   centerPoint3 = Math2.ToRotatedPoint(angle + 180.0, (double)(r.Width / 2), centerPoint);

            array[0] = Math2.ToRotatedPoint(angle + 90.0, (double)(r.Height / 2), centerPoint2);
            array[3] = Math2.ToRotatedPoint(angle - 90.0, (double)(r.Height / 2), centerPoint2);
            array[1] = Math2.ToRotatedPoint(angle + 90.0, (double)(r.Height / 2), centerPoint3);
            array[2] = Math2.ToRotatedPoint(angle - 90.0, (double)(r.Height / 2), centerPoint3);
            return(array);
        }
Example #5
0
        protected void UpdateGrabHandles(Rectangle r)
        {
            double centerX = (double)(r.Left + r.Right) / 2.0;
            double centerY = (double)(r.Top + r.Bottom) / 2.0;
            double num     = (double)r.Width / 2.0;
            double num2    = (double)r.Height / 2.0;
            double num3    = Math.Atan2(num2, num) * 360.0 / 6.2831853071795862;
            double radius  = Math.Sqrt(num * num + num2 * num2);

            this.GrabHandle0.Rectangle = this.CalcGrabRect(Math2.ToRotatedPoint(180.0 + num3 + this.Rotation, radius, centerX, centerY));
            this.GrabHandle1.Rectangle = this.CalcGrabRect(Math2.ToRotatedPoint(270.0 + this.Rotation, num2, centerX, centerY));
            this.GrabHandle2.Rectangle = this.CalcGrabRect(Math2.ToRotatedPoint(0.0 - num3 + this.Rotation, radius, centerX, centerY));
            this.GrabHandle3.Rectangle = this.CalcGrabRect(Math2.ToRotatedPoint(0.0 + this.Rotation, num, centerX, centerY));
            this.GrabHandle4.Rectangle = this.CalcGrabRect(Math2.ToRotatedPoint(0.0 + num3 + this.Rotation, radius, centerX, centerY));
            this.GrabHandle5.Rectangle = this.CalcGrabRect(Math2.ToRotatedPoint(90.0 + this.Rotation, num2, centerX, centerY));
            this.GrabHandle6.Rectangle = this.CalcGrabRect(Math2.ToRotatedPoint(180.0 - num3 + this.Rotation, radius, centerX, centerY));
            this.GrabHandle7.Rectangle = this.CalcGrabRect(Math2.ToRotatedPoint(180.0 + this.Rotation, num, centerX, centerY));
        }
        private void CalculateLabelCallout(ScaleDiscreetItem item, Size textSize, double angle, int radius, Point centerPoint)
        {
            int num = radius + base.TextMargin;

            item.LinePoint1 = Math2.ToRotatedPoint(angle, (double)num, centerPoint);
            if (angle == 0.0)
            {
                num               += (int)(1.414 * (double)this.CallOutLength);
                item.LinePoint2    = Math2.ToRotatedPoint(angle, (double)num, centerPoint);
                item.TextRectangle = Math2.TextRectangleAngular(textSize, item.LinePoint2, base.TextMargin, angle);
            }
            else if (angle == 180.0)
            {
                num               += (int)(1.414 * (double)this.CallOutLength);
                item.LinePoint2    = Math2.ToRotatedPoint(angle, (double)num, centerPoint);
                item.TextRectangle = Math2.TextRectangleAngular(textSize, item.LinePoint2, base.TextMargin, angle);
            }
            else if (angle == 90.0)
            {
                num               += (int)(1.414 * (double)this.CallOutLength);
                item.LinePoint2    = Math2.ToRotatedPoint(angle, (double)num, centerPoint);
                item.TextRectangle = Math2.TextRectangleAngular(textSize, item.LinePoint2, base.TextMargin, angle);
            }
            else if (angle == 270.0)
            {
                num               += (int)(1.414 * (double)this.CallOutLength);
                item.LinePoint2    = Math2.ToRotatedPoint(angle, (double)num, centerPoint);
                item.TextRectangle = Math2.TextRectangleAngular(textSize, item.LinePoint2, base.TextMargin, angle);
            }
            else if (angle > 90.0 && angle < 270.0)
            {
                num               += this.CallOutLength;
                item.LinePoint2    = Math2.ToRotatedPoint(angle, (double)num, centerPoint);
                item.LinePoint3    = Math2.ToRotatedPoint(180.0, (double)this.CallOutLength, item.LinePoint2);
                item.TextRectangle = Math2.TextRectangleAngular(textSize, item.LinePoint3, base.TextMargin, angle);
            }
            else
            {
                num               += this.CallOutLength;
                item.LinePoint2    = Math2.ToRotatedPoint(angle, (double)num, centerPoint);
                item.LinePoint3    = Math2.ToRotatedPoint(0.0, (double)this.CallOutLength, item.LinePoint2);
                item.TextRectangle = Math2.TextRectangleAngular(textSize, item.LinePoint3, base.TextMargin, angle);
            }
        }
Example #7
0
        private Point GetTickPoint(IScaleTickBase tick, float radius)
        {
            double angle = this.I_Range.ValueToAngle(tick.Value);
            double num;

            switch ((!(tick is ScaleTickMinor)) ? ((tick is ScaleTickMid) ? (tick as ScaleTickMid).Alignment : AlignmentStyle.Near) : (tick as ScaleTickMinor).Alignment)
            {
            case AlignmentStyle.Center:
                num = (double)((float)(base.TickMajor.Length - tick.Length) / 2f);
                break;

            case AlignmentStyle.Far:
                num = (double)(base.TickMajor.Length - tick.Length);
                break;

            default:
                num = 0.0;
                break;
            }
            return(Math2.ToRotatedPoint(angle, (double)(radius + (float)this.Margin) + num, this.CenterPoint));
        }
 protected override void Calculate(PaintArgs p, ScaleDiscreetItemCollection items, Point centerPoint, int activeIndex, int pointerExtent)
 {
     if (base.Visible)
     {
         DrawStringFormat genericTypographic = DrawStringFormat.GenericTypographic;
         genericTypographic.LineAlignment = StringAlignment.Near;
         genericTypographic.Alignment     = StringAlignment.Near;
         for (int i = 0; i < items.Count; i++)
         {
             Font   font     = (i != activeIndex) ? base.TextInactiveFont : base.TextActiveFont;
             Size   textSize = p.Graphics.MeasureString(items[i].Text, font, true);
             double angle    = this.ScaleRange.ValueToAngle(i, items.Count);
             int    num      = pointerExtent + base.Margin;
             if (base.Markers.Style != MarkerStyleLabel.None)
             {
                 items[i].MarkerPoint = Math2.ToRotatedPoint(angle, (double)(num + base.Markers.Size), centerPoint);
                 num += 2 * base.Markers.Size;
             }
             items[i].LinePoint1 = Point.Empty;
             items[i].LinePoint2 = Point.Empty;
             items[i].LinePoint3 = Point.Empty;
             if (this.TextAlignment == StringAlignmentDiscreetAngular.Center)
             {
                 this.CalculateLabelCenter(items[i], textSize, angle, num, centerPoint);
             }
             else if (this.TextAlignment == StringAlignmentDiscreetAngular.CallOut)
             {
                 this.CalculateLabelCallout(items[i], textSize, angle, num, centerPoint);
             }
             else if (this.TextAlignment == StringAlignmentDiscreetAngular.Justified)
             {
                 this.CalculateLabelJustified(items[i], textSize, angle, num, centerPoint);
             }
         }
     }
 }
Example #9
0
        private Point GetScalePoint(double value, double radius)
        {
            double angle = this.I_Range.ValueToAngle(value);

            return(Math2.ToRotatedPoint(angle, radius, this.CenterPoint));
        }