Пример #1
0
        public LinearScale Add(string name)
        {
            LinearScale linearScale = new LinearScale();

            linearScale.Name = name;
            this.Add(linearScale);
            return(linearScale);
        }
Пример #2
0
        public override object Clone()
        {
            MemoryStream           stream = new MemoryStream();
            BinaryFormatSerializer binaryFormatSerializer = new BinaryFormatSerializer();

            binaryFormatSerializer.Serialize(this, stream);
            LinearScale linearScale = new LinearScale();

            binaryFormatSerializer.Deserialize(linearScale, stream);
            return(linearScale);
        }
Пример #3
0
        public override void Render(GaugeGraphics g)
        {
            if (this.Common != null && base.Visible && this.GetScale() != null && !double.IsNaN(this.StartValue) && !double.IsNaN(this.EndValue))
            {
                this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(this.Name));
                g.StartHotRegion(this);
                LinearScale  scale        = this.GetScale();
                Pen          pen          = null;
                Brush        brush        = null;
                GraphicsPath graphicsPath = null;
                try
                {
                    graphicsPath = g.GetLinearRangePath(scale.GetPositionFromValue(this.StartValue), scale.GetPositionFromValue(this.EndValue), this.StartWidth, this.EndWidth, scale.Position, this.GetGauge().GetOrientation(), this.DistanceFromScale, this.Placement, scale.Width);
                    if (graphicsPath != null && g.Graphics.VisibleClipBounds.IntersectsWith(graphicsPath.GetBounds()))
                    {
                        brush         = g.GetLinearRangeBrush(graphicsPath.GetBounds(), base.FillColor, base.FillHatchStyle, base.FillGradientType, base.FillGradientEndColor, this.GetGauge().GetOrientation(), this.GetScale().GetReversed(), this.StartValue, this.EndValue);
                        pen           = new Pen(base.BorderColor, (float)base.BorderWidth);
                        pen.DashStyle = g.GetPenStyle(base.BorderStyle);
                        g.FillPath(brush, graphicsPath);
                        if (base.BorderStyle != 0 && base.BorderWidth > 0)
                        {
                            g.DrawPath(pen, graphicsPath);
                        }
                        goto end_IL_0069;
                    }
                    g.EndHotRegion();
                    this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name));
                    return;

                    end_IL_0069 :;
                }
                catch (Exception)
                {
                    if (graphicsPath != null)
                    {
                        graphicsPath.Dispose();
                    }
                    if (pen != null)
                    {
                        pen.Dispose();
                    }
                    if (brush != null)
                    {
                        brush.Dispose();
                    }
                    throw;
                }
                this.Common.GaugeCore.HotRegionList.SetHotRegion(this, PointF.Empty, graphicsPath);
                g.EndHotRegion();
                this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name));
            }
        }
        private LinearRange[] GetColorRanges()
        {
            LinearGauge gauge = this.GetGauge();
            LinearScale scale = this.GetScale();

            if (gauge != null && scale != null)
            {
                double    barStartValue = this.GetBarStartValue();
                double    position      = base.Position;
                ArrayList arrayList     = null;
                foreach (LinearRange range in gauge.Ranges)
                {
                    if (range.GetScale() == scale && range.InRangeBarPointerColor != Color.Empty)
                    {
                        double valueLimit  = scale.GetValueLimit(range.StartValue);
                        double valueLimit2 = scale.GetValueLimit(range.EndValue);
                        if (barStartValue >= valueLimit && barStartValue <= valueLimit2)
                        {
                            goto IL_00aa;
                        }
                        if (position >= valueLimit && position <= valueLimit2)
                        {
                            goto IL_00aa;
                        }
                        if (valueLimit >= barStartValue && valueLimit <= position)
                        {
                            goto IL_00aa;
                        }
                        if (valueLimit2 >= barStartValue && valueLimit2 <= position)
                        {
                            goto IL_00aa;
                        }
                    }
                    continue;
IL_00aa:
                    if (arrayList == null)
                    {
                        arrayList = new ArrayList();
                    }
                    arrayList.Add(range);
                }
                if (arrayList == null)
                {
                    return(null);
                }
                return((LinearRange[])arrayList.ToArray(typeof(LinearRange)));
            }
            return(null);
        }
Пример #5
0
        public LinearScale GetScale()
        {
            if (this.GetGauge() == null)
            {
                return(null);
            }
            LinearScale linearScale = null;

            try
            {
                return(this.GetGauge().Scales[base.ScaleName]);
            }
            catch
            {
                return(null);
            }
        }
        private double GetBarStartValue()
        {
            LinearScale scale = this.GetScale();

            if (this.Type == LinearPointerType.Thermometer)
            {
                return(double.NegativeInfinity);
            }
            if (this.BarStart == BarStart.ScaleStart)
            {
                return(double.NegativeInfinity);
            }
            if (scale.Logarithmic)
            {
                return(1.0);
            }
            return(0.0);
        }
Пример #7
0
 public GraphicsPath GetPath(GaugeGraphics g, bool getShadowPath)
 {
     if (getShadowPath && (!base.Visible || base.ShadowOffset == 0.0))
     {
         return(null);
     }
     if (!double.IsNaN(this.StartValue) && !double.IsNaN(this.EndValue))
     {
         LinearScale  scale           = this.GetScale();
         GraphicsPath linearRangePath = g.GetLinearRangePath(scale.GetPositionFromValue(this.StartValue), scale.GetPositionFromValue(this.EndValue), this.StartWidth, this.EndWidth, scale.Position, this.GetGauge().GetOrientation(), this.DistanceFromScale, this.Placement, scale.Width);
         if (getShadowPath)
         {
             using (Matrix matrix = new Matrix())
             {
                 matrix.Translate(base.ShadowOffset, base.ShadowOffset);
                 linearRangePath.Transform(matrix);
                 return(linearRangePath);
             }
         }
         return(linearRangePath);
     }
     return(null);
 }
        public BarStyleAttrib GetThermometerStyleAttrib(GaugeGraphics g)
        {
            BarStyleAttrib barStyleAttrib = new BarStyleAttrib();

            if (this.Image != "")
            {
                return(barStyleAttrib);
            }
            LinearScale scale = this.GetScale();
            double      num   = scale.GetValueLimit(this.GetBarStartValue());

            if ((this.Type == LinearPointerType.Thermometer || this.BarStart == BarStart.ScaleStart) && num > scale.MinimumLog)
            {
                num = scale.MinimumLog;
            }
            double valueLimit         = scale.GetValueLimit(base.Position);
            float  positionFromValue  = scale.GetPositionFromValue(num);
            float  positionFromValue2 = scale.GetPositionFromValue(valueLimit);
            float  num2              = positionFromValue2 - positionFromValue;
            float  width             = this.Width;
            float  bulbSize          = this.ThermometerBulbSize;
            float  bulbOffset        = this.thermometerBulbOffset;
            float  distanceFromScale = this.DistanceFromScale;

            if (Math.Round((double)num2, 4) == 0.0 && this.Type != LinearPointerType.Thermometer)
            {
                return(barStyleAttrib);
            }
            double num3 = scale.GetValueLimit(double.PositiveInfinity);

            if (num3 < scale.Maximum)
            {
                num3 = scale.Maximum;
            }
            float positionFromValue3 = scale.GetPositionFromValue(num3);

            barStyleAttrib.primaryPath = g.GetThermometerPath(positionFromValue, positionFromValue2, width, scale.Position, this.GetGauge().GetOrientation(), distanceFromScale, this.Placement, scale.GetReversed(), scale.Width, bulbOffset, bulbSize, this.ThermometerStyle);
            if (barStyleAttrib.primaryPath == null)
            {
                return(barStyleAttrib);
            }
            barStyleAttrib.totalPath    = g.GetThermometerPath(positionFromValue, positionFromValue3, this.Width, scale.Position, this.GetGauge().GetOrientation(), this.DistanceFromScale, this.Placement, scale.GetReversed(), scale.Width, this.ThermometerBulbOffset, this.ThermometerBulbSize, this.ThermometerStyle);
            barStyleAttrib.totalBrush   = g.GetLinearRangeBrush(barStyleAttrib.totalPath.GetBounds(), this.ThermometerBackColor, this.ThermometerBackHatchStyle, (RangeGradientType)Enum.Parse(typeof(RangeGradientType), this.ThermometerBackGradientType.ToString()), this.ThermometerBackGradientEndColor, this.GetGauge().GetOrientation(), this.GetScale().GetReversed(), 0.0, 0.0);
            barStyleAttrib.primaryBrush = g.GetLinearRangeBrush(barStyleAttrib.primaryPath.GetBounds(), this.FillColor, this.FillHatchStyle, (RangeGradientType)Enum.Parse(typeof(RangeGradientType), this.FillGradientType.ToString()), this.FillGradientEndColor, this.GetGauge().GetOrientation(), this.GetScale().GetReversed(), 0.0, 0.0);
            LinearRange[] colorRanges = this.GetColorRanges();
            if (colorRanges != null)
            {
                barStyleAttrib.secondaryPaths   = new GraphicsPath[colorRanges.Length];
                barStyleAttrib.secondaryBrushes = new Brush[colorRanges.Length];
                int           num4  = 0;
                LinearRange[] array = colorRanges;
                foreach (LinearRange linearRange in array)
                {
                    double num5 = scale.GetValueLimit(linearRange.StartValue);
                    if (num5 < num)
                    {
                        num5 = num;
                    }
                    if (num5 > valueLimit)
                    {
                        num5 = valueLimit;
                    }
                    double num6 = scale.GetValueLimit(linearRange.EndValue);
                    if (num6 < num)
                    {
                        num6 = num;
                    }
                    if (num6 > valueLimit)
                    {
                        num6 = valueLimit;
                    }
                    float positionFromValue4 = scale.GetPositionFromValue(num5);
                    float positionFromValue5 = scale.GetPositionFromValue(num6);
                    float num7 = positionFromValue5 - positionFromValue4;
                    if (Math.Round((double)num7, 4) == 0.0)
                    {
                        barStyleAttrib.secondaryPaths[num4]   = null;
                        barStyleAttrib.secondaryBrushes[num4] = null;
                    }
                    else
                    {
                        barStyleAttrib.secondaryPaths[num4]   = g.GetLinearRangePath(positionFromValue4, positionFromValue5, width, width, scale.Position, this.GetGauge().GetOrientation(), distanceFromScale, this.Placement, scale.Width);
                        barStyleAttrib.secondaryBrushes[num4] = g.GetLinearRangeBrush(barStyleAttrib.primaryPath.GetBounds(), linearRange.InRangeBarPointerColor, this.FillHatchStyle, (RangeGradientType)Enum.Parse(typeof(RangeGradientType), this.FillGradientType.ToString()), this.FillGradientEndColor, this.GetGauge().GetOrientation(), this.GetScale().GetReversed(), 0.0, 0.0);
                    }
                    num4++;
                }
            }
            return(barStyleAttrib);
        }
Пример #9
0
 public int IndexOf(LinearScale value)
 {
     return(base.List.IndexOf(value));
 }
Пример #10
0
 public void Insert(int index, LinearScale value)
 {
     base.List.Insert(index, value);
 }
Пример #11
0
 public bool Contains(LinearScale value)
 {
     return(base.List.Contains(value));
 }
Пример #12
0
 public void Remove(LinearScale value)
 {
     base.List.Remove(value);
 }
Пример #13
0
 public int Add(LinearScale value)
 {
     return(base.List.Add(value));
 }