SDC C-Project CF Review 프로그램
LYW
2021-07-01 597136832196f40e9d91dee12c3b9ca94a8fc7eb
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
#pragma once
 
 
// CVirtualGlassView
#include "CHImageControls/CHImageData.h"
#include "CHVirtualGlassMap/VirtualGlassMapInfo.h"
 
#define IDR_LOAD_IMAGE        9000
#define IDR_SAVE_IMAGE        9002
#define IDR_SAVE_AS_IMAGE    9003
 
#define IDR_IMAGE_INFO        9100
#define IDR_CENTER_LINE        9101
#define IDR_CENTER_RECT        9102
#define IDR_RULER            9103
 
#define IDR_ROI_RECT        9104
#define IDR_CLEAR_ROI_RECT    9105
#define IDR_SAVE_ROI_RECT    9106
 
#define IDR_VIEW_ORIGIN        9200
#define IDR_VIEW_FIT        9201
 
#define IDR_VIEW_COLOR        9300
#define IDR_VIEW_GRAY        9301
#define IDR_VIEW_RED        9302
#define IDR_VIEW_BLUE        9303
#define IDR_VIEW_GREEN        9304
 
struct SPixelInfo
{
    SPixelInfo() 
    {
        nWidthPixel = 0;
        nHeightPixel = 0;
        dDiagonalPixel = 0;
        dWidthRealUM = 0;
        dHeightRealUM = 0;
        dDiagonalRealUM = 0;
    }
    int        nWidthPixel;
    int        nHeightPixel;
    double    dDiagonalPixel;
 
    double    dWidthRealUM;
    double    dHeightRealUM;
    double    dDiagonalRealUM;
 
};
 
class AFX_EXT_CLASS CVirtualGlassView : public CWnd, public CCHImageData
{
    DECLARE_DYNAMIC(CVirtualGlassView)
 
public:
    CVirtualGlassView(int nViewIndex=0, CWnd* pParentWnd=NULL);
    virtual ~CVirtualGlassView();
 
    int        GetScaleWidth();
    int        GetScaleHeight();
    BOOL    GetViewImage(CCHImageData* pImageData);
    BOOL    GetOriginImage(CCHImageData* pImageData);
    BOOL    SetViewImage(CCHImageData* pImageData);
    BOOL    SetOriginImage(CCHImageData* pImageData);
    BOOL    SetOriginImage(int nWidth, int nHeight, int nChannels, int nWidthStep, const BYTE* pBuffer);
 
    // getter 
    double    GetWidthResolution() const;
    double    GetHeightResolution() const;
    double    GetWidthScaleResolution() const;
    double    GetHeightScaleResolution() const;
    double    GetWidthScale() const;
    double    GetHeightScale() const;
    int        GetHScrollPos() const;
    int        GetVScrollPos() const;
    const CVirtualImageInfo* GetImageInfo() const;
 
    // setter
    void    SetViewMode(int nViewMode);
    void    SetViewName(const CString& strViewName);
    void    SetParentWnd(CWnd* pParentWnd);
    void    SetDrawCenterLine(BOOL bDraw);
    void    SetDrawRuler(BOOL bDraw);
    void    SetImageInfo(const CVirtualImageInfo& imageInfo);
    
    // loader
    BOOL    LoadImage(const CString& strFilename);
 
protected:
    DECLARE_MESSAGE_MAP()
 
    afx_msg void OnPaint();
    afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
    afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
    afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
 
    afx_msg void OnLoadImage();
    afx_msg void OnSaveImage();
    afx_msg void OnImageInfo();
    afx_msg void OnCenterLine();
    afx_msg void OnCenterRect();
    afx_msg void OnRuler();
    afx_msg void OnViewOrigin();
    afx_msg void OnViewFit();
    afx_msg void OnViewColor();
    afx_msg void OnViewGray();
    afx_msg void OnViewRed();
    afx_msg void OnViewGreen();
    afx_msg void OnViewBlue();
 
protected:
    void    DrawViewName(CDC *pDC);
    void    DrawCenterRect(CDC *pDC);
    void    DrawCenterLine(CDC *pDC);
    void    DrawRuler(CDC *pDC);
    void    UpdateView(CDC *pDC);
    virtual void PopUpCommandMenu(const CPoint& point);
            
protected:
 
    CRITICAL_SECTION    m_csImageData;
 
    int                    m_nViewIndex;
    CCHImageData        m_OriginImage;
 
    CWnd                *m_pParentWnd;
 
    int                    m_nViewMode;
    int                    m_nViewBand;
    CRect                m_rtViewRect;
    CString                m_strImageInfo;
        
    int                    m_nScaleWidth;
    int                    m_nScaleHeight;
    double                m_dWidthScale; 
    double                m_dHeightScale;
 
    CVirtualImageInfo    m_ImageInfo;
 
    // Scroll Pos
    int                    m_nVScroll;
    int                    m_nHScroll;
    // Max Scroll Pos
    int                    m_nMaxVScroll;
    int                    m_nMaxHScroll;
 
    BOOL                m_bDrawImageInfo;
    BOOL                m_bDrawCenterLine;
    BOOL                m_bDrawCenterRect;
    BOOL                m_bDrawRuler;
 
public:
    afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
    afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
};