-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathDlgEdgeSobelPrewitt.cpp
164 lines (138 loc) · 4.08 KB
/
DlgEdgeSobelPrewitt.cpp
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
// DlgEdgeSobelPrewitt.cpp : 实现文件
//
#include "stdafx.h"
#include "DIPDemo.h"
#include "DlgEdgeSobelPrewitt.h"
// CDlgEdgeSobelPrewitt 对话框
IMPLEMENT_DYNAMIC(CDlgEdgeSobelPrewitt, CDialog)
CDlgEdgeSobelPrewitt::CDlgEdgeSobelPrewitt(CWnd* pParent /*=NULL*/)
: CDialog(CDlgEdgeSobelPrewitt::IDD, pParent)
, m_bThre(0)
, m_nEdgeType(0)
, m_bThining(1)
, m_bGratOnly(0)
, isRobert(false)
, isGauss(false)
, m_dSigma(0)
{
}
CDlgEdgeSobelPrewitt::~CDlgEdgeSobelPrewitt()
{
}
void CDlgEdgeSobelPrewitt::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, m_bThre);
DDV_MinMaxByte(pDX, m_bThre, 0, 255);
DDX_Check(pDX, IDC_CHECK2, m_bThining);
DDX_Check(pDX, IDC_CHECK3, m_bGratOnly);
DDX_Text(pDX, IDC_EDIT2, m_dSigma);
DDV_MinMaxDouble(pDX, m_dSigma, 0, 5);
}
BEGIN_MESSAGE_MAP(CDlgEdgeSobelPrewitt, CDialog)
ON_BN_CLICKED(IDC_RADIO1, CDlgEdgeSobelPrewitt::OnBnClickedRadio1)
ON_BN_CLICKED(IDC_RADIO2, CDlgEdgeSobelPrewitt::OnBnClickedRadio2)
ON_BN_CLICKED(IDC_RADIO3, CDlgEdgeSobelPrewitt::OnBnClickedRadio3)
ON_BN_CLICKED(IDC_RADIO4, CDlgEdgeSobelPrewitt::OnBnClickedRadio4)
ON_BN_CLICKED(IDC_RADIO5, CDlgEdgeSobelPrewitt::OnBnClickedRadio5)
ON_BN_CLICKED(IDC_CHECK1, CDlgEdgeSobelPrewitt::OnBnClickedCheck1)
ON_BN_CLICKED(IDC_CHECK2, CDlgEdgeSobelPrewitt::OnBnClickedCheck2)
// ON_WM_CREATE()
ON_WM_ACTIVATE()
ON_BN_CLICKED(IDC_CHECK3, CDlgEdgeSobelPrewitt::OnBnClickedCheck3)
END_MESSAGE_MAP()
// CDlgEdgeSobelPrewitt 消息处理程序
void CDlgEdgeSobelPrewitt::OnBnClickedRadio1()
{
// TODO: 在此添加控件通知处理程序代码
m_nEdgeType = 0;
UpdateData(true);
}
void CDlgEdgeSobelPrewitt::OnBnClickedRadio2()
{
// TODO: 在此添加控件通知处理程序代码
m_nEdgeType = 1;
UpdateData(true);
}
void CDlgEdgeSobelPrewitt::OnBnClickedRadio3()
{
// TODO: 在此添加控件通知处理程序代码
m_nEdgeType = 2;
UpdateData(true);
}
void CDlgEdgeSobelPrewitt::OnBnClickedRadio4()
{
// TODO: 在此添加控件通知处理程序代码
m_nEdgeType = 3;
UpdateData(true);
}
void CDlgEdgeSobelPrewitt::OnBnClickedRadio5()
{
// TODO: 在此添加控件通知处理程序代码
m_nEdgeType = 4;
UpdateData(true);
}
void CDlgEdgeSobelPrewitt::OnBnClickedCheck1()
{
// TODO: 在此添加控件通知处理程序代码
if (IsDlgButtonChecked(IDC_CHECK1)) {
(CEdit *)GetDlgItem(IDC_EDIT1)->EnableWindow(false);
m_bThre = 0;
}
else
{
(CEdit *)GetDlgItem(IDC_EDIT1)->EnableWindow(true);
}
}
void CDlgEdgeSobelPrewitt::OnBnClickedCheck2()
{
// TODO: 在此添加控件通知处理程序代码
}
void CDlgEdgeSobelPrewitt::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
CDialog::OnActivate(nState, pWndOther, bMinimized);
// TODO: 在此处添加消息处理程序代码
if (isRobert)
{
(CButton *)GetDlgItem(IDC_RADIO2)->EnableWindow(false);
(CButton *)GetDlgItem(IDC_RADIO3)->EnableWindow(false);
}
if (isGauss)
{
(CStatic *)GetDlgItem(IDC_GROUP)->ShowWindow(SW_HIDE);
(CButton *)GetDlgItem(IDC_RADIO1)->ShowWindow(SW_HIDE);
(CButton *)GetDlgItem(IDC_RADIO2)->ShowWindow(SW_HIDE);
(CButton *)GetDlgItem(IDC_RADIO3)->ShowWindow(SW_HIDE);
(CButton *)GetDlgItem(IDC_RADIO4)->ShowWindow(SW_HIDE);
(CButton *)GetDlgItem(IDC_RADIO5)->ShowWindow(SW_HIDE);
(CButton *)GetDlgItem(IDC_CHECK3)->ShowWindow(SW_HIDE);
}
else
{
(CStatic *)GetDlgItem(IDC_GROUP1)->ShowWindow(SW_HIDE);
(CStatic *)GetDlgItem(IDC_STATIC1)->ShowWindow(SW_HIDE);
(CStatic *)GetDlgItem(IDC_STATIC2)->ShowWindow(SW_HIDE);
(CEdit *)GetDlgItem(IDC_EDIT2)->ShowWindow(SW_HIDE);
}
CheckDlgButton(IDC_RADIO1, 1);
CheckDlgButton(IDC_CHECK1, 1);
CheckDlgButton(IDC_CHECK2, 1);
}
void CDlgEdgeSobelPrewitt::OnBnClickedCheck3()
{
// TODO: 在此添加控件通知处理程序代码
static BOOL sbEdit1;
if (IsDlgButtonChecked(IDC_CHECK3))
{
(CButton *)GetDlgItem(IDC_CHECK1)->EnableWindow(false);
(CButton *)GetDlgItem(IDC_CHECK2)->EnableWindow(false);
sbEdit1 = ((CEdit *)GetDlgItem(IDC_EDIT1))->IsWindowEnabled();
(CEdit *)GetDlgItem(IDC_EDIT1)->EnableWindow(false);
}
else
{
(CButton *)GetDlgItem(IDC_CHECK1)->EnableWindow(true);
(CButton *)GetDlgItem(IDC_CHECK2)->EnableWindow(true);
(CEdit *)GetDlgItem(IDC_EDIT1)->EnableWindow(sbEdit1);
}
}