SDC C-Project CF Review 프로그램
LYW
2021-07-09 6bb39b058bce38f80645e1e54d03a172f74dba3b
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
 
#pragma once
 
#include "stdafx.h"
 
enum CameraType            { CamType_Unknown = 0, CamType_Transfer, CamType_Reflex, CamType_Back };
enum ScanDirectionIns    { SD_Forward = 0, SD_Backward, SD_Unknown };    // Glass ±âÁØ Scan ¹æÇâ.
 
 
static char ASG_NAME[4][10]={"LEFT", "RIGHT", "TOP", "BOTTOM"};
enum emPadPos {PAD_LEFT, PAD_RIGHT, PAD_TOP, PAD_BOTTOM, PAD_KIND};
static BOOL IsTopBottomPad(emPadPos ppos){return ppos >= PAD_TOP;};
static BOOL IsHoriInsPad(emPadPos ppos){return IsTopBottomPad(ppos);};
static char    *GetPadPosName(emPadPos ppos)
{
    return ASG_NAME[ppos];
}
 
class CScanCell;
class CScanRegion;
class CScanModel;
class CScanGlass;
 
 
class CZone_MatPoint
{
public:            
    CRect        rectOrg;
    CRect        rectAdj;
 
public:
    CZone_MatPoint()
    {        
        Reset();
    }
    void Reset()
    {        
        rectOrg.SetRect(0,0,0,0);
        rectAdj.SetRect(0,0,0,0);
    }
    CZone_MatPoint& operator=(CZone_MatPoint& rhs)
    {        
        rectOrg = rhs.rectOrg;
        rectAdj = rhs.rectAdj;
        return *this;
    }    
    void OffsetRegion(int nXDiff,int nMarginLeft,int nMarginRight)
    {
        int            nWidth = rectAdj.Width();
 
        rectAdj.OffsetRect(nXDiff,0);
        if(nMarginLeft > rectAdj.left)
        {
            rectAdj.left = nMarginLeft;
            rectAdj.right = rectAdj.left + nWidth;
        }
        if(nMarginRight < rectAdj.right)
        {
            rectAdj.right = nMarginRight;
            rectAdj.left = rectAdj.right - nWidth;
        }
    }
};
 
class CZone_MatReg
{
public:            
    int                    iFrame;
    CArray<CZone_MatPoint,CZone_MatPoint>        pPoint;
 
public:
    CZone_MatReg()
    {        
        Reset();
    }
    ~CZone_MatReg()
    {
        DeleteAll();
    }    
    void DeleteAll()
    {
        pPoint.RemoveAll();
    }
    void Reset()
    {        
        iFrame = -1;
        DeleteAll();
    }
    CZone_MatReg& operator=(CZone_MatReg& rhs)
    {        
        iFrame = rhs.iFrame;
        DeleteAll();
        for (int i = 0; i < rhs.pPoint.GetSize(); i++)
        {
            pPoint.Add(rhs.pPoint.GetAt(i));
        }
        return *this;
    }    
    void OffsetRegion(int nXDiff,int nMarginLeft,int nMarginRight)
    {
        for (int i = 0; i < pPoint.GetSize(); i++)
            pPoint.GetAt(i).OffsetRegion(nXDiff,nMarginLeft,nMarginRight);
    }
};
 
class CZone_MatRegArray : public CArray<CZone_MatReg *, CZone_MatReg *>
{
public:
    ~CZone_MatRegArray()
    {
        DeleteAll();
    }        
    void DeleteAt(LONG nIndex)
    {
        if(nIndex >= GetSize()) return;
 
        for (int i = 0; i < GetSize(); i++)
        {
            if(nIndex == i)
            {                    
                if(GetAt(i) != NULL)
                    GetAt(i)->DeleteAll();
                delete GetAt(i);
                RemoveAt(i);
                break;
            }
        }
    }
    void DeleteAll()
    {
        for (int i = 0; i < GetSize(); i++)
        {
            if(GetAt(i) != NULL)
                GetAt(i)->DeleteAll();
            delete GetAt(i);
        }
        RemoveAll();
    }
};
 
 
class CScanCell
{
public:
    CZone_MatRegArray    m_pZoneMatReg;
    CScanCell(){m_RectCellPat.SetRect(300, 1, 11700, 1023);}
public:
    CRect m_RectCellPat;
    CZone_MatRegArray    *GetZoneRegData(){return &m_pZoneMatReg;}
    CZone_MatReg        *GetZoneReg(int iFrame) {return NULL;}
public:
    void            SetScanRegion(int iCell, CScanRegion *pRegion){m_iCell= iCell; m_pScanRegion= pRegion;}
    CScanRegion*    GetScanRegion()    {return m_pScanRegion;}
    int                m_iCell;
    CScanRegion        *m_pScanRegion;
 
};
 
