SDC C-Project CF Review 프로그램
LYW
2022-05-31 f1a543772246f59b8b52a8857270b38ee38f3588
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
#pragma once
 
#include "GlassDefectMapData.h"
 
#include <d2d1.h>
#include <d2d1helper.h>
#include <dwrite.h>
#include <wincodec.h>
 
class AFX_EXT_CLASS CGlassDefectMap : public CWnd
{
    DECLARE_DYNAMIC(CGlassDefectMap)
 
public:
    CGlassDefectMap(CWnd* pParentWnd=NULL);
    virtual ~CGlassDefectMap(void);
 
    void    SetParentWnd(CWnd* pParentWnd);
    void    SetMapZoomLevel(float fLevel);
    void    SetMapCenterPoint(const CPoint& ptPoint);
    void    SetMapDefaultValue();
    void    SetMapBackColor(UINT nColor);
    void    SetDrawData_Glass(const CDrawData_Glass& dataGlass);
 
protected:
    void InitGlassDefectMap();
    void CalTransformMatrix();
    void CalCornerTransformMatrix(const D2D1_SIZE_F& fTrans, const D2D1_SIZE_F& fScale, const D2D1_POINT_2F& fPoint, const D2D1_SIZE_F& fViewSize, const CDrawData_Glass *pDataGlass, D2D1_MATRIX_3X2_F& matTransform);
    void ReleaseAllLayers();
    void UpdateGlassLayer(ID2D1RenderTarget *pRenderTarget);
    void UpdateCellLayer(ID2D1RenderTarget *pRenderTarget);
    void UpdateDefectLayer(ID2D1RenderTarget *pRenderTarget);
 
    void UpdateGlassRuler(ID2D1RenderTarget *pRenderTarget, const CDrawData_Glass* pDrawData, const D2D1_SIZE_F& fScale);
    void UpdateGlassCorner( ID2D1RenderTarget *pRenderTarget, const CDrawData_Glass* pDataGlass, const D2D1_SIZE_F& fScale);
    void UpdateDrawData(ID2D1RenderTarget *pRenderTarget, const CDrawData* pDrawData, float fScale);
    void DrawGlassLayer(ID2D1RenderTarget *pRenderTarget, const D2D1_RECT_F* pDestRect);
    void DrawCellLayer(ID2D1RenderTarget *pRenderTarget, const D2D1_RECT_F* pDestRect);
    void DrawDefectLayer(ID2D1RenderTarget *pRenderTarget, const D2D1_RECT_F* pDestRect);
 
protected:
    DECLARE_MESSAGE_MAP()
    
 
protected:
    CWnd                    *m_pParentWnd;
    IWICImagingFactory        *m_pWICFactory;
    ID2D1Factory            *m_pD2DFactory;
    IDWriteFactory            *m_pDWFactroy;
 
    ID2D1Bitmap                *m_pLayerGlass;
    ID2D1Bitmap                *m_pLayerCell;
    ID2D1Bitmap                *m_pLayerDefect;
 
    ID2D1HwndRenderTarget    *m_pRenderTargetHwnd;
    D2D1_RECT_F                m_rtRenderTargetHwndRect;
    D2D1_SIZE_U                m_uRenderTargetHwndSize;
    D2D1_SIZE_F                m_fRenderTargetHwndSize;
    D2D1_SIZE_U                m_pxRenderTargetHwndSize;
    D2D1_MATRIX_3X2_F        m_matTransform;
 
    // map 
    int                        m_nMapDrawType;
    float                    m_fMapZoomLevel;
    CPoint                    m_ptMapPoint;
    D2D1_SIZE_F                m_fMapTranslation;
    D2D1_SIZE_F                m_fMapScale;
    D2D1_POINT_2F            m_fMapPoint;
    UINT                    m_nMapBackColor;
 
    // glass
    BOOL                    m_bDrawGlass;
    BOOL                    m_bDrawCell;
    BOOL                    m_bDrawDefect;
 
    // object
    CDrawData_Glass            m_DrawData_Glass;
    VectorDrawData_Cell        m_vecDrawData_Cell;
 
public:
    afx_msg void OnPaint();
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
    
};