123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- #pragma once
- #include "stdafx.h"
- #include "OTSFieldMgr.h"
- #include "OTSImageProcess.h"
- #include "otsdataconst.h"
- #include "BSEImgFileMgr.h"
- #include "SmplMsrResultFile.h"
- #include "PosXrayFileMgr.h"
- #include "IncAFileMgr.h"
- #include "DBConst.h"
- //#include "IClassifyEngine.h"
- namespace OTSMODEL {
- using namespace OTSSQLITE;
- //using namespace OTSClassifyEngine;
- COTSFieldMgr::COTSFieldMgr()
- : m_pFieldData(nullptr)
- {
- }
- COTSFieldMgr::~COTSFieldMgr()
- {
- }
- // init
- BOOL COTSFieldMgr::Init(COTSFieldDataPtr a_pFieldData, CBSEImgPtr a_pBSEImg)
- {
- ASSERT(a_pFieldData);
- if (!a_pFieldData)
- {
- // invalid field data.
- LogErrorTrace(__FILE__, __LINE__, _T("Init: invalid field data."));
- return FALSE;
- }
- ASSERT(a_pBSEImg);
- if (!a_pBSEImg)
- {
- // invalid BSE image.
- LogErrorTrace(__FILE__, __LINE__, _T("SetBSEImage: invalid BSE image."));
- return FALSE;
- }
- // keep the original field data pointer
- m_pFieldData = a_pFieldData;
- // make a copy of the BSE image
- //m_pBSEImg = CBSEImgPtr(new CBSEImg(a_pBSEImg.get()));
- m_pBSEImg = a_pBSEImg;
- // create measure result
- m_pMsrResults = CMsrResultsPtr(new CMsrResults());
- // ok, return TRUE
- return TRUE;
- }
- // field data
- void COTSFieldMgr::SetOTSFieldData(COTSFieldDataPtr a_pOTSFieldData)
- {
- ASSERT(a_pOTSFieldData);
- if (!a_pOTSFieldData)
- {
- // invalid field data.
- LogErrorTrace(__FILE__, __LINE__, _T("SetOTSFieldData: invalid field data."));
- return;
- }
- m_pFieldData = a_pOTSFieldData;
- }
- // BSE image
- void COTSFieldMgr::SetBSEImage(CBSEImgPtr a_pBSEImg)
- {
- ASSERT(a_pBSEImg);
- if (!a_pBSEImg)
- {
- // invalid BSE image.
- LogErrorTrace(__FILE__, __LINE__, _T("SetBSEImage: invalid BSE image."));
- return;
- }
- m_pBSEImg = a_pBSEImg;
- }
-
- void COTSFieldMgr::SetAnalysisPosXayList(CPosXrayList& a_listPosXray, BOOL a_bClear)
- {
- if (a_bClear)
- {
- m_listAnalysisPosXray.clear();
- }
- for (auto pPosXray : a_listPosXray)
- {
- m_listAnalysisPosXray.push_back(pPosXray);
- }
- }
-
-
-
-
-
- void COTSFieldMgr::SetMsrResult(CMsrResultsPtr a_pMsrResults)
- {
- ASSERT(a_pMsrResults);
- if (!a_pMsrResults)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetMsrResult: invalid pointer."));
- return;
- }
-
- m_pMsrResults = a_pMsrResults;
- }
-
-
-
-
-
-
-
- BOOL COTSFieldMgr::GetIncAParticleList(COTSParticleList& a_listParticleOut)
- {
- // field data
- ASSERT(m_pFieldData);
- if (!m_pFieldData)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetIncAParticleList: empty filed data pointer."));
- return FALSE;
- }
- COTSParticleList listParticleIn = m_pFieldData->GetParticleList();
- a_listParticleOut.clear();
- for (auto pParticle : listParticleIn)
- {
- int nType = (int)pParticle->GetType();
- if (nType > (int)OTS_PARTCLE_TYPE::NO_ANALYSIS_X_RAY)
- {
- a_listParticleOut.push_back(pParticle);
- }
- }
- return TRUE;
- }
-
-
-
-
- }
|