OTSImageScanParam.cpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #include "stdafx.h"
  2. #include "OTSImageScanParam.h"
  3. namespace OTSIMGPROC
  4. {
  5. // constructor
  6. COTSImageScanParam::COTSImageScanParam()
  7. {
  8. Init();
  9. }
  10. // copy constructor
  11. COTSImageScanParam::COTSImageScanParam(const COTSImageScanParam& a_oSource)
  12. {
  13. // can't copy itself
  14. if (&a_oSource == this)
  15. {
  16. return;
  17. }
  18. // copy data over
  19. Duplicate(a_oSource);
  20. }
  21. // copy constructor
  22. COTSImageScanParam::COTSImageScanParam(COTSImageScanParam* a_poSource)
  23. {
  24. // input check
  25. ASSERT(a_poSource);
  26. if (!a_poSource)
  27. {
  28. return;
  29. }
  30. // can't copy itself
  31. if (a_poSource == this)
  32. {
  33. return;
  34. }
  35. // copy data over
  36. Duplicate(*a_poSource);
  37. }
  38. // =operator
  39. COTSImageScanParam& COTSImageScanParam::operator=(const COTSImageScanParam& a_oSource)
  40. {
  41. // cleanup
  42. Cleanup();
  43. // copy the class data over
  44. Duplicate(a_oSource);
  45. // return class
  46. return *this;
  47. }
  48. // ==operator
  49. BOOL COTSImageScanParam::operator==(const COTSImageScanParam& a_oSource)
  50. {
  51. // return test result
  52. return((m_nStopMode == a_oSource.m_nStopMode) &&
  53. (m_nStopParamMeasTime == a_oSource.m_nStopParamMeasTime) &&
  54. (m_nStopParamFields == a_oSource.m_nStopParamFields) &&
  55. (m_nStopParamParticles == a_oSource.m_nStopParamParticles) &&
  56. (m_nSatrtImageMode == a_oSource.m_nSatrtImageMode) &&
  57. (m_nImagePixelSize == a_oSource.m_nImagePixelSize));
  58. }
  59. // detractor
  60. COTSImageScanParam::~COTSImageScanParam()
  61. {
  62. Cleanup();
  63. }
  64. // COTSStageData member functions
  65. // serialization
  66. /*void COTSImageScanParam::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode)
  67. {
  68. xmls::xInt xnStopMode;
  69. xmls::xInt xnStopParamMeasTime;
  70. xmls::xInt xnStopParamFields;
  71. xmls::xInt xnStopParamParticles;
  72. xmls::xInt xnSatrtImageMode;
  73. xmls::xInt xnScanImageSpeed;
  74. xmls::xInt xnImagePixelSize;
  75. xmls::xBool xbShowStopMode = false;
  76. xmls::xBool xbShowMeasTime = false;
  77. xmls::xBool xbShowParamFields = false;
  78. xmls::xBool xbShowParticles = false;
  79. xmls::xBool xbShowStartImageMode = false;
  80. xmls::xBool xbShowImageSpeed = false;
  81. xmls::xBool xbShowPixelSize = false;
  82. xmls::Slo slo;
  83. slo.Register("StopMode", &xnStopMode);
  84. slo.Register("StopParamMeasTime", &xnStopParamMeasTime);
  85. slo.Register("StopParamFields", &xnStopParamFields);
  86. slo.Register("StopParamParticles", &xnStopParamParticles);
  87. slo.Register("SatrtImageMode", &xnSatrtImageMode);
  88. slo.Register("ScanImageSpeed", &xnScanImageSpeed);
  89. slo.Register("ImagePixelSize", &xnImagePixelSize);
  90. if (isStoring)
  91. {
  92. xnStopMode = (int)m_nStopMode;
  93. xnStopParamMeasTime = m_nStopParamMeasTime;
  94. xnStopParamFields = m_nStopParamFields;
  95. xnStopParamParticles = m_nStopParamParticles;
  96. xnSatrtImageMode = (int)m_nSatrtImageMode;
  97. xnScanImageSpeed = (int)m_nScanImageSpeed;
  98. xnImagePixelSize = (int)m_nImagePixelSize;
  99. slo.Serialize(true, classDoc, rootNode);
  100. }
  101. else
  102. {
  103. slo.Serialize(false, classDoc, rootNode);
  104. m_nStopMode = (OTS_MEASURE_STOP_MODE)xnStopMode.value();
  105. m_nStopParamMeasTime = xnStopParamMeasTime.value();
  106. m_nStopParamFields = xnStopParamFields.value();
  107. m_nSatrtImageMode = (OTS_GET_IMAGE_MODE)xnSatrtImageMode.value();
  108. m_nScanImageSpeed = (OTS_THREE_TIES_OPTIONS)xnScanImageSpeed.value();
  109. m_nImagePixelSize = (OTS_FIVE_TIES_OPTIONS)xnImagePixelSize.value();
  110. }
  111. }*/
  112. // cleanup
  113. void COTSImageScanParam::Cleanup()
  114. {
  115. // nothing needs to be done at the moment
  116. }
  117. // initialization
  118. void COTSImageScanParam::Init()
  119. {
  120. m_nStopMode = DEFUALT_MEASURE_STOP_MODE; //测量终止方式
  121. m_nStopParamMeasTime = DEFUALT_PARAM_TIME; //测量时间
  122. m_nStopParamFields = DEFUALT_PARAM_FIELD; //帧图数
  123. m_nStopParamParticles = DEFUALT_PARAM_PARTICLE; //夹杂物数
  124. m_nSatrtImageMode = DEFAULT_IMAGEMODE; //取图方式
  125. m_nScanImageSpeed = DEFAULE_SCAN_SPEED;
  126. m_nImagePixelSize = DEFAULE_IMAGE_SIZE;
  127. }
  128. // duplication
  129. void COTSImageScanParam::Duplicate(const COTSImageScanParam& a_oSource)
  130. {
  131. // initialization
  132. Init();
  133. // copy data over
  134. m_nStopMode = a_oSource.m_nStopMode;
  135. m_nStopParamMeasTime = a_oSource.m_nStopParamMeasTime;
  136. m_nStopParamFields = a_oSource.m_nStopParamFields;
  137. m_nStopParamParticles = a_oSource.m_nStopParamParticles;
  138. m_nSatrtImageMode = a_oSource.m_nSatrtImageMode;
  139. m_nImagePixelSize = a_oSource.m_nImagePixelSize;
  140. m_nScanImageSpeed = a_oSource.m_nScanImageSpeed;
  141. }
  142. }