Ejemplo n.º 1
0
        private void CalcTickPoint()
        {
            _TickPoint = null;

            if (Scale is GaugeCircularScale)
                CalcCircularTickPoint(Scale as GaugeCircularScale);

            else if (Scale is GaugeLinearScale)
                CalcLinearTickPoint(Scale as GaugeLinearScale);
        }
Ejemplo n.º 2
0
        public object Clone()
        {
            TickPoint tp = new TickPoint(_TickMark);

            tp.Point = _Point;
            tp.Angle = _Angle;
            tp.Interval = _Interval;
            tp.Visible = _Visible;

            return (tp);
        }
Ejemplo n.º 3
0
        private void CalcCircularTickPoint(GaugeCircularScale scale)
        {
            double spread = Scale.MaxValue - Scale.MinValue;
            double dpt = scale.SweepAngle / spread;

            if (_Interval >= 0 && _Interval <= spread)
            {
                _TickPoint = new TickPoint(this);

                if (scale.Reversed == true)
                    _TickPoint.Angle = (float)(scale.StartAngle + scale.SweepAngle - (_Interval * dpt));
                else
                    _TickPoint.Angle = (float)(scale.StartAngle + _Interval * dpt);

                _TickPoint.Point = scale.GetPoint(Radius, _TickPoint.Angle);
                _TickPoint.Interval = _Interval;
            }
        }
Ejemplo n.º 4
0
        private GradientFillColor GetTickMarkFillColor(TickPoint tp)
        {
            if (_Rank == GaugeTickMarkRank.Custom)
                return (Layout.FillColor);

            ColorSourceFillEntry entry = (_Rank == GaugeTickMarkRank.Major)
                ? ColorSourceFillEntry.MajorTickMark : ColorSourceFillEntry.MinorTickMark;

            GradientFillColor fillColor = (Scale.GetRangeFillColor(tp.Interval, entry) ??
                                           Scale.GetSectionFillColor(tp.Interval, entry)) ?? Layout.FillColor;

            return (fillColor);
        }
Ejemplo n.º 5
0
        internal Bitmap GetTickMarkBitmap(Graphics g, TickPoint tp)
        {
            if (_Layout.Style != GaugeMarkerStyle.None)
            {
                if (_Width > 0 && _Length > 0)
                {
                    return (_GaugeMarker.GetMarkerBitmap(g, _Layout.Style,
                            GetTickMarkFillColor(tp), _Width, _Length));
                }
            }

            return (null);
        }
Ejemplo n.º 6
0
        private void PaintVerticalTickPoint(Graphics g, TickPoint tp, Image image)
        {
            Rectangle r = new Rectangle(0, 0, _Width, _Length);

            if (_Layout.Placement == DisplayPlacement.Far)
            {
                g.TranslateTransform(tp.Point.X + _Length - (_Length % 2), tp.Point.Y);
                g.RotateTransform(90);
            }
            else
            {
                g.TranslateTransform(tp.Point.X, tp.Point.Y);
                g.RotateTransform(-90);
            }

            r.X -= (_Width / 2);

            g.DrawImage(image, r);
            g.ResetTransform();
        }
Ejemplo n.º 7
0
        private void PaintHorizontalTickPoint(Graphics g, TickPoint tp, Image image)
        {
            if (_Layout.Placement != DisplayPlacement.Far)
            {
                Rectangle r = new Rectangle(tp.Point.X, tp.Point.Y, _Width, _Length);
                r.X -= _Width / 2;

                g.DrawImage(image, r);
            }
            else
            {
                Rectangle r = new Rectangle(0, 0, _Width, _Length);

                g.TranslateTransform(tp.Point.X, tp.Point.Y + _Length - (_Length % 2));
                g.RotateTransform(180);

                r.X -= _Width / 2;

                g.DrawImage(image, r);
                g.ResetTransform();
            }
        }
Ejemplo n.º 8
0
 private void PaintLinearTickPoint(Graphics g,
     TickPoint tp, Image image, GaugeLinearScale scale)
 {
     if (scale.Orientation == Orientation.Horizontal)
         PaintHorizontalTickPoint(g, tp, image);
     else
         PaintVerticalTickPoint(g, tp, image);
 }
