| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- #include "stdafx.h"
- #include "PosXrayClr.h"
- namespace OTSINTERFACE {
- CPosXrayClr::CPosXrayClr() // constructor
- {
- m_PosXray = new CPosXrayPtr(new CPosXray());
- }
-
- CPosXrayClr::CPosXrayClr(CPosXrayPtr a_pPosXray) // copy constructor
- {
-
- ASSERT(a_pPosXray);
- if (!a_pPosXray)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CPosXrayClr: Generate CPosXrayClr pointer failed."));
- return;
- }
-
- m_PosXray = new CPosXrayPtr(a_pPosXray);
-
- }
- CPosXrayPtr CPosXrayClr::GetPosXrayPtr()
- {
- return *m_PosXray;
- }
- CPosXrayClr::CPosXrayClr(CPosXray* a_pSource) // copy constructor
- {
- ASSERT(a_pSource);
- if (!a_pSource)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CPosXrayClr: Generate CPosXrayClr pointer failed."));
- return;
- }
- m_PosXray = new CPosXrayPtr(new CPosXray(a_pSource));
- }
- CPosXrayClr::~CPosXrayClr()
- {
- if (m_PosXray != nullptr)
- {
- delete m_PosXray;
- m_PosXray = nullptr;
- }
- }
- CPosXrayClr::!CPosXrayClr()
- {
- if (m_PosXray != nullptr)
- {
- delete m_PosXray;
- m_PosXray = nullptr;
- }
- }
-
- array<DWORD>^ CPosXrayClr::GetXrayData()
- {
- array<DWORD>^ XrayData;
- if (m_PosXray != nullptr)
- {
- DWORD* XData = m_PosXray->get()->GetXrayData();
- XrayData = gcnew array<DWORD>(m_PosXray->get()->GetChannelsNo ());
- for (int i = 0; i < m_PosXray->get()->GetChannelsNo(); i++)
- {
- XrayData[i] = XData[i];
- }
- }
- return XrayData;
- }
- long CPosXrayClr::GetIndex()
- {
- return m_PosXray->get()->GetIndex();
- }
- CElementChemistryListClr^ CPosXrayClr::GetElementQuantifyData()
- {
- CElementChemistryListClr^ ElementChemistryListClr = gcnew CElementChemistryListClr();
- auto eleQtyData = m_PosXray->get()->GetElementQuantifyData();
- if (m_PosXray != nullptr)
- {
- for (auto i = 0; i < eleQtyData.size(); i++)
- {
- ElementChemistryListClr->Add(gcnew CElementChemistryClr(eleQtyData[i]));
- }
- }
- return ElementChemistryListClr;
- }
- void CPosXrayClr::SetXrayData(cli::array<DWORD>^ a_pnXrayData)
- {
- ASSERT(a_pnXrayData);
- if (!a_pnXrayData)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetFileVersion: invalid version."));
- }
- DWORD* XData=new DWORD[a_pnXrayData->GetLength(0)];
- for (auto i = 0; i < a_pnXrayData->GetLength(0);i++)
- {
- XData[i] = a_pnXrayData[i];
-
- }
- if (m_PosXray != nullptr)
- {
- m_PosXray->get()->SetXrayData(XData);
- }
- }
-
- DWORD CPosXrayClr::GetTotalCount()
- {
- CPosXrayPtr pPosXray = GetPosXrayPtr();
- return pPosXray->GetTotalCount();
- }
- void CPosXrayClr::GetMaxHeightPosition(long % a_nMaxHeight, long % a_nPosition)
- {
- CPosXrayPtr pPosXray = GetPosXrayPtr();
- long nMaxHeight, nPosition;
- pPosXray->GetMaxHeightPosition(nMaxHeight, nPosition);
- a_nMaxHeight = nMaxHeight;
- a_nPosition = nPosition;
- }
- // clear the x-ray data
- // if start position is [0, GENERALXRAYCHANNELS - 1], will do the clear
- void CPosXrayClr::ClearXrayData(long a_nStartPos)
- {
- CPosXrayPtr pPosXray = GetPosXrayPtr();
- pPosXray->ClearXrayData(a_nStartPos);
- }
- // set x-ray data at channel
- void CPosXrayClr::SetXrayDataAtChannel(DWORD a_nXray, long a_nChannel)
- {
- if (this == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetTotalCount: empty pointer."));
- }
- CPosXrayPtr pPosXray = GetPosXrayPtr();
- pPosXray->SetXrayDataAtChannel(a_nXray, a_nChannel);
- }
- }
|