Beispiel #1
0
 public CircledPathes(PolygonControl container, GraphicsPath path, float distance, float angleOffset, float rotation, int repetition, AngleFilterDelegate isBypassed, bool isFixed, Brush brush, Pen pen)
     : base(container, distance, angleOffset, rotation, brush, pen)
 {
     Path            = path;
     Repetition      = repetition;
     BypassPredicate = isBypassed;
     IsFixed         = isFixed;
 }
Beispiel #2
0
        public void Initialize()
        {
            Circles.Mapper        = this.ToPhysicalAngle;
            TicksAndLables.Mapper = this.ToPhysicalAngle;

            Circles.Add(new PointF(), OutsideRadius, false, new SolidBrush(LoopColor), new Pen(BorderColor, BorderWidth));
            Circles.Add(new PointF(), InsideRadius, false, IsTransparent ? new SolidBrush(Color.Transparent) : new SolidBrush(FaceColor), new Pen(BorderColor, BorderWidth));

            #region Add Ticks

            if (MajorTickStep > 0)
            {
                Pen majorPen = new Pen(ScaleColor, 3);
                TicksAndLables.AddLines(InsideRadius, 0, -0.4f, MajorTickStep, majorPen, null, false);
                TicksAndLables.AddLines(OutsideRadius - 0.2f, 0, -0.4f, MajorTickStep, majorPen, null, false);
            }

            if (MiddleTickStep > 0)
            {
                Pen middlePen = new Pen(ScaleColor, 2);
                AngleFilterDelegate filter = new AngleFilterDelegate(x => x % MajorTickStep == 0);
                TicksAndLables.AddLines(InsideRadius, 0, -0.2f, MiddleTickStep, middlePen, filter, false);
                TicksAndLables.AddLines(OutsideRadius - 0.1f, 0, -0.2f, MiddleTickStep, middlePen, filter, false);
            }

            if (MinorTickStep > 0)
            {
                Pen minorPen = new Pen(ScaleColor, 1);
                //AngleFilterDelegate filter = new AngleFilterDelegate(x => x % MiddleTickStep == 0);
                TicksAndLables.AddLines(InsideRadius, 0, -0.2f, MinorTickStep, minorPen, (x => x % MiddleTickStep == 0), true);
                TicksAndLables.AddLines(OutsideRadius - 0.1f, 0, -0.2f, MinorTickStep, minorPen, (x => x % MiddleTickStep == 0), true);
            }

            #endregion

            float middle = (InsideRadius + OutsideRadius) / 2f;

            if (LabelStep > 0)
            {
                TicksAndLables.AddLables(new Font("AstroGadget", 9f, FontStyle.Regular), new SolidBrush(LabelColor),
                                         middle, 0, 0, 12, null, null);
            }

            if (SignOffset > 0)
            {
                List <string> signs = new List <string>();
                for (char c = 'a'; c < 'm'; c++)
                {
                    signs.Add(c.ToString());
                }

                TicksAndLables.AddLables(signs, new Font("AstroGadget", 24f, FontStyle.Bold),
                                         new SolidBrush(IsTransparent ? Color.FromArgb(127, Color.Crimson) : Color.Crimson),
                                         middle, SignOffset, -90f, null, null);
            }
        }
Beispiel #3
0
        //public PointF ToControlPosition(float distanceLow, float angleLow, float ptShift)
        //{
        //    angleLow += AngleOffset;
        //    return Container.RelativeToCenter(distanceLow, angleLow, ptShift);
        //}

        public CircledPathes AddLines(float distance, float angleOffset, float length, float step, Pen pen, AngleFilterDelegate filter, bool isFixed)
        {
            if (!Toolkit.Contains(pen) && pen != null)
            {
                Toolkit.Add(pen);
            }

            int repetition = (int)(360 / step);
            //path.AddLine(-0.5f * length * Container.UnitSize, 0, 0.5f * length * Container.UnitSize, 0);
            GraphicsPath path = new GraphicsPath();

            path.AddLine(-0.5f * length, 0, 0.5f * length, 0);
            CircledPathes lines = new CircledPathes(Container, path, distance, angleOffset, 0, repetition, filter, isFixed, null, pen);

            Add(lines);
            return(lines);
        }