#include "pch.h" #include "M_AutoDiagnosisManager/DiagnosisInfo.h" #include "CHCommonClasses/MacroFile.h" BOOL CDiagnosisInfo::LoadInfo(CString strFilePath) { CMacroFile file; if (!file.Read(strFilePath)) return FALSE; file.GetItem(_T("MODULE_COUNT"), m_nModuleCount, 2); file.GetItem(_T("SQUARENESS_PANEL_COUNT"), m_nPanelCount_Squareness, 0); file.GetItem(_T("SQUARENESS_CAMERA_RESOLUTION"), m_dCameraResolution, 0); file.GetItem(_T("SQUARENESS_JUDGE_DATA_DEGREE"), m_dJudgeData_Degree, 0); file.GetItem(_T("SQUARENESS_CAMERA_FRAME_WIDTH"), m_nCameraFrameWidth, 0); file.GetItem(_T("SQUARENESS_CAMERA_FRAME_HEIGHT"), m_nCameraFrameHeight, 0); file.GetItem(_T("FLATNESS_AF_DELAY"), m_nAFDelay, 0); file.GetItem(_T("FLATNESS_JUDGE_DATA_Z_RANGE"), m_dJudgeData_ZRange, 0); file.GetItem(_T("FLATNESS_GLASS_X"), m_nGlassSizeX, 0); file.GetItem(_T("FLATNESS_GLASS_Y"), m_nGlassSizeY, 0); /*< LYW 20210719 : #3517 ADD Start >*/ file.GetItem(_T("FLATNESS_SKIPMODE"), m_nFlatnessSkipMode, 0); file.GetItem(_T("SQUARENESS_STANDARD"), m_dSquarenessStandard, 0); file.GetItem(_T("SQUARENESS_STANDARD2"), m_dSquarenessStandard2, 0); file.GetItem(_T("WSI_STANDARD"), m_dWSIStandard, 0); /*< LYW 20210719 : #3517 ADD End >*/ file.GetItem(_T("FLATNESS_MODE"), m_nFlatnessMode, 0); file.GetItem(_T("FLATNESS_RANGECOUNT"), m_nRangeCount_Flatness, 0); file.GetItem(_T("WSI_PANEL_COUNT"), m_nPanelCount_Wsi, 0); file.GetItem(_T("WSI_JUDGE_DATA_3SIGMA"), m_dJudgeData_3Sigma, 0); file.GetItem(_T("WSI_PANEL_POSX"), m_dPanelPosX, 0); file.GetItem(_T("WSI_PANEL_POSY"), m_dPanelPosY, 0); file.GetItem(_T("WSI_PANEL_POSX2"), m_dPanelPosX2, 0); file.GetItem(_T("WSI_PANEL_POSY2"), m_dPanelPosY2, 0); file.GetItem(_T("REVIEW_PANEL_POSX"), m_dReviewPanelPosX, 0); file.GetItem(_T("REVIEW_PANEL_POSY"), m_dReviewPanelPosY, 0); file.GetItem(_T("REVIEW_PANEL_POSX2"), m_dReviewPanelPosX2, 0); file.GetItem(_T("REVIEW_PANEL_POSY2"), m_dReviewPanelPosY2, 0); file.GetItem(_T("REVIEW_PANEL_POSX3"), m_dReviewPanelPosX3, 0); file.GetItem(_T("REVIEW_PANEL_POSY3"), m_dReviewPanelPosY3, 0); file.GetItem(_T("REVIEW_PANEL_POSX4"), m_dReviewPanelPosX4, 0); file.GetItem(_T("REVIEW_PANEL_POSY4"), m_dReviewPanelPosY4, 0); file.GetItem(_T("REVIEW_PANEL_POSX5"), m_dReviewPanelPosX5, 0); file.GetItem(_T("REVIEW_PANEL_POSY5"), m_dReviewPanelPosY5, 0); file.GetItem(_T("REVIEW_PANEL_POSX6"), m_dReviewPanelPosX6, 0); file.GetItem(_T("REVIEW_PANEL_POSY6"), m_dReviewPanelPosY6, 0); return TRUE; } int CDiagnosisInfo::SetSettingResultCount_Squareness(int nCount) { if (nCount == int(m_vecSettingResult_Squareness.size())) return int(m_vecSettingResult_Squareness.size()); m_vecSettingResult_Squareness.clear(); m_vecSettingResult_Squareness.resize(nCount); return int(m_vecSettingResult_Squareness.size()); } CDiagnosisResult* CDiagnosisInfo::GetSettingResult_Squareness(int nModuleIdx) { if (nModuleIdx < 0 || int(m_vecSettingResult_Squareness.size()) <= 0 || nModuleIdx >= int(m_vecSettingResult_Squareness.size())) return NULL; return &(m_vecSettingResult_Squareness.at(nModuleIdx)); } const CDiagnosisResult* CDiagnosisInfo::GetSettingResult_Squareness(int nModuleIdx) const { if (nModuleIdx < 0 || int(m_vecSettingResult_Squareness.size()) <= 0 || nModuleIdx >= int(m_vecSettingResult_Squareness.size())) return NULL; return &(m_vecSettingResult_Squareness.at(nModuleIdx)); } const CDiagnosisResult* CDiagnosisInfo::GetSettingResult_Flatness() const { return &m_dataSettingResult_Flatness; } CDiagnosisResult* CDiagnosisInfo::GetSettingResult_Flatness() { return &m_dataSettingResult_Flatness; } const CDiagnosisResult* CDiagnosisInfo::GetSettingResult_Wsi(int nModuleIdx) const { if (nModuleIdx < 0 || int(m_vecSettingResult_Wsi.size()) <= 0 || nModuleIdx >= int(m_vecSettingResult_Wsi.size())) return NULL; return &(m_vecSettingResult_Wsi.at(nModuleIdx)); } CDiagnosisResult* CDiagnosisInfo::GetSettingResult_Wsi(int nModuleIdx) { if (nModuleIdx < 0 || int(m_vecSettingResult_Wsi.size()) <= 0 || nModuleIdx >= int(m_vecSettingResult_Wsi.size())) return NULL; return &(m_vecSettingResult_Wsi.at(nModuleIdx)); } BOOL CDiagnosisResult::PathScheduling_Flatness(SPositionData* pPositionData, int nGlassSizeX, int nGlassSizeY) { if (m_nRangeCount_Flatness <= 0) return FALSE; if (pPositionData == NULL) return FALSE; int nRows, nCols; int nStartPos = 50; int nPosWidth, nPosHeight; int nIndex = 0; switch (m_nFlatnessMode) { case Mode_2x2: nRows = 2; nCols = 2; nPosWidth = (nGlassSizeX - nStartPos * 2) / (nRows - 1); nPosHeight = (nGlassSizeY - nStartPos * 2) / (nCols - 1); for (int i = 0; i < nRows; i++) { if (i % 2 == 0) { for (int j = 0; j < nCols; j++) { pPositionData[nIndex].dPosX = nStartPos + nPosWidth * i; pPositionData[nIndex].dPosY = nStartPos + nPosHeight * j; nIndex++; } } else { for (int j = nCols - 1; j >= 0; j--) { pPositionData[nIndex].dPosX = nStartPos + nPosWidth * i; pPositionData[nIndex].dPosY = nStartPos + nPosHeight * j; nIndex++; } } } break; case Mode_3x3: nRows = 3; nCols = 3; nPosWidth = (nGlassSizeX - nStartPos * 2) / (nRows - 1); nPosHeight = (nGlassSizeY - nStartPos * 2) / (nCols - 1); for (int i = 0; i < nRows; i++) { if (i % 2 == 0) { for (int j = 0; j < nCols; j++) { pPositionData[nIndex].dPosX = nStartPos + nPosWidth * i; pPositionData[nIndex].dPosY = nStartPos + nPosHeight * j; nIndex++; } } else { for (int j = nCols - 1; j >= 0; j--) { pPositionData[nIndex].dPosX = nStartPos + nPosWidth * i; pPositionData[nIndex].dPosY = nStartPos + nPosHeight * j; nIndex++; } } } break; case Mode_3x4: nRows = 3; nCols = 4; nPosWidth = (nGlassSizeX - nStartPos * 2) / (nRows - 1); nPosHeight = (nGlassSizeY - nStartPos * 2) / (nCols - 1); for (int i = 0; i < nRows; i++) { if (i % 2 == 0) { for (int j = 0; j < nCols; j++) { pPositionData[nIndex].dPosX = nStartPos + nPosWidth * i; pPositionData[nIndex].dPosY = nStartPos + nPosHeight * j; nIndex++; } } else { for (int j = nCols - 1; j >= 0; j--) { pPositionData[nIndex].dPosX = nStartPos + nPosWidth * i; pPositionData[nIndex].dPosY = nStartPos + nPosHeight * j; nIndex++; } } } break; case Mode_4x5: nRows = 4; nCols = 5; nPosWidth = (nGlassSizeX - nStartPos * 2) / (nRows - 1); nPosHeight = (nGlassSizeY - nStartPos * 2) / (nCols - 1); for (int i = 0; i < nRows; i++) { if (i % 2 == 0) { for (int j = 0; j < nCols; j++) { pPositionData[nIndex].dPosX = nStartPos + nPosWidth * i; pPositionData[nIndex].dPosY = nStartPos + nPosHeight * j; nIndex++; } } else { for (int j = nCols - 1; j >= 0; j--) { pPositionData[nIndex].dPosX = nStartPos + nPosWidth * i; pPositionData[nIndex].dPosY = nStartPos + nPosHeight * j; nIndex++; } } } break; case Mode_10x10: nRows = 10; nCols = 10; nPosWidth = (nGlassSizeX - nStartPos * 2) / (nRows - 1); nPosHeight = (nGlassSizeY - nStartPos * 2) / (nCols - 1); for (int i = 0; i < nRows; i++) { if (i % 2 == 0) { for (int j = 0; j < nCols; j++) { pPositionData[nIndex].dPosX = nStartPos + nPosWidth * i; pPositionData[nIndex].dPosY = nStartPos + nPosHeight * j; nIndex++; } } else { for (int j = nCols - 1; j >= 0; j--) { pPositionData[nIndex].dPosX = nStartPos + nPosWidth * i; pPositionData[nIndex].dPosY = nStartPos + nPosHeight * j; nIndex++; } } } break; } return TRUE; } BOOL CDiagnosisResult::PathScheduling_Flatness_TestFunc(SPositionData* pPositionData, int nGlassSizeX, int nGlassSizeY) { if (m_nRangeCount_Flatness <= 0) return FALSE; if (pPositionData == NULL) return FALSE; int nRows, nCols; int nStartPos = 50; int nPosWidth, nPosHeight; int nIndex = 0; switch (m_nFlatnessMode) { case Mode_2x2: nRows = 2; nCols = 2; nPosWidth = (nGlassSizeX - nStartPos * 2) / (nRows - 1); nPosHeight = (nGlassSizeY - nStartPos * 2) / (nCols - 1); pPositionData[0].dPosX = 1345.703; pPositionData[0].dPosY = 2280.953; pPositionData[1].dPosX = 2308.821; pPositionData[1].dPosY = 2280.953; pPositionData[2].dPosX = 2308.821; pPositionData[2].dPosY = 2381.836; pPositionData[3].dPosX = 1343.277; pPositionData[3].dPosY = 2381.836; } return TRUE; } void CDiagnosisResult::SetPositionData_Flatness(int nIndex) { m_pPositionData_Flatness = new SPositionData[nIndex]; } SPositionData* CDiagnosisResult::GetPositionData_Squareness(int nIndex) { if (nIndex < 0 || nIndex >= MAX_PANEL_COUNT) return NULL; return &(m_pPositionData_Squareness[nIndex]); } const SPositionData* CDiagnosisResult::GetPositionData_Squareness(int nIndex) const { if (nIndex < 0 || nIndex >= MAX_PANEL_COUNT) return NULL; return &(m_pPositionData_Squareness[nIndex]); } SPositionData* CDiagnosisResult::GetPositionData_Flatness(int nIndex) { if (nIndex < 0 || nIndex >= m_nRangeCount_Flatness) return NULL; return &(m_pPositionData_Flatness[nIndex]); } const SPositionData* CDiagnosisResult::GetPositionData_Flatness(int nIndex) const { if (nIndex < 0 || nIndex >= m_nRangeCount_Flatness) return NULL; return &(m_pPositionData_Flatness[nIndex]); }