SDC C-Project CF Review 프로그램
LYW
2021-08-25 03152a241b9463c582b56896f5f5f73717497ab4
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
#pragma once
 
#include <vector>
#include "CHCommonClasses/MacroFile.h"
 
#define MAX_WSI_RESULT_COUNT        12
#define MAX_WSI_REFLOW_RESULT_COUNT    20
 
enum WSIReflowResultInfo        {    WsiReflow_AZoneJudge=0, 
    WsiReflow_BZoneJudge, 
    WsiReflow_CZoneJudge,                                         
    WsiReflow_DZoneJudge,
    WsiReflowInfo_EZoneJudge,
    WsiReflowInfo_FZoneJudge,
    WsiReflow_PointIndex, 
    WsiReflow_Result_Info_Count };
 
enum WsiMessageType    { WMT_MeasureReady=0, WMT_MeasureStart, WMT_MeasureMotionEnd, WMT_MeasureEnd, WMT_MeasureTimeout };
enum WsiDirType        { WsiDirType_Left=0, WsiDirType_Top, WsiDirType_Right, WsiDirType_Bottom };
enum WsiMode        { WsiMode_None=0, WsiMode_Wsi, WsiMode_Confocal };
enum WsiMeasureType    { WsiMeasureType_Normal=0, WsiMeasureType_Monomer, WsiMeasureType_User, WsiMeasureType_MultiShot,WsiMeasureType_VLSI};
 
struct SWsiResult
{
    SWsiResult() 
    {
        nGlassType = 0;
        nResultIndex    = -1;
        nResultCode        = 0;
        nResultType        = -1;
        nXSlopeWarn        = 0;
        dDamDistance    = 0.;
        memset(pResultData, 0, sizeof(pResultData));
        memset(pReflowResultData, 0, sizeof(pReflowResultData));
        nDefectType =-1;
        nMultiShot  =-1;
        nCurrentShotNumber = -1;
        bBigSizeDefect=FALSE;
        bObjectType =FALSE;
        fHeight = 0.0f;
        fWidthX = 0.0f;
        fWidthY = 0.0f;
        fAratio = 0.0f;
 
        nDecisionZoneA = -1;
        nDecisionZoneB = -1;
        nDecisionZoneC = -1;
        nDecisionZoneD = -1;
        nDecisionZoneE = -1;
        nDecisionZoneF = -1;
        nDecisionZoneSlotB = -1;
 
        dDistFromRef = 0.;
 
        nJugementR = -1;
        nJugementG = -1;
        nJugementB = -1;
 
        dRZoneHeight = 0.;
        dGZoneHeight = 0.;
        dBZoneHeight = 0.;
 
        dDefectHeight = 0.;
 
        dCSHeight = 0.;
    }
    int            nGlassType; //TFE=0,MN=1,QD=2,BANK=3 CS =4 CSG = 5 
    int            nResultIndex;
    int            nResultCode;
    int            nResultType;
    int            nXSlopeWarn;
    int         nDefectType;
    int            nMultiShot;
    int         nCurrentShotNumber;
    int            nWsiState;
    double        dAccuracy;
    double      dRepeatability;
    double        dDiagnosisHeight[10];
 
    bool        bBigSizeDefect;
    
    float        fHeight;
    float        fWidthX;
    float        fWidthY;
    float        fAratio; //TFE
 
    int            nDecisionZoneA;
    int            nDecisionZoneB;
    int            nDecisionZoneC;
    int            nDecisionZoneD;
    int            nDecisionZoneE;
    int            nDecisionZoneF;
    int            nPointIndex;
    int            nDecisionZoneSlotB; 
 
    double        dDistFromRef; //MN
 
    bool        bObjectType;
    int            nJugementR;
    int            nJugementG;
    int            nJugementB;
    double        dRZoneHeight;
    double        dGZoneHeight;
    double        dBZoneHeight;
    double        dDefectHeight; //QD
 
