You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Controls/Mesnac.Controls.ChemicalWei.../HslCurve/HslCurve.cs

1957 lines
86 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Windows.Forms;
namespace Mesnac.Controls.ChemicalWeighing.HslCurve
{
/// <summary>
/// 曲线控件信息,可以用于显示一些实时的曲线信息,同时支持对曲线控件的一些简单的交互
/// </summary>
// Token: 0x02000014 RID: 20
[Description("实时曲线控件,主要用来显示实时的曲线信息,不支持光标移动显示数据信息,支持简单的交互,显示隐藏曲线")]
public class HslCurve : UserControl
{
/// <summary>
/// 实例化一个曲线显示的控件
/// </summary>
// Token: 0x060001FE RID: 510 RVA: 0x0001E290 File Offset: 0x0001C490
public HslCurve()
{
this.InitializeComponent();
this.random = new Random();
this.data_list = new Dictionary<string, HslCurveItem>();
this.auxiliary_lines = new List<AuxiliaryLine>();
this.hslMarkTexts = new List<HslMarkText>();
this.auxiliary_Labels = new List<AuxiliaryLable>();
this.format_left = new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Near
};
this.format_right = new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Far
};
this.format_center = new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = StringAlignment.Center
};
this.font_size9 = new Font("微软雅黑", 9f);
this.InitializationColor();
this.pen_dash = new Pen(this.color_deep);
this.pen_dash.DashStyle = DashStyle.Custom;
this.pen_dash.DashPattern = new float[]
{
5f,
5f
};
this.referenceAxisLeft = new ReferenceAxis(this);
this.referenceAxisRight = new ReferenceAxis(this);
this.referenceAxisLeft.Color = Color.DimGray;
this.referenceAxisRight.Color = Color.DimGray;
base.SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
base.SetStyle(ControlStyles.ResizeRedraw, true);
base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
}
/// <summary>
/// 获取或设置控件的背景色
/// </summary>
// Token: 0x170000AA RID: 170
// (get) Token: 0x060001FF RID: 511 RVA: 0x0001E4E3 File Offset: 0x0001C6E3
// (set) Token: 0x06000200 RID: 512 RVA: 0x0001E4EB File Offset: 0x0001C6EB
[Browsable(true)]
[Description("获取或设置控件的背景色")]
[Category("HslControls")]
[DefaultValue(typeof(Color), "Transparent")]
[EditorBrowsable(EditorBrowsableState.Always)]
public override Color BackColor
{
get
{
return base.BackColor;
}
set
{
base.BackColor = value;
}
}
/// <summary>
/// 获取或设置图形的左轴的坐标轴信息
/// </summary>
// Token: 0x170000AB RID: 171
// (get) Token: 0x06000201 RID: 513 RVA: 0x0001E4F5 File Offset: 0x0001C6F5
[Category("HslControls")]
[Description("获取或设置图形的左轴的坐标轴信息")]
[Browsable(true)]
[TypeConverter(typeof(ReferenceAxisConverter))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ReferenceAxis ReferenceAxisLeft
{
get
{
return this.referenceAxisLeft;
}
}
/// <summary>
/// 获取或设置图形的右轴的坐标轴信息
/// </summary>
// Token: 0x170000AC RID: 172
// (get) Token: 0x06000202 RID: 514 RVA: 0x0001E4FD File Offset: 0x0001C6FD
[Category("HslControls")]
[Description("获取或设置图形的右轴的坐标轴信息")]
[Browsable(true)]
[TypeConverter(typeof(ReferenceAxisConverter))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ReferenceAxis ReferenceAxisRight
{
get
{
return this.referenceAxisRight;
}
}
/// <summary>
/// 获取或设置图形的纵轴分段数
/// </summary>
// Token: 0x170000AD RID: 173
// (get) Token: 0x06000203 RID: 515 RVA: 0x0001E508 File Offset: 0x0001C708
// (set) Token: 0x06000204 RID: 516 RVA: 0x0001E520 File Offset: 0x0001C720
[Category("HslControls")]
[Description("获取或设置图形的纵轴分段数")]
[Browsable(true)]
[DefaultValue(5)]
public virtual int ValueSegment
{
get
{
return this.value_Segment;
}
set
{
this.value_Segment = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置所有的数据是否强制在一个界面里显示
/// </summary>
// Token: 0x170000AE RID: 174
// (get) Token: 0x06000205 RID: 517 RVA: 0x0001E534 File Offset: 0x0001C734
// (set) Token: 0x06000206 RID: 518 RVA: 0x0001E54C File Offset: 0x0001C74C
[Category("HslControls")]
[Description("获取或设置所有的数据是否强制在一个界面里显示")]
[Browsable(true)]
[DefaultValue(false)]
public virtual bool IsAbscissaStrech
{
get
{
return this.value_IsAbscissaStrech;
}
set
{
this.value_IsAbscissaStrech = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置拉伸模式下的最大数据量
/// </summary>
// Token: 0x170000AF RID: 175
// (get) Token: 0x06000207 RID: 519 RVA: 0x0001E560 File Offset: 0x0001C760
// (set) Token: 0x06000208 RID: 520 RVA: 0x0001E578 File Offset: 0x0001C778
[Category("HslControls")]
[Description("获取或设置拉伸模式下的最大数据量")]
[Browsable(true)]
[DefaultValue(300)]
public virtual int StrechDataCountMax
{
get
{
return this.value_StrechDataCountMax;
}
set
{
this.value_StrechDataCountMax = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置虚线是否进行显示
/// </summary>
// Token: 0x170000B0 RID: 176
// (get) Token: 0x06000209 RID: 521 RVA: 0x0001E58C File Offset: 0x0001C78C
// (set) Token: 0x0600020A RID: 522 RVA: 0x0001E5A4 File Offset: 0x0001C7A4
[Category("HslControls")]
[Description("获取或设置虚线是否进行显示")]
[Browsable(true)]
[DefaultValue(true)]
public virtual bool IsRenderDashLine
{
get
{
return this.value_IsRenderDashLine;
}
set
{
this.value_IsRenderDashLine = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置坐标轴及相关信息文本的颜色
/// </summary>
// Token: 0x170000B1 RID: 177
// (get) Token: 0x0600020B RID: 523 RVA: 0x0001E5B8 File Offset: 0x0001C7B8
// (set) Token: 0x0600020C RID: 524 RVA: 0x0001E5D0 File Offset: 0x0001C7D0
[Category("HslControls")]
[Description("获取或设置坐标轴及相关信息文本的颜色")]
[Browsable(true)]
[DefaultValue(typeof(Color), "DimGray")]
public virtual Color ColorLinesAndText
{
get
{
return this.color_deep;
}
set
{
this.color_deep = value;
this.InitializationColor();
base.Invalidate();
}
}
/// <summary>
/// 获取或设置虚线的颜色
/// </summary>
// Token: 0x170000B2 RID: 178
// (get) Token: 0x0600020D RID: 525 RVA: 0x0001E5E8 File Offset: 0x0001C7E8
// (set) Token: 0x0600020E RID: 526 RVA: 0x0001E600 File Offset: 0x0001C800
[Category("HslControls")]
[Description("获取或设置虚线的颜色")]
[Browsable(true)]
[DefaultValue(typeof(Color), "Gray")]
public virtual Color ColorDashLines
{
get
{
return this.color_dash;
}
set
{
this.color_dash = value;
Pen pen = this.pen_dash;
if (pen != null)
{
pen.Dispose();
}
this.pen_dash = new Pen(this.color_dash);
this.pen_dash.DashStyle = DashStyle.Custom;
this.pen_dash.DashPattern = new float[]
{
5f,
5f
};
base.Invalidate();
}
}
/// <summary>
/// 获取或设置纵向虚线的分隔情况,单位为多少个数据
/// </summary>
// Token: 0x170000B3 RID: 179
// (get) Token: 0x0600020F RID: 527 RVA: 0x0001E670 File Offset: 0x0001C870
// (set) Token: 0x06000210 RID: 528 RVA: 0x0001E688 File Offset: 0x0001C888
[Category("HslControls")]
[Description("获取或设置纵向虚线的分隔情况,单位为多少个数据")]
[Browsable(true)]
[DefaultValue(100)]
public virtual int IntervalAbscissaText
{
get
{
return this.value_IntervalAbscissaText;
}
set
{
this.value_IntervalAbscissaText = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置实时数据新增时文本相对应于时间的格式化字符串默认HH:mm
/// </summary>
// Token: 0x170000B4 RID: 180
// (get) Token: 0x06000211 RID: 529 RVA: 0x0001E69C File Offset: 0x0001C89C
// (set) Token: 0x06000212 RID: 530 RVA: 0x0001E6B4 File Offset: 0x0001C8B4
[Category("HslControls")]
[Description("获取或设置实时数据新增时文本相对应于时间的格式化字符串默认HH:mm")]
[Browsable(true)]
[DefaultValue("HH:mm")]
public virtual string TextAddFormat
{
get
{
return this.textFormat;
}
set
{
this.textFormat = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置图标的标题信息
/// </summary>
// Token: 0x170000B5 RID: 181
// (get) Token: 0x06000213 RID: 531 RVA: 0x0001E6C8 File Offset: 0x0001C8C8
// (set) Token: 0x06000214 RID: 532 RVA: 0x0001E6E0 File Offset: 0x0001C8E0
[Category("HslControls")]
[Description("获取或设置图标的标题信息")]
[Browsable(true)]
[DefaultValue("")]
public virtual string Title
{
get
{
return this.value_title;
}
set
{
this.value_title = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置是否显示右侧的坐标系信息
/// </summary>
// Token: 0x170000B6 RID: 182
// (get) Token: 0x06000215 RID: 533 RVA: 0x0001E6F4 File Offset: 0x0001C8F4
// (set) Token: 0x06000216 RID: 534 RVA: 0x0001E70C File Offset: 0x0001C90C
[Category("HslControls")]
[Description("获取或设置是否显示右侧的坐标系信息")]
[Browsable(true)]
[DefaultValue(true)]
public virtual bool IsRenderRightCoordinate
{
get
{
return this.isRenderRightCoordinate;
}
set
{
this.isRenderRightCoordinate = value;
base.Invalidate();
}
}
// Token: 0x06000217 RID: 535 RVA: 0x0001E720 File Offset: 0x0001C920
private void InitializationColor()
{
Pen pen = this.pen_normal;
if (pen != null)
{
pen.Dispose();
}
Brush brush = this.brush_deep;
if (brush != null)
{
brush.Dispose();
}
this.pen_normal = new Pen(this.color_deep);
this.brush_deep = new SolidBrush(this.color_deep);
}
/// <summary>
/// 获取或设置曲线名称的布局宽度默认为100
/// </summary>
// Token: 0x170000B7 RID: 183
// (get) Token: 0x06000218 RID: 536 RVA: 0x0001E774 File Offset: 0x0001C974
// (set) Token: 0x06000219 RID: 537 RVA: 0x0001E77C File Offset: 0x0001C97C
[Browsable(true)]
[Description("获取或设置曲线名称的布局宽度默认为100")]
[Category("HslControls")]
[DefaultValue(100)]
public virtual int CurveNameWidth
{
get
{
return this.curveNameWidth;
}
set
{
bool flag = value > 10;
if (flag)
{
this.curveNameWidth = value;
}
}
}
/// <summary>
/// 获取或设置所有的数据点显示的半径大小默认是0不显示数据点
/// </summary>
// Token: 0x170000B8 RID: 184
// (get) Token: 0x0600021A RID: 538 RVA: 0x0001E79C File Offset: 0x0001C99C
// (set) Token: 0x0600021B RID: 539 RVA: 0x0001E7A4 File Offset: 0x0001C9A4
[Browsable(true)]
[Description("获取或设置所有的数据点显示的半径大小默认是0不显示数据点")]
[Category("HslControls")]
[DefaultValue(0)]
public virtual int PointsRadius
{
get
{
return this.pointsRadius;
}
set
{
this.pointsRadius = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置Y轴刻度文本的字体信息
/// </summary>
// Token: 0x170000B9 RID: 185
// (get) Token: 0x0600021D RID: 541 RVA: 0x0001E7C8 File Offset: 0x0001C9C8
// (set) Token: 0x0600021C RID: 540 RVA: 0x0001E7B5 File Offset: 0x0001C9B5
[Browsable(true)]
[Description("获取或设置Y轴刻度文本的字体信息")]
[Category("HslControls")]
public virtual Font FontCalibration
{
get
{
return this.font_size9;
}
set
{
this.font_size9 = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置左右两侧的坐标轴的宽度,以像素为单位
/// </summary>
// Token: 0x170000BA RID: 186
// (get) Token: 0x0600021E RID: 542 RVA: 0x0001E7E0 File Offset: 0x0001C9E0
// (set) Token: 0x0600021F RID: 543 RVA: 0x0001E7F8 File Offset: 0x0001C9F8
[Browsable(true)]
[Description("获取或设置左右两侧的坐标轴的宽度,以像素为单位")]
[Category("HslControls")]
[DefaultValue(50)]
public int LeftRightWidth
{
get
{
return this.leftRight;
}
set
{
this.leftRight = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置上下两侧的空白的宽度,以像素为单位
/// </summary>
// Token: 0x170000BB RID: 187
// (get) Token: 0x06000220 RID: 544 RVA: 0x0001E80C File Offset: 0x0001CA0C
// (set) Token: 0x06000221 RID: 545 RVA: 0x0001E824 File Offset: 0x0001CA24
[Browsable(true)]
[Description("获取或设置上下两侧的空白的宽度,以像素为单位")]
[Category("HslControls")]
[DefaultValue(25)]
public int UpDownHeight
{
get
{
return this.upDown;
}
set
{
this.upDown = value;
base.Invalidate();
}
}
/// <summary>
/// 设置曲线的横坐标文本,适用于显示一些固定的曲线信息
/// </summary>
/// <param name="descriptions">应该和曲线的点数一致</param>
// Token: 0x06000222 RID: 546 RVA: 0x0001E835 File Offset: 0x0001CA35
public void SetCurveText(string[] descriptions)
{
this.data_text = descriptions;
base.Invalidate();
}
/// <summary>
/// 新增或修改一条指定关键字的左参考系曲线数据需要指定数据颜色随机没有数据上限线条宽度为1
/// </summary>
/// <param name="key">曲线关键字</param>
/// <param name="data">曲线的具体数据</param>
// Token: 0x06000223 RID: 547 RVA: 0x0001E848 File Offset: 0x0001CA48
public void SetLeftCurve(string key, float[] data)
{
this.SetLeftCurve(key, data, Color.FromArgb(this.random.Next(256), this.random.Next(256), this.random.Next(256)));
}
/// <summary>
/// 新增或修改一条指定关键字的左参考系曲线数据需要指定数据颜色没有数据上限线条宽度为1
/// </summary>
/// <param name="key">曲线关键字</param>
/// <param name="data">数据内容</param>
/// <param name="lineColor">曲线颜色</param>
// Token: 0x06000224 RID: 548 RVA: 0x0001E894 File Offset: 0x0001CA94
public void SetLeftCurve(string key, float[] data, Color lineColor)
{
this.SetCurve(key, 0, data, lineColor, 1f, CurveStyle.LineSegment);
}
/// <summary>
/// 新增或修改一条指定关键字的左参考系曲线数据需要指定数据颜色没有数据上限线条宽度为1
/// </summary>
/// <param name="key">曲线关键字</param>
/// <param name="data">数据内容</param>
/// <param name="lineColor">曲线颜色</param>
/// <param name="style">曲线的样式</param>
// Token: 0x06000225 RID: 549 RVA: 0x0001E8A8 File Offset: 0x0001CAA8
public void SetLeftCurve(string key, float[] data, Color lineColor, CurveStyle style)
{
this.SetCurve(key, 0, data, lineColor, 1f, style);
}
/// <summary>
/// 新增或修改一条指定关键字的右参考系曲线数据需要指定数据颜色随机没有数据上限线条宽度为1
/// </summary>
/// <param name="key">曲线关键字</param>
/// <param name="data">数据内容</param>
// Token: 0x06000226 RID: 550 RVA: 0x0001E8C0 File Offset: 0x0001CAC0
public void SetRightCurve(string key, float[] data)
{
this.SetRightCurve(key, data, Color.FromArgb(this.random.Next(256), this.random.Next(256), this.random.Next(256)));
}
/// <summary>
/// 新增或修改一条指定关键字的右参考系曲线数据需要指定数据颜色没有数据上限线条宽度为1
/// </summary>
/// <param name="key">曲线关键字</param>
/// <param name="data">数据内容</param>
/// <param name="lineColor">曲线颜色</param>
// Token: 0x06000227 RID: 551 RVA: 0x0001E90C File Offset: 0x0001CB0C
public void SetRightCurve(string key, float[] data, Color lineColor)
{
this.SetCurve(key, 1, data, lineColor, 1f, CurveStyle.LineSegment);
}
/// <summary>
/// 新增或修改一条指定关键字的右参考系曲线数据需要指定数据颜色没有数据上限线条宽度为1
/// </summary>
/// <param name="key">曲线关键字</param>
/// <param name="data">数据内容</param>
/// <param name="lineColor">曲线颜色</param>
/// <param name="style">曲线的样式</param>
// Token: 0x06000228 RID: 552 RVA: 0x0001E920 File Offset: 0x0001CB20
public void SetRightCurve(string key, float[] data, Color lineColor, CurveStyle style)
{
this.SetCurve(key, 1, data, lineColor, 1f, style);
}
/// <summary>
/// 新增或修改一条指定关键字的曲线数据,需要指定参考系及数据,颜色,线条宽度
/// </summary>
/// <param name="key">曲线关键字</param>
/// <param name="referenceAxis">是否以左侧坐标轴为参照系</param>
/// <param name="data">数据</param>
/// <param name="lineColor">线条颜色</param>
/// <param name="thickness">线条宽度</param>
/// <param name="style">曲线的样式</param>
// Token: 0x06000229 RID: 553 RVA: 0x0001E938 File Offset: 0x0001CB38
public void SetCurve(string key, int referenceAxis, float[] data, Color lineColor, float thickness, CurveStyle style)
{
bool flag = this.data_list.ContainsKey(key);
if (flag)
{
bool flag2 = data == null;
if (flag2)
{
data = new float[0];
}
this.data_list[key].Data = data;
bool flag3 = this.data_text != null && this.data_text.Length != data.Length;
if (flag3)
{
this.data_text = new string[data.Length];
}
}
else
{
bool flag4 = data == null;
if (flag4)
{
data = new float[0];
}
this.data_list.Add(key, new HslCurveItem
{
Data = data,
MarkText = new string[data.Length],
LineThickness = thickness,
LineColor = lineColor,
ReferenceAxisIndex = referenceAxis,
Style = style
});
bool flag5 = this.data_text == null || this.data_text.Length != data.Length;
if (flag5)
{
this.data_text = new string[data.Length];
}
}
base.Invalidate();
}
/// <summary>
/// 移除指定关键字的曲线
/// </summary>
/// <param name="key">曲线关键字</param>
// Token: 0x0600022A RID: 554 RVA: 0x0001EA48 File Offset: 0x0001CC48
public void RemoveCurve(string key)
{
bool flag = this.data_list.ContainsKey(key);
if (flag)
{
this.data_list.Remove(key);
}
bool flag2 = this.data_list.Count == 0;
if (flag2)
{
this.data_text = new string[0];
}
base.Invalidate();
}
/// <summary>
/// 移除所有的曲线
/// </summary>
// Token: 0x0600022B RID: 555 RVA: 0x0001EA9C File Offset: 0x0001CC9C
public void RemoveAllCurve()
{
int count = this.data_list.Count;
this.data_list.Clear();
bool flag = this.data_list.Count == 0;
if (flag)
{
this.data_text = new string[0];
}
bool flag2 = count > 0;
if (flag2)
{
base.Invalidate();
}
}
/// <summary>
/// 移除所有曲线的数据
/// </summary>
// Token: 0x0600022C RID: 556 RVA: 0x0001EAF4 File Offset: 0x0001CCF4
public void RemoveAllCurveData()
{
int count = this.data_list.Count;
foreach (KeyValuePair<string, HslCurveItem> keyValuePair in this.data_list)
{
keyValuePair.Value.Data = new float[0];
keyValuePair.Value.MarkText = new string[0];
}
this.data_text = new string[0];
bool flag = count > 0;
if (flag)
{
base.Invalidate();
}
}
/// <summary>
/// 获取曲线图中已经存在的曲线对象,用于动态修改一些复杂的数据信息,如线宽,标记点,修改以前的数据内容等等
/// </summary>
/// <param name="key">关键字</param>
/// <returns>曲线对象信息</returns>
// Token: 0x0600022D RID: 557 RVA: 0x0001EB90 File Offset: 0x0001CD90
public HslCurveItem GetCurveItem(string key)
{
bool flag = this.data_list.ContainsKey(key);
HslCurveItem result;
if (flag)
{
result = this.data_list[key];
}
else
{
result = null;
}
return result;
}
/// <summary>
/// 将当前的图形曲线保存为图片内容,可用于存储本地的文件,或是打印到纸张,默认大小为控件的大小
/// </summary>
/// <returns>图片内容</returns>
// Token: 0x0600022E RID: 558 RVA: 0x0001EBC4 File Offset: 0x0001CDC4
public Bitmap SaveToBitmap()
{
return this.SaveToBitmap(base.Width, base.Height);
}
/// <summary>
/// 将当前的图形曲线保存为图片内容,可用于存储本地的文件,或是打印到纸张,使用指定的大小,显示的曲线可能和控件上的不一致
/// </summary>
/// <returns>图片内容</returns>
// Token: 0x0600022F RID: 559 RVA: 0x0001EBE8 File Offset: 0x0001CDE8
public Bitmap SaveToBitmap(int width, int height)
{
Bitmap bitmap = new Bitmap(width, height);
Graphics graphics = Graphics.FromImage(bitmap);
this.OnPaint(new PaintEventArgs(graphics, new Rectangle(0, 0, width, height)));
return bitmap;
}
/// <summary>
/// 新增指定关键字曲线的一个数据,注意该关键字的曲线必须存在,否则无效
/// </summary>
/// <param name="key">新增曲线的关键字</param>
/// <param name="values">数据值</param>
/// <param name="markTexts">标记的文本信息</param>
/// <param name="isUpdateUI">是否刷新界面</param>
// Token: 0x06000230 RID: 560 RVA: 0x0001EC20 File Offset: 0x0001CE20
private void AddCurveData(string key, float[] values, string[] markTexts, bool isUpdateUI)
{
bool flag = values != null && values.Length < 1;
if (!flag)
{
bool flag2 = this.data_list.ContainsKey(key);
if (flag2)
{
HslCurveItem hslCurveItem = this.data_list[key];
bool flag3 = hslCurveItem.Data != null;
if (flag3)
{
bool flag4 = this.value_IsAbscissaStrech;
if (flag4)
{
HslHelper.AddArrayData<float>(ref hslCurveItem.Data, values, this.value_StrechDataCountMax);
HslHelper.AddArrayData<string>(ref hslCurveItem.MarkText, markTexts, this.value_StrechDataCountMax);
}
else
{
HslHelper.AddArrayData<float>(ref hslCurveItem.Data, values, 4096);
HslHelper.AddArrayData<string>(ref hslCurveItem.MarkText, markTexts, 4096);
}
if (isUpdateUI)
{
base.Invalidate();
}
}
}
}
}
// Token: 0x06000231 RID: 561 RVA: 0x0001ECE0 File Offset: 0x0001CEE0
private void AddCurveTime(int count)
{
this.AddCurveTime(count, DateTime.Now.ToString(this.textFormat));
}
// Token: 0x06000232 RID: 562 RVA: 0x0001ED0C File Offset: 0x0001CF0C
private void AddCurveTime(int count, string text)
{
bool flag = this.data_text == null;
if (!flag)
{
string[] array = new string[count];
for (int i = 0; i < array.Length; i++)
{
array[i] = text;
}
bool flag2 = this.value_IsAbscissaStrech;
if (flag2)
{
HslHelper.AddArrayData<string>(ref this.data_text, array, this.value_StrechDataCountMax);
}
else
{
HslHelper.AddArrayData<string>(ref this.data_text, array, 4096);
}
}
}
/// <summary>
/// 新增指定关键字曲线的一个数据,注意该关键字的曲线必须存在,否则无效
/// </summary>
/// <param name="key">曲线的关键字</param>
/// <param name="value">数据值</param>
// Token: 0x06000233 RID: 563 RVA: 0x0001ED7F File Offset: 0x0001CF7F
public void AddCurveData(string key, float value)
{
this.AddCurveData(key, new float[]
{
value
});
}
/// <summary>
/// 新增指定关键字曲线的一个数据,注意该关键字的曲线必须存在,否则无效
/// </summary>
/// <param name="key">曲线的关键字</param>
/// <param name="value">数据值</param>
/// <param name="markText">标记的本文信息</param>
// Token: 0x06000234 RID: 564 RVA: 0x0001ED94 File Offset: 0x0001CF94
public void AddCurveData(string key, float value, string markText)
{
this.AddCurveData(key, new float[]
{
value
}, new string[]
{
markText
});
}
/// <summary>
/// 新增指定关键字曲线的一组数据,注意该关键字的曲线必须存在,否则无效
/// </summary>
/// <param name="key">曲线的关键字</param>
/// <param name="values">数组值</param>
// Token: 0x06000235 RID: 565 RVA: 0x0001EDB3 File Offset: 0x0001CFB3
public void AddCurveData(string key, float[] values)
{
this.AddCurveData(key, values, null);
}
/// <summary>
/// 新增指定关键字曲线的一组数据,注意该关键字的曲线必须存在,否则无效
/// </summary>
/// <param name="key">曲线的关键字</param>
/// <param name="values">数组值</param>
/// <param name="markTexts">标记的本文信息</param>
// Token: 0x06000236 RID: 566 RVA: 0x0001EDC0 File Offset: 0x0001CFC0
public void AddCurveData(string key, float[] values, string[] markTexts)
{
bool flag = markTexts == null;
if (flag)
{
markTexts = new string[values.Length];
}
this.AddCurveData(key, values, markTexts, false);
bool flag2 = values != null && values.Length != 0;
if (flag2)
{
this.AddCurveTime(values.Length);
}
base.Invalidate();
}
/// <summary>
/// 新增指定关键字数组曲线的一组数据,注意该关键字的曲线必须存在,否则无效,一个数据对应一个数组
/// </summary>
/// <param name="keys">曲线的关键字数组</param>
/// <param name="values">数组值</param>
// Token: 0x06000237 RID: 567 RVA: 0x0001EE0D File Offset: 0x0001D00D
public void AddCurveData(string[] keys, float[] values)
{
this.AddCurveData(keys, values, null);
}
/// <summary>
/// 新增指定关键字数组曲线的一组数据,注意该关键字的曲线必须存在,否则无效,一个数据对应一个数组
/// </summary>
/// <param name="axisText">自定义的横轴坐标数据</param>
/// <param name="keys">曲线的关键字数组</param>
/// <param name="values">数组值</param>
// Token: 0x06000238 RID: 568 RVA: 0x0001EE1A File Offset: 0x0001D01A
public void AddCurveData(string axisText, string[] keys, float[] values)
{
this.AddCurveData(axisText, keys, values, null);
}
/// <summary>
/// 新增指定关键字数组曲线的一组数据,注意该关键字的曲线必须存在,否则无效,一个数据对应一个数组
/// </summary>
/// <param name="keys">曲线的关键字数组</param>
/// <param name="values">数组值</param>
/// <param name="markTexts">标记的文本信息</param>
// Token: 0x06000239 RID: 569 RVA: 0x0001EE28 File Offset: 0x0001D028
public void AddCurveData(string[] keys, float[] values, string[] markTexts)
{
bool flag = keys == null;
if (flag)
{
throw new ArgumentNullException("keys");
}
bool flag2 = values == null;
if (flag2)
{
throw new ArgumentNullException("values");
}
bool flag3 = markTexts == null;
if (flag3)
{
markTexts = new string[keys.Length];
}
bool flag4 = keys.Length != values.Length;
if (flag4)
{
throw new Exception("两个参数的数组长度不一致。");
}
bool flag5 = keys.Length != markTexts.Length;
if (flag5)
{
throw new Exception("两个参数的数组长度不一致。");
}
for (int i = 0; i < keys.Length; i++)
{
this.AddCurveData(keys[i], new float[]
{
values[i]
}, new string[]
{
markTexts[i]
}, false);
}
this.AddCurveTime(1);
base.Invalidate();
}
/// <summary>
/// 新增指定关键字数组曲线的一组数据,注意该关键字的曲线必须存在,否则无效,一个数据对应一个数组
/// </summary>
/// <param name="axisText">自定义的横轴坐标数据</param>
/// <param name="keys">曲线的关键字数组</param>
/// <param name="values">数组值</param>
/// <param name="markTexts">标记的文本信息</param>
// Token: 0x0600023A RID: 570 RVA: 0x0001EEF4 File Offset: 0x0001D0F4
public void AddCurveData(string axisText, string[] keys, float[] values, string[] markTexts)
{
bool flag = keys == null;
if (flag)
{
throw new ArgumentNullException("keys");
}
bool flag2 = values == null;
if (flag2)
{
throw new ArgumentNullException("values");
}
bool flag3 = markTexts == null;
if (flag3)
{
markTexts = new string[keys.Length];
}
bool flag4 = keys.Length != values.Length;
if (flag4)
{
throw new Exception("两个参数的数组长度不一致。");
}
bool flag5 = keys.Length != markTexts.Length;
if (flag5)
{
throw new Exception("两个参数的数组长度不一致。");
}
for (int i = 0; i < keys.Length; i++)
{
this.AddCurveData(keys[i], new float[]
{
values[i]
}, new string[]
{
markTexts[i]
}, false);
}
this.AddCurveTime(1, axisText);
base.Invalidate();
}
/// <summary>
/// 设置一条曲线是否是可见的,如果该曲线不存在,则无效。
/// </summary>
/// <param name="key">关键字</param>
/// <param name="visible">是否可见</param>
// Token: 0x0600023B RID: 571 RVA: 0x0001EFC4 File Offset: 0x0001D1C4
public void SetCurveVisible(string key, bool visible)
{
bool flag = this.data_list.ContainsKey(key);
if (flag)
{
HslCurveItem hslCurveItem = this.data_list[key];
hslCurveItem.Visible = visible;
base.Invalidate();
}
}
/// <summary>
/// 设置多条曲线是否是可见的,如果该曲线不存在,则无效。
/// </summary>
/// <param name="keys">关键字</param>
/// <param name="visible">是否可见</param>
// Token: 0x0600023C RID: 572 RVA: 0x0001F000 File Offset: 0x0001D200
public void SetCurveVisible(string[] keys, bool visible)
{
foreach (string key in keys)
{
bool flag = this.data_list.ContainsKey(key);
if (flag)
{
HslCurveItem hslCurveItem = this.data_list[key];
hslCurveItem.Visible = visible;
}
}
base.Invalidate();
}
/// <summary>
/// 获取当前曲线的字典信息,所有的曲线都在这里面,可以进行一些自由的控制
/// </summary>
/// <returns>包含所有曲线的词典信息</returns>
// Token: 0x0600023D RID: 573 RVA: 0x0001F055 File Offset: 0x0001D255
public Dictionary<string, HslCurveItem> GetAllCurve()
{
return this.data_list;
}
/// <summary>
/// 新增一条左侧的辅助线,使用默认的文本颜色
/// </summary>
/// <param name="value">数据值</param>
// Token: 0x0600023E RID: 574 RVA: 0x0001F060 File Offset: 0x0001D260
public AuxiliaryLine AddLeftAuxiliary(float value)
{
return this.AddLeftAuxiliary(value, this.ColorLinesAndText);
}
/// <summary>
/// 新增一条左侧的辅助线,使用指定的颜色
/// </summary>
/// <param name="value">数据值</param>
/// <param name="lineColor">线条颜色</param>
// Token: 0x0600023F RID: 575 RVA: 0x0001F080 File Offset: 0x0001D280
public AuxiliaryLine AddLeftAuxiliary(float value, Color lineColor)
{
return this.AddLeftAuxiliary(value, lineColor, 1f, true);
}
/// <summary>
/// 新增一条左侧的辅助线
/// </summary>
/// <param name="value">数据值</param>
/// <param name="lineColor">线条颜色</param>
/// <param name="lineThickness">线条宽度</param>
/// <param name="isDashLine">是否是虚线</param>
// Token: 0x06000240 RID: 576 RVA: 0x0001F0A0 File Offset: 0x0001D2A0
public AuxiliaryLine AddLeftAuxiliary(float value, Color lineColor, float lineThickness, bool isDashLine)
{
return this.AddAuxiliary(value, lineColor, lineThickness, isDashLine, true);
}
/// <summary>
/// 新增一条右侧的辅助线,使用默认的文本颜色
/// </summary>
/// <param name="value">数据值</param>
// Token: 0x06000241 RID: 577 RVA: 0x0001F0C0 File Offset: 0x0001D2C0
public AuxiliaryLine AddRightAuxiliary(float value)
{
return this.AddRightAuxiliary(value, this.ColorLinesAndText);
}
/// <summary>
/// 新增一条右侧的辅助线,使用指定的颜色
/// </summary>
/// <param name="value">数据值</param>
/// <param name="lineColor">线条颜色</param>
// Token: 0x06000242 RID: 578 RVA: 0x0001F0E0 File Offset: 0x0001D2E0
public AuxiliaryLine AddRightAuxiliary(float value, Color lineColor)
{
return this.AddRightAuxiliary(value, lineColor, 1f, true);
}
/// <summary>
/// 新增一条右侧的辅助线
/// </summary>
/// <param name="value">数据值</param>
/// <param name="lineColor">线条颜色</param>
/// <param name="lineThickness">线条宽度</param>
/// <param name="isDashLine">是否是虚线的信息</param>
// Token: 0x06000243 RID: 579 RVA: 0x0001F100 File Offset: 0x0001D300
public AuxiliaryLine AddRightAuxiliary(float value, Color lineColor, float lineThickness, bool isDashLine)
{
return this.AddAuxiliary(value, lineColor, lineThickness, isDashLine, false);
}
// Token: 0x06000244 RID: 580 RVA: 0x0001F120 File Offset: 0x0001D320
private AuxiliaryLine AddAuxiliary(float value, Color lineColor, float lineThickness, bool isDashLine, bool isLeft)
{
AuxiliaryLine auxiliaryLine = new AuxiliaryLine
{
Value = value,
LineColor = lineColor,
PenDash = new Pen(lineColor)
{
DashStyle = DashStyle.Custom,
DashPattern = new float[]
{
5f,
5f
}
},
PenSolid = new Pen(lineColor),
IsDashStyle = isDashLine,
IsLeftFrame = isLeft,
LineThickness = lineThickness,
LineTextBrush = new SolidBrush(lineColor)
};
this.auxiliary_lines.Add(auxiliaryLine);
base.Invalidate();
return auxiliaryLine;
}
/// <summary>
/// 移除所有的指定值的辅助曲线,包括左边的和右边的
/// </summary>
/// <param name="value">移除的数据值</param>
// Token: 0x06000245 RID: 581 RVA: 0x0001F1C8 File Offset: 0x0001D3C8
public void RemoveAuxiliary(float value)
{
int num = 0;
for (int i = this.auxiliary_lines.Count - 1; i >= 0; i--)
{
bool flag = this.auxiliary_lines[i].Value == value;
if (flag)
{
this.auxiliary_lines[i].Dispose();
this.auxiliary_lines.RemoveAt(i);
num++;
}
}
bool flag2 = num > 0;
if (flag2)
{
base.Invalidate();
}
}
/// <summary>
/// 移除一个指定的辅助对象
/// </summary>
/// <param name="auxiliary">移除的数据值</param>
// Token: 0x06000246 RID: 582 RVA: 0x0001F248 File Offset: 0x0001D448
public void RemoveAuxiliary(AuxiliaryLine auxiliary)
{
bool flag = this.auxiliary_lines.Remove(auxiliary);
if (flag)
{
base.Invalidate();
}
}
/// <summary>
/// 移除所有的辅助线
/// </summary>
// Token: 0x06000247 RID: 583 RVA: 0x0001F270 File Offset: 0x0001D470
public void RemoveAllAuxiliary()
{
int count = this.auxiliary_lines.Count;
this.auxiliary_lines.Clear();
bool flag = count > 0;
if (flag)
{
base.Invalidate();
}
}
/// <summary>
/// 新增一条辅助标签
/// </summary>
/// <param name="auxiliaryLable">描述的标签值</param>
// Token: 0x06000248 RID: 584 RVA: 0x0001F2A5 File Offset: 0x0001D4A5
public void AddAuxiliaryLabel(AuxiliaryLable auxiliaryLable)
{
this.auxiliary_Labels.Add(auxiliaryLable);
}
/// <summary>
/// 移除指定的辅助标签
/// </summary>
/// <param name="auxiliaryLable">等待删除的对象</param>
// Token: 0x06000249 RID: 585 RVA: 0x0001F2B8 File Offset: 0x0001D4B8
public void RemoveAuxiliaryLable(AuxiliaryLable auxiliaryLable)
{
bool flag = this.auxiliary_Labels.Remove(auxiliaryLable);
if (flag)
{
base.Invalidate();
}
}
/// <summary>
/// 移除所有的辅助标签
/// </summary>
// Token: 0x0600024A RID: 586 RVA: 0x0001F2E0 File Offset: 0x0001D4E0
public void RemoveAllAuxiliaryLable()
{
int count = this.auxiliary_Labels.Count;
this.auxiliary_Labels.Clear();
bool flag = count > 0;
if (flag)
{
base.Invalidate();
}
}
/// <summary>
/// 新增一个标记的文本信息
/// </summary>
/// <param name="markText">文本标记信息</param>
// Token: 0x0600024B RID: 587 RVA: 0x0001F318 File Offset: 0x0001D518
public void AddMarkText(HslMarkText markText)
{
this.hslMarkTexts.Add(markText);
bool flag = this.data_list.Count > 0;
if (flag)
{
base.Invalidate();
}
}
/// <summary>
/// 移除一个标记的文本信息
/// </summary>
/// <param name="markText">文本标记信息</param>
// Token: 0x0600024C RID: 588 RVA: 0x0001F350 File Offset: 0x0001D550
public void RemoveMarkText(HslMarkText markText)
{
this.hslMarkTexts.Remove(markText);
bool flag = this.data_list.Count > 0;
if (flag)
{
base.Invalidate();
}
}
/// <summary>
/// 移除所有的标记的文本信息
/// </summary>
// Token: 0x0600024D RID: 589 RVA: 0x0001F388 File Offset: 0x0001D588
public void RemoveAllMarkText()
{
this.hslMarkTexts.Clear();
bool flag = this.data_list.Count > 0;
if (flag)
{
base.Invalidate();
}
}
/// <summary>
/// 鼠标移动的信息
/// </summary>
/// <param name="e"></param>
// Token: 0x0600024E RID: 590 RVA: 0x0001F3C0 File Offset: 0x0001D5C0
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
bool flag = false;
foreach (KeyValuePair<string, HslCurveItem> keyValuePair in this.data_list)
{
bool flag2 = keyValuePair.Value.TitleRegion.Contains(e.Location);
if (flag2)
{
flag = true;
break;
}
}
this.Cursor = (flag ? Cursors.Hand : Cursors.Arrow);
}
/// <summary>
/// 鼠标点击的信息
/// </summary>
/// <param name="e"></param>
// Token: 0x0600024F RID: 591 RVA: 0x0001F45C File Offset: 0x0001D65C
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
foreach (KeyValuePair<string, HslCurveItem> keyValuePair in this.data_list)
{
bool flag = keyValuePair.Value.TitleRegion.Contains(e.Location);
if (flag)
{
keyValuePair.Value.LineRenderVisiable = !keyValuePair.Value.LineRenderVisiable;
base.Invalidate();
break;
}
}
}
/// <summary>
/// 重绘控件的基本外观
/// </summary>
/// <param name="e">重绘事件</param>
// Token: 0x06000250 RID: 592 RVA: 0x0001F500 File Offset: 0x0001D700
protected override void OnPaint(PaintEventArgs e)
{
Graphics graphics = e.Graphics;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
this.PaintHslControls(graphics, base.Width, base.Height);
base.OnPaint(e);
}
/// <inheritdoc cref="M:HslControls.HslArrow.PaintHslControls(System.Drawing.Graphics,System.Single,System.Single)" />
// Token: 0x06000251 RID: 593 RVA: 0x0001F544 File Offset: 0x0001D744
public void PaintHslControls(Graphics g, int width, int height)
{
bool flag = !true;
if (!flag)
{
bool flag2 = this.BackColor != Color.Transparent;
if (flag2)
{
g.Clear(this.BackColor);
}
int num = height - this.upDown - this.upDown;
bool flag3 = width < 120 || height < 60;
if (!flag3)
{
Point[] array = new Point[]
{
new Point(this.leftRight - 1, this.upDown - 8),
new Point(this.leftRight - 1, height - this.upDown),
new Point(width - this.leftRight, height - this.upDown),
new Point(width - this.leftRight, this.upDown - 8)
};
g.DrawLine(this.pen_normal, array[1], array[2]);
g.DrawLine(this.referenceAxisLeft.GetPen(), array[0], array[1]);
bool flag4 = this.isRenderRightCoordinate;
if (flag4)
{
g.DrawLine(this.referenceAxisRight.GetPen(), array[2], array[3]);
}
bool flag5 = !string.IsNullOrEmpty(this.value_title);
if (flag5)
{
g.DrawString(this.value_title, this.font_size9, this.brush_deep, new Rectangle(0, 0, width - 1, 20), this.format_center);
}
else
{
bool flag6 = this.data_list.Count > 0;
if (flag6)
{
float num2 = (float)(this.leftRight + 10);
foreach (KeyValuePair<string, HslCurveItem> keyValuePair in this.data_list)
{
bool visible = keyValuePair.Value.Visible;
if (visible)
{
Pen pen = keyValuePair.Value.LineRenderVisiable ? new Pen(keyValuePair.Value.LineColor) : new Pen(Color.FromArgb(80, keyValuePair.Value.LineColor));
g.DrawLine(pen, num2, (float)(this.upDown / 2 - 1), num2 + 30f, (float)(this.upDown / 2 - 1));
g.DrawEllipse(pen, num2 + 8f, (float)(this.upDown / 2 - 8), 14f, 14f);
pen.Dispose();
SolidBrush solidBrush = keyValuePair.Value.LineRenderVisiable ? new SolidBrush(keyValuePair.Value.LineColor) : new SolidBrush(Color.FromArgb(80, keyValuePair.Value.LineColor));
g.DrawString(keyValuePair.Key, this.Font, solidBrush, new RectangleF(num2 + 35f, (float)(this.upDown / 2 - 9), 120f, 18f), this.format_left);
keyValuePair.Value.TitleRegion = new RectangleF(num2, 2f, 60f, 18f);
solidBrush.Dispose();
num2 += (float)this.curveNameWidth;
}
}
}
}
for (int i = 0; i < this.auxiliary_Labels.Count; i++)
{
bool flag7 = !string.IsNullOrEmpty(this.auxiliary_Labels[i].Text);
if (flag7)
{
int num3 = (this.auxiliary_Labels[i].LocationX > 1f) ? ((int)this.auxiliary_Labels[i].LocationX) : ((int)(this.auxiliary_Labels[i].LocationX * (float)width));
int num4 = (int)g.MeasureString(this.auxiliary_Labels[i].Text, this.Font).Width + 3;
Point[] points = new Point[]
{
new Point(num3, 11),
new Point(num3 + 10, 20),
new Point(num3 + num4 + 10, 20),
new Point(num3 + num4 + 10, 0),
new Point(num3 + 10, 0),
new Point(num3, 11)
};
g.FillPolygon(this.auxiliary_Labels[i].TextBack, points);
g.DrawString(this.auxiliary_Labels[i].Text, this.Font, this.auxiliary_Labels[i].TextBrush, new Rectangle(num3 + 7, 0, num4 + 3, 20), this.format_center);
}
}
HslHelper.PaintTriangle(g, this.referenceAxisLeft.Brush, new Point(this.leftRight - 1, this.upDown - 8), 4, GraphDirection.Upward);
bool flag8 = this.isRenderRightCoordinate;
if (flag8)
{
HslHelper.PaintTriangle(g, this.referenceAxisRight.Brush, new Point(width - this.leftRight, this.upDown - 8), 4, GraphDirection.Upward);
}
bool flag9 = !string.IsNullOrEmpty(this.referenceAxisLeft.Unit);
if (flag9)
{
g.DrawString(this.referenceAxisLeft.Unit, this.font_size9, this.referenceAxisLeft.Brush, new RectangleF(0f, 0f, (float)(this.leftRight - 4), (float)(this.upDown - 5)), this.format_right);
}
bool flag10 = this.isRenderRightCoordinate && !string.IsNullOrEmpty(this.referenceAxisRight.Unit);
if (flag10)
{
g.DrawString(this.referenceAxisRight.Unit, this.font_size9, this.referenceAxisRight.Brush, new RectangleF((float)(width - this.leftRight + 4), 0f, (float)(this.leftRight - 4), (float)(this.upDown - 5)), this.format_left);
}
for (int j = 0; j < this.auxiliary_lines.Count; j++)
{
bool isLeftFrame = this.auxiliary_lines[j].IsLeftFrame;
if (isLeftFrame)
{
this.auxiliary_lines[j].PaintValue = HslHelper.ComputePaintLocationY(this.referenceAxisLeft, (float)num, this.auxiliary_lines[j].Value) + (float)this.upDown;
}
else
{
this.auxiliary_lines[j].PaintValue = HslHelper.ComputePaintLocationY(this.referenceAxisRight, (float)num, this.auxiliary_lines[j].Value) + (float)this.upDown;
}
}
for (int k = 0; k <= this.value_Segment; k++)
{
float value = (float)((double)k * (double)(this.referenceAxisLeft.Max - this.referenceAxisLeft.Min) / (double)this.value_Segment + (double)this.referenceAxisLeft.Min);
float num5 = HslHelper.ComputePaintLocationY(this.referenceAxisLeft.Max, this.referenceAxisLeft.Min, (float)num, value) + (float)this.upDown;
bool flag11 = this.IsNeedPaintDash(num5);
if (flag11)
{
g.DrawLine(this.referenceAxisLeft.GetPen(), (float)(this.leftRight - 4), num5, (float)(this.leftRight - 1), num5);
RectangleF layoutRectangle = new RectangleF(0f, num5 - 9f, (float)(this.leftRight - 4), 20f);
g.DrawString(HslHelper.GetFormatString(this.referenceAxisLeft.Format, value, false), this.font_size9, this.referenceAxisLeft.Brush, layoutRectangle, this.format_right);
bool flag12 = this.isRenderRightCoordinate;
if (flag12)
{
float value2 = (float)((double)k * (double)(this.referenceAxisRight.Max - this.referenceAxisRight.Min) / (double)this.value_Segment + (double)this.referenceAxisRight.Min);
g.DrawLine(this.referenceAxisRight.GetPen(), (float)(width - this.leftRight + 1), num5, (float)(width - this.leftRight + 4), num5);
layoutRectangle.Location = new PointF((float)(width - this.leftRight + 4), num5 - 9f);
g.DrawString(HslHelper.GetFormatString(this.referenceAxisRight.Format, value2, false), this.font_size9, this.referenceAxisRight.Brush, layoutRectangle, this.format_left);
}
bool flag13 = k > 0 && this.value_IsRenderDashLine;
if (flag13)
{
g.DrawLine(this.pen_dash, (float)this.leftRight, num5, (float)(width - this.leftRight), num5);
}
}
}
bool flag14 = this.value_IsRenderDashLine;
if (flag14)
{
bool flag15 = this.value_IsAbscissaStrech;
if (flag15)
{
float num6 = (float)(width - this.leftRight * 2) * 1f / (float)(this.value_StrechDataCountMax - 1);
int num7 = this.CalculateDataCountByOffect(num6);
for (int l = 0; l < this.value_StrechDataCountMax; l += num7)
{
bool flag16 = l > 0 && l < this.value_StrechDataCountMax - 1;
if (flag16)
{
g.DrawLine(this.pen_dash, (float)l * num6 + (float)this.leftRight, (float)this.upDown, (float)l * num6 + (float)this.leftRight, (float)(height - this.upDown - 1));
}
bool flag17 = this.data_text != null;
if (flag17)
{
bool flag18 = l < this.data_text.Length && (float)l * num6 + (float)this.leftRight < (float)(this.data_text.Length - 1) * num6 + (float)this.leftRight - 40f;
if (flag18)
{
Rectangle r = new Rectangle((int)((float)l * num6), height - this.upDown + 1, this.leftRight * 2, this.upDown);
g.DrawString(this.data_text[l], this.font_size9, this.brush_deep, r, this.format_center);
}
}
}
string[] array2 = this.data_text;
bool flag19 = array2 != null && array2.Length > 1;
if (flag19)
{
bool flag20 = this.data_text.Length < this.value_StrechDataCountMax;
if (flag20)
{
g.DrawLine(this.pen_dash, (float)(this.data_text.Length - 1) * num6 + (float)this.leftRight, (float)this.upDown, (float)(this.data_text.Length - 1) * num6 + (float)this.leftRight, (float)(height - this.upDown - 1));
}
Rectangle r2 = new Rectangle((int)((float)(this.data_text.Length - 1) * num6 + (float)this.leftRight) - this.leftRight, height - this.upDown + 1, this.leftRight * 2, this.upDown);
g.DrawString(this.data_text[this.data_text.Length - 1], this.font_size9, this.brush_deep, r2, this.format_center);
}
}
else
{
int num8 = width - 2 * this.leftRight + 1;
bool flag21 = this.value_IntervalAbscissaText > 0;
if (flag21)
{
for (int m = this.leftRight; m < width - this.leftRight; m += this.value_IntervalAbscissaText)
{
bool flag22 = m != this.leftRight;
if (flag22)
{
g.DrawLine(this.pen_dash, m, this.upDown, m, height - this.upDown - 1);
}
bool flag23 = this.data_text != null;
if (flag23)
{
int num9 = (num8 > this.data_text.Length) ? this.data_text.Length : num8;
bool flag24 = m - this.leftRight < this.data_text.Length;
if (flag24)
{
bool flag25 = num9 - (m - this.leftRight) > 40;
if (flag25)
{
bool flag26 = this.data_text.Length <= num8;
if (flag26)
{
Rectangle r3 = new Rectangle(m - this.leftRight, height - this.upDown + 1, this.leftRight * 2, this.upDown);
g.DrawString(this.data_text[m - this.leftRight], this.font_size9, this.brush_deep, r3, this.format_center);
}
else
{
Rectangle r4 = new Rectangle(m - this.leftRight, height - this.upDown + 1, this.leftRight * 2, this.upDown);
g.DrawString(this.data_text[m - this.leftRight + this.data_text.Length - num8], this.font_size9, this.brush_deep, r4, this.format_center);
}
}
}
}
}
}
string[] array3 = this.data_text;
bool flag27 = array3 != null && array3.Length > 1;
if (flag27)
{
bool flag28 = this.data_text.Length < num8;
if (flag28)
{
g.DrawLine(this.pen_dash, this.data_text.Length + this.leftRight - 1, this.upDown, this.data_text.Length + this.leftRight - 1, height - this.upDown - 1);
Rectangle r5 = new Rectangle(this.data_text.Length + this.leftRight - 1 - this.leftRight, height - this.upDown + 1, this.leftRight * 2, this.upDown);
g.DrawString(this.data_text[this.data_text.Length - 1], this.font_size9, this.brush_deep, r5, this.format_center);
}
else
{
Rectangle r6 = new Rectangle(width - this.leftRight - this.leftRight, height - this.upDown + 1, this.leftRight * 2, this.upDown);
g.DrawString(this.data_text[this.data_text.Length - 1], this.font_size9, this.brush_deep, r6, this.format_center);
}
}
}
}
for (int n = 0; n < this.auxiliary_lines.Count; n++)
{
bool isLeftFrame2 = this.auxiliary_lines[n].IsLeftFrame;
if (isLeftFrame2)
{
g.DrawLine(this.auxiliary_lines[n].GetPen(), (float)(this.leftRight - 4), this.auxiliary_lines[n].PaintValue, (float)(this.leftRight - 1), this.auxiliary_lines[n].PaintValue);
RectangleF layoutRectangle2 = new RectangleF(0f, this.auxiliary_lines[n].PaintValue - 9f, (float)(this.leftRight - 4), 20f);
g.DrawString(HslHelper.GetFormatString(this.referenceAxisLeft.Format, this.auxiliary_lines[n].Value, false), this.font_size9, this.auxiliary_lines[n].LineTextBrush, layoutRectangle2, this.format_right);
}
else
{
g.DrawLine(this.auxiliary_lines[n].GetPen(), (float)(width - this.leftRight + 1), this.auxiliary_lines[n].PaintValue, (float)(width - this.leftRight + 4), this.auxiliary_lines[n].PaintValue);
RectangleF layoutRectangle3 = new RectangleF((float)(width - this.leftRight + 4), this.auxiliary_lines[n].PaintValue - 9f, (float)(this.leftRight - 4), 20f);
g.DrawString(HslHelper.GetFormatString(this.referenceAxisRight.Format, this.auxiliary_lines[n].Value, false), this.font_size9, this.auxiliary_lines[n].LineTextBrush, layoutRectangle3, this.format_left);
}
g.DrawLine(this.auxiliary_lines[n].GetPen(), (float)this.leftRight, this.auxiliary_lines[n].PaintValue, (float)(width - this.leftRight), this.auxiliary_lines[n].PaintValue);
}
bool flag29 = this.value_IsAbscissaStrech;
if (flag29)
{
foreach (HslMarkText hslMarkText in this.hslMarkTexts)
{
foreach (KeyValuePair<string, HslCurveItem> keyValuePair2 in this.data_list)
{
bool flag30 = !keyValuePair2.Value.Visible;
if (!flag30)
{
bool flag31 = !keyValuePair2.Value.LineRenderVisiable;
if (!flag31)
{
bool flag32 = keyValuePair2.Key != hslMarkText.CurveKey;
if (!flag32)
{
float[] data = keyValuePair2.Value.Data;
bool flag33 = data != null && data.Length > 1;
if (flag33)
{
float num10 = (float)(width - this.leftRight * 2) * 1f / (float)(this.value_StrechDataCountMax - 1);
bool flag34 = hslMarkText.Index >= 0 && hslMarkText.Index < keyValuePair2.Value.Data.Length;
if (flag34)
{
PointF center = new PointF((float)this.leftRight + (float)hslMarkText.Index * num10, HslHelper.ComputePaintLocationY((keyValuePair2.Value.ReferenceAxisIndex == 0) ? this.referenceAxisLeft.Max : this.referenceAxisRight.Max, (keyValuePair2.Value.ReferenceAxisIndex == 0) ? this.referenceAxisLeft.Min : this.referenceAxisRight.Min, (float)num, keyValuePair2.Value.Data[hslMarkText.Index]) + (float)this.upDown);
MarkTextPositionStyle markTextPosition = (hslMarkText.PositionStyle == MarkTextPositionStyle.Auto) ? HslMarkText.CalculateDirectionFromDataIndex(keyValuePair2.Value.Data, hslMarkText.Index) : hslMarkText.PositionStyle;
HslCurveHelper.DrawHslMarkTextPoint(g, hslMarkText, center, this.Font, markTextPosition);
}
}
}
}
}
}
}
foreach (HslCurveItem hslCurveItem in this.data_list.Values)
{
bool flag35 = !hslCurveItem.Visible;
if (!flag35)
{
bool flag36 = !hslCurveItem.LineRenderVisiable;
if (!flag36)
{
float[] data2 = hslCurveItem.Data;
bool flag37 = data2 != null && data2.Length > 1;
if (flag37)
{
float num11 = (float)(width - this.leftRight * 2) * 1f / (float)(this.value_StrechDataCountMax - 1);
List<PointF> list = new List<PointF>(hslCurveItem.Data.Length);
for (int num12 = 0; num12 < hslCurveItem.Data.Length; num12++)
{
bool flag38 = !float.IsNaN(hslCurveItem.Data[num12]);
if (flag38)
{
PointF pointF = new PointF
{
X = (float)this.leftRight + (float)num12 * num11,
Y = HslHelper.ComputePaintLocationY((hslCurveItem.ReferenceAxisIndex == 0) ? this.referenceAxisLeft.Max : this.referenceAxisRight.Max, (hslCurveItem.ReferenceAxisIndex == 0) ? this.referenceAxisLeft.Min : this.referenceAxisRight.Min, (float)num, hslCurveItem.Data[num12]) + (float)this.upDown
};
list.Add(pointF);
bool flag39 = !string.IsNullOrEmpty(hslCurveItem.MarkText[num12]);
if (flag39)
{
using (Brush brush = new SolidBrush(hslCurveItem.LineColor))
{
g.FillEllipse(brush, new RectangleF(pointF.X - 3f, pointF.Y - 3f, 6f, 6f));
MarkTextPositionStyle markTextPosition2 = HslMarkText.CalculateDirectionFromDataIndex(hslCurveItem.Data, num12);
HslCurveHelper.DrawTextByPoint(g, hslCurveItem.MarkText[num12], pointF, this.Font, brush, markTextPosition2, 5);
}
}
}
else
{
HslCurveHelper.DrawLineCore(g, hslCurveItem, list, this.pointsRadius, -1f);
list.Clear();
}
}
HslCurveHelper.DrawLineCore(g, hslCurveItem, list, this.pointsRadius, -1f);
}
}
}
}
}
else
{
foreach (HslMarkText hslMarkText2 in this.hslMarkTexts)
{
foreach (KeyValuePair<string, HslCurveItem> keyValuePair3 in this.data_list)
{
bool flag40 = !keyValuePair3.Value.Visible;
if (!flag40)
{
bool flag41 = !keyValuePair3.Value.LineRenderVisiable;
if (!flag41)
{
bool flag42 = keyValuePair3.Key != hslMarkText2.CurveKey;
if (!flag42)
{
float[] data3 = keyValuePair3.Value.Data;
bool flag43 = data3 != null && data3.Length > 1;
if (flag43)
{
bool flag44 = hslMarkText2.Index >= 0 && hslMarkText2.Index < keyValuePair3.Value.Data.Length;
if (flag44)
{
PointF center2 = new PointF((float)(this.leftRight + hslMarkText2.Index), HslHelper.ComputePaintLocationY((keyValuePair3.Value.ReferenceAxisIndex == 0) ? this.referenceAxisLeft.Max : this.referenceAxisRight.Max, (keyValuePair3.Value.ReferenceAxisIndex == 0) ? this.referenceAxisLeft.Min : this.referenceAxisRight.Min, (float)num, keyValuePair3.Value.Data[hslMarkText2.Index]) + (float)this.upDown);
MarkTextPositionStyle markTextPosition3 = (hslMarkText2.PositionStyle == MarkTextPositionStyle.Auto) ? HslMarkText.CalculateDirectionFromDataIndex(keyValuePair3.Value.Data, hslMarkText2.Index) : hslMarkText2.PositionStyle;
HslCurveHelper.DrawHslMarkTextPoint(g, hslMarkText2, center2, this.Font, markTextPosition3);
}
}
}
}
}
}
}
foreach (HslCurveItem hslCurveItem2 in this.data_list.Values)
{
bool flag45 = !hslCurveItem2.Visible;
if (!flag45)
{
bool flag46 = !hslCurveItem2.LineRenderVisiable;
if (!flag46)
{
float[] data4 = hslCurveItem2.Data;
bool flag47 = data4 != null && data4.Length > 1;
if (flag47)
{
int num13 = width - 2 * this.leftRight + 1;
List<PointF> list2 = new List<PointF>(hslCurveItem2.Data.Length);
bool flag48 = hslCurveItem2.Data.Length <= num13;
if (flag48)
{
for (int num14 = 0; num14 < hslCurveItem2.Data.Length; num14++)
{
bool flag49 = !float.IsNaN(hslCurveItem2.Data[num14]);
if (flag49)
{
PointF pointF2 = new PointF
{
X = (float)(this.leftRight + num14),
Y = HslHelper.ComputePaintLocationY((hslCurveItem2.ReferenceAxisIndex == 0) ? this.referenceAxisLeft.Max : this.referenceAxisRight.Max, (hslCurveItem2.ReferenceAxisIndex == 0) ? this.referenceAxisLeft.Min : this.referenceAxisRight.Min, (float)num, hslCurveItem2.Data[num14]) + (float)this.upDown
};
list2.Add(pointF2);
this.DrawMarkPoint(g, hslCurveItem2.MarkText[num14], pointF2, hslCurveItem2.LineColor, HslMarkText.CalculateDirectionFromDataIndex(hslCurveItem2.Data, num14));
}
else
{
HslCurveHelper.DrawLineCore(g, hslCurveItem2, list2, this.pointsRadius, -1f);
list2.Clear();
}
}
}
else
{
for (int num15 = 0; num15 < num13; num15++)
{
int num16 = num15 + hslCurveItem2.Data.Length - num13;
bool flag50 = !float.IsNaN(hslCurveItem2.Data[num16]);
if (flag50)
{
PointF pointF3 = new PointF
{
X = (float)(this.leftRight + num15),
Y = HslHelper.ComputePaintLocationY((hslCurveItem2.ReferenceAxisIndex == 0) ? this.referenceAxisLeft.Max : this.referenceAxisRight.Max, (hslCurveItem2.ReferenceAxisIndex == 0) ? this.referenceAxisLeft.Min : this.referenceAxisRight.Min, (float)num, hslCurveItem2.Data[num16]) + (float)this.upDown
};
list2.Add(pointF3);
this.DrawMarkPoint(g, hslCurveItem2.MarkText[num16], pointF3, hslCurveItem2.LineColor, HslMarkText.CalculateDirectionFromDataIndex(hslCurveItem2.Data, num16));
}
else
{
HslCurveHelper.DrawLineCore(g, hslCurveItem2, list2, this.pointsRadius, -1f);
list2.Clear();
}
}
}
HslCurveHelper.DrawLineCore(g, hslCurveItem2, list2, this.pointsRadius, -1f);
}
}
}
}
}
}
}
}
// Token: 0x06000252 RID: 594 RVA: 0x00020FF4 File Offset: 0x0001F1F4
private void DrawMarkPoint(Graphics g, string markText, PointF center, Color color, MarkTextPositionStyle markTextPosition)
{
bool flag = !string.IsNullOrEmpty(markText);
if (flag)
{
using (Brush brush = new SolidBrush(color))
{
this.DrawMarkPoint(g, markText, center, brush, markTextPosition);
}
}
}
// Token: 0x06000253 RID: 595 RVA: 0x00021048 File Offset: 0x0001F248
private void DrawMarkPoint(Graphics g, string markText, PointF center, Brush brush, MarkTextPositionStyle markTextPosition)
{
bool flag = !string.IsNullOrEmpty(markText);
if (flag)
{
g.FillEllipse(brush, new RectangleF(center.X - 3f, center.Y - 3f, 6f, 6f));
HslCurveHelper.DrawTextByPoint(g, markText, center, this.Font, brush, markTextPosition, 5);
}
}
// Token: 0x06000254 RID: 596 RVA: 0x000210AC File Offset: 0x0001F2AC
private bool IsNeedPaintDash(float paintValue)
{
for (int i = 0; i < this.auxiliary_lines.Count; i++)
{
bool flag = Math.Abs(this.auxiliary_lines[i].PaintValue - paintValue) < (float)this.font_size9.Height;
if (flag)
{
return false;
}
}
return true;
}
// Token: 0x06000255 RID: 597 RVA: 0x0002110C File Offset: 0x0001F30C
private int CalculateDataCountByOffect(float offect)
{
bool flag = this.value_IntervalAbscissaText > 0;
int result;
if (flag)
{
result = this.value_IntervalAbscissaText;
}
else
{
bool flag2 = offect > 40f;
if (flag2)
{
result = 1;
}
else
{
offect = 40f / offect;
result = (int)Math.Ceiling((double)offect);
}
}
return result;
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
// Token: 0x06000256 RID: 598 RVA: 0x00021158 File Offset: 0x0001F358
protected override void Dispose(bool disposing)
{
bool flag = disposing && this.components != null;
if (flag)
{
this.components.Dispose();
}
base.Dispose(disposing);
}
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
// Token: 0x06000257 RID: 599 RVA: 0x00021190 File Offset: 0x0001F390
private void InitializeComponent()
{
base.SuspendLayout();
base.AutoScaleMode = AutoScaleMode.None;
this.BackColor = Color.Transparent;
base.Name = "HslCurve";
base.Size = new Size(417, 205);
base.ResumeLayout(false);
}
// Token: 0x040000EE RID: 238
private const int value_count_max = 4096;
// Token: 0x040000EF RID: 239
private int value_Segment = 5;
// Token: 0x040000F0 RID: 240
private bool value_IsAbscissaStrech = false;
// Token: 0x040000F1 RID: 241
private int value_StrechDataCountMax = 300;
// Token: 0x040000F2 RID: 242
private bool value_IsRenderDashLine = true;
// Token: 0x040000F3 RID: 243
private string textFormat = "HH:mm";
// Token: 0x040000F4 RID: 244
private int value_IntervalAbscissaText = 100;
// Token: 0x040000F5 RID: 245
private Random random = null;
// Token: 0x040000F6 RID: 246
private string value_title = "";
// Token: 0x040000F7 RID: 247
private ReferenceAxis referenceAxisLeft;
// Token: 0x040000F8 RID: 248
private ReferenceAxis referenceAxisRight;
// Token: 0x040000F9 RID: 249
private int leftRight = 50;
// Token: 0x040000FA RID: 250
private int upDown = 25;
// Token: 0x040000FB RID: 251
private Dictionary<string, HslCurveItem> data_list = null;
// Token: 0x040000FC RID: 252
private string[] data_text = null;
// Token: 0x040000FD RID: 253
private List<AuxiliaryLine> auxiliary_lines;
// Token: 0x040000FE RID: 254
private List<AuxiliaryLable> auxiliary_Labels;
// Token: 0x040000FF RID: 255
private List<HslMarkText> hslMarkTexts;
// Token: 0x04000100 RID: 256
private Font font_size9 = null;
// Token: 0x04000101 RID: 257
private Brush brush_deep = null;
// Token: 0x04000102 RID: 258
private Pen pen_normal = null;
// Token: 0x04000103 RID: 259
private Pen pen_dash = null;
// Token: 0x04000104 RID: 260
private Color color_normal = Color.DeepPink;
// Token: 0x04000105 RID: 261
private Color color_deep = Color.DimGray;
// Token: 0x04000106 RID: 262
private Color color_dash = Color.Gray;
// Token: 0x04000107 RID: 263
private Color color_mark_font = Color.DodgerBlue;
// Token: 0x04000108 RID: 264
private Brush brush_mark_font = Brushes.DodgerBlue;
// Token: 0x04000109 RID: 265
private StringFormat format_left = null;
// Token: 0x0400010A RID: 266
private StringFormat format_right = null;
// Token: 0x0400010B RID: 267
private StringFormat format_center = null;
// Token: 0x0400010C RID: 268
private bool isRenderRightCoordinate = true;
// Token: 0x0400010D RID: 269
private int curveNameWidth = 100;
// Token: 0x0400010E RID: 270
private int pointsRadius = 0;
/// <summary>
/// 必需的设计器变量。
/// </summary>
// Token: 0x0400010F RID: 271
private IContainer components = null;
}
}