4 # pragma warning(disable: 4005)
7 #include "VideoSource_Controller_PMDZess.hh"
10 # include <Base/Common/getopt_W32.h>
14 #include <Base/Image/ImageIO.hh>
15 #include <Image/Camera.hh>
16 #include <Gui/StringConv.hh>
36 ,wxDefaultPosition,wxSize(500,500),wxSTAY_ON_TOP |wxCAPTION){
48 VideoSource_Controller_PMDZess::
49 ~VideoSource_Controller_PMDZess()
54 void VideoSource_Controller_PMDZess::
57 sliderBox_ShGa_Visible =
true;
60 wxSize SlSize(100,200);
64 wxBoxSizer *slGa =
new wxBoxSizer(wxVERTICAL);
65 wxStaticText *textGain =
new wxStaticText(
this,ID_TEXT, wxT(
"Gain 2D\n[dB]"));
66 SliderGain2D =
new wxSlider(
this, ID_GAIN2D, 0, 0, 30000,
67 wxDefaultPosition,SlSize,
68 wxSL_VERTICAL | wxSL_LABELS | wxSL_RIGHT,
69 wxDefaultValidator, wxT(
"Gain2D"));
71 SliderGain2D->Enable(
true);
72 slGa->Add(textGain,0,wxALL,2);
73 slGa->Add(SliderGain2D,0, wxALL,2);
76 wxBoxSizer *slSh =
new wxBoxSizer(wxVERTICAL);
77 wxStaticText *textShutter =
new wxStaticText(
this,ID_TEXT, wxT(
"Shutter 2D\n[ms*100]"));
78 SliderShutter2D =
new wxSlider(
this, ID_SHUTTER2D, 20, 0, 80000,
79 wxDefaultPosition,SlSize,
80 wxSL_VERTICAL | wxSL_LABELS | wxSL_RIGHT,
81 wxDefaultValidator, wxT(
"Shutter2D"));
83 SliderShutter2D->Enable(
true);
84 slSh->Add(textShutter,0,wxALL,2);
85 slSh->Add(SliderShutter2D,0,wxALL, 2);
89 wxBoxSizer *slSh3D =
new wxBoxSizer(wxVERTICAL);
90 wxStaticText *textShutter3D =
new wxStaticText(
this,ID_TEXT, wxT(
"Shutter 3D\n[ms*100]"));
91 SliderShutter3D =
new wxSlider(
this, ID_SHUTTER3D, 20, 0, 80000,
92 wxDefaultPosition,SlSize,
93 wxSL_VERTICAL | wxSL_LABELS | wxSL_RIGHT,
94 wxDefaultValidator, wxT(
"Shutter3D"));
96 SliderShutter3D->Enable(
true);
97 slSh3D->Add(textShutter3D,0,wxALL,2);
98 slSh3D->Add(SliderShutter3D,0,wxALL, 2);
101 wxBoxSizer *boxModFreq =
new wxBoxSizer(wxVERTICAL);
102 wxStaticText *textModFreq =
new wxStaticText(
this,ID_TEXT, wxT(
"Modulation\nFrequency\n[MHz]"));
103 modulationFreqText =
new wxTextCtrl(
this,ID_MODULATION_TEXT,
"20.0",
104 wxDefaultPosition,wxSize(50,20));
105 setModFreqButton =
new wxButton(
this, ID_MODULATIONFREQUENCY, wxT(
"SetModFreq"),
106 wxDefaultPosition,wxSize(100,50));
108 boxModFreq->Add(textModFreq,0,wxALL|wxCENTER,2);
109 boxModFreq->Add(modulationFreqText,0,wxALL|wxCENTER,2);
110 boxModFreq->Add(setModFreqButton,0,wxALL|wxCENTER,2);
112 wxBoxSizer *sl =
new wxBoxSizer(wxHORIZONTAL);
113 sl->Add(slGa,0,wxALL, 2);
114 sl->Add(slSh,0,wxALL,2);
115 sl->Add(slSh3D,0,wxALL,2);
116 sl->Add(boxModFreq,0,wxALL,2);
118 showButton =
new wxButton(
this, ID_HIDE, wxT(
"Hide"),
119 wxDefaultPosition,BtSize);
120 update_Button =
new wxButton(
this, ID_BUTTON_UPDATE,
121 wxT(
"UPDATE"),wxDefaultPosition,BtSize);
123 vBox =
new wxBoxSizer(wxHORIZONTAL);
124 vBox->Add(showButton,0,wxALIGN_LEFT | wxBOTTOM);
125 vBox->Add(update_Button, 0, wxALIGN_RIGHT | wxBOTTOM);
128 sliderBox_ShGa =
new wxBoxSizer(wxVERTICAL);
129 sliderBox_ShGa->Add(sl,0,wxALL, 2);
130 sliderBox_ShGa->Add(vBox,0,wxALL,2);
132 vBox->SetSizeHints(
this);
133 this->SetSizer(sliderBox_ShGa);
137 wxCommandEvent fakeEvent;
142 void VideoSource_Controller_PMDZess::
148 void VideoSource_Controller_PMDZess::
149 OnHide(wxCommandEvent& event){
153 void VideoSource_Controller_PMDZess::
154 OnClose(wxCloseEvent& event) {
159 void VideoSource_Controller_PMDZess::
160 OnModFreq(wxCommandEvent& event) {
161 wxString modFreq = modulationFreqText->GetValue();
163 int res = modFreq.ToDouble(¤t);
164 if (res >=0 && Cam_!= NULL) {
166 cout<<
"Setting ModulationFreq "<<current<<endl;
170 void VideoSource_Controller_PMDZess::
171 OnGain2D(wxScrollEvent& event) {
172 double value = SliderGain2D->GetValue();
175 BIASERR(
"Not working");
177 cout<<
"Setting Gain 2D "<<value/100.0f<<endl;
180 void VideoSource_Controller_PMDZess::
181 OnShutter2D(wxScrollEvent& event) {
182 double value = SliderShutter2D->GetValue();
184 Cam_->SetShutter2D(value/100.0);
188 void VideoSource_Controller_PMDZess::
189 OnShutter3D(wxScrollEvent& event) {
190 double value = SliderShutter3D->GetValue();
192 Cam_->SetShutter3D(value/100.0);
197 void VideoSource_Controller_PMDZess::
200 float currentShutter2D =0.0;
201 currentShutter2D = Cam_->GetShutter2D();
202 SliderShutter2D->SetValue(
int(currentShutter2D*100.0));
204 float currentShutter3D= Cam_->GetShutter3D();
205 SliderShutter3D->SetValue(
int(currentShutter3D*100.0f));
207 float currentGain2D = Cam_->GetGain2D();
208 SliderGain2D->SetValue(
int(currentGain2D));
210 int modFreq = Cam_->GetModulationFrequency();
212 BIASERR(
"Camera returned wrong Modulation Frequency");
214 text.Printf(wxT(
"%d"),modFreq );
215 modulationFreqText->SetValue(text);
219 void VideoSource_Controller_PMDZess::
220 OnUpdate(wxCommandEvent& event) {
224 void VideoSource_Controller_PMDZess::
225 SetShutter2DRange(
unsigned int min,
unsigned int max)
227 SliderShutter2D->SetRange(min,max);
231 void VideoSource_Controller_PMDZess::
232 SetShutter3DRange(
unsigned int min,
unsigned int max)
234 SliderShutter3D->SetRange(min,max);
238 void VideoSource_Controller_PMDZess::
239 SetGain2DRange(
unsigned int min,
unsigned int max)
241 SliderGain2D->SetRange(min,max);
represents Zess PMD camera driver interface TODO: include support for normal images (2DImg_)...
Defines a common interface to different devices.