mrDarker
2025-07-16 1dbe46cd9d0f181d08d5a69f72d8548628a13b9d
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
// GlassMap.h: interface for the CGlassMap class.
//
//////////////////////////////////////////////////////////////////////
 
#pragma once
 
#include "InspectDefect.h"
#include "Server_MemDC.h"
#include "DefectMap.h"
#include "Global_Define.h"
#include "GlassRecipe.h"
#include "HardwareSettings.h"
#include "Glass_Data.h"
 
#define RCUT_DEFECT_TYPECOUNT    5
#define ID_TIMER_BLINK            9001
#define ID_TIMER_MASKBLINK        9002
 
#define    COLOR_0            RGB(255,0,0)        // TB
#define    COLOR_1            RGB(0,0,255)        // TW
#define    COLOR_2            RGB(0,200,200)        // RB
#define    COLOR_3            RGB(88,224,88)        // RW
#define    COLOR_4            RGB(100,0,100)        // BB
#define    COLOR_5            RGB(128,0,0)        // BW
#define    COLOR_6            RGB(0,100,0)        // CD
#define    COLOR_7            RGB(255,128,0)    // NO
#define    COLOR_8            RGB(0,128,128)            // NO
#define    COLOR_9            RGB(0,5,128)
#define    COLOR_10        RGB(0,255,0)
            // NO
 
#define COLOR_STACK_0    RGB(50,0,100)        // BML
#define COLOR_STACK_1    RGB(70,100,50)        // BLU
#define COLOR_STACK_2    RGB(90,200,0)        // GRN
#define COLOR_STACK_3    RGB(110,0,100)        // RED
#define COLOR_STACK_4    RGB(130,100,50)        // RPL
#define COLOR_STACK_5    RGB(150,200,0)        // OCL
#define COLOR_STACK_6    RGB(170,0,100)        // PS
#define COLOR_STACK_7    RGB(190,100,50)        // ANL
#define COLOR_STACK_8    RGB(210,200,0)        // FINAL
#define COLOR_STACK_9    RGB(230,0,100)        // MASK
 
#define    MAPSTACK_STEP_COUNT    10
#define  UM_MAP_SELECTDEFECT        (WM_USER + 8763)
 
#define MAX_POINT_VALUE_CNT        3
enum Disp_SplineLocation        { Disp_Spline_BotRight=0,Disp_Spline_BotLeft,Disp_Spline_TopRight,Disp_Spline_TopLeft,Disp_Spline_None };
enum NotchDirArry                {NotchDir_A=0,NotchDir_B,NotchDir_C,NotchDir_D,NotchDir_Non};
 
class CGlassMap : public CDefectMap
{
public:
    CGlassMap();
    virtual ~CGlassMap();
 
    void                SetGlassRecipe(CHardwareSettings *pHard,CGlassRecipe* pRecipe,BOOL bTFTArea);        
    void                ReCalRectDraw();
    
    virtual void        DrawGlass(CDC* pDC);
    virtual void        MouseLBtnDblClk(CPoint& point);
    virtual void        MouseLBtnDwn(CPoint& point);
    virtual void        MouseLBtnMove(CPoint& point);
    virtual void        MouseLBtnUp(CPoint& point);
    virtual void        MouseRBtnDwn(CPoint& point);
    virtual void        Timer(UINT nIDEvent);    
    
    void                ZoomInDefectMap();    
    void                SetZoomMode(BOOL bSet){ m_bSetZoomMode = bSet; }
        
    BOOL                SetSelectDefect(int nGlassDefectIdx);
    void                SetDrawMapRefresh(){Invalidate(FALSE);}
    void                DrawDefects(MapDefect* pMapDefect,CGlass_Data *pGlassData);    
    void                SetGlasssize(int nIdx,double dValue);
    void                SetPointCutData(DimensionDir enDir,double *pCutArea,double dAvgVal);
    void                SetPointDimenData(DimensionDir enDir,double *pDimen,double dAvgVal);
    void                SetSplineData(Disp_SplineLocation enDir,double dValue);    
    void                SetCornerXData(Disp_SplineLocation enDir,double dValue);
    void                SetCornerYData(Disp_SplineLocation enDir,double dValue);
    CInspectDefect        *GetSelectDefect(){return m_pSelDefect;}
 
