OTSSegmentClr.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #include "stdafx.h"
  2. #include "OTSSegmentClr.h"
  3. #include "OTSSegment.h"
  4. #include "../OTSLog/COTSUtilityDllFunExport.h"
  5. namespace OTSCLRINTERFACE {
  6. using namespace OTSDATA;
  7. COTSSegmentClr::COTSSegmentClr()
  8. {
  9. m_Segment = new COTSSegmentPtr(new COTSSegment());
  10. }
  11. COTSSegmentClr::COTSSegmentClr(long a_nHeight, long a_nStart, long a_nLength) // constructor
  12. {
  13. m_Segment = new COTSSegmentPtr(new COTSSegment(a_nHeight, a_nStart, a_nLength));
  14. }
  15. COTSSegmentClr::COTSSegmentClr(COTSSegmentPtr a_pSegment) // copy constructor
  16. {
  17. ASSERT(a_pSegment);
  18. if (!a_pSegment)
  19. {
  20. LogErrorTrace(__FILE__, __LINE__, _T("COTSParticleClr: Generate COTSParticleClr pointer failed."));
  21. return;
  22. }
  23. m_Segment = new COTSSegmentPtr(a_pSegment);
  24. }
  25. COTSSegmentClr::COTSSegmentClr(COTSSegmentClr^ a_pSource)
  26. {
  27. auto src = a_pSource->GetOTSSegmentPtr();
  28. m_Segment = new COTSSegmentPtr(new COTSSegment(src.get()));
  29. }
  30. COTSSegmentClr::COTSSegmentClr(COTSSegment* a_pSource) // copy constructor
  31. {
  32. ASSERT(a_pSource);
  33. if (!a_pSource)
  34. {
  35. LogErrorTrace(__FILE__, __LINE__, _T("COTSSegmentClr: Generate COTSSegmentClr pointer failed."));
  36. return;
  37. }
  38. m_Segment = new COTSSegmentPtr(new COTSSegment(a_pSource));
  39. }
  40. COTSSegmentPtr COTSSegmentClr::GetOTSSegmentPtr()
  41. {
  42. return *m_Segment;
  43. }
  44. COTSSegmentClr::~COTSSegmentClr()
  45. {
  46. if (m_Segment != nullptr)
  47. {
  48. delete m_Segment;
  49. m_Segment = nullptr;
  50. }
  51. }
  52. COTSSegmentClr::!COTSSegmentClr()
  53. {
  54. if (m_Segment != nullptr)
  55. {
  56. delete m_Segment;
  57. m_Segment = nullptr;
  58. }
  59. }
  60. long COTSSegmentClr::GetHeight()
  61. {
  62. long nHeight = -1;
  63. if (m_Segment != nullptr)
  64. {
  65. nHeight = m_Segment->get()->GetHeight();
  66. }
  67. return nHeight;
  68. }
  69. void COTSSegmentClr::SetHeight(long a_nHeight)
  70. {
  71. if (m_Segment != nullptr)
  72. {
  73. m_Segment->get()->SetHeight(a_nHeight);
  74. }
  75. }
  76. long COTSSegmentClr::GetStart()
  77. {
  78. long nStart = -1;
  79. if (m_Segment != nullptr)
  80. {
  81. nStart =m_Segment->get()->GetStart();
  82. }
  83. return nStart;
  84. }
  85. void COTSSegmentClr::SetStart(long a_nStart)
  86. {
  87. if (m_Segment != nullptr)
  88. {
  89. m_Segment->get()->SetStart(a_nStart);
  90. }
  91. }
  92. long COTSSegmentClr::GetLength()
  93. {
  94. long nLength = -1;
  95. if (m_Segment != nullptr)
  96. {
  97. nLength = m_Segment->get()->GetLength();
  98. }
  99. return nLength;
  100. }
  101. void COTSSegmentClr::SetLength(long a_nLength)
  102. {
  103. if (m_Segment != nullptr)
  104. {
  105. m_Segment->get()->SetLength(a_nLength);
  106. }
  107. }
  108. long COTSSegmentClr::GetEnd()
  109. {
  110. long nEnd = -1;
  111. if (m_Segment != nullptr)
  112. {
  113. nEnd = m_Segment->get()->GetEnd();
  114. }
  115. return nEnd;
  116. }
  117. void COTSSegmentClr::SetEnd(long end)
  118. {
  119. if (m_Segment != nullptr)
  120. {
  121. m_Segment->get()->SetEnd(end);
  122. }
  123. }
  124. void COTSSegmentClr::UpDownConection(COTSSegmentClr^ otherSeg)
  125. {
  126. auto seg = otherSeg->GetOTSSegmentPtr();
  127. m_Segment->get()->UpDownConection(seg.get());
  128. }
  129. }