    double        dCSHeight; //cs
 
 
    double        dDamDistance;
    double        pResultData[MAX_WSI_RESULT_COUNT];
    int            pReflowResultData[MAX_WSI_REFLOW_RESULT_COUNT];
};
typedef std::vector<SWsiResult>                        VectorWsiResult;
typedef std::vector<SWsiResult>::iterator            VectorWsiResultIt;
typedef std::vector<SWsiResult>::const_iterator        constVectorWsiResultIt;
 
struct SDataWsiMeasurement
{
    SDataWsiMeasurement()
    {
        nIndex = 0;
        strCellID = _T("");
        bMeasure = TRUE;
        nDirection1 = WsiDirType_Left;
        nDirection2 = WsiDirType_Bottom;
    }
    int        nIndex;
    CString    strCellID;
    BOOL    bMeasure;
    int        nDirection1;
    int        nDirection2;
};
typedef std::vector<SDataWsiMeasurement>                    VectorDataWsiMeasurement;
typedef std::vector<SDataWsiMeasurement>::iterator            VectorDataWsiMeasurementIt;
typedef std::vector<SDataWsiMeasurement>::const_iterator    constVectorDataWsiMeasurementIt;
 
struct SDataWsiJudge
{
    SDataWsiJudge()
    {
        nHorzPlusWarningMargin = 0;
        nHorzPlusNGMargin = 0;
        nHorzMinusWarningMargin = 0;
        nHorzMinusNGMargin = 0;
 
        nVertPlusWarningMargin = 0;
        nVertPlusNGMargin = 0;
        nVertMinusWarningMargin = 0;
        nVertMinusNGMargin = 0;
    }
 
    // direction top, bottom
    int nHorzPlusWarningMargin;
    int nHorzPlusNGMargin;
    int nHorzMinusWarningMargin;
    int nHorzMinusNGMargin;
 
    // direction left, right
    int nVertPlusWarningMargin;
    int nVertPlusNGMargin;
    int nVertMinusWarningMargin;
    int nVertMinusNGMargin;
};
 
interface IWsiControl2Parnet
{
    virtual void    IWC2P_DisplayMessage(int nIndex, const TCHAR* lpstrFormat, ...) = 0;
    virtual BOOL    IWC2P_SetMeasureInfo(int nIndex, int nPointIndex, const CString& strImagFilename) = 0;
    virtual BOOL    IWC2P_SetMeasureInfo(int nIndex, int nPointIndex, const CString& strImagFilename, const CString& strImagFilename2) = 0;
    virtual BOOL    IWC2P_SetMeasureInfo(int nIndex, int nPointIndex, const CString& strImagFilename, int nWsiType) = 0;
    virtual BOOL    IWC2P_GetMeasureInfo(int nIndex, int nPointIndex, short& nLoc, short& nOptic, short& nGray, CString& strCellID) = 0;
    virtual int        IWC2P_GetCurrentStatus(int nIndex, CString& strGlassID, CString& strRecipeID, int& nType) = 0;
    virtual void    IWC2P_SetConnectedStatus(int nIndex, int nConnectStatus) = 0;
    virtual void    IWC2P_RecvMeasureMessage(int nIndex, int nMessageType, int nMessageResult) = 0;
    virtual void    IWC2P_SetMeasureResult(int nIndex, const SWsiResult& measureResut) = 0;
    virtual void    IWC2P_SetScanEnd(int nIndex, int nPointIndex, int nPositionX, int nPositionY) = 0;
    virtual int        IWC2P_GetWsiType() = 0;
    virtual void    IWC2P_SetWSIErrorCheck(int nIndex,CString strAlarmMessage)= 0;
    virtual void    IWC2P_SetWSIAliveCheck()= 0;
};
 
