SDC C-Project CF Review 프로그램
kojingeun
2023-11-24 c112cf54a238afa473e7eb0ea6298e06f4957658
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
#pragma once
 
 
// CDefectMap
#include "CHImageControls/CHImageData.h"
#include "CHReviewResult/GlassResult.h"
#include "CHReviewResult/DefectResult.h"
#include "CHReviewSetting/GlassTypeInfo.h"
#include "ModuleStatus.h"
#include "CHPathScheduler/PathScheduler.h"
#include "CameraController.h"
 
#define GLASS_SIZE_X_UM                1500000
#define GLASS_SIZE_Y_UM                1300000
#define DEFECT_SIZE                    3
#define REVIEW_SIZE                    4
#define GLASS_MAP_CLK_RANGE            4
 
 
#define UWM_SEND_DEFECTMAP_EVENT    (WM_USER + 200)
 
#define UM_DBLCLK_DEFECT_MAP        (WM_USER + 7000)
#define UM_DBRCLK_DEFECT_MAP        (WM_USER + 7001)
#define UM_LBDOWN_DEFECT_MAP        (WM_USER + 7002)
#define UM_LBDOWN_DEFECT_MAP2        (WM_USER + 7003)
#define UM_MOUSEWHEEL_DEFECT_MAP    (WM_USER + 7004)
 