Ejemplo n.º 9
0
        private void PaintCircularTickPoint(Graphics g, TickPoint tp, Image image)
        {
            Rectangle r = new Rectangle(0, 0, _Width, _Length);

            float angle = tp.Angle + 90;

            if (_Layout.Placement == DisplayPlacement.Near)
                angle += 180;

            g.TranslateTransform(tp.Point.X, tp.Point.Y);
            g.RotateTransform(angle % 360);

            r.X -= _Width / 2;

            g.DrawImage(image, r);
            g.ResetTransform();
        }
Ejemplo n.º 10
0
        internal void PaintTickPoint(Graphics g, TickPoint tp)
        {
            Image image = _Layout.Image ?? GetTickMarkBitmap(g, tp);

            if (image != null)
            {
                if (Scale is GaugeCircularScale)
                    PaintCircularTickPoint(g, tp, image);

                else if (Scale is GaugeLinearScale)
                    PaintLinearTickPoint(g, tp, image, Scale as GaugeLinearScale);
            }
        }
Ejemplo n.º 11
0
        private void CalcVerticalTickPoints(int n, double dpt)
        {
            _TickPoints = new TickPoint[n];

            double interval = _IntervalOffset;

            for (int i = 0; i < n; i++)
            {
                _TickPoints[i] = new TickPoint(this);

                int y = (Scale.Reversed == true)
                    ? Bounds.Top + (int)(dpt * interval)
                    : Bounds.Bottom - (int)(dpt * interval);

                _TickPoints[i].Point = new Point(Bounds.X, y);
                _TickPoints[i].Interval = interval;

                interval += _Interval;
            }
        }
Ejemplo n.º 12
0
        private void CalcHorizontalTickPoints(int n, double dpt)
        {
            _TickPoints = new TickPoint[n];

            double interval = _IntervalOffset;

            for (int i = 0; i < n; i++)
            {
                _TickPoints[i] = new TickPoint(this);

                int x = (Scale.Reversed == true)
                    ? Bounds.Right - (int)(dpt * interval)
                    : Bounds.X + (int)(dpt * interval);

                _TickPoints[i].Point = new Point(x, Bounds.Y);
                _TickPoints[i].Interval = interval;

                interval += _Interval;
            }
        }
Ejemplo n.º 13
0
        private void CalcCircularTickPoints(
            GaugeCircularScale scale, double ticks, int n)
        {
            double dpt = scale.SweepAngle / ticks;
            double theta = _Interval * dpt;

            double startAngle = scale.StartAngle;

            if (scale.Reversed == true)
                startAngle += scale.SweepAngle;

            int dir = scale.Reversed ? -1 : 1;
          
            startAngle += (dpt * _IntervalOffset * dir);

            _TickPoints = new TickPoint[n];

            double interval = _IntervalOffset;

            for (int i = 0; i < n; i++)
            {
                _TickPoints[i] = new TickPoint(this);

                _TickPoints[i].Angle = (float)(startAngle + (i * theta * dir));
                _TickPoints[i].Point = scale.GetPoint(Radius, _TickPoints[i].Angle);
                _TickPoints[i].Interval = interval;

                interval += _Interval;
            }
        }
Ejemplo n.º 14
0
        private void CalcVerticalTickPoint(GaugeLinearScale scale, double dpt)
        {
            _TickPoint = new TickPoint(this);

            int x = scale.ScaleBounds.X + Offset;

            int y = (scale.Reversed == true)
                ? Scale.Bounds.Top + (int)(dpt * _Interval)
                : Scale.Bounds.Bottom - (int)(dpt * _Interval);

            _TickPoint.Point = new Point(x, y);
            _TickPoint.Interval = _Interval;
        }
Ejemplo n.º 15
0
        private void CalcHorizontalTickPoint(GaugeLinearScale scale, double dpt)
        {
            _TickPoint = new TickPoint(this);

            int x = (scale.Reversed == true)
                ? Scale.Bounds.Right - (int)(dpt * _Interval)
                : Scale.Bounds.X + (int)(dpt * _Interval);

            int y = scale.ScaleBounds.Y + Offset;

            _TickPoint.Point = new Point(x, y);
            _TickPoint.Interval = _Interval;
        }