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/HslMarkText.cs

183 lines
6.8 KiB
C#

using System.Drawing;
namespace Mesnac.Controls.ChemicalWeighing.HslCurve
{
/// <summary>
/// 曲线图里的文本标记信息
/// </summary>
// Token: 0x02000017 RID: 23
public class HslMarkText
{
/// <summary>
/// 实例化一个默认的对象
/// </summary>
// Token: 0x06000272 RID: 626 RVA: 0x000212FF File Offset: 0x0001F4FF
public HslMarkText()
{
this.CircleBrush = Brushes.DodgerBlue;
this.TextBrush = Brushes.Black;
this.MarkTextOffect = 5;
}
/// <summary>
/// 针对的曲线的关键字
/// </summary>
// Token: 0x170000C8 RID: 200
// (get) Token: 0x06000273 RID: 627 RVA: 0x00021338 File Offset: 0x0001F538
// (set) Token: 0x06000274 RID: 628 RVA: 0x00021340 File Offset: 0x0001F540
public string CurveKey { get; set; }
/// <summary>
/// 位置的索引
/// </summary>
// Token: 0x170000C9 RID: 201
// (get) Token: 0x06000275 RID: 629 RVA: 0x00021349 File Offset: 0x0001F549
// (set) Token: 0x06000276 RID: 630 RVA: 0x00021351 File Offset: 0x0001F551
public int Index { get; set; }
/// <summary>
/// 标记的文本
/// </summary>
// Token: 0x170000CA RID: 202
// (get) Token: 0x06000277 RID: 631 RVA: 0x0002135A File Offset: 0x0001F55A
// (set) Token: 0x06000278 RID: 632 RVA: 0x00021362 File Offset: 0x0001F562
public string MarkText { get; set; }
/// <summary>
/// 标记的图片信息,和标记的文本只能二选其一
/// </summary>
// Token: 0x170000CB RID: 203
// (get) Token: 0x06000279 RID: 633 RVA: 0x0002136B File Offset: 0x0001F56B
// (set) Token: 0x0600027A RID: 634 RVA: 0x00021373 File Offset: 0x0001F573
public Image MarkImage { get; set; }
/// <summary>
/// 文本的颜色
/// </summary>
// Token: 0x170000CC RID: 204
// (get) Token: 0x0600027B RID: 635 RVA: 0x0002137C File Offset: 0x0001F57C
// (set) Token: 0x0600027C RID: 636 RVA: 0x00021384 File Offset: 0x0001F584
public Brush TextBrush { get; set; }
/// <summary>
/// 圆圈的画刷
/// </summary>
// Token: 0x170000CD RID: 205
// (get) Token: 0x0600027D RID: 637 RVA: 0x0002138D File Offset: 0x0001F58D
// (set) Token: 0x0600027E RID: 638 RVA: 0x00021395 File Offset: 0x0001F595
public Brush CircleBrush { get; set; }
/// <summary>
/// 文本的偏移标记信息
/// </summary>
// Token: 0x170000CE RID: 206
// (get) Token: 0x0600027F RID: 639 RVA: 0x0002139E File Offset: 0x0001F59E
// (set) Token: 0x06000280 RID: 640 RVA: 0x000213A6 File Offset: 0x0001F5A6
public int MarkTextOffect { get; set; } = 5;
/// <summary>
/// 点的标记状态
/// </summary>
// Token: 0x170000CF RID: 207
// (get) Token: 0x06000281 RID: 641 RVA: 0x000213AF File Offset: 0x0001F5AF
// (set) Token: 0x06000282 RID: 642 RVA: 0x000213B7 File Offset: 0x0001F5B7
public MarkTextPositionStyle PositionStyle { get; set; } = MarkTextPositionStyle.Auto;
/// <summary>
/// 根据数据和索引计算文本的绘制的位置
/// </summary>
/// <param name="data">数据信息</param>
/// <param name="Index">索引</param>
/// <returns>绘制的位置信息</returns>
// Token: 0x06000283 RID: 643 RVA: 0x000213C0 File Offset: 0x0001F5C0
public static MarkTextPositionStyle CalculateDirectionFromDataIndex(float[] data, int Index)
{
float num = (Index == 0) ? data[Index] : data[Index - 1];
float num2 = (Index == data.Length - 1) ? data[Index] : data[Index + 1];
bool flag = num < data[Index] && data[Index] < num2;
MarkTextPositionStyle result;
if (flag)
{
result = MarkTextPositionStyle.Left;
}
else
{
bool flag2 = num > data[Index] && data[Index] > num2;
if (flag2)
{
result = MarkTextPositionStyle.Right;
}
else
{
bool flag3 = num <= data[Index] && data[Index] >= num2;
if (flag3)
{
result = MarkTextPositionStyle.Up;
}
else
{
bool flag4 = num >= data[Index] && data[Index] <= num2;
if (flag4)
{
result = MarkTextPositionStyle.Down;
}
else
{
result = MarkTextPositionStyle.Up;
}
}
}
}
return result;
}
/// <summary>
/// 根据数据和索引计算文本的绘制的位置
/// </summary>
/// <param name="data">数据信息</param>
/// <param name="Index">索引</param>
/// <returns>绘制的位置信息</returns>
// Token: 0x06000284 RID: 644 RVA: 0x0002145C File Offset: 0x0001F65C
public static MarkTextPositionStyle CalculateDirectionFromDataIndex(PointF[] data, int Index)
{
float num = (Index == 0) ? data[Index].Y : data[Index - 1].Y;
float num2 = (Index == data.Length - 1) ? data[Index].Y : data[Index + 1].Y;
bool flag = num < data[Index].Y && data[Index].Y < num2;
MarkTextPositionStyle result;
if (flag)
{
result = MarkTextPositionStyle.Left;
}
else
{
bool flag2 = num > data[Index].Y && data[Index].Y > num2;
if (flag2)
{
result = MarkTextPositionStyle.Right;
}
else
{
bool flag3 = num <= data[Index].Y && data[Index].Y >= num2;
if (flag3)
{
result = MarkTextPositionStyle.Up;
}
else
{
bool flag4 = num >= data[Index].Y && data[Index].Y <= num2;
if (flag4)
{
result = MarkTextPositionStyle.Down;
}
else
{
result = MarkTextPositionStyle.Up;
}
}
}
}
return result;
}
}
}