COTSImageScanParam.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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. const OTS_MEASURE_STOP_MODE DEFUALT_MEASURE_STOP_MODE = OTS_MEASURE_STOP_MODE.CoverMode;
  26. // stop parameters
  27. const int DEFUALT_PARAM_FIELD = 500;
  28. const int DEFUALT_PARAM_TIME = 300;
  29. const int DEFUALT_PARAM_PARTICLE = 5000;
  30. // image mode
  31. const OTS_GET_IMAGE_MODE DEFAULT_IMAGEMODE = OTS_GET_IMAGE_MODE.FROM_CENTER;
  32. // scan speed
  33. const OTS_THREE_TIES_OPTIONS DEFAULE_SCAN_SPEED = OTS_THREE_TIES_OPTIONS.TIE2;
  34. // image size
  35. const OTS_FIVE_TIES_OPTIONS DEFAULE_IMAGE_SIZE = OTS_FIVE_TIES_OPTIONS.TIE3;
  36. void Init()
  37. {
  38. m_nStopMode = DEFUALT_MEASURE_STOP_MODE; //测量终止方式
  39. m_nStopParamMeasTime = DEFUALT_PARAM_TIME; //测量时间
  40. m_nStopParamFields = DEFUALT_PARAM_FIELD; //帧图数
  41. m_nStopParamParticles = DEFUALT_PARAM_PARTICLE; //夹杂物数
  42. m_nSatrtImageMode = DEFAULT_IMAGEMODE; //取图方式
  43. m_nScanImageSpeed = DEFAULE_SCAN_SPEED;
  44. m_nImagePixelSize = DEFAULE_IMAGE_SIZE;
  45. m_nFieldStopMode = OTS_MEASURE_FIELD_STOP_MODE.ParticlesPercentage;
  46. m_nFieldAreaPercentage = 100;
  47. m_nFieldLargeParticles = 1000;
  48. m_nFieldLargeParticlesPercentage = 100;
  49. m_nFieldSmallParticles = 10000;
  50. m_nFieldSmallParticlesPercentage = 100;
  51. }
  52. public COTSImgScanPrm ()
  53. {
  54. // copy data over
  55. Init();
  56. }
  57. void Duplicate( COTSImgScanPrm a_oSource)
  58. {
  59. // copy data over
  60. m_nStopMode = a_oSource.m_nStopMode;
  61. m_nStopParamMeasTime = a_oSource.m_nStopParamMeasTime;
  62. m_nStopParamFields = a_oSource.m_nStopParamFields;
  63. m_nStopParamParticles = a_oSource.m_nStopParamParticles;
  64. m_nSatrtImageMode = a_oSource.m_nSatrtImageMode;
  65. m_nImagePixelSize = a_oSource.m_nImagePixelSize;
  66. m_nScanImageSpeed = a_oSource.m_nScanImageSpeed;
  67. m_nFieldStopMode = a_oSource.m_nFieldStopMode;
  68. m_nFieldAreaPercentage = a_oSource.m_nFieldAreaPercentage;
  69. m_nFieldLargeParticles = a_oSource.m_nFieldLargeParticles;
  70. m_nFieldLargeParticlesPercentage = a_oSource.m_nFieldLargeParticlesPercentage;
  71. m_nFieldSmallParticles = a_oSource.m_nFieldSmallParticles;
  72. m_nFieldSmallParticlesPercentage = a_oSource.m_nFieldSmallParticlesPercentage;
  73. }
  74. public COTSImgScanPrm ( COTSImgScanPrm a_oSource)
  75. {
  76. // copy data over
  77. Duplicate(a_oSource);
  78. }
  79. public bool Equals(COTSImgScanPrm a_oSource)
  80. {
  81. // return test result
  82. return((m_nStopMode == a_oSource.m_nStopMode) &&
  83. (m_nStopParamMeasTime == a_oSource.m_nStopParamMeasTime) &&
  84. (m_nStopParamFields == a_oSource.m_nStopParamFields) &&
  85. (m_nStopParamParticles == a_oSource.m_nStopParamParticles) &&
  86. (m_nSatrtImageMode == a_oSource.m_nSatrtImageMode) &&
  87. (m_nImagePixelSize == a_oSource.m_nImagePixelSize));
  88. }
  89. //测量终止方式
  90. public OTS_MEASURE_STOP_MODE GetStopMode() { return m_nStopMode; }
  91. public void SetStopMode(OTS_MEASURE_STOP_MODE a_nStopMode) { m_nStopMode = a_nStopMode; }
  92. //测量时间
  93. public int GetStopParamMeasTime() { return m_nStopParamMeasTime; }
  94. public void SetStopParamMeasTime(int a_nStopParamMeasTime) { m_nStopParamMeasTime = a_nStopParamMeasTime; }
  95. //帧图数
  96. public int GetStopParamFields() { return m_nStopParamFields; }
  97. public void SetStopParamFields(int a_nStopParamFields) { m_nStopParamFields = a_nStopParamFields; }
  98. //夹杂物数
  99. public int GetStopParamParticles() { return m_nStopParamParticles; }
  100. public void SetStopParamParticles(int a_nStopParamParticles) { m_nStopParamParticles = a_nStopParamParticles; }
  101. //测量帧终止方式
  102. public OTS_MEASURE_FIELD_STOP_MODE GetFieldStopMode() { return m_nFieldStopMode; }
  103. public void SetFieldStopMode(OTS_MEASURE_FIELD_STOP_MODE a_nFieldStopMode) { m_nFieldStopMode = a_nFieldStopMode; }
  104. //帧完成面积百分比
  105. public int GetFieldAreaPercentage() { return m_nFieldAreaPercentage; }
  106. public void SetFieldAreaPercentage(int a_nAreaPercentage) { m_nFieldAreaPercentage = a_nAreaPercentage; }
  107. //帧完成大颗粒数
  108. public int GetFieldLargeParticleNum() { return m_nFieldLargeParticles; }
  109. public void SetFieldLargeParticleNum(int a_nLargeParticles) { m_nFieldLargeParticles = a_nLargeParticles; }
  110. //帧完成大颗粒百分比
  111. public int GetFieldLargeParticlesPercentage() { return m_nFieldLargeParticlesPercentage; }
  112. public void SetFieldLargeParticlePercentage(int a_nLargeParticlesPercentage) { m_nFieldLargeParticlesPercentage = a_nLargeParticlesPercentage; }
  113. //帧完成小颗粒数
  114. public int GetFieldSmallParticleNum() { return m_nFieldSmallParticles; }
  115. public void SetFieldSmallParticleNum(int a_nSmallParticles) { m_nFieldSmallParticles = a_nSmallParticles; }
  116. //帧完成小颗粒数百分比
  117. public int GetFieldSmallParticlesPercentage() { return m_nFieldSmallParticlesPercentage; }
  118. public void SetFieldSmallParticlePercentage(int a_nSmallParticlesPercentage) { m_nFieldSmallParticlesPercentage = a_nSmallParticlesPercentage; }
  119. //取图方式
  120. public OTS_GET_IMAGE_MODE GetFieldStartMode() { return m_nSatrtImageMode; }
  121. public void SetStartImageMode(OTS_GET_IMAGE_MODE a_nSatrtImageMode) { m_nSatrtImageMode = a_nSatrtImageMode; }
  122. //扫描图尺寸
  123. public OTS_FIVE_TIES_OPTIONS GetImagePixelSize() { return m_nImagePixelSize; }
  124. public void SetImagePixelSize(OTS_FIVE_TIES_OPTIONS a_nImagePixelSize) { m_nImagePixelSize = a_nImagePixelSize; }
  125. //扫描图精度
  126. public OTS_THREE_TIES_OPTIONS GetScanImageSpeed() { return m_nScanImageSpeed; }
  127. public void SetScanImageSpeed(OTS_THREE_TIES_OPTIONS a_nScanImageSpeed) { m_nScanImageSpeed = a_nScanImageSpeed; }
  128. public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
  129. {
  130. xInt xnStopMode=new xInt();
  131. xInt xnStopParamMeasTime=new xInt();
  132. xInt xnStopParamFields = new xInt();
  133. xInt xnStopParamParticles = new xInt();
  134. xInt xnSatrtImageMode = new xInt();
  135. xInt xnScanImageSpeed = new xInt();
  136. xInt xnImagePixelSize = new xInt();
  137. xInt xnFieldStopMode = new xInt();
  138. xInt xnFieldAreaPercentage = new xInt();
  139. xInt xnFieldLargeParticles = new xInt();
  140. xInt xnFieldLargeParticlePercentage = new xInt();
  141. xInt xnFieldSmallParticles = new xInt();
  142. xInt xnFieldSmallParticlePercentage = new xInt();
  143. Slo slo=new Slo();
  144. slo.Register("StopMode", xnStopMode);
  145. slo.Register("StopParamMeasTime", xnStopParamMeasTime);
  146. slo.Register("StopParamFields", xnStopParamFields);
  147. slo.Register("StopParamParticles", xnStopParamParticles);
  148. slo.Register("SatrtImageMode", xnSatrtImageMode);
  149. slo.Register("ScanImageSpeed", xnScanImageSpeed);
  150. slo.Register("ImagePixelSize", xnImagePixelSize);
  151. slo.Register("FieldStopMode", xnFieldStopMode);
  152. slo.Register("FieldAreaPercentage", xnFieldAreaPercentage);
  153. slo.Register("FieldLargeParticles", xnFieldLargeParticles);
  154. slo.Register("FieldLargeParticlePercentage", xnFieldLargeParticlePercentage);
  155. slo.Register("FieldSmallParticles", xnFieldSmallParticles);
  156. slo.Register("FieldSmallParticlePercentage", xnFieldSmallParticlePercentage);
  157. if (isStoring)
  158. {
  159. xnStopMode.AssignValue((int)m_nStopMode);
  160. xnStopParamMeasTime.AssignValue((int) m_nStopParamMeasTime);
  161. xnStopParamFields.AssignValue((int)m_nStopParamFields);
  162. xnStopParamParticles.AssignValue((int)m_nStopParamParticles);
  163. xnSatrtImageMode.AssignValue((int)m_nSatrtImageMode);
  164. xnScanImageSpeed.AssignValue( (int)m_nScanImageSpeed);
  165. xnImagePixelSize.AssignValue( (int)m_nImagePixelSize);
  166. xnFieldStopMode.AssignValue((int)m_nFieldStopMode);
  167. xnFieldSmallParticles.AssignValue((int)m_nFieldSmallParticles);
  168. xnFieldSmallParticlePercentage .AssignValue((int)m_nFieldSmallParticlesPercentage);
  169. slo.Serialize(true, classDoc, rootNode);
  170. }
  171. else
  172. {
  173. slo.Serialize(false, classDoc, rootNode);
  174. m_nStopMode = (OTS_MEASURE_STOP_MODE)xnStopMode.value();
  175. m_nStopParamMeasTime = xnStopParamMeasTime.value();
  176. m_nStopParamFields = xnStopParamFields.value();
  177. m_nStopParamParticles = xnStopParamParticles.value();
  178. m_nSatrtImageMode = (OTS_GET_IMAGE_MODE)xnSatrtImageMode.value();
  179. m_nScanImageSpeed = (OTS_THREE_TIES_OPTIONS)xnScanImageSpeed.value();
  180. m_nImagePixelSize = (OTS_FIVE_TIES_OPTIONS)xnImagePixelSize.value();
  181. m_nFieldStopMode = (OTS_MEASURE_FIELD_STOP_MODE)xnFieldStopMode.value();
  182. m_nFieldAreaPercentage = xnFieldAreaPercentage.value();
  183. m_nFieldLargeParticles = xnFieldLargeParticles.value();
  184. m_nFieldLargeParticlesPercentage = xnFieldLargeParticlePercentage.value();
  185. m_nFieldSmallParticles = xnFieldSmallParticles.value();
  186. m_nFieldSmallParticlesPercentage = xnFieldSmallParticlePercentage.value();
  187. }
  188. }
  189. }
  190. }