| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- #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;
- }
-
- }
|