using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PaintDotNet.Base.DedicatedAnalysis.Inclusions
{
///
/// 夹杂物抽象全局设置
///
public class InclusionsGlobalSettings: DedicatedAnalysisGlobalSettings
{
public bool autoThreshold = true;
public int binaryThreshold;
///
/// 轧制方向
///
public RollingDirection rollingDirection;
///
/// 系统纳米标尺每像素长度
///
public double pxPerUnit;
///
/// 微粒之间的距离(distances between particles) 垂直距离
///
public int distancesBetweenParticlesE;
///
/// 微粒之间的距离(distances between particles) 水平距离
///
public int distancesBetweenParticlesT;
///
/// 条串之间的距离(distances between stringers) 垂直距离
///
public int distancesBetweenStringersE;
///
/// 条串之间的距离(distances between stringers) 水平距离
///
public int distancesBetweenStringersT;
///
/// 判定微粒最小长度尺寸
///
public int minimumLength;
///
/// 判定微粒最小宽度尺寸
///
public int minimumWidth;
///
/// 长宽比界限,用于判断球型夹杂物
///
public double lwRatioLimit;
public Dictionary typeDics = new Dictionary();
public Dictionary colorOfInclusions = new Dictionary();
public enum RollingDirection
{
[Description("纵向")]
PORTRAIT,
[Description("横向")]
HORIZONTAL
}
///
/// 夹杂物类型
///
public class TypesOfInclusions
{
public TypesOfInclusions(string type)
{
this.type = type;
}
///
/// 展示颜色
///
public int showColor;
///
/// 夹杂物类型字符串
///
public string type;
}
public class ColorOfInclusions
{
public string colorName;
public TypesOfInclusions[] ofTypes;
///
/// 判断夹杂物rgb
/// rgb 上下限
///
public byte ru;
public byte rd;
public byte gu;
public byte gd;
public byte bu;
public byte bd;
public ColorOfInclusions(string colorName, TypesOfInclusions[] ofTypes, Color color)
{
this.colorName = colorName;
this.ofTypes = ofTypes;
this.rd = (byte)(color.R - 10 < 0 ? 0 : color.R - 10);
this.ru = (byte)(color.R + 10 > 255 ? 255 : color.R + 10);
this.gd = (byte)(color.G - 10 < 0 ? 0 : color.G - 10);
this.gu = (byte)(color.G + 10 > 255 ? 255 : color.G + 10);
this.bd = (byte)(color.B - 10 < 0 ? 0 : color.B - 10);
this.bu = (byte)(color.B + 10 > 255 ? 255 : color.B + 10);
}
public ColorOfInclusions(string colorName, TypesOfInclusions[] ofTypes, byte ru, byte rd, byte gu, byte gd, byte bu, byte bd)
{
this.colorName = colorName;
this.ofTypes = ofTypes;
this.ru = ru;
this.rd = rd;
this.gu = gu;
this.gd = gd;
this.bu = bu;
this.bd = bd;
}
public void setColor(Color color)
{
this.rd = (byte)(color.R - 10 < 0 ? 0 : color.R - 10);
this.ru = (byte)(color.R + 10 > 255 ? 255 : color.R + 10);
this.gd = (byte)(color.G - 10 < 0 ? 0 : color.G - 10);
this.gu = (byte)(color.G + 10 > 255 ? 255 : color.G + 10);
this.bd = (byte)(color.B - 10 < 0 ? 0 : color.B - 10);
this.bu = (byte)(color.B + 10 > 255 ? 255 : color.B + 10);
}
}
}
}