123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- #pragma once
- #include "stdafx.h"
- #include "OTSParticleClr.h"
- #include "../OTSLog/COTSUtilityDllFunExport.h"
- namespace OTSCLRINTERFACE {
-
- COTSParticleClr::COTSParticleClr()
- {
- m_Particle = new COTSParticlePtr(new COTSParticle());
- }
-
- COTSParticleClr::COTSParticleClr(COTSParticlePtr pParticle) // copy constructor
- {
- ASSERT(pParticle);
- if (!pParticle)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("COTSParticleClr: Generate COTSParticleClr pointer failed."));
- return;
- }
-
-
- m_Particle = new COTSParticlePtr(pParticle);
-
- }
- COTSParticleClr::COTSParticleClr(COTSParticleClr^ a_pSource)
- {
- auto src = a_pSource->GetOTSParticlePtr();
- m_Particle = new COTSParticlePtr(new COTSParticle(src.get()));
- }
- COTSParticleClr::COTSParticleClr(COTSParticle* a_pSource) // copy constructor
- {
- ASSERT(a_pSource);
- if (!a_pSource)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("COTSParticleClr: Generate COTSParticleClr pointer failed."));
- return;
- }
- m_Particle = new COTSParticlePtr(new COTSParticle(a_pSource));
- }
- COTSParticleClr::~COTSParticleClr()
- {
- if (m_Particle != nullptr)
- {
- delete m_Particle;
- m_Particle = nullptr;
- }
- }
- COTSParticleClr::!COTSParticleClr()
- {
- if (m_Particle != nullptr)
- {
- delete m_Particle;
- m_Particle = nullptr;
- }
- }
- COTSParticlePtr COTSParticleClr::GetOTSParticlePtr()
- {
- return *m_Particle;
- }
-
- System::Drawing::Rectangle^ COTSParticleClr::GetParticleRect()
- {
- COTSParticlePtr prt = *m_Particle;
- CRect Crec = prt->GetParticleRect();
- System::Drawing::Rectangle^ r = gcnew System::Drawing::Rectangle((int)Crec.left, (int)Crec.top, (int)Crec.Width(), (int)Crec.Height());
- return r;
- }
- void COTSParticleClr::SetParticleRect(System::Drawing::Rectangle^ a_rectParticle)
- {
- CRect r(a_rectParticle->Left, a_rectParticle->Top, a_rectParticle->Right, a_rectParticle->Bottom);
- m_Particle->get()->SetParticleRect(r);
- }
- int COTSParticleClr::GetType()
- {
- int nType = -1;
- if (m_Particle != nullptr)
- {
- nType =(int) m_Particle->get()->GetType();
- }
- return nType;
- }
- void COTSParticleClr::SetType(int a_nType)
- {
- if (m_Particle != nullptr)
- {
- m_Particle->get()->SetType((OTS_PARTICLE_TYPE)a_nType);
- }
- }
- int COTSParticleClr::GetClassifyId()
- {
- int nType = -1;
- if (m_Particle != nullptr)
- {
- nType = m_Particle->get()->GetClassifyId();
- }
- return nType;
- }
- void COTSParticleClr::SetClassifyId(int a_nType)
- {
- if (m_Particle != nullptr)
- {
- m_Particle->get()->SetClassifyId(a_nType);
- }
- }
- double COTSParticleClr::GetActualArea()
- {
- double nArea = -1;
- if (m_Particle != nullptr)
- {
- nArea = m_Particle->get()->GetActualArea();
- }
- return nArea;
- }
- void COTSParticleClr::SetArea(double a_dArea)
- {
- if (m_Particle != nullptr)
- {
- m_Particle->get()->SetActualArea(a_dArea);
- }
- }
- BYTE COTSParticleClr::GetAveGray()
- {
- BYTE nAveGray = -1;
- if (m_Particle != nullptr)
- {
- nAveGray = m_Particle->get()->GetAveGray();
- }
- return nAveGray;
- }
- void COTSParticleClr::SetAveGray(BYTE a_cAveGray)
- {
- if (m_Particle != nullptr)
- {
- m_Particle->get()->SetAveGray(a_cAveGray);
- }
- }
- Point^ COTSParticleClr::GetXRayPos()
- {
-
- Point^ XRayPosClr;
-
- if (m_Particle != nullptr)
- {
- CPoint P = m_Particle->get()->GetXRayPos();
- XRayPosClr = gcnew Point(P.x, P.y);
- }
- return XRayPosClr;
- }
- void COTSParticleClr::SetXRayPos(Point^ a_pXRayPos)
- {
- ASSERT(a_pXRayPos);
- if (!a_pXRayPos)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetFileVersion: invalid version."));
- }
- if (m_Particle != nullptr)
- {
- CPoint P = CPoint(a_pXRayPos->X, a_pXRayPos->Y);
- m_Particle->get()->SetXRayPos(P);
- }
- }
- void COTSParticleClr::SetAbsolutPos(System::Drawing::Point^ a_pAbsPos)
- {
- m_Particle->get()->SetAbsolutePos(CPoint(a_pAbsPos->X, a_pAbsPos->Y));
- }
- COTSFeatureClr^ COTSParticleClr::GetFeature()
- {
- COTSFeatureClr^ FeatureClr;
- if (m_Particle != nullptr)
- {
- COTSFeaturePtr Feature = m_Particle->get()->GetFeature();
- FeatureClr = gcnew COTSFeatureClr(Feature);
- }
- return FeatureClr;
- }
- void COTSParticleClr::SetFeature(COTSFeatureClr^ a_pFeautre)
- {
- ASSERT(a_pFeautre);
- if (!a_pFeautre)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetFeature: invalid feature pointer."));
- return;
- }
-
- if (m_Particle != nullptr)
- {
- COTSFeaturePtr pSetElement = a_pFeautre->GetOTSFeaturePtr();
- ASSERT(pSetElement);
- if (!pSetElement)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetElement: invalid part Element pointer."));
- return;
- }
- m_Particle->get()->SetFeature(pSetElement);
- }
- }
- void COTSParticleClr::SetXray(CPosXrayClr^ xray)
- {
- m_Particle->get()->SetXrayInfo(xray->GetPosXrayPtr());
- }
- CPosXrayClr^ COTSParticleClr::GetXray()
- {
- auto xray = m_Particle->get()->GetXrayInfo();
- if (xray != nullptr)
- {
- return gcnew CPosXrayClr(m_Particle->get()->GetXrayInfo());
- }
- else
- {
- return gcnew CPosXrayClr();
- }
-
- }
- int COTSParticleClr::GetTagId()
- {
- int nTagId = -1;
- if (m_Particle != nullptr)
- {
- nTagId = m_Particle->get()->GetTagId();
- }
- return nTagId;
- }
- void COTSParticleClr::SetTagId(int a_nTagId)
- {
- if (m_Particle != nullptr)
- {
- m_Particle->get()->SetTagId(a_nTagId);
- }
- }
- int COTSParticleClr::GetSearchId()
- {
- int SearchId = -1;
- if (m_Particle != nullptr)
- {
- SearchId = m_Particle->get()->GetSearchId();
- }
- return SearchId;
- }
- void COTSParticleClr::SetSearchId(int a_nSearchId)
- {
- if (m_Particle != nullptr)
- {
- m_Particle->get()->SetSearchtId(a_nSearchId);
- }
- }
- int COTSParticleClr::GetAnalysisId()
- {
- int AnalysisId = -1;
- if (m_Particle != nullptr)
- {
- AnalysisId = m_Particle->get()->GetAnalysisId();
- }
- return AnalysisId;
- }
- void COTSParticleClr::SetAnalysisId(int a_nAnalysisId)
- {
- if (m_Particle != nullptr)
- {
- m_Particle->get()->SetAnalysisId(a_nAnalysisId);
- }
- }
- int COTSParticleClr::GetFieldId()
- {
- int FieldId = -1;
- if (m_Particle != nullptr)
- {
- FieldId = m_Particle->get()->GetFieldId();
- }
- return FieldId;
- }
- void COTSParticleClr::SetFieldId(int a_nFieldId)
- {
- if (m_Particle != nullptr)
- {
- m_Particle->get()->SetFieldId(a_nFieldId);
- }
- }
- }
|