#include "stdafx.h" #include "HoleBSEImgClr.h" #include "BSEImgClr.h" namespace OTSINTERFACE { CHoleBSEImgClr::CHoleBSEImgClr() { m_HoleBSEImg = new CHoleBSEImgPtr(new CHoleBSEImg()); } CHoleBSEImgClr::CHoleBSEImgClr(System::Drawing::Rectangle^ a_rectImage, int a_nHoleID) // constructor { CHoleBSEImgPtr d = GetHoleBSEImgPtr(); CRect* r = new CRect(a_rectImage->Left, a_rectImage->Top, a_rectImage->Right, a_rectImage->Bottom); m_LpBSEImg = new CBSEImgPtr(new CBSEImg(r)); d->SetHoleID(a_nHoleID); } CHoleBSEImgClr::CHoleBSEImgClr(CHoleBSEImgPtr a_pHoleBSEImg) // copy constructor { ASSERT(a_pHoleBSEImg); if (!a_pHoleBSEImg) { LogErrorTrace(__FILE__, __LINE__, _T("CHoleBSEImgClr: Generate CHoleBSEImgClr pointer failed.")); return; } m_HoleBSEImg = new CHoleBSEImgPtr(a_pHoleBSEImg); } CHoleBSEImgClr::CHoleBSEImgClr(CHoleBSEImg* a_pSource) // copy constructor { ASSERT(a_pSource); if (!a_pSource) { LogErrorTrace(__FILE__, __LINE__, _T("CHoleBSEImgClr: Generate CHoleBSEImgClr pointer failed.")); return; } m_HoleBSEImg = new CHoleBSEImgPtr(new CHoleBSEImg(a_pSource)); } CHoleBSEImgClr::~CHoleBSEImgClr() { if (m_HoleBSEImg != nullptr) { delete m_HoleBSEImg; m_HoleBSEImg = nullptr; } } CHoleBSEImgClr::!CHoleBSEImgClr() { if (m_HoleBSEImg != nullptr) { delete m_HoleBSEImg; m_HoleBSEImg = nullptr; } } int CHoleBSEImgClr::GetHoleID() { int nParticleType = -1; if (m_HoleBSEImg != nullptr) { nParticleType = (int)m_HoleBSEImg->get()->GetHoleID(); } return nParticleType; } void CHoleBSEImgClr::SetHoleID(int a_nHoleID) { if (m_HoleBSEImg != nullptr) { m_HoleBSEImg->get()->SetHoleID(a_nHoleID); } } // get CHoleBSEImgPtr CHoleBSEImgPtr CHoleBSEImgClr::GetHoleBSEImgPtr() { return *m_HoleBSEImg; } }