using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace DNSD_Controls
{
	
	/// <summary>
	/// 参考坐标轴的转换器
	/// </summary>
	// Token: 0x02000026 RID: 38
	public class ReferenceAxisConverter : TypeConverter
	{
		/// <inheritdoc />
		// Token: 0x060003C9 RID: 969 RVA: 0x000297D0 File Offset: 0x000279D0
		public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
		{
			return TypeDescriptor.GetProperties(value, attributes);
		}

		/// <inheritdoc />
		// Token: 0x060003CA RID: 970 RVA: 0x000297EC File Offset: 0x000279EC
		public override bool GetPropertiesSupported(ITypeDescriptorContext context)
		{
			return true;
		}
	}
	
   /// <summary>
	/// 参考坐标系的轴信息
	/// </summary>
	// Token: 0x02000025 RID: 37
	[TypeConverter(typeof(ReferenceAxisConverter))]
	public class ReferenceAxis
	{
		/// <summary>
		/// 实例化一个默认的对象
		/// </summary>
		// Token: 0x060003B2 RID: 946 RVA: 0x0002952C File Offset: 0x0002772C
		public ReferenceAxis()
		{
			this.Max = 100f;
			this.Min = 0f;
			this.Color = Color.LightGray;
			this.Format = "{0}";
		}

		/// <summary>
		/// 实例化一个默认的对象
		/// </summary>
		// Token: 0x060003B3 RID: 947 RVA: 0x00029566 File Offset: 0x00027766
		public ReferenceAxis(UserControl userControl) : this()
		{
			this._control = userControl;
		}

		// Token: 0x060003B4 RID: 948 RVA: 0x00029577 File Offset: 0x00027777
		public ReferenceAxis(float max, float min, bool useLog)
		{
			this.Max = max;
			this.Min = min;
			this.useLogarithms = useLog;
		}

		/// <summary>
		/// 最大值
		/// </summary>
		// Token: 0x1700011F RID: 287
		// (get) Token: 0x060003B5 RID: 949 RVA: 0x00029598 File Offset: 0x00027798
		// (set) Token: 0x060003B6 RID: 950 RVA: 0x000295A0 File Offset: 0x000277A0
		[Category("HslControls")]
		[Description("获取或设置当前的Y轴的最大值")]
		[Browsable(true)]
		[DefaultValue(100f)]
		public float Max
		{
			get
			{
				return this._max;
			}
			set
			{
				this._max = value;
				UserControl control = this._control;
				if (control != null)
				{
					control.Invalidate();
				}
			}
		}

		/// <summary>
		/// 最小值
		/// </summary>
		// Token: 0x17000120 RID: 288
		// (get) Token: 0x060003B7 RID: 951 RVA: 0x000295BC File Offset: 0x000277BC
		// (set) Token: 0x060003B8 RID: 952 RVA: 0x000295C4 File Offset: 0x000277C4
		[Category("HslControls")]
		[Description("获取或设置当前的Y轴的最小值")]
		[Browsable(true)]
		[DefaultValue(0f)]
		public float Min
		{
			get
			{
				return this._min;
			}
			set
			{
				this._min = value;
				UserControl control = this._control;
				if (control != null)
				{
					control.Invalidate();
				}
			}
		}

		/// <summary>
		/// 单位信息
		/// </summary>
		// Token: 0x17000121 RID: 289
		// (get) Token: 0x060003B9 RID: 953 RVA: 0x000295E0 File Offset: 0x000277E0
		// (set) Token: 0x060003BA RID: 954 RVA: 0x000295E8 File Offset: 0x000277E8
		[Category("HslControls")]
		[Description("获取或设置当前的Y轴的单位值")]
		[Browsable(true)]
		[DefaultValue("")]
		public string Unit
		{
			get
			{
				return this._unit;
			}
			set
			{
				this._unit = value;
				UserControl control = this._control;
				if (control != null)
				{
					control.Invalidate();
				}
			}
		}

		// Token: 0x17000122 RID: 290
		// (get) Token: 0x060003BB RID: 955 RVA: 0x00029604 File Offset: 0x00027804
		// (set) Token: 0x060003BC RID: 956 RVA: 0x0002960C File Offset: 0x0002780C
		[Category("HslControls")]
		[Description("是否使用对数的表示方式，在开始对数的模式下，无法表示小于等于0的数值，对数以10为底数")]
		[Browsable(true)]
		[DefaultValue(false)]
		public bool UseLogarithms
		{
			get
			{
				return this.useLogarithms;
			}
			set
			{
				this.useLogarithms = value;
				UserControl control = this._control;
				if (control != null)
				{
					control.Invalidate();
				}
			}
		}

		/// <summary>
		/// 获取或设置当前的坐标系的颜色信息
		/// </summary>
		// Token: 0x17000123 RID: 291
		// (get) Token: 0x060003BD RID: 957 RVA: 0x00029628 File Offset: 0x00027828
		// (set) Token: 0x060003BE RID: 958 RVA: 0x00029630 File Offset: 0x00027830
		[Category("HslControls")]
		[Description("获取或设置当前的坐标系的颜色信息")]
		[Browsable(true)]
		[DefaultValue(typeof(Color), "LightGray")]
		public Color Color
		{
			get
			{
				return this._color;
			}
			set
			{
				this._color = value;
				Brush brush = this.Brush;
				if (brush != null)
				{
					brush.Dispose();
				}
				this.Brush = new SolidBrush(this._color);
				Pen pen = this._pen;
				if (pen != null)
				{
					pen.Dispose();
				}
				this._pen = new Pen(this._color, 1f);
				UserControl control = this._control;
				if (control != null)
				{
					control.Invalidate();
				}
			}
		}

		/// <summary>
		/// 获取或设置当前坐标轴数字的格式化信息，默认为 {0}, 直接转字符串
		/// </summary>
		// Token: 0x17000124 RID: 292
		// (get) Token: 0x060003BF RID: 959 RVA: 0x000296A3 File Offset: 0x000278A3
		// (set) Token: 0x060003C0 RID: 960 RVA: 0x000296AB File Offset: 0x000278AB
		[Category("HslControls")]
		[Description("获取或设置当前坐标轴数字的格式化信息，默认为 {0}, 直接转字符串")]
		[Browsable(true)]
		[DefaultValue("{0}")]
		public string Format
		{
			get
			{
				return this._format;
			}
			set
			{
				this._format = value;
				UserControl control = this._control;
				if (control != null)
				{
					control.Invalidate();
				}
			}
		}

		/// <summary>
		/// 获取画笔信息
		/// </summary>
		/// <returns>画笔信息</returns>
		// Token: 0x060003C1 RID: 961 RVA: 0x000296C8 File Offset: 0x000278C8
		public Pen GetPen()
		{
			bool flag = this._pen != null;
			Pen pen;
			if (flag)
			{
				pen = this._pen;
			}
			else
			{
				this._pen = new Pen(this.Color, 1f);
				pen = this._pen;
			}
			return pen;
		}

		// Token: 0x060003C2 RID: 962 RVA: 0x0002970C File Offset: 0x0002790C
		public bool IsUseLogarithms()
		{
			return this.useLogarithms && this._max > 0f && this._min > 0f;
		}

		// Token: 0x060003C3 RID: 963 RVA: 0x00029744 File Offset: 0x00027944
		public float GetCalculateMax()
		{
			bool flag = this.IsUseLogarithms();
			float result;
			if (flag)
			{
				result = (float)Math.Log10((double)this.Max);
			}
			else
			{
				result = this.Max;
			}
			return result;
		}

		// Token: 0x060003C4 RID: 964 RVA: 0x00029778 File Offset: 0x00027978
		public float GetCalculateMin()
		{
			bool flag = this.IsUseLogarithms();
			float result;
			if (flag)
			{
				result = (float)Math.Log10((double)this.Min);
			}
			else
			{
				result = this.Min;
			}
			return result;
		}

		// Token: 0x060003C5 RID: 965 RVA: 0x000297AB File Offset: 0x000279AB
		public void SetMaxValue(float value)
		{
			this._max = value;
		}

		// Token: 0x060003C6 RID: 966 RVA: 0x000297B5 File Offset: 0x000279B5
		public void SetMinValue(float value)
		{
			this._min = value;
		}

		/// <summary>
		/// 画刷资源
		/// </summary>
		// Token: 0x17000125 RID: 293
		// (get) Token: 0x060003C7 RID: 967 RVA: 0x000297BF File Offset: 0x000279BF
		// (set) Token: 0x060003C8 RID: 968 RVA: 0x000297C7 File Offset: 0x000279C7
		[Browsable(false)]
		public Brush Brush { get; set; }

		// Token: 0x040001CC RID: 460
		private float _max;

		// Token: 0x040001CD RID: 461
		private float _min;

		// Token: 0x040001CE RID: 462
		private string _unit;

		// Token: 0x040001CF RID: 463
		private string _format;

		// Token: 0x040001D0 RID: 464
		private Color _color;

		// Token: 0x040001D1 RID: 465
		private UserControl _control;

		// Token: 0x040001D2 RID: 466
		private Pen _pen;

		// Token: 0x040001D3 RID: 467
		private bool useLogarithms;
	}
}