SDC C-Project CF Review 프로그램
SWK
2023-03-10 5ce2e7ca14f09da2138ea783ef16044a01423413
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// DlgResultGraph.cpp : ±¸Çö ÆÄÀÏÀÔ´Ï´Ù.
//
 
#include "stdafx.h"
#include "DlgResultGraph.h"
#include "afxdialogex.h"
#include "CHReviewResult/ReviewResult.h"
#include "CHEdgeTriangle/RecipeFormula.h"
 
 
// CDlgResultGraph ´ëÈ­ »óÀÚÀÔ´Ï´Ù.
 
IMPLEMENT_DYNAMIC(CDlgResultGraph, CDialog)
 
CDlgResultGraph::CDlgResultGraph(CWnd* pParent /*=NULL*/)
    : CDialog(CDlgResultGraph::IDD, pParent)
{
    m_nGraphMode = 1;
    nGlassIndex = 0;
    nGlassID = 0;
    temp = 0;
    nMode = 1;
 
}
 
CDlgResultGraph::~CDlgResultGraph()
{
 
}
 
void CDlgResultGraph::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_STATIC_GRAPH_VIEW, m_ctrlGraphView);
}
 
 
BEGIN_MESSAGE_MAP(CDlgResultGraph, CDialog)
    ON_WM_SIZE()
END_MESSAGE_MAP()
 
void CDlgResultGraph::DrawMeasureGraph(int nType, CGlassResult* pGlassResult)
{
 
// 
//     SReviewResult b;
//     CReviewResult c;
// 
//     b.vecMeasure_ResultData[0].m_dResultValue = rand() % 10;
//     b.vecMeasure_ResultData[1].m_dResultValue = rand() % 10;
//     c.AddSReviewResult(b);
//     c.SetModuleIndex(0);
// 
//     CGlassResult pGlassResult2;
//     pGlassResult2.AddMeasureResult(c);
 
    a.SetChartGlassData(1,nGlassIndex,pGlassResult);
    if(nType)
        UpdateGraphView(nType);
    else
        UpdateGraphView(nType);
    nGlassIndex++;
    a.MoveChartData(nGlassIndex);
}
 
BOOL CDlgResultGraph::OnInitDialog()
{
    CDialog::OnInitDialog();
 
    InitGlassGraph();
 
    return TRUE;  // return TRUE unless you set the focus to a control
 
}
 
void CDlgResultGraph::InitGlassGraph()
{
    CChartGlassData::Reset();
 
    CRect rect;
    m_ctrlGraphView.GetClientRect(rect);
 
    XYChart* pChart = new XYChart(rect.Width(), rect.Height(), 0xf8daa9, 0x000000, 1);
    if (pChart != NULL)
    {
//         CRect rtGraphGab(50,30,20,30); // gab
//         CRect areaRect(rtGraphGab.left, rtGraphGab.top, rect.Width()-rtGraphGab.right, rect.Height()-rtGraphGab.bottom);
//         pChart->setPlotArea(areaRect.left, areaRect.top, areaRect.Width(), areaRect.Height(), 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
//         pChart->addLegend(areaRect.left, 2, false, "arialbd.ttf", 9)->setBackground(Chart::Transparent);
 
        int nLineWidthX = 2;
        int nLineWidthY = 2;
 
        char strValue[MAX_STR_LEN];
        switch(m_nGraphMode)
        {
        case 0:
            sprintf_s(strValue, MAX_STR_LEN, "Defect Count(ea)");
            break;
        case 1:
            sprintf_s(strValue, MAX_STR_LEN, "Measure Result(um)");
            break;
        }
 
        pChart->yAxis()->setAutoScale();
        pChart->yAxis()->setLabelFormat("{value}");
        pChart->yAxis()->setTitle(strValue, "arialbd.ttf", 9);
        pChart->yAxis()->setWidth(nLineWidthY);
 
        pChart->xAxis()->setAutoScale();
        pChart->xAxis()->setTitle("Glass ID", "arialbd.ttf", 9);
        pChart->xAxis()->setDateScale(0, double(m_nGlassCount));
        pChart->xAxis()->setLabelStep(5);
        pChart->xAxis()->setWidth(nLineWidthX);
 
        m_ctrlGraphView.setChart(pChart);
    
        delete pChart;
    }
}
 
void CDlgResultGraph::UpdateGraphView(int nType)
{
    // graph update
    CRect rect;
    m_ctrlGraphView.GetClientRect(rect);
    const char *imageMap = 0;
    int nListCnt = nGlassIndex;
    BaseChart *chart = NULL;
    if(nType)
        chart = a.CreateChart(m_nGraphMode, nListCnt, &imageMap, rect, nType);
    else
        chart = a.CreateChart(m_nGraphMode, nListCnt, &imageMap, rect, nType);
 
    if (chart!=NULL)
    {
        m_ctrlGraphView.setChart(chart);
        m_ctrlGraphView.setImageMap(imageMap);
    }
    //nGlassIndex++;
    delete chart;
}
 
void CDlgResultGraph::OnSize(UINT nType, int cx, int cy)
{
    CDialog::OnSize(nType, cx, cy);
    
    if (m_ctrlGraphView.GetSafeHwnd())
    {
        m_ctrlGraphView.SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER);
        if(nMode)
            UpdateGraphView(Graph_Dy);
        else
            UpdateGraphView(Graph_Dx);
    }
}