#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);
|
}
|