class CWsiControlInfo
{
public:
    CWsiControlInfo(int nIndex=0) : m_nIndex(nIndex)            { Reset(); }
    ~CWsiControlInfo(void)                                        { Reset(); }
    void Reset()
    {
        m_strName            = _T("");
        m_nControllerType    = 0;
        m_strConnectionPort = _T("");
        m_nMode                = WsiMode_None;
        m_dOffsetX            = 0.0;
        m_dOffsetY            = 0.0;
        m_dWSIFOVX          = 0.0;
        m_dWSIFOVY          = 0.0;
        m_dWSISCANDIR       = 0;
 
        m_vecDataWsiMeasurement.clear();
    }
 
    BOOL LoadInfo(CMacroFile* pFile, const CString& strItemName)
    {
        if (pFile==NULL) return FALSE;
        CString strValue = _T("");
 
        strValue = strItemName + _T("_INDEX");
        pFile->GetItem(strValue, m_nIndex, 0);
 
        strValue = strItemName + _T("_NAME");
        pFile->GetItem(strValue, m_strName, _T(""));
 
        strValue = strItemName + _T("_CONTROL_TYPE");
        pFile->GetItem(strValue, m_nControllerType, 0);
 
        strValue = strItemName + _T("_CONNECT_PORT");
        pFile->GetItem(strValue, m_strConnectionPort, _T(""));
 
        strValue = strItemName + _T("_MODE");
        pFile->GetItem(strValue, m_nMode, 0);
 
        strValue = strItemName + _T("_OFFSET_X");
        pFile->GetItem(strValue, m_dOffsetX, 0.0);
 
        strValue = strItemName + _T("_OFFSET_Y");
        pFile->GetItem(strValue, m_dOffsetY, 0.0);
 
        strValue = strItemName + _T("_FOV_X");
        pFile->GetItem(strValue, m_dWSIFOVX, 0.0);
 
        strValue = strItemName + _T("_FOV_Y");
        pFile->GetItem(strValue, m_dWSIFOVY, 0.0);
 
        strValue = strItemName + _T("_SCAN_DIR");
        pFile->GetItem(strValue, m_dWSISCANDIR, 0);
 
        return TRUE;
    }
 
    BOOL SaveInfo(CMacroFile* pFile, const CString& strItemName)
    {
        if (pFile==NULL) return FALSE;
        CString strValue = _T("");
 
        strValue = strItemName + _T("_INDEX");
        pFile->SetItem(strValue, m_nIndex);
 
        strValue = strItemName + _T("_NAME");
        pFile->SetItem(strValue, m_strName);
 
        strValue = strItemName + _T("_CONTROL_TYPE");
        pFile->SetItem(strValue, m_nControllerType);
 
        strValue = strItemName + _T("_CONNECT_PORT");
        pFile->SetItem(strValue, m_strConnectionPort);
 
        strValue = strItemName + _T("_MODE");
        pFile->SetItem(strValue, m_nMode);
 
        strValue = strItemName + _T("_OFFSET_X");
        pFile->SetItem(strValue, m_dOffsetX);
 
        strValue = strItemName + _T("_OFFSET_Y");
        pFile->SetItem(strValue, m_dOffsetY);
 
        strValue = strItemName + _T("_FOV_X");
        pFile->SetItem(strValue, m_dWSIFOVX);
 
        strValue = strItemName + _T("_FOV_Y");
        pFile->SetItem(strValue, m_dWSIFOVY);
 
        strValue = strItemName + _T("_SCAN_DIR");
        pFile->SetItem(strValue, m_dWSISCANDIR);
 
        return TRUE;
    }
 
    // getter
    int            GetIndex() const                            { return m_nIndex; }
    CString        GetName() const                                { return m_strName; }
    int            GetControllerType() const                    { return m_nControllerType; }
    CString        GetConnectionPort() const                    { return m_strConnectionPort; }
    int            GetMode() const                                { return m_nMode; }
    double        GetOffsetX() const                            { return m_dOffsetX; }
    double        GetOffsetY() const                            { return m_dOffsetY; }
    double        GetWSIFOVX() const { return m_dWSIFOVX; }
    double        GetWSIFOVY() const { return m_dWSIFOVY; }
    int            GetWSIScanDir() const { return m_dWSISCANDIR; }
 
