// DlgGlassType.cpp : ±¸Çö ÆÄÀÏÀÔ´Ï´Ù.
|
//
|
|
#include "stdafx.h"
|
#include "ReviewSystemSetting.h"
|
#include "DlgGlassType.h"
|
#include "ReviewSystemSettingDlg.h"
|
#include "CHReviewSetting/Sys_MotorManager.h"
|
#include "CHReviewSetting/Sys_GlassTypeManager.h"
|
#include "CHReviewSetting/Sys_SystemManager.h"
|
#include "CHReviewSetting/Sys_AlignManager.h"
|
#include "CHCommonControls/GridCellCheck.h"
|
#include "CHCommonControls/GridCellCombo.h"
|
#include "DlgAlignPositionInfo.h"
|
#include "CHReviewSetting/SystemInfo.h"
|
|
// CDlgGlassType ´ëÈ »óÀÚÀÔ´Ï´Ù.
|
|
IMPLEMENT_DYNAMIC(CDlgGlassType, CDialog)
|
|
CDlgGlassType::CDlgGlassType(CWnd* pParent /*=NULL*/)
|
: CDialog(CDlgGlassType::IDD, pParent)
|
// , m_nGlassSizeX(0)
|
// , m_nGlassSizeY(0)
|
, m_nGlassTypeCount(0)
|
, m_strStandardCameraMotorPosX(_T(""))
|
, m_strStandardCameraMotorPosY(_T(""))
|
{
|
m_nSelectGlassTypeIdx = -1;
|
}
|
|
CDlgGlassType::~CDlgGlassType()
|
{
|
}
|
|
void CDlgGlassType::DoDataExchange(CDataExchange* pDX)
|
{
|
CDialog::DoDataExchange(pDX);
|
// DDX_Text(pDX, IDC_EDIT_SYS_GLASS_TYPE_SIZE_X, m_nGlassSizeX);
|
// DDX_Text(pDX, IDC_EDIT_SYS_GLASS_TYPE_SIZE_Y, m_nGlassSizeY);
|
DDX_Text(pDX, IDC_EDIT_SYS_GLASS_TYPE_COUNT, m_nGlassTypeCount);
|
DDX_Control(pDX, IDC_GRID_GLASS_TYPE_INFO, m_ctrlGridGlassTypeInfo);
|
DDX_Text(pDX, IDC_EDIT_SYS_GLASS_TYPE_STD_CAMERA_MOTOR_X, m_strStandardCameraMotorPosX);
|
DDX_Text(pDX, IDC_EDIT_SYS_GLASS_TYPE_STD_CAMERA_MOTOR_Y, m_strStandardCameraMotorPosY);
|
}
|
|
|
BEGIN_MESSAGE_MAP(CDlgGlassType, CDialog)
|
ON_BN_CLICKED(IDC_BUTTON_SYS_GLASS_TYPE_RESET, &CDlgGlassType::OnBnClickedButtonSysGlassTypeReset)
|
ON_BN_CLICKED(IDC_BUTTON_SYS_GLASS_TYPE_APPLY, &CDlgGlassType::OnBnClickedButtonSysGlassTypeApply)
|
ON_EN_CHANGE(IDC_EDIT_SYS_GLASS_TYPE_COUNT, &CDlgGlassType::OnEnChangeEditSysGlassTypeCount)
|
ON_WM_COPYDATA()
|
ON_WM_TIMER()
|
ON_BN_CLICKED(IDC_BUTTON_SYS_GLASS_TYPE_INSERT_FISRT_ALIGN_MOTOR_POS, &CDlgGlassType::OnBnClickedButtonSysGlassTypeInsertFisrtAlignMotorPos)
|
ON_BN_CLICKED(IDC_BUTTON_SYS_GLASS_TYPE_SECOND_ALIGN_MOTOR_POS_SET, &CDlgGlassType::OnBnClickedButtonSysGlassTypeSecondAlignMotorPosSet)
|
ON_BN_CLICKED(IDC_BUTTON_SYS_GLASS_TYPE_FIND_ALIGN_MARK, &CDlgGlassType::OnBnClickedButtonSysGlassTypeFindAlignMark)
|
ON_BN_CLICKED(IDC_BUTTON_SYS_GLASS_TYPE_CALCULATE_TILT, &CDlgGlassType::OnBnClickedButtonSysGlassTypeCalculateTilt)
|
ON_NOTIFY(NM_CLICK, IDC_GRID_GLASS_TYPE_INFO, &CDlgGlassType::OnGridClick)
|
END_MESSAGE_MAP()
|
|
|
// CDlgGlassType ¸Þ½ÃÁö 󸮱âÀÔ´Ï´Ù.
|
|
BOOL CDlgGlassType::OnInitDialog()
|
{
|
CDialog::OnInitDialog();
|
|
// mch 20140923
|
// CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
//
|
// if(pDlg)
|
// {
|
// CSys_GlassTypeManager* pGlassTypeManager = NULL;
|
// pGlassTypeManager = pDlg->GetGlassTypeManager();
|
// if(pGlassTypeManager)
|
// {
|
// m_nGlassSizeX = pGlassTypeManager->m_nGlassSizeX;
|
// m_nGlassSizeY = pGlassTypeManager->m_nGlassSizeY;
|
// }
|
// }
|
|
InitGlassTypeInfoGridControl();
|
FillGlassTypeInfo();
|
SetTimer(100, 500, NULL);
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
// ¿¹¿Ü: OCX ¼Ó¼º ÆäÀÌÁö´Â FALSE¸¦ ¹ÝÈ¯ÇØ¾ß ÇÕ´Ï´Ù.
|
}
|
|
BOOL CDlgGlassType::PreTranslateMessage(MSG* pMsg)
|
{
|
// TODO: ¿©±â¿¡ Ư¼öÈµÈ Äڵ带 Ãß°¡ ¹×/¶Ç´Â ±âº» Ŭ·¡½º¸¦ È£ÃâÇÕ´Ï´Ù.
|
if( pMsg->message == WM_KEYDOWN )
|
{
|
if(pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE )
|
{
|
::TranslateMessage(pMsg);
|
::DispatchMessage(pMsg);
|
return TRUE;
|
}
|
}
|
|
return CDialog::PreTranslateMessage(pMsg);
|
}
|
|
void CDlgGlassType::OnBnClickedButtonSysGlassTypeReset()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
// m_nGlassSizeX = 0;
|
// m_nGlassSizeY = 0;
|
m_nGlassTypeCount = 0;
|
UpdateData(FALSE);
|
OnEnChangeEditSysGlassTypeCount();
|
}
|
|
void CDlgGlassType::OnBnClickedButtonSysGlassTypeApply()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
UpdateData(TRUE);
|
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
if (pDlg==NULL) return;
|
|
CSys_GlassTypeManager* pGlassTypeManager = pDlg->GetGlassTypeManager();
|
if (pGlassTypeManager==NULL) return;
|
|
int i, j, nArrayCount, nRowIdx, nColIdx;
|
CString strItemText, strTemp;
|
|
|
pGlassTypeManager->SetGlassTypeInfoCount(m_nGlassTypeCount);
|
|
CGlassTypeInfo glassTypeInfo;
|
CGridCellCheck* pCellCheck = NULL;
|
CGridCellCombo* pCellCombo = NULL;
|
CStringArray strArrayOption;
|
|
nColIdx = 1;
|
|
for(i = 0; i < m_nGlassTypeCount; i++)
|
{
|
nRowIdx = 1;
|
|
CGlassTypeInfo *pGlassTypeInfo = pGlassTypeManager->GetGlassTypeInfo(i);
|
if (pGlassTypeInfo==NULL) continue;
|
|
//1. ±âÁØ Ä«¸Þ¶ó
|
pCellCheck = (CGridCellCheck*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCheck)
|
{
|
pGlassTypeInfo->m_bStandardGlassType = pCellCheck->GetCheck();
|
}
|
|
//2. ±Û¶ó½º ŸÀÔ¸í
|
nRowIdx++;
|
CString t = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_strGlassTypeName = t;//m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
|
//3. ±Û¶ó½º »çÀÌÁî X
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_nGlassSizeX = _ttoi(strItemText);
|
|
//4. ±Û¶ó½º »çÀÌÁî Y
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_nGlassSizeY = _ttoi(strItemText);
|
|
//5. Áß¾ÓÁÂÇ¥ ¿©ºÎ
|
nRowIdx++;
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
strItemText = pCellCombo->GetText();
|
pCellCombo->GetOptions(strArrayOption);
|
nArrayCount = (int)strArrayOption.GetCount();
|
|
for(j = 0; j < nArrayCount; j++)
|
{
|
strTemp = strArrayOption.GetAt(j);
|
if(strTemp.Compare(strItemText) == 0)
|
{
|
pGlassTypeInfo->m_bUseCenterCoodinateSystem = j;
|
break;
|
}
|
}
|
}
|
|
//6. ÁÂÇ¥°è ¹ÝÀü ¿©ºÎ
|
nRowIdx++;
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
strItemText = pCellCombo->GetText();
|
pCellCombo->GetOptions(strArrayOption);
|
nArrayCount = (int)strArrayOption.GetCount();
|
|
for(j = 0; j < nArrayCount; j++)
|
{
|
strTemp = strArrayOption.GetAt(j);
|
if(strTemp.Compare(strItemText) == 0)
|
{
|
pGlassTypeInfo->m_bUseInverseCoordinate = j;
|
break;
|
}
|
}
|
}
|
|
//7. ÄÚ³ÊÄÆ ¹æÇâ
|
nRowIdx++;
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
strItemText = pCellCombo->GetText();
|
pCellCombo->GetOptions(strArrayOption);
|
nArrayCount = (int)strArrayOption.GetCount();
|
|
for(j = 0; j < nArrayCount; j++)
|
{
|
strTemp = strArrayOption.GetAt(j);
|
if(strTemp.Compare(strItemText) == 0)
|
{
|
pGlassTypeInfo->m_nCornerCutDirection = j;
|
break;
|
}
|
}
|
}
|
|
//8. ¿øÁ¡ ¹æÇâ
|
nRowIdx++;
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
strItemText = pCellCombo->GetText();
|
pCellCombo->GetOptions(strArrayOption);
|
nArrayCount = (int)strArrayOption.GetCount();
|
|
for(j = 0; j < nArrayCount; j++)
|
{
|
strTemp = strArrayOption.GetAt(j);
|
if(strTemp.Compare(strItemText) == 0)
|
{
|
pGlassTypeInfo->m_nOriginDirection = j;
|
break;
|
}
|
}
|
}
|
|
//9. ù¹øÂ° ¾ó¶óÀÎ ±Û¶ó½º ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dFirstAlignGlassX = _tcstod(strItemText, NULL);
|
|
//10. ù¹øÂ° ¾ó¶óÀÎ ±Û¶ó½º ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dFirstAlignGlassY = _tcstod(strItemText, NULL);
|
|
//11. µÎ¹øÂ° ¾ó¶óÀÎ ±Û¶ó½º ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dSecondAlignGlassX = _tcstod(strItemText, NULL);
|
|
//12. µÎ¹øÂ° ¾ó¶óÀÎ ±Û¶ó½º ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dSecondAlignGlassY = _tcstod(strItemText, NULL);
|
|
//13. ù¹øÂ° ¾ó¶óÀÎ ¸ðÅÍ ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dFirstAlignMotorX = _tcstod(strItemText, NULL);
|
|
//14. ù¹øÂ° ¾ó¶óÀÎ ¸ðÅÍ ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dFirstAlignMotorY = _tcstod(strItemText, NULL);
|
|
//15. µÎ¹øÂ° ¾ó¶óÀÎ ¸ðÅÍ ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dSecondAlignMotorX = _tcstod(strItemText, NULL);
|
|
//16. µÎ¹øÂ° ¾ó¶óÀÎ ¸ðÅÍ ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dSecondAlignMotorY = _tcstod(strItemText, NULL);
|
|
//17. ù¹øÂ° ¾ó¶óÀÎ Çȼ¿ ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_nFirstAlignFindPixelX = _ttoi(strItemText);
|
|
//18. ù¹øÂ° ¾ó¶óÀÎ Çȼ¿ ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_nFirstAlignFindPixelY = _ttoi(strItemText);
|
|
//19. µÎ¹øÂ° ¾ó¶óÀÎ Çȼ¿ ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_nSecondAlignFindPixelX = _ttoi(strItemText);
|
|
//20. µÎ¹øÂ° ¾ó¶óÀÎ Çȼ¿ ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_nSecondAlignFindPixelY = _ttoi(strItemText);
|
|
//21. ¾ó¶óÀÎ Ä«¸Þ¶ó ¾ó¶óÀÎ ¸ðÅÍ À§Ä¡
|
nRowIdx++;
|
|
pCellCheck = (CGridCellCheck*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCheck)
|
{
|
pGlassTypeInfo->m_nUseAlignPosMove = pCellCheck->GetCheck();
|
}
|
//strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
// pGlassTypeInfo->m_dAlignCameraMotorX = _tcstod(strItemText, NULL);
|
|
//22. ÅÛÇø´ À̹ÌÁö °æ·Î #1
|
nRowIdx++;
|
pGlassTypeInfo->m_vecTemplateImagePath.clear();
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
if(strItemText.IsEmpty() == FALSE)
|
{
|
pGlassTypeInfo->m_vecTemplateImagePath.push_back(strItemText);
|
}
|
|
//23. ÅÛÇø´ À̹ÌÁö °æ·Î #2
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
if(strItemText.IsEmpty() == FALSE)
|
{
|
pGlassTypeInfo->m_vecTemplateImagePath.push_back(strItemText);
|
}
|
|
//24. ¿øÁ¡ ¸ðÅÍ ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dOriginMotorX = _tcstod(strItemText, NULL);
|
|
//25. ¿øÁ¡ ¸ðÅÍ ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dOriginMotorY = _tcstod(strItemText, NULL);
|
|
//26. ȸÀü·®
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dAlignAngle = _tcstod(strItemText, NULL);
|
|
//27. ¸ÅĪ·ü
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dMatchingThreshold = _tcstod(strItemText, NULL);
|
|
//28. OFFSET X cmark
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dMotorOffsetX = _tcstod(strItemText, NULL);
|
|
//29. OFFSET Y
|
nRowIdx++;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
pGlassTypeInfo->m_dMotorOffsetY = _tcstod(strItemText, NULL);
|
|
nColIdx++;
|
}
|
|
}
|
|
void CDlgGlassType::OnEnChangeEditSysGlassTypeCount()
|
{
|
// TODO: RICHEDIT ÄÁÆ®·ÑÀÎ °æ¿ì, ÀÌ ÄÁÆ®·ÑÀº
|
// CDialog::OnInitDialog() ÇÔ¼ö¸¦ ÀçÁöÁ¤
|
//ÇÏ°í ¸¶½ºÅ©¿¡ OR ¿¬»êÇÏ¿© ¼³Á¤µÈ ENM_CHANGE Ç÷¡±×¸¦ ÁöÁ¤ÇÏ¿© CRichEditCtrl().SetEventMask()¸¦ È£ÃâÇÏÁö ¾ÊÀ¸¸é
|
// ÀÌ ¾Ë¸² ¸Þ½ÃÁö¸¦ º¸³»Áö ¾Ê½À´Ï´Ù.
|
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
UpdateData(TRUE);
|
|
int i, j, nRowIdx, nColIdx;
|
int nWidth, nMargin, nDataColumnWidth;
|
CString strTemp;
|
CRect rect;
|
m_ctrlGridGlassTypeInfo.GetWindowRect(&rect);
|
m_ctrlGridGlassTypeInfo.SetColumnCount(m_nGlassTypeCount + 1);
|
nWidth = m_ctrlGridGlassTypeInfo.GetColumnWidth(0);
|
|
nMargin = 20;
|
nDataColumnWidth = rect.Width() - nWidth - nMargin;
|
|
if(m_nGlassTypeCount > 0)
|
{
|
GV_ITEM Item;
|
CStringArray strArrayOption;
|
CGridCellCombo* pCellCombo = NULL;
|
nColIdx = 1;
|
nDataColumnWidth = nDataColumnWidth / m_nGlassTypeCount;
|
|
for(i = 0; i < m_nGlassTypeCount; i++)
|
{
|
m_ctrlGridGlassTypeInfo.SetColumnWidth(i + 1, nDataColumnWidth);
|
|
//±Û¶ó½º ŸÀÔ À妽º
|
nRowIdx = 0;
|
Item.mask = GVIF_TEXT;
|
Item.row = nRowIdx;
|
Item.col = nColIdx;
|
strTemp.Format(_T("%02d"), i);
|
Item.strText = strTemp;
|
m_ctrlGridGlassTypeInfo.SetItem(&Item);
|
|
//±âÁØ ±Û¶ó½º ŸÀÔ
|
nRowIdx++;
|
Item.strText = _T("");
|
m_ctrlGridGlassTypeInfo.SetCellType(nRowIdx, nColIdx, RUNTIME_CLASS(CGridCellCheck));
|
m_ctrlGridGlassTypeInfo.SetItemState(nRowIdx, nColIdx, m_ctrlGridGlassTypeInfo.GetItemState(nRowIdx, nColIdx) | GVIS_READONLY);
|
|
/* nRowIdx = 5;
|
Item.strText = _T("");
|
m_ctrlGridGlassTypeInfo.SetCellType(nRowIdx, nColIdx, RUNTIME_CLASS(CGridCellCheck));
|
m_ctrlGridGlassTypeInfo.SetItemState(nRowIdx, nColIdx, m_ctrlGridGlassTypeInfo.GetItemState(nRowIdx, nColIdx) | GVIS_READONLY);
|
|
CGridCellCheck* pCellCheck = (CGridCellCheck*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(!pCellCheck->GetCheck())
|
{
|
m_ctrlGridGlassTypeInfo.GetCell(nRowIdx+1, nColIdx)->SetState(GVIS_READONLY);
|
}*/
|
|
nRowIdx = 21;
|
Item.strText = _T("");
|
m_ctrlGridGlassTypeInfo.SetCellType(nRowIdx, nColIdx, RUNTIME_CLASS(CGridCellCheck));
|
m_ctrlGridGlassTypeInfo.SetItemState(nRowIdx, nColIdx, m_ctrlGridGlassTypeInfo.GetItemState(nRowIdx, nColIdx) | GVIS_READONLY);
|
|
//Áß¾ÓÁÂÇ¥°è
|
nRowIdx = 5;
|
strArrayOption.RemoveAll();
|
strArrayOption.Add(_T("FALSE"));
|
strArrayOption.Add(_T("TRUE"));
|
m_ctrlGridGlassTypeInfo.SetCellType(nRowIdx, nColIdx, RUNTIME_CLASS(CGridCellCombo));
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
pCellCombo->SetOptions(strArrayOption);
|
pCellCombo->SetStyle(CBS_DROPDOWN);
|
|
//ÁÂÇ¥¹ÝÀü
|
nRowIdx = 6;
|
strArrayOption.RemoveAll();
|
strArrayOption.Add(_T("FALSE"));
|
strArrayOption.Add(_T("TRUE"));
|
m_ctrlGridGlassTypeInfo.SetCellType(nRowIdx, nColIdx, RUNTIME_CLASS(CGridCellCombo));
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
pCellCombo->SetOptions(strArrayOption);
|
pCellCombo->SetStyle(CBS_DROPDOWN);
|
|
//ÄÚ³ÊÄÆ ¹æÇâ
|
nRowIdx = 7;
|
strArrayOption.RemoveAll();
|
for(j = 0; j < GLASS_CORNERCUT_DIRECTION_COUNT; j++)
|
{
|
switch(j)
|
{
|
case GLASS_CORNERCUT_LEFT_TOP:
|
strTemp.Format(_T("Left Top"));//_T("Á»ó"));
|
break;
|
case GLASS_CORNERCUT_RIGHT_TOP:
|
strTemp.Format(_T("Right Top"));//_T("¿ì»ó"));
|
break;
|
case GLASS_CORNERCUT_LEFT_BOTTOM:
|
strTemp.Format(_T("Left Bottom"));//_T("ÁÂÇÏ"));
|
break;
|
case GLASS_CORNERCUT_RIGHT_BOTTOM:
|
strTemp.Format(_T("Right Bottom"));//_T("¿ìÇÏ"));
|
break;
|
default:
|
strTemp.Format(_T(""));
|
break;
|
}
|
|
strArrayOption.Add(strTemp);
|
}
|
m_ctrlGridGlassTypeInfo.SetCellType(nRowIdx, nColIdx, RUNTIME_CLASS(CGridCellCombo));
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
pCellCombo->SetOptions(strArrayOption);
|
pCellCombo->SetStyle(CBS_DROPDOWN);
|
|
|
//¿øÁ¡¹æÇâ
|
nRowIdx++;
|
strArrayOption.RemoveAll();
|
for(j = 0; j < GlassOriginDir_Count; j++)
|
{
|
switch(j)
|
{
|
case GlassOriginDir_LeftTop:
|
strTemp.Format(_T("Left Top"));//_T("Á»ó"));
|
break;
|
case GlassOriginDir_RightTop:
|
strTemp.Format(_T("Right Top"));//_T("¿ì»ó"));
|
break;
|
case GlassOriginDir_LeftBottom:
|
strTemp.Format(_T("Left Bottom"));//_T("ÁÂÇÏ"));
|
break;
|
case GlassOriginDir_RightBottom:
|
strTemp.Format(_T("Right Bottom"));//_T("¿ìÇÏ"));
|
break;
|
default:
|
strTemp.Format(_T(""));
|
break;
|
}
|
|
strArrayOption.Add(strTemp);
|
}
|
m_ctrlGridGlassTypeInfo.SetCellType(nRowIdx, nColIdx, RUNTIME_CLASS(CGridCellCombo));
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
pCellCombo->SetOptions(strArrayOption);
|
pCellCombo->SetStyle(CBS_DROPDOWN);
|
|
nColIdx++;
|
}
|
}
|
}
|
|
void CDlgGlassType::InitGlassTypeInfoGridControl()
|
{
|
int nRowIdx, nColIdx, nRows, nCols, nFixRows, nFixCols;
|
CString strTemp;
|
|
nRows = GLASS_TYPE_INFO_GRID_ROW_COUNT;
|
nCols = m_nGlassTypeCount + 1;
|
nFixRows = 1;
|
nFixCols = 1;
|
nRowIdx = 0;
|
nColIdx = 0;
|
|
m_ctrlGridGlassTypeInfo.GetDefaultCell(FALSE, FALSE)->SetBackClr(RGB(0xFF, 0xFF, 0xE0));
|
m_ctrlGridGlassTypeInfo.SetRowCount(nRows);
|
m_ctrlGridGlassTypeInfo.SetColumnCount(nCols);
|
m_ctrlGridGlassTypeInfo.SetFixedRowCount(nFixRows);
|
m_ctrlGridGlassTypeInfo.SetFixedColumnCount(nFixCols);
|
|
|
CRect rect;
|
m_ctrlGridGlassTypeInfo.GetWindowRect(&rect);
|
m_ctrlGridGlassTypeInfo.SetColumnCount(m_nGlassTypeCount + 1);
|
int nWidth = m_ctrlGridGlassTypeInfo.GetColumnWidth(0);
|
int nMargin = 5;
|
int nDataColumnWidth = rect.Width() - nWidth - nMargin;
|
|
if(m_nGlassTypeCount > 0)
|
{
|
nColIdx = 1;
|
nDataColumnWidth = nDataColumnWidth / m_nGlassTypeCount;
|
for(int i = 0; i < m_nGlassTypeCount; i++)
|
{
|
m_ctrlGridGlassTypeInfo.SetColumnWidth(i + 1, nDataColumnWidth);
|
}
|
}
|
|
GV_ITEM Item;
|
Item.mask = GVIF_TEXT;
|
Item.col = nColIdx;
|
|
for (int nRowIdx=0; nRowIdx<nRows; nRowIdx++)
|
{
|
// m_ctrlGridGlassTypeInfo.SetRowHeight(nRowIdx, 22);
|
|
Item.row = nRowIdx;
|
|
switch(nRowIdx)
|
{
|
case 0:
|
strTemp.Format(_T("Index"));//_T("À妽º"));
|
break;
|
case 1:
|
strTemp.Format(_T("Standard Glass Type"));//_T("±âÁØ ±Û¶ó½º ŸÀÔ"));
|
break;
|
case 2:
|
strTemp.Format(_T("Glass Type Name"));//_T("±Û¶ó½º ŸÀÔ¸í"));
|
break;
|
case 3:
|
strTemp.Format(_T("Glass With (mm)"));//_T("±Û¶ó½º Å©±â X(mm)"));
|
break;
|
case 4:
|
strTemp.Format(_T("Glass Height (mm)"));//_T("±Û¶ó½º Å©±â Y(mm)"));
|
break;
|
case 5:
|
strTemp.Format(_T("Center Coordinate"));//_T("Áß¾ÓÁÂÇ¥°è ¿©ºÎ"));
|
break;
|
case 6:
|
strTemp.Format(_T("Reverse Coordinate"));//_T("ÁÂÇ¥°è ¹ÝÀü ¿©ºÎ"));
|
break;
|
case 7:
|
strTemp.Format(_T("CornerCut Direction"));//_T("ÄÚ³ÊÄÆ ¹æÇâ"));
|
break;
|
case 8:
|
strTemp.Format(_T("Origin Direction"));//_T("¿øÁ¡ ¹æÇâ"));
|
break;
|
case 9:
|
strTemp.Format(_T("1st Align Glass Pos_X (mm)"));//_T("±âÁؾó¶óÀÎ ±Û¶ó½ºÁÂÇ¥ X(mm)"));
|
break;
|
case 10:
|
strTemp.Format(_T("1st Align Glass Pos_Y (mm)"));//_T("±âÁؾó¶óÀÎ ±Û¶ó½ºÁÂÇ¥ Y(mm)"));
|
break;
|
case 11:
|
strTemp.Format(_T("2nd Align Glass Pos_X (mm)"));//_T("º¸Á¶¾ó¶óÀÎ ±Û¶ó½ºÁÂÇ¥ X(mm)"));
|
break;
|
case 12:
|
strTemp.Format(_T("2nd Align Glass Pos_Y (mm)"));//_T("º¸Á¶¾ó¶óÀÎ ±Û¶ó½ºÁÂÇ¥ Y(mm)"));
|
break;
|
case 13:
|
strTemp.Format(_T("1st Align Motor Pos_X (mm)"));//_T("±âÁؾó¶óÀÎ ¸ðÅÍÁÂÇ¥ X(mm)"));
|
break;
|
case 14:
|
strTemp.Format(_T("1st Align Motor Pos_Y (mm)"));//_T("±âÁؾó¶óÀÎ ¸ðÅÍÁÂÇ¥ Y(mm)"));
|
break;
|
case 15:
|
strTemp.Format(_T("2nd Align Motor Pos_X (mm)"));//_T("º¸Á¶¾ó¶óÀÎ ¸ðÅÍÁÂÇ¥ X(mm)"));
|
break;
|
case 16:
|
strTemp.Format(_T("2nd Align Motor Pos_Y (mm)"));//_T("º¸Á¶¾ó¶óÀÎ ¸ðÅÍÁÂÇ¥ Y(mm)"));
|
break;
|
case 17:
|
strTemp.Format(_T("1st Align Pixel Pos_X (Pxl)"));//_T("±âÁؾó¶óÀÎ Çȼ¿ÁÂÇ¥ X(Pixel)"));
|
break;
|
case 18:
|
strTemp.Format(_T("1st Align Pixel Pos_Y (Pxl)"));//_T("±âÁؾó¶óÀÎ Çȼ¿ÁÂÇ¥ Y(Pixel)"));
|
break;
|
case 19:
|
strTemp.Format(_T("2nd Align Pixel Pos_X (Pxl)"));//_T("º¸Á¶¾ó¶óÀÎ Çȼ¿ÁÂÇ¥ X(Pixel)"));
|
break;
|
case 20:
|
strTemp.Format(_T("2nd Align Pixel Pos_Y (Pxl)"));//_T("º¸Á¶¾ó¶óÀÎ Çȼ¿ÁÂÇ¥ Y(Pixel)"));
|
break;
|
case 21:
|
//strTemp.Format(_T("¾ó¶óÀÎ ÃøÁ¤ ¸ðÅÍÀ§Ä¡(mm)"));
|
strTemp.Format(_T("Align Measurement"));//_T("¾ó¶óÀÎ ÃøÁ¤ ¿©ºÎ"));
|
break;
|
case 22:
|
strTemp.Format(_T("1st Template Image Path"));//_T("ÅÛÇø´ À̹ÌÁö °æ·Î #1"));
|
break;
|
case 23:
|
strTemp.Format(_T("2nd Template Image Path"));//_T("ÅÛÇø´ À̹ÌÁö °æ·Î #2"));
|
break;
|
case 24:
|
strTemp.Format(_T("Origin Pos_X (mm)"));//_T("¿øÁ¡ ¸ðÅÍÁÂÇ¥ X(mm)"));
|
break;
|
case 25:
|
strTemp.Format(_T("Origin Pos_Y (mm)"));//_T("¿øÁ¡ ¸ðÅÍÁÂÇ¥ Y(mm)"));
|
break;
|
case 26:
|
strTemp.Format(_T("Origin Angle (deg)"));//_T("ȸÀü·®(degree)"));
|
break;
|
case 27:
|
strTemp.Format(_T("Matching Rate (0~1.0)"));//_T("¸ÅĪ·ü(0.0~1.0)"));
|
break;
|
|
//cmark
|
case 28:
|
strTemp.Format(_T("Offset X"));//_T("MOTOR OFFSET)"));
|
break;
|
case 29:
|
strTemp.Format(_T("Offset Y"));//_T("MOTOR OFFSET)"));
|
break;
|
}
|
|
Item.strText = strTemp;
|
m_ctrlGridGlassTypeInfo.SetItem(&Item);
|
}
|
|
m_ctrlGridGlassTypeInfo.AutoSize();
|
|
}
|
|
void CDlgGlassType::FillGlassTypeInfo()
|
{
|
int i, nRowIdx, nColIdx, nTemplateImageIdx, nGlassTypeCount, nTemplateImageCount;
|
CString strItemText, strTemplateImagePath;
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
if(pDlg == NULL) return;
|
|
CSys_GlassTypeManager* pGlassTypeManager = pDlg->GetGlassTypeManager();
|
if(pGlassTypeManager == NULL) return;
|
|
nGlassTypeCount = pGlassTypeManager->GetGlassTypeInfoCount();
|
|
if(nGlassTypeCount > 0)
|
{
|
CGlassTypeInfo* pGlassTypeInfo = NULL;
|
CGridCellCheck* pCellCheck = NULL;
|
CGridCellCombo* pCellCombo = NULL;
|
CStringArray strArrayOption;
|
|
nColIdx = 1;
|
m_nGlassTypeCount = nGlassTypeCount;
|
|
UpdateData(FALSE);
|
OnEnChangeEditSysGlassTypeCount();
|
|
for(i = 0; i < nGlassTypeCount; i++)
|
{
|
nRowIdx = 1;
|
pGlassTypeInfo = pGlassTypeManager->GetGlassTypeInfo(i);
|
if(pGlassTypeInfo == NULL) continue;
|
|
//1. ±âÁØ ±Û¶ó½º ŸÀÔ
|
pCellCheck = (CGridCellCheck*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCheck)
|
{
|
pCellCheck->SetCheck(pGlassTypeInfo->m_bStandardGlassType);
|
}
|
|
//2. ±Û¶ó½º ŸÀÔ¸í
|
nRowIdx++;
|
strItemText.Format(_T("%s"), pGlassTypeInfo->m_strGlassTypeName);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//3. ±Û¶ó½º Å©±â X mm
|
nRowIdx++;
|
strItemText.Format(_T("%d"), pGlassTypeInfo->m_nGlassSizeX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//4. ±Û¶ó½º Å©±â Y mm
|
nRowIdx++;
|
strItemText.Format(_T("%d"), pGlassTypeInfo->m_nGlassSizeY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//5. Áß¾ÓÁÂÇ¥°è ¿©ºÎ
|
nRowIdx++;
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
pCellCombo->GetOptions(strArrayOption);
|
|
strItemText = strArrayOption.GetAt(pGlassTypeInfo->m_bUseCenterCoodinateSystem);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
}
|
|
//6. ÁÂÇ¥°è ¹ÝÀü ¿©ºÎ
|
nRowIdx++;
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
pCellCombo->GetOptions(strArrayOption);
|
|
strItemText = strArrayOption.GetAt(pGlassTypeInfo->m_bUseInverseCoordinate);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
}
|
|
//7. ÄÚ³ÊÄÆ ¹æÇâ
|
nRowIdx++;
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
pCellCombo->GetOptions(strArrayOption);
|
|
if(strArrayOption.GetSize() > 0 && pGlassTypeInfo->m_nCornerCutDirection > -1)
|
{
|
strItemText = strArrayOption.GetAt(pGlassTypeInfo->m_nCornerCutDirection);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
}
|
}
|
|
//8. ¿øÁ¡ ¹æÇâ
|
nRowIdx++;
|
pCellCombo = (CGridCellCombo*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCombo)
|
{
|
strArrayOption.RemoveAll();
|
pCellCombo->GetOptions(strArrayOption);
|
|
if(strArrayOption.GetSize() > 0 && pGlassTypeInfo->m_nOriginDirection > -1)
|
{
|
strItemText = strArrayOption.GetAt(pGlassTypeInfo->m_nOriginDirection);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
}
|
}
|
|
//9. ù¹øÂ° ¾ó¶óÀÎ ±Û¶ó½º ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dFirstAlignGlassX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//10. ù¹øÂ° ¾ó¶óÀÎ ±Û¶ó½º ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dFirstAlignGlassY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//11. µÎ¹øÂ° ¾ó¶óÀÎ ±Û¶ó½º ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dSecondAlignGlassX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//15. µÎ¹øÂ° ¾ó¶óÀÎ ±Û¶ó½º ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dSecondAlignGlassY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//16. ù¹øÂ° ¾ó¶óÀÎ ¸ðÅÍ ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dFirstAlignMotorX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//14. ù¹øÂ° ¾ó¶óÀÎ ¸ðÅÍ ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dFirstAlignMotorY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//15. µÎ¹øÂ° ¾ó¶óÀÎ ¸ðÅÍ ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dSecondAlignMotorX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//16. µÎ¹øÂ° ¾ó¶óÀÎ ¸ðÅÍ ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dSecondAlignMotorY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//17. ù¹øÂ° ¾ó¶óÀÎ Çȼ¿ ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText.Format(_T("%d"), pGlassTypeInfo->m_nFirstAlignFindPixelX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//18. ù¹øÂ° ¾ó¶óÀÎ Çȼ¿ ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText.Format(_T("%d"), pGlassTypeInfo->m_nFirstAlignFindPixelY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//19. µÎ¹øÂ° ¾ó¶óÀÎ Çȼ¿ ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText.Format(_T("%d"), pGlassTypeInfo->m_nSecondAlignFindPixelX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//20. µÎ¹øÂ° ¾ó¶óÀÎ Çȼ¿ ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText.Format(_T("%d"), pGlassTypeInfo->m_nSecondAlignFindPixelY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//21. ¾ó¶óÀÎ Ä«¸Þ¶ó ¾ó¶óÀÎ ¸ðÅÍ À§Ä¡
|
nRowIdx++;
|
//strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dAlignCameraMotorX);
|
//m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
pCellCheck = (CGridCellCheck*)m_ctrlGridGlassTypeInfo.GetCell(nRowIdx, nColIdx);
|
|
if(pCellCheck)
|
{
|
pCellCheck->SetCheck(pGlassTypeInfo->m_nUseAlignPosMove);
|
}
|
|
//m_ctrlGridGlassTypeInfo.set
|
|
//22. ÅÛÇø´ À̹ÌÁö °æ·Î #1
|
nRowIdx++;
|
nTemplateImageIdx = 0;
|
nTemplateImageCount = (int)pGlassTypeInfo->m_vecTemplateImagePath.size();
|
if(nTemplateImageIdx < nTemplateImageCount)
|
{
|
strTemplateImagePath = pGlassTypeInfo->m_vecTemplateImagePath[nTemplateImageIdx];
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strTemplateImagePath);
|
}
|
else
|
{
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, _T(""));
|
}
|
|
//23. ÅÛÇø´ À̹ÌÁö °æ·Î #2
|
nRowIdx++;
|
nTemplateImageIdx++;
|
if(nTemplateImageIdx < nTemplateImageCount)
|
{
|
strTemplateImagePath = pGlassTypeInfo->m_vecTemplateImagePath[nTemplateImageIdx];
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strTemplateImagePath);
|
}
|
else
|
{
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, _T(""));
|
}
|
|
//24. ¿øÁ¡ ¸ðÅÍ ÁÂÇ¥ X
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dOriginMotorX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//25. ¿øÁ¡ ¸ðÅÍ ÁÂÇ¥ Y
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dOriginMotorY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//26. ȸÀü·®
|
nRowIdx++;
|
strItemText.Format(_T("%.08lf"), pGlassTypeInfo->m_dAlignAngle);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//27. ¸ÅĪ·ü
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dMatchingThreshold);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//28. OFFSET X
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dMotorOffsetX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
//29. OFFSET Y
|
nRowIdx++;
|
strItemText.Format(_T("%.03lf"), pGlassTypeInfo->m_dMotorOffsetY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, strItemText);
|
|
|
nColIdx++;
|
}
|
}
|
|
}
|
|
void CDlgGlassType::OnTimer(UINT_PTR nIDEvent)
|
{
|
// TODO: ¿©±â¿¡ ¸Þ½ÃÁö 󸮱â Äڵ带 Ãß°¡ ¹×/¶Ç´Â ±âº»°ªÀ» È£ÃâÇÕ´Ï´Ù.
|
if (nIDEvent == 100)
|
{
|
static int i = 0;
|
|
if ( (i+1) % 2 == 0 )
|
{
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
|
if(pDlg)
|
{
|
COPYDATA_SYSTEM2REV copyData;
|
copyData.Message = MsgSystem2Rev_StandardCameraMotorPos;
|
pDlg->SendData2ReviewSystem(©Data);
|
}
|
}
|
else
|
{
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
|
if(pDlg)
|
{
|
COPYDATA_SYSTEM2REV* pCopyData = pDlg->GetSystem2ReviewData();
|
m_strStandardCameraMotorPosX.Format(_T("%.04lf"), pCopyData->dStandardCameraMotorPosX);
|
m_strStandardCameraMotorPosY.Format(_T("%.04lf"), pCopyData->dStandardCameraMotorPosY);
|
|
SetDlgItemText(IDC_EDIT_SYS_GLASS_TYPE_STD_CAMERA_MOTOR_X, m_strStandardCameraMotorPosX);
|
SetDlgItemText(IDC_EDIT_SYS_GLASS_TYPE_STD_CAMERA_MOTOR_Y, m_strStandardCameraMotorPosY);
|
}
|
}
|
|
i++;
|
}
|
|
CDialog::OnTimer(nIDEvent);
|
}
|
|
BOOL CDlgGlassType::DestroyWindow()
|
{
|
// TODO: ¿©±â¿¡ Ư¼öÈµÈ Äڵ带 Ãß°¡ ¹×/¶Ç´Â ±âº» Ŭ·¡½º¸¦ È£ÃâÇÕ´Ï´Ù.
|
KillTimer(100);
|
|
return CDialog::DestroyWindow();
|
}
|
|
void CDlgGlassType::OnBnClickedButtonSysGlassTypeInsertFisrtAlignMotorPos()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
int nRowIdx, nColIdx;
|
CString strItemText;
|
|
if(m_nSelectGlassTypeIdx < 0)
|
{
|
AfxMessageBox(_T("Select Glass Type!"));
|
return;
|
}
|
|
nRowIdx = 13;
|
nColIdx = m_nSelectGlassTypeIdx + 1;
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx++, nColIdx, m_strStandardCameraMotorPosX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, m_strStandardCameraMotorPosY);
|
m_ctrlGridGlassTypeInfo.Invalidate(FALSE);
|
}
|
|
void CDlgGlassType::OnBnClickedButtonSysGlassTypeSecondAlignMotorPosSet()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
int nRowIdx, nColIdx;
|
CString strItemText;
|
|
if(m_nSelectGlassTypeIdx < 0)
|
{
|
AfxMessageBox(_T("Select Glass Type"));//_T("±Û¶ó½º ŸÀÔÀ» ¼±ÅÃÇϼ¼¿ä"));
|
return;
|
}
|
|
nRowIdx = 15;
|
nColIdx = m_nSelectGlassTypeIdx + 1;
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx++, nColIdx, m_strStandardCameraMotorPosX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, m_strStandardCameraMotorPosY);
|
m_ctrlGridGlassTypeInfo.Invalidate(FALSE);
|
}
|
|
void CDlgGlassType::OnBnClickedButtonSysGlassTypeFindAlignMark()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
int nRowIdx, nColIdx, nSize;
|
char* strTemp = NULL;
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
|
if(m_nSelectGlassTypeIdx < 0)
|
{
|
AfxMessageBox(_T("Select Glass Type"));//_T("±Û¶ó½º ŸÀÔÀ» ¼±ÅÃÇϼ¼¿ä"));
|
return;
|
}
|
|
nRowIdx = 17;
|
nColIdx = m_nSelectGlassTypeIdx + 1;
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx, nColIdx, m_strStandardCameraMotorPosX);
|
m_ctrlGridGlassTypeInfo.Invalidate(FALSE);
|
|
if(pDlg)
|
{
|
CString strItemText;
|
COPYDATA_SYSTEM2REV copyData;
|
|
copyData.Message = MsgSystem2Rev_FindAlignMark;
|
nRowIdx = 22;
|
nColIdx = m_nSelectGlassTypeIdx + 1;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx++, nColIdx);
|
|
#ifdef _UNICODE
|
nSize = WideCharToMultiByte(CP_ACP, 0, strItemText.GetBuffer(), -1, NULL, 0, NULL,NULL);
|
strTemp = new char[nSize];
|
WideCharToMultiByte(CP_ACP, 0, strItemText.GetBuffer(), -1, strTemp, nSize, NULL, NULL);
|
memcpy(copyData.strTemplateImagePath1, strTemp, sizeof(char)*nSize);
|
#else
|
nSize = strItemText.GetLength();
|
strTemp = new char[nSize+1];
|
memcpy(strTemp, strItemText.GetBuffer(), sizeof(char)*nSize);
|
strTemp[nSize] = NULL;
|
memcpy(copyData.strTemplateImagePath1, strTemp, sizeof(char)*nSize);
|
#endif
|
|
if(strTemp)
|
{
|
delete[] strTemp;
|
strTemp = NULL;
|
}
|
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx, nColIdx);
|
|
#ifdef _UNICODE
|
nSize = WideCharToMultiByte(CP_ACP, 0, strItemText.GetBuffer(), -1, NULL, 0, NULL,NULL);
|
strTemp = new char[nSize];
|
WideCharToMultiByte(CP_ACP, 0, strItemText.GetBuffer(), -1, strTemp, nSize, NULL, NULL);
|
memcpy(copyData.strTemplateImagePath2, strTemp, sizeof(char)*nSize);
|
#else
|
nSize = strItemText.GetLength();
|
strTemp = new char[nSize+1];
|
memcpy(strTemp, strItemText.GetBuffer(), sizeof(char)*nSize);
|
strTemp[nSize] = NULL;
|
memcpy(copyData.strTemplateImagePath2, strTemp, sizeof(char)*nSize);
|
#endif
|
|
if(strTemp)
|
{
|
delete[] strTemp;
|
strTemp = NULL;
|
}
|
|
pDlg->SendData2ReviewSystem(©Data);
|
}
|
}
|
|
int CDlgGlassType::GetDirectionX(int nGlassDirection, int nMotorDirection)
|
{
|
if(nGlassDirection == GlassOriginDir_LeftTop || nGlassDirection == GlassOriginDir_LeftBottom)
|
{
|
if(nMotorDirection == MotorOriginDir_LeftTop || nMotorDirection == MotorOriginDir_LeftBottom)
|
{
|
return COORDINATE_DIRECTION_FORWARD;
|
}
|
else
|
{
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
}
|
|
if(nGlassDirection == GlassOriginDir_RightTop || nGlassDirection == GlassOriginDir_RightBottom)
|
{
|
if(nMotorDirection == MotorOriginDir_RightTop || nMotorDirection == MotorOriginDir_RightBottom)
|
{
|
return COORDINATE_DIRECTION_FORWARD;
|
}
|
else
|
{
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
}
|
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
|
int CDlgGlassType::GetDirectionY(int nGlassDirection, int nMotorDirection)
|
{
|
if(nGlassDirection == GlassOriginDir_LeftTop || nGlassDirection == GlassOriginDir_RightTop)
|
{
|
if(nMotorDirection == MotorOriginDir_LeftTop || nMotorDirection == MotorOriginDir_RightTop)
|
{
|
return COORDINATE_DIRECTION_FORWARD;
|
}
|
else
|
{
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
}
|
|
if(nGlassDirection == GlassOriginDir_LeftBottom || nGlassDirection == GlassOriginDir_RightBottom)
|
{
|
if(nMotorDirection == MotorOriginDir_LeftBottom || nMotorDirection == MotorOriginDir_RightBottom)
|
{
|
return COORDINATE_DIRECTION_FORWARD;
|
}
|
else
|
{
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
}
|
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
|
void CDlgGlassType::OnBnClickedButtonSysGlassTypeCalculateTilt()
|
{
|
// TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
if(pDlg == NULL) return;
|
BOOL bFindStandardCamera = FALSE;
|
int nAlignCameraCount, nRowIdx, nColIdx, nXDir, nYDir;
|
CString strItemText;
|
SAlignResult sAlignResult;
|
SMarkPosition sFirstMotorAlignPos, sSecondMotorAlignPos, sFirstGlassAlignPos, sSecondGlassAlignPos;
|
CCameraControlInfo_Plus cameraInfo;
|
CGlassTypeInfo* pGlassTypeInfo = NULL;
|
|
CSys_AlignManager* pAlignManager = pDlg->GetAlignManager();
|
if(pAlignManager == NULL) return;
|
|
/*CSys_MotorManager* pMotorManager = pDlg->GetMotorManager();
|
if(pMotorManager == NULL) return;*/
|
|
CMotorControlInfo* pMotorInfo = pDlg->GetMot_MotorInfo();
|
if(pMotorInfo == NULL) return;
|
|
CSys_GlassTypeManager* pGlassTypeManager = pDlg->GetGlassTypeManager();
|
if(pGlassTypeManager == NULL) return;
|
|
|
if(m_nSelectGlassTypeIdx < 0)
|
{
|
AfxMessageBox(_T("Select Glass Type!"));//_T("±Û¶ó½º ŸÀÔÀ» ¼±ÅÃÇϼ¼¿ä"));
|
return;
|
}
|
|
nAlignCameraCount = pAlignManager->GetAlignCameraInfoCount();
|
|
pGlassTypeInfo = pGlassTypeManager->GetGlassTypeInfo(m_nSelectGlassTypeIdx);
|
|
nXDir = GetDirectionX(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection());
|
nYDir = GetDirectionY(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection());
|
|
CAlignCalibrator alignCalibrator;
|
|
alignCalibrator.SetDirection(nXDir, nYDir);
|
|
nRowIdx = 9;
|
nColIdx = m_nSelectGlassTypeIdx + 1;
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx++, nColIdx);
|
sFirstGlassAlignPos.dPositionX = _tcstod(strItemText, NULL); // GLASS X1
|
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx++, nColIdx);
|
sFirstGlassAlignPos.dPositionY = _tcstod(strItemText, NULL); // GLASS Y1
|
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx++, nColIdx);
|
sSecondGlassAlignPos.dPositionX = _tcstod(strItemText, NULL); // GLASS X2
|
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx++, nColIdx);
|
sSecondGlassAlignPos.dPositionY = _tcstod(strItemText, NULL); // GLASS Y2
|
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx++, nColIdx);
|
sFirstMotorAlignPos.dPositionX = _tcstod(strItemText, NULL); // MOTOR X1
|
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx++, nColIdx);
|
sFirstMotorAlignPos.dPositionY = _tcstod(strItemText, NULL); // MOTOR Y1
|
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx++, nColIdx);
|
sSecondMotorAlignPos.dPositionX = _tcstod(strItemText, NULL); // MOTOR X2
|
|
strItemText = m_ctrlGridGlassTypeInfo.GetItemText(nRowIdx++, nColIdx);
|
sSecondMotorAlignPos.dPositionY = _tcstod(strItemText, NULL); // MOTOR Y2
|
|
alignCalibrator.SetFirstMarkPos(sFirstMotorAlignPos.dPositionX, sFirstMotorAlignPos.dPositionY,
|
sFirstGlassAlignPos.dPositionX, sFirstGlassAlignPos.dPositionY);
|
|
alignCalibrator.SetSecondMarkPos(sSecondMotorAlignPos.dPositionX, sSecondMotorAlignPos.dPositionY,
|
sSecondGlassAlignPos.dPositionX, sSecondGlassAlignPos.dPositionY);
|
|
if(alignCalibrator.CalculateAlignResult() == TRUE)
|
{
|
nRowIdx = 24;
|
sAlignResult = alignCalibrator.GetAlignResult();
|
strItemText.Format(_T("%.03lf"), sAlignResult.dOriginX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx++, nColIdx, strItemText);
|
strItemText.Format(_T("%.03lf"), sAlignResult.dOriginY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx++, nColIdx, strItemText);
|
strItemText.Format(_T("%.08lf"), sAlignResult.dDegree);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx++, nColIdx, strItemText);
|
m_ctrlGridGlassTypeInfo.Invalidate(FALSE);
|
}
|
else
|
{
|
AfxMessageBox(_T("Calculate Origin Pos FAIL!"));
|
}
|
}
|
|
void CDlgGlassType::OnGridClick(NMHDR *pNotifyStruct, LRESULT* pResult)
|
{
|
int nIdx;
|
CString strItemText;
|
NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
|
|
nIdx = pItem->iColumn - 1;
|
|
if(nIdx >= 0)
|
{
|
m_nSelectGlassTypeIdx = nIdx;
|
}
|
|
/* CGridCellCheck* pCellCheck = (CGridCellCheck*)m_ctrlGridGlassTypeInfo.GetCell(5, nIdx+1);
|
if(pCellCheck == NULL) return;
|
if(pCellCheck->GetCheck())
|
{
|
// pCellCheck->SetCheck(pGlassTypeInfo->m_bStandardGlassType);
|
m_ctrlGridGlassTypeInfo.GetCell(6, nIdx+1)->SetState(0);
|
}
|
else
|
{
|
m_ctrlGridGlassTypeInfo.GetCell(6, nIdx+1)->SetText(_T(""));
|
m_ctrlGridGlassTypeInfo.GetCell(6, nIdx+1)->SetState(GVIS_READONLY);
|
}*/
|
|
CGridCellCheck* pCellCheck = (CGridCellCheck*)m_ctrlGridGlassTypeInfo.GetCell(21, nIdx+1);
|
|
if(pItem->iRow == 21 && nIdx >= 0)
|
{
|
if(pCellCheck)
|
{
|
if(pCellCheck->GetCheck())
|
{
|
int a = 0;
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
if(pDlg == NULL) return;
|
CSys_GlassTypeManager* pGlassTypeManager = pDlg->GetGlassTypeManager();
|
if(pGlassTypeManager == NULL) return;
|
CGlassTypeInfo* pGlassTypeInfo = pGlassTypeManager->GetGlassTypeInfo(nIdx);
|
pGlassTypeInfo->SetAlignPositionInfoCount(ALIGN_CAMERA_COUNT);
|
CDlgAlignPositionInfo dlgAlignPositionInfo;
|
dlgAlignPositionInfo.SetGlassTypeIndex(nIdx);
|
dlgAlignPositionInfo.DoModal();
|
}
|
else
|
{
|
CReviewSystemSettingDlg* pDlg = (CReviewSystemSettingDlg*)AfxGetMainWnd();
|
if(pDlg == NULL) return;
|
CSys_GlassTypeManager* pGlassTypeManager = pDlg->GetGlassTypeManager();
|
if(pGlassTypeManager == NULL) return;
|
CGlassTypeInfo* pGlassTypeInfo = pGlassTypeManager->GetGlassTypeInfo(nIdx);
|
if(pGlassTypeInfo == NULL) return;
|
for(int i = 0; i < pGlassTypeInfo->GetAlignPositionInfoCount(); i++)
|
{
|
CAlignPositionInfo* pAlignPositionInfo = pGlassTypeInfo->GetAlignPositionInfo(i);
|
if(pAlignPositionInfo == NULL) continue;
|
pAlignPositionInfo->Reset();
|
//delete pAlignPositionInfo;
|
}
|
pGlassTypeInfo->SetAlignPositionInfoCount(0);
|
}
|
}
|
}
|
|
}
|
|
void CDlgGlassType::SetFindAlignMark(COPYDATA_SYSTEM2REV& dataSystem2Rev)
|
{
|
int nRowIdx, nColIdx;
|
CString strItemText;
|
|
if(m_nSelectGlassTypeIdx < 0)
|
{
|
AfxMessageBox(_T("Select Glass Type"));//_T("±Û¶ó½º ŸÀÔÀ» ¼±ÅÃÇϼ¼¿ä"));
|
return;
|
}
|
|
nRowIdx = 17;
|
nColIdx = m_nSelectGlassTypeIdx + 1;
|
|
strItemText.Format(_T("%d"), dataSystem2Rev.nFirstAlignFindPixelX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx++, nColIdx, strItemText);
|
|
strItemText.Format(_T("%d"), dataSystem2Rev.nFirstAlignFindPixelY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx++, nColIdx, strItemText);
|
|
strItemText.Format(_T("%d"), dataSystem2Rev.nSecondAlignFindPixelX);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx++, nColIdx, strItemText);
|
|
strItemText.Format(_T("%d"), dataSystem2Rev.nSecondAlignFindPixelY);
|
m_ctrlGridGlassTypeInfo.SetItemText(nRowIdx++, nColIdx, strItemText);
|
|
m_ctrlGridGlassTypeInfo.Invalidate(FALSE);
|
}
|