#include "stdafx.h" #include "BSEImgFileMgrClr.h" namespace OTSINTERFACE { //CMsrParamFileMrgClr CBSEImgFileMgrClr::CBSEImgFileMgrClr() // constructor { //Init(); m_BSEImgFileMgr = new CBSEImgFileMgrPtr(new CBSEImgFileMgr()); } CBSEImgFileMgrClr::CBSEImgFileMgrClr(CBSEImgFileMgrPtr a_pBSEFileMgr) { ASSERT(a_pBSEFileMgr); if (!a_pBSEFileMgr) { LogErrorTrace(__FILE__, __LINE__, _T("CBSEImgFileMgrClr::invalid pointer.")); return; } m_BSEImgFileMgr = new CBSEImgFileMgrPtr(a_pBSEFileMgr); } CBSEImgFileMgrClr::CBSEImgFileMgrClr(CBSEImgFileMgr* a_pSource) // copy constructor { ASSERT(a_pSource); if (!a_pSource) { LogErrorTrace(__FILE__, __LINE__, _T("CBSEImgClr: Generate CBSEImgFileMgrClr pointer failed.")); return; } m_BSEImgFileMgr = new CBSEImgFileMgrPtr(a_pSource); } CBSEImgFileMgrPtr CBSEImgFileMgrClr::GetBSEImgFileMgrPtr() { return *m_BSEImgFileMgr; } CBSEImgFileMgrClr::~CBSEImgFileMgrClr() { if (m_BSEImgFileMgr != nullptr) { delete m_BSEImgFileMgr; } } CBSEImgFileMgrClr::!CBSEImgFileMgrClr() { if (m_BSEImgFileMgr != nullptr) { delete m_BSEImgFileMgr; } } // Load/Save bool CBSEImgFileMgrClr::Load(String^ a_strPathName, bool a_bClear) { bool bRet = false; CBSEImgFileMgrPtr pBSEImgFileMgr = GetBSEImgFileMgrPtr(); ASSERT(a_strPathName); if (!a_strPathName) { LogErrorTrace(__FILE__, __LINE__, _T("CBSEImgFileMgrClr::Load:: invalid pointer.")); return false; } bRet = pBSEImgFileMgr->Load(a_strPathName, a_bClear); return bRet; } bool CBSEImgFileMgrClr::Save(String^ a_strPathName) { bool bRet = false; CBSEImgFileMgrPtr pBSEImgFileMgr = GetBSEImgFileMgrPtr(); ASSERT(a_strPathName); if (!a_strPathName) { LogErrorTrace(__FILE__, __LINE__, _T("CBSEImgFileMgrClr::Save:: invalid pointer.")); } bRet = pBSEImgFileMgr->Save(a_strPathName); return bRet; } // LoadFromBitmap bool CBSEImgFileMgrClr::LoadFromBitmap(String^ a_strPathName, bool a_bClear) { bool bRet = false; CBSEImgFileMgrPtr pBSEImgFileMgr = GetBSEImgFileMgrPtr(); ASSERT(a_strPathName); if (!a_strPathName) { LogErrorTrace(__FILE__, __LINE__, _T("LoadFromBitmap:: invalid pointer.")); return false; } bRet = pBSEImgFileMgr->LoadFromBitmap(a_strPathName, a_bClear); return bRet; } // SaveIntoBitmap bool CBSEImgFileMgrClr::SaveIntoBitmap(String^ a_strPathName) { bool bRet = false; CBSEImgFileMgrPtr pBSEImgFileMgr = GetBSEImgFileMgrPtr(); ASSERT(a_strPathName); if (!a_strPathName) { LogErrorTrace(__FILE__, __LINE__, _T("SaveIntoBitmap:: invalid pointer.")); return false; } bRet = pBSEImgFileMgr->SaveIntoBitmap(a_strPathName); return bRet; } // measurement parameters file bool CBSEImgFileMgrClr::SetBSEImg(CBSEImgClr^ a_poBSE) { if (this == nullptr) { LogErrorTrace(__FILE__, __LINE__, _T("SetBSEImg::empty object!")); return false; } CBSEImgFileMgrPtr pBSEImgFileMgr = GetBSEImgFileMgrPtr(); ASSERT(a_poBSE); if (!a_poBSE) { LogErrorTrace(__FILE__, __LINE__, _T("SetBSEImg::invalide param pointer.")); return false; } CBSEImgPtr poBSEImg = a_poBSE->GetBSEImgPtr(); ASSERT(poBSEImg); if (!poBSEImg) { LogErrorTrace(__FILE__, __LINE__, _T("SetBSEImg::invalide param pointer.")); return false; } pBSEImgFileMgr->SetBSEImg(poBSEImg); return true; } // file pathname String^ CBSEImgFileMgrClr::GetPathName() { String^ FilePathNameClr; if (m_BSEImgFileMgr != nullptr) { CBSEImgFileMgrPtr filePtr = *m_BSEImgFileMgr; CString sPathName = filePtr->GetPathName(); FilePathNameClr = gcnew String(sPathName); } return FilePathNameClr; } void CBSEImgFileMgrClr::SetPathName(String^ strPathName) { ASSERT(strPathName); if (!strPathName) { LogErrorTrace(__FILE__, __LINE__, _T("SetFileVersion: invalid version.")); } if (m_BSEImgFileMgr != nullptr) { CBSEImgFileMgrPtr filePtr= *m_BSEImgFileMgr; filePtr->SetPathName(strPathName); } } CBSEImgClr^ CBSEImgFileMgrClr::GetBSEImg() { CBSEImgClr^ BSEImgClr; if (m_BSEImgFileMgr != nullptr) { CBSEImgFileMgrPtr filePtr = *m_BSEImgFileMgr; CBSEImgPtr pBSEImg = filePtr->GetBSEImg(); ASSERT(pBSEImg); if (!pBSEImg) { LogErrorTrace(__FILE__, __LINE__, _T("COTSReportProjFileClr: invalid partSTDData pointer.")); return BSEImgClr; } BSEImgClr = gcnew CBSEImgClr(pBSEImg); } return BSEImgClr; } }