    // setter
    void        SetIndex(int nIndex)                        { m_nIndex = nIndex; }
    void        SetName(const CString& strName)                { m_strName = strName; }
    void        SetControllerType(int nType)                { m_nControllerType = nType; }
    void        SetConnectionPort(const CString& strPort)    { m_strConnectionPort = strPort; }
    void        SetMode(int nMode)                            { m_nMode = nMode; }
    void        SetOffsetX(double dValue)                    { m_dOffsetX = dValue; }
    void        SetOffsetY(double dValue)                    { m_dOffsetY = dValue; }
    void        SetWSIFOVX(double dValue) { m_dWSIFOVX = dValue; }
    void        SetWSIFOVY(double dValue) { m_dWSIFOVY = dValue; }
    void        SetWSIScanDir(double dValue) { m_dWSISCANDIR = dValue; }
 
    // wsi measurement data
    void    SetWsiMeasurementCount(int nCnt)        { m_vecDataWsiMeasurement.resize(nCnt); }
    int        GetWsiMeasurementCount() const            { return int(m_vecDataWsiMeasurement.size()); }
    SDataWsiMeasurement* GetWsiMeasurementData(int nIdx)
    {
        if (nIdx<0 || nIdx>=int(m_vecDataWsiMeasurement.size())) return NULL;
        return &m_vecDataWsiMeasurement[nIdx];
    }
    const SDataWsiMeasurement* GetWsiMeasurementData(int nIdx) const
    {
        if (nIdx<0 || nIdx>=int(m_vecDataWsiMeasurement.size())) return NULL;
        return &m_vecDataWsiMeasurement[nIdx];
    }
    void    SetDataIndex(int nIdx, int nIdxData)
    {
        if (nIdx<0 || nIdx>=GetWsiMeasurementCount()) return;
        m_vecDataWsiMeasurement[nIdx].nIndex = nIdxData;
    }
    void    SetDataCellID(int nIdx, CString strCellID)
    {
        if (nIdx<0 || nIdx>=GetWsiMeasurementCount()) return;
        m_vecDataWsiMeasurement[nIdx].strCellID = strCellID;
    }
    void    SetDataMeasure(int nIdx, BOOL bMeasure)
    {
        if (nIdx<0 || nIdx>=GetWsiMeasurementCount()) return;
        m_vecDataWsiMeasurement[nIdx].bMeasure = bMeasure;
    }
    void    SetDataDirection1(int nIdx, int nDirData)
    {
        if (nIdx<0 || nIdx>=GetWsiMeasurementCount()) return;
        m_vecDataWsiMeasurement[nIdx].nDirection1 = nDirData;
    }
    void    SetDataDirection2(int nIdx, int nDirData)
    {
        if (nIdx<0 || nIdx>=GetWsiMeasurementCount()) return;
        m_vecDataWsiMeasurement[nIdx].nDirection2 = nDirData;
    }
    int        GetDataIndex(int nIdx)
    {
        if (nIdx<0 || nIdx>=GetWsiMeasurementCount()) return -1;
        return m_vecDataWsiMeasurement[nIdx].nIndex;
    }
    CString    GetDataCellID(int nIdx)
    {
        if (nIdx<0 || nIdx>=GetWsiMeasurementCount()) return _T("");
        return m_vecDataWsiMeasurement[nIdx].strCellID;
    }
    BOOL    GetDataMeasure(int nIdx)
    {
        if (nIdx<0 || nIdx>=GetWsiMeasurementCount()) return FALSE;
        return m_vecDataWsiMeasurement[nIdx].bMeasure;
    }
    int        GetDataDirection1(int nIdx)
    {
        if (nIdx<0 || nIdx>=GetWsiMeasurementCount()) return -1;
        return m_vecDataWsiMeasurement[nIdx].nDirection1;
    }
    int        GetDataDirection2(int nIdx)
    {
        if (nIdx<0 || nIdx>=GetWsiMeasurementCount()) return -1;
        return m_vecDataWsiMeasurement[nIdx].nDirection2;
    }
 
