MeasureParam.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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. //FIB拍照时的放大倍数
  96. private float fib_Magnification;
  97. public float FIB_Magnification
  98. {
  99. get { return this.fib_Magnification; }
  100. set { this.fib_Magnification = value; }
  101. }
  102. //校正角度选择
  103. private float correction_Angle;
  104. public float Correction_Angle
  105. {
  106. get { return this.correction_Angle; }
  107. set { this.correction_Angle = value; }
  108. }
  109. //厂商
  110. private String firm;
  111. public String Firm
  112. {
  113. get { return this.firm; }
  114. set { this.firm = value; }
  115. }
  116. //对焦参数
  117. private FocusParam focusP;
  118. public FocusParam AutoFocus
  119. {
  120. get { return this.focusP; }
  121. set { this.focusP = value; }
  122. }
  123. //能谱参数
  124. #endregion
  125. //构造函数
  126. public MeasureParam()
  127. {
  128. Init();
  129. }
  130. public void Init()
  131. {
  132. this.SampleName = @"";
  133. this.PT = false;
  134. this.FIBTemp = @"";
  135. this.PTTemp = @"";
  136. this.FocusMode = 2;
  137. this.AutoFocus = new FocusParam();
  138. }
  139. //XML文件保存测量参数
  140. public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
  141. {
  142. Slo sFile = new Slo();
  143. //是否拍照和PT
  144. xBool isPhotograph = new xBool();
  145. xBool ptDepostion = new xBool();
  146. isPhotograph.AssignValue(this.is_Photograph);
  147. ptDepostion.AssignValue(this.m_pt);
  148. sFile.Register("Is_Photograph", isPhotograph);
  149. sFile.Register("PT_Depostion", ptDepostion);
  150. //ELY文件
  151. xString ptELYFile = new xString();
  152. xString fibELYFile = new xString();
  153. ptELYFile.AssignValue(this.m_ptTemp);
  154. fibELYFile.AssignValue(this.m_fibTemp);
  155. sFile.Register("PT_ELYFile", ptELYFile);
  156. sFile.Register("FIB_ELYFile", fibELYFile);
  157. //对焦方式
  158. xInt focusmode = new xInt();
  159. focusmode.AssignValue(this.m_fMode);
  160. sFile.Register("FocusMode", focusmode);
  161. //放大倍数和电压参数
  162. xDouble stretchMagnification = new xDouble();
  163. xDouble locationMagnification = new xDouble();
  164. xDouble locationVoltage = new xDouble();
  165. xDouble photographMagnification = new xDouble();
  166. xDouble photographVoltage = new xDouble();
  167. xDouble fibMagnification = new xDouble();
  168. stretchMagnification.AssignValue(this.stretch_Magnification);
  169. locationMagnification.AssignValue(this.location_Magnification);
  170. locationVoltage.AssignValue(this.location_Voltage);
  171. photographMagnification.AssignValue(this.photograph_Magnification);
  172. photographVoltage.AssignValue(this.photograph_Voltage);
  173. fibMagnification.AssignValue(this.fib_Magnification);
  174. sFile.Register("Strectch_Magnification", stretchMagnification);
  175. sFile.Register("Locatio_Magnification", locationMagnification);
  176. sFile.Register("Location_Voltage", locationVoltage);
  177. sFile.Register("Photograph_Magnification", photographMagnification);
  178. sFile.Register("Photograph_Voltage", photographVoltage);
  179. sFile.Register("FIB_Magnification", fibMagnification);
  180. //校正角度
  181. xDouble correctionAngle = new xDouble();
  182. correctionAngle.AssignValue(this.correction_Angle);
  183. sFile.Register("Correction_Angle", correctionAngle);
  184. //样品名称和厂商
  185. xString sampleType = new xString();
  186. xString _firm = new xString();
  187. sampleType.AssignValue(this.m_SampleName);
  188. _firm.AssignValue(this.firm);
  189. sFile.Register("Sample_Type", sampleType);
  190. sFile.Register("Firm", _firm);
  191. //对焦参数
  192. sFile.Register("Focus_Param", this.focusP);
  193. if (isStoring)
  194. {
  195. sFile.Serialize(true, xml, rootNode);
  196. }
  197. else
  198. {
  199. sFile.Serialize(false, xml, rootNode);
  200. this.is_Photograph = isPhotograph.value();
  201. this.m_pt = ptDepostion.value();
  202. this.m_ptTemp = ptELYFile.value();
  203. this.m_fibTemp = fibELYFile.value();
  204. this.m_fMode = focusmode.value();
  205. this.stretch_Magnification = Convert.ToSingle(stretchMagnification.value());
  206. this.location_Magnification = Convert.ToSingle(locationMagnification.value());
  207. this.location_Voltage = Convert.ToSingle(locationVoltage.value());
  208. this.photograph_Magnification = Convert.ToSingle(photographMagnification.value());
  209. this.photograph_Voltage = Convert.ToSingle(photographVoltage.value());
  210. this.correction_Angle = Convert.ToSingle(correctionAngle.value());
  211. this.m_SampleName = sampleType.value();
  212. this.firm = _firm.value();
  213. }
  214. }
  215. }
  216. }