HoleBSEImg.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #include "stdafx.h"
  2. #include "HoleBSEImg.h"
  3. namespace OTSDATA {
  4. IMPLEMENT_SERIAL(CHoleBSEImg, CObject, 1)
  5. CHoleBSEImg::CHoleBSEImg()
  6. {
  7. Init();
  8. }
  9. CHoleBSEImg::CHoleBSEImg(CRect a_rectImage, int a_nHoleID, CPoint a_poiPosition) // constructor
  10. {
  11. Init();
  12. // set image rectangle and create memory for image data
  13. SetImageRect(a_rectImage);
  14. m_nHoleID = a_nHoleID;
  15. m_poiPosition = a_poiPosition;
  16. }
  17. CHoleBSEImg::CHoleBSEImg(const CHoleBSEImg& a_oSource) // copy constructor
  18. {
  19. // can't copy itself
  20. if (&a_oSource == this)
  21. {
  22. return;
  23. }
  24. // copy data over
  25. Duplicate(a_oSource);
  26. }
  27. CHoleBSEImg::CHoleBSEImg(CHoleBSEImg* a_poSource) // copy constructor
  28. {
  29. // input check
  30. ASSERT(a_poSource);
  31. if (!a_poSource)
  32. {
  33. return;
  34. }
  35. // can't copy itself
  36. if (a_poSource == this)
  37. {
  38. return;
  39. }
  40. // copy data over
  41. Duplicate(*a_poSource);
  42. }
  43. CHoleBSEImg& CHoleBSEImg::operator=(const CHoleBSEImg& a_oSource) // =operator
  44. {
  45. // cleanup
  46. Cleanup();
  47. // copy the class data over
  48. Duplicate(a_oSource);
  49. // return class
  50. return *this;
  51. }
  52. CHoleBSEImg::~CHoleBSEImg()
  53. {
  54. // cleanup
  55. Cleanup();
  56. }
  57. // sterilizations
  58. void CHoleBSEImg::Serialize(CArchive& ar)
  59. {
  60. // store?
  61. if (ar.IsStoring())
  62. {
  63. // store
  64. ar << m_nHoleID;
  65. ar << m_poiPosition;
  66. }
  67. else
  68. {
  69. // load
  70. ar >> m_nHoleID;
  71. ar >> m_poiPosition;
  72. }
  73. // base object serialization
  74. CBSEImg::Serialize(ar);
  75. }
  76. /*void CHoleBSEImg::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode)
  77. {
  78. xmls::xInt xnHoleID;
  79. xmls::xPoint xpoiPosition;
  80. Register("HoleID", &xnHoleID);
  81. Register("Position", &xpoiPosition);
  82. if (isStoring)
  83. {
  84. xnHoleID = m_nHoleID;
  85. xpoiPosition = m_poiPosition;
  86. Slo::Serialize(true, classDoc, rootNode);
  87. }
  88. else
  89. {
  90. xmls::Slo::Serialize(false, classDoc, rootNode);
  91. m_nHoleID = xnHoleID.value();
  92. m_poiPosition = xpoiPosition.value();
  93. }
  94. }*/
  95. // cleanup
  96. void CHoleBSEImg::Cleanup()
  97. {
  98. }
  99. // Initialization
  100. void CHoleBSEImg::Init()
  101. {
  102. // base class initialization
  103. CBSEImg::Init();
  104. // initialization
  105. m_nHoleID = 0;
  106. m_poiPosition = CPoint(0, 0);
  107. }
  108. // duplication
  109. void CHoleBSEImg::Duplicate(const CHoleBSEImg& a_oSource)
  110. {
  111. // initialization
  112. Init();
  113. // base class duplication
  114. CBSEImg::Duplicate(a_oSource);
  115. // copy data over
  116. m_nHoleID = a_oSource.m_nHoleID;
  117. m_poiPosition = a_oSource.m_poiPosition;
  118. }
  119. }