| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 | #pragma once#include "OTSParticle.h"#include "OTSFeatureClr.h"#include <PosXrayClr.h>#include <msclr\marshal.h>#include <msclr\marshal_cppstd.h>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);		void SetOTSRect(int left, int top, int right, int bottom);		bool GetOTSRect(int% left, int% top, int% right, int% bottom);		//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<System::Drawing::Point^>^ GetXrayMatrixPoints();		void SetXrayMatrixPoints(cli::array<System::Drawing::Point^>^ points);		void CalXrayPos()		{			m_Particle->get()->CalXRayPos();		}		void CalCoverRectFromSegment()		{			m_Particle->get()->CalCoverRectFromSegment();		}		void SetSEMPos(System::Drawing::Point^ a_pAbsPos);		System::Drawing::Point^ GetSEMPos()		{			return gcnew System::Drawing::Point(m_Particle->get()->GetSEMPos().x, m_Particle->get()->GetSEMPos().y);		}		// feature		COTSFeatureClr^ GetFeature();		void SetFeature(COTSFeatureClr^ a_pFeautre);		void SetXray(CPosXrayClr^ xray);		CPosXrayClr^ GetXray();		// tag id		int GetParticleId();		void SetParticleId(int a_nTagId);		// 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);		}		double CalculateSimilarity(COTSParticleClr^ part);		String^ GetImgPortraitString()		{			return gcnew String(m_Particle->get()->GetImgPortraitString().c_str());				}		String^ GetTypeName()		{			return gcnew  String(m_Particle->get()->GetClassifyName().c_str());		}		void SetTypeName(String^ val)		{			std::string val1 = marshal_as<std::string>(val);			return m_Particle->get()->SetClassifyName(val1);		}		String^ GetTypeColor()		{			return gcnew  String(m_Particle->get()->GetColor().c_str());		}		void SetTypeColor(String^ val)		{			std::string val1 = marshal_as<std::string>(val);			return m_Particle->get()->SetColor(val1);		}		String^ GetConnectedParticlesName()		{			return gcnew String(m_Particle->get()->GetConnectedParticlesSequentialString().c_str());		}		void SetConnectedParticlesName(String^ val)		{			std::string val1 = marshal_as<std::string>(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<std::string>(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<std::string>(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<COTSParticleClr^>^ GetSubParticles() 		{ 			System::Collections::Generic::List<COTSParticleClr^>^ clrparts = gcnew System::Collections::Generic::List<COTSParticleClr^>();			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<COTSParticleClr^>^ clrParts)		{			m_Particle->get()->ClearSubParticles();			for (int i=0;i<clrParts->Count;i++)			{				m_Particle->get()->AddSubParticle(clrParts[i]->GetOTSParticlePtr());			}				}		void ClearSubParticles() { m_Particle->get()->ClearSubParticles(); }		void AddSubParticle(COTSParticleClr^ particle) { m_Particle->get()->AddSubParticle(particle->GetOTSParticlePtr()); }		bool IsConnected(COTSParticleClr^ a_p, int fldwidth, int fldheight, int direction)		{			return m_Particle->get()->IsConnected(a_p->GetOTSParticlePtr().get(), fldwidth, fldheight, direction);		}	protected:				COTSParticlePtr* m_Particle;	};	typedef System::Collections::Generic::List<COTSParticleClr^> COTSParticleListClr;}
 |