// ViewLedRecipeSetting.cpp : 备泅 颇老涝聪促.
|
//
|
|
#include "stdafx.h"
|
#include "EdgeInspector_App.h"
|
#include "ViewMain_Recipe.h"
|
#include "afxdialogex.h"
|
#include "ViewRecipeList.h"
|
#include "ViewLampControl.h"
|
#include "DlgLogin.h"
|
#include "Global_Define.h"
|
// CViewLedRecipeSetting 措拳 惑磊涝聪促.
|
|
IMPLEMENT_DYNAMIC(CViewMain_Recipe, CDialogEx)
|
|
#if HALCON_VISION_KEY
|
static CViewMain_Recipe *m_pThis = NULL;
|
#endif
|
CViewMain_Recipe::CViewMain_Recipe(CWnd* pParent /*=NULL*/)
|
: CDialogEx(CViewMain_Recipe::IDD, pParent)
|
{
|
m_pDlgRecipe = new CGlassRecipe;
|
m_IV2M = NULL;
|
m_pGlassData = NULL;
|
m_pViewRecipeList = NULL;
|
m_pviewLightControl = NULL;
|
m_pViewSideDimensionSetting = NULL;
|
m_pViewSideNotchSetting = NULL;
|
m_pViewSideExceptionSetting = NULL;
|
m_pViewSideUserDefectSetting = NULL;
|
m_pHardware = NULL;
|
m_eSelectSide = eRcp_SideRD_A;
|
m_eSelectInsType = eRcp_InsType_Chip;
|
m_dScanTimeOut = 0.;
|
|
for(int i=0; i<MAX_MARKER_COUNT; i++)
|
{
|
m_pTopMarkImage[i] = NULL;
|
m_pBotMarkImage[i] = NULL;
|
}
|
|
ZeroMemory(m_bTopMarkImageAlloc, sizeof(m_bTopMarkImageAlloc));
|
ZeroMemory(m_bBotMarkImageAlloc, sizeof(m_bBotMarkImageAlloc));
|
|
m_strRecipeName = _T("");
|
m_strPPIDName = _T("");
|
|
m_eSelectLangType = emLanguageType_EN;
|
|
#if HALCON_VISION_KEY
|
m_pVisionSetDlg = NULL;
|
m_pThis = this;
|
#endif // HALCON_VISION_KEY
|
}
|
|
CViewMain_Recipe::~CViewMain_Recipe()
|
{
|
DeleteVectorList();
|
|
delete m_pDlgRecipe;
|
m_pDlgRecipe = NULL;
|
|
if(m_pViewRecipeList != NULL)
|
{
|
delete m_pViewRecipeList;
|
m_pViewRecipeList = NULL;
|
}
|
if(m_pviewLightControl != NULL)
|
{
|
delete m_pviewLightControl;
|
m_pviewLightControl = NULL;
|
}
|
|
if(m_pViewSideDimensionSetting != NULL)
|
{
|
delete m_pViewSideDimensionSetting;
|
m_pViewSideDimensionSetting = NULL;
|
}
|
|
if(m_pViewSideNotchSetting != NULL)
|
{
|
delete m_pViewSideNotchSetting;
|
m_pViewSideNotchSetting = NULL;
|
}
|
|
if(m_pViewSideExceptionSetting != NULL)
|
{
|
delete m_pViewSideExceptionSetting;
|
m_pViewSideExceptionSetting = NULL;
|
}
|
|
if(m_pViewSideUserDefectSetting != NULL)
|
{
|
delete m_pViewSideUserDefectSetting;
|
m_pViewSideUserDefectSetting = NULL;
|
}
|
|
for(int i=0; i<MAX_MARKER_COUNT; i++)
|
{
|
if(m_pTopMarkImage[i] != NULL)
|
cvReleaseImage(&m_pTopMarkImage[i]), m_pTopMarkImage[i] = NULL;
|
|
if(m_pBotMarkImage[i] != NULL)
|
cvReleaseImage(&m_pBotMarkImage[i]), m_pBotMarkImage[i] = NULL;
|
}
|
|
#if HALCON_VISION_KEY
|
if (NULL != m_pVisionSetDlg) {
|
if (0 == BlVision_GetSoftVisionApp()->ReleaseWindow(m_pVisionSetDlg)) {
|
m_pVisionSetDlg = NULL;
|
}
|
}
|
|
if (nullptr != m_pVisionEvent) {
|
m_pVisionEvent->clear();
|
delete m_pVisionEvent;
|
m_pVisionEvent = nullptr;
|
}
|
#endif
|
|
free(m_pBmInfo);
|
}
|
|
void CViewMain_Recipe::DoDataExchange(CDataExchange* pDX)
|
{
|
DDX_Control(pDX, IDC_STATIC_RECIPE_NAME, m_ctrlRecipeName);
|
DDX_Control(pDX, IDC_STATIC_RECIPE_COMMENT, m_ctrlRecipeComment);
|
DDX_Control(pDX, IDC_BUTTON_RECIPE_LIST, m_ctrlRecipList);
|
DDX_Control(pDX, IDC_SLIDER_ZOOM2, m_sliderZoom);
|
DDX_Control(pDX, IDC_SCROLLBAR_V, m_ctrlScrollV);
|
DDX_Control(pDX, IDC_SCROLLBAR_H, m_ctrlScrollH);
|
DDX_Control(pDX, IDC_PANEL_INFO, m_PanelInfo);
|
DDX_Control(pDX, IDC_SIDE_INS_INFO, m_SideInspectInfo);
|
DDX_Control(pDX, IDC_JUDGEMENT, m_JudgementInfo);
|
DDX_Text(pDX,IDC_EDIT_SCAN_TIMEOUT, m_dScanTimeOut);
|
CDialogEx::DoDataExchange(pDX);
|
}
|
|
|
BEGIN_MESSAGE_MAP(CViewMain_Recipe, CDialogEx)
|
ON_WM_SHOWWINDOW()
|
ON_WM_HSCROLL()
|
ON_WM_VSCROLL()
|
ON_WM_MOUSEWHEEL()
|
ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_ZOOM2, &CViewMain_Recipe::OnNMCustomdrawSliderZoom2)
|
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_ZOOM2, &CViewMain_Recipe::OnNMReleasedcaptureSliderZoom2)
|
ON_MESSAGE(WM_POCESS_STATUS , &CViewMain_Recipe::OnProcessStatus)
|
ON_MESSAGE(UM_SELECT_RECIPE, &CViewMain_Recipe::OnSelectRecipe)
|
ON_WM_PAINT()
|
END_MESSAGE_MAP()
|
|
|
// CViewLedRecipeSetting 皋矫瘤 贸府扁涝聪促.
|
BEGIN_EVENTSINK_MAP(CViewMain_Recipe, CDialogEx)
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_IMG_LOAD, DISPID_CLICK, CViewMain_Recipe::ClickImgLoadButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_IMG_SAVE, DISPID_CLICK, CViewMain_Recipe::ClickImgSaveButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_IMG_INIT, DISPID_CLICK, CViewMain_Recipe::ClickInitProcessButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_IMG_PROCESS, DISPID_CLICK, CViewMain_Recipe::ClickInspectProcessButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_RECIPE_SAVE, DISPID_CLICK, CViewMain_Recipe::ClickRecipeSaveButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BUTTON_RECIPE_LIST, DISPID_CLICK, CViewMain_Recipe::ClickRecipeListButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BUTTON_LIGHT_CONTROL, DISPID_CLICK, CViewMain_Recipe::OnBnClickedBtnLightControl, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_A_TOP, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_B_TOP, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_C_TOP, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_D_TOP, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_A_BOT, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_B_BOT, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_C_BOT, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_SIDE_D_BOT, DISPID_CLICK, CViewMain_Recipe::ClickSideSelButton, VTS_NONE)
|
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_CHIP, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_CRACK, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_BURR, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_CHAMFER, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_IN_CHIP, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_IN_CRACK, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_IN_BURR, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_IN_CHAMFER, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_TOP_CORNER, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_RDO_INSTYPE_BOT_CORNER, DISPID_CLICK, CViewMain_Recipe::ClickRdoInsType, VTS_NONE)
|
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_TOP_MARK_UPDATE_0, DISPID_CLICK, CViewMain_Recipe::ClickBtnMarkUpdate, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_TOP_MARK_UPDATE_1, DISPID_CLICK, CViewMain_Recipe::ClickBtnMarkUpdate, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_TOP_MARK_UPDATE_2, DISPID_CLICK, CViewMain_Recipe::ClickBtnMarkUpdate, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_BOT_MARK_UPDATE_0, DISPID_CLICK, CViewMain_Recipe::ClickBtnMarkUpdate, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_BOT_MARK_UPDATE_1, DISPID_CLICK, CViewMain_Recipe::ClickBtnMarkUpdate, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BTN_BOT_MARK_UPDATE_2, DISPID_CLICK, CViewMain_Recipe::ClickBtnMarkUpdate, VTS_NONE)
|
|
ON_EVENT(CViewMain_Recipe, IDC_BUTTON_LANG_ENGLISH, DISPID_CLICK, CViewMain_Recipe::ClickButtonLang, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BUTTON_LANG_KOREAN, DISPID_CLICK, CViewMain_Recipe::ClickButtonLang, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BUTTON_LANG_CHINESE, DISPID_CLICK, CViewMain_Recipe::ClickButtonLang, VTS_NONE)
|
|
ON_EVENT(CViewMain_Recipe, IDC_BUTTON_OPEN_DIMENSION_SETTING_VIEW, DISPID_CLICK, CViewMain_Recipe::ClickButtonOpenDimensionSettingView, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BUTTON_OPEN_NOTCH_SETTING_VIEW, DISPID_CLICK, CViewMain_Recipe::ClickButtonOpenNotchSettingView, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BUTTON_OPEN_EXCEPTION_SETTING_VIEW, DISPID_CLICK, CViewMain_Recipe::ClickButtonOpenExceptionSettingView, VTS_NONE)
|
ON_EVENT(CViewMain_Recipe, IDC_BUTTON_OPEN_USER_DEFECT_SETTING_VIEW, DISPID_CLICK, CViewMain_Recipe::ClickButtonOpenUserDefectSettingView, VTS_NONE)
|
|
ON_EVENT(CViewMain_Recipe, IDC_BUTTON_VISION_SETTING, DISPID_CLICK, CViewMain_Recipe::ClickButtonVisionSetting, VTS_NONE)
|
END_EVENTSINK_MAP()
|
|
BOOL CViewMain_Recipe::PreTranslateMessage(MSG* pMsg)
|
{
|
if( pMsg->message == WM_KEYDOWN )
|
{
|
if(pMsg->wParam == VK_RETURN
|
|| pMsg->wParam == VK_ESCAPE )
|
{
|
::TranslateMessage(pMsg);
|
::DispatchMessage(pMsg);
|
return TRUE; // DO NOT process further
|
}
|
}
|
|
return CDialog::PreTranslateMessage(pMsg);
|
}
|
|
BOOL CViewMain_Recipe::OnInitDialog()
|
{
|
CDialogEx::OnInitDialog();
|
|
m_pViewRecipeList = new CViewRecipeList;
|
m_pViewRecipeList->Create(CViewRecipeList::IDD,this);
|
m_pViewRecipeList->SetParent(this);
|
m_pViewRecipeList->ShowWindow(SW_HIDE);
|
|
m_pviewLightControl = new CViewLampControl;
|
m_pviewLightControl->Create(CViewLampControl::IDD,this);
|
m_pviewLightControl->ShowWindow(SW_HIDE);
|
m_pviewLightControl->SetParent(this);
|
|
m_pViewSideDimensionSetting = new CDlgSideDimensionSetting;
|
m_pViewSideDimensionSetting->Create(CDlgSideDimensionSetting::IDD,this);
|
m_pViewSideDimensionSetting->SetDlgRecipe(m_pDlgRecipe);
|
m_pViewSideDimensionSetting->SetSelectSideIdx(&m_eSelectSide);
|
m_pViewSideDimensionSetting->ShowWindow(SW_HIDE);
|
|
m_pViewSideNotchSetting = new CDlgSideNotchSetting;
|
m_pViewSideNotchSetting->Create(CDlgSideNotchSetting::IDD,this);
|
m_pViewSideNotchSetting->SetDlgRecipe(m_pDlgRecipe);
|
m_pViewSideNotchSetting->SetGlassData(m_pGlassData);
|
m_pViewSideNotchSetting->SetSelectSideIdx(&m_eSelectSide);
|
m_pViewSideNotchSetting->SetSelectLanguage(&m_eSelectLangType);
|
m_pViewSideNotchSetting->SetRecipeImageViewer(&m_frameImg);
|
m_pViewSideNotchSetting->ShowWindow(SW_HIDE);
|
|
m_pViewSideExceptionSetting = new CDlgSideExceptoinSetting;
|
m_pViewSideExceptionSetting->Create(CDlgSideExceptoinSetting::IDD,this);
|
m_pViewSideExceptionSetting->SetDlgRecipe(m_pDlgRecipe);
|
m_pViewSideExceptionSetting->SetGlassData(m_pGlassData);
|
m_pViewSideExceptionSetting->SetRecipeImageViewer(&m_frameImg);
|
m_pViewSideExceptionSetting->SetSelectSideIdx(&m_eSelectSide);
|
m_pViewSideExceptionSetting->ShowWindow(SW_HIDE);
|
|
m_pViewSideUserDefectSetting = new CDlgSideUserDefectSetting;
|
m_pViewSideUserDefectSetting->Create(CDlgSideUserDefectSetting::IDD,this);
|
m_pViewSideUserDefectSetting->SetDlgRecipe(m_pDlgRecipe);
|
m_pViewSideUserDefectSetting->SetGlassData(m_pGlassData);
|
m_pViewSideUserDefectSetting->SetRecipeImageViewer(&m_frameImg);
|
m_pViewSideUserDefectSetting->SetSelectSideIdx(&m_eSelectSide);
|
m_pViewSideUserDefectSetting->ShowWindow(SW_HIDE);
|
|
m_sliderZoom.SetRange(0,ZOOM_RANGE);
|
m_sliderZoom.SetPos(ZOOM_RANGE/2);
|
|
m_frameImg.SetImageBuffer(NULL, IMAGE_WIDTH, IMAGE_HEIGHT, MAX_FRAM_COUNT);
|
m_frameImg.SetSideIdx(0);
|
|
GetDlgItem(IDC_STATIC_SELECT_IMG)->GetWindowRect(m_rcFrameImg);
|
GetDlgItem(IDC_STATIC_SELECT_IMG)->DestroyWindow();
|
|
ScreenToClient(m_rcFrameImg);
|
m_frameImg.Create(NULL,NULL,WS_VISIBLE | WS_CHILD,m_rcFrameImg,this,0);
|
|
InitScrollInfo();
|
|
LoadLinkFile(LINK_FILE_NAME);
|
|
Init_PanelInfo();
|
|
Init_SideInsInfo();
|
|
Init_JudgementInfo();
|
|
Init_BitmapInfo();
|
|
// Init
|
CButton* pMain = (CButton*)GetDlgItem(IDC_RDO_SIDE_A_TOP);
|
if (pMain && pMain->GetSafeHwnd())
|
pMain->SetCheck(1);
|
|
pMain = (CButton*)GetDlgItem(IDC_RDO_INSTYPE_CHIP);
|
if (pMain && pMain->GetSafeHwnd())
|
pMain->SetCheck(1);
|
|
pMain = (CButton*)GetDlgItem(IDC_BUTTON_LANG_ENGLISH);
|
if (pMain && pMain->GetSafeHwnd())
|
pMain->SetCheck(1);
|
|
#if HALCON_VISION_KEY
|
m_pVisionEvent = new IVisionEvent(onMsgVisionEvent, onMsgLogEvent);
|
BlVision_GetSoftVisionApp()->setImageEventSignal(m_pVisionEvent);
|
#else
|
GetDlgItem(IDC_BUTTON_VISION_SETTING)->ShowWindow(SW_HIDE);
|
#endif // HALCON_VISION_KEY
|
|
return TRUE;
|
}
|
|
#if HALCON_VISION_KEY
|
void CViewMain_Recipe::onMsgVisionEvent(int code, int eDir) {
|
/* code */
|
if (1 == code) { //获取区域数据
|
m_pThis->SetFrameRegion();
|
}
|
else if (2 == code) { //获取效果
|
m_pThis->DispAllResult();
|
}
|
}
|
|
void CViewMain_Recipe::onMsgLogEvent(int level, std::string strText) {
|
/* code */
|
CString str = CA2T(strText.c_str());
|
g_pLog->DisplayMessage(str);
|
}
|
|
void CViewMain_Recipe::SetFrameRegion(void) {
|
/* code */
|
IVisionRecipe *pInstance = BlVision_GetVisionRecipe();
|
if (NULL == pInstance) return;
|
|
CRect rtMeasureRect = m_frameImg.GetManualMeasureRect();
|
pInstance->setFrame(rtMeasureRect.left, rtMeasureRect.top, rtMeasureRect.right, rtMeasureRect.bottom);
|
}
|
|
void CViewMain_Recipe::DispAllResult(void) {
|
/* code */
|
m_frameImg.UpdataVisionResult();
|
}
|
#endif // HALCON_VISION_KEY
|
|
void CViewMain_Recipe::ClickImgLoadButton()
|
{
|
if(m_IV2M == NULL)
|
return;
|
|
m_IV2M->IV2M_LoadImageFullFile((int) m_eSelectSide,m_pGlassData);
|
|
m_frameImg.Invalidate(FALSE);
|
InitScrollInfo();
|
}
|
|
void CViewMain_Recipe::ClickImgSaveButton()
|
{
|
CPoint ptStart;
|
int nLength;
|
const int nOneFrameSize = 50000;
|
CString strPath,strLog;
|
int iSide = (int) m_eSelectSide;
|
int nTotalLength = 0;
|
int nFrame = 0;
|
|
if(m_pGlassData == NULL || m_IV2M == NULL || m_pHardware == NULL)
|
return;
|
|
int iCam = m_pHardware->GetCameraIndexToDimension((DimensionDir)iSide);
|
int iScan = m_pHardware->GetScanToDimension((DimensionDir)iSide);
|
|
CCameraSettings *pCamera = m_pHardware->GetCameraSettings(iCam,iScan);
|
if(pCamera == NULL)
|
return;
|
|
CGlassRecipe *pGlassRcp = m_pGlassData->GetGlassRecipe();
|
CString strRcpName = pGlassRcp->GetRecipeName();
|
|
nTotalLength = pCamera->m_nGrabFrameCount*pCamera->m_FrameSize.cy;
|
nFrame = nTotalLength/nOneFrameSize;
|
|
ptStart.x = 0;
|
ptStart.y = max(0,0);
|
|
CSide_Data* pSideData = m_pGlassData->GetSideData((DimensionDir)iSide);
|
if(pSideData != NULL)
|
{
|
ptStart.y = max(0,pSideData->m_nGlassStartLine-1000);
|
|
nTotalLength = min((pSideData->m_nGlassEndLine + 1000) - ptStart.y,pCamera->m_nGrabFrameCount*pCamera->m_FrameSize.cy);
|
}
|
|
CString strGlassID = g_pBase->m_strHPanelID;
|
if(strGlassID.IsEmpty() == TRUE)
|
{
|
strGlassID = _T("Manual_ID");
|
}
|
|
if(strRcpName.IsEmpty() == TRUE)
|
{
|
strRcpName = _T("TestRcp");
|
}
|
|
strGlassID.Trim(_T(' '));
|
|
CTime time = CTime::GetCurrentTime();
|
|
CString strDate,strTime;
|
|
strDate.Format(_T("%04d%02d%02d"),time.GetYear(),time.GetMonth(),time.GetDay());
|
strTime.Format(_T("%02d%02d%02d"),time.GetHour(),time.GetMinute(),time.GetSecond());
|
|
for(int i = 0; i < nFrame ; i++)
|
{
|
nLength = nOneFrameSize;
|
|
strPath.Format(_T("%s\\DebugFullImage\\%s\\%s\\%s\\%s\\%s__%s_%d"),PATH_INSPECTION_DATA,strDate,strRcpName,strGlassID,strTime,strGlassID,PANEL_SIDE[iSide],i);
|
|
m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength);
|
ptStart.y += nLength;
|
}
|
|
nLength = nTotalLength%nOneFrameSize;
|
if(nLength)
|
{
|
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);
|
}
|
|
//AfxMessageBox(_T("Save Completed"));
|
}
|
|
void CViewMain_Recipe::ClickInitProcessButton()
|
{
|
InitView();
|
|
if(m_IV2M != NULL)
|
{
|
m_IV2M->IV2M_InitView(VIEW_RECIPE);
|
}
|
}
|
|
void CViewMain_Recipe::ClickInspectProcessButton()
|
{
|
DimensionDir eDim = (DimensionDir)((int) m_eSelectSide);
|
|
m_IV2M->IV2M_InspectionProcess(eDim);
|
}
|
|
void CViewMain_Recipe::OnShowWindow(BOOL bShow, UINT nStatus)
|
{
|
if(bShow == TRUE)
|
{
|
UpdateData(FALSE);
|
|
m_frameImg.SetRecipe(m_pDlgRecipe);
|
m_frameImg.SetHardwareSetting(m_pHardware);
|
m_frameImg.SetGlassData(m_pGlassData);
|
m_frameImg.SetSideIdx((int) m_eSelectSide);
|
|
InitScrollInfo();
|
}
|
}
|
|
void CViewMain_Recipe::SetGlassData(CGlass_Data *pGlass)
|
{
|
m_pGlassData = pGlass;
|
|
if(m_pViewSideExceptionSetting != NULL)
|
m_pViewSideExceptionSetting->SetGlassData(pGlass);
|
|
if(m_pViewSideUserDefectSetting != NULL)
|
m_pViewSideUserDefectSetting->SetGlassData(pGlass);
|
}
|
|
void CViewMain_Recipe::ViewRefresh(PROG_MSG ProcMsg)
|
{
|
SendMessage(WM_POCESS_STATUS,(WPARAM)&ProcMsg, ProcMsg.nSide);
|
}
|
|
void CViewMain_Recipe::SetV2M(IViewInterface2Parent* pV2M)
|
{
|
m_IV2M = pV2M;
|
|
if(m_pviewLightControl != NULL)
|
m_pviewLightControl->SetIV2P(static_cast<IViewInterface2Parent*>(m_IV2M));
|
|
// m_frameImg.SetMainInterface(m_IV2M);
|
}
|
|
void CViewMain_Recipe::InitView()
|
{
|
m_pGlassData= NULL;
|
|
if(m_IV2M != NULL)
|
{
|
LPBYTE plpBuf = NULL;
|
if(m_IV2M != NULL)
|
plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)((int) m_eSelectSide),0);
|
m_frameImg.SetImageBuffer(plpBuf);
|
}
|
|
m_frameImg.SetGlassData(m_pGlassData);
|
m_frameImg.SetRecipe(m_pDlgRecipe);
|
m_frameImg.SetHardwareSetting(m_pHardware);
|
m_frameImg.SetSideIdx(((int) m_eSelectSide));
|
|
InitScrollInfo(TRUE);
|
}
|
|
void CViewMain_Recipe::SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe)
|
{
|
// Hardware
|
m_pHardware = pHW;
|
|
double dPixelSizeX = 1.0;
|
double dPixelSizeY = 1.0;
|
int nFrameWidth = IMAGE_WIDTH;
|
int nFrameHeight = IMAGE_HEIGHT;
|
int nFrameCount = MAX_FRAM_COUNT;
|
GetResolution(dPixelSizeX, dPixelSizeY, nFrameWidth, nFrameHeight, nFrameCount);
|
m_frameImg.SetPixelSize(dPixelSizeX, dPixelSizeY);
|
|
// Recipe
|
m_pRecipe = pRecipe;
|
|
if(pRecipe != NULL)
|
{
|
*m_pDlgRecipe = *pRecipe;
|
}
|
|
if(m_IV2M != NULL)
|
{
|
LPBYTE plpBuf = NULL;
|
|
if(m_IV2M != NULL)
|
plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)((int) m_eSelectSide),0);
|
|
m_frameImg.SetImageBuffer(plpBuf, nFrameWidth, nFrameHeight, nFrameCount);
|
}
|
|
m_frameImg.SetGlassData(m_pGlassData);
|
m_frameImg.SetHardwareSetting(m_pHardware);
|
m_frameImg.SetRecipe(m_pDlgRecipe);
|
m_frameImg.SetSideIdx(((int) m_eSelectSide));
|
|
InitScrollInfo();
|
|
m_strRecipeName = m_pDlgRecipe->GetRecipeName();
|
m_ctrlRecipeName.SetCaption(m_strRecipeName);
|
m_ctrlRecipeComment.SetCaption(m_pDlgRecipe->m_RecieParm.m_strComment);
|
|
UpdateRecipe(FALSE);
|
}
|
|
void CViewMain_Recipe::InitScrollInfo(BOOL bInitPos /*= FALSE*/)
|
{
|
int i =0;
|
|
SCROLLINFO scrollInfoV;
|
SCROLLINFO scrollInfoH;
|
|
int nPos_V = m_ctrlScrollV.GetScrollPos();
|
int nPos_H = m_ctrlScrollH.GetScrollPos();
|
|
if(bInitPos)
|
{
|
nPos_V = 0;
|
nPos_H = 0;
|
}
|
|
scrollInfoV.cbSize = sizeof(SCROLLINFO);
|
scrollInfoV.fMask = SIF_ALL;
|
scrollInfoV.nMin = 1;
|
if(scrollInfoV.nMin < 1)
|
scrollInfoV.nMin = 1;
|
scrollInfoV.nPos = 1;
|
scrollInfoV.nTrackPos = 400;
|
scrollInfoV.nMax = INT_MAX;
|
|
scrollInfoH.cbSize = sizeof(SCROLLINFO);
|
scrollInfoH.fMask = SIF_ALL;
|
scrollInfoH.nMin = 1;
|
scrollInfoH.nPos = 1;
|
scrollInfoH.nTrackPos = 64;
|
|
double dZoom = m_frameImg.GetZoom();
|
|
scrollInfoV.nPage = m_rcFrameImg.Height();
|
scrollInfoH.nPage = int(m_rcFrameImg.Width() / dZoom);
|
scrollInfoH.nMax = IMAGE_WIDTH;
|
|
if(m_pGlassData != NULL)
|
{
|
CSide_Data* pSideData = m_pGlassData->GetSideData((DimensionDir)((int) m_eSelectSide));
|
if(pSideData != NULL)
|
{
|
int nEndLIne = pSideData->m_nGlassEndLine;
|
if(nEndLIne <= 0)
|
nEndLIne = pSideData->m_nPreGlassEndLine;
|
|
scrollInfoV.nMax = nEndLIne - pSideData->m_nGlassStartLine + (int)(m_rcFrameImg.Height() * dZoom);
|
}
|
}
|
else
|
{
|
if((int) ((int) m_eSelectSide)%2)
|
scrollInfoV.nMax = MAX_IMAGE_LINE_SHORT - int(m_rcFrameImg.Height() / dZoom);
|
else
|
scrollInfoV.nMax = MAX_IMAGE_LINE_LONG - int(m_rcFrameImg.Height() / dZoom);
|
}
|
|
if(m_pHardware == NULL)
|
{
|
if((int) ((int) m_eSelectSide)%2)
|
scrollInfoV.nMax = min(MAX_IMAGE_LINE_SHORT - int(m_rcFrameImg.Height() / dZoom),scrollInfoV.nMax);
|
else
|
scrollInfoV.nMax = min(MAX_IMAGE_LINE_LONG - int(m_rcFrameImg.Height() / dZoom),scrollInfoV.nMax);
|
}
|
else
|
{
|
int iCam = m_pHardware->GetCameraIndexToDimension((DimensionDir)(int) m_eSelectSide);
|
int nMaxLine = g_pBase->m_pMemFrameNo[iCam]*g_pBase->m_pFrameHeight[iCam];
|
|
scrollInfoV.nMax = min(nMaxLine - int(m_rcFrameImg.Height() / dZoom),scrollInfoV.nMax);
|
}
|
|
m_ctrlScrollV.SetScrollInfo(&scrollInfoV);
|
m_ctrlScrollV.SetScrollPos(nPos_V);
|
|
m_ctrlScrollH.SetScrollInfo(&scrollInfoH);
|
m_ctrlScrollH.SetScrollPos(nPos_H);
|
}
|
|
void CViewMain_Recipe::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
{
|
if(pScrollBar->m_hWnd == m_ctrlScrollH.m_hWnd)
|
{
|
SCROLLINFO si;
|
si.fMask=SIF_ALL;
|
m_ctrlScrollH.GetScrollInfo(&si,SIF_ALL);
|
|
switch(nSBCode)
|
{
|
case SB_LINEUP:
|
si.nPos--;
|
break;
|
case SB_LINEDOWN:
|
si.nPos++;
|
break;
|
case SB_PAGEUP:
|
si.nPos-=si.nPage;
|
break;
|
case SB_PAGEDOWN:
|
si.nPos+=si.nPage;
|
break;
|
case SB_THUMBTRACK:
|
si.nPos=nPos;
|
break;
|
}
|
|
if(si.nPos>(int)(si.nMax-si.nMin-si.nPage+1)) si.nPos=si.nMax-si.nMin-si.nPage+1;
|
if(si.nPos<si.nMin) si.nPos=si.nMin;
|
si.fMask=SIF_POS;
|
|
m_ctrlScrollH.SetScrollInfo(&si);
|
|
CPoint ptOrg = m_frameImg.GetDisplayPos();
|
ptOrg.x = si.nPos;
|
m_frameImg.SetDisplayPos(ptOrg);
|
m_frameImg.Invalidate();
|
}
|
CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar);
|
}
|
|
void CViewMain_Recipe::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
{
|
if(!pScrollBar->m_hWnd)
|
{
|
CDialogEx::OnVScroll(nSBCode, nPos, pScrollBar);
|
return;
|
}
|
|
|
if(pScrollBar->m_hWnd == m_ctrlScrollV.m_hWnd)
|
{
|
int pos;
|
SCROLLINFO si;
|
si.fMask=SIF_ALL;
|
|
m_ctrlScrollV.GetScrollInfo(&si,SIF_ALL);
|
|
switch(nSBCode)
|
{
|
|
case SB_LINEUP:
|
si.nPos = si.nPos -1;
|
break;
|
case SB_LINEDOWN:
|
si.nPos = si.nPos +1;
|
break;
|
case SB_PAGEUP:
|
si.nPos-=si.nPage;
|
break;
|
case SB_PAGEDOWN:
|
si.nPos+=si.nPage;
|
break;
|
case SB_THUMBTRACK:
|
si.nPos = si.nTrackPos;
|
break;
|
|
}
|
|
if(si.nPos>(int)(si.nMax-si.nMin -si.nPage+1))
|
si.nPos=si.nMax-si.nMin-si.nPage+1;
|
|
if(si.nPos<si.nMin)
|
si.nPos=si.nMin;
|
|
si.fMask=SIF_POS;
|
pos = si.nPos - 1;
|
pos += 0;//g_GrabInfo[m_nCndRDSide].nStartLine;
|
|
m_ctrlScrollV.SetScrollInfo(&si);
|
|
LPBYTE plpBuf = NULL;
|
|
CPoint ptOrg = m_frameImg.GetDisplayPos();
|
if(m_pGlassData != NULL)
|
{
|
CSide_Data* pSideData = m_pGlassData->GetSideData((DimensionDir)((int) m_eSelectSide));
|
if(pSideData != NULL)
|
ptOrg.y = max(0,pos + pSideData->m_nGlassStartLine - m_frameImg.GetWndRect().Height()/2);
|
}
|
else
|
ptOrg.y = max(0,pos - m_frameImg.GetWndRect().Height()/2);
|
|
m_frameImg.SetDisplayPos(ptOrg);
|
|
if(m_IV2M != NULL)
|
{
|
if(m_IV2M != NULL)
|
plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)((int) m_eSelectSide), ptOrg.y);
|
}
|
|
m_frameImg.SetImageBuffer(plpBuf);
|
m_frameImg.SetGlassData(m_pGlassData);
|
m_frameImg.Invalidate(FALSE);
|
}
|
|
CDialogEx::OnVScroll(nSBCode, nPos, pScrollBar);
|
}
|
|
void CViewMain_Recipe::UpdateZoom()
|
{
|
m_frameImg.SetZoom(m_dZoom);
|
InitScrollInfo();
|
m_frameImg.Invalidate(FALSE);
|
}
|
|
void CViewMain_Recipe::OnNMCustomdrawSliderZoom2(NMHDR *pNMHDR, LRESULT *pResult)
|
{
|
LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
|
|
CString strTmp;
|
int nPos = m_sliderZoom.GetPos();
|
|
double dZoomRatio = ZOOM_RATIO;
|
int nStep = (nPos - ZOOM_RANGE/2);
|
|
if(nPos > ZOOM_RANGE/2) // ZOOM IN
|
m_dZoom = 1 + ((nPos - ZOOM_RANGE/2) * ZOOM_RATIO);
|
else if(nPos < ZOOM_RANGE/2) // ZOOM OUT
|
m_dZoom = 1 + ((nPos - ZOOM_RANGE/2) * ZOOM_RATIO);
|
else
|
m_dZoom = 1;
|
|
|
strTmp.Format(_T("X %.2f"),m_dZoom);
|
GetDlgItem(IDC_ST_ZOOM2)->SetWindowText(strTmp);
|
|
*pResult = 0;
|
}
|
|
void CViewMain_Recipe::OnNMReleasedcaptureSliderZoom2(NMHDR *pNMHDR, LRESULT *pResult)
|
{
|
// TODO: Add your control notification handler code here
|
this->SetFocus();
|
UpdateZoom();
|
*pResult = 0;
|
}
|
|
BOOL CViewMain_Recipe::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
|
{
|
// TODO: Add your message handler code here and/or call default
|
|
int nPos = m_sliderZoom.GetPos();
|
if(zDelta > 0)
|
m_sliderZoom.SetPos(nPos+1);
|
else
|
m_sliderZoom.SetPos(nPos-1);
|
|
UpdateZoom();
|
|
return CDialogEx::OnMouseWheel(nFlags, zDelta, pt);
|
}
|
|
LRESULT CViewMain_Recipe::OnProcessStatus(WPARAM wParam, LPARAM lParam)
|
{
|
PROG_MSG MsgJob = *((PROG_MSG*)wParam);
|
|
if(MsgJob.nSide != ((int) m_eSelectSide))
|
return 0;
|
|
if(MsgJob.nState == 2)
|
{
|
InitScrollInfo();
|
|
double dZoom = m_frameImg.GetZoom();
|
CPoint ptOrg = m_frameImg.GetDisplayPos();
|
|
if(m_pGlassData != NULL)
|
{
|
CSide_Data* pSideData = m_pGlassData->GetSideData((DimensionDir)MsgJob.nSide);
|
|
if(pSideData != NULL)
|
ptOrg.y = CHKMAX(0,pSideData->m_nGlassStartLine - (int)((m_frameImg.GetWndRect().Height()/2)/ dZoom));
|
}
|
|
m_frameImg.SetGlassData(m_pGlassData);
|
|
if(m_IV2M != NULL)
|
{
|
LPBYTE plpBuf = NULL;
|
|
if(m_IV2M != NULL)
|
plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)MsgJob.nSide, ptOrg.y);
|
|
m_frameImg.SetImageBuffer(plpBuf);
|
}
|
|
m_frameImg.SetDisplayPos(ptOrg);
|
|
}
|
else
|
{
|
InitScrollInfo();
|
|
CPoint ptOrg = m_frameImg.GetDisplayPos();
|
ptOrg.y = MsgJob.nDispLine;
|
|
if(m_IV2M != NULL)
|
{
|
LPBYTE plpBuf = NULL;
|
|
if(m_IV2M != NULL)
|
plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)MsgJob.nSide, ptOrg.y);
|
|
m_frameImg.SetImageBuffer(plpBuf);
|
}
|
|
m_frameImg.SetGlassData(m_pGlassData);
|
|
m_frameImg.SetDisplayPos(ptOrg);
|
}
|
|
m_frameImg.Invalidate();
|
|
return 1;
|
}
|
|
void CViewMain_Recipe::ClickRecipeListButton()
|
{
|
if(m_pViewRecipeList != NULL)
|
{
|
m_pViewRecipeList->SetRecipeName(m_strPPIDName,m_strRecipeName);
|
m_pViewRecipeList->SetLinkList(&m_VectorLinkList);
|
m_pViewRecipeList->ShowWindow(SW_SHOW);
|
}
|
}
|
|
void CViewMain_Recipe::ClickRecipeSaveButton()
|
{
|
if(m_pDlgRecipe == NULL)
|
return;
|
|
CDlgLogin login;
|
|
login.DoModal();
|
if (login.m_bLoginOK == FALSE)
|
{
|
//AfxMessageBox(_T("Login failed! Please try again."));
|
return;
|
}
|
|
//if(IDYES == AfxMessageBox(_T("Save Parameter?"), MB_YESNO | MB_ICONQUESTION))
|
{
|
DWORD tickCount = GetTickCount();
|
|
UpdateRecipe(TRUE, login.m_nLVPassword);
|
|
g_pLog->DisplayMessage(_T("Update Recipe %d"), GetTickCount() - tickCount);
|
|
if(m_strRecipeName.IsEmpty() == TRUE)
|
{
|
AfxMessageBox(_T("No Select Recipe"), MB_OK | MB_ICONERROR);
|
return;
|
}
|
|
tickCount = GetTickCount();
|
|
// 急琶等 Recipe 荐沥.
|
if (m_pDlgRecipe->WriteRecipeFile() == FALSE)
|
{
|
AfxMessageBox(_T("Save Fail"), MB_OK | MB_ICONERROR);
|
return;
|
}
|
|
if (m_pDlgRecipe->SaveRecipeConfigFile(m_strRecipeName) == FALSE)
|
{
|
AfxMessageBox(_T("Save Recipe Cofg Fail"), MB_OK | MB_ICONERROR);
|
return;
|
}
|
|
g_pLog->DisplayMessage(_T("Write Recipe %d"), GetTickCount() - tickCount);
|
|
tickCount = GetTickCount();
|
|
m_pDlgRecipe->MakeRecipeFileNameBackUp(m_strRecipeName);
|
|
g_pLog->DisplayMessage(_T("Backup Recipe %d"), GetTickCount() - tickCount);
|
|
m_pDlgRecipe->WriteRecipeFileBackUp();
|
|
if(m_IV2M != NULL)
|
m_IV2M->IV2M_RecipeChange(m_strRecipeName);
|
|
#if HALCON_VISION_KEY
|
BlVision_GetVisionRecipe()->save();
|
#endif // HALCON_VISION_KEY
|
}
|
}
|
|
BOOL CViewMain_Recipe::LoadLinkFile(CString strFilePath)
|
{
|
CConfig cfg;
|
if(!cfg.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode))
|
{
|
CStdioFile File;
|
CFileException ex;
|
|
if (File.Open(strFilePath, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite, &ex) == FALSE)
|
return FALSE;
|
|
File.Close();
|
|
if(!cfg.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode))
|
return FALSE;
|
}
|
|
int nCount;
|
|
cfg.GetItemValue(_T("UPPER_NUMBER"), nCount, 0);
|
|
if(nCount <= 0 || nCount >= 1000)
|
return FALSE;
|
|
DeleteVectorList();
|
|
int i;
|
CString strValue = _T("");
|
|
for(i = 0; i < nCount; i++)
|
{
|
LinkList* pList = new LinkList();
|
cfg.GetItemValue(i, _T("UPPER_NAME"), strValue, _T("NoName"));
|
strValue.MakeUpper();
|
pList->m_strUpperName=strValue;
|
|
cfg.GetItemValue(i, _T("STEP_NAME"), strValue, _T("NoName"));
|
strValue.MakeUpper();
|
pList->m_strStepName=strValue;
|
|
cfg.GetItemValue(i, _T("INS_NAME"), strValue, _T("NoName"));
|
strValue.MakeUpper();
|
pList->m_strInsName=strValue;
|
|
m_VectorLinkList.push_back(pList);
|
}
|
return TRUE;
|
}
|
|
void CViewMain_Recipe::DeleteVectorList()
|
{
|
// Vector 昏力
|
LinkList* pList = NULL;
|
for (VectorLinkListIt it = m_VectorLinkList.begin(); it != m_VectorLinkList.end(); it++)
|
{
|
pList = *it;
|
if (pList)
|
delete pList;
|
}
|
m_VectorLinkList.clear();
|
}
|
|
BOOL CViewMain_Recipe::WriteLinkFile(CString strFilePath)
|
{
|
CConfig cfg;
|
if(!cfg.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode))
|
{
|
CStdioFile File;
|
CFileException ex;
|
|
if (File.Open(strFilePath, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite, &ex) == FALSE)
|
return FALSE;
|
|
File.Close();
|
|
if(!cfg.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode))
|
return FALSE;
|
}
|
|
int nCount = (int)m_VectorLinkList.size();
|
|
cfg.SetItemValue(_T("UPPER_NUMBER"), nCount);
|
|
if(nCount <= 0 || nCount >= 1000)
|
return FALSE;
|
|
int i = 0;
|
CString strValue = _T("");
|
|
LinkList* pList;
|
for(VectorLinkListIt it = m_VectorLinkList.begin(); it != m_VectorLinkList.end(); it++)
|
{
|
pList = *it;
|
if(pList == NULL)
|
continue;
|
|
cfg.SetItemValue(i, _T("UPPER_NAME"), (TCHAR*)(LPCTSTR)pList->m_strUpperName);
|
cfg.SetItemValue(i, _T("STEP_NAME"), (TCHAR*)(LPCTSTR)pList->m_strStepName);
|
cfg.SetItemValue(i, _T("INS_NAME"), (TCHAR*)(LPCTSTR)pList->m_strInsName);
|
|
i++;
|
}
|
cfg.WriteToFile();
|
|
return TRUE;
|
}
|
|
LRESULT CViewMain_Recipe::OnSelectRecipe(WPARAM wParam, LPARAM lParam)
|
{
|
if(m_pViewRecipeList != NULL)
|
{
|
m_strPPIDName = m_pViewRecipeList->GetPPIDName();
|
m_strRecipeName = m_pViewRecipeList->GetRecipeName();
|
ChangeRecipe();
|
WriteLinkFile(LINK_FILE_NAME);
|
}
|
|
return 0;
|
}
|
|
void CViewMain_Recipe::ChangeRecipe()
|
{
|
m_pDlgRecipe->Reset();
|
|
ReadRecipe(m_strRecipeName);
|
|
m_strRecipeName = m_pDlgRecipe->GetRecipeName();
|
m_ctrlRecipeName.SetCaption(m_strRecipeName);
|
m_ctrlRecipeComment.SetCaption(m_pDlgRecipe->m_RecieParm.m_strComment);
|
|
UpdateRecipe(FALSE);
|
// UpdateData(FALSE);
|
}
|
|
BOOL CViewMain_Recipe::ReadRecipe(CString strRecipe)
|
{
|
if(strRecipe.IsEmpty() == TRUE)
|
{
|
//AfxMessageBox("Recipe Name捞 绝嚼聪促.");
|
return FALSE;
|
}
|
|
m_pDlgRecipe->Reset();
|
|
if(m_pDlgRecipe->MakeRecipeFileName(strRecipe) == FALSE)
|
return FALSE;
|
|
return m_pDlgRecipe->ReadRecipeFile();
|
}
|
|
void CViewMain_Recipe::ChangViewCdmSide(UINT nID)
|
{
|
eViewCmdSide eSelView;
|
|
switch(nID)
|
{
|
case IDC_RDO_SIDE_A_TOP:
|
eSelView = eRcp_SideRD_A;
|
break;
|
case IDC_RDO_SIDE_B_TOP:
|
eSelView = eRcp_SideRD_B;
|
break;
|
case IDC_RDO_SIDE_C_TOP:
|
eSelView = eRcp_SideRD_C;
|
break;
|
case IDC_RDO_SIDE_D_TOP:
|
eSelView = eRcp_SideRD_D;
|
break;
|
case IDC_RDO_SIDE_A_BOT:
|
eSelView = eRcp_SideRD_A_DN;
|
break;
|
case IDC_RDO_SIDE_B_BOT:
|
eSelView = eRcp_SideRD_B_DN;
|
break;
|
case IDC_RDO_SIDE_C_BOT:
|
eSelView = eRcp_SideRD_C_DN;
|
break;
|
case IDC_RDO_SIDE_D_BOT:
|
eSelView = eRcp_SideRD_D_DN;
|
break;
|
default:
|
return;
|
}
|
|
if(m_eSelectSide == eSelView)
|
return;
|
|
m_eSelectSide = eSelView;
|
|
CString strMarkTitle;
|
strMarkTitle.Format(_T("Mark Image [Side : %s]"), g_SideName[(int) m_eSelectSide]);
|
SetDlgItemText(IDC_STATIC_MARK_INFO_TITLE, strMarkTitle);
|
|
double dPixelSizeX = 1.0;
|
double dPixelSizeY = 1.0;
|
int nFrameWidth = IMAGE_WIDTH;
|
int nFrameHeight = IMAGE_HEIGHT;
|
int nFrameCount = MAX_FRAM_COUNT;
|
GetResolution(dPixelSizeX, dPixelSizeY, nFrameWidth, nFrameHeight, nFrameCount);
|
m_frameImg.SetPixelSize(dPixelSizeX, dPixelSizeY);
|
|
#if HALCON_VISION_KEY
|
if (NULL != m_pVisionSetDlg) {
|
ISoftVisionApp *pApp = BlVision_GetSoftVisionApp();
|
int nDir = (DimensionDir)(m_eSelectSide);
|
pApp->ChangeDimension(m_pVisionSetDlg, nDir);
|
}
|
#endif // HALCON_VISION_KEY
|
|
UpdateRecipe(FALSE);
|
}
|
|
void CViewMain_Recipe::ChangInsTypeSide(UINT nID)
|
{
|
eViewCmdInsType eSelInsType;
|
|
switch(nID)
|
{
|
case IDC_RDO_INSTYPE_CHIP: eSelInsType = eRcp_InsType_Chip;
|
break;
|
case IDC_RDO_INSTYPE_CRACK: eSelInsType = eRcp_InsType_Crack;
|
break;
|
case IDC_RDO_INSTYPE_BURR: eSelInsType = eRcp_InsType_Burr;
|
break;
|
case IDC_RDO_INSTYPE_CHAMFER: eSelInsType = eRcp_InsType_Chamfer;
|
break;
|
case IDC_RDO_INSTYPE_IN_CHIP: eSelInsType = eRcp_InsType_In_Chip;
|
break;
|
case IDC_RDO_INSTYPE_IN_CRACK: eSelInsType = eRcp_InsType_In_Crack;
|
break;
|
case IDC_RDO_INSTYPE_IN_BURR: eSelInsType = eRcp_InsType_In_Burr;
|
break;
|
case IDC_RDO_INSTYPE_IN_CHAMFER: eSelInsType = eRcp_InsType_In_Chamfer;
|
break;
|
case IDC_RDO_INSTYPE_TOP_CORNER: eSelInsType = eRcp_InsType_TopCorner;
|
break;
|
case IDC_RDO_INSTYPE_BOT_CORNER: eSelInsType = eRcp_InsType_BotCorner;
|
break;
|
default:
|
return;
|
}
|
|
if(m_eSelectInsType == eSelInsType)
|
return;
|
|
m_eSelectInsType = eSelInsType;
|
|
Init_SideInsInfo();
|
Fill_SideInsInfo(FALSE);
|
|
Init_JudgementInfo();
|
Fill_JudgementInfo(FALSE);
|
}
|
|
void CViewMain_Recipe::UpdateRecipe(BOOL bGetData, int type)
|
{
|
if(bGetData == FALSE)
|
{
|
// UpdateData(FALSE); // Parameter
|
|
Fill_PanelInfo(bGetData);
|
Fill_SideInsInfo(bGetData);
|
Fill_JudgementInfo(bGetData);
|
|
UpdateSideImage(); // Image
|
|
UpdateMarkImage(); // Mark Image
|
|
m_dScanTimeOut = m_pDlgRecipe->m_RecieParm.m_dOneScanTime_sec;
|
|
if(m_pViewSideDimensionSetting != NULL)
|
m_pViewSideDimensionSetting->UpdateRecipe(bGetData);
|
|
if(m_pViewSideNotchSetting != NULL)
|
m_pViewSideNotchSetting->UpdateRecipe(bGetData);
|
|
if(m_pViewSideExceptionSetting != NULL)
|
m_pViewSideExceptionSetting->UpdateRecipe(bGetData);
|
|
if(m_pViewSideUserDefectSetting != NULL)
|
m_pViewSideUserDefectSetting->UpdateRecipe(bGetData);
|
|
UpdateData(FALSE);
|
}
|
else
|
{
|
UpdateData(TRUE); // Parameter
|
|
Fill_PanelInfo(bGetData);
|
Fill_SideInsInfo(bGetData);
|
Fill_JudgementInfo(bGetData);
|
|
m_pDlgRecipe->m_RecieParm.m_dOneScanTime_sec = m_dScanTimeOut;
|
|
if (type == 1)
|
{
|
if (m_pViewSideDimensionSetting != NULL)
|
m_pViewSideDimensionSetting->UpdateRecipe(bGetData);
|
}
|
|
if(m_pViewSideNotchSetting != NULL)
|
m_pViewSideNotchSetting->UpdateRecipe(bGetData);
|
|
if(m_pViewSideExceptionSetting != NULL)
|
m_pViewSideExceptionSetting->UpdateRecipe(bGetData);
|
|
if(m_pViewSideUserDefectSetting != NULL)
|
m_pViewSideUserDefectSetting->UpdateRecipe(bGetData);
|
}
|
}
|
|
void CViewMain_Recipe::UpdateSideImage()
|
{
|
InitScrollInfo();
|
|
m_frameImg.SetSideIdx((int) m_eSelectSide);
|
|
if(m_IV2M != NULL)
|
{
|
CPoint ptOrg = m_frameImg.GetDisplayPos();
|
|
LPBYTE plpBuf = NULL;
|
if(m_IV2M != NULL)
|
plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)m_eSelectSide, ptOrg.y);
|
|
m_frameImg.SetImageBuffer(plpBuf);
|
}
|
|
m_frameImg.SetRecipe(m_pDlgRecipe);
|
m_frameImg.SetHardwareSetting(m_pHardware);
|
m_frameImg.SetGlassData(m_pGlassData);
|
m_frameImg.Invalidate();
|
}
|
|
void CViewMain_Recipe::GetResolution(double &dH,double &dV,int& nFrameWidth, int& nFrameHeight, int& nFrameCount)
|
{
|
int nStageNo = g_pBase->m_nStageNo;
|
|
if(nStageNo < 0 || nStageNo > 1)
|
nStageNo = 0;
|
|
if(m_pHardware != NULL)
|
{
|
int iCam = m_pHardware->GetCameraIndexToDimension((DimensionDir) m_eSelectSide);
|
int iScan = m_pHardware->GetScanToDimension((DimensionDir) m_eSelectSide);
|
|
CCameraSettings *pCamera = m_pHardware->GetCameraSettings(iCam, iScan);
|
if(pCamera != NULL)
|
{
|
dH = pCamera->m_dConvResolution[nStageNo];
|
dV = pCamera->m_dScanResolution[nStageNo];
|
nFrameWidth = pCamera->m_FrameSize.cx;
|
nFrameHeight = pCamera->m_FrameSize.cy;
|
nFrameCount = pCamera->m_nGrabFrameCount;
|
}
|
}
|
|
if(dH <= 0)
|
dH = 1.;
|
if(dV <= 0)
|
dV = 1.;
|
}
|
|
CvRect CViewMain_Recipe::Get_MaxPattern(IplImage *IpScr,CvRect roi,int nMode,int nOffSet)
|
{
|
cvSetImageROI(IpScr,roi);
|
|
IplImage *Bin = cvCreateImage(cvSize(roi.width,roi.height),8,1);
|
|
double dMean = cvAvg(IpScr).val[0];
|
|
if(nMode == 0)
|
cvThreshold(IpScr,Bin,dMean + nOffSet,255,CV_THRESH_BINARY);
|
else
|
cvThreshold(IpScr,Bin,dMean - nOffSet,255,CV_THRESH_BINARY_INV);
|
|
CvMemStorage* storage = cvCreateMemStorage(0);
|
CvSeq *contours = 0;
|
cvFindContours(Bin,storage,&contours,sizeof(CvContour),CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
|
|
|
CvRect rect;
|
CvRect rect_max = cvRect(0,0,0,0);
|
|
for(;contours!=0;contours=contours->h_next)
|
{
|
rect = cvBoundingRect(contours);
|
|
if(rect.width * rect.height > rect_max.width * rect_max.height)
|
{
|
rect_max = rect;
|
}
|
}
|
cvResetImageROI(IpScr);
|
cvSetImageROI(IpScr,rect_max);
|
|
rect_max.x += roi.x;
|
rect_max.y += roi.y;
|
cvResetImageROI(IpScr);
|
cvReleaseMemStorage(&storage);
|
cvReleaseImage(&Bin);
|
return rect_max;
|
}
|
|
CvPoint2D32f CViewMain_Recipe::Get_MarkCenter(IplImage *IpScr,CvRect roi,int nMode,int nOffSet)
|
{
|
cvSetImageROI(IpScr,roi);
|
IplImage *Bin = cvCreateImage(cvSize(roi.width,roi.height),8,1);
|
|
double dMean = cvAvg(IpScr).val[0];
|
|
switch(nMode)
|
{
|
case 0:
|
cvThreshold(IpScr,Bin,dMean + nOffSet,255,CV_THRESH_BINARY);
|
break;
|
|
case 1:
|
cvThreshold(IpScr,Bin,dMean - nOffSet,255,CV_THRESH_BINARY_INV);
|
break;
|
|
case 2:
|
cvCanny(IpScr,Bin,100,50,3);
|
break;
|
}
|
|
cvResetImageROI(IpScr);
|
|
//cvSaveImage(Data,Bin)
|
int i,j,nPos1,nPos2,nCnt1,nCnt2;
|
|
float *ptCenter_X = new float[roi.height];
|
|
float *ptCenter_Y = new float[roi.width];
|
|
BYTE *pData;
|
|
nCnt1 = nCnt2 = 0;
|
for(i = 0; i < roi.height; i++)
|
{
|
nPos1 = nPos2 = 0;
|
|
pData = (BYTE *)(&Bin->imageData[i * Bin->widthStep]);
|
for(j = 1; j < roi.width ; j++)
|
{
|
if(pData[j])
|
{
|
nPos1 = j;
|
break;
|
}
|
}
|
|
for(j = roi.width -1 ; j > 1 ; j--)
|
{
|
if(pData[j])
|
{
|
nPos2 = j;
|
break;
|
}
|
}
|
|
if(nPos1 && nPos2)
|
ptCenter_X[nCnt1++] = (float)((nPos1 + nPos2)/2.0);
|
}
|
|
|
for(j = 1 ; j< roi.width; j++)
|
{
|
nPos1 = nPos2 = 0;
|
for(i = 1; i < roi.height ; i++)
|
{
|
pData = (BYTE *)(&Bin->imageData[i * Bin->widthStep + j]);
|
|
if(*pData)
|
{
|
nPos1 = i;
|
break;
|
}
|
}
|
|
for(i = roi.height -1; i > 1 ; i--)
|
{
|
pData = (BYTE *)(&Bin->imageData[i * Bin->widthStep + j]);
|
|
if(*pData)
|
{
|
nPos2 = i;
|
break;
|
}
|
}
|
|
if(nPos1 && nPos2)
|
ptCenter_Y[nCnt2++] = (float)((nPos1 + nPos2)/2.0);
|
}
|
|
if(nCnt1)
|
sort(ptCenter_X,&ptCenter_X[nCnt1]);
|
if(nCnt2)
|
sort(ptCenter_Y,&ptCenter_Y[nCnt2]);
|
|
|
CvPoint2D32f ptCenter;
|
|
ptCenter.x = ptCenter.y = 0;
|
|
if(nCnt1 > 10 && nCnt2 > 10)
|
{
|
|
for(i = nCnt1/2 - 5; i < nCnt1/2 + 5; i++)
|
ptCenter.x += ptCenter_X[i];
|
|
for(i = nCnt2/2 - 5; i < nCnt2/2 + 5; i++)
|
ptCenter.y += ptCenter_Y[i];
|
|
ptCenter.x = (float)(ptCenter.x / 10.0 + roi.x);
|
ptCenter.y = (float)(ptCenter.y / 10.0 + roi.y);
|
}
|
else
|
{
|
|
ptCenter.x = (float)(ptCenter_X[nCnt1/2]/2.0 + roi.x);
|
ptCenter.y = (float)(ptCenter_Y[nCnt2/2]/2.0 + roi.y);
|
}
|
|
delete [] ptCenter_X;
|
delete [] ptCenter_Y;
|
|
|
cvReleaseImage(&Bin);
|
|
return ptCenter;
|
}
|
|
void CViewMain_Recipe::OnBnClickedBtnLightControl()
|
{
|
if(m_pviewLightControl != NULL)
|
{
|
m_pviewLightControl->SetData(m_pDlgRecipe,m_pHardware);
|
m_pviewLightControl->SetParent(this);
|
m_pviewLightControl->ShowWindow(SW_SHOW);
|
}
|
}
|
|
void CViewMain_Recipe::Init_PanelInfo()
|
{
|
if (m_PanelInfo.GetSafeHwnd() == NULL)
|
return;
|
|
int nRows = 17;
|
int nCols = MAX_SIDE_COUNT + 1;
|
|
int nFixRows = 1;
|
int nFixCols = 0;
|
int nRowIdx = 0;
|
int nColIdx = 0;
|
|
m_PanelInfo.DeleteAllItems();
|
m_PanelInfo.SetVirtualMode(FALSE);
|
m_PanelInfo.GetDefaultCell(TRUE, FALSE)->SetBackClr(g_nGridFixCellColor);
|
m_PanelInfo.GetDefaultCell(FALSE, TRUE)->SetBackClr(g_nGridFixCellColor);
|
m_PanelInfo.GetDefaultCell(FALSE, FALSE)->SetBackClr(g_nGridCellColor);
|
m_PanelInfo.SetFixedTextColor(g_nGridFixFontColor);
|
|
m_PanelInfo.SetRowCount(nRows);
|
m_PanelInfo.SetColumnCount(nCols);
|
m_PanelInfo.SetFixedRowCount(nFixRows);
|
m_PanelInfo.SetFixedColumnCount(nFixCols);
|
|
CFont *pFont = m_PanelInfo.GetFont();
|
if (pFont)
|
{
|
LOGFONT lf;
|
pFont->GetLogFont(&lf);
|
lf.lfItalic = 0;
|
lf.lfHeight = 14;
|
lf.lfWeight = FW_BOLD;
|
_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
|
|
m_PanelInfo.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
|
m_PanelInfo.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
|
m_PanelInfo.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
|
m_PanelInfo.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
|
}
|
|
// Col
|
m_PanelInfo.SetColumnWidth(nColIdx, 180);
|
m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("Param."));
|
m_PanelInfo.SetColumnWidth(nColIdx, 80);
|
m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("A Top"));
|
m_PanelInfo.SetColumnWidth(nColIdx, 80);
|
m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("B Top"));
|
m_PanelInfo.SetColumnWidth(nColIdx, 80);
|
m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("C Top"));
|
m_PanelInfo.SetColumnWidth(nColIdx, 80);
|
m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("D Top"));
|
m_PanelInfo.SetColumnWidth(nColIdx, 80);
|
m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("A Bot"));
|
m_PanelInfo.SetColumnWidth(nColIdx, 80);
|
m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("B Bot"));
|
m_PanelInfo.SetColumnWidth(nColIdx, 80);
|
m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("C Bot"));
|
m_PanelInfo.SetColumnWidth(nColIdx, 80);
|
m_PanelInfo.SetItemText(nRowIdx, nColIdx++, _T("D Bot"));
|
|
nColIdx = 0;
|
nRowIdx = 1;
|
|
std::vector<CString> vecParams;
|
vecParams.push_back(_T("Panel Size Y um"));
|
vecParams.push_back(_T("Top Mark (0:Edge, 1:Mark)"));
|
vecParams.push_back(_T("Top Edge To Mark X um"));
|
vecParams.push_back(_T("Top Edge To Mark Y um"));
|
vecParams.push_back(_T("Top Mark Matching Rate (%)"));
|
vecParams.push_back(_T("Bot Mark (0:Edge, 1:Mark)"));
|
vecParams.push_back(_T("Bot Edge To Mark X um"));
|
vecParams.push_back(_T("Bot Edge To Mark Y um"));
|
vecParams.push_back(_T("Bot Mark Matching Rate (%)"));
|
vecParams.push_back(_T("Start/End Line Find X pxl"));
|
vecParams.push_back(_T("Start/End Line Find Thres."));
|
vecParams.push_back(_T("Side Line Find Thres."));
|
vecParams.push_back(_T("Side Chamfer Line Find Thres."));
|
vecParams.push_back(_T("Center Judge Area Start (pxl)"));
|
vecParams.push_back(_T("Center Judge Area End (pxl)"));
|
vecParams.push_back(_T("Edge Direction"));
|
|
CLanguageControl* pLanguageControl = g_pStatus->m_pLanguageControl;
|
|
if(pLanguageControl != NULL)
|
{
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
CString strParam = pLanguageControl->GetString(m_eSelectLangType, vecParams[i]);
|
|
if(strParam.IsEmpty() || strParam.GetLength() == 0)
|
continue;
|
|
vecParams[i] = strParam;
|
}
|
}
|
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetState(GVIS_READONLY);
|
m_PanelInfo.SetRowHeight(nRowIdx, 19);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, vecParams[i]);
|
}
|
|
m_PanelInfo.SetFixedRowSelection(FALSE);
|
m_PanelInfo.SetFixedColumnSelection(FALSE);
|
m_PanelInfo.EnableSelection(TRUE);
|
m_PanelInfo.SetEditable(TRUE);
|
m_PanelInfo.SetRowResize(FALSE);
|
m_PanelInfo.SetColumnResize(FALSE);
|
m_PanelInfo.ExpandColumnsToFit(TRUE);
|
}
|
|
void CViewMain_Recipe::Init_SideInsInfo()
|
{
|
if (m_SideInspectInfo.GetSafeHwnd() == NULL)
|
return;
|
|
int nRows = 13;
|
int nCols = MAX_SIDE_COUNT + 1;
|
|
switch(m_eSelectInsType)
|
{
|
case eRcp_InsType_Chip :
|
case eRcp_InsType_Crack :
|
case eRcp_InsType_Burr :
|
case eRcp_InsType_Chamfer :
|
case eRcp_InsType_In_Chip :
|
case eRcp_InsType_In_Crack :
|
case eRcp_InsType_In_Burr :
|
case eRcp_InsType_In_Chamfer :
|
nRows = 15;
|
break;
|
case eRcp_InsType_TopCorner :
|
case eRcp_InsType_BotCorner :
|
nRows = 14;
|
break;
|
default:
|
break;
|
}
|
|
int nFixRows = 1;
|
int nFixCols = 0;
|
int nRowIdx = 0;
|
int nColIdx = 0;
|
|
m_SideInspectInfo.DeleteAllItems();
|
m_SideInspectInfo.SetVirtualMode(FALSE);
|
m_SideInspectInfo.GetDefaultCell(TRUE, FALSE)->SetBackClr(g_nGridFixCellColor);
|
m_SideInspectInfo.GetDefaultCell(FALSE, TRUE)->SetBackClr(g_nGridFixCellColor);
|
m_SideInspectInfo.GetDefaultCell(FALSE, FALSE)->SetBackClr(g_nGridCellColor);
|
m_SideInspectInfo.SetFixedTextColor(g_nGridFixFontColor);
|
|
m_SideInspectInfo.SetRowCount(nRows);
|
m_SideInspectInfo.SetColumnCount(nCols);
|
m_SideInspectInfo.SetFixedRowCount(nFixRows);
|
m_SideInspectInfo.SetFixedColumnCount(nFixCols);
|
|
CFont *pFont = m_SideInspectInfo.GetFont();
|
if (pFont)
|
{
|
LOGFONT lf;
|
pFont->GetLogFont(&lf);
|
lf.lfItalic = 0;
|
lf.lfHeight = 14;
|
lf.lfWeight = FW_BOLD;
|
_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
|
|
m_SideInspectInfo.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
|
m_SideInspectInfo.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
|
m_SideInspectInfo.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
|
m_SideInspectInfo.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
|
}
|
|
// Col
|
m_SideInspectInfo.SetColumnWidth(nColIdx, 180);
|
m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("Param."));
|
m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
|
m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("A Top"));
|
m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
|
m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("B Top"));
|
m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
|
m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("C Top"));
|
m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
|
m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("D Top"));
|
m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
|
m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("A Bot"));
|
m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
|
m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("B Bot"));
|
m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
|
m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("C Bot"));
|
m_SideInspectInfo.SetColumnWidth(nColIdx, 80);
|
m_SideInspectInfo.SetItemText(nRowIdx, nColIdx++, _T("D Bot"));
|
|
nColIdx = 0;
|
nRowIdx = 1;
|
|
CString strTemp;
|
|
if(eRcp_InsType_Chip <= m_eSelectInsType && m_eSelectInsType <= eRcp_InsType_In_Chamfer)
|
{
|
std::vector<CString> vecParams;
|
strTemp.Format(_T("%s Use (0:OFF/1:ON)"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Ins. Type (0:Gray/1:Pitch/2:G+P)"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Ins. Range um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Side Offset um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Min Thres."), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Max Thres."), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Diff Thres."), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Pitch pxl"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Side Filter (0:OFF/1:ON)"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Side Filter um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Min Size Pxl"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Min Size X um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Min Size Y um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Defect Amp."), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
|
CLanguageControl* pLanguageControl = g_pStatus->m_pLanguageControl;
|
|
if(pLanguageControl != NULL)
|
{
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
CString strParam = pLanguageControl->GetString(m_eSelectLangType, vecParams[i]);
|
|
if(strParam.IsEmpty() || strParam.GetLength() == 0)
|
continue;
|
|
vecParams[i] = strParam;
|
}
|
}
|
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetState(GVIS_READONLY);
|
m_SideInspectInfo.SetRowHeight(nRowIdx, 19);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, vecParams[i]);
|
}
|
}
|
else if(m_eSelectInsType == eRcp_InsType_TopCorner || m_eSelectInsType == eRcp_InsType_BotCorner)
|
{
|
std::vector<CString> vecParams;
|
strTemp.Format(_T("%s Type (0:None, 1:CCut, 2:RCut)"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Use Defect Inspect"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Size X um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Size Y um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Ins Start Offset pxl"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Ins Range pxl"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Ins Min Thres."), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Ins Max Thres."), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Min Size pxl"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Defect Amp."), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Use Measurement Size"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Edge Filter Size"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("%s Edge Threshold"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
|
CLanguageControl* pLanguageControl = g_pStatus->m_pLanguageControl;
|
|
if(pLanguageControl != NULL)
|
{
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
CString strParam = pLanguageControl->GetString(m_eSelectLangType, vecParams[i]);
|
|
if(strParam.IsEmpty() || strParam.GetLength() == 0)
|
continue;
|
|
vecParams[i] = strParam;
|
}
|
}
|
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetState(GVIS_READONLY);
|
m_SideInspectInfo.SetRowHeight(nRowIdx, 19);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, vecParams[i]);
|
}
|
}
|
|
m_SideInspectInfo.SetFixedRowSelection(FALSE);
|
m_SideInspectInfo.SetFixedColumnSelection(FALSE);
|
m_SideInspectInfo.EnableSelection(TRUE);
|
m_SideInspectInfo.SetEditable(TRUE);
|
m_SideInspectInfo.SetRowResize(FALSE);
|
m_SideInspectInfo.SetColumnResize(FALSE);
|
m_SideInspectInfo.ExpandColumnsToFit(TRUE);
|
}
|
|
void CViewMain_Recipe::Init_JudgementInfo()
|
{
|
if (m_JudgementInfo.GetSafeHwnd() == NULL)
|
return;
|
|
int nRows = 10;
|
int nCols = MAX_SIDE_COUNT + 1;
|
|
switch(m_eSelectInsType)
|
{
|
case eRcp_InsType_Chip :
|
case eRcp_InsType_Crack :
|
case eRcp_InsType_Burr :
|
case eRcp_InsType_Chamfer :
|
case eRcp_InsType_In_Chip :
|
case eRcp_InsType_In_Crack :
|
case eRcp_InsType_In_Burr :
|
case eRcp_InsType_In_Chamfer :
|
nRows = 10;
|
break;
|
case eRcp_InsType_TopCorner :
|
case eRcp_InsType_BotCorner :
|
nRows = 11;
|
break;
|
default:
|
break;
|
}
|
|
int nFixRows = 1;
|
int nFixCols = 0;
|
int nRowIdx = 0;
|
int nColIdx = 0;
|
|
m_JudgementInfo.DeleteAllItems();
|
m_JudgementInfo.SetVirtualMode(FALSE);
|
m_JudgementInfo.GetDefaultCell(TRUE, FALSE)->SetBackClr(g_nGridFixCellColor);
|
m_JudgementInfo.GetDefaultCell(FALSE, TRUE)->SetBackClr(g_nGridFixCellColor);
|
m_JudgementInfo.GetDefaultCell(FALSE, FALSE)->SetBackClr(g_nGridCellColor);
|
m_JudgementInfo.SetFixedTextColor(g_nGridFixFontColor);
|
|
m_JudgementInfo.SetRowCount(nRows);
|
m_JudgementInfo.SetColumnCount(nCols);
|
m_JudgementInfo.SetFixedRowCount(nFixRows);
|
m_JudgementInfo.SetFixedColumnCount(nFixCols);
|
|
CFont *pFont = m_JudgementInfo.GetFont();
|
if (pFont)
|
{
|
LOGFONT lf;
|
pFont->GetLogFont(&lf);
|
lf.lfItalic = 0;
|
lf.lfHeight = 14;
|
lf.lfWeight = FW_BOLD;
|
_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
|
|
m_JudgementInfo.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
|
m_JudgementInfo.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
|
m_JudgementInfo.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
|
m_JudgementInfo.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
|
}
|
|
// Col
|
m_JudgementInfo.SetColumnWidth(nColIdx, 180);
|
m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("Param."));
|
m_JudgementInfo.SetColumnWidth(nColIdx, 80);
|
m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("A Top"));
|
m_JudgementInfo.SetColumnWidth(nColIdx, 80);
|
m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("B Top"));
|
m_JudgementInfo.SetColumnWidth(nColIdx, 80);
|
m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("C Top"));
|
m_JudgementInfo.SetColumnWidth(nColIdx, 80);
|
m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("D Top"));
|
m_JudgementInfo.SetColumnWidth(nColIdx, 80);
|
m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("A Bot"));
|
m_JudgementInfo.SetColumnWidth(nColIdx, 80);
|
m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("B Bot"));
|
m_JudgementInfo.SetColumnWidth(nColIdx, 80);
|
m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("C Bot"));
|
m_JudgementInfo.SetColumnWidth(nColIdx, 80);
|
m_JudgementInfo.SetItemText(nRowIdx, nColIdx++, _T("D Bot"));
|
|
nColIdx = 0;
|
nRowIdx = 1;
|
|
CString strTemp;
|
|
if(eRcp_InsType_Chip <= m_eSelectInsType && m_eSelectInsType <= eRcp_InsType_In_Chamfer)
|
{
|
CString strAreaName[3] = {_T("1st"), _T("2nd"), _T("3rd") };
|
|
std::vector<CString> vecParams;
|
|
for(int i=0; i<3; i++)
|
{
|
strTemp.Format(_T("[%s] %s Min Size X um"), strAreaName[i], g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("[%s] %s Min Size Y um"), strAreaName[i], g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("[%s] %s Filter (0:NG/1:OR/2:AND)"), strAreaName[i], g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
}
|
|
CLanguageControl* pLanguageControl = g_pStatus->m_pLanguageControl;
|
|
if(pLanguageControl != NULL)
|
{
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
CString strParam = pLanguageControl->GetString(m_eSelectLangType, vecParams[i]);
|
|
if(strParam.IsEmpty() || strParam.GetLength() == 0)
|
continue;
|
|
vecParams[i] = strParam;
|
}
|
}
|
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetState(GVIS_READONLY);
|
m_JudgementInfo.SetRowHeight(nRowIdx, 19);
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, vecParams[i]);
|
}
|
}
|
else if(eRcp_InsType_TopCorner <= m_eSelectInsType && m_eSelectInsType <= eRcp_InsType_BotCorner)
|
{
|
std::vector<CString> vecParams;
|
strTemp.Format(_T("Defect Min Size X um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Defect Min Size Y um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Defect Filter (0:NG/1:OR/2:AND)"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Measure Size X Std um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Measure Size X Min um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Measure Size X Max um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Measure Size Y Std um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Measure Size Y Min um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Measure Size Y Max um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Measure Filter (0:NG/1:OR/2:AND)"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
|
CLanguageControl* pLanguageControl = g_pStatus->m_pLanguageControl;
|
|
if(pLanguageControl != NULL)
|
{
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
CString strParam = pLanguageControl->GetString(m_eSelectLangType, vecParams[i]);
|
|
if(strParam.IsEmpty() || strParam.GetLength() == 0)
|
continue;
|
|
vecParams[i] = strParam;
|
}
|
}
|
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetState(GVIS_READONLY);
|
m_JudgementInfo.SetRowHeight(nRowIdx, 19);
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, vecParams[i]);
|
}
|
}
|
else
|
{
|
std::vector<CString> vecParams;
|
strTemp.Format(_T("Min Size X um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Min Size Y um"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
strTemp.Format(_T("Filter (0:NG/1:OR/2:AND)"), g_strInsType[m_eSelectInsType]);
|
vecParams.push_back(strTemp);
|
|
CLanguageControl* pLanguageControl = g_pStatus->m_pLanguageControl;
|
|
if(pLanguageControl != NULL)
|
{
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
CString strParam = pLanguageControl->GetString(m_eSelectLangType, vecParams[i]);
|
|
if(strParam.IsEmpty() || strParam.GetLength() == 0)
|
continue;
|
|
vecParams[i] = strParam;
|
}
|
}
|
|
for(int i=0; i<vecParams.size(); i++)
|
{
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetState(GVIS_READONLY);
|
m_JudgementInfo.SetRowHeight(nRowIdx, 19);
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, vecParams[i]);
|
}
|
}
|
|
|
m_JudgementInfo.SetFixedRowSelection(FALSE);
|
m_JudgementInfo.SetFixedColumnSelection(FALSE);
|
m_JudgementInfo.EnableSelection(TRUE);
|
m_JudgementInfo.SetEditable(TRUE);
|
m_JudgementInfo.SetRowResize(FALSE);
|
m_JudgementInfo.SetColumnResize(FALSE);
|
m_JudgementInfo.ExpandColumnsToFit(TRUE);
|
}
|
|
void CViewMain_Recipe::Fill_PanelInfo(BOOL bGetData)
|
{
|
if(m_pRecipe == NULL)
|
return;
|
|
CString strTemp;
|
|
int nRowIdx = 0;
|
int nColIdx = 0;
|
|
if(bGetData == FALSE)
|
{
|
for(int i=0; i<MAX_SIDE_COUNT; i++)
|
{
|
UINT uCellColor = (i != (int) m_eSelectSide) ? g_nGridCellColor_NonSelect : g_nGridCellColor;
|
|
nRowIdx = 1;
|
nColIdx = i + 1;
|
|
CSIDE_PARM* pSideParam = &m_pDlgRecipe->m_SideParam[i];
|
|
// 1. Panel Size Y um
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nSidePanelSize_um);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 2. Top Mark?
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_bTopMark_Use);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 3. Top Edge To Mark X um
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopMarkToEdgeX_um);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 4. Top Edge To Mark Y um
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopMarkToEdgeY_um);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 5. Top Mark Matching Rate
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%.2f"), pSideParam->m_dTopMarkTemplateMatchingRate);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 6. Bottom Mark?
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_bBottomMark_Use);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 7. Bottom Edge To Mark X um
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomMarkToEdgeX_um);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 8. Bottom Edge To Mark Y um
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomMarkToEdgeY_um);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 9. Bottom Mark Matching Rate
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%.2f"), pSideParam->m_dBottomMarkTemplateMatchingRate);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 10. Start / End Line Find X
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nFindStartEndLine_X_pxl);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 11. Start / End Line Find Threshold
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nFindStartEndLine_Threshold);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 12. Side Line Find Threshold
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nSideLineThreshold);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 13. Chamfer Line Find Threshold
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nChamferLineThreshold);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 13. Center Judge Area Start
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nCenterJudgeArea_StartLine_To_Start_pxl);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 14. Center Judge Area End
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nCenterJudgeArea_StartLine_To_End_pxl);
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
//15. Pose Direction
|
m_PanelInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp = pSideParam->m_strPosDirection;
|
m_PanelInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
}
|
|
m_PanelInfo.Invalidate();
|
}
|
else
|
{
|
for(int i=0; i<MAX_SIDE_COUNT; i++)
|
{
|
nRowIdx = 1;
|
nColIdx = i + 1;
|
|
CSIDE_PARM* pSideParam = &m_pDlgRecipe->m_SideParam[i];
|
|
// 1. Panel Size Y um
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nSidePanelSize_um = _wtoi(strTemp);
|
|
// 2. Top Mark
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_bTopMark_Use = _wtoi(strTemp);
|
|
// 3. Top Edge To Mark X um
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopMarkToEdgeX_um = _wtoi(strTemp);
|
|
// 4. Top Edge To Mark Y um
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopMarkToEdgeY_um = _wtoi(strTemp);
|
|
// 5. Top Mark Matching Rate
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_dTopMarkTemplateMatchingRate = _wtof(strTemp);
|
|
// 6. Bottom Mark
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_bBottomMark_Use = _wtoi(strTemp);
|
|
// 7. Bottom Edge To Mark X um
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomMarkToEdgeX_um = _wtoi(strTemp);
|
|
// 8. Bottom Edge To Mark Y um
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomMarkToEdgeY_um = _wtoi(strTemp);
|
|
// 9. Bottom Mark Matching Rate
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_dBottomMarkTemplateMatchingRate = _wtof(strTemp);
|
|
// 10. Start / End Line Find X
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nFindStartEndLine_X_pxl = _wtoi(strTemp);
|
|
// 11. Start / End Line Find Threshold
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nFindStartEndLine_Threshold = _wtoi(strTemp);
|
|
// 12. Side Line Find Threshold
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nSideLineThreshold = _wtoi(strTemp);
|
|
// 12. Side Line Find Threshold
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nChamferLineThreshold = _wtoi(strTemp);
|
|
// 13. Center Judge Area Start
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nCenterJudgeArea_StartLine_To_Start_pxl = _wtoi(strTemp);
|
|
// 14. Center Judge Area End
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nCenterJudgeArea_StartLine_To_End_pxl = _wtoi(strTemp);
|
|
// 15. Pose Direction
|
strTemp = m_PanelInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_strPosDirection = strTemp;
|
}
|
}
|
}
|
|
void CViewMain_Recipe::Fill_SideInsInfo(BOOL bGetData)
|
{
|
if(m_pRecipe == NULL)
|
return;
|
|
CString strTemp;
|
|
int nRowIdx = 0;
|
int nColIdx = 0;
|
|
if(bGetData == FALSE)
|
{
|
for(int i=0; i<MAX_SIDE_COUNT; i++)
|
{
|
UINT uCellColor = (i != (int) m_eSelectSide) ? g_nGridCellColor_NonSelect : g_nGridCellColor;
|
|
nRowIdx = 1;
|
nColIdx = i + 1;
|
|
CSIDE_PARM* pSideParam = &m_pDlgRecipe->m_SideParam[i];
|
|
if(eRcp_InsType_Chip <= m_eSelectInsType && m_eSelectInsType <= eRcp_InsType_In_Chamfer)
|
{
|
CSIDE_INSPECTT_PARM* pSideInsParam = &pSideParam->m_InspectPrm[(int) m_eSelectInsType];
|
|
// 1. m_bUseInspect;
|
// m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
if(pSideInsParam->m_bUseInspect == TRUE) m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(RGB(50,255,50));
|
else m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(RGB(255,50,50));
|
|
strTemp.Format(_T("%d"), pSideInsParam->m_bUseInspect);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 2. m_nInspect_Method; // 0 : Gray, 1 : Pitch, 2 : Gray + Pitch
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nInspect_Method);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 3. m_nInspect_Range_um;
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nInspect_Range_um);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
// 4. m_nInspect_SideLine_Offset_um;
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nInspect_SideLine_Offset_um);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
|
// 5. m_nMin_Threshold;
|
if(pSideInsParam->m_nInspect_Method == 1) m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(g_nGridCellColor_NonSelect);
|
else m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nMin_Threshold);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 6. m_nMax_Threshold;
|
if(pSideInsParam->m_nInspect_Method == 1) m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(g_nGridCellColor_NonSelect);
|
else m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nMax_Threshold);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 7. m_nDiff_Threshold;
|
if(pSideInsParam->m_nInspect_Method == 0) m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(g_nGridCellColor_NonSelect);
|
else m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nDiff_Threshold);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 8. m_nDiff_Pitch;
|
if(pSideInsParam->m_nInspect_Method == 0) m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(g_nGridCellColor_NonSelect);
|
else m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nDiff_Pitch);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 9. m_bSide_Filter;
|
if(pSideInsParam->m_bSide_Filter == 0) m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(g_nGridCellColor_NonSelect);
|
else m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_bSide_Filter);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 10. m_nSide_Filter_pxl;
|
if(pSideInsParam->m_bSide_Filter == 0) m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(g_nGridCellColor_NonSelect);
|
else m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nSide_Filter_um);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 11. m_nMinSize_Filter_pxl;
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nMinSize_Filter_pxl);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
// 12. m_nMinSize_Filter_X_pxl;
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nMinSize_Filter_X_um);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
// 13. m_nMinSize_Filter_Y_pxl;
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nMinSize_Filter_Y_um);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
// 14. m_nDefect_Size_Dilation;
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nDefect_Size_Dilation);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
}
|
else if(m_eSelectInsType == eRcp_InsType_TopCorner)
|
{
|
// 1. Top Corner Type
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerShape);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 2. m_bTopCornerFindDefect
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_bTopCornerFindDefect);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 3. Top Corner Size X um
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerSizeX_um);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 4. Top Corner Size Y um
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerSizeY_um);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 5. m_nTopCornerIns_StartOffset
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerIns_StartOffset );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 6. m_nTopCornerIns_Range
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerIns_Range );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 7. m_nTopCornerIns_Thres_Min
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerIns_Thres_Min );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 8. m_nTopCornerIns_Thres_Max
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerIns_Thres_Max );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 9. m_nTopCornerIns_Min_Size
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerIns_Min_Size );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 10. m_nTopCornerIns_Defect_Size_Dilation
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerIns_Defect_Size_Dilation );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 11. m_bTopCornerMeasureSize
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_bTopCornerMeasureSize );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 12. m_nTopCornerIns_Defect_Size_Dilation
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerEdgeFilterSize );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 13. m_nTopCornerIns_Defect_Size_Dilation
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCornerEdgeThreshold );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
}
|
else if(m_eSelectInsType == eRcp_InsType_BotCorner)
|
{
|
// 10. Bot Corner Type
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerShape);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 11. m_bBottomCornerFindDefect
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_bBottomCornerFindDefect);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 12. Bot Corner Size X um
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerSizeX_um);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 13. Bot Corner Size Y um
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerSizeY_um);
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 14. m_nBotCornerIns_StartOffset
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerIns_StartOffset );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 15. m_nBotCornerIns_Range
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerIns_Range );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 16. m_nBotCornerIns_Thres_Min
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerIns_Thres_Min );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 17. m_nBotCornerIns_Thres_Max
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerIns_Thres_Max );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 18. m_nBotCornerIns_Min_Size
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerIns_Min_Size );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 19. m_nBotCornerIns_Defect_Size_Dilation
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerIns_Defect_Size_Dilation );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 20. m_bBottomCornerMeasureSize
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_bBottomCornerMeasureSize );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 21. m_nBotCornerIns_Defect_Size_Dilation
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerEdgeFilterSize );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 22. m_nBotCornerIns_Defect_Size_Dilation
|
m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCornerEdgeThreshold );
|
m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
}
|
}
|
|
m_SideInspectInfo.Invalidate();
|
}
|
else
|
{
|
for(int i=0; i<MAX_SIDE_COUNT; i++)
|
{
|
nRowIdx = 1;
|
nColIdx = i + 1;
|
|
CSIDE_PARM* pSideParam = &m_pDlgRecipe->m_SideParam[i];
|
|
if(eRcp_InsType_Chip <= m_eSelectInsType && m_eSelectInsType <= eRcp_InsType_In_Chamfer)
|
{
|
CSIDE_INSPECTT_PARM* pSideInsParam = &pSideParam->m_InspectPrm[(int) m_eSelectInsType];
|
|
// 1. m_bUseInspect;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_bUseInspect = _wtoi(strTemp);
|
// 2. m_nInspect_Method; // 0 : Gray, 1 : Pitch, 2 : Gray + Pitch
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nInspect_Method = _wtoi(strTemp);
|
// 3. m_nInspect_Range_um;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nInspect_Range_um = _wtoi(strTemp);
|
// 4. m_nInspect_SideLine_Offset_um;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nInspect_SideLine_Offset_um = _wtoi(strTemp);
|
// 5. m_nMin_Threshold;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nMin_Threshold = _wtoi(strTemp);
|
// 6. m_nMax_Threshold;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nMax_Threshold = _wtoi(strTemp);
|
// 7. m_nDiff_Threshold;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nDiff_Threshold = _wtoi(strTemp);
|
// 8. m_nDiff_Pitch;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nDiff_Pitch = _wtoi(strTemp);
|
// 9. m_bSide_Filter;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_bSide_Filter = _wtoi(strTemp);
|
// 10. m_nSide_Filter_pxl;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nSide_Filter_um = _wtoi(strTemp);
|
// 11. m_nMinSize_Filter_pxl;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nMinSize_Filter_pxl = _wtoi(strTemp);
|
// 12. m_nMinSize_Filter_X_pxl;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nMinSize_Filter_X_um = _wtoi(strTemp);
|
// 13. m_nMinSize_Filter_Y_pxl;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nMinSize_Filter_Y_um = _wtoi(strTemp);
|
// 12. m_nDefect_Size_Dilation;
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nDefect_Size_Dilation = _wtoi(strTemp);
|
}
|
else if(m_eSelectInsType == eRcp_InsType_TopCorner)
|
{
|
// 1. Top Corner Type
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerShape = _wtoi(strTemp);
|
|
// 2. m_bTopCornerFindDefect
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_bTopCornerFindDefect = _wtoi(strTemp);
|
|
// 3. Top Corner Size X um
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerSizeX_um = _wtoi(strTemp);
|
|
// 4. Top Corner Size Y um
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerSizeY_um = _wtoi(strTemp);
|
|
// 5. m_nTopCornerIns_StartOffset
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerIns_StartOffset = _wtoi(strTemp);
|
|
// 6. m_nTopCornerIns_Range
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerIns_Range = _wtoi(strTemp);
|
|
// 7. m_nTopCornerIns_Thres_Min
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerIns_Thres_Min = _wtoi(strTemp);
|
|
// 8. m_nTopCornerIns_Thres_Max
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerIns_Thres_Max = _wtoi(strTemp);
|
|
// 9. m_nTopCornerIns_Min_Size
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerIns_Min_Size = _wtoi(strTemp);
|
|
// 10. m_nTopCornerIns_Defect_Size_Dilation
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerIns_Defect_Size_Dilation = _wtoi(strTemp);
|
|
// 11. m_bTopCornerMeasureSize
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_bTopCornerMeasureSize = _wtoi(strTemp);
|
|
// 12. m_nTopCornerIns_Defect_Size_Dilation
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerEdgeFilterSize = _wtoi(strTemp);
|
|
// 13. m_nTopCornerIns_Defect_Size_Dilation
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCornerEdgeThreshold = _wtoi(strTemp);
|
}
|
else if(m_eSelectInsType == eRcp_InsType_BotCorner)
|
{
|
// 10. Bot Corner Type
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerShape = _wtoi(strTemp);
|
|
// 11. m_bBottomCornerFindDefect
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_bBottomCornerFindDefect = _wtoi(strTemp);
|
|
// 12. Bot Corner Size X um
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerSizeX_um = _wtoi(strTemp);
|
|
// 13. Bot Corner Size Y um
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerSizeY_um = _wtoi(strTemp);
|
|
// 14. m_nBottomCornerIns_Range
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerIns_StartOffset = _wtoi(strTemp);
|
|
// 15. m_nBottomCornerIns_Range
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerIns_Range = _wtoi(strTemp);
|
|
// 16. m_nBottomCornerIns_Thres_Min
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerIns_Thres_Min = _wtoi(strTemp);
|
|
// 17. m_nBottomCornerIns_Thres_Max
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerIns_Thres_Max = _wtoi(strTemp);
|
|
// 18. m_nBottomCornerIns_Min_Size
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerIns_Min_Size = _wtoi(strTemp);
|
|
// 19. m_nBottomCornerIns_Defect_Size_Dilation
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerIns_Defect_Size_Dilation = _wtoi(strTemp);
|
|
// 20. m_bBottomCornerMeasureSize
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_bBottomCornerMeasureSize = _wtoi(strTemp);
|
|
// 21. m_nBottomCornerEdgeFilterSize
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerEdgeFilterSize = _wtoi(strTemp);
|
|
// 22. m_nBottomCornerEdgeThreshold
|
strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCornerEdgeThreshold = _wtoi(strTemp);
|
}
|
}
|
}
|
}
|
|
|
void CViewMain_Recipe::Fill_JudgementInfo(BOOL bGetData)
|
{
|
if(m_pRecipe == NULL)
|
return;
|
|
CString strTemp;
|
|
int nRowIdx = 0;
|
int nColIdx = 0;
|
|
if(bGetData == FALSE)
|
{
|
for(int i=0; i<MAX_SIDE_COUNT; i++)
|
{
|
UINT uCellColor = (i != (int) m_eSelectSide) ? g_nGridCellColor_NonSelect : g_nGridCellColor;
|
|
nRowIdx = 1;
|
nColIdx = i + 1;
|
|
CSIDE_PARM* pSideParam = &m_pDlgRecipe->m_SideParam[i];
|
|
if(eRcp_InsType_Chip <= m_eSelectInsType && m_eSelectInsType <= eRcp_InsType_In_Chamfer)
|
{
|
CSIDE_INSPECTT_PARM* pSideInsParam = &pSideParam->m_InspectPrm[(int) m_eSelectInsType];
|
|
for(int i=0; i<3; i++)
|
{
|
// 1. Min Size X
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nJudge_Size_Min_X_um[i]);
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 2. Min Size Y
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nJudge_Size_Min_Y_um[i]);
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 3. OR/AND
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideInsParam->m_nJudge_Size_Min_OR_AND[i]);
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
}
|
}
|
else if(m_eSelectInsType == eRcp_InsType_TopCorner)
|
{
|
// 1. Top Corner Min Size X
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCorner_Judge_Size_Min_X_um );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 2. Top Corner Min Size Y
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCorner_Judge_Size_Min_Y_um );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 3. Top Corner OR/AND
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCorner_Judge_Size_Min_OR_AND );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 4. m_nTopCorner_Measure_Judge_Std_um_X
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCorner_Measure_Judge_Std_um_X );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 5. m_nTopCorner_Measure_Judge_Min_um_X
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCorner_Measure_Judge_Min_um_X );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 6. m_nTopCorner_Measure_Judge_Max_um_X
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCorner_Measure_Judge_Max_um_X );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 7. m_nTopCorner_Measure_Judge_Std_um_Y
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCorner_Measure_Judge_Std_um_Y );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 8. m_nTopCorner_Measure_Judge_Min_um_Y
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCorner_Measure_Judge_Min_um_Y );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 9. m_nTopCorner_Measure_Judge_Max_um_Y
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCorner_Measure_Judge_Max_um_Y );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 10. m_nTopCorner_Measure_Judge_OR_AND
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nTopCorner_Measure_Judge_OR_AND );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
}
|
else if(m_eSelectInsType == eRcp_InsType_BotCorner)
|
{
|
// 1. Bottom Corner Min Size X
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Judge_Size_Min_X_um );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 2. Bottom Corner Min Size Y
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Judge_Size_Min_Y_um );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 3. Bottom Corner OR/AND
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Judge_Size_Min_OR_AND );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 4. m_nBottomCorner_Measure_Judge_Std_um_X
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Measure_Judge_Std_um_X );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 5. m_nBottomCorner_Measure_Judge_Min_um_X
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Measure_Judge_Min_um_X );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 6. m_nBottomCorner_Measure_Judge_Max_um_X
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Measure_Judge_Max_um_X );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 7. m_nBottomCorner_Measure_Judge_Std_um_Y
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Measure_Judge_Std_um_Y );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 8. m_nBottomCorner_Measure_Judge_Min_um_Y
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Measure_Judge_Min_um_Y );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 9. m_nBottomCorner_Measure_Judge_Max_um_Y
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Measure_Judge_Max_um_Y );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
|
// 10. m_nBottomCorner_Measure_Judge_OR_AND
|
m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
|
strTemp.Format(_T("%d"), pSideParam->m_nBottomCorner_Measure_Judge_OR_AND );
|
m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
|
}
|
}
|
|
m_JudgementInfo.Invalidate();
|
}
|
else
|
{
|
for(int i=0; i<MAX_SIDE_COUNT; i++)
|
{
|
nRowIdx = 1;
|
nColIdx = i + 1;
|
|
CSIDE_PARM* pSideParam = &m_pDlgRecipe->m_SideParam[i];
|
|
if(eRcp_InsType_Chip <= m_eSelectInsType && m_eSelectInsType <= eRcp_InsType_In_Chamfer)
|
{
|
CSIDE_INSPECTT_PARM* pSideInsParam = &pSideParam->m_InspectPrm[(int) m_eSelectInsType];
|
|
for(int i=0; i<3; i++)
|
{
|
// 1. Min Size X
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nJudge_Size_Min_X_um[i] = _wtoi(strTemp);
|
|
// 2. Min Size Y
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nJudge_Size_Min_Y_um[i] = _wtoi(strTemp);
|
|
// 3. OR/AND
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideInsParam->m_nJudge_Size_Min_OR_AND[i] = _wtoi(strTemp);
|
}
|
}
|
else if(m_eSelectInsType == eRcp_InsType_TopCorner)
|
{
|
// 1. Top Corner Min Size X
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCorner_Judge_Size_Min_X_um = _wtoi(strTemp);
|
|
// 2. Top Corner Min Size Y
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCorner_Judge_Size_Min_Y_um = _wtoi(strTemp);
|
|
// 3. Top Corner OR/AND
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCorner_Judge_Size_Min_OR_AND = _wtoi(strTemp);
|
|
// 4. m_nTopCorner_Measure_Judge_Std_um_X
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCorner_Measure_Judge_Std_um_X = _wtoi(strTemp);
|
|
// 5. m_nTopCorner_Measure_Judge_Min_um_X
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCorner_Measure_Judge_Min_um_X = _wtoi(strTemp);
|
|
// 6. m_nTopCorner_Measure_Judge_Max_um_X
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCorner_Measure_Judge_Max_um_X = _wtoi(strTemp);
|
|
// 7. m_nTopCorner_Measure_Judge_Std_um_Y
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCorner_Measure_Judge_Std_um_Y = _wtoi(strTemp);
|
|
// 8. m_nTopCorner_Measure_Judge_Min_um_Y
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCorner_Measure_Judge_Min_um_Y = _wtoi(strTemp);
|
|
// 9. m_nTopCorner_Measure_Judge_Max_um_Y
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCorner_Measure_Judge_Max_um_Y = _wtoi(strTemp);
|
|
// 10. m_nTopCorner_Measure_Judge_OR_AND
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nTopCorner_Measure_Judge_OR_AND = _wtoi(strTemp);
|
}
|
else if(m_eSelectInsType == eRcp_InsType_BotCorner)
|
{
|
// 1. Bottom Corner Min Size X
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCorner_Judge_Size_Min_X_um = _wtoi(strTemp);
|
|
// 2. Bottom Corner Min Size Y
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCorner_Judge_Size_Min_Y_um = _wtoi(strTemp);
|
|
// 3. Bottom Corner OR/AND
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCorner_Judge_Size_Min_OR_AND = _wtoi(strTemp);
|
|
// 4. m_nBottomCorner_Measure_Judge_Std_um_X
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCorner_Measure_Judge_Std_um_X = _wtoi(strTemp);
|
|
// 5. m_nBottomCorner_Measure_Judge_Min_um_X
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCorner_Measure_Judge_Min_um_X = _wtoi(strTemp);
|
|
// 6. m_nBottomCorner_Measure_Judge_Max_um_X
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCorner_Measure_Judge_Max_um_X = _wtoi(strTemp);
|
|
// 7. m_nBottomCorner_Measure_Judge_Std_um_Y
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCorner_Measure_Judge_Std_um_Y = _wtoi(strTemp);
|
|
// 8. m_nBottomCorner_Measure_Judge_Min_um_Y
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCorner_Measure_Judge_Min_um_Y = _wtoi(strTemp);
|
|
// 9. m_nBottomCorner_Measure_Judge_Max_um_Y
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCorner_Measure_Judge_Max_um_Y = _wtoi(strTemp);
|
|
// 10. m_nBottomCorner_Measure_Judge_OR_AND
|
strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
|
pSideParam->m_nBottomCorner_Measure_Judge_OR_AND = _wtoi(strTemp);
|
}
|
}
|
}
|
}
|
|
void CViewMain_Recipe::Init_BitmapInfo()
|
{
|
SIZE sz;
|
sz.cx = 100;sz.cy = 100;
|
|
m_pBmInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFO)+256*sizeof(RGBQUAD));
|
m_pBmInfo->bmiHeader.biBitCount = 8;
|
m_pBmInfo->bmiHeader.biClrImportant = 256;
|
m_pBmInfo->bmiHeader.biClrUsed = 256;
|
m_pBmInfo->bmiHeader.biCompression = BI_RGB;
|
m_pBmInfo->bmiHeader.biHeight = -sz.cy;
|
m_pBmInfo->bmiHeader.biPlanes = 1;
|
m_pBmInfo->bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
|
m_pBmInfo->bmiHeader.biSizeImage = sz.cx * sz.cy;
|
m_pBmInfo->bmiHeader.biWidth = sz.cx;
|
m_pBmInfo->bmiHeader.biXPelsPerMeter=0;
|
m_pBmInfo->bmiHeader.biYPelsPerMeter=0;
|
for(int i=0; i<256; i++) // Palette number is 256
|
{
|
m_pBmInfo->bmiColors[i].rgbRed= m_pBmInfo->bmiColors[i].rgbGreen = m_pBmInfo->bmiColors[i].rgbBlue = i;
|
m_pBmInfo->bmiColors[i].rgbReserved = 0;
|
}
|
}
|
|
void CViewMain_Recipe::ClickSideSelButton()
|
{
|
UINT nID = GetFocus()->GetDlgCtrlID();
|
|
UpdateRecipe(TRUE);
|
|
ChangViewCdmSide(nID);
|
}
|
|
|
void CViewMain_Recipe::ClickRdoInsType()
|
{
|
UINT nID = GetFocus()->GetDlgCtrlID();
|
|
Fill_SideInsInfo(TRUE); // Get Data..
|
Fill_JudgementInfo(TRUE);
|
|
ChangInsTypeSide(nID);
|
}
|
|
void CViewMain_Recipe::ClickButtonLang()
|
{
|
UINT nID = GetFocus()->GetDlgCtrlID();
|
|
emLanguageType eSelLang;
|
|
switch(nID)
|
{
|
case IDC_BUTTON_LANG_ENGLISH:
|
eSelLang = emLanguageType_EN;
|
break;
|
case IDC_BUTTON_LANG_KOREAN:
|
eSelLang = emLanguageType_KR;
|
break;
|
case IDC_BUTTON_LANG_CHINESE:
|
eSelLang = emLanguageType_CH;
|
break;
|
default:
|
return;
|
}
|
|
if(m_eSelectLangType == eSelLang)
|
return;
|
|
m_eSelectLangType = eSelLang;
|
|
Init_PanelInfo();
|
Init_SideInsInfo();
|
Init_JudgementInfo();
|
|
UpdateRecipe(FALSE);
|
}
|
|
void CViewMain_Recipe::ClickBtnMarkUpdate()
|
{
|
if(m_pDlgRecipe == NULL)
|
return;
|
|
CSIDE_PARM* pSideParam = &m_pDlgRecipe->m_SideParam[(DimensionDir)m_eSelectSide];
|
|
CRect rtMeasureRect = m_frameImg.GetManualMeasureRect();
|
|
if(rtMeasureRect.IsRectEmpty() == TRUE || rtMeasureRect.IsRectNull() == TRUE)
|
return;
|
|
LPBYTE lpImg = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)m_eSelectSide, rtMeasureRect.top);
|
|
UINT nID = GetFocus()->GetDlgCtrlID();
|
|
BOOL bBotMark = FALSE;
|
int nMarkIdx = 0;
|
|
switch(nID)
|
{
|
case IDC_BTN_TOP_MARK_UPDATE_0: nMarkIdx = 0;
|
break;
|
case IDC_BTN_TOP_MARK_UPDATE_1: nMarkIdx = 1;
|
break;
|
case IDC_BTN_TOP_MARK_UPDATE_2: nMarkIdx = 2;
|
break;
|
case IDC_BTN_BOT_MARK_UPDATE_0: nMarkIdx = 0, bBotMark = TRUE;
|
break;
|
case IDC_BTN_BOT_MARK_UPDATE_1: nMarkIdx = 1, bBotMark = TRUE;
|
break;
|
case IDC_BTN_BOT_MARK_UPDATE_2: nMarkIdx = 2, bBotMark = TRUE;
|
break;
|
default:
|
return;
|
break;
|
}
|
|
USES_CONVERSION;
|
|
if(bBotMark == FALSE)
|
{
|
if(m_pTopMarkImage[nMarkIdx])
|
cvReleaseImage(&m_pTopMarkImage[nMarkIdx]);
|
|
m_pTopMarkImage[nMarkIdx] = cvCreateImage(cvSize(rtMeasureRect.Width(), rtMeasureRect.Height()),8,1);
|
|
for(int i=0 ; i<rtMeasureRect.Height() ; i++)
|
memcpy(&m_pTopMarkImage[nMarkIdx]->imageData[i*m_pTopMarkImage[nMarkIdx]->widthStep], &lpImg[i*IMAGE_WIDTH + rtMeasureRect.left], rtMeasureRect.Width());
|
|
CString strPath;
|
CreateDirectory(RECIPE_ALIGN_PATH, NULL);
|
strPath.Format(_T("%s\\%s"),RECIPE_ALIGN_PATH,m_pDlgRecipe->GetRecipeName());
|
CreateDirectory(strPath, NULL);
|
|
strPath.Format(_T("%s\\%s\\Side_%d_TopAlign_%d.bmp"),RECIPE_ALIGN_PATH,m_pDlgRecipe->GetRecipeName(), (int) m_eSelectSide, nMarkIdx);
|
|
char str_filename[256];
|
sprintf_s(str_filename, "%s", W2A(strPath));
|
cvSaveImage(str_filename, m_pTopMarkImage[nMarkIdx]);
|
}
|
else
|
{
|
if(m_pBotMarkImage[nMarkIdx])
|
cvReleaseImage(&m_pBotMarkImage[nMarkIdx]);
|
|
m_pBotMarkImage[nMarkIdx] = cvCreateImage(cvSize(rtMeasureRect.Width(), rtMeasureRect.Height()),8,1);
|
|
for(int i=0 ; i<rtMeasureRect.Height() ; i++)
|
memcpy(&m_pBotMarkImage[nMarkIdx]->imageData[i*m_pBotMarkImage[nMarkIdx]->widthStep], &lpImg[i*IMAGE_WIDTH + rtMeasureRect.left], rtMeasureRect.Width());
|
|
CString strPath;
|
CreateDirectory(RECIPE_ALIGN_PATH, NULL);
|
strPath.Format(_T("%s\\%s"),RECIPE_ALIGN_PATH,m_pDlgRecipe->GetRecipeName());
|
CreateDirectory(strPath, NULL);
|
|
strPath.Format(_T("%s\\%s\\Side_%d_BotAlign_%d.bmp"),RECIPE_ALIGN_PATH,m_pDlgRecipe->GetRecipeName(), (int) m_eSelectSide, nMarkIdx);
|
|
char str_filename[256];
|
sprintf_s(str_filename, "%s", W2A(strPath));
|
cvSaveImage(str_filename, m_pBotMarkImage[nMarkIdx]);
|
}
|
|
UpdateMarkImage();
|
}
|
|
void CViewMain_Recipe::UpdateMarkImage()
|
{
|
if(m_pDlgRecipe == NULL)
|
return;
|
|
CSIDE_PARM* pSideParam = &m_pDlgRecipe->m_SideParam[(DimensionDir)m_eSelectSide];
|
|
USES_CONVERSION;
|
char str_filename[256];
|
|
for(int nMarkIdx = 0; nMarkIdx < MAX_MARKER_COUNT ; nMarkIdx++)
|
{
|
if(m_pTopMarkImage[nMarkIdx] != NULL)
|
{
|
cvReleaseImage(&m_pTopMarkImage[nMarkIdx]);
|
m_pTopMarkImage[nMarkIdx] = NULL;
|
}
|
|
sprintf_s(str_filename, "%s\\%s\\Side_%d_TopAlign_%d.bmp", W2A(RECIPE_ALIGN_PATH),W2A(m_pDlgRecipe->GetRecipeName()), (int) m_eSelectSide, nMarkIdx);
|
m_pTopMarkImage[nMarkIdx] = cvLoadImage(str_filename, CV_LOAD_IMAGE_GRAYSCALE);
|
|
if(m_pBotMarkImage[nMarkIdx] != NULL)
|
{
|
cvReleaseImage(&m_pBotMarkImage[nMarkIdx]);
|
m_pBotMarkImage[nMarkIdx] = NULL;
|
}
|
|
sprintf_s(str_filename, "%s\\%s\\Side_%d_BotAlign_%d.bmp", W2A(RECIPE_ALIGN_PATH),W2A(m_pDlgRecipe->GetRecipeName()), (int) m_eSelectSide, nMarkIdx);
|
m_pBotMarkImage[nMarkIdx] = cvLoadImage(str_filename, CV_LOAD_IMAGE_GRAYSCALE);
|
}
|
|
DrawMarkImage();
|
}
|
|
void CViewMain_Recipe::DrawMarkImage()
|
{
|
CRect rc;
|
CDC *pStaticDC;
|
|
CWnd* pTopMarkImageWnd[MAX_MARKER_COUNT];
|
pTopMarkImageWnd[0] = GetDlgItem(IDC_STATIC_TOP_MARK_0);
|
pTopMarkImageWnd[1] = GetDlgItem(IDC_STATIC_TOP_MARK_1);
|
pTopMarkImageWnd[2] = GetDlgItem(IDC_STATIC_TOP_MARK_2);
|
|
CWnd* pBotMarkImageWnd[MAX_MARKER_COUNT];
|
pBotMarkImageWnd[0] = GetDlgItem(IDC_STATIC_BOT_MARK_0);
|
pBotMarkImageWnd[1] = GetDlgItem(IDC_STATIC_BOT_MARK_1);
|
pBotMarkImageWnd[2] = GetDlgItem(IDC_STATIC_BOT_MARK_2);
|
|
CPen pen(PS_SOLID, 1, RGB(255,0,0)), *pOldPen;
|
|
for(int i = 0; i < MAX_MARKER_COUNT ; i++)
|
{
|
// Top
|
pTopMarkImageWnd[i]->GetClientRect(&rc);
|
pStaticDC = pTopMarkImageWnd[i]->GetDC();
|
|
if(m_pTopMarkImage[i] != NULL)
|
{
|
m_pBmInfo->bmiHeader.biWidth = m_pTopMarkImage[i]->width;
|
m_pBmInfo->bmiHeader.biHeight = -m_pTopMarkImage[i]->height;
|
m_pBmInfo->bmiHeader.biSizeImage = m_pTopMarkImage[i]->width * m_pTopMarkImage[i]->height;
|
pStaticDC->SetStretchBltMode(COLORONCOLOR);
|
StretchDIBits(pStaticDC->GetSafeHdc(), 0 , 0, rc.Width(),rc.Height(),
|
0,0,m_pTopMarkImage[i]->width,m_pTopMarkImage[i]->height
|
,m_pTopMarkImage[i]->imageData,(BITMAPINFO*)m_pBmInfo,DIB_RGB_COLORS,SRCCOPY);
|
|
pOldPen = pStaticDC->SelectObject(&pen);
|
|
pStaticDC->MoveTo(CPoint(0,rc.Height()/2));
|
pStaticDC->LineTo(CPoint(rc.Width(),rc.Height()/2));
|
pStaticDC->MoveTo(CPoint(rc.Width()/2,0));
|
pStaticDC->LineTo(CPoint(rc.Width()/2,rc.Height()));
|
|
pStaticDC->SelectObject(&pOldPen);
|
pTopMarkImageWnd[i]->Invalidate(TRUE);
|
pTopMarkImageWnd[i]->ReleaseDC(pStaticDC);
|
}
|
else
|
{
|
pStaticDC->FillRect(rc,&CBrush(RGB(0,0,0)));
|
}
|
|
// Bottom
|
pBotMarkImageWnd[i]->GetClientRect(&rc);
|
pStaticDC = pBotMarkImageWnd[i]->GetDC();
|
|
if(m_pBotMarkImage[i] != NULL)
|
{
|
m_pBmInfo->bmiHeader.biWidth = m_pBotMarkImage[i]->width;
|
m_pBmInfo->bmiHeader.biHeight = -m_pBotMarkImage[i]->height;
|
m_pBmInfo->bmiHeader.biSizeImage = m_pBotMarkImage[i]->width * m_pBotMarkImage[i]->height;
|
pStaticDC->SetStretchBltMode(COLORONCOLOR);
|
StretchDIBits(pStaticDC->GetSafeHdc(), 0 , 0, rc.Width(),rc.Height(),
|
0,0,m_pBotMarkImage[i]->width,m_pBotMarkImage[i]->height
|
,m_pBotMarkImage[i]->imageData,(BITMAPINFO*)m_pBmInfo,DIB_RGB_COLORS,SRCCOPY);
|
|
|
pOldPen = pStaticDC->SelectObject(&pen);
|
|
pStaticDC->MoveTo(CPoint(0,rc.Height()/2));
|
pStaticDC->LineTo(CPoint(rc.Width(),rc.Height()/2));
|
pStaticDC->MoveTo(CPoint(rc.Width()/2,0));
|
pStaticDC->LineTo(CPoint(rc.Width()/2,rc.Height()));
|
|
pStaticDC->SelectObject(&pOldPen);
|
pBotMarkImageWnd[i]->Invalidate();
|
pBotMarkImageWnd[i]->ReleaseDC(pStaticDC);
|
}
|
else
|
{
|
pStaticDC->FillRect(rc,&CBrush(RGB(0,0,0)));
|
}
|
}
|
}
|
|
void CViewMain_Recipe::ClickButtonOpenDimensionSettingView()
|
{
|
if(m_pViewSideDimensionSetting == NULL)
|
return;
|
|
m_pViewSideDimensionSetting->SetGlassData(m_pGlassData);
|
m_pViewSideDimensionSetting->ShowWindow(SW_SHOW);
|
}
|
|
|
void CViewMain_Recipe::ClickButtonOpenNotchSettingView()
|
{
|
if(m_pViewSideNotchSetting == NULL)
|
return;
|
|
m_pViewSideNotchSetting->SetGlassData(m_pGlassData);
|
m_pViewSideNotchSetting->ShowWindow(SW_SHOW);
|
}
|
|
void CViewMain_Recipe::OnPaint()
|
{
|
CPaintDC dc(this);
|
|
DrawMarkImage(); // 恐 捞芭 秦拎具父 贸澜俊 付农 捞固瘤啊 弊妨龙鳖..
|
}
|
|
void CViewMain_Recipe::ClickButtonOpenExceptionSettingView()
|
{
|
if(m_pViewSideExceptionSetting == NULL)
|
return;
|
|
m_pViewSideExceptionSetting->SetGlassData(m_pGlassData);
|
m_pViewSideExceptionSetting->SetRecipeImageViewer(&m_frameImg);
|
m_pViewSideExceptionSetting->ShowWindow(SW_SHOW);
|
}
|
|
void CViewMain_Recipe::ClickButtonOpenUserDefectSettingView()
|
{
|
if(m_pViewSideUserDefectSetting == NULL)
|
return;
|
|
m_pViewSideUserDefectSetting->SetGlassData(m_pGlassData);
|
m_pViewSideUserDefectSetting->SetRecipeImageViewer(&m_frameImg);
|
m_pViewSideUserDefectSetting->ShowWindow(SW_SHOW);
|
}
|
|
void CViewMain_Recipe::ClickButtonVisionSetting()
|
{
|
// TODO: 在此处添加消息处理程序代码
|
#if HALCON_VISION_KEY
|
IVisionRecipe* pInstance = BlVision_GetVisionRecipe();
|
if (!pInstance->getVisionUse()) {
|
BlVision_GetSoftVisionApp()->OpenKeySetWindow();
|
return;
|
}
|
|
ISoftVisionApp* pApp = BlVision_GetSoftVisionApp();
|
if (NULL == m_pVisionSetDlg) {
|
m_pVisionSetDlg = pApp->CreateVisionWindow();
|
}
|
|
m_pVisionSetDlg->ShowWindow(SW_SHOW);
|
int nDir = (DimensionDir)(m_eSelectSide);
|
pApp->SetVisionOpen(TRUE);
|
pApp->ChangeDimension(m_pVisionSetDlg, nDir);
|
#endif // HALCON_VISION_KEY
|
}
|