OTSParticleClr.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. #pragma once
  2. #include "OTSParticle.h"
  3. #include "OTSFeatureClr.h"
  4. #include <PosXrayClr.h>
  5. #include <msclr\marshal.h>
  6. #include <msclr\marshal_cppstd.h>
  7. namespace OTSCLRINTERFACE {
  8. using namespace System;
  9. using namespace System::Drawing;
  10. using namespace OTSDATA;
  11. using namespace msclr::interop;
  12. using namespace System::Runtime::InteropServices;
  13. public ref class COTSParticleClr
  14. {
  15. public:
  16. // constructor
  17. COTSParticleClr(); // constructor
  18. COTSParticleClr(COTSParticlePtr); // copy constructor
  19. COTSParticleClr(COTSParticleClr^);
  20. COTSParticleClr(COTSParticle*);
  21. ~COTSParticleClr();
  22. !COTSParticleClr();
  23. COTSParticlePtr GetOTSParticlePtr(); //can only be used in C++, because the original C++ type.
  24. // rectangle
  25. System::Drawing::Rectangle^ GetParticleRect();
  26. void SetParticleRect(System::Drawing::Rectangle^ a_rectParticle);
  27. //Type
  28. int GetType();
  29. void SetType(int a_nType);
  30. //Type
  31. int GetClassifyId();
  32. void SetClassifyId(int a_nType);
  33. //area
  34. double GetActualArea();
  35. void SetArea(double a_dArea);
  36. // gray
  37. BYTE GetAveGray();
  38. void SetAveGray(BYTE a_cAveGray);
  39. // x-ray position
  40. System::Drawing::Point^ GetXRayPos();
  41. void SetXRayPos(System::Drawing::Point^ a_pXRayPos);
  42. void CalXrayPos()
  43. {
  44. m_Particle->get()->CalXRayPos();
  45. }
  46. void SetAbsolutPos(System::Drawing::Point^ a_pAbsPos);
  47. System::Drawing::Point^ GetAbsolutPos()
  48. {
  49. return gcnew System::Drawing::Point(m_Particle->get()->GetAbsolutPos().x, m_Particle->get()->GetAbsolutPos().y);
  50. }
  51. // feature
  52. COTSFeatureClr^ GetFeature();
  53. void SetFeature(COTSFeatureClr^ a_pFeautre);
  54. void SetXray(CPosXrayClr^ xray);
  55. CPosXrayClr^ GetXray();
  56. // tag id
  57. int GetTagId();
  58. void SetTagId(int a_nTagId);
  59. // search id
  60. int GetSearchId();
  61. void SetSearchId(int a_nSearchId);
  62. // analysis id
  63. int GetAnalysisId();
  64. void SetAnalysisId(int a_nAnalysisId);
  65. // field id
  66. int GetFieldId();
  67. void SetFieldId(int a_nFieldId);
  68. /*double GetArea()
  69. {
  70. return m_Particle->get()->GetArea();
  71. }*/
  72. double GetDMAX()
  73. {
  74. return m_Particle->get()->GetDMax();
  75. }
  76. void SetDMAX(double val)
  77. {
  78. return m_Particle->get()->SetDMax(val);
  79. }
  80. double GetDMIN()
  81. {
  82. return m_Particle->get()->GetDMin();
  83. }
  84. void SetDMIN(double val)
  85. {
  86. return m_Particle->get()->SetDMin(val);
  87. }
  88. double GetDMPERP()
  89. {
  90. return m_Particle->get()->GetDPerp();
  91. }
  92. void SetDMPERP(double val)
  93. {
  94. return m_Particle->get()->SetDPerp(val);
  95. }
  96. double GetDINSCR()
  97. {
  98. return m_Particle->get()->GetDInscr ();
  99. }
  100. void SetDINSCR(double val)
  101. {
  102. return m_Particle->get()->SetDInscr(val);
  103. }
  104. double GetDMEAN()
  105. {
  106. return m_Particle->get()->GetDMean();
  107. }
  108. void SetDMEAN(double val)
  109. {
  110. return m_Particle->get()->SetDMean(val);
  111. }
  112. double GetDELONG()
  113. {
  114. return m_Particle->get()->GetDElong();
  115. }
  116. void SetDELONG(double val)
  117. {
  118. return m_Particle->get()->SetDElong(val);
  119. }
  120. double GetDPRIMETER()
  121. {
  122. return m_Particle->get()->GetPerimeter();
  123. }
  124. void SetDPRIMETER(double val)
  125. {
  126. return m_Particle->get()->SetPerimeter(val);
  127. }
  128. double GetORIENTATION()
  129. {
  130. return m_Particle->get()->GetOrientation();
  131. }
  132. void SetORIENTATION(double val)
  133. {
  134. return m_Particle->get()->SetOrientation(val);
  135. }
  136. double GetEqualCircleDiameter()
  137. {
  138. return m_Particle->get()->GetEqualCircleDiameter();
  139. }
  140. double GetFeretDiameter()
  141. {
  142. return m_Particle->get()->GetFeretDiameter();
  143. }
  144. void SetFeretDiameter(double val)
  145. {
  146. return m_Particle->get()->SetFeretDiameter(val);
  147. }
  148. String^ GetTypeName()
  149. {
  150. return gcnew String(m_Particle->get()->TypeName().c_str());
  151. }
  152. void SetTypeName(String^ val)
  153. {
  154. std::string val1 = marshal_as<std::string>(val);
  155. return m_Particle->get()->TypeName(val1);
  156. }
  157. String^ GetTypeColor()
  158. {
  159. return gcnew String(m_Particle->get()->TypeColor().c_str());
  160. }
  161. void SetTypeColor(String^ val)
  162. {
  163. std::string val1 = marshal_as<std::string>(val);
  164. return m_Particle->get()->TypeColor(val1);
  165. }
  166. String^ GetSubParticles()
  167. {
  168. return gcnew String(m_Particle->get()->GetSubParticles().c_str());
  169. }
  170. void SetSubParticles(String^ val)
  171. {
  172. std::string val1 = marshal_as<std::string>(val);
  173. return m_Particle->get()->SetSubParticles(val1);
  174. }
  175. String^ GetGrpName()
  176. {
  177. return gcnew String(m_Particle->get()->GetGroupName().c_str());
  178. }
  179. void SetGrpName(String^ val)
  180. {
  181. std::string val1 = marshal_as<std::string>(val);
  182. return m_Particle->get()->SetGroupName(val1);
  183. }
  184. String^ GetGrpColor()
  185. {
  186. return gcnew String(m_Particle->get()->GetGroupColor().c_str());
  187. }
  188. void SetGrpColor(String^ val)
  189. {
  190. std::string val1 = marshal_as<std::string>(val);
  191. return m_Particle->get()->SetGroupColor(val1);
  192. }
  193. int GetGrpId()
  194. {
  195. return m_Particle->get()->GetGroupId();
  196. }
  197. void SetGrpId(int grpid)
  198. {
  199. m_Particle->get()->SetGroupId(grpid);
  200. }
  201. protected:
  202. COTSParticlePtr* m_Particle;
  203. };
  204. typedef System::Collections::Generic::List<COTSParticleClr^> COTSParticleListClr;
  205. }