From 4139a71f5c0b72f88813a15d7112fdac76756fe4 Mon Sep 17 00:00:00 2001 From: LYW <leeyeanwoo@diteam.co.kr> Date: 월, 15 11월 2021 10:31:35 +0900 Subject: [PATCH] 프로그램 종료시 팝업 멘트 고객사 요청사항 반영 --- ReviewHistory/ReveiwHistory/akFormationMap.cpp | 1190 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 1,190 insertions(+), 0 deletions(-) diff --git a/ReviewHistory/ReveiwHistory/akFormationMap.cpp b/ReviewHistory/ReveiwHistory/akFormationMap.cpp new file mode 100644 index 0000000..d517d85 --- /dev/null +++ b/ReviewHistory/ReveiwHistory/akFormationMap.cpp @@ -0,0 +1,1190 @@ +#include "stdafx.h" +#include "akFormationMap.h" + + +CakFormationMap::CakFormationMap() +{ + { + CakGraphBase::setAK(); + m_AxisX.m_Size = 80; + m_AxisX.m_TickGabStep = 1; + m_AxisX.m_MinorTickNum = 4; + m_AxisY.m_MinorTickNum = 4; + //m_AxisX.m_TickGabPixel = 30; + //m_AxisX.m_FontTick.DeleteObject(); + //m_AxisX.m_FontTick.CreatePointFont(120, _T("Tahoma")); + //m_AxisX.SetRotateFont(&m_AxisX.m_FontTick, 270); + m_AxisY.SetRotateFont(&m_AxisY.m_FontTick, 90); + m_AxisY2.SetRotateFont(&m_AxisY2.m_FontTick, 270); + SetClossLine(false); + SetDragStyle(DS_All_HOR); + m_bGrid = false; + + m_AxisY.m_TickGabPixel = 70; + m_AxisX.m_Size = 20; + m_AxisY.m_Size = 20; + m_AxisY2.m_Size = 20; + m_Title.m_Size = 20; + + m_AxisX.m_strTitle = ""; + m_AxisY.m_strTitle = ""; + m_Title.m_strTitle = " "; + + m_MouseMoveInfo.m_nType = 0; + } + + m_bShowCell = TRUE; + + + m_bShowGroupIndex = FALSE; + m_bShowGroupLine = TRUE; + + m_pDefectFormation = NULL; + m_dGlassSizeWidth = 2500; + m_dGlassSizeHeight = 2300; + + m_bShowDefectOutLine = TRUE; + m_bShowDefectColorType = FALSE; + + m_pSelectedFormation = NULL; + m_pMouseOveredDefect = NULL; + m_pSelectedDefect = NULL; + m_pMouseOveredFormation = NULL; +} + + +CakFormationMap::~CakFormationMap() +{ +} + +void CakFormationMap::RenderSeries(Graphics* grfx, CDC* pDC) +{ + renderGlass(pDC); + renderCell(pDC); + + renderDefects(pDC); + renderDefectsPath(pDC); + + renderFormations(pDC); +} + +void CakFormationMap::SetAutoScale() +{ + CakGraphBasic3::SetAutoScale(); + + if (1)//글라스 크기 및 그리기 방향 결정 태현[2016/3/23] + { + double nGlassSizeX = m_dGlassSizeWidth; + double nGlassSizeY = m_dGlassSizeHeight; + + double dWindowRate = (double)m_rectData.Width() / (double)m_rectData.Height(); + double dValueRate = (double)nGlassSizeX / (double)nGlassSizeY; + + if (dWindowRate < dValueRate)//가로풀 기준 태현[2016/3/25] + { + m_AxisX.m_RangeValueMin = 0; + m_AxisX.m_RangeValueMax = nGlassSizeX; + m_AxisY.m_RangeValueMin = 0; + m_AxisY.m_RangeValueMax = (float)nGlassSizeX*((float)m_rectData.Height() / (float)m_rectData.Width()); + m_AxisY.SetRangePos(nGlassSizeY / 2); + + + } + else //세로풀기준 태현[2016/3/25] + { + + m_AxisX.m_RangeValueMin = 0; + m_AxisX.m_RangeValueMax = (float)nGlassSizeY*((float)m_rectData.Width() / (float)m_rectData.Height()); + m_AxisY.m_RangeValueMin = 0; + m_AxisY.m_RangeValueMax = nGlassSizeY; + + m_AxisX.SetRangePos(nGlassSizeX / 2); + } + + //0,0이 중앙에 오도록 [김태현2021/2/16] + m_AxisX.SetRangePos(0); + m_AxisY.SetRangePos(0); + } +} + +void CakFormationMap::SetResize() +{ + CakGraphBasic3::SetAutoScale(); + + if (1)//글라스 크기 및 그리기 방향 결정 태현[2016/3/23] + { + double nGlassSizeX = m_dGlassSizeWidth; + double nGlassSizeY = m_dGlassSizeHeight; + + double dWindowRate = (double)m_rectData.Width() / (double)m_rectData.Height(); + double dValueRate = (double)nGlassSizeX / (double)nGlassSizeY; + + double dPosOldX = m_AxisX.m_RangeValueMin + m_AxisX.GetRangeValue()/2.0; + double dPosOldY = m_AxisY.m_RangeValueMin + m_AxisY.GetRangeValue() / 2.0; + if (dWindowRate < dValueRate)//가로풀 기준 태현[2016/3/25] + { + m_AxisX.m_RangeValueMin = 0; + m_AxisX.m_RangeValueMax = nGlassSizeX; + m_AxisY.m_RangeValueMin = 0; + m_AxisY.m_RangeValueMax = (float)nGlassSizeX*((float)m_rectData.Height() / (float)m_rectData.Width()); + m_AxisY.SetRangePos(nGlassSizeY / 2); + + + } + else //세로풀기준 태현[2016/3/25] + { + + m_AxisX.m_RangeValueMin = 0; + m_AxisX.m_RangeValueMax = (float)nGlassSizeY*((float)m_rectData.Width() / (float)m_rectData.Height()); + m_AxisY.m_RangeValueMin = 0; + m_AxisY.m_RangeValueMax = nGlassSizeY; + + m_AxisX.SetRangePos(nGlassSizeX / 2); + } + + m_AxisX.SetRangePos(dPosOldX); + m_AxisY.SetRangePos(dPosOldY); + } +} + +void CakFormationMap::OnMouseInput(akMouseEvent mouseevent, CPoint point) +{ + CakGraphBasic3::OnMouseInput(mouseevent, point); + + switch (mouseevent) + { + case MouseMove: + { + m_pMouseOveredDefect = findDefect(GetValuePosDataX(point.x), GetValuePosDataY(point.y)); + if(m_pMouseOveredDefect) GetParent()->PostMessage(UM_FORMMAP_DEFECTMOUSEOVER, m_pMouseOveredDefect->m_nDefectID); + //else GetParent()->PostMessage(UM_FORMMAP_DEFECTMOUSEOVER, m_pMouseOveredDefect->nDefectID); + + m_pMouseOveredFormation = findFormation(GetValuePosDataX(point.x), GetValuePosDataY(point.y)); + //if (m_pMouseOveredFormation) GetParent()->PostMessage(UM_FORMMAP_FORMMOUSEOVER, m_pMouseOveredFormation->m_nFormLabel); + break; + } + case MouseLeftButtonDown: + { + m_pSelectedDefect = findDefect(GetValuePosDataX(point.x), GetValuePosDataY(point.y)); + if (m_pSelectedDefect) GetParent()->PostMessage(UM_FORMMAP_DEFECTSELECT, m_pSelectedDefect->m_nDefectID, 0); + + m_pSelectedFormation = findFormation(GetValuePosDataX(point.x), GetValuePosDataY(point.y)); + if (m_pMouseOveredFormation) GetParent()->PostMessage(UM_FORMMAP_DEFECTSELECT, m_pMouseOveredFormation->m_nFormLabel, 1); + + + break; + } + } +} +void CakFormationMap::OnKeyInput(int key, int mode) +{ + CakGraphBasic3::OnKeyInput(key, mode); + + if (mode == 0) return; + + switch (key) + { + case 'G': + { + m_bGrid = !m_bGrid; + ReDraw(true); + break; + } + } +} +_akDefect* CakFormationMap::findDefect(double nPosX, double nPosY) +{ + if (!m_pDefectFormation) + return NULL; + + _akDefect* pDefect; + + double nInPosRage = 1; + nInPosRage =(abs(GetValuePosDataX(nInPosRage) - GetValuePosDataX(0))); + CakRectd rectMousePos; + rectMousePos.set(nPosX, nPosY, nPosX, nPosY); + rectMousePos.InflateRect(nInPosRage*3, nInPosRage*5, nInPosRage*5, nInPosRage*3); + + int nFormType; + int nFormLabel; + + double dMinDistance; + _akDefect* pDefectMin = NULL; + //속도 신경안쓰고 구현;;기능이 우선이다~ [김태현2021/2/16] + for (int i = 0; i < m_pDefectFormation->m_vecDefects.size(); i++) + { + { + pDefect = &m_pDefectFormation->m_vecDefects[i]; + + nFormType = -1; + nFormLabel = m_pDefectFormation->m_vecDefects[i].nLabel; + + if (nFormLabel >= 0) + { + nFormType = m_pDefectFormation->m_vecFormation[nFormLabel].m_nFormType; + } + + if (m_pDefectDisplayOption->m_nShowSize) + { + if (pDefect->nSize <= m_pDefectDisplayOption->m_nShowSize) continue; + } + if (m_pDefectDisplayOption->m_bShowDefectNormal == FALSE) + { + if (nFormType < 0) continue;; + } + if (m_pDefectDisplayOption->m_bShowDefectGroupRound == FALSE) + { + if (nFormType == 0) continue;; + } + if (m_pDefectDisplayOption->m_bShowDefectGroupLine == FALSE) + { + if (nFormType == 1) continue;; + } + if (m_pDefectDisplayOption->m_nShowLabel >= 0) + { + if (nFormLabel != m_pDefectDisplayOption->m_nShowLabel) continue;; + } + } + if (rectMousePos.getCheckAreaIn(m_pDefectFormation->m_vecDefects[i].dPositionX, m_pDefectFormation->m_vecDefects[i].dPositionY)) + { + double dMinDistanceNew = + (m_pDefectFormation->m_vecDefects[i].dPositionX - rectMousePos.getCenter()) * (m_pDefectFormation->m_vecDefects[i].dPositionX - rectMousePos.getCenter()) + + (m_pDefectFormation->m_vecDefects[i].dPositionY - rectMousePos.getVCenter()) * (m_pDefectFormation->m_vecDefects[i].dPositionY - rectMousePos.getVCenter()) ; + if (pDefectMin) + { + if (dMinDistance < dMinDistanceNew) + { + pDefectMin = &m_pDefectFormation->m_vecDefects[i]; + dMinDistance = dMinDistanceNew; + } + } + else + { + pDefectMin = &m_pDefectFormation->m_vecDefects[i]; + dMinDistance = dMinDistanceNew; + break; + } + + } + } + + return pDefectMin; +} + +_akFormation* CakFormationMap::findFormation(double nPosX, double nPosY) +{ + if (!m_pDefectFormation) + return NULL; + + _akFormation* pFormation = NULL; + _akFormation* pFormationRetrun = NULL; + + CakRectd rectForm; + + int nFormType; + int nFormLabel; + + double dMinDistance; + //속도 신경안쓰고 구현;;기능이 우선이다~ [김태현2021/2/16] + for (int i = 0; i < m_pDefectFormation->m_vecFormation.size(); i++) + { + { + pFormation = &m_pDefectFormation->m_vecFormation[i]; + + nFormType = pFormation->m_nFormType; + nFormLabel = i; + + if (nFormLabel >= 0) + { + nFormType = m_pDefectFormation->m_vecFormation[nFormLabel].m_nFormType; + } + +// if (m_pDefectDisplayOption->m_nShowSize) +// { +// if (pFormation->nSize <= m_pDefectDisplayOption->m_nShowSize) continue; +// } + if (m_pDefectDisplayOption->m_bShowDefectNormal == FALSE) + { + if (nFormType < 0) continue;; + } + if (m_pDefectDisplayOption->m_bShowDefectGroupRound == FALSE) + { + if (nFormType == 0) continue;; + } + if (m_pDefectDisplayOption->m_bShowDefectGroupLine == FALSE) + { + if (nFormType == 1) continue;; + } + if (m_pDefectDisplayOption->m_nShowLabel >= 0) + { + if (nFormLabel != m_pDefectDisplayOption->m_nShowLabel) continue;; + } + } + + rectForm.set( + GetWindowPosX(pFormation->m_dRectLeft), + GetWindowPosY(pFormation->m_dRectTop), + GetWindowPosX(pFormation->m_dRectRight), + GetWindowPosY(pFormation->m_dRectBottom) + ); + + rectForm.NormalizeRect(); + rectForm.InflateRect(4, 4, 5, 5); + + if (rectForm.getCheckAreaIn(GetWindowPosX(nPosX), GetWindowPosY(nPosY))) + { + double dMinDistanceNew = min(abs(GetWindowPosX(nPosX) - rectForm.getCenter()), abs(GetWindowPosY(nPosY) - rectForm.getVCenter())); + + if (pFormationRetrun) + { + if (dMinDistanceNew < dMinDistance) + { + pFormationRetrun = pFormation; + dMinDistance = dMinDistanceNew; + } + + } + else + { + pFormationRetrun = pFormation; + dMinDistance = dMinDistanceNew; + } + + } + } + + return pFormationRetrun; +} + +void CakFormationMap::setSelectDefect(int nDefectID) +{ + for (int i = 0; i < m_pDefectFormation->m_vecDefects.size(); i++) + { + if (m_pDefectFormation->m_vecDefects[i].m_nDefectID == nDefectID) + { + m_pSelectedDefect = &m_pDefectFormation->m_vecDefects[i]; + break; + } + } + ReDraw(false); +} + +void CakFormationMap::setSelectForm(int nFormID) +{ + for (int i = 0; i < m_pDefectFormation->m_vecFormation.size(); i++) + { + if (m_pDefectFormation->m_vecFormation[i].m_nFormLabel == nFormID) + { + m_pSelectedFormation = &m_pDefectFormation->m_vecFormation[i]; + break; + } + } + ReDraw(false); +} +void CakFormationMap::renderGlass(CDC* pDC) +{ + double nGlassSizeX = m_dGlassSizeWidth; + double nGlassSizeY = m_dGlassSizeHeight; + + + CBrush BrushGlass, *pOldBrush; + BrushGlass.CreateSolidBrush(RGB(255,255,255)); + + + CakRectd rectGlass; + rectGlass.set(0, 0, nGlassSizeX, nGlassSizeY); + rectGlass.MoveToXY(-nGlassSizeX / 2, -nGlassSizeY / 2); + + //글라스 외각선 그리기 태현[2016/3/23] + { + pOldBrush = (CBrush*)pDC->SelectObject(&BrushGlass); + CPen pen; + pen.CreatePen(PS_SOLID, 1, RGB(64, 191, 79)); + pDC->SelectObject(&pen); + + pDC->MoveTo(GetWindowPosX(rectGlass.left), GetWindowPosY(rectGlass.top)); + pDC->LineTo(GetWindowPosX(rectGlass.right), GetWindowPosY(rectGlass.top)); + pDC->LineTo(GetWindowPosX(rectGlass.right), GetWindowPosY(rectGlass.bottom)); + pDC->LineTo(GetWindowPosX(rectGlass.left), GetWindowPosY(rectGlass.bottom)); + pDC->LineTo(GetWindowPosX(rectGlass.left), GetWindowPosY(rectGlass.top)); + + pDC->SelectObject(&pOldBrush); + } +} + +void CakFormationMap::renderCell(CDC* pDC) +{ + if (m_vecCellRect.empty() || m_bShowCell == FALSE) return; + + CBrush BrushGlass, *pOldBrush; + BrushGlass.CreateSolidBrush(RGB(225, 225, 225)); + + pOldBrush = (CBrush*)pDC->SelectObject(&BrushGlass); + CPen pen; + pen.CreatePen(PS_SOLID, 1, RGB(242, 104, 13)); + pDC->SelectObject(&pen); + + CakRectd rectCell; + // + for(int i=0; i<m_vecCellRect.size(); i++) + { + rectCell = m_vecCellRect[i]; + + + pDC->MoveTo(GetWindowPosX(rectCell.left), GetWindowPosY(rectCell.top)); + pDC->LineTo(GetWindowPosX(rectCell.right), GetWindowPosY(rectCell.top)); + pDC->LineTo(GetWindowPosX(rectCell.right), GetWindowPosY(rectCell.bottom)); + pDC->LineTo(GetWindowPosX(rectCell.left), GetWindowPosY(rectCell.bottom)); + pDC->LineTo(GetWindowPosX(rectCell.left), GetWindowPosY(rectCell.top)); + + + } + + pDC->SelectObject(&pOldBrush); +} + +void CakFormationMap::renderDefects(CDC* pDC) +{ + if (m_pDefectFormation == NULL) return; + + CBrush BrushDefect, *pOldBrush; + CPen PenDefect, *pOldPen; + CBrush BrushRoundForm; + CBrush BrushLineForm; + CBrush BrushFiltered; + PenDefect.CreatePen(PS_SOLID, 1, RGB(50, 50, 50)); + BrushDefect.CreateSolidBrush(RGB(96, 159, 255)); + + BrushRoundForm.CreateSolidBrush(RGB(234, 43, 36)); + BrushLineForm.CreateSolidBrush(RGB(70, 161, 70)); + BrushFiltered.CreateSolidBrush(RGB(200,200,200)); + pOldPen = pDC->SelectObject(&PenDefect); + pOldBrush = pDC->SelectObject(&BrushDefect); + + if(m_bShowDefectOutLine == FALSE) pDC->SelectStockObject(NULL_PEN); + + CakRectd rectDefect; + rectDefect.set(0, 0, 5, 5); + + for (int i = 0; i < m_pDefectFormation->m_vecDefects.size(); i++) + { + _akDefect* pDefect = &m_pDefectFormation->m_vecDefects[i]; + + rectDefect.set(GetWindowPosX(pDefect->dPositionX), GetWindowPosY(pDefect->dPositionY), + GetWindowPosX(pDefect->dPositionX), GetWindowPosY(pDefect->dPositionY)); + rectDefect.InflateRect(3, 3, 3, 3); + + if (m_pDefectDisplayOption->m_nShowSize) + { + if(pDefect->nSize <= m_pDefectDisplayOption->m_nShowSize) continue; + } + if (m_pDefectDisplayOption->m_nShowLabel >= 0) + { + if(pDefect->nLabel != m_pDefectDisplayOption->m_nShowLabel) continue; + } + if (m_pDefectDisplayOption->m_bShowNoFilteredDefect == TRUE) + { + if (pDefect->nFilter == 1) continue; + } + if (pDefect->nLabel < 0) + { + if (m_pDefectDisplayOption->m_bShowDefectNormal) + { + pDC->SelectObject(&BrushDefect); + if (pDefect->nFilter == 1) pDC->SelectObject(&BrushFiltered); + pDC->Rectangle(rectDefect.left, rectDefect.top, rectDefect.right, rectDefect.bottom); + + } + + } + else + { + pDC->SelectObject(&BrushDefect); + int nFormType = 0; + nFormType = m_pDefectFormation->m_vecFormation[pDefect->nLabel].m_nFormType; + if (nFormType == 0) //일반군집 [김태현2021/2/16] + { + if (m_pDefectDisplayOption->m_bShowDefectGroupRound) + { + pDC->SelectObject(&BrushRoundForm); + if(m_bShowDefectColorType) pDC->SelectObject(&BrushDefect); + if(pDefect->nFilter==1) pDC->SelectObject(&BrushFiltered); + pDC->Rectangle(rectDefect.left, rectDefect.top, rectDefect.right, rectDefect.bottom); + } + + } + else if (nFormType == 1) //라인군입 [김태현2021/2/16] + { + if (m_pDefectDisplayOption->m_bShowDefectGroupLine) + { + pDC->SelectObject(&BrushLineForm); + if (m_bShowDefectColorType) pDC->SelectObject(&BrushDefect); + if (pDefect->nFilter == 1) pDC->SelectObject(&BrushFiltered); + pDC->Rectangle(rectDefect.left, rectDefect.top, rectDefect.right, rectDefect.bottom); + } + + } + } + + } + + if (m_bShowGroupIndex) + { + CString strLabel; + pDC->SetTextColor(RGB(111, 0, 138)); + pDC->SetTextAlign(TA_BASELINE | TA_CENTER); + + for (int k = 0; k < m_pDefectFormation->m_vecFormation.size(); k++) + { + _akFormation* pFormation = &m_pDefectFormation->m_vecFormation[k]; + + for (int i = 0; i < pFormation->m_vecForms.size(); i++) + { + _akDefect* pDefect = pFormation->m_vecForms[i]; + if (pDefect->nLabel >= 0) + { + strLabel.Format("%d", pDefect->nLabel); + pDC->TextOut(GetWindowPosX(pDefect->dPositionX), GetWindowPosY(pDefect->dPositionY), strLabel); + } + } + } + + } + + pDC->SelectObject(pOldPen); + pDC->SelectObject(pOldBrush); + +} + +void CakFormationMap::renderDefectsPath(CDC* pDC) +{ + if (!m_pDefectFormation) return; + + if (m_pDefectFormation->m_vecDefects.size() == 0) return; + + int nStartPosX, nStartPosY, nEndPosX, nEndPosY; + + CPen pathPen; + CPen *pOldPen = NULL; + + pathPen.CreatePen(PS_DOT, 1, RGB(0, 0, 255)); + + CakRectd rectDefectPath; + + //전체에서 모듈 순서 확인 해서 정렬 + //모듈 순서에서 short 순서에 따라 정렬 + //순서대로 넣어 준다. + m_pDefectFormation->m_vecPath1.clear(); + m_pDefectFormation->m_vecPath2.clear(); + m_pDefectFormation->m_vecPath3.clear(); + m_pDefectFormation->m_vecPath4.clear(); + m_pDefectFormation->m_vecPath5.clear(); + m_pDefectFormation->m_vecPath6.clear(); + + //short index 순서 대로 가져 오면 되는 거 아닌가? + //분류 작업을 해야 한다 + for (int i = 0; i < m_pDefectFormation->m_vecDefects.size(); i++) + { + //1, 모듈 순서에 따라서 정렬 해 보자 + _akDefect* pDefect = &m_pDefectFormation->m_vecDefects[i]; + //_akDefect* pDefect1 = &m_pDefectFormation->m_vecPath1[i]; + + if (pDefect->m_nModelIdx == 0) + { + m_pDefectFormation->m_vecPath1.push_back(m_pDefectFormation->m_vecDefects[i]); + } + else if (pDefect->m_nModelIdx == 1) + { + m_pDefectFormation->m_vecPath2.push_back(m_pDefectFormation->m_vecDefects[i]); + } + else if (pDefect->m_nModelIdx == 2) + { + m_pDefectFormation->m_vecPath3.push_back(m_pDefectFormation->m_vecDefects[i]); + } + else if (pDefect->m_nModelIdx == 3) + { + m_pDefectFormation->m_vecPath4.push_back(m_pDefectFormation->m_vecDefects[i]); + } + else if (pDefect->m_nModelIdx == 4) + { + m_pDefectFormation->m_vecPath5.push_back(m_pDefectFormation->m_vecDefects[i]); + } + else if (pDefect->m_nModelIdx == 5) + { + m_pDefectFormation->m_vecPath6.push_back(m_pDefectFormation->m_vecDefects[i]); + } + } + + //분류 작업이 완료 되면 모듈 갯수 만큼 다시 sort 후 순서대로 그린다 + int nS = 0, nS2 = 0, nS3 = 0, nS4 = 0, nS5=0, nS6 = 0; + + bool bNext = false, bNext2 = false; + + for (int i = 0; i < m_pDefectFormation->m_vecPath1.size(); i++) + { + //모듈에 들어 있는 값을 sort 하자 + //sort한 것을 그린다. + bNext = false, bNext2 = false; + int nStart = -1, nEnd = -1; + + for (int j = 0; j < m_pDefectFormation->m_vecPath1.size(); j++) + { + _akDefect* pDefect1 = &m_pDefectFormation->m_vecPath1[j]; + + if (pDefect1->m_nShotIdx == nS) + { + nStart = j; + bNext = true; + } + else if (pDefect1->m_nShotIdx == nS + 1) + { + nEnd = j; + bNext2 = true; + } + else if (bNext == true && bNext2 == true) + { + break; + } + else + { + continue; + } + } + + if (bNext == true && bNext2 == true) + { + nS++; + } + + if (nStart == -1) return; + if (nEnd == -1) nEnd = nStart; + + _akDefect* pDefectStart = &m_pDefectFormation->m_vecPath1[nStart]; + _akDefect* pDefectEnd = &m_pDefectFormation->m_vecPath1[nEnd]; + + pDC->MoveTo(GetWindowPosX(pDefectStart->dPositionX), GetWindowPosY(pDefectStart->dPositionY)); + pDC->LineTo(GetWindowPosX(pDefectEnd->dPositionX), GetWindowPosY(pDefectEnd->dPositionY)); + } + + bool bNext3 = false, bNext4 = false; + + for (int i = 0; i < m_pDefectFormation->m_vecPath2.size(); i++) + { + int nStart = -1, nEnd = -1; + bNext3 = false, bNext4 = false; + + for (int j = 0; j < m_pDefectFormation->m_vecPath2.size(); j++) + { + _akDefect* pDefect2 = &m_pDefectFormation->m_vecPath2[j]; + + if (pDefect2->m_nShotIdx == nS2) + { + nStart = j; + bNext3 = true; + } + else if (pDefect2->m_nShotIdx == nS2 + 1) + { + nEnd = j; + bNext4 = true; + } + else if (bNext3 == true && bNext4 == true) + { + break; + } + else + { + continue; + } + } + + if (bNext3 == true && bNext4 == true) + { + nS2++; + } + if (nStart == -1) return; + if (nEnd == -1) nEnd = nStart; + + _akDefect* pDefectStart = &m_pDefectFormation->m_vecPath2[nStart]; + _akDefect* pDefectEnd = &m_pDefectFormation->m_vecPath2[nEnd]; + + pDC->MoveTo(GetWindowPosX(pDefectStart->dPositionX), GetWindowPosY(pDefectStart->dPositionY)); + pDC->LineTo(GetWindowPosX(pDefectEnd->dPositionX), GetWindowPosY(pDefectEnd->dPositionY)); + } + + bool bNext5 = false, bNext6 = false; + + for (int i = 0; i < m_pDefectFormation->m_vecPath3.size(); i++) + { + int nStart = -1, nEnd = -1; + bNext5 = false, bNext6 = false; + + for (int j = 0; j < m_pDefectFormation->m_vecPath3.size(); j++) + { + _akDefect* pDefect3 = &m_pDefectFormation->m_vecPath3[j]; + + if (pDefect3->m_nShotIdx == nS3) + { + nStart = j; + bNext5 = true; + } + else if (pDefect3->m_nShotIdx == nS3 + 1) + { + nEnd = j; + bNext6 = true; + } + else if (bNext5 == true && bNext6 == true) + { + break; + } + else + { + continue; + } + } + + + //sort한 것을 그린다. + if (bNext5 == true && bNext6 == true) + { + nS3++; + } + if (nStart == -1) return; + if (nEnd == -1) nEnd = nStart; + + _akDefect* pDefectStart = &m_pDefectFormation->m_vecPath3[nStart]; + _akDefect* pDefectEnd = &m_pDefectFormation->m_vecPath3[nEnd]; + + pDC->MoveTo(GetWindowPosX(pDefectStart->dPositionX), GetWindowPosY(pDefectStart->dPositionY)); + pDC->LineTo(GetWindowPosX(pDefectEnd->dPositionX), GetWindowPosY(pDefectEnd->dPositionY)); + } + + bool bNext7 = false, bNext8 = false; + + for (int i = 0; i < m_pDefectFormation->m_vecPath4.size(); i++) + { + int nStart = -1, nEnd = -1; + bNext7 = false, bNext8 = false; + + for (int j = 0; j < m_pDefectFormation->m_vecPath4.size(); j++) + { + _akDefect* pDefect4 = &m_pDefectFormation->m_vecPath4[j]; + + if (pDefect4->m_nShotIdx == nS4) + { + nStart = j; + bNext7 = true; + } + else if (pDefect4->m_nShotIdx == nS4 + 1) + { + nEnd = j; + bNext8 = true; + } + else if (bNext7 == true && bNext8 == true) + { + break; + } + else + { + continue; + } + } + + if (bNext7 == true && bNext8 == true) + { + nS4++; + } + if (nStart == -1) return; + if (nEnd == -1) nEnd = nStart; + + _akDefect* pDefectStart = &m_pDefectFormation->m_vecPath4[nStart]; + _akDefect* pDefectEnd = &m_pDefectFormation->m_vecPath4[nEnd]; + + pDC->MoveTo(GetWindowPosX(pDefectStart->dPositionX), GetWindowPosY(pDefectStart->dPositionY)); + pDC->LineTo(GetWindowPosX(pDefectEnd->dPositionX), GetWindowPosY(pDefectEnd->dPositionY)); + } + + bool bNext9 = false, bNext10 = false; + + for (int i = 0; i < m_pDefectFormation->m_vecPath5.size(); i++) + { + int nStart = -1, nEnd = -1; + bNext9 = false, bNext10 = false; + for (int j = 0; j < m_pDefectFormation->m_vecPath5.size(); j++) + { + _akDefect* pDefect5 = &m_pDefectFormation->m_vecPath5[j]; + + if (pDefect5->m_nShotIdx == nS5) + { + nStart = j; + bNext9 = true; + } + else if (pDefect5->m_nShotIdx == nS5 + 1) + { + nEnd = j; + bNext10 = true; + } + else if (bNext9 == true && bNext10 == true) + { + break; + } + else + { + continue; + } + } + + if (bNext9 == true && bNext10 == true) + { + nS5++; + } + if (nStart == -1) return; + if (nEnd == -1) nEnd = nStart; + + _akDefect* pDefectStart = &m_pDefectFormation->m_vecPath5[nStart]; + _akDefect* pDefectEnd = &m_pDefectFormation->m_vecPath5[nEnd]; + + pDC->MoveTo(GetWindowPosX(pDefectStart->dPositionX), GetWindowPosY(pDefectStart->dPositionY)); + pDC->LineTo(GetWindowPosX(pDefectEnd->dPositionX), GetWindowPosY(pDefectEnd->dPositionY)); + } + + bool bNext11 = false, bNext12 = false; + + for (int i = 0; i < m_pDefectFormation->m_vecPath6.size(); i++) + { + int nStart = -1, nEnd = -1; + bNext11 = false, bNext12 = false; + + for (int j = 0; j < m_pDefectFormation->m_vecPath6.size(); j++) + { + _akDefect* pDefect6 = &m_pDefectFormation->m_vecPath6[j]; + + if (pDefect6->m_nShotIdx == nS6) + { + nStart = j; + bNext11 = true; + } + else if (pDefect6->m_nShotIdx == nS6 + 1) + { + nEnd = j; + bNext12 = true; + } + else if (bNext11 == true && bNext12 == true) + { + break; + } + else + { + continue; + } + } + + if (bNext11 == true && bNext12 == true) + { + nS6++; + } + if (nStart == -1) return; + if (nEnd == -1) nEnd = nStart; + + _akDefect* pDefectStart = &m_pDefectFormation->m_vecPath6[nStart]; + _akDefect* pDefectEnd = &m_pDefectFormation->m_vecPath6[nEnd]; + + pDC->MoveTo(GetWindowPosX(pDefectStart->dPositionX), GetWindowPosY(pDefectStart->dPositionY)); + pDC->LineTo(GetWindowPosX(pDefectEnd->dPositionX), GetWindowPosY(pDefectEnd->dPositionY)); + } + +/* SortingtoMoudle();*/ + +/* _akDefect* pDefect = &m_pDefectFormation->m_vecDefects[i];*/ + + //pDefect->m_nShotIdx 1 인것과 2인 것을 찾아서 1인 것은 start 2인것은 end 네? + + //m_nshortidx 에 모듈이 먼지를 알아야 겠네? pDefect->m_nModelIdx 이걸로 알 수 있네? + //m_nShortidx 에 시작은 있고 끝이 없다면 종료 + +// if (pDefect->m_nShotIdx == i) +// { +// pDC->MoveTo(GetWindowPosX(rectDefectPath.left), GetWindowPosY(rectDefectPath.top)); +// pDC->LineTo(GetWindowPosX(rectDefectPath.right), GetWindowPosY(rectDefectPath.top)); +// +// //pDC->MoveTo(nStartPosX, nStartPosY); +// //pDC->LineTo(nEndPosX, nEndPosY); +// } +// } + + +// for (constVectorReviewResultIt it = pVecReviewResult->begin(); it != pVecReviewResult->end(); it++) +// { +// const CReviewResult *pReviewResult = static_cast<const CReviewResult*>(&(*it)); +// +// constVectorSReviewResultIt itt; +// constVectorSReviewResultIt ittEnd; +// if (pReviewResult->GetSReviewResultCount() > 0) +// { +// itt = pReviewResult->m_vecSReviewResult.begin(); +// ittEnd = pReviewResult->m_vecSReviewResult.end(); +// } +// else +// { +// continue; +// } +// const SReviewResult *pSReviewResult = static_cast<const SReviewResult*>(&(*itt)); +// int nDraw = FilterDefectPos(m_pDefectFilter, pSReviewResult); +// if (nDraw < 0) +// { +// continue; +// } +// +// // select path pen +// pOldPen = pDC->SelectObject(&pathPen); +// for (constVectorSReviewResultIt its = pReviewResult->m_vecSReviewResult.begin(); its != pReviewResult->m_vecSReviewResult.end(); its++) +// { +// if (itt + 1 != ittEnd) +// { +// itt++; +// nStartPosX = its->nUMOriginX; +// nStartPosY = its->nUMOriginY; +// nEndPosX = itt->nUMOriginX; +// nEndPosY = itt->nUMOriginY; +// TransformGlass2Map(nStartPosX, nStartPosY); +// TransformGlass2Map(nEndPosX, nEndPosY); +// //모터 좌표를 글라스 좌표로 변환 해야 함 +// pDC->MoveTo(nStartPosX, nStartPosY); +// pDC->LineTo(nEndPosX, nEndPosY); +// } +// } +// } + + pDC->SelectObject(pOldPen); +} + +void CakFormationMap::renderFormations(CDC* pDC) +{ + if (m_pDefectFormation == NULL) return; + if (m_bShowGroupLine == FALSE) return; + + CPen PenDefect, *pOldPen; + + CPen PenDefectLine; + PenDefect.CreatePen(PS_SOLID, 1, RGB(234, 43, 36)); + PenDefectLine.CreatePen(PS_SOLID, 1, RGB(50, 153, 50)); + + pOldPen = pDC->SelectObject(&PenDefect); + pDC->SelectStockObject(NULL_BRUSH); + + CakRectd rectForm; + + for (int i = 0; i < m_pDefectFormation->m_vecFormation.size(); i++) + { + _akFormation* pForm = &m_pDefectFormation->m_vecFormation[i]; + + if (m_pDefectDisplayOption->m_nShowLabel >= 0) + { + if (i != m_pDefectDisplayOption->m_nShowLabel) continue; + } + + rectForm.set( + GetWindowPosX(pForm->m_dRectLeft), + GetWindowPosY(pForm->m_dRectTop), + GetWindowPosX(pForm->m_dRectRight), + GetWindowPosY(pForm->m_dRectBottom) + ); + + rectForm.NormalizeRect(); + rectForm.InflateRect(4, 4, 5, 5); + + if (pForm->m_nFormType == 1) pDC->SelectObject(&PenDefectLine); + else pDC->SelectObject(&PenDefect); + + pDC->Rectangle(rectForm.left, rectForm.top, rectForm.right, rectForm.bottom); + + } + + + + + pDC->SelectObject(pOldPen); +} + +void CakFormationMap::renderMouseoverInfos(CDC* pDC) +{ + + pDC->SelectObject(m_AxisX.m_Font); + + if(m_pSelectedDefect) + { + _akDefect* pDefect = m_pSelectedDefect; + + CakRectd rectDefect; + rectDefect.set(GetWindowPosX(pDefect->dPositionX), GetWindowPosY(pDefect->dPositionY), + GetWindowPosX(pDefect->dPositionX), GetWindowPosY(pDefect->dPositionY)); + if(m_bShowDefectOutLine) rectDefect.InflateRect(5, 5, 5, 5); + else rectDefect.InflateRect(5, 5, 5-1, 5-1); + + CPen PenDefect, *pOldPen; + PenDefect.CreatePen(PS_SOLID, 1, RGB(24, 24, 192)); + pDC->SelectStockObject(NULL_BRUSH); + pOldPen = pDC->SelectObject(&PenDefect); + + pDC->Rectangle(rectDefect.left, rectDefect.top, rectDefect.right, rectDefect.bottom); + rectDefect.InflateRect(-1,-1,-1,-1); + pDC->Rectangle(rectDefect.left, rectDefect.top, rectDefect.right, rectDefect.bottom); + + + + pDC->SelectObject(pOldPen); + } + + if (m_pMouseOveredDefect) + { + _akDefect* pDefect = m_pMouseOveredDefect; + + CakRectd rectDefect; + rectDefect.set(GetWindowPosX(pDefect->dPositionX), GetWindowPosY(pDefect->dPositionY), + GetWindowPosX(pDefect->dPositionX), GetWindowPosY(pDefect->dPositionY)); + if (m_bShowDefectOutLine) rectDefect.InflateRect(5, 5, 5, 5); + else rectDefect.InflateRect(5, 5, 5 - 1, 5 - 1); + + CPen PenDefect, *pOldPen; + PenDefect.CreatePen(PS_SOLID, 1, RGB(192, 24, 24)); + pDC->SelectStockObject(NULL_BRUSH); + pOldPen = pDC->SelectObject(&PenDefect); + + pDC->Rectangle(rectDefect.left, rectDefect.top, rectDefect.right, rectDefect.bottom); + + pDC->SelectObject(pOldPen); + + CString strDefectInfo; + COLORREF cl; + cl = RGB(0, 0, 0); + + pDC->SetTextAlign(TA_LEFT | TA_BASELINE); + pDC->SetTextColor(cl); + strDefectInfo.Format("%dCam %dSCan, %d : %.3lf, %.3lf ", m_pMouseOveredDefect->m_nCameraID, m_pMouseOveredDefect->m_nScanIdx, m_pMouseOveredDefect->m_nDefectID, m_pMouseOveredDefect->dPositionX, m_pMouseOveredDefect->dPositionY); + pDC->TextOut(GetWindowPosX(m_pMouseOveredDefect->dPositionX)+5, GetWindowPosY(m_pMouseOveredDefect->dPositionY)+3, strDefectInfo); + + } + if (m_pSelectedFormation) + { + _akFormation* pFormation = m_pSelectedFormation; + + int nFormLabel = -1; + if (pFormation && !pFormation->m_vecForms.empty()) + { + nFormLabel = pFormation->m_vecForms[0]->nLabel; + } + CakRectd rectForm; + + rectForm.set( + GetWindowPosX(pFormation->m_dRectLeft), + GetWindowPosY(pFormation->m_dRectTop), + GetWindowPosX(pFormation->m_dRectRight), + GetWindowPosY(pFormation->m_dRectBottom) + ); + + rectForm.NormalizeRect(); + rectForm.InflateRect(4, 4, 5, 5); + rectForm.InflateRect(-1, -1, -1, -1); + + CPen PenDefect, *pOldPen; + //PenDefect.CreatePen(PS_SOLID, 1, RGB(192, 192, 24)); + + //if(pFormation->m_nFormType == 0) PenDefect.CreatePen(PS_DOT, 1, RGB(234, 43, 36)); + //else if (pFormation->m_nFormType == 1) PenDefect.CreatePen(PS_DOT, 1, RGB(50, 153, 50)); + + PenDefect.CreatePen(PS_DOT, 1, RGB(24, 24, 192)); + pDC->SelectStockObject(NULL_BRUSH); + pOldPen = pDC->SelectObject(&PenDefect); + + pDC->Rectangle(rectForm.left, rectForm.top, rectForm.right, rectForm.bottom); + + //text + { + CString strDefectInfo; + pDC->SetTextAlign(TA_LEFT | TA_BOTTOM); + CString strFormType = "ROUND"; + if (pFormation->m_nFormType == 1) strFormType = "LINE"; + + strDefectInfo.Format("FORM %d, %s", nFormLabel, strFormType); + + pDC->SetBkMode(OPAQUE); + pDC->SetBkColor(RGB(0, 255, 0)); + pDC->SetTextColor(RGB(0, 0, 0)); + pDC->SelectObject(m_AxisX.m_Font); + pDC->TextOut(rectForm.left, rectForm.top, strDefectInfo); + pDC->SetBkMode(TRANSPARENT); + } + } + if (m_pMouseOveredFormation) + { + _akFormation* pFormation = m_pMouseOveredFormation; + + int nFormLabel = -1; + if (pFormation && !pFormation->m_vecForms.empty()) + { + nFormLabel = pFormation->m_vecForms[0]->nLabel; + } + CakRectd rectForm; + + rectForm.set( + GetWindowPosX(pFormation->m_dRectLeft), + GetWindowPosY(pFormation->m_dRectTop), + GetWindowPosX(pFormation->m_dRectRight), + GetWindowPosY(pFormation->m_dRectBottom) + ); + + rectForm.NormalizeRect(); + rectForm.InflateRect(4, 4, 5, 5); + rectForm.InflateRect(1, 1, 1, 1); + + CPen PenDefect, *pOldPen; + PenDefect.CreatePen(PS_SOLID, 1, RGB(192, 192, 24)); + pDC->SelectStockObject(NULL_BRUSH); + pOldPen = pDC->SelectObject(&PenDefect); + + pDC->Rectangle(rectForm.left, rectForm.top, rectForm.right, rectForm.bottom); + + pDC->SelectObject(pOldPen); + + CString strDefectInfo; + pDC->SetTextAlign(TA_LEFT | TA_BOTTOM); + CString strFormType = "ROUND"; + if(pFormation->m_nFormType == 1) strFormType = "LINE"; + + strDefectInfo.Format("FORM %d, %s", nFormLabel, strFormType); + + pDC->SetBkMode(OPAQUE); + pDC->SetBkColor(RGB(0, 255, 0)); + pDC->SetTextColor(RGB(0, 0, 0)); + pDC->SelectObject(m_AxisX.m_Font); + pDC->TextOut(rectForm.left, rectForm.top, strDefectInfo); + pDC->SetBkMode(TRANSPARENT); + + } +} + +void CakFormationMap::AddCellData() +{ + CakRectd akCellTemp; + m_vecTempCellRect.push_back(akCellTemp); +} + +void CakFormationMap::AddCell() +{ + CakRectd akCellTemp; + m_vecCellRect.push_back(akCellTemp); +} + +void CakFormationMap::RenderEnd(Graphics* grfx, CDC* pDC) +{ + + CRgn rgn; + CRect rectROI = CakRectToCRect(m_rectData); + rgn.CreateRectRgnIndirect(&rectROI); + pDC->SelectClipRgn(&rgn); + + renderMouseoverInfos(pDC); + + pDC->SelectClipRgn(NULL); + + CakGraphBasic3::RenderEnd(grfx, pDC); +} \ No newline at end of file -- Gitblit v1.9.3