    // wsi judge data
    SDataWsiJudge* GetWsiJudgeData()                { return &m_dataWsiJudge; }
    const SDataWsiJudge* GetWsiJudgeData() const    { return &m_dataWsiJudge; }
    void SetHorzWarningMargin(int nPlusMargin, int nMinusMargin)
    {
        if (GetWsiJudgeData()==NULL) return;
        m_dataWsiJudge.nHorzPlusWarningMargin = nPlusMargin;
        m_dataWsiJudge.nHorzMinusWarningMargin = nMinusMargin;
    }
    void GetHorzWarningMargin(int& nPlusMargin, int& nMinusMargin)
    {
        if (GetWsiJudgeData()==NULL) return;
        nPlusMargin = m_dataWsiJudge.nHorzPlusWarningMargin;
        nMinusMargin = m_dataWsiJudge.nHorzMinusWarningMargin;
    }
    void SetHorzNGMargin(int nPlusMargin, int nMinusMargin)
    {
        if (GetWsiJudgeData()==NULL) return;
        m_dataWsiJudge.nHorzPlusNGMargin = nPlusMargin;
        m_dataWsiJudge.nHorzMinusNGMargin = nMinusMargin;
    }
    void GetHorzNGMargin(int& nPlusMargin, int& nMinusMargin)
    {
        if (GetWsiJudgeData()==NULL) return;
        nPlusMargin = m_dataWsiJudge.nHorzPlusNGMargin;
        nMinusMargin = m_dataWsiJudge.nHorzMinusNGMargin;
    }
    void SetVertWarningMargin(int nPlusMargin, int nMinusMargin)
    {
        if (GetWsiJudgeData()==NULL) return;
        m_dataWsiJudge.nVertPlusWarningMargin = nPlusMargin;
        m_dataWsiJudge.nVertMinusWarningMargin = nMinusMargin;
    }
    void GetVertWarningMargin(int& nPlusMargin, int& nMinusMargin)
    {
        if (GetWsiJudgeData()==NULL) return;
        nPlusMargin = m_dataWsiJudge.nVertPlusWarningMargin;
        nMinusMargin = m_dataWsiJudge.nVertMinusWarningMargin;
    }
    void SetVertNGMargin(int nPlusMargin, int nMinusMargin)
    {
        if (GetWsiJudgeData()==NULL) return;
        m_dataWsiJudge.nVertPlusNGMargin = nPlusMargin;
        m_dataWsiJudge.nVertMinusNGMargin = nMinusMargin;
    }
    void GetVertNGMargin(int& nPlusMargin, int& nMinusMargin)
    {
        if (GetWsiJudgeData()==NULL) return;
        nPlusMargin = m_dataWsiJudge.nVertPlusNGMargin;
        nMinusMargin = m_dataWsiJudge.nVertMinusNGMargin;
    }
 
protected:
    int            m_nIndex;
    CString        m_strName;
    int            m_nControllerType;
    CString        m_strConnectionPort;
    int            m_nMode;
    double        m_dOffsetX;
    double        m_dOffsetY;
    double      m_dWSIFOVX; //거대결함 측정을 위한 FOV
    double      m_dWSIFOVY; //거대결함 측정을 위한 FOV
    int            m_dWSISCANDIR;//거대결함 측정을 위한 측정 순서
 
    VectorDataWsiMeasurement    m_vecDataWsiMeasurement;
    SDataWsiJudge                m_dataWsiJudge;
};