class CScanRegion
{
public:
    CScanRegion()    {m_bOnlyPAD= FALSE;}
 
    BOOL        m_bOnlyPAD;
    CScanCell    m_pCell[1];
    int            GetCellCount()    {return 1;}
    CScanCell    *GetCellInfo(int i)    {return m_pCell;}
 
public:
    void                SetScanModel(int iRegion, CScanModel *pModel){m_iRegion= iRegion; m_pScanModel= pModel;}
    CScanModel*            GetScanModel()    {return m_pScanModel;}
    int                    m_iRegion;
    CScanModel            *m_pScanModel;
    BOOL    SetCellCount(int nRegion)
    {
        m_pCell[0].SetScanRegion(0, this);
        return TRUE;
    }
};
 
class CScanModel
{
public:
    BOOL        m_bAsgZone;
public:
    CScanModel()    { m_bAsgZone= TRUE; m_ConvPitch= 179.5; m_ScanPitch= 179.5;}
 
public:
    CScanRegion    m_pRegion[1];
    CScanRegion    *GetScanRegion(int i)    {return m_pRegion;}
    int            GetRegionCount()        {return 1;}
 
    double        m_ConvPitch, m_ScanPitch;
    double    GetConvPitch()        {return m_ConvPitch;}
    double    GetScanPitch()        {return m_ScanPitch;}
 
public:
    BOOL    SetRegionCount(int nRegion)
    {
        m_pRegion[0].SetScanModel(0, this);
        m_pRegion[0].SetCellCount(1);
        return TRUE;
    }
    void                SetScanGlass(int iModel, CScanGlass *pGlass){m_iModel= iModel; m_pScanGlass= pGlass;}
    CScanGlass*            GetScanGlass()    {return m_pScanGlass;}
    int                    m_iModel;
    CScanGlass            *m_pScanGlass;
 
};
 
class CScanGlass
{
    CScanModel m_pModel[1];
public:
    CScanGlass()    {m_enScanDirection= SD_Forward; m_nScanIdx= 0; SetModelCount(1);}
    int        m_nScanIdx;
    int        m_enScanDirection;
public:
    int            GetModelCount()    {return 1;}
    CScanModel    *GetScanModel(int i)    {return m_pModel;}
 
    int        GetCamType()        {return CamType_Reflex;}
    CString    GetHPanelID()        {return CString("HPANELID");}
 
    int        GetMarginLeft()        {return 100;}
    int        GetMarginRight()    {return 100;}
 
    CString    GetRecipeName()    {return CString("TEMPRECIPE");}
    int        GetConvMode()    {return 1;}
 
    BOOL    SetModelCount(int nRegion)
    {
        m_pModel[0].SetScanGlass(0, this);
        m_pModel[0].SetRegionCount(1);
        return TRUE;
    }
};
 
 
class CFakeBase
{
public:
    int        m_nFrameWidth;
    int        m_nFrameHeight;
    CString m_strHPanelID;
    CFakeBase()
    {
        m_nFrameWidth    = 10240;
        m_nFrameHeight    = 1024;
        m_strHPanelID    = "Test";
    }
};
 
extern CFakeBase *g_pBase;
 
 
 
class CHMConfigFile
{
public:
    void SetFileName(char *name){};
    void GetItemValue(char* szName, int& nValue, int nDefault= 0){nValue= nDefault;}
};