////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //생성 : //추가 : //목적 : 라이브 시 해당 델리게이트 호출 //설명 : 동기 호출 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void UpdateDisplayLive(int iCameraIndex, Cognex.VisionPro.CogImage8Grey objLiveImage) { CFormDisplay obj = m_objFormDisplay[iCameraIndex] as CFormDisplay; do { if (null == obj) { break; } // 라이브는 바로 날림 obj.UpdateDisplay(objLiveImage); } while(false); }
public void UpdateDisplayPMS(enumDisplayIndex eDisplayIndex, CInspectionResult.CResult objResult) { CFormDisplay obj = m_objFormDisplay[( int )eDisplayIndex] as CFormDisplay; do { if (null == obj) { break; } obj.BeginInvoke(obj.m_objDelegateUpdateDisplayPMSImage, objResult); } while (false); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //생성 : //추가 : //목적 : 이미지 저장 해당 델리게이트 호출 //설명 : 비동기 호출 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void SaveImage(int iCameraIndex, CInspectionResult.CResult objResult) { var pDocument = CDocument.GetDocument; CFormDisplay obj = m_objFormDisplay[iCameraIndex] as CFormDisplay; do { if (null == obj) { break; } if (CDefine.enumRunMode.RUN_MODE_START == pDocument.GetRunMode()) { obj.BeginInvoke(obj.m_objDelegateSaveImage, objResult, false); } else { obj.BeginInvoke(obj.m_objDelegateSaveImage, objResult, true); } } while(false); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //생성 : //추가 : //목적 : 폼 초기화 //설명 : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public bool InitializeForm() { bool bReturn = false; do { var pDocument = CDocument.GetDocument; m_iCameraCount = ( int )CDefine.enumCamera.CAMERA_FINAL; // 검사 결과 ( 디스플레이 & 데이터 갱신 ) m_delegateUpdateDisplayResultVIDI = new DelegateUpdateDisplay(UpdateDisplayResultVIDI); m_delegateUpdateDisplayResultMeasure = new DelegateUpdateDisplay(UpdateDisplayResultMeasure); m_delegateUpdateDisplayOriginal = new DelegateUpdateDisplay(UpdateDisplayOriginal); m_delegateUpdateDisplayPMS = new DelegateUpdateDisplay(UpdateDisplayPMS); m_delegateUpdateResult = new DelegateUpdateResult(UpdateResult); // 라이브 결과 ( 디스플레이 ) m_delegateUpdateDisplayLive = new DelegateUpdateDisplayLive(UpdateDisplayLive); // 이미지 저장 m_delegateSaveImage = new DelegateSaveImage(SaveImage); // 리스트 로그 m_objListLog = new ListBox[m_iCameraCount]; m_objListLog[( int )CDefine.enumCamera.CAMERA_1] = this.listLogInputTray1; // 디스플레이 화면 생성 { m_iDisplayIndex = ( int )enumDisplayIndex.DISPLAY_FINAL; m_objPanelDisplay = new Panel[m_iDisplayIndex]; m_objPanelDisplay[( int )enumDisplayIndex.PMS] = this.panelDisplayPMS; m_objPanelDisplay[( int )enumDisplayIndex.ORIGIN_1] = this.panelDisplayOriginalImage1; m_objPanelDisplay[( int )enumDisplayIndex.ORIGIN_2] = this.panelDisplayOriginalImage2; m_objPanelDisplay[( int )enumDisplayIndex.ORIGIN_3] = this.panelDisplayOriginalImage3; m_objPanelDisplay[( int )enumDisplayIndex.ORIGIN_4] = this.panelDisplayOriginalImage4; m_objPanelDisplay[( int )enumDisplayIndex.VIDI_1] = this.panelDisplayVidi1; m_objPanelDisplay[( int )enumDisplayIndex.VIDI_2] = this.panelDisplayVidi2; m_objPanelDisplay[( int )enumDisplayIndex.VIDI_3] = this.panelDisplayVidi3; m_objPanelDisplay[( int )enumDisplayIndex.MEASURE_1] = this.panelDisplayVidi4; m_objPanelDisplay[( int )enumDisplayIndex.MEASURE_2] = this.panelDisplayVidi5; m_objPanelDisplay[( int )enumDisplayIndex.MEASURE_3] = this.panelDisplayVidi6; // 폼 디스플레이 생성 m_objFormDisplay = new Form[m_iDisplayIndex]; m_objDisplaySize = new Size[m_iDisplayIndex]; m_objDisplayLocation = new Point[m_iDisplayIndex]; string[] strDisplayName = new string[m_objFormDisplay.Length]; strDisplayName[( int )enumDisplayIndex.PMS] = enumDisplayIndex.PMS.ToString(); strDisplayName[( int )enumDisplayIndex.ORIGIN_1] = enumDisplayIndex.ORIGIN_1.ToString(); strDisplayName[( int )enumDisplayIndex.ORIGIN_2] = enumDisplayIndex.ORIGIN_2.ToString(); strDisplayName[( int )enumDisplayIndex.ORIGIN_3] = enumDisplayIndex.ORIGIN_3.ToString(); strDisplayName[( int )enumDisplayIndex.ORIGIN_4] = enumDisplayIndex.ORIGIN_4.ToString(); strDisplayName[( int )enumDisplayIndex.VIDI_1] = enumDisplayIndex.VIDI_1.ToString(); strDisplayName[( int )enumDisplayIndex.VIDI_2] = enumDisplayIndex.VIDI_2.ToString(); strDisplayName[( int )enumDisplayIndex.VIDI_3] = enumDisplayIndex.VIDI_3.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_1] = enumDisplayIndex.MEASURE_1.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_2] = enumDisplayIndex.MEASURE_2.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_3] = enumDisplayIndex.MEASURE_3.ToString(); for (int iLoopCount = 0; iLoopCount < m_objFormDisplay.Length; iLoopCount++) { // 디스플레이 화면 생성 & 초기화 CFormDisplay objForm = new CFormDisplay(); int iImageIndex = 0; if (( int )enumDisplayIndex.VIDI_1 > iLoopCount && ( int )enumDisplayIndex.PMS < iLoopCount) { iImageIndex = iLoopCount - ( int )enumDisplayIndex.ORIGIN_1; } else if (( int )enumDisplayIndex.VIDI_1 <= iLoopCount && ( int )enumDisplayIndex.MEASURE_1 > iLoopCount) { iImageIndex = iLoopCount - ( int )enumDisplayIndex.VIDI_1; } else if (( int )enumDisplayIndex.MEASURE_1 <= iLoopCount) { iImageIndex = iLoopCount - ( int )enumDisplayIndex.MEASURE_1; } objForm.Initialize(( int )CDefine.enumCamera.CAMERA_1, string.Format("{0}", strDisplayName[iLoopCount]), false, iImageIndex); objForm.SetDisplayIndex(iLoopCount); objForm.Visible = true; objForm.SetTimer(true); // 사이즈 조정 Panel objPanel = m_objPanelDisplay[iLoopCount]; objForm.SetSize(objPanel.Location.X, objPanel.Location.Y, objPanel.Width, objPanel.Height, true); // 디스플레이 사이즈 변경 이벤트 추가 objForm.EventChangeSizeDisplay += new CFormDisplay.DelegateChangeSizeDisplay(ChangeDisplaySize); // 패널에 화면 붙임 SetFormDockStyle(objForm, objPanel); m_objFormDisplay[iLoopCount] = objForm; // 원본 패널 사이즈 및 위치 저장 m_objDisplaySize[iLoopCount] = m_objPanelDisplay[iLoopCount].Size; m_objDisplayLocation[iLoopCount] = m_objPanelDisplay[iLoopCount].Location; } } // 디스플레이 확대 화면 생성 m_objFormDisplayChangeSize = new CFormDisplayChangeSize(); // 버튼 색상 정의 SetButtonColor(); // 초기화 언어 변경 SetChangeLanguage(); // 버튼 이벤트 로그 정의 SetButtonEventChange(); // 타이머 외부에서 제어 timer.Interval = 100; timer.Enabled = false; bReturn = true; } while(false); return(bReturn); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //생성 : //추가 : //목적 : 초기화 //설명 : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private bool Initialize() { bool bReturn = false; var pDocument = CDocument.GetDocument; do { InitializeForm(); m_delegateUpdateDisplayResult = new DelegateUpdateDisplay(UpdateDisplayResult); m_delegateUpdateDisplayResultHistory = new DelegateUpdateDisplayHistory(UpdateDisplayResultHistory); // 디스플레이 화면 생성 { m_iDisplayIndex = ( int )enumDisplayIndex.DISPLAY_FINAL; m_objPanelDisplayLeft = new Panel[m_iDisplayIndex]; m_objPanelDisplayLeft[( int )enumDisplayIndex.OIRGINAL] = this.panelDisplayPosition22; m_objPanelDisplayLeft[( int )enumDisplayIndex.MEASURE_1] = this.panelDisplayMeasure11; m_objPanelDisplayLeft[( int )enumDisplayIndex.MEASURE_2] = this.panelDisplayMeasure12; m_objPanelDisplayLeft[( int )enumDisplayIndex.MEASURE_3] = this.panelDisplayMeasure13; m_objPanelDisplayLeft[( int )enumDisplayIndex.MEASURE_4] = this.panelDisplayMeasure14; m_objPanelDisplayLeft[( int )enumDisplayIndex.MEASURE_5] = this.panelDisplayMeasure15; m_objPanelDisplayLeft[( int )enumDisplayIndex.MEASURE_6] = this.panelDisplayMeasure16; // 폼 디스플레이 생성 m_objFormDisplayLeft = new Form[m_iDisplayIndex]; string[] strDisplayName = new string[m_objFormDisplayLeft.Length]; strDisplayName[( int )enumDisplayIndex.OIRGINAL] = enumDisplayIndex.OIRGINAL.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_1] = enumDisplayIndex.MEASURE_1.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_2] = enumDisplayIndex.MEASURE_2.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_3] = enumDisplayIndex.MEASURE_3.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_4] = enumDisplayIndex.MEASURE_4.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_5] = enumDisplayIndex.MEASURE_5.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_6] = enumDisplayIndex.MEASURE_6.ToString(); for (int iLoopCount = 0; iLoopCount < m_objFormDisplayLeft.Length; iLoopCount++) { // 디스플레이 화면 생성 & 초기화 CFormDisplay objForm = new CFormDisplay(); int iImageIndex = 0; if (( int )enumDisplayIndex.OIRGINAL == iLoopCount) { iImageIndex = iLoopCount; } else if (( int )enumDisplayIndex.MEASURE_1 <= iLoopCount) { iImageIndex = iLoopCount - ( int )enumDisplayIndex.MEASURE_1; } objForm.Initialize(( int )CDefine.enumCamera.CAMERA_1, string.Format("{0}", strDisplayName[iLoopCount]), false, iImageIndex); objForm.UseMeasureInfo3D(); objForm.Visible = true; objForm.SetTimer(true); // 사이즈 조정 Panel objPanel = m_objPanelDisplayLeft[iLoopCount]; objForm.SetSize(objPanel.Location.X, objPanel.Location.Y, objPanel.Width, objPanel.Height, false, false); // 패널에 화면 붙임 SetFormDockStyle(objForm, objPanel); m_objFormDisplayLeft[iLoopCount] = objForm; } } // 디스플레이 화면 생성 { m_iDisplayIndex = ( int )enumDisplayIndex.DISPLAY_FINAL; m_objPanelDisplayRight = new Panel[m_iDisplayIndex]; m_objPanelDisplayRight[( int )enumDisplayIndex.OIRGINAL] = this.panelDisplayPosition24; m_objPanelDisplayRight[( int )enumDisplayIndex.MEASURE_1] = this.panelDisplayMeasure21; m_objPanelDisplayRight[( int )enumDisplayIndex.MEASURE_2] = this.panelDisplayMeasure22; m_objPanelDisplayRight[( int )enumDisplayIndex.MEASURE_3] = this.panelDisplayMeasure23; m_objPanelDisplayRight[( int )enumDisplayIndex.MEASURE_4] = this.panelDisplayMeasure24; m_objPanelDisplayRight[( int )enumDisplayIndex.MEASURE_5] = this.panelDisplayMeasure25; m_objPanelDisplayRight[( int )enumDisplayIndex.MEASURE_6] = this.panelDisplayMeasure26; // 폼 디스플레이 생성 m_objFormDisplayRight = new Form[m_iDisplayIndex]; string[] strDisplayName = new string[m_objFormDisplayRight.Length]; strDisplayName[( int )enumDisplayIndex.OIRGINAL] = enumDisplayIndex.OIRGINAL.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_1] = enumDisplayIndex.MEASURE_1.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_2] = enumDisplayIndex.MEASURE_2.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_3] = enumDisplayIndex.MEASURE_3.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_4] = enumDisplayIndex.MEASURE_4.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_5] = enumDisplayIndex.MEASURE_5.ToString(); strDisplayName[( int )enumDisplayIndex.MEASURE_6] = enumDisplayIndex.MEASURE_6.ToString(); for (int iLoopCount = 0; iLoopCount < m_objFormDisplayRight.Length; iLoopCount++) { // 디스플레이 화면 생성 & 초기화 CFormDisplay objForm = new CFormDisplay(); int iImageIndex = 0; if (( int )enumDisplayIndex.OIRGINAL == iLoopCount) { iImageIndex = iLoopCount; } else if (( int )enumDisplayIndex.MEASURE_1 <= iLoopCount) { iImageIndex = iLoopCount - ( int )enumDisplayIndex.MEASURE_1; } objForm.Initialize(( int )CDefine.enumCamera.CAMERA_1, string.Format("{0}", strDisplayName[iLoopCount]), false, iImageIndex); objForm.SetDisplayIndex(iLoopCount); objForm.Visible = true; objForm.SetTimer(true); // 사이즈 조정 Panel objPanel = m_objPanelDisplayRight[iLoopCount]; objForm.SetSize(objPanel.Location.X, objPanel.Location.Y, objPanel.Width, objPanel.Height, false, false); // 패널에 화면 붙임 SetFormDockStyle(objForm, objPanel); m_objFormDisplayRight[iLoopCount] = objForm; } } bReturn = true; } while(false); return(bReturn); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //생성 : //추가 : //목적 : 이미지 갱신 //설명 : ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void UpdateDisplay(DataRow objDataRow) { do { try { CDefine.structureReportImage objReportImage = new CDefine.structureReportImage(); if ("OK" == objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.RESULT].ToString()) { objReportImage.bResult = true; } else { objReportImage.bResult = false; } CFormDisplay[] objFormDisplay = new CFormDisplay[m_objFormDisplayLeft.Length]; bool bInit = true; for (int iLoopCount = 0; iLoopCount < m_objFormDisplayLeft.Length; iLoopCount++) { if ("21" == objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.POSITION].ToString()) { objFormDisplay[iLoopCount] = m_objFormDisplayLeft[iLoopCount] as CFormDisplay; } else if ("23" == objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.POSITION].ToString()) { objFormDisplay[iLoopCount] = m_objFormDisplayRight[iLoopCount] as CFormDisplay; } else { bInit = false; break; } } if (false == bInit) { break; } var pFormCommon = CFormCommon.GetFormCommon; if (true == objReportImage.bResult) { if ("21" == objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.POSITION].ToString()) { pFormCommon.SetButtonColor(this.BtnTitleCaseLeft, pFormCommon.COLOR_WHITE, pFormCommon.COLOR_GREEN); } else { pFormCommon.SetButtonColor(this.BtnTitleCaseRight, pFormCommon.COLOR_WHITE, pFormCommon.COLOR_GREEN); } } else { if ("23" == objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.POSITION].ToString()) { pFormCommon.SetButtonColor(this.BtnTitleCaseLeft, pFormCommon.COLOR_WHITE, pFormCommon.COLOR_RED); } else { pFormCommon.SetButtonColor(this.BtnTitleCaseRight, pFormCommon.COLOR_WHITE, pFormCommon.COLOR_RED); } } objReportImage.strImagePath = objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.IMAGE_PATH].ToString(); objReportImage.dPatternPositionX = double.Parse(objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.PATTERN_POSITION_X].ToString()); objReportImage.dPatternPositionY = double.Parse(objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.PATTERN_POSITION_Y].ToString()); (objFormDisplay[( int )enumDisplayIndex.OIRGINAL] as CFormDisplay).UpdateDisplayHistory3D(objReportImage); // 높이그랙픽 그리기.. CDefine.structureReportImage[] objReportImageLineResult = new CDefine.structureReportImage[CDefine.DEF_MAX_COUNT_CROP_REGION]; for (int iLoopCount = 0; iLoopCount < CDefine.DEF_MAX_COUNT_CROP_REGION; iLoopCount++) { objReportImageLineResult[iLoopCount] = new CDefine.structureReportImage(); objReportImageLineResult[iLoopCount].iFindLineCount = Int32.Parse(objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.MEASURE_LINE_FIND_COUNT].ToString()); objReportImageLineResult[iLoopCount].dStartX = double.Parse(objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.MEASURE_START_X_1 + (iLoopCount * 4)].ToString()); objReportImageLineResult[iLoopCount].dStartY = double.Parse(objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.MEASURE_START_Y_1 + (iLoopCount * 4)].ToString()); objReportImageLineResult[iLoopCount].dEndX = double.Parse(objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.MEASURE_END_X_1 + (iLoopCount * 4)].ToString()); objReportImageLineResult[iLoopCount].dEndY = double.Parse(objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.MEASURE_END_Y_1 + (iLoopCount * 4)].ToString()); objReportImageLineResult[iLoopCount].dLineDistance = double.Parse(objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.MEASURE_WIDTH_1 + (iLoopCount * 3)].ToString()); } (objFormDisplay[( int )enumDisplayIndex.OIRGINAL] as CFormDisplay).SetDisplayMeasureHeight(objReportImageLineResult); for (int iLoopCount = 0; iLoopCount < CDefine.DEF_MAX_COUNT_CROP_REGION; iLoopCount++) { objReportImage.bResult = "OK" == objDataRow.ItemArray[( int )CDatabaseDefine.enumHistoryAlign.MEASURE_RESULT_1 + (iLoopCount * 3)].ToString() ? true : false; (objFormDisplay[( int )enumDisplayIndex.MEASURE_1 + iLoopCount] as CFormDisplay).UpdateDisplayHistory3DHeight(objReportImage); } } catch (Exception ex) { Trace.WriteLine(ex.ToString()); } } while(false); }
public void UpdateDisplayResult(int iPosition) { var pDocument = CDocument.GetDocument; var pFormCommon = CFormCommon.GetFormCommon; do { CFormDisplay[] objFormDisplay = new CFormDisplay[m_objFormDisplayLeft.Length]; bool bInit = true; for (int iLoopCount = 0; iLoopCount < m_objFormDisplayLeft.Length; iLoopCount++) { if (21 == iPosition) { objFormDisplay[iLoopCount] = m_objFormDisplayLeft[iLoopCount] as CFormDisplay; } else if (23 == iPosition) { objFormDisplay[iLoopCount] = m_objFormDisplayRight[iLoopCount] as CFormDisplay; } else { bInit = false; break; } } if (false == bInit) { break; } CInspectionResult.CResult objResult = pDocument.GetInspectionResultAlign(iPosition); if (null == objFormDisplay) { break; } objFormDisplay[( int )enumDisplayIndex.OIRGINAL].BeginInvoke(objFormDisplay[( int )enumDisplayIndex.OIRGINAL].m_objDelegateUpdateDisplay3D, objResult); // 여기서 결과 디스플레이를 뿌리자 for (int iLoopCount = 0; iLoopCount < CDefine.DEF_MAX_COUNT_CROP_REGION; iLoopCount++) { // if( 21 == iPosition ) // obj = m_objFormDisplayLeft[ ( int )enumDisplayIndex.MEASURE_1 + iLoopCount ] as CFormDisplay; // else if( 23 == iPosition ) // obj = m_objFormDisplayRight[ ( int )enumDisplayIndex.MEASURE_1 + iLoopCount ] as CFormDisplay; //obj.BeginInvoke( obj.m_objDelegateUpdateDisplayMeasure3D, objResult ); objFormDisplay[( int )enumDisplayIndex.MEASURE_1 + iLoopCount].BeginInvoke(objFormDisplay[( int )enumDisplayIndex.MEASURE_1 + iLoopCount].m_objDelegateUpdateDisplayMeasure3D, objResult); } if (CDefine.enumResult.RESULT_OK == objResult.objResultCommon.eResult) { if (21 == iPosition) { pFormCommon.SetButtonColor(this.BtnTitleCaseLeft, pFormCommon.COLOR_WHITE, pFormCommon.COLOR_GREEN); } else { pFormCommon.SetButtonColor(this.BtnTitleCaseRight, pFormCommon.COLOR_WHITE, pFormCommon.COLOR_GREEN); } } else { if (21 == iPosition) { pFormCommon.SetButtonColor(this.BtnTitleCaseLeft, pFormCommon.COLOR_WHITE, pFormCommon.COLOR_RED); } else { pFormCommon.SetButtonColor(this.BtnTitleCaseRight, pFormCommon.COLOR_WHITE, pFormCommon.COLOR_RED); } } } while(false); }