104: QWidget(0,Qt::WindowStaysOnTopHint),
m_d(new
Imp)
112 m_d->theclass =
this;
113 m_d->ui.setupUi(
this);
114 m_d->ui.groupBox_camera->setChecked(
true);
115 m_d->ui.groupBox_viewer->setChecked(
false);
119 m_d->viewer = viewer;
121 setWindowIcon(QIcon(QString(
":/vp1/icons/icons/3d_32x32.png")));
124 m_d->ui.label_focal->setText( QString::number(
m_d->viewer->getCamera()->focalDistance.getValue()) );
125 m_d->ui.doubleSpinBox_offset->setValue(
m_d->viewer->stereo_offset_camera);
126 m_d->ui.doubleSpinBox_parallax->setValue(
m_d->viewer->stereo_parallax_camera);
127 m_d->ui.doubleSpinBox_offset_viewer->setValue(
m_d->viewer->stereo_offset_viewer);
130 connect(
m_d->ui.pushButton_focal,SIGNAL(clicked()),
this,SLOT(
updateFocal()));
132 connect(
m_d->ui.pushButton_setToFocal30,SIGNAL(clicked()),
this,SLOT(
setToFocal30()));
135 connect(
m_d->ui.pushButton_defCamera,SIGNAL(clicked()),
this,SLOT(
buttonClicked()));
136 connect(
m_d->ui.pushButton_defViewer,SIGNAL(clicked()),
this,SLOT(
buttonClicked()));
138 connect(
m_d->ui.pushButton_refresh,SIGNAL(clicked()),
this,SLOT(
buttonClicked()));
139 connect(
m_d->ui.pushButton_refreshViewer,SIGNAL(clicked()),
this,SLOT(
buttonClicked()));
141 connect(
m_d->ui.radioButton_standard,SIGNAL(toggled(
bool)),
this,SLOT(
changedView(
bool)));
142 connect(
m_d->ui.radioButton_left,SIGNAL(toggled(
bool)),
this,SLOT(
changedView(
bool)));
143 connect(
m_d->ui.radioButton_right,SIGNAL(toggled(
bool)),
this,SLOT(
changedView(
bool)));
147 connect(
m_d->ui.radioButton_standard_viewer,SIGNAL(toggled(
bool)),
this,SLOT(
changedView_viewer(
bool)));
155 connect(
m_d->ui.doubleSpinBox_imageWidth_meter,SIGNAL(valueChanged(
double)),
this,SLOT(
perform3DCalculations(
double)));
156 connect(
m_d->ui.doubleSpinBox_imageWidth_inch,SIGNAL(valueChanged(
double)),
this,SLOT(
perform3DCalculations(
double)));
169 m_d->ui.groupBox_viewer->hide();
193 m_d->ui.label_focal->setText( QString::number(
m_d->viewer->getCamera()->focalDistance.getValue()) );
195 m_d->ui.doubleSpinBox_offset->setValue(
m_d->viewer->stereo_offset_camera);
196 m_d->ui.doubleSpinBox_parallax->setValue(
m_d->viewer->stereo_parallax_camera);
197 m_d->ui.doubleSpinBox_offset_viewer->setValue(
m_d->viewer->stereo_offset_viewer);
199 m_d->ui.radioButton_standard->setChecked(
true);
200 m_d->ui.radioButton_noStereo->setChecked(
true);
201 m_d->ui.radioButton_standard_viewer->setChecked(
true);
203 m_d->ui.groupBox_2->setEnabled(
false);
206 QWidget::showEvent(
ev);
237 double value_meters = 0.;
239 if (
m_d->ui.doubleSpinBox_imageWidth_meter==sender()) {
241 m_d->ui.doubleSpinBox_imageWidth_inch->setValue( value * 39.370);
242 value_meters = value;
244 else if (
m_d->ui.doubleSpinBox_imageWidth_inch==sender()) {
246 m_d->ui.doubleSpinBox_imageWidth_meter->setValue( value / 39.370);
247 value_meters = value / 39.370;
250 value_meters =
m_d->ui.doubleSpinBox_imageWidth_meter->value();
255 double nativeParallax =
m_d->ui.doubleSpinBox_offset->value() / value_meters;
256 double minimumObjDistance =
m_d->ui.doubleSpinBox_offset->value() / 30.;
259 m_d->ui.label_nativeParalValue->setText( QString::number(nativeParallax) );
260 m_d->ui.label_minObjDistValue->setText( QString::number(minimumObjDistance) );
270 SoCamera *camera =
m_d->viewer->getCamera();
271 if (
m_d->ui.radioButton_standard->isChecked() ) {
272 camera->setStereoMode(SoCamera::MONOSCOPIC);
275 else if (
m_d->ui.radioButton_left->isChecked() ) {
276 camera->setStereoMode(SoCamera::LEFT_VIEW);
279 else if (
m_d->ui.radioButton_right->isChecked() ) {
280 camera->setStereoMode(SoCamera::RIGHT_VIEW);
291 if (
m_d->ui.radioButton_left_viewer->isChecked())
298 if (
m_d->ui.radioButton_right_viewer->isChecked())
305 if (
m_d->ui.radioButton_standard_viewer->isChecked())
309 if (
m_d->ui.radioButton_noStereo->isChecked())
311 m_d->viewer->setStereoTypeSlot(SoQtViewer::STEREO_NONE);
312 m_d->ui.groupBox_2->setEnabled(
false);
314 if (
m_d->ui.radioButton_anaglyph->isChecked())
316 m_d->viewer->setStereoTypeSlot(SoQtViewer::STEREO_ANAGLYPH);
317 m_d->ui.groupBox_2->setEnabled(
true);
319 if (
m_d->ui.radioButton_quadbuffer->isChecked())
321 m_d->viewer->setStereoTypeSlot(SoQtViewer::STEREO_QUADBUFFER);
322 m_d->ui.groupBox_2->setEnabled(
true);
324 if (
m_d->ui.radioButton_int_rows->isChecked())
326 m_d->viewer->setStereoTypeSlot(SoQtViewer::STEREO_INTERLEAVED_ROWS);
327 m_d->ui.groupBox_2->setEnabled(
true);
329 if (
m_d->ui.radioButton_int_cols->isChecked())
331 m_d->viewer->setStereoTypeSlot(SoQtViewer::STEREO_INTERLEAVED_COLUMNS);
332 m_d->ui.groupBox_2->setEnabled(
true);
348 if (
m_d->ui.pushButton_refresh==sender())
351 double offset(
m_d->ui.doubleSpinBox_offset->value());
352 double parallax(
m_d->ui.doubleSpinBox_parallax->value());
354 float old_offset =
m_d->viewer->stereo_offset_camera;
355 float old_parallax =
m_d->viewer->stereo_parallax_camera;
357 SoCamera *camera =
m_d->viewer->getCamera();
359 if (old_offset != offset) {
360 camera->setStereoAdjustment(offset);
361 m_d->viewer->stereo_offset_camera = offset;
364 if (old_parallax != parallax) {
365 camera->setBalanceAdjustment(parallax);
366 m_d->viewer->stereo_parallax_camera = parallax;
374 else if (
m_d->ui.pushButton_refreshViewer==sender())
377 double offset(
m_d->ui.doubleSpinBox_offset_viewer->value());
379 float old_offset =
m_d->viewer->stereo_offset_viewer;
381 if (old_offset != offset) {
382 m_d->viewer->setStereoOffsetSlot(offset);
383 m_d->viewer->stereo_offset_viewer = offset;
389 else if (
m_d->ui.pushButton_defCamera==sender())
413 double defParall = 1.0;
415 m_d->ui.doubleSpinBox_offset->setValue(defOff);
416 m_d->ui.doubleSpinBox_parallax->setValue(defParall);
422 else if (
m_d->ui.pushButton_defViewer==sender())
435 m_d->ui.doubleSpinBox_offset_viewer->setValue(defOff);