#pragma once #include "OTSParticle.h" #include "OTSFeatureClr.h" #include #include #include namespace OTSCLRINTERFACE { using namespace System; using namespace System::Drawing; using namespace OTSDATA; using namespace msclr::interop; using namespace System::Runtime::InteropServices; public ref class COTSParticleClr { public: // constructor COTSParticleClr(); // constructor COTSParticleClr(COTSParticlePtr); // copy constructor COTSParticleClr(COTSParticleClr^); COTSParticleClr(COTSParticle*); ~COTSParticleClr(); !COTSParticleClr(); COTSParticlePtr GetOTSParticlePtr(); //can only be used in C++, because the original C++ type. // rectangle System::Drawing::Rectangle^ GetParticleRect(); void SetParticleRect(System::Drawing::Rectangle^ a_rectParticle); //Type int GetType(); void SetType(int a_nType); //Type int GetClassifyId(); void SetClassifyId(int a_nType); //area double GetActualArea(); void SetActualArea(double a_dArea); double GetPixelArea(); // gray BYTE GetAveGray(); void SetAveGray(BYTE a_cAveGray); // x-ray position System::Drawing::Point^ GetXRayPos(); void SetXRayPos(System::Drawing::Point^ a_pXRayPos); cli::array^ GetXrayMatrixPoints(); void SetXrayMatrixPoints(cli::array^ points); void CalXrayPos() { m_Particle->get()->CalXRayPos(); } void CalCoverRect() { m_Particle->get()->CalCoverRect(); } void SetAbsolutPos(System::Drawing::Point^ a_pAbsPos); System::Drawing::Point^ GetAbsolutPos() { return gcnew System::Drawing::Point(m_Particle->get()->GetAbsolutPos().x, m_Particle->get()->GetAbsolutPos().y); } // feature COTSFeatureClr^ GetFeature(); void SetFeature(COTSFeatureClr^ a_pFeautre); void SetXray(CPosXrayClr^ xray); CPosXrayClr^ GetXray(); // tag id int GetParticleId(); void SetParticleId(int a_nTagId); // search id int GetSearchId(); void SetSearchId(int a_nSearchId); // analysis id int GetAnalysisId(); void SetAnalysisId(int a_nAnalysisId); // field id int GetFieldId(); void SetFieldId(int a_nFieldId); double GetDMAX() { return m_Particle->get()->GetDMax(); } void SetDMAX(double val) { return m_Particle->get()->SetDMax(val); } double GetDMIN() { return m_Particle->get()->GetDMin(); } void SetDMIN(double val) { return m_Particle->get()->SetDMin(val); } double GetDMPERP() { return m_Particle->get()->GetDPerp(); } void SetDMPERP(double val) { return m_Particle->get()->SetDPerp(val); } double GetDINSCR() { return m_Particle->get()->GetDInscr (); } void SetDINSCR(double val) { return m_Particle->get()->SetDInscr(val); } double GetDMEAN() { return m_Particle->get()->GetDMean(); } void SetDMEAN(double val) { return m_Particle->get()->SetDMean(val); } double GetDELONG() { return m_Particle->get()->GetDElong(); } void SetDELONG(double val) { return m_Particle->get()->SetDElong(val); } double GetDPRIMETER() { return m_Particle->get()->GetPerimeter(); } void SetDPRIMETER(double val) { return m_Particle->get()->SetPerimeter(val); } double GetORIENTATION() { return m_Particle->get()->GetOrientation(); } void SetORIENTATION(double val) { return m_Particle->get()->SetOrientation(val); } double GetEqualCircleDiameter() { return m_Particle->get()->GetEqualCircleDiameter(); } double GetFeretDiameter() { return m_Particle->get()->GetFeretDiameter(); } void SetFeretDiameter(double val) { return m_Particle->get()->SetFeretDiameter(val); } String^ GetTypeName() { return gcnew String(m_Particle->get()->TypeName().c_str()); } void SetTypeName(String^ val) { std::string val1 = marshal_as(val); return m_Particle->get()->TypeName(val1); } String^ GetTypeColor() { return gcnew String(m_Particle->get()->TypeColor().c_str()); } void SetTypeColor(String^ val) { std::string val1 = marshal_as(val); return m_Particle->get()->TypeColor(val1); } String^ GetConnectedParticlesName() { return gcnew String(m_Particle->get()->GetConnectedParticlesSequentialString().c_str()); } void SetConnectedParticlesName(String^ val) { std::string val1 = marshal_as(val); return m_Particle->get()->SetConnectedParticlesSequentialString(val1); } String^ GetGrpName() { return gcnew String(m_Particle->get()->GetGroupName().c_str()); } void SetGrpName(String^ val) { std::string val1 = marshal_as(val); return m_Particle->get()->SetGroupName(val1); } String^ GetGrpColor() { return gcnew String(m_Particle->get()->GetGroupColor().c_str()); } void SetGrpColor(String^ val) { std::string val1 = marshal_as(val); return m_Particle->get()->SetGroupColor(val1); } int GetGrpId() { return m_Particle->get()->GetGroupId(); } void SetGrpId(int grpid) { m_Particle->get()->SetGroupId(grpid); } bool IsXrayParticle() { return m_Particle->get()->IsXrayParticle(); } void SetIsXrayParticle(bool value) { m_Particle->get()->SetIsXrayParticle(value); } System::Collections::Generic::List^ GetSubParticles() { System::Collections::Generic::List^ clrparts = gcnew System::Collections::Generic::List(); auto parts = m_Particle->get()->GetSubParticles(); for (auto p : parts) { auto clrPart = gcnew COTSParticleClr(p); clrparts->Add(clrPart); } return clrparts; } void SetSubParticles(System::Collections::Generic::List^ clrParts) { m_Particle->get()->ClearSubParticles(); for (int i=0;iCount;i++) { m_Particle->get()->AddSubParticle(clrParts[i]->GetOTSParticlePtr()); } } void ClearSubParticles() { m_Particle->get()->ClearSubParticles(); } void AddSubParticle(COTSParticleClr^ particle) { m_Particle->get()->AddSubParticle(particle->GetOTSParticlePtr()); } protected: COTSParticlePtr* m_Particle; }; typedef System::Collections::Generic::List COTSParticleListClr; }