    void                SetMapIndex(_ST_MAPSETTINGS_INDEX MapIndex){m_MapIndex=MapIndex;}
 
protected:    
    int                    m_nBlinkColor;    
    BOOL                m_bSetZoomMode;
    BOOL                m_bZoomDrag;
    BOOL                m_bZoomInMode;
    CRect                m_rectZoomDrag,m_rectZoomWindow;
    double                m_dZoomRatioH;
    double                m_dZoomRatioV;
    double                m_dGlasssize[2];
 
//iskang Add notch iamge view
    BOOL                m_bNotch;
    int                    m_nNotchDir;
        
    int                    m_nMinDefectSize;
    inline int            GetSmallSize();
    inline int            GetMidSize();
    inline int            GetLargeSize();
    inline int            GetHugeSize();    
    
    //////////////////////////////////////////////////////////////////////////
    // Glass Info
    CHardwareSettings    *m_pHardwareSetting;
    CGlassRecipe    *m_pRecipe;        
    MapDefect            *m_pMapDefect;
    CInspectDefect        *m_pSelDefect;    
    CGlass_Data            *m_pGlassData;
    CBrush                m_BrushDefect[RCUT_DEFECT_TYPECOUNT];
    CRect                m_rectGlass;
    BOOL                m_bTFTArea;
 
    int                    m_nCutAreaSize[4][MAX_POINT_VALUE_CNT];
    int                    m_nCutAreaAVG[4];
    int                    m_nDimensionSize[4][MAX_POINT_VALUE_CNT];
    int                    m_nDimensionAVG[4];
    double                m_dSplineSize[4];
    double                m_dCornerSize_X[4];
    double                m_dCornerSize_Y[4];
    _ST_MAPSETTINGS_INDEX    m_MapIndex;
 
protected:    
    void        DrawGlassDefect(HDC hDC);
    void        DrawGlassPreDefect(HDC hDC,MapDefect *pMapDefect,int iPre);
    void        DrawGlassBackGround(HDC hDC);
    void        DrawGlassBackGroundRev(HDC hDC);
    void        DrawGlassPosition(HDC hDC);
    void        DrawZoonInMode(CDC *pDC,CControlMemDC *memDC);        
    void        DrawTriangle(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius);
    void        DrawCircle(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius);
    void        DrawCross(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius);
    void        DrawRightAngleCross(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius);
    void        DrawRect(HDC hDC, HPEN hPen, CRect rect);
    void        DrawGlassArea(HDC hDC);                
    void        DrawRectangle(HDC hDC, CRect rectDrag, COLORREF pencolor, COLORREF brushcolor);        
    void        FillPolygon(HDC hDC,POINT *poly,int npoly,DWORD color,int nTop,int nBottom);
    void        DrawPointValue(HDC hDC);
    void        DrawPointValue(HDC hDC,CRect rectBase,CPoint pointSkip,int *pCurValue,int *pDimenValue,int nLoopCnt=MAX_POINT_VALUE_CNT);
    void        DrawSplineValue(HDC hDC);
    void        DrawCornerXValue(HDC hDC);
    void        DrawCornerYValue(HDC hDC);
 
protected:
    void        CalDefectRect(CRect &rect,BOOL bRet=FALSE,BOOL bDirOpt=TRUE);
    void        CalDefectRect(CPoint &point,BOOL bRet=FALSE,BOOL bDirOpt=TRUE);
    CString        GetPositionString(DimensionDir dir);    
    void        ConvertOriginToView(int iSide,CRect &RectDefect);
    void        ConvertOriginToViewRev(int iSide,CRect &RectDefect);
    CInspectDefect*    FindSelDefect(CPoint pt);
 
    // Ãß¿ø±¹ - UI º¯°æ
protected:
    CGlassMap*            m_ptrOtherSideClass;
public:
    void        SetOtherGlassMapPtr(CGlassMap* ptr){m_ptrOtherSideClass = ptr;}
    CGlassMap*    GetOtherGlassMapPtr(){return m_ptrOtherSideClass;}
    void        DrawPointValue(HDC hDC,CRect rectBase,CPoint pointSkip,int *pCurValue, int *pCurValue2, int *pDimenValue,int nIndex,int nLoopCnt=MAX_POINT_VALUE_CNT);
};