// ReviewProcessor.cpp : 구현 파일입니다.
|
//
|
|
#include "stdafx.h"
|
#include "ReviewProcessor.h"
|
#include "CHCommonClasses/ProcessTimer.h"
|
#include "CHImageControls/CHImageProcess.h"
|
#include "CHReviewRecipe/RsRcpReviewInfo.h"
|
#include "CHReviewRecipe/RcpLightInfo.h"
|
#include "CHReviewRecipe/RsRcpDefectFindInfo.h"
|
#include "CameraControlReview.h"
|
#include "CHSignalControls/SignalControl.h"
|
#include "CHWsiControls/WsiControl.h"
|
#include "CHEdgeTriangle/RecipeManager.h"
|
#include "CHEdgeTriangle/EdgeTriangle.h"
|
|
using namespace CHReviewResult;
|
using namespace CHImageControls;
|
|
// CReviewProcessor
|
CReviewProcessor::CReviewProcessor(int nThreadCount) : CWorkThreadPools(nThreadCount)
|
{
|
// gdiplus startup
|
if (gpGdiplusToken==NULL)
|
{
|
GdiplusStartupInput gdiplusStartupInput;
|
GdiplusStartup(&gpGdiplusToken, &gdiplusStartupInput, NULL);
|
gpGdiplusTokenCount++;
|
}
|
|
|
InitializeCriticalSection(&m_csUseThreadIndex);
|
|
m_pView = NULL;
|
m_pRP2P = NULL;
|
|
m_pReviewDefectFinder = new CReviewDefectFinder[nThreadCount];
|
m_pEdgeTriangle = new CEdgeTriangle[nThreadCount];
|
m_pUseThreadIndex = new bool [nThreadCount];
|
for (int i=0; i<m_nThreadCount; i++)
|
{
|
m_pUseThreadIndex[i] = false;
|
}
|
|
|
// m_pManageResultFileCD = NULL;
|
// m_pManageResultFileSD = NULL;
|
|
m_strSaveImageBasePath = _T("D:\\ResultData\\Image");
|
m_strSaveImageUploadPath = _T("D:\\ResultData\\UploadImage");
|
// [2017:6:6]-[WEZASW] :
|
m_strInspectImagePath = _T("D:\\Image\\Defect");
|
|
m_strRTMSImagePath = _T("");
|
m_nLineType = -1;
|
m_nMachineType = -1;
|
m_strEqpID = _T("");
|
m_strJobID = _T("");
|
m_strOperID = _T("");
|
m_nReviewCount = 0;
|
|
m_nReviewResizeWidth = 1224;
|
m_nReviewResizeHeight = 1024;
|
m_nReviewImageSize = 150000; //byte
|
m_nReviewImageQuality = 50;
|
m_nReviewImageStep = 5;
|
m_dReviewImageScale = 1.0;
|
m_bReviewOriginalImage = false;
|
|
m_bDefectFindProcess = FALSE;
|
|
m_nReviewProcessStatus = ReviewProcessStatus_None;
|
m_nReviewPlanIndex = 0;
|
|
m_vecCellIndex.clear();
|
m_vecCellId.clear();
|
}
|
|
CReviewProcessor::~CReviewProcessor(void)
|
{
|
if (m_pReviewDefectFinder)
|
{
|
delete [] m_pReviewDefectFinder;
|
}
|
m_pReviewDefectFinder = NULL;
|
|
if (m_pEdgeTriangle)
|
{
|
delete [] m_pEdgeTriangle;
|
}
|
m_pEdgeTriangle = NULL;
|
|
if (m_pUseThreadIndex)
|
{
|
delete [] m_pUseThreadIndex;
|
}
|
m_pUseThreadIndex = NULL;
|
|
DeleteCriticalSection(&m_csUseThreadIndex);
|
|
// gdiplus shutdown
|
gpGdiplusTokenCount--;
|
if (gpGdiplusToken && gpGdiplusTokenCount==0)
|
{
|
GdiplusShutdown(gpGdiplusToken);
|
gpGdiplusToken = NULL;
|
}
|
}
|
|
void CReviewProcessor::UpdateReviewProcessStatus(int nReviewStatus, int nPlanIndex)
|
{
|
m_nReviewProcessStatus = nReviewStatus;
|
m_nReviewPlanIndex = nPlanIndex;
|
}
|
|
|
int CReviewProcessor::LockThreadIndex()
|
{
|
if (m_pUseThreadIndex==NULL) return -1;
|
|
EnterCriticalSection(&m_csUseThreadIndex);
|
|
int nThreadIdx = -1;
|
for (int i=0; i<m_nThreadCount; i++)
|
{
|
if (!m_pUseThreadIndex[i])
|
{
|
m_pUseThreadIndex[i] = true;
|
|
nThreadIdx = i;
|
break;
|
}
|
}
|
|
LeaveCriticalSection(&m_csUseThreadIndex);
|
|
return nThreadIdx;
|
}
|
|
void CReviewProcessor::UnlockThreadIndex(int nIndex)
|
{
|
if (m_pUseThreadIndex==NULL) return;
|
|
EnterCriticalSection(&m_csUseThreadIndex);
|
|
if (nIndex>-1 && nIndex<m_nThreadCount)
|
{
|
m_pUseThreadIndex[nIndex] = false;
|
}
|
|
LeaveCriticalSection(&m_csUseThreadIndex);
|
}
|
|
void CReviewProcessor::SetView(CView *pView)
|
{
|
m_pView = pView;
|
}
|
|
void CReviewProcessor::SetRP2P(IReviewProcessor2Parent *pRP2P)
|
{
|
m_pRP2P = pRP2P;
|
}
|
|
void CReviewProcessor::SetLineMachineType(int nLineType, int nMachineType, CString strEqpID)
|
{
|
m_nLineType = nLineType;
|
m_nMachineType = nMachineType;
|
m_strEqpID = strEqpID;
|
}
|
|
void CReviewProcessor::SetJobID(const CString& strJobID)
|
{
|
m_strJobID = strJobID;
|
}
|
|
void CReviewProcessor::SetOperID(const CString& strOperID)
|
{
|
m_strOperID = strOperID;
|
}
|
|
void CReviewProcessor::SetReviewCount(int nCount)
|
{
|
m_nReviewCount = nCount;
|
}
|
|
void CReviewProcessor::SetSaveImageBasePath(const CString& strPath)
|
{
|
m_strSaveImageBasePath = strPath;
|
}
|
|
BOOL CReviewProcessor::SetReviewImageInfo(int nWidth, int nHeight, int nSize, int nQuality, int nStep, double dScale)
|
{
|
if (nQuality>100 || nStep<1 || nStep>10) return FALSE;
|
|
m_nReviewResizeWidth = nWidth;
|
m_nReviewResizeHeight = nHeight;
|
m_nReviewImageSize = nSize; //byte
|
m_nReviewImageQuality = nQuality;
|
m_nReviewImageStep = nStep;
|
m_dReviewImageScale = dScale;
|
|
return TRUE;
|
}
|
|
BOOL CReviewProcessor::SetReviewImageInfo(int nWidth, int nHeight, int nSize, int nQuality, int nStep, double dScale, BOOL bOriginImg, int nImageRotate, int nImageFlip)
|
{
|
if (nQuality>100 || nStep<1 || nStep>10) return FALSE;
|
|
if (nImageRotate == 1 || nImageRotate == 3)
|
{
|
m_nReviewResizeWidth = nHeight;
|
m_nReviewResizeHeight = nWidth;
|
}
|
else
|
{
|
m_nReviewResizeWidth = nWidth;
|
m_nReviewResizeHeight = nHeight;
|
}
|
m_nReviewImageSize = nSize; //byte
|
m_nReviewImageQuality = nQuality;
|
m_nReviewImageStep = nStep;
|
m_dReviewImageScale = dScale;
|
|
m_bReviewOriginalImage = bOriginImg;
|
m_nImageRotate = nImageRotate;
|
m_nimageFlip = nImageFlip;
|
|
return TRUE;
|
}
|
|
void CReviewProcessor::SetUploadImagePath(const CString& strImagePath)
|
{
|
m_strSaveImageUploadPath = strImagePath;
|
}
|
|
void CReviewProcessor::SetReviewImagePath(const CString& strImagePath)
|
{
|
m_strSaveImageReviewPath = strImagePath;
|
}
|
|
void CReviewProcessor::GetSaveImageBasePath( CString& strPath )
|
{
|
strPath = m_strSaveImageBasePath;
|
}
|
|
CString CReviewProcessor::GetUploadImagePath()
|
{
|
return m_strSaveImageUploadPath;
|
}
|
|
CString CReviewProcessor::GetReviewUploadImagePath()
|
{
|
return m_strSaveImageReviewPath;
|
}
|
|
void CReviewProcessor::SetRTMSUploadImagePath(const CString& strImagePath)
|
{
|
m_strRTMSImagePath = strImagePath;
|
}
|
|
CString CReviewProcessor::GetRTMSUploadImagePath()
|
{
|
return m_strRTMSImagePath;
|
}
|
|
void CReviewProcessor::SetDefectFindInfo(const CRsRcpDefectFindInfo* pDefectFindInfo)
|
{
|
if (pDefectFindInfo==NULL) return;
|
|
m_bDefectFindProcess = pDefectFindInfo->m_bDefectFind;
|
|
m_ReviewDefectFindParam.nDirection = pDefectFindInfo->m_nDirection;
|
m_ReviewDefectFindParam.dPitchX = pDefectFindInfo->m_nDFPitchX;
|
m_ReviewDefectFindParam.dPitchY = pDefectFindInfo->m_nDFPitchY;
|
m_ReviewDefectFindParam.nAutoPitchRange = pDefectFindInfo->m_nDFAutoPitchRange;
|
m_ReviewDefectFindParam.nThreshold = pDefectFindInfo->m_nDFThreshold;
|
}
|
|
UINT64 CReviewProcessor::SaveReviewImage(CCHImageData* pImageData, const CString& strFilename, UINT64 nMaxSize, int nQuality, int nStep)
|
{
|
if (pImageData==NULL) return 0;
|
|
UINT64 nSize = 0;
|
BOOL bFind = FALSE;
|
CFileFind finder;
|
do
|
{
|
if (pImageData->SaveImage(strFilename, nQuality)==FALSE)
|
{
|
|
return 0;
|
}
|
|
bFind = finder.FindFile(strFilename);
|
if (bFind==FALSE) return 0;
|
|
bFind = finder.FindNextFile();
|
|
nSize = finder.GetLength();
|
|
nQuality -= nStep;
|
|
if (nQuality<1 || nQuality>100)
|
{
|
return 0;
|
}
|
} while (nSize > nMaxSize);
|
|
return nSize;
|
}
|
|
BOOL CReviewProcessor::SaveReviewImage(CCHImageData* pImageData, const CString& strFilename)
|
{
|
if (pImageData==NULL) return 0;
|
|
BOOL bFind = FALSE;
|
CFileFind finder;
|
if (pImageData->SaveImage(strFilename)==FALSE) { return 0; }
|
|
bFind = finder.FindFile(strFilename);
|
|
return bFind;
|
}
|
|
void CReviewProcessor::DrawText(CDC *pDC, int nStartX, int nStartY, const VectorPoint& vectorPoint, const VectorString& vectorString)
|
{
|
if (pDC==NULL) return;
|
|
pDC->SelectStockObject(WHITE_PEN);
|
|
CFont font;
|
VERIFY(font.CreateFont(
|
17, // nHeight
|
9, // nWidth
|
0, // nEscapement
|
0, // nOrientation
|
FW_NORMAL, // nWeight
|
FALSE, // bItalic
|
FALSE, // bUnderline
|
0, // cStrikeOut
|
ANSI_CHARSET, // nCharSet
|
OUT_DEFAULT_PRECIS, // nOutPrecision
|
CLIP_DEFAULT_PRECIS, // nClipPrecision
|
DEFAULT_QUALITY, // nQuality
|
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
|
_T("Arial"))); // lpszFacename
|
|
// Do something with the font just created...
|
CFont* def_font = pDC->SelectObject(&font);
|
// pDC->SetTextColor(RGB(255,255,255));
|
// pDC->SetBkMode(TRANSPARENT);
|
pDC->SetTextColor(RGB(255,255,0));
|
pDC->SetBkColor(RGB(0, 0, 0));
|
pDC->SetBkMode(OPAQUE);
|
|
// text out
|
for (int i=0; i<(int)vectorPoint.size(); i++)
|
{
|
pDC->TextOut(vectorPoint[i].x + nStartX, vectorPoint[i].y + nStartY, vectorString[i]);
|
}
|
}
|
|
void CReviewProcessor::DrawRuler(CDC *pDC, int nWidth, int nHeight, double dResolution, double dRulerGab)
|
{
|
if (pDC==NULL || dRulerGab==0.0 || dResolution==0.0) return;
|
if (nWidth==0 || nHeight==0) return;
|
|
pDC->SelectStockObject(WHITE_PEN);
|
|
CFont font;
|
VERIFY(font.CreateFont(
|
10, // nHeight
|
5, // nWidth
|
0, // nEscapement
|
0, // nOrientation
|
FW_NORMAL, // nWeight
|
FALSE, // bItalic
|
FALSE, // bUnderline
|
0, // cStrikeOut
|
ANSI_CHARSET, // nCharSet
|
OUT_DEFAULT_PRECIS, // nOutPrecision
|
CLIP_DEFAULT_PRECIS, // nClipPrecision
|
DEFAULT_QUALITY, // nQuality
|
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
|
_T("Arial"))); // lpszFacename
|
|
// Do something with the font just created...
|
CFont* def_font = pDC->SelectObject(&font);
|
pDC->SetTextColor(RGB(255,255,255));
|
pDC->SetBkMode(TRANSPARENT);
|
|
// ruler
|
double dResX = dResolution;
|
double dResY = dResolution;
|
double dGabX = dRulerGab / dResX; // um
|
double dGabY = dRulerGab / dResY; // um
|
|
if (dGabX<=0.0 || dGabY<=0.0) return;
|
|
double dWidth = nWidth;
|
double dHeight = nHeight;
|
double dCenterX = dWidth/2.0;
|
double dCenterY = dHeight/2.0;
|
|
// x direction
|
CString strValue = _T("");
|
strValue.Format(_T("%.1lf um"), dRulerGab);
|
pDC->TextOut(5, nHeight/2+5, strValue);
|
for (double dPos=dCenterX; dPos>=0.0; dPos-=dGabX)
|
{
|
pDC->MoveTo((int)(dPos+0.5), 0);
|
pDC->LineTo((int)(dPos+0.5), 6);
|
}
|
for (double dPos=dCenterX+dGabX; dPos<dWidth; dPos+=dGabX)
|
{
|
pDC->MoveTo((int)(dPos+0.5), 0);
|
pDC->LineTo((int)(dPos+0.5), 6);
|
}
|
|
// y direction
|
strValue.Format(_T("%.1lf um"), dRulerGab);
|
pDC->TextOut(nWidth/2+5, 5, strValue);
|
for (double dPos=dCenterY; dPos>0.0; dPos-=dGabY)
|
{
|
pDC->MoveTo(0, (int)(dPos+0.5));
|
pDC->LineTo(6, (int)(dPos+0.5));
|
}
|
for (double dPos=dCenterY+dGabY; dPos<dHeight; dPos+=dGabY)
|
{
|
pDC->MoveTo(0, (int)(dPos+0.5));
|
pDC->LineTo(6, (int)(dPos+0.5));
|
}
|
}
|
|
void CReviewProcessor::DrawDefectPosCursor(CDC* pDC, int nDefectPosX, int nDefectPosY)
|
{
|
if (pDC==NULL) return;
|
|
POINT ptTemp;
|
CPen pen, *pOldPen;
|
pen.CreatePen(PS_SOLID, 2, RGB(0,255,0));
|
pOldPen = (CPen*) pDC->SelectObject(&pen);
|
|
ptTemp.x = nDefectPosX;
|
ptTemp.y = nDefectPosY;
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x + 14;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x - 4;
|
ptTemp.y = ptTemp.y - 4;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x + 10;
|
ptTemp.y = ptTemp.y - 10;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x - 6;
|
ptTemp.y = ptTemp.y - 6;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x - 10;
|
ptTemp.y = ptTemp.y + 10;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x - 4;
|
ptTemp.y = ptTemp.y - 4;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.y = ptTemp.y + 14;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->SelectObject(pOldPen);
|
}
|
|
void CReviewProcessor::DrawDefectRect(CDC* pDC, const CRect& rtRect)
|
{
|
if (pDC==NULL) return;
|
|
CPen pen, *pOldPen;
|
pen.CreatePen(PS_SOLID, 2, RGB(0,255,0));
|
pOldPen = (CPen*) pDC->SelectObject(&pen);
|
pDC->SelectStockObject(NULL_BRUSH);
|
|
pDC->Rectangle(rtRect);
|
|
/* ptTemp.x = nDefectPosX;
|
ptTemp.y = nDefectPosY;
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x + 14;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x - 4;
|
ptTemp.y = ptTemp.y - 4;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x + 10;
|
ptTemp.y = ptTemp.y - 10;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x - 6;
|
ptTemp.y = ptTemp.y - 6;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x - 10;
|
ptTemp.y = ptTemp.y + 10;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.x = ptTemp.x - 4;
|
ptTemp.y = ptTemp.y - 4;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
|
pDC->MoveTo(ptTemp.x, ptTemp.y);
|
ptTemp.y = ptTemp.y + 14;
|
pDC->LineTo(ptTemp.x, ptTemp.y);
|
*/
|
|
pDC->SelectObject(pOldPen);
|
}
|
|
// PCControl Control command
|
BOOL CReviewProcessor::Signal_SendSignal(int nSignalIndex)
|
{
|
CSignalControl *pSignalControl = m_pRP2P->IRP2P_GetSignalControl();
|
|
if (pSignalControl==NULL) return FALSE;
|
|
int nAddrIdx = 0;
|
if (pSignalControl->Write_SendSignal(nAddrIdx, nSignalIndex, 1, 2000))
|
{
|
m_pRP2P->IRP2P_DisplayMessage(_T("[PCControl_Send] Send Fail! "));
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
// Review Camera Control Command
|
void CReviewProcessor::ReviewCamera_CameraControl(int nControlCmd)
|
{
|
int nModuleCount = Module_GetModuleStatusCount();
|
|
for (int nModuleIdx=0; nModuleIdx<nModuleCount; nModuleIdx++)
|
{
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIdx);
|
CCameraControlReview *pReviewCameraControl = ReviewCamera_GetReviewCameraControl(nModuleIdx);
|
|
if (pCameraControl==NULL || pReviewCameraControl==NULL) continue;
|
|
if (pCameraControl->nCameraControl != nControlCmd)
|
{
|
pReviewCameraControl->Camera_Control(nControlCmd);
|
|
pCameraControl->nCameraControl = nControlCmd;
|
|
m_pRP2P->IRP2P_UpdateCameraControl(nModuleIdx, pCameraControl, NULL);
|
}
|
}
|
}
|
|
BOOL CReviewProcessor::ReviewCamera_CameraControl(int nModuleIndex, int nControlCmd)
|
{
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CCameraControlReview *pReviewCameraControl = ReviewCamera_GetReviewCameraControl(nModuleIndex);
|
if (pCameraControl==NULL || pReviewCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (nControlCmd!=CameraControlStop)
|
{
|
pReviewCameraControl->Camera_Control(CameraControlStop);
|
}
|
|
if(pReviewCameraControl->Camera_Control(nControlCmd))
|
{
|
pCameraControl->nCameraControl = nControlCmd;
|
m_pRP2P->IRP2P_UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
|
int CReviewProcessor::ReviewCamera_GetReviewCameraControlCount() const
|
{
|
return m_pRP2P->IRP2P_GetReviewCameraControlCount();
|
}
|
|
CCameraControlReview* CReviewProcessor::ReviewCamera_GetReviewCameraControl(int nModuleIndex)
|
{
|
return m_pRP2P->IRP2P_GetReviewCameraControl(nModuleIndex);
|
}
|
|
// getter module status
|
int CReviewProcessor::Module_GetModuleStatusCount(int nModuleType) const
|
{
|
return m_pRP2P->IRP2P_GetModuleStatusCount(nModuleType);
|
}
|
|
CModuleStatus* CReviewProcessor::Module_GetModuleStatus(int nModuleIdx)
|
{
|
return m_pRP2P->IRP2P_GetModuleStatus(nModuleIdx);
|
}
|
|
SCameraControl* CReviewProcessor::Module_GetCameraControl(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetCameraControl();
|
}
|
|
SMotorPosition* CReviewProcessor::Module_GetMotorPosition(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetMotorPosition();
|
}
|
|
SMotorStatus* CReviewProcessor::Module_GetMotorStatus(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetMotorStatus();
|
}
|
|
SAxisIndex* CReviewProcessor::Module_GetAxisIndex(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetAxisIndex();
|
}
|
|
SCoordInfo* CReviewProcessor::Module_GetCoordInfo(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetCoordInfo();
|
}
|
|
SCameraInfo* CReviewProcessor::Module_GetCurrentCameraInfo(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetCurrentCameraInfo();
|
}
|
|
SCameraInfo* CReviewProcessor::Module_GetCameraInfo(int nModuleIdx, int nZoomIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetCameraInfo(nZoomIdx);
|
}
|
|
BOOL CReviewProcessor::WSI_SetWSIEnd()
|
{
|
BOOL bReturn = TRUE;
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
bReturn = bReturn & WSI_SetWSIEnd(i);
|
}
|
return bReturn;
|
}
|
|
BOOL CReviewProcessor::WSI_SetWSITimeOver()
|
{
|
BOOL bReturn = TRUE;
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
bReturn = bReturn & WSI_SetWSITimeOver(i);
|
}
|
return bReturn;
|
}
|
|
BOOL CReviewProcessor::WSI_SetWSIEnd(int nModuleIndex)
|
{
|
if (nModuleIndex<0 || nModuleIndex>=Module_GetModuleStatusCount())
|
{
|
return FALSE;
|
}
|
|
CWsiControl *pWSIControl = m_pRP2P->IRP2P_GetWSIControl(nModuleIndex);
|
if (pWSIControl==NULL) return FALSE;
|
|
return pWSIControl->SetWsiEnd();
|
}
|
|
BOOL CReviewProcessor::WSI_SetWSITimeOver(int nModuleIndex)
|
{
|
if (nModuleIndex<0 || nModuleIndex>=Module_GetModuleStatusCount())
|
{
|
return FALSE;
|
}
|
|
CWsiControl *pWSIControl = m_pRP2P->IRP2P_GetWSIControl(nModuleIndex);
|
if (pWSIControl==NULL) return FALSE;
|
|
return pWSIControl->SetWsiTimeOver();
|
}
|
|
void CReviewProcessor::SetCellData(CGlassResult* pGlassResult)
|
{
|
m_vecCellId.clear();
|
m_vecCellIndex.clear();
|
|
int nVectorCellCount = pGlassResult->GetCellResultCount();
|
VectorCellResult* pVectorCellResult = pGlassResult->GetVectorCellResult();
|
|
for(int nVectorCellIdx = 0; nVectorCellIdx < nVectorCellCount; nVectorCellIdx++)
|
{
|
m_vecCellId.push_back(pVectorCellResult->at(nVectorCellIdx).strCellID);
|
m_vecCellIndex.push_back(0);
|
}
|
}
|
|
int CReviewProcessor::GetCellIdIdx(const CString& strCellID)
|
{
|
int nCellIDCount = (int)m_vecCellId.size();
|
|
for(int nCellIDIdx = 0; nCellIDIdx < nCellIDCount; nCellIDIdx++)
|
{
|
if(!strCellID.Compare(m_vecCellId.at(nCellIDIdx)))
|
{
|
return nCellIDIdx;
|
}
|
}
|
return -1;
|
}
|
|
void CReviewProcessor::DrawCenterLine( CDC *pDC, int nWidth, int nHeight )
|
{
|
|
if (pDC==NULL) return;
|
if (nWidth==0 || nHeight==0) return;
|
|
CPen CenterPen(PS_SOLID, 2, RGB(255,255,255));
|
pDC->SelectObject(&CenterPen);
|
|
double dWidth = nWidth;
|
double dHeight = nHeight;
|
double dCenterX = dWidth/2.0;
|
double dCenterY = dHeight/2.0;
|
|
// horizontal line
|
pDC->MoveTo(0, nHeight/2);
|
pDC->LineTo(nWidth, nHeight/2);
|
|
// vertical line
|
pDC->MoveTo(nWidth/2, 0);
|
pDC->LineTo(nWidth/2, nHeight);
|
}
|
|
void CReviewProcessor::DrawCenterRect( CDC *pDC, int nWidth, int nHeight, int nDrawWidth, int nDrawHeight, double dResolution )
|
{
|
if (pDC==NULL) return;
|
if (nWidth==0 || nHeight==0 || nDrawWidth==0 || nDrawHeight==0) return;
|
|
CPen CenterPen(PS_SOLID, 3, RGB(255,0,0));
|
pDC->SelectObject(&CenterPen);
|
|
int nPixelWidth = int(nDrawWidth/dResolution);
|
int nPixelHeight = int(nDrawHeight/dResolution);
|
int nCenterPixelX = nWidth/2;
|
int nCenterPixelY = nHeight/2;
|
|
// top line
|
pDC->MoveTo(nCenterPixelX-nPixelWidth/2, nCenterPixelY-nPixelHeight/2);
|
pDC->LineTo(nCenterPixelX+nPixelWidth/2, nCenterPixelY-nPixelHeight/2);
|
|
// left line
|
pDC->MoveTo(nCenterPixelX-nPixelWidth/2, nCenterPixelY-nPixelHeight/2);
|
pDC->LineTo(nCenterPixelX-nPixelWidth/2, nCenterPixelY+nPixelHeight/2);
|
|
// right line
|
pDC->MoveTo(nCenterPixelX+nPixelWidth/2, nCenterPixelY-nPixelHeight/2);
|
pDC->LineTo(nCenterPixelX+nPixelWidth/2, nCenterPixelY+nPixelHeight/2);
|
|
// bottom line
|
pDC->MoveTo(nCenterPixelX-nPixelWidth/2, nCenterPixelY+nPixelHeight/2);
|
pDC->LineTo(nCenterPixelX+nPixelWidth/2, nCenterPixelY+nPixelHeight/2);
|
}
|
|
void IReviewProcessor2Parent::IRP2P_UpdateWSISelfDiagnosisResult()
|
{
|
|
}
|