class CDefectMap :    public CWnd, 
                    public CCHImageData,
                    public IUpdateDefectFilter, 
                    public IUpdateProcessStatus,
                    public IUpdateMotorPosition,
                    public IUpdateReviewResult
{
    DECLARE_DYNAMIC(CDefectMap)
 
public:
    CDefectMap(CWnd *pParentWnd);
    virtual ~CDefectMap();
 
    virtual void    UpdateDefectFilter(const SDefectFilter* pDefectFilter);
    virtual void    UpdateProcessStatus(int nLineType, int nMachineType, int nProcessStatus, const CGlassResult* pGlassResult);
    virtual void    UpdateMotorPosition(int nModuleIndex, BOOL bSelected, const SMotorPosition* pMotorPosition);
    virtual void    UpdateReviewResult(int nModuleIndex, const CGlassResult* pGlassResult, int nPlanIndex);
 
 
    void    SetSelectedCameraIndex(int nIndex)                { m_nSelectedIndex = nIndex; }
 
    void    SetGlassInfo(int nSizeX, int nSizeY, int nCornerCutDir, int nGlassOriginDir);
    void    SetGlassInfo2(int nSizeX, int nSizeY, int nCornerCutDir, int nGlassOriginDir);
    void    SetGlassResult(const CGlassResult* pGlassResult);
 
    void    SetRationX(double dSizeRatioX) { m_dOrignSizeRatioX = dSizeRatioX; }
    void    SetRationY(double dSizeRatioY) { m_dOrignSizeRatioY = dSizeRatioY; }
 
    double    GetRationX() { return m_dOrignSizeRatioX; }
    double  GetRationY() { return m_dOrignSizeRatioY; }
 
    void    SetOriginX(int nOriginX) { m_nOriginSizeX = nOriginX; }
    void    SetOriginY(int nOriginY) { m_nOriginSizeY = nOriginY; }
 
    int        GetOriginX() { return m_nOriginSizeX; }
    int        GetOriginY() { return m_nOriginSizeY; }
 
 
    void    SetDefectFilter(const SDefectFilter* pDefectFilter)    { m_pDefectFilter = pDefectFilter; }
    void    DrawDefectPoint(int nPosX, int nPosY, COLORREF nColor);
    void    DrawDefectPoint2(int nPosX, int nPosY, COLORREF nColor);
    void    DrawCamera(VectorInteger& vectorType, VectorInteger& vectorPosX, VectorInteger& vectorPosY);
    void    SetGlassResult2(const CGlassResult * pGlassResult, BOOL bHistory);
    void    TransformGlass2Map(int& nUMGlassPosX, int& nUMGlassPosY);
    void    TransformGlass2Map2(int& nUMGlassPosX, int& nUMGlassPosY);
    void    TransformGlass2Map3(int& nUMGlassPosX, int& nUMGlassPosY);
    void    TransformMap2Glass(int& nUMMapPosX, int& nUMMapPosY);
    void    TransformMap2Glass2(int& nUMMapPosX, int& nUMMapPosY);
 
    double    GetScaleX() { return m_dSizeRatioX; }
    double    GetScaleY() { return m_dSizeRatioY; }
 
 
    void    SetDrawCollision(BOOL bValue) { m_bDrawCollision = bValue; }
    BOOL    GetDrawCollision() { return m_bDrawCollision; }
 
    void SetDefectZoom(double dDefectZoom) { m_dDefectZoom = dDefectZoom; }
    void SetrevDefectZoom(double drevDefectZoom) { m_dRevDefectZoom = drevDefectZoom; }
 
    DOUBLE    GetDefectZoom() { return m_dDefectZoom; }
    DOUBLE    GetrevDefectZoom() { return m_dRevDefectZoom; }
    
    void    SetDisplayClickedPoint(const CDefectResult* pDefectResult);
    BOOL    IsValideClickedPoint(const CPoint origPoint, CPoint compPoint, int nRange);
    void    UpdateHistoryDefectMap();
 
    static int FilterDefect(const SDefectFilter& defectFilter, const CDefectResult* pDefectResult);
    static int FilterDefect(const SDefectFilter* pDefectFilter, const CDefectResult* pDefectResult);
    static int FilterDefectPos(const SDefectFilter& defectFilter, const SReviewResult* pSReviewResult);
    static int FilterDefectPos(const SDefectFilter* pDefectFilter, const SReviewResult* pSReviewResult);
 
protected:
 
    void UpdateDefectMap();
    void UpdateDefectMap2();
    void UpdateDefectMap3();
    void UpdateReviewResult(CDC *pDC);
    void UpdateReviewResult2(CDC *pDC);
 
    void Reset();
    void DrawGlass(CDC *pDC, const CRect& rtRect);
    void RectChange(const CRect & rtRect);
    void DrawCornerCut(CDC* pDC);
    void DrawCell(CDC *pDC);
    void DrawDefect(CDC *pDC);
 
    void DrawCell2(CDC *pDC);
    void DrawDefect2(CDC *pDC);
    
    void DrawUserPoint(CDC *pDC);
    void DrawUserPath(CDC *pDC);
    void DrawUserPointPath(CDC *pDC);
 
    void DrawUserPoint2(CDC *pDC);
    void DrawUserPath2(CDC *pDC);
    void DrawUserPointPath2(CDC *pDC);
 
    void DrawReflowPoint(CDC *pDC);
    void DrawReflowPath(CDC *pDC);
    void DrawReflowPointPath(CDC *pDC);
 
    void DrawReflowPoint2(CDC *pDC);
    void DrawReflowPath2(CDC *pDC);
    void DrawReflowPointPath2(CDC *pDC);
 
    void DrawMeasurePoint(CDC *pDC);
    void DrawMeasurePath(CDC *pDC);
    void DrawMeasurePointPath(CDC *pDC);
 
    void DrawMeasurePoint2(CDC *pDC);
    void DrawMeasurePath2(CDC *pDC);
    void DrawMeasurePointPath2(CDC *pDC);
 
    void DrawReviewDefect(CDC *pDC);
    void DrawReviewPath(CDC *pDC);
    void DrawReviewDefectPath(CDC *pDC);
 
    void DrawReviewDefect2(CDC *pDC);
    void DrawReviewPath2(CDC *pDC);
    void DrawReviewDefectPath2(CDC *pDC);
    
    void DrawWsiDefect(CDC *pDC);
    void DrawWsiPath(CDC *pDC);
    void DrawWsiDefectPath(CDC *pDC);
 
    void DrawWsiDefect2(CDC *pDC);
    void DrawWsiPath2(CDC *pDC);
    void DrawWsiDefectPath2(CDC *pDC);
    
    void DrawWsiReflowPoint(CDC *pDC);
    void DrawWsiReflowPath(CDC *pDC);
    void DrawWsiReflowPointPath(CDC *pDC);
 
    void DrawWsiReflowPoint2(CDC *pDC);
    void DrawWsiReflowPath2(CDC *pDC);
    void DrawWsiReflowPointPath2(CDC *pDC);
 
    void DrawClickedPoint(CDC *pDC);
    void DrawReviewImg(CDC *pDC);
    void DrawCollisionRange(CDC* pDC, const CRect& rtRect);
 
    void DrawCollisionRange2(CDC* pDC, const CRect& rtRect);
 
    void DrawUserWsiDefect(CDC *pDC);
    void DrawUserWsiPath(CDC *pDC);
    void DrawUserWsiDefectPath(CDC *pDC);
 
    void DrawUserWsiDefect2(CDC *pDC);
    void DrawUserWsiPath2(CDC *pDC);
    void DrawUserWsiDefectPath2(CDC *pDC);
 
    int TransX(double x);
    int TransY(double y);
    int TransX(int x);
    int TransY(int y);
 
 
    CDC                    m_memDC;
    CBitmap                m_bitmap;
    CRect                m_rtViewRect;
 
    int                    m_nOriginX;
    int                    m_nOriginY;
    int                    m_nOriginDir;
    int                    m_nCornerCutDir;
    CPoint                m_clkPoint;
    int                    m_nDrawDirX;
    int                    m_nDrawDirY;
 
    double                m_dOrignSizeRatioX;
    double                m_dOrignSizeRatioY;
 
    int                    m_nOriginSizeX;
    int                    m_nOriginSizeY;
    
    double                m_dSizeRatioX;
    double                m_dSizeRatioY;
    CWnd*                m_pParentWnd;
 
    int                    m_nSelectedIndex;
    VectorInteger        m_vecCameraType;
    VectorInteger        m_vecCameraPosX;
    VectorInteger        m_vecCameraPosY;
 
    int                            m_nReviewIndex;
    const SDefectFilter*        m_pDefectFilter;
    const CGlassResult*            m_pGlassResult;
    const VectorReviewResult*    m_pVecReviewResult;
    
    COLORREF                    m_RowColor[6];
    CBrush                        m_pDefectBrush[6];
    CPen                        m_pDefectPen[6];
    //CPen                        m_pOffsetPen;
    //CBrush                        m_pOffsetBrush;
 
    CPoint                m_pMousePt;
    CPoint                m_pMouseDwPt;
    CPoint                m_pMouseUpPt;
 
    int                    m_nDefectSize;
    int                    m_nReviewSize;
    
    // 181203 SJB, PlanIndex
    int                    m_nPlanIndex;
 
    BOOL            m_bDrawCollision;
 
    BOOL            m_bHistoryEnable;
 
/*    int                m_nHistoryCount;*/
 
    int    m_nPointX;
    int m_nPointY;
    short m_sDelta;
 
 
    
    DECLARE_MESSAGE_MAP()
 
public:
    void SetOffsetmodeparma(BOOL bMode, int nCamidx, int nScanidx, double nXpos, double nYpos);
    void SetOffsetparm(int nCamidx, int nScanidx, BOOL bUse);
        BOOL nOffSetMode;
        int nGlassMax;
        int nGlassMin;
        int nCamIndex;
        int nCamSacnIndex;
 
        int m_nDefectOffsetX;
        int m_nDefectOffsetY;
        int m_nDefectCenterX;
        int m_nDefectCenterY;
        int m_nRectTop;
        int m_nRectRight;
        int m_nRectBottom;
        int m_nRectLeft;
        double m_dDefectZoom;
        double m_dRevDefectZoom;
 
public:
    afx_msg void OnPaint();
 
 
//     afx_msg    LRESULT    OnMotorPositionUpdate(WPARAM wParam, LPARAM lParam);
//     afx_msg LRESULT    OnDefectFilterUpdate(WPARAM wParam, LPARAM lParam);
//     afx_msg    LRESULT    OnProcessStatusUpdate(WPARAM wParam, LPARAM lParam);
 
    afx_msg    LRESULT    OnUpdateDefectMap(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnUpdateDefectMap2(WPARAM wParam, LPARAM lParam);
    afx_msg    LRESULT    OnReviewResultUpdate(WPARAM wParam, LPARAM lParam);
    afx_msg    LRESULT    OnUpdateDefectMapDefault(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnHistoryWhell(WPARAM wParam, LPARAM lParam);
 
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
    afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint point);
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
    afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
    afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
 
    void ClearDefectMap(void);
};