OTSImageProcessParam.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #include "stdafx.h"
  2. #include "OTSImageProcessParam.h"
  3. namespace OTSIMGPROC
  4. {
  5. // constructor
  6. COTSImageProcessParam::COTSImageProcessParam()
  7. {
  8. Init();
  9. }
  10. // copy constructor
  11. COTSImageProcessParam::COTSImageProcessParam(const COTSImageProcessParam& 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. COTSImageProcessParam::COTSImageProcessParam(COTSImageProcessParam* 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. COTSImageProcessParam& COTSImageProcessParam::operator=(const COTSImageProcessParam& 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 COTSImageProcessParam::operator==(const COTSImageProcessParam& a_oSource)
  50. {
  51. // return test result
  52. return m_oIncArea == a_oSource.m_oIncArea &&
  53. m_oBGGray == a_oSource.m_oBGGray &&
  54. m_oParticleGray == a_oSource.m_oParticleGray;
  55. }
  56. // detractor
  57. COTSImageProcessParam::~COTSImageProcessParam()
  58. {
  59. Cleanup();
  60. }
  61. // COTSStageData member functions
  62. // serialization
  63. void COTSImageProcessParam::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode)
  64. {
  65. /*xmls::xBool xbShowAreaUp;
  66. xmls::xBool xbShowAreaDown;
  67. xmls::xBool xbShowBGGrayUp;
  68. xmls::xBool xbShowBGGrayDown;
  69. xmls::xBool xbShowParticleGrayUp;
  70. xmls::xBool xbShowParticleGrayDown;*/
  71. xmls::Slo slo;
  72. slo.Register("IncArea", &m_oIncArea);
  73. slo.Register("BGGray", &m_oBGGray);
  74. slo.Register("ParticleGray", &m_oParticleGray);
  75. if (isStoring)
  76. {
  77. slo.Serialize(true, classDoc, rootNode);
  78. }
  79. else
  80. {
  81. slo.Serialize(false, classDoc, rootNode);
  82. }
  83. }
  84. // cleanup
  85. void COTSImageProcessParam::Cleanup()
  86. {
  87. // nothing needs to be done at the moment
  88. }
  89. // initialization
  90. void COTSImageProcessParam::Init()
  91. {
  92. m_oIncArea = CDoubleRange(DEFUALT_PARTICALE_AREA_MIN, DEFUALT_PARTICALE_AREA_MAX);
  93. m_oBGGray = CIntRange(DEFUALT_BG_GRAY_LEVEL_MIN, DEFUALT_BG_GRAY_LEVEL_MAX);
  94. m_oParticleGray = CIntRange(DEFUALT_PARTICLE_GRAY_LEVEL_MIN, DEFUALT_PARTICLE_GRAY_LEVEL_MAX);
  95. }
  96. // duplication
  97. void COTSImageProcessParam::Duplicate(const COTSImageProcessParam& a_oSource)
  98. {
  99. // initialization
  100. Init();
  101. // copy data over
  102. m_oIncArea = a_oSource.m_oIncArea;
  103. m_oBGGray = a_oSource.m_oBGGray;
  104. m_oParticleGray = a_oSource.m_oParticleGray;
  105. }
  106. }