Repository navigation
Expand file tree
/
Copy pathWorkingMode.cpp
More file actions
executable file
·241 lines (215 loc) · 7.51 KB
/
Copy pathWorkingMode.cpp
File metadata and controls
executable file
·241 lines (215 loc) · 7.51 KB
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
// WorkingMode.cpp : implementation file
//
#include "stdafx.h"
#include "LaserScan.h"
#include "WorkingMode.h"
#include "RTC5impl.hpp"
#include "LaserScanDoc.h"
// CWorkingMode dialog
IMPLEMENT_DYNAMIC(CWorkingMode, CDialog)
CWorkingMode::CWorkingMode(CWnd* pParent /*=NULL*/)
: CDialog(CWorkingMode::IDD, pParent)
{
}
CWorkingMode::~CWorkingMode()
{
}
void CWorkingMode::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TREE_WorkingMode, m_tree_Working);
}
BEGIN_MESSAGE_MAP(CWorkingMode, CDialog)
ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_WorkingMode, &CWorkingMode::OnTvnSelchangedTreeWorkingmode)
ON_BN_CLICKED(IDC_BUTTON1, &CWorkingMode::OnBnClickedButton1)
END_MESSAGE_MAP()
// CWorkingMode message handlers
BOOL CWorkingMode::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
HTREEITEM hItem, hSubItem;
hItem = m_tree_Working.InsertItem(_T("Select Working Mode"), TVI_ROOT);
hSubItem = m_tree_Working.InsertItem(_T("Wobbel Motion"), hItem);
hSubItem = m_tree_Working.InsertItem(_T("Processing-on-the-fly"), hItem, hSubItem);
hSubItem = m_tree_Working.InsertItem(_T("Automatic Self-Calibration"), hItem, hSubItem);
m_tree_Working.Expand(hItem,TVE_EXPAND);
m_Wobbel.Create(IDD_Wobbel, this);
m_Processing.Create(IDD_Processing, this);
m_Automatic.Create(IDD_Automatic, this);
CRect r;
GetDlgItem(IDC_STATIC_WorkingMode)->GetWindowRect(r);
ScreenToClient(r);
GetDlgItem(IDC_STATIC_WorkingMode)->DestroyWindow();
m_Wobbel.MoveWindow(r);
m_Processing.MoveWindow(r);
m_Automatic.MoveWindow(r);
m_Wobbel.ShowWindow(SW_HIDE);
m_Processing.ShowWindow(SW_HIDE);
m_Automatic.ShowWindow(SW_HIDE);
m_Wobbel.transversal=CLaserScanDoc::s_transversal;
m_Wobbel.longitudinal=CLaserScanDoc::s_longitudinal;
m_Wobbel.freq=CLaserScanDoc::s_freq;
m_Wobbel.mode=CLaserScanDoc::s_mode;
m_Wobbel.UpdateData(FALSE);
m_Processing.scalex=CLaserScanDoc::s_scalex;
m_Processing.scaley=CLaserScanDoc::s_scaley;
m_Processing.rot_x=CLaserScanDoc::s_rot_x;
m_Processing.rot_y=CLaserScanDoc::s_rot_y;
m_Processing.resolution=CLaserScanDoc::s_resolution;
m_Processing.ret_x=CLaserScanDoc::s_ret_x;
m_Processing.ret_y=CLaserScanDoc::s_ret_y;
m_Processing.func=CLaserScanDoc::s_func_p;
m_Processing.UpdateData(FALSE);
m_Automatic.headNo=CLaserScanDoc::s_headNo;
m_Automatic.command=CLaserScanDoc::s_command;
m_Automatic.gainX=CLaserScanDoc::s_gainX;
m_Automatic.gainY=CLaserScanDoc::s_gainY;
m_Automatic.offsetX=CLaserScanDoc::s_offsetX;
m_Automatic.offsetY=CLaserScanDoc::s_offsetY;
m_Automatic.Ecode=CLaserScanDoc::s_Ecode;
m_Automatic.func=CLaserScanDoc::s_func_a;
m_Automatic.UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CWorkingMode::OnTvnSelchangedTreeWorkingmode(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
// TODO: Add your control notification handler code here
HTREEITEM hItem = m_tree_Working.GetSelectedItem();
CString str = m_tree_Working.GetItemText(hItem);
if (str.Compare(_T("Wobbel Motion")) == 0)
{
m_Wobbel.ShowWindow(SW_SHOW);
m_Processing.ShowWindow(SW_HIDE);
m_Automatic.ShowWindow(SW_HIDE);
m_Wobbel.UpdateData();
//m_Wobbel.transversal=CLaserScanDoc::s_transversal;
//m_Wobbel.longitudinal=CLaserScanDoc::s_longitudinal;
//m_Wobbel.freq=CLaserScanDoc::s_freq;
//m_Wobbel.mode=CLaserScanDoc::s_mode;
//m_Wobbel.UpdateData(FALSE);
}
else if (str.Compare(_T("Processing-on-the-fly")) == 0)
{
m_Wobbel.ShowWindow(SW_HIDE);
m_Processing.ShowWindow(SW_SHOW);
m_Automatic.ShowWindow(SW_HIDE);
m_Processing.UpdateData();
//m_Processing.scalex=CLaserScanDoc::s_scalex;
//m_Processing.scaley=CLaserScanDoc::s_scaley;
//m_Processing.rot_x=CLaserScanDoc::s_rot_x;
//m_Processing.rot_y=CLaserScanDoc::s_rot_y;
//m_Processing.resolution=CLaserScanDoc::s_resolution;
//m_Processing.ret_x=CLaserScanDoc::s_ret_x;
//m_Processing.ret_y=CLaserScanDoc::s_ret_y;
//m_Processing.func=CLaserScanDoc::s_func_p;
//m_Processing.UpdateData(FALSE);
}
else if (str.Compare(_T("Automatic Self-Calibration")) == 0)
{
m_Wobbel.ShowWindow(SW_HIDE);
m_Processing.ShowWindow(SW_HIDE);
m_Automatic.ShowWindow(SW_SHOW);
m_Automatic.UpdateData();
//m_Automatic.headNo=CLaserScanDoc::s_headNo;
//m_Automatic.command=CLaserScanDoc::s_command;
//m_Automatic.gainX=CLaserScanDoc::s_gainX;
//m_Automatic.gainY=CLaserScanDoc::s_gainY;
//m_Automatic.offsetX=CLaserScanDoc::s_offsetX;
//m_Automatic.offsetY=CLaserScanDoc::s_offsetY;
//m_Automatic.Ecode=CLaserScanDoc::s_Ecode;
//m_Automatic.func=CLaserScanDoc::s_func_a;
//m_Automatic.UpdateData(FALSE);
}
else
{
m_Wobbel.ShowWindow(SW_HIDE);
m_Processing.ShowWindow(SW_HIDE);
m_Automatic.ShowWindow(SW_HIDE);
}
*pResult = 0;
}
void CWorkingMode::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
HTREEITEM hItem = m_tree_Working.GetSelectedItem();
CString str = m_tree_Working.GetItemText(hItem);
if (str.Compare(_T("Wobbel Motion")) == 0)
{
m_Wobbel.UpdateData();
set_start_list(1);
set_wobbel_mode(m_Wobbel.transversal, m_Wobbel.longitudinal, m_Wobbel.freq, m_Wobbel.mode);
set_end_of_list();
execute_list(1);
m_Wobbel.UpdateData(false);
}
else if (str.Compare(_T("Processing-on-the-fly")) == 0)
{
m_Processing.UpdateData();
set_start_list(1);
if (m_Processing.func == 0)
{
set_fly_x(m_Processing.scalex);
set_fly_y(m_Processing.scaley);
}
else if (m_Processing.func == 1)
{
set_rot_center(m_Processing.rot_x, m_Processing.rot_y);
set_fly_rot(m_Processing.resolution);
}
else if (m_Processing.func == 2)
{
fly_return(m_Processing.ret_x, m_Processing.ret_y);
}
else
{
MessageBox(_T("ERROR!"));
}
set_end_of_list();
execute_list(1);
m_Processing.UpdateData(false);
}
else if (str.Compare(_T("Automatic Self-Calibration")) == 0)
{
m_Automatic.UpdateData();
set_start_list(1);
if (m_Automatic.func == 0)
{
UINT ErrorCode = auto_cal(m_Automatic.headNo, m_Automatic.command);
m_Automatic.Ecode = ErrorCode;
}
else if (m_Automatic.func == 1)
{
set_hi(m_Automatic.headNo, m_Automatic.gainX, m_Automatic.gainY, m_Automatic.offsetX, m_Automatic.offsetY);
}
set_end_of_list();
execute_list(1);
m_Automatic.UpdateData(false);
}
m_Wobbel.UpdateData();
CLaserScanDoc::s_transversal=m_Wobbel.transversal;
CLaserScanDoc::s_longitudinal=m_Wobbel.longitudinal;
CLaserScanDoc::s_freq=m_Wobbel.freq;
CLaserScanDoc::s_mode=m_Wobbel.mode;
m_Processing.UpdateData();
CLaserScanDoc::s_scalex=m_Processing.scalex;
CLaserScanDoc::s_scaley=m_Processing.scaley;
CLaserScanDoc::s_rot_x=m_Processing.rot_x;
CLaserScanDoc::s_rot_y=m_Processing.rot_y;
CLaserScanDoc::s_resolution=m_Processing.resolution;
CLaserScanDoc::s_ret_x=m_Processing.ret_x;
CLaserScanDoc::s_ret_y=m_Processing.ret_y;
CLaserScanDoc::s_func_p=m_Processing.func;
//m_Automatic
m_Automatic.UpdateData();
CLaserScanDoc::s_headNo=m_Automatic.headNo;
CLaserScanDoc::s_command=m_Automatic.command;
CLaserScanDoc::s_gainX=m_Automatic.gainX;
CLaserScanDoc::s_gainY=m_Automatic.gainY;
CLaserScanDoc::s_offsetX=m_Automatic.offsetX;
CLaserScanDoc::s_offsetY=m_Automatic.offsetY;
CLaserScanDoc::s_Ecode=m_Automatic.Ecode;
CLaserScanDoc::s_func_a=m_Automatic.func;
}