SDC C-Project CF Review 프로그램
KEJ
2024-06-26 0c66940a8e2cf64c9890519901f433b3668216b6
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
#pragma once
 
#include "CHImageControls/CHImageData.h"
 
#define IDR_LOAD_IMAGE        9000
#define IDR_SAVE_IMAGE        9001
#define IDR_ONLY_SAVE_IMAGE    9002
 
#define IDR_CENTER_LINE        9100
#define IDR_RULER            9101
#define IDR_ROI_RECT        9102
#define IDR_CLEAR_ROI_RECT    9103
#define IDR_SAVE_ROI_RECT    9104
    
#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
 
 
// CDlgHistory 대화 상자입니다.
interface ICameraImageView2Parent
{
    virtual void CIV2P_GetImagePathName(CString& strFilename) = 0;
    virtual void CIV2P_ManualSimulation(CCHImageData* pImageData) = 0;
};
 
class CCameraImageView : public CWnd, public CCHImageData
{
    DECLARE_DYNAMIC(CCameraImageView)
 
public:
    double d_MatchingRate;
    double d_FindScore;
    CCameraImageView(CWnd *pParentWnd);
    virtual ~CCameraImageView();
    void SetCIV2P(ICameraImageView2Parent* pCIV2P)        { m_pCIV2P = pCIV2P; }
 
    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
    int        GetScaleWidth(void);
    int        GetScaleHeight(void);
    int        GetHScrollPos(void);
    int        GetVScrollPos(void);
    double    GetWidthScale()        { return m_dWidthScale; }
    double    GetHeightScale()    { return m_dHeightScale; }
 
    // setter
    void    SetDrawObject(BOOL bDraw);
    void    SetDrawMode(int nDrawMode);
    void    SetViewName(const CString strViewName);
    void    SetParentWnd(CWnd* pParentWnd);
    void    SetDrawCenterLine(BOOL bDraw);
    void    SetDrawRuler(BOOL bDraw);
 
    void    SetResolution(double dRes);
    void    SetRulerGab(double dGab);
 
    BOOL    LoadImage(const CString& strFilename);
 
protected:
    void    UpdateImageView(CDC *pDC);
    void    DrawCenterLine(CDC *pDC);
    void    DrawRuler(CDC *pDC);
    void    DrawViewName(CDC *pDC);
 
    ICameraImageView2Parent*    m_pCIV2P;
 
    CRITICAL_SECTION    m_csImageData;
    CWnd                *m_pParentWnd;
    CString                m_strViewName;
    CCHImageData        m_OriginImage;
 
    // pre draw info
    int            m_nViewBand;
    CRect        m_rtClientRect;
    int            m_nScaleWidth;
    int            m_nScaleHeight;
    double        m_dWidthScale; 
    double        m_dHeightScale;
 
    // Scroll Pos
    int            m_nVScroll;
    int            m_nHScroll;
    // Max Scroll Pos
    int            m_nMaxVScroll;
    int            m_nMaxHScroll;
 
    // image draw
    int            m_nDrawMode;
    BOOL        m_bDrawViewName;
 
    BOOL        m_bDrawCenterLine;
    BOOL        m_bDrawRuler;
    double        m_dRulerGab;
    double        m_dResolution;
 
protected:
    DECLARE_MESSAGE_MAP()
    afx_msg void OnLoadImage();
    afx_msg void OnSaveImage();
    afx_msg void OnCenterLine();
    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();
    afx_msg void OnDestroy();
    afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
    afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
 
    afx_msg void OnPaint();
 
    afx_msg void OnMouseMove(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 OnRButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
    afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
    
public:
    
};
 
typedef std::vector<CCameraImageView*>                    VectorCameraImageView;
typedef std::vector<CCameraImageView*>::iterator        VectorCameraImageViewIt;