| | |
| | | |
| | | enum TYPE_MANUAL_CMD |
| | | { |
| | | M_CMD_PROC_SHORT_START = 0, |
| | | M_CMD_PROC_RIP_START = 0, |
| | | M_CMD_PROC_SHORT_START, |
| | | M_CMD_PROC_LONG_START, |
| | | M_CMD_PROC_ALL_START, |
| | | M_CMD_IMG_LOAD_ALL, |
| | |
| | | |
| | | void CViewMain_ScanImage::OnShowWindow(BOOL bShow, UINT nStatus) |
| | | { |
| | | if(bShow == TRUE) |
| | | { |
| | | if(bShow == TRUE) { |
| | | int nSide; |
| | | CString strTitle; |
| | | for(int i = 0 ; i < MAX_PANEL_SIDE * UPDN_TYPE; i++) |
| | | { |
| | | for(int i = 0 ; i < MAX_PANEL_SIDE * UPDN_TYPE; i++) { |
| | | nSide = GetSideIdx(i); |
| | | m_frameImg[i].SetSideIdx(nSide); |
| | | m_frameImg[i].SetGlassData(m_pGlassData); |
| | |
| | | m_frameImg[i].Invalidate(); |
| | | |
| | | if(m_pHardware != NULL) { |
| | | CCameraSettings *pCamera = LiveGetSideIdx(i); |
| | | CCameraSettings *pCamera = GetCameraSettingsByViewIndex(i); |
| | | if(pCamera != NULL) { |
| | | double dPixelSizeX = pCamera->m_dConvResolution[0]; |
| | | double dPixelSizeY = pCamera->m_dScanResolution[0]; |
| | | m_frameImg[i].SetPixelSize(dPixelSizeX, dPixelSizeY); |
| | | |
| | | strTitle.Format(_T("BORD[%d] CHANNEL[%d]"), pCamera->m_iCamera, 0); |
| | | m_staticCamInfo[i].SetWindowText(strTitle); |
| | | } |
| | | |
| | | strTitle.Format(_T("BORD[%d] CHANNEL[%d]"),pCamera->m_iCamera, 0); |
| | | m_staticCamInfo[i].SetWindowText(strTitle); |
| | | } |
| | | } |
| | | |
| | | if (m_pGlassData != nullptr) { |
| | | m_frameImg[i].SetRecipe(m_pGlassData->GetGlassRecipe()); |
| | | } |
| | | } |
| | | |
| | | m_bInitDlg = TRUE; |
| | |
| | | BYTE* CViewMain_ScanImage::GetBufferPoint(int nViewIndex,int nPos /*= 0*/) |
| | | { |
| | | BYTE *add = NULL; |
| | | int nIdx_Side = GetSideIdx(nViewIndex); |
| | | int nIdx_Side = GetSideIdx(nViewIndex); |
| | | |
| | | LPBYTE plpBuf = NULL; |
| | | if(m_IV2M != NULL) |
| | | plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)nIdx_Side,nPos); |
| | | |
| | | if (m_IV2M != NULL) { |
| | | plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)nIdx_Side, nPos); |
| | | } |
| | | |
| | | return plpBuf; |
| | | } |
| | | |
| | |
| | | PROG_MSG MsgJob = *((PROG_MSG*)wParam); |
| | | |
| | | int nIndex = GetViewIndex(MsgJob.nSide); |
| | | if(MsgJob.nState == 2) |
| | | { |
| | | if(MsgJob.nState == 2) { |
| | | InitScrollInfo(MsgJob.nSide,1); |
| | | |
| | | m_ctrlScrollV[nIndex].EnableWindow(TRUE); |
| | |
| | | m_frameImg[nIndex].SetGlassData(m_pGlassData); |
| | | m_frameImg[nIndex].Invalidate(); |
| | | } |
| | | else |
| | | { |
| | | /* |
| | | if(fabs(m_dZoom - 1.) > 0.01) |
| | | { |
| | | m_dZoom = 0.2; |
| | | m_sliderZoom.SetPos(0); |
| | | |
| | | CString strTmp; |
| | | strTmp.Format(_T("X %.2f"),m_dZoom); |
| | | GetDlgItem(IDC_ST_ZOOM)->SetWindowText(strTmp); |
| | | |
| | | UpdateZoom(); |
| | | } |
| | | */ |
| | | |
| | | //g_pLog->DisplayMessage(_T("Frame Display %d"),nIndex); |
| | | else { |
| | | CPoint ptOrg = m_frameImg[nIndex].GetDisplayPos(); |
| | | ptOrg.y = MsgJob.nDispLine; |
| | | |
| | |
| | | |
| | | void CViewMain_ScanImage::SetupImageSave() |
| | | { |
| | | ManualThreadStart(M_CMD_IMG_SAVE_ALL,-1); |
| | | ManualThreadStart(M_CMD_IMG_SAVE_ALL, -1); |
| | | } |
| | | |
| | | void CViewMain_ScanImage::SetRecipe(CHardwareSettings *pHW) |
| | |
| | | |
| | | void CViewMain_ScanImage::ResetView() |
| | | { |
| | | for(int i = 0; i < MAX_PANEL_SIDE * UPDN_TYPE; i++) |
| | | { |
| | | for(int i = 0; i < MAX_PANEL_SIDE * UPDN_TYPE; i++) { |
| | | m_ctrlScrollV[i].EnableWindow(FALSE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CViewMain_ScanImage::ViewRefresh(PROG_MSG ProcMsg) |
| | |
| | | if (NULL == pGlassRcp) return; |
| | | #endif |
| | | |
| | | CString strRcpName = pGlassRcp->GetRecipeName(); |
| | | CString strGlassID = g_pBase->m_strHPanelID; |
| | | CString strRcpName = pGlassRcp->GetRecipeName(); |
| | | CString strGlassID = g_pBase->m_strHPanelID; |
| | | |
| | | if(strGlassID.IsEmpty() == TRUE) { |
| | | strGlassID = _T("Manual_ID"); |
| | |
| | | if(nLength > 10) { |
| | | if(ptStart.y+nLength < nMaxSize) { |
| | | strPath.Format(_T("%s\\DebugFullImage\\%s\\%s\\%s\\%s\\%s__%s_%d"),PATH_INSPECTION_DATA,strDate,strRcpName,strGlassID,strTime,strGlassID,PANEL_SIDE[iSide],nFrame); |
| | | m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength); |
| | | m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength); |
| | | g_pLog->DisplayMessage(_T("%s %d Save Completed : %s"), PANEL_SIDE[iSide], nFrame, strPath); |
| | | } |
| | | } |
| | | |
| | | g_pLog->DisplayMessage(_T("%s %d Save Completed : %s"),PANEL_SIDE[iSide],nFrame,strPath); |
| | | } |
| | | } |
| | | |
| | |
| | | CViewMain_ScanImage *pDlg = (CViewMain_ScanImage*)pParam; |
| | | int i =0; |
| | | if(pDlg->m_nThreadCmd == M_CMD_PROC_ALL_START |
| | | || pDlg->m_nThreadCmd == M_CMD_PROC_LONG_START |
| | | || pDlg->m_nThreadCmd == M_CMD_PROC_SHORT_START |
| | | || pDlg->m_nThreadCmd == M_CMD_PROC_LONG_START) |
| | | || pDlg->m_nThreadCmd == M_CMD_PROC_RIP_START) |
| | | { |
| | | pDlg->m_IV2M->IV2M_InspectionProcessAll(pDlg->m_nThreadCmd); |
| | | } |
| | |
| | | ManualThreadStart(M_CMD_PROC_SHORT_START); |
| | | break; |
| | | |
| | | //case 3: |
| | | // ManualThreadStart(M_CMD_PROC_RIP_START); |
| | | // break; |
| | | case 3: |
| | | ManualThreadStart(M_CMD_PROC_RIP_START); |
| | | break; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | CCameraSettings* CViewMain_ScanImage::LiveGetSideIdx(int nViewIndex) |
| | | CCameraSettings* CViewMain_ScanImage::GetCameraSettingsByViewIndex(int nViewIndex) |
| | | { |
| | | CCameraSettings* pCamera = NULL; |
| | | if (m_pHardware != nullptr) { |
| | | int nSide = GetSideIdx(nViewIndex); |
| | | int nCamera = m_pHardware->GetCameraIndexToDimension((DimensionDir)nSide); |
| | | if (nViewIndex < MAX_PANEL_SIDE) { |
| | | // Long side |
| | | pCamera = m_pHardware->GetCameraSettings(nCamera, 0); |
| | | } |
| | | else if (nViewIndex < 2 * MAX_PANEL_SIDE) { |
| | | // Short side |
| | | pCamera = m_pHardware->GetCameraSettings(nCamera, 1); |
| | | } |
| | | else { |
| | | // Rip side |
| | | int nRipIndex = nViewIndex - 2 * MAX_PANEL_SIDE; |
| | | int nRipCamera = nRipIndex / 2 + MAX_PANEL_SIDE; |
| | | if (nRipIndex % 2 != 0) { |
| | | pCamera = m_pHardware->GetCameraSettings(nCamera, 0); |
| | | } |
| | | else { |
| | | pCamera = m_pHardware->GetCameraSettings(nCamera, 1); |
| | | } |
| | | } |
| | | if (nullptr == m_pHardware) { |
| | | return pCamera; |
| | | } |
| | | |
| | | return pCamera; |
| | | // ViewIndex -> DimensionDir |
| | | static const DimensionDir SIDE_MAP[] = { |
| | | DIMENSION_C, DIMENSION_C_DN, |
| | | DIMENSION_A, DIMENSION_A_DN, |
| | | DIMENSION_D, DIMENSION_D_DN, |
| | | DIMENSION_B, DIMENSION_B_DN, |
| | | DIMENSION_A_RIP, DIMENSION_B_RIP, |
| | | DIMENSION_C_RIP, DIMENSION_D_RIP |
| | | }; |
| | | |
| | | if (nViewIndex < 0 || nViewIndex >= _countof(SIDE_MAP)) { |
| | | AfxMessageBox(_T("GetCameraSettingsByViewIndex: Invalid view index")); |
| | | return nullptr; |
| | | } |
| | | |
| | | DimensionDir eSide = SIDE_MAP[nViewIndex]; |
| | | int nScan = m_pHardware->GetScanToDimension(eSide); |
| | | int nCamera = m_pHardware->GetCameraIndexToDimension(eSide); |
| | | return pCamera = m_pHardware->GetCameraSettings(nCamera, nScan); |
| | | } |