SDC C-Project CF Review 프로그램
LYW
2021-06-09 754fa0614469b76fcd789a4f50f9bee59aa09e9b
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
#pragma once
 
#include <vector>
#include <d2d1.h>
#include <d2d1helper.h>
#include <wincodec.h>
 
 
enum VirtualObjectDraw_Type        { VODT_Rectangle=0, VODT_Ellipse, VODT_Polygon, VODT_Count };
enum VirtualGlassObject_Type    { VGOT_Align=0, VGOT_Active, VGOT_Pad, VGOT_Defect, VGOT_Count };
enum VirtualOriginDir_Type        { VODT_LeftTop=0, VODT_RightTop, VODT_LeftBottom, VODT_RightBottom };
 
enum ColorBandShiftValue
{
    AlphaShiftValue  = 24,
    RedShiftValue    = 16,
    GreenShiftValue  = 8,
    BlueShiftValue   = 0
};
 
static UINT MakeColor(BYTE a, BYTE r, BYTE g, BYTE b)
{
    return (((UINT) (b) <<  BlueShiftValue) |
            ((UINT) (g) << GreenShiftValue) |
            ((UINT) (r) <<   RedShiftValue) |
            ((UINT) (a) << AlphaShiftValue));
}
 
struct SDoublePos
{
    SDoublePos(double dX=0, double dY=0) 
    {
        dPosX = dX;
        dPosY = dY;
    }
    double dPosX;
    double dPosY;
};
typedef std::vector<SDoublePos>                        VectorDoublePos;
typedef std::vector<SDoublePos>::iterator            VectorDoublePosIt;
typedef std::vector<SDoublePos>::const_iterator        constVectorDoublePosIt;
 
class CVirtualGlassTilt
{
public:
    CVirtualGlassTilt(double dX=0, double dY=0, double dA=0) 
    {
        dDx        = dX;
        dDy        = dY;
        dAngle    = dA;
    }
public:
    double    dDx;
    double    dDy;
    double    dAngle;
};
 
class CVirtualObject
{
public:
    CVirtualObject() { Reset(); }
 
    void Reset()
    {
        nIndex            = 0;
        strName            = _T("");
        nPenColor        = MakeColor(255,0,0,0);
        nBrushColor        = MakeColor(255,0,0,0);
        dPenOpacity        = 1.0;
        dBrushOpacity    = 1.0;
        dPenSize        = 0.01; // 10um
    }
 
    double Left() const        { return dPosX; }
    double Top() const        { return dPosY; }
    double Right() const    { return (dPosX+dSizeX); }
    double Bottom() const    { return (dPosY+dSizeY); }
    double Width() const    { return dSizeX; }
    double Height() const    { return dSizeY; }
 
    int            nIndex;                // ¼ø¹ø
    CString        strName;            // À̸§
    UINT        nPenColor;            // Ææ Ä÷¯
    UINT        nBrushColor;        // ºê·¯½Ã Ä÷¯
    double        dPenSize;            // Ææ Å©±â // um
    double        dPenOpacity;        // Ææ ºÒÅõ¸íµµ        (0~1)
    double        dBrushOpacity;        // ºê·¯½Ã ºÒÅõ¸íµµ    (0~1)
 
    double        dPosX;            // ¿øÁ¡ X //um
    double        dPosY;            // ¿øÁ¡ Y //um
    double        dSizeX;            // »çÀÌÁî X //um
    double        dSizeY;            // »çÀÌÁî Y //um
};
 
class CVirtualMotorInfo : public CVirtualObject
{
public:
    CVirtualMotorInfo() { Reset(); }
    void Reset()
    {
        strName            = _T("Motor");
        nPenColor        = MakeColor(255,0,0,0);
        nBrushColor        = MakeColor(255,50,0,50);
        dPenSize        = 0.01; // 10um
        nOriginDir        = VODT_LeftTop;
        dPosX            = 0.0;            
        dPosY            = 0.0;        
        dSizeX            = 1800.0;
        dSizeY            = 1400.0;
    }
 
    int            nOriginDir;        // ¿øÁ¡ ¹æÇâ
};
 
class CVirtualGlassInfo : public CVirtualObject
{
public:
    CVirtualGlassInfo() { Reset(); }
    void Reset()
    {
        strName            = _T("Glass");
        nPenColor        = MakeColor(255,100,100,100);
        nBrushColor        = MakeColor(255,0,200,200);
        dPenSize        = 0.50; // 500
 
        nOriginDir        = VODT_LeftTop;
        nCutDir            = VODT_LeftTop;
        dCutSize        = 3.0;
        dNoCutSize        = 1.0;
        dPosX            = 100;            
        dPosY            = 100;        
        dSizeX            = 1600;
        dSizeY            = 1200;
    }
 
    bool operator==(const CVirtualGlassInfo& rhs)
    {
        if (rhs.nPenColor!=nPenColor) return false;
        if (rhs.nBrushColor!=nBrushColor) return false;
        if (rhs.dPenSize!=dPenSize) return false;
        if (rhs.nOriginDir!=nOriginDir) return false;
        if (rhs.nCutDir!=nCutDir) return false;
        if (rhs.dCutSize!=dCutSize) return false;
        if (rhs.dNoCutSize!=dNoCutSize) return false;
        if (rhs.dPosX!=dPosX) return false;
        if (rhs.dPosY!=dPosY) return false;
        if (rhs.dSizeX!=dSizeX) return false;
        if (rhs.dSizeY!=dSizeY) return false;
        return true;
    }
 
    int        nOriginDir;        // ¿øÁ¡ ¹æÇâ
    int        nCutDir;        // ÄÚ³ÊÄÆ ¹æÇâ
    double    dCutSize;        // ÄÚ³ÊÄÆ Å©±â
    double    dNoCutSize;        // ³ë ÄÚ³ÊÄÆ Å©±â
};
 
class CVirtualGlassObject :public CVirtualObject
{
public:
    CVirtualGlassObject() { Reset(); }
    void Reset()
    {
        nObjectType        = VGOT_Defect;
        nDrawType        = VODT_Rectangle;
        dPosX            = 0;            
        dPosY            = 0;        
        dSizeX            = 0;
        dSizeY            = 0;
        vecPolygon.clear();
    }
 
    int                nObjectType;    // ¿ÀºêÁ§Æ® Å¸ÀÔ
    int                nDrawType;        // »ý±ä ¸ð¾ç
    VectorDoublePos    vecPolygon;        // Æú¸®°ï Á¤º¸ um
};
typedef std::vector<CVirtualGlassObject>                        VectorVirtualGlassObject;
typedef std::vector<CVirtualGlassObject>::iterator                VectorVirtualGlassObjectIt;
typedef std::vector<CVirtualGlassObject>::const_iterator        constVectorVirtualGlassObjectIt;
 
class CVirtualImageInfo
{
public:
    CVirtualImageInfo() { Reset(); }
    void Reset()
    {
        dCenterX        = 0.0;
        dCenterY        = 0.0;
        dPixelSizeX        = 1.0;
        dPixelSizeY        = 1.0;
        dRulerGab        = 100.0;
        nFrameWidth        = 0;
        nFrameHeight    = 0;
        nFrameChannels    = 0;
    }
    bool operator==(const CVirtualImageInfo& rhs)
    {
        if (rhs.dCenterX!=dCenterX) return false;
        if (rhs.dCenterY!=dCenterY) return false;
        if (rhs.dPixelSizeX!=dPixelSizeX) return false;
        if (rhs.dPixelSizeY!=dPixelSizeY) return false;
        if (rhs.dRulerGab!=dRulerGab) return false;
        if (rhs.nFrameWidth!=nFrameWidth) return false;
        if (rhs.nFrameHeight!=nFrameHeight) return false;
        if (rhs.nFrameChannels!=nFrameChannels) return false;
        return true;
    }
    
    double    dCenterX;            // um
    double    dCenterY;            // um
    double    dPixelSizeX;        // um/pixel
    double    dPixelSizeY;        // um/pixel
    double    dRulerGab;
    int        nFrameWidth;        // pixel
    int        nFrameHeight;        // pixel
    int        nFrameChannels;        // 
};