MaterialCode.cs
5.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
using System;
using System.Collections.Generic;
using System.Drawing;
namespace Model
{
public class MaterialCode
{
public int ID { get; set; } = -1;
public string Text { get; set; } = "";
public string CodeType { get; set; } = "";
public float CenterX { get; set; } = 0;
public float CenterY { get; set; } = 0;
public float Angle { get; set; } = 0;
public float Width { get; set; } = 0;
public float Height { get; set; } = 0;
public float Distance { get; set; } = 0;
public MaterialCode Clone()
{
MaterialCode node = new();
System.Reflection.PropertyInfo[] destination = node.GetType().GetProperties();
System.Reflection.PropertyInfo[] orgin = GetType().GetProperties();
for (int i = 0; i < destination.Length; i++)
destination[i].SetValue(node, orgin[i].GetValue(this));
return node;
}
}
///// <summary>
///// 物料原始条形码类
///// </summary>
//public class MaterialCode : ICloneable
//{
// public int ID { get; set; }
// /// <summary>
// /// 文本
// /// </summary>
// public string Text { get; set; }
// /// <summary>
// /// 条码类型
// /// </summary>
// public string CodeType { get; set; }
// /// <summary>
// /// 中心点
// /// </summary>
// public PointF Center { get; set; }
// /// <summary>
// /// 角度,3点钟方向0°,逆时针为正,顺时针为负。
// /// </summary>
// public float Angle { get; set; }
// /// <summary>
// /// 宽度
// /// </summary>
// public float Width { get; set; }
// /// <summary>
// /// 高度
// /// </summary>
// public float Height { get; set; }
// /// <summary>
// /// 中心点到原点直线方程的距离
// /// </summary>
// public double Distance { get; set; }
// public bool MatchingStart { get; set; } = false;
// public string MatchingStartText { get; set; } = "";
// public bool MatchingEnd { get; set; } = false;
// public string MatchingEndText { get; set; } = "";
// public bool MatchingMiddle { get; set; } = false;
// public string MatchingMiddleText { get; set; } = "";
// public bool MatchingCaseSensitivity { get; set; } = false;
// public bool MatchingMinLength { get; set; } = false;
// public int MatchingMinLengthValue { get; set; } = 1;
// public bool MatchingMaxLength { get; set; } = false;
// public int MatchingMaxLengthValue { get; set; } = 1;
// /// <summary>
// /// 关键字
// /// </summary>
// public string Keyword { set; get; }
// /// <summary>
// /// 字符串截取起始
// /// </summary>
// public int Start { set; get; }
// /// <summary>
// /// 字符串截取长度
// /// </summary>
// public int Length { set; get; }
// public object Clone()
// {
// MaterialCode node = new MaterialCode();
// System.Reflection.PropertyInfo[] info1 = node.GetType().GetProperties();
// System.Reflection.PropertyInfo[] info2 = this.GetType().GetProperties();
// for (int i = 0; i < info1.Length; i++)
// info1[i].SetValue(node, info2[i].GetValue(this));
// return node;
// }
//}
///// <summary>
///// 物料原始条码对应的OCR类
///// </summary>
//public class OriginalCodeOCR : ICloneable
//{
// /// <summary>
// /// 条码ID
// /// </summary>
// public int CodeID { set; get; }
// /// <summary>
// /// 与指定条码的偏移
// /// </summary>
// public Point Offset { set; get; }
// /// <summary>
// /// 识别区域的大小
// /// </summary>
// public Size Size { set; get; }
// /// <summary>
// /// 模式,用于替换
// /// </summary>
// public string Mode { set; get; } = "";
// public object Clone()
// {
// OriginalCodeOCR node = new OriginalCodeOCR();
// System.Reflection.PropertyInfo[] info1 = node.GetType().GetProperties();
// System.Reflection.PropertyInfo[] info2 = this.GetType().GetProperties();
// for (int i = 0; i < info1.Length; i++)
// info1[i].SetValue(node, info2[i].GetValue(this));
// return node;
// }
//}
///// <summary>
///// 物料模板类
///// </summary>
//public class MaterialTemplate: ICloneable
//{
// public List<MaterialCode> Code = new List<MaterialCode>();
// public List<OriginalCodeOCR> OCR = new List<OriginalCodeOCR>();
// public string FilePath { get; set; } = "";
// public string ImagePath { get; set; } = "";
// public Bitmap Image { get; set; } = null;
// public string Name { get; set; } = "";
// public int PrimaryCode { get; set; } = -1;
// public object Clone()
// {
// MaterialTemplate node = new MaterialTemplate
// {
// Code = new List<MaterialCode>(),
// OCR = new List<OriginalCodeOCR>()
// };
// for (int i = 0; i < Code.Count; i++)
// node.Code.Add((MaterialCode)Code[i].Clone());
// for (int i = 0; i < OCR.Count; i++)
// node.OCR.Add((OriginalCodeOCR)OCR[i].Clone());
// System.Reflection.PropertyInfo[] info1 = node.GetType().GetProperties();
// System.Reflection.PropertyInfo[] info2 = this.GetType().GetProperties();
// for (int i = 0; i < info1.Length; i++)
// info1[i].SetValue(node, info2[i].GetValue(this));
// return node;
// }
//}
}