MeasureParam.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. //时间:20200618
  2. //作者:郝爽
  3. //功能:测量参数
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using FileManager;
  10. using System.Xml;
  11. using System.IO;
  12. namespace MeasureData
  13. {
  14. public class MeasureParam : ISlo
  15. {
  16. #region 内容
  17. //工作条件,一次测量的全部切孔都是一类的
  18. // 样品类型
  19. private string m_SampleName;
  20. public string SampleName
  21. {
  22. get { return this.m_SampleName; }
  23. set { this.m_SampleName = value; }
  24. }
  25. //是否仅拍照
  26. private Boolean is_Photograph;
  27. public Boolean Is_Photograph
  28. {
  29. get { return this.is_Photograph; }
  30. set { this.is_Photograph = value; }
  31. }
  32. //是否有pt工序
  33. private Boolean m_pt;
  34. public Boolean PT
  35. {
  36. get { return this.m_pt; }
  37. set { this.m_pt = value; }
  38. }
  39. //FIB使用的ELY文件
  40. private string m_fibTemp;
  41. public string FIBTemp
  42. {
  43. get { return this.m_fibTemp; }
  44. set { this.m_fibTemp = value; }
  45. }
  46. //PT使用的ELY文件
  47. private string m_ptTemp;
  48. public string PTTemp
  49. {
  50. get { return this.m_ptTemp; }
  51. set { this.m_ptTemp = value; }
  52. }
  53. //对焦方式,自动对焦还是手动对焦,手动对焦是1,自有自动对焦2,客户自动对焦3
  54. private int m_fMode;
  55. public int FocusMode
  56. {
  57. get { return m_fMode; }
  58. set { m_fMode = value; }
  59. }
  60. //拉直操作需要的放大位数
  61. private float stretch_Magnification;
  62. public float Stretch_Magnification
  63. {
  64. get { return this.stretch_Magnification; }
  65. set { this.stretch_Magnification = value; }
  66. }
  67. //定位切割位置的放大倍数
  68. private float location_Magnification;
  69. public float Location_Magnification
  70. {
  71. get { return this.location_Magnification; }
  72. set { this.location_Magnification = value; }
  73. }
  74. //定位切割位置的工作电压
  75. private float location_Voltage;
  76. public float Location_Voltage
  77. {
  78. get { return this.location_Voltage; }
  79. set { this.location_Voltage = value; }
  80. }
  81. //拍照的放大倍数
  82. private float photograph_Magnification;
  83. public float Photograph_Magnification
  84. {
  85. get { return this.photograph_Magnification; }
  86. set { this.photograph_Magnification = value; }
  87. }
  88. //拍照的工作电压
  89. private float photograph_Voltage;
  90. public float Photograph_Voltage
  91. {
  92. get { return this.photograph_Voltage; }
  93. set { this.photograph_Voltage = value; }
  94. }
  95. //校正角度选择
  96. private float correction_Angle;
  97. public float Correction_Angle
  98. {
  99. get { return this.correction_Angle; }
  100. set { this.correction_Angle = value; }
  101. }
  102. //厂商
  103. private String firm;
  104. public String Firm
  105. {
  106. get { return this.firm; }
  107. set { this.firm = value; }
  108. }
  109. //对焦参数
  110. private FocusParam focusP;
  111. public FocusParam AutoFocus
  112. {
  113. get { return this.focusP; }
  114. set { this.focusP = value; }
  115. }
  116. //能谱参数
  117. #endregion
  118. //构造函数
  119. public MeasureParam()
  120. {
  121. Init();
  122. }
  123. public void Init()
  124. {
  125. this.SampleName = @"";
  126. this.PT = false;
  127. this.FIBTemp = @"";
  128. this.PTTemp = @"";
  129. this.FocusMode = 2;
  130. this.AutoFocus = new FocusParam();
  131. }
  132. //XML文件保存测量参数
  133. public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
  134. {
  135. Slo sFile = new Slo();
  136. //是否拍照和PT
  137. xBool isPhotograph = new xBool();
  138. xBool ptDepostion = new xBool();
  139. isPhotograph.AssignValue(this.is_Photograph);
  140. ptDepostion.AssignValue(this.m_pt);
  141. sFile.Register("Is_Photograph", isPhotograph);
  142. sFile.Register("PT_Depostion", ptDepostion);
  143. //ELY文件
  144. xString ptELYFile = new xString();
  145. xString fibELYFile = new xString();
  146. ptELYFile.AssignValue(this.m_ptTemp);
  147. fibELYFile.AssignValue(this.m_fibTemp);
  148. sFile.Register("PT_ELYFile", ptELYFile);
  149. sFile.Register("FIB_ELYFile", fibELYFile);
  150. //对焦方式
  151. xInt focusmode = new xInt();
  152. focusmode.AssignValue(this.m_fMode);
  153. sFile.Register("FocusMode", focusmode);
  154. //放大倍数和电压参数
  155. xDouble stretchMagnification = new xDouble();
  156. xDouble locationMagnification = new xDouble();
  157. xDouble locationVoltage = new xDouble();
  158. xDouble photographMagnification = new xDouble();
  159. xDouble photographVoltage = new xDouble();
  160. stretchMagnification.AssignValue(this.stretch_Magnification);
  161. locationMagnification.AssignValue(this.location_Magnification);
  162. locationVoltage.AssignValue(this.location_Voltage);
  163. photographMagnification.AssignValue(this.photograph_Magnification);
  164. photographVoltage.AssignValue(this.photograph_Voltage);
  165. sFile.Register("Strectch_Magnification", stretchMagnification);
  166. sFile.Register("Locatio_Magnification", locationMagnification);
  167. sFile.Register("Location_Voltage", locationVoltage);
  168. sFile.Register("Photograph_Magnification", photographMagnification);
  169. sFile.Register("Photograph_Voltage", photographVoltage);
  170. //校正角度
  171. xDouble correctionAngle = new xDouble();
  172. correctionAngle.AssignValue(this.correction_Angle);
  173. sFile.Register("Correction_Angle", correctionAngle);
  174. //样品名称和厂商
  175. xString sampleType = new xString();
  176. xString _firm = new xString();
  177. sampleType.AssignValue(this.m_SampleName);
  178. _firm.AssignValue(this.firm);
  179. sFile.Register("Sample_Type", sampleType);
  180. sFile.Register("Firm", _firm);
  181. //对焦参数
  182. sFile.Register("Focus_Param", this.focusP);
  183. if (isStoring)
  184. {
  185. sFile.Serialize(true, xml, rootNode);
  186. }
  187. else
  188. {
  189. sFile.Serialize(false, xml, rootNode);
  190. this.is_Photograph = isPhotograph.value();
  191. this.m_pt = ptDepostion.value();
  192. this.m_ptTemp = ptELYFile.value();
  193. this.m_fibTemp = fibELYFile.value();
  194. this.m_fMode = focusmode.value();
  195. this.stretch_Magnification = Convert.ToSingle(stretchMagnification.value());
  196. this.location_Magnification = Convert.ToSingle(locationMagnification.value());
  197. this.location_Voltage = Convert.ToSingle(locationVoltage.value());
  198. this.photograph_Magnification = Convert.ToSingle(photographMagnification.value());
  199. this.photograph_Voltage = Convert.ToSingle(photographVoltage.value());
  200. this.correction_Angle = Convert.ToSingle(correctionAngle.value());
  201. this.m_SampleName = sampleType.value();
  202. this.firm = _firm.value();
  203. }
  204. }
  205. }
  206. }