| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- #include "stdafx.h"
- #include "PosXrayInfoClr.h"
- namespace OTSINTERFACE {
- CPosXrayInfoClr::CPosXrayInfoClr() // constructor
- {
- m_PosXrayInfo = new CPosXrayInfoPtr(new CPosXrayInfo());
- }
- CPosXrayInfoClr::CPosXrayInfoClr(CPosXrayInfoPtr a_pPosXrayInfo) // copy constructor
- {
- ASSERT(a_pPosXrayInfo);
- if (!a_pPosXrayInfo)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CPosXrayInfoClr: Generate CPosXrayInfoClr pointer failed."));
- return;
- }
-
- m_PosXrayInfo = new CPosXrayInfoPtr(a_pPosXrayInfo);
-
- }
- CPosXrayInfoPtr CPosXrayInfoClr::GetPosXrayInfoPtr()
- {
- return *m_PosXrayInfo;
- }
- CPosXrayInfoClr::CPosXrayInfoClr(CPosXrayInfo* a_pSource) // copy constructor
- {
- ASSERT(a_pSource);
- if (!a_pSource)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CPosXrayClr: Generate CPosXrayClr pointer failed."));
- return;
- }
- m_PosXrayInfo = new CPosXrayInfoPtr(a_pSource);
- }
- CPosXrayInfoClr::~CPosXrayInfoClr()
- {
- if (m_PosXrayInfo != nullptr)
- {
- delete m_PosXrayInfo;
- m_PosXrayInfo = nullptr;
- }
- }
- CPosXrayInfoClr::!CPosXrayInfoClr()
- {
- if (m_PosXrayInfo != nullptr)
- {
- delete m_PosXrayInfo;
- m_PosXrayInfo = nullptr;
- }
- }
- System::Drawing::Point^CPosXrayInfoClr::GetPosition()
- {
- auto p= m_PosXrayInfo->get()->GetPosition();
- System::Drawing::Point^ pnt = gcnew System::Drawing::Point(p.x, p.y);
- return pnt;
- }
- void CPosXrayInfoClr::SetPosition(System::Drawing::Point^ a_pRect)
- {
- m_PosXrayInfo->get()->SetPosition(CPoint(a_pRect->X, a_pRect->Y));
- }
- long CPosXrayInfoClr::GetIndex()
- {
- int nIndex = -1;
- if (m_PosXrayInfo != nullptr)
- {
- nIndex = (int)m_PosXrayInfo->get()->GetIndex();
- }
- return nIndex;
- }
- void CPosXrayInfoClr::SetIndex(long a_nIndex)
- {
- if (m_PosXrayInfo != nullptr)
- {
- m_PosXrayInfo->get()->SetIndex(a_nIndex);
- }
- }
- long CPosXrayInfoClr::GetScanFieldId()
- {
- int nScanFieldId = -1;
- if (m_PosXrayInfo != nullptr)
- {
- nScanFieldId = (int)m_PosXrayInfo->get()->GetScanFieldId();
- }
- return nScanFieldId;
- }
- void CPosXrayInfoClr::SetScanFieldId(long a_nScanfieldId)
- {
- if (m_PosXrayInfo != nullptr)
- {
- m_PosXrayInfo->get()->SetScanFieldId(a_nScanfieldId);
- }
- }
- long CPosXrayInfoClr::GetPartTagId()
- {
- int nPartTagId = -1;
- if (m_PosXrayInfo != nullptr)
- {
- nPartTagId = (int)m_PosXrayInfo->get()->GetPartTagId();
- }
- return nPartTagId;
- }
- void CPosXrayInfoClr::SetPartTagId(long a_nPartTagId)
- {
- if (m_PosXrayInfo != nullptr)
- {
- m_PosXrayInfo->get()->SetScanFieldId(a_nPartTagId);
- }
- }
- long CPosXrayInfoClr::GetFeatureId()
- {
- int nFeatureId = -1;
- if (m_PosXrayInfo != nullptr)
- {
- nFeatureId = (int)m_PosXrayInfo->get()->GetFeatureId();
- }
- return nFeatureId;
- }
- void CPosXrayInfoClr::SetFeatureId(long a_nFeatureId)
- {
- if (m_PosXrayInfo != nullptr)
- {
- m_PosXrayInfo->get()->SetScanFieldId(a_nFeatureId);
- }
- }
- CElementChemistryListClr^ CPosXrayInfoClr::GetElementQuantifyData()
- {
- CElementChemistryListClr^ ElementChemistryListClr=gcnew CElementChemistryListClr();
- auto eleQtyData = m_PosXrayInfo->get()->GetElementQuantifyData();
- if (m_PosXrayInfo != nullptr)
- {
- for (auto i = 0; i < eleQtyData.size(); i++)
- {
- ElementChemistryListClr->Add(gcnew CElementChemistryClr(eleQtyData[i]));
- }
- }
- return ElementChemistryListClr;
- }
- // element quantify data
- void CPosXrayInfoClr::SetElementQuantifyData(CElementChemistryListClr^ a_listElementQuantifyData)
- {
- ASSERT(a_listElementQuantifyData);
- if (!a_listElementQuantifyData)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetElementQuantifyData: invalid feature pointer."));
- return;
- }
- CElementChemistriesList chemiList;
- for (int i = 0; i < a_listElementQuantifyData->Count; i++)
- {
- chemiList[i] = a_listElementQuantifyData[i]->GetElementChemistryPtr();
- }
-
- m_PosXrayInfo->get()->SetElementQuantifyData(chemiList);
- }
- void CPosXrayInfoClr::NormalizeXrayQuantifyData()
- {
- CPosXrayInfoPtr pPosXrayInfo = GetPosXrayInfoPtr();
- ASSERT(pPosXrayInfo);
- if (!pPosXrayInfo)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("NormalizeXrayQuantifyData: Can't get pointer."));
- return;
- }
- pPosXrayInfo->NormalizeXrayQuantifyData();
- }
-
-
- }
|