OTSParticleClr.cpp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. #include "stdafx.h"
  2. #include "OTSParticleClr.h"
  3. namespace OTSINTERFACE {
  4. COTSParticleClr::COTSParticleClr()
  5. {
  6. m_Particle = new COTSParticlePtr(new COTSParticle());
  7. }
  8. COTSParticleClr::COTSParticleClr(COTSParticlePtr pParticle) // copy constructor
  9. {
  10. ASSERT(pParticle);
  11. if (!pParticle)
  12. {
  13. LogErrorTrace(__FILE__, __LINE__, _T("COTSParticleClr: Generate COTSParticleClr pointer failed."));
  14. return;
  15. }
  16. m_Particle = new COTSParticlePtr(pParticle);
  17. }
  18. COTSParticleClr::COTSParticleClr(COTSParticle* a_pSource) // copy constructor
  19. {
  20. ASSERT(a_pSource);
  21. if (!a_pSource)
  22. {
  23. LogErrorTrace(__FILE__, __LINE__, _T("COTSParticleClr: Generate COTSParticleClr pointer failed."));
  24. return;
  25. }
  26. m_Particle = new COTSParticlePtr(new COTSParticle(a_pSource));
  27. }
  28. COTSParticleClr::~COTSParticleClr()
  29. {
  30. if (m_Particle != nullptr)
  31. {
  32. delete m_Particle;
  33. m_Particle = nullptr;
  34. }
  35. }
  36. COTSParticleClr::!COTSParticleClr()
  37. {
  38. if (m_Particle != nullptr)
  39. {
  40. delete m_Particle;
  41. m_Particle = nullptr;
  42. }
  43. }
  44. COTSParticlePtr COTSParticleClr::GetOTSParticlePtr()
  45. {
  46. return *m_Particle;
  47. }
  48. System::Drawing::Rectangle^ COTSParticleClr::GetParticleRect()
  49. {
  50. COTSParticlePtr prt = *m_Particle;
  51. CRect Crec = prt->GetParticleRect();
  52. System::Drawing::Rectangle^ r = gcnew System::Drawing::Rectangle((int)Crec.left, (int)Crec.top, (int)Crec.Width(), (int)Crec.Height());
  53. return r;
  54. }
  55. void COTSParticleClr::SetParticleRect(System::Drawing::Rectangle^ a_rectParticle)
  56. {
  57. CRect r(a_rectParticle->Left, a_rectParticle->Top, a_rectParticle->Right, a_rectParticle->Bottom);
  58. m_Particle->get()->SetParticleRect(r);
  59. }
  60. int COTSParticleClr::GetType()
  61. {
  62. int nType = -1;
  63. if (m_Particle != nullptr)
  64. {
  65. nType = m_Particle->get()->GetType();
  66. }
  67. return nType;
  68. }
  69. void COTSParticleClr::SetType(int a_nType)
  70. {
  71. if (m_Particle != nullptr)
  72. {
  73. m_Particle->get()->SetType(a_nType);
  74. }
  75. }
  76. double COTSParticleClr::GetArea()
  77. {
  78. double nArea = -1;
  79. if (m_Particle != nullptr)
  80. {
  81. nArea = m_Particle->get()->GetArea();
  82. }
  83. return nArea;
  84. }
  85. void COTSParticleClr::SetArea(double a_dArea)
  86. {
  87. if (m_Particle != nullptr)
  88. {
  89. m_Particle->get()->SetArea(a_dArea);
  90. }
  91. }
  92. BYTE COTSParticleClr::GetAveGray()
  93. {
  94. BYTE nAveGray = -1;
  95. if (m_Particle != nullptr)
  96. {
  97. nAveGray = m_Particle->get()->GetAveGray();
  98. }
  99. return nAveGray;
  100. }
  101. void COTSParticleClr::SetAveGray(BYTE a_cAveGray)
  102. {
  103. if (m_Particle != nullptr)
  104. {
  105. m_Particle->get()->SetType(a_cAveGray);
  106. }
  107. }
  108. Point^ COTSParticleClr::GetXRayPos()
  109. {
  110. Point^ XRayPosClr;
  111. if (m_Particle != nullptr)
  112. {
  113. CPoint P = m_Particle->get()->GetXRayPos();
  114. XRayPosClr = gcnew Point(P.x, P.y);
  115. }
  116. return XRayPosClr;
  117. }
  118. void COTSParticleClr::SetXRayPos(Point^ a_pXRayPos)
  119. {
  120. ASSERT(a_pXRayPos);
  121. if (!a_pXRayPos)
  122. {
  123. LogErrorTrace(__FILE__, __LINE__, _T("SetFileVersion: invalid version."));
  124. }
  125. if (m_Particle != nullptr)
  126. {
  127. CPoint P = m_Particle->get()->GetXRayPos();
  128. m_Particle->get()->SetXRayPos(P);
  129. }
  130. }
  131. COTSFeatureClr^ COTSParticleClr::GetFeature()
  132. {
  133. COTSFeatureClr^ FeatureClr;
  134. if (m_Particle != nullptr)
  135. {
  136. COTSFeaturePtr Feature = m_Particle->get()->GetFeature();
  137. FeatureClr = gcnew COTSFeatureClr(Feature);
  138. }
  139. return FeatureClr;
  140. }
  141. void COTSParticleClr::SetFeature(COTSFeatureClr^ a_pFeautre)
  142. {
  143. ASSERT(a_pFeautre);
  144. if (!a_pFeautre)
  145. {
  146. LogErrorTrace(__FILE__, __LINE__, _T("SetFeature: invalid feature pointer."));
  147. return;
  148. }
  149. if (m_Particle != nullptr)
  150. {
  151. COTSFeaturePtr pSetElement = a_pFeautre->GetOTSFeaturePtr();
  152. ASSERT(pSetElement);
  153. if (!pSetElement)
  154. {
  155. LogErrorTrace(__FILE__, __LINE__, _T("SetElement: invalid part Element pointer."));
  156. return;
  157. }
  158. m_Particle->get()->SetFeature(pSetElement);
  159. }
  160. }
  161. int COTSParticleClr::GetTagId()
  162. {
  163. int nTagId = -1;
  164. if (m_Particle != nullptr)
  165. {
  166. nTagId = m_Particle->get()->GetTagId();
  167. }
  168. return nTagId;
  169. }
  170. void COTSParticleClr::SetTagId(int a_nTagId)
  171. {
  172. if (m_Particle != nullptr)
  173. {
  174. m_Particle->get()->SetTagId(a_nTagId);
  175. }
  176. }
  177. int COTSParticleClr::GetSearchId()
  178. {
  179. int SearchId = -1;
  180. if (m_Particle != nullptr)
  181. {
  182. SearchId = m_Particle->get()->GetSearchId();
  183. }
  184. return SearchId;
  185. }
  186. void COTSParticleClr::SetSearchId(int a_nSearchId)
  187. {
  188. if (m_Particle != nullptr)
  189. {
  190. m_Particle->get()->SetSearchtId(a_nSearchId);
  191. }
  192. }
  193. int COTSParticleClr::GetAnalysisId()
  194. {
  195. int AnalysisId = -1;
  196. if (m_Particle != nullptr)
  197. {
  198. AnalysisId = m_Particle->get()->GetAnalysisId();
  199. }
  200. return AnalysisId;
  201. }
  202. void COTSParticleClr::SetAnalysisId(int a_nAnalysisId)
  203. {
  204. if (m_Particle != nullptr)
  205. {
  206. m_Particle->get()->SetAnalysisId(a_nAnalysisId);
  207. }
  208. }
  209. int COTSParticleClr::GetFieldId()
  210. {
  211. int FieldId = -1;
  212. if (m_Particle != nullptr)
  213. {
  214. FieldId = m_Particle->get()->GetFieldId();
  215. }
  216. return FieldId;
  217. }
  218. void COTSParticleClr::SetFieldId(int a_nFieldId)
  219. {
  220. if (m_Particle != nullptr)
  221. {
  222. m_Particle->get()->SetFieldId(a_nFieldId);
  223. }
  224. }
  225. }