COTSImageScanParam.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Xml;
  7. using static OTSDataType.otsdataconst;
  8. namespace OTSDataType
  9. {
  10. public class COTSImgScanPrm : ISlo
  11. {
  12. private OTS_MEASURE_STOP_MODE m_nStopMode;
  13. private int m_nStopParamMeasTime;
  14. private int m_nStopParamFields;
  15. private int m_nStopParamParticles;
  16. private OTS_GET_IMAGE_MODE m_nSatrtImageMode;
  17. private OTS_THREE_TIES_OPTIONS m_nScanImageSpeed;
  18. private OTS_FIVE_TIES_OPTIONS m_nImagePixelSize;
  19. private OTS_MEASURE_FIELD_STOP_MODE m_nFieldStopMode;
  20. private int m_nFieldAreaPercentage;
  21. private int m_nFieldLargeParticles;
  22. private int m_nFieldLargeParticlesPercentage;
  23. private int m_nFieldSmallParticles;
  24. private int m_nFieldSmallParticlesPercentage;
  25. private bool m_nShowStopMode = true;
  26. private bool m_nShowMeasTime = true;
  27. private bool m_nShowParamFields = true;
  28. private bool m_nShowParticles = true;
  29. private bool m_nShowStartImageMode = true;
  30. private bool m_nShowImageSpeed = true;
  31. private bool m_nShowPixelSize = true;
  32. const OTS_MEASURE_STOP_MODE DEFUALT_MEASURE_STOP_MODE = OTS_MEASURE_STOP_MODE.CoverMode;
  33. // stop parameters
  34. const int DEFUALT_PARAM_FIELD = 500;
  35. const int DEFUALT_PARAM_TIME = 300;
  36. const int DEFUALT_PARAM_PARTICLE = 5000;
  37. // image mode
  38. const OTS_GET_IMAGE_MODE DEFAULT_IMAGEMODE = OTS_GET_IMAGE_MODE.FROM_CENTER;
  39. // scan speed
  40. const OTS_THREE_TIES_OPTIONS DEFAULE_SCAN_SPEED = OTS_THREE_TIES_OPTIONS.TIE2;
  41. // image size
  42. const OTS_FIVE_TIES_OPTIONS DEFAULE_IMAGE_SIZE = OTS_FIVE_TIES_OPTIONS.TIE3;
  43. void Init()
  44. {
  45. m_nStopMode = DEFUALT_MEASURE_STOP_MODE; //测量终止方式
  46. m_nStopParamMeasTime = DEFUALT_PARAM_TIME; //测量时间
  47. m_nStopParamFields = DEFUALT_PARAM_FIELD; //帧图数
  48. m_nStopParamParticles = DEFUALT_PARAM_PARTICLE; //夹杂物数
  49. m_nSatrtImageMode = DEFAULT_IMAGEMODE; //取图方式
  50. m_nScanImageSpeed = DEFAULE_SCAN_SPEED;
  51. m_nImagePixelSize = DEFAULE_IMAGE_SIZE;
  52. m_nFieldStopMode = OTS_MEASURE_FIELD_STOP_MODE.ParticlesPercentage;
  53. m_nFieldAreaPercentage = 100;
  54. m_nFieldLargeParticles = 1000;
  55. m_nFieldLargeParticlesPercentage = 100;
  56. m_nFieldSmallParticles = 10000;
  57. m_nFieldSmallParticlesPercentage = 100;
  58. }
  59. public COTSImgScanPrm ()
  60. {
  61. // copy data over
  62. Init();
  63. }
  64. void Duplicate( COTSImgScanPrm a_oSource)
  65. {
  66. // copy data over
  67. m_nStopMode = a_oSource.m_nStopMode;
  68. m_nStopParamMeasTime = a_oSource.m_nStopParamMeasTime;
  69. m_nStopParamFields = a_oSource.m_nStopParamFields;
  70. m_nStopParamParticles = a_oSource.m_nStopParamParticles;
  71. m_nSatrtImageMode = a_oSource.m_nSatrtImageMode;
  72. m_nImagePixelSize = a_oSource.m_nImagePixelSize;
  73. m_nScanImageSpeed = a_oSource.m_nScanImageSpeed;
  74. m_nFieldStopMode = a_oSource.m_nFieldStopMode;
  75. m_nFieldAreaPercentage = a_oSource.m_nFieldAreaPercentage;
  76. m_nFieldLargeParticles = a_oSource.m_nFieldLargeParticles;
  77. m_nFieldLargeParticlesPercentage = a_oSource.m_nFieldLargeParticlesPercentage;
  78. m_nFieldSmallParticles = a_oSource.m_nFieldSmallParticles;
  79. m_nFieldSmallParticlesPercentage = a_oSource.m_nFieldSmallParticlesPercentage;
  80. m_nShowStopMode = a_oSource.m_nShowStopMode;
  81. m_nShowMeasTime = a_oSource.m_nShowMeasTime;
  82. m_nShowParamFields = a_oSource.m_nShowParamFields;
  83. m_nShowParticles = a_oSource.m_nShowParticles;
  84. m_nShowStartImageMode = a_oSource.m_nShowStartImageMode;
  85. m_nShowImageSpeed = a_oSource.m_nShowImageSpeed;
  86. m_nShowPixelSize = a_oSource.m_nShowPixelSize;
  87. }
  88. public COTSImgScanPrm ( COTSImgScanPrm a_oSource)
  89. {
  90. // copy data over
  91. Duplicate(a_oSource);
  92. }
  93. public bool Equals(COTSImgScanPrm a_oSource)
  94. {
  95. // return test result
  96. return((m_nStopMode == a_oSource.m_nStopMode) &&
  97. (m_nStopParamMeasTime == a_oSource.m_nStopParamMeasTime) &&
  98. (m_nStopParamFields == a_oSource.m_nStopParamFields) &&
  99. (m_nStopParamParticles == a_oSource.m_nStopParamParticles) &&
  100. (m_nSatrtImageMode == a_oSource.m_nSatrtImageMode) &&
  101. (m_nImagePixelSize == a_oSource.m_nImagePixelSize));
  102. }
  103. //测量终止方式
  104. public OTS_MEASURE_STOP_MODE GetStopMode() { return m_nStopMode; }
  105. public void SetStopMode(OTS_MEASURE_STOP_MODE a_nStopMode) { m_nStopMode = a_nStopMode; }
  106. //测量时间
  107. public int GetStopParamMeasTime() { return m_nStopParamMeasTime; }
  108. public void SetStopParamMeasTime(int a_nStopParamMeasTime) { m_nStopParamMeasTime = a_nStopParamMeasTime; }
  109. //帧图数
  110. public int GetStopParamFields() { return m_nStopParamFields; }
  111. public void SetStopParamFields(int a_nStopParamFields) { m_nStopParamFields = a_nStopParamFields; }
  112. //夹杂物数
  113. public int GetStopParamParticles() { return m_nStopParamParticles; }
  114. public void SetStopParamParticles(int a_nStopParamParticles) { m_nStopParamParticles = a_nStopParamParticles; }
  115. //测量帧终止方式
  116. public OTS_MEASURE_FIELD_STOP_MODE GetFieldStopMode() { return m_nFieldStopMode; }
  117. public void SetFieldStopMode(OTS_MEASURE_FIELD_STOP_MODE a_nFieldStopMode) { m_nFieldStopMode = a_nFieldStopMode; }
  118. //帧完成面积百分比
  119. public int GetFieldAreaPercentage() { return m_nFieldAreaPercentage; }
  120. public void SetFieldAreaPercentage(int a_nAreaPercentage) { m_nFieldAreaPercentage = a_nAreaPercentage; }
  121. //帧完成大颗粒数
  122. public int GetFieldLargeParticleNum() { return m_nFieldLargeParticles; }
  123. public void SetFieldLargeParticleNum(int a_nLargeParticles) { m_nFieldLargeParticles = a_nLargeParticles; }
  124. //帧完成大颗粒百分比
  125. public int GetFieldLargeParticlesPercentage() { return m_nFieldLargeParticlesPercentage; }
  126. public void SetFieldLargeParticlePercentage(int a_nLargeParticlesPercentage) { m_nFieldLargeParticlesPercentage = a_nLargeParticlesPercentage; }
  127. //帧完成小颗粒数
  128. public int GetFieldSmallParticleNum() { return m_nFieldSmallParticles; }
  129. public void SetFieldSmallParticleNum(int a_nSmallParticles) { m_nFieldSmallParticles = a_nSmallParticles; }
  130. //帧完成小颗粒数百分比
  131. public int GetFieldSmallParticlesPercentage() { return m_nFieldSmallParticlesPercentage; }
  132. public void SetFieldSmallParticlePercentage(int a_nSmallParticlesPercentage) { m_nFieldSmallParticlesPercentage = a_nSmallParticlesPercentage; }
  133. //取图方式
  134. public OTS_GET_IMAGE_MODE GetFieldStartMode() { return m_nSatrtImageMode; }
  135. public void SetStartImageMode(OTS_GET_IMAGE_MODE a_nSatrtImageMode) { m_nSatrtImageMode = a_nSatrtImageMode; }
  136. //扫描图尺寸
  137. public OTS_FIVE_TIES_OPTIONS GetImagePixelSize() { return m_nImagePixelSize; }
  138. public void SetImagePixelSize(OTS_FIVE_TIES_OPTIONS a_nImagePixelSize) { m_nImagePixelSize = a_nImagePixelSize; }
  139. //扫描图精度
  140. public OTS_THREE_TIES_OPTIONS GetScanImageSpeed() { return m_nScanImageSpeed; }
  141. public void SetScanImageSpeed(OTS_THREE_TIES_OPTIONS a_nScanImageSpeed) { m_nScanImageSpeed = a_nScanImageSpeed; }
  142. public void SetShowStopMode(bool a_nShowStopMode) { m_nShowStopMode = a_nShowStopMode; }
  143. public bool GetShowStopMode() { return m_nShowStopMode; }
  144. public void SetShowMeasTime(bool a_nShowMeasTime) { m_nShowMeasTime = a_nShowMeasTime; }
  145. public bool GetShowMeasTime() { return m_nShowMeasTime; }
  146. public void SetShowParamFields(bool a_nShowParamFields) { m_nShowParamFields = a_nShowParamFields; }
  147. public bool GetShowParamFields() { return m_nShowParamFields; }
  148. public void SetShowParticles(bool a_nShowParticles) { m_nShowParticles = a_nShowParticles; }
  149. public bool GetShowParticles() { return m_nShowParticles; }
  150. public void SetShowStartImageMode(bool a_nShowStartImageMode) { m_nShowStartImageMode = a_nShowStartImageMode; }
  151. public bool GetShowStartImageMode() { return m_nShowStartImageMode; }
  152. public void SetShowImageSpeed(bool a_nShowImageSpeed) { m_nShowImageSpeed = a_nShowImageSpeed; }
  153. public bool GetShowImageSpeed() { return m_nShowImageSpeed; }
  154. public void SetShowPixelSize(bool a_nShowPixelSize) { m_nShowPixelSize = a_nShowPixelSize; }
  155. public bool GetShowPixelSize() { return m_nShowPixelSize; }
  156. public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
  157. {
  158. xInt xnStopMode=new xInt();
  159. xInt xnStopParamMeasTime=new xInt();
  160. xInt xnStopParamFields = new xInt();
  161. xInt xnStopParamParticles = new xInt();
  162. xInt xnSatrtImageMode = new xInt();
  163. xInt xnScanImageSpeed = new xInt();
  164. xInt xnImagePixelSize = new xInt();
  165. xInt xnFieldStopMode = new xInt();
  166. xInt xnFieldAreaPercentage = new xInt();
  167. xInt xnFieldLargeParticles = new xInt();
  168. xInt xnFieldLargeParticlePercentage = new xInt();
  169. xInt xnFieldSmallParticles = new xInt();
  170. xInt xnFieldSmallParticlePercentage = new xInt();
  171. xBool xbShowStopMode = new xBool();
  172. xBool xbShowMeasTime = new xBool();
  173. xBool xbShowParamFields = new xBool();
  174. xBool xbShowParticles = new xBool();
  175. xBool xbShowStartImageMode = new xBool();
  176. xBool xbShowImageSpeed = new xBool();
  177. xBool xbShowPixelSize = new xBool();
  178. Slo slo=new Slo();
  179. slo.Register("StopMode", xnStopMode);
  180. slo.Register("StopParamMeasTime", xnStopParamMeasTime);
  181. slo.Register("StopParamFields", xnStopParamFields);
  182. slo.Register("StopParamParticles", xnStopParamParticles);
  183. slo.Register("SatrtImageMode", xnSatrtImageMode);
  184. slo.Register("ScanImageSpeed", xnScanImageSpeed);
  185. slo.Register("ImagePixelSize", xnImagePixelSize);
  186. slo.Register("FieldStopMode", xnFieldStopMode);
  187. slo.Register("FieldAreaPercentage", xnFieldAreaPercentage);
  188. slo.Register("FieldLargeParticles", xnFieldLargeParticles);
  189. slo.Register("FieldLargeParticlePercentage", xnFieldLargeParticlePercentage);
  190. slo.Register("FieldSmallParticles", xnFieldSmallParticles);
  191. slo.Register("FieldSmallParticlePercentage", xnFieldSmallParticlePercentage);
  192. slo.Register("ShowStopMode", xbShowStopMode);
  193. slo.Register("ShowMeasTime", xbShowMeasTime);
  194. slo.Register("ShowParamFields", xbShowParamFields);
  195. slo.Register("ShowParticles", xbShowParticles);
  196. slo.Register("ShowStartImageMode", xbShowStartImageMode);
  197. slo.Register("ShowImageSpeed", xbShowImageSpeed);
  198. slo.Register("ShowPixelSize", xbShowPixelSize);
  199. if (isStoring)
  200. {
  201. xnStopMode.AssignValue((int)m_nStopMode);
  202. xnStopParamMeasTime.AssignValue((int) m_nStopParamMeasTime);
  203. xnStopParamFields.AssignValue((int)m_nStopParamFields);
  204. xnStopParamParticles.AssignValue((int)m_nStopParamParticles);
  205. xnSatrtImageMode.AssignValue((int)m_nSatrtImageMode);
  206. xnScanImageSpeed.AssignValue( (int)m_nScanImageSpeed);
  207. xnImagePixelSize.AssignValue( (int)m_nImagePixelSize);
  208. xnFieldStopMode.AssignValue((int)m_nFieldStopMode);
  209. xnFieldSmallParticles.AssignValue((int)m_nFieldSmallParticles);
  210. xnFieldSmallParticlePercentage .AssignValue((int)m_nFieldSmallParticlesPercentage);
  211. xbShowStopMode.AssignValue(m_nShowStopMode);
  212. xbShowMeasTime.AssignValue(m_nShowMeasTime);
  213. xbShowParamFields.AssignValue(m_nShowParamFields);
  214. xbShowParticles.AssignValue(m_nShowParticles);
  215. xbShowStartImageMode.AssignValue(m_nShowStartImageMode);
  216. xbShowImageSpeed.AssignValue(m_nShowImageSpeed);
  217. xbShowPixelSize.AssignValue(m_nShowPixelSize);
  218. slo.Serialize(true, classDoc, rootNode);
  219. }
  220. else
  221. {
  222. slo.Serialize(false, classDoc, rootNode);
  223. m_nStopMode = (OTS_MEASURE_STOP_MODE)xnStopMode.value();
  224. m_nStopParamMeasTime = xnStopParamMeasTime.value();
  225. m_nStopParamFields = xnStopParamFields.value();
  226. m_nStopParamParticles = xnStopParamParticles.value();
  227. m_nSatrtImageMode = (OTS_GET_IMAGE_MODE)xnSatrtImageMode.value();
  228. m_nScanImageSpeed = (OTS_THREE_TIES_OPTIONS)xnScanImageSpeed.value();
  229. m_nImagePixelSize = (OTS_FIVE_TIES_OPTIONS)xnImagePixelSize.value();
  230. m_nFieldStopMode = (OTS_MEASURE_FIELD_STOP_MODE)xnFieldStopMode.value();
  231. m_nFieldAreaPercentage = xnFieldAreaPercentage.value();
  232. m_nFieldLargeParticles = xnFieldLargeParticles.value();
  233. m_nFieldLargeParticlesPercentage = xnFieldLargeParticlePercentage.value();
  234. m_nFieldSmallParticles = xnFieldSmallParticles.value();
  235. m_nFieldSmallParticlesPercentage = xnFieldSmallParticlePercentage.value();
  236. m_nShowStopMode = xbShowStopMode.value();
  237. m_nShowMeasTime = xbShowMeasTime.value();
  238. m_nShowParamFields = xbShowParamFields.value();
  239. m_nShowParticles = xbShowParticles.value();
  240. m_nShowStartImageMode = xbShowStartImageMode.value();
  241. m_nShowImageSpeed = xbShowImageSpeed.value();
  242. m_nShowPixelSize = xbShowPixelSize.value();
  243. }
  244. }
  245. }
  246. }