public GraphicsPath GetPointerPath(GaugeGraphics g)
        {
            if (!this.Visible)
            {
                return(null);
            }
            GraphicsPath graphicsPath = new GraphicsPath();
            ScaleBase    scale        = this.GetScale();

            scale.GetPositionFromValue(scale.GetValueLimit(base.Position));
            if (this.Type == LinearPointerType.Marker || this.Image != string.Empty)
            {
                MarkerStyleAttrib markerStyleAttrib = this.GetMarkerStyleAttrib(g);
                if (markerStyleAttrib.path != null)
                {
                    graphicsPath.AddPath(markerStyleAttrib.path, false);
                }
            }
            else if (this.Type == LinearPointerType.Bar)
            {
                BarStyleAttrib barStyleAttrib = this.GetBarStyleAttrib(g);
                if (barStyleAttrib.primaryPath == null)
                {
                    graphicsPath.Dispose();
                    return(null);
                }
                if (barStyleAttrib.primaryPath != null)
                {
                    graphicsPath.AddPath(barStyleAttrib.primaryPath, false);
                }
            }
            else if (this.Type == LinearPointerType.Thermometer)
            {
                BarStyleAttrib thermometerStyleAttrib = this.GetThermometerStyleAttrib(g);
                if (thermometerStyleAttrib.primaryPath == null)
                {
                    graphicsPath.Dispose();
                    return(null);
                }
                if (thermometerStyleAttrib.totalPath != null)
                {
                    graphicsPath.AddPath(thermometerStyleAttrib.primaryPath, false);
                }
            }
            return(graphicsPath);
        }
        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);
        }
 public override void Render(GaugeGraphics g)
 {
     if (this.Common != null && this.Visible && this.GetScale() != null)
     {
         this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(this.Name));
         g.StartHotRegion(this);
         if (this.Image != "")
         {
             this.DrawImage(g, false);
             this.SetAllHotRegions(g);
             g.EndHotRegion();
             this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name));
         }
         else
         {
             Pen pen = new Pen(base.BorderColor, (float)base.BorderWidth);
             pen.DashStyle = g.GetPenStyle(base.BorderStyle);
             if (pen.DashStyle != 0)
             {
                 pen.Alignment = PenAlignment.Center;
             }
             if (this.Type == LinearPointerType.Bar)
             {
                 BarStyleAttrib barStyleAttrib = this.GetBarStyleAttrib(g);
                 try
                 {
                     if (barStyleAttrib.primaryPath != null)
                     {
                         g.FillPath(barStyleAttrib.primaryBrush, barStyleAttrib.primaryPath);
                     }
                     if (barStyleAttrib.secondaryPaths != null)
                     {
                         int            num            = 0;
                         GraphicsPath[] secondaryPaths = barStyleAttrib.secondaryPaths;
                         foreach (GraphicsPath graphicsPath in secondaryPaths)
                         {
                             if (graphicsPath != null && barStyleAttrib.secondaryBrushes[num] != null)
                             {
                                 g.FillPath(barStyleAttrib.secondaryBrushes[num], graphicsPath);
                             }
                             num++;
                         }
                     }
                     if (base.BorderWidth > 0 && barStyleAttrib.primaryBrush != null && base.BorderStyle != 0)
                     {
                         g.DrawPath(pen, barStyleAttrib.primaryPath);
                     }
                 }
                 catch (Exception)
                 {
                     barStyleAttrib.Dispose();
                 }
                 if (barStyleAttrib.primaryPath != null)
                 {
                     this.AddHotRegion(barStyleAttrib.primaryPath, true);
                 }
             }
             else if (this.Type == LinearPointerType.Thermometer)
             {
                 BarStyleAttrib thermometerStyleAttrib = this.GetThermometerStyleAttrib(g);
                 try
                 {
                     if (thermometerStyleAttrib.totalPath != null)
                     {
                         g.FillPath(thermometerStyleAttrib.totalBrush, thermometerStyleAttrib.totalPath);
                     }
                     if (thermometerStyleAttrib.primaryPath != null)
                     {
                         g.FillPath(thermometerStyleAttrib.primaryBrush, thermometerStyleAttrib.primaryPath);
                     }
                     if (thermometerStyleAttrib.secondaryPaths != null)
                     {
                         int            num2            = 0;
                         GraphicsPath[] secondaryPaths2 = thermometerStyleAttrib.secondaryPaths;
                         foreach (GraphicsPath graphicsPath2 in secondaryPaths2)
                         {
                             if (graphicsPath2 != null && thermometerStyleAttrib.secondaryBrushes[num2] != null)
                             {
                                 g.FillPath(thermometerStyleAttrib.secondaryBrushes[num2], graphicsPath2);
                             }
                             num2++;
                         }
                     }
                     if (base.BorderWidth > 0 && thermometerStyleAttrib.primaryBrush != null && base.BorderStyle != 0)
                     {
                         g.DrawPath(pen, thermometerStyleAttrib.totalPath);
                     }
                 }
                 catch (Exception)
                 {
                     thermometerStyleAttrib.Dispose();
                 }
                 if (thermometerStyleAttrib.primaryPath != null)
                 {
                     this.AddHotRegion(thermometerStyleAttrib.primaryPath, true);
                 }
             }
             else
             {
                 MarkerStyleAttrib markerStyleAttrib = this.GetMarkerStyleAttrib(g);
                 try
                 {
                     if (markerStyleAttrib.path != null)
                     {
                         bool circularFill = (byte)((this.MarkerStyle == MarkerStyle.Circle) ? 1 : 0) != 0;
                         g.FillPath(markerStyleAttrib.brush, markerStyleAttrib.path, 0f, true, circularFill);
                     }
                     if (base.BorderWidth > 0 && markerStyleAttrib.path != null && base.BorderStyle != 0)
                     {
                         g.DrawPath(pen, markerStyleAttrib.path);
                     }
                 }
                 catch (Exception)
                 {
                     markerStyleAttrib.Dispose();
                 }
                 if (markerStyleAttrib.path != null)
                 {
                     this.AddHotRegion(markerStyleAttrib.path, true);
                 }
             }
             this.SetAllHotRegions(g);
             g.EndHotRegion();
             this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name));
         }
     }
 }