1
1
/*
2
- * $Id$
2
+ * $Id$
3
3
*/
4
4
/* **************************************************************************
5
5
globe_plugin_dialog.cpp - settings dialog for the globe plugin
@@ -41,6 +41,7 @@ QgsGlobePluginDialog::QgsGlobePluginDialog( QWidget* parent, Qt::WFlags fl )
41
41
setupUi ( this );
42
42
loadStereoConfig (); // values from settings, default values from OSG
43
43
setStereoConfig (); // overwrite with values from QSettings
44
+ updateStereoDialog (); // update the dialog gui
44
45
}
45
46
46
47
// destructor
@@ -49,7 +50,7 @@ QgsGlobePluginDialog::~QgsGlobePluginDialog()
49
50
}
50
51
51
52
QString QgsGlobePluginDialog::openFile ()
52
- {
53
+ {
53
54
QString path = QFileDialog::getOpenFileName ( this ,
54
55
tr ( " Open earth file" ),
55
56
earthFile,
@@ -69,12 +70,58 @@ bool QgsGlobePluginDialog::globeRunning()
69
70
return true ;
70
71
}
71
72
73
+ void QgsGlobePluginDialog::updateStereoDialog ()
74
+ {
75
+ QString stereoMode = comboStereoMode->currentText () ;
76
+ screenDistance->setEnabled ( true );
77
+ screenHeight->setEnabled ( true );
78
+ screenWidth->setEnabled ( true );
79
+ eyeSeparation->setEnabled ( true );
80
+ splitStereoHorizontalSeparation->setEnabled ( false );
81
+ splitStereoVerticalSeparation->setEnabled ( false );
82
+ splitStereoHorizontalEyeMapping->setEnabled ( false );
83
+ splitStereoVerticalEyeMapping->setEnabled ( false );
84
+
85
+ if (" OFF" == stereoMode)
86
+ {
87
+ screenDistance->setEnabled ( false );
88
+ screenHeight->setEnabled ( false );
89
+ screenWidth->setEnabled ( false );
90
+ eyeSeparation->setEnabled ( false );
91
+ }
92
+ else if (" ANAGLYPHIC" == stereoMode)
93
+ {
94
+ // nothing to do
95
+ }
96
+ else if (" VERTICAL_SPLIT" == stereoMode)
97
+ {
98
+ splitStereoVerticalSeparation->setEnabled ( true );
99
+ splitStereoVerticalEyeMapping->setEnabled ( true );
100
+ }
101
+ else if (" HORIZONTAL_SPLIT" == stereoMode)
102
+ {
103
+ splitStereoHorizontalSeparation->setEnabled ( true );
104
+ splitStereoHorizontalEyeMapping->setEnabled ( true );
105
+ }
106
+ else if (" QUAD_BUFFER" == stereoMode)
107
+ {
108
+ // nothing to do
109
+ }
110
+ else
111
+ {
112
+ // should never get here
113
+ QMessageBox msgBox;
114
+ msgBox.setText (" This stereo mode has not been implemented yet." );
115
+ msgBox.exec ();
116
+ }
117
+ }
118
+
72
119
void QgsGlobePluginDialog::on_buttonBox_accepted ()
73
120
{
74
121
setStereoConfig ();
75
122
saveStereoConfig ();
76
123
/*
77
- *
124
+ *
78
125
// Validate input settings
79
126
QString srcUrl( inputSrcDataset->text() );
80
127
QString srcLayer( comboSrcLayer->currentText() );
@@ -156,11 +203,11 @@ void QgsGlobePluginDialog::on_buttonBox_accepted()
156
203
157
204
// Close dialog box
158
205
*/
159
-
206
+
160
207
if ( globeRunning () )
161
208
{
162
209
restartGlobe ();
163
- }
210
+ }
164
211
accept ();
165
212
}
166
213
@@ -188,6 +235,7 @@ void QgsGlobePluginDialog::on_resetDefaults_clicked()
188
235
void QgsGlobePluginDialog::on_comboStereoMode_currentIndexChanged (QString value)
189
236
{
190
237
setStereoMode ();
238
+ updateStereoDialog ();
191
239
}
192
240
193
241
void QgsGlobePluginDialog::on_eyeSeparation_valueChanged (double value)
@@ -222,13 +270,13 @@ void QgsGlobePluginDialog::on_splitStereoVerticalSeparation_valueChanged(int val
222
270
223
271
void QgsGlobePluginDialog::on_splitStereoHorizontalEyeMapping_currentIndexChanged (int value)
224
272
{
225
- osg::DisplaySettings::instance ()->setSplitStereoHorizontalEyeMapping (
273
+ osg::DisplaySettings::instance ()->setSplitStereoHorizontalEyeMapping (
226
274
(osg::DisplaySettings::SplitStereoHorizontalEyeMapping) value );
227
275
}
228
276
229
277
void QgsGlobePluginDialog::on_splitStereoVerticalEyeMapping_currentIndexChanged (int value)
230
278
{
231
- osg::DisplaySettings::instance ()->setSplitStereoVerticalEyeMapping (
279
+ osg::DisplaySettings::instance ()->setSplitStereoVerticalEyeMapping (
232
280
(osg::DisplaySettings::SplitStereoVerticalEyeMapping) value );
233
281
}
234
282
@@ -241,25 +289,23 @@ void QgsGlobePluginDialog::showMessageBox( QString text )
241
289
242
290
void QgsGlobePluginDialog::loadStereoConfig ()
243
291
{
244
- // TODO: is it ok to default to OFF? or should we implement all of the STEREO_MODES
245
- // and a enable stereo switch?
246
- comboStereoMode->setCurrentIndex ( comboStereoMode->findText ( settings.value ( " /Plugin-Globe/stereoMode" ,
292
+ comboStereoMode->setCurrentIndex ( comboStereoMode->findText ( settings.value ( " /Plugin-Globe/stereoMode" ,
247
293
" OFF" ).toString () ) );
248
- screenDistance->setValue ( settings.value ( " /Plugin-Globe/screenDistance" ,
294
+ screenDistance->setValue ( settings.value ( " /Plugin-Globe/screenDistance" ,
249
295
osg::DisplaySettings::instance ()->getScreenDistance () ).toDouble () );
250
- screenWidth->setValue ( settings.value ( " /Plugin-Globe/screenWidth" ,
296
+ screenWidth->setValue ( settings.value ( " /Plugin-Globe/screenWidth" ,
251
297
osg::DisplaySettings::instance ()->getScreenWidth () ).toDouble () );
252
- screenHeight->setValue ( settings.value ( " /Plugin-Globe/screenHeight" ,
298
+ screenHeight->setValue ( settings.value ( " /Plugin-Globe/screenHeight" ,
253
299
osg::DisplaySettings::instance ()->getScreenHeight () ).toDouble () );
254
- eyeSeparation->setValue ( settings.value ( " /Plugin-Globe/eyeSeparation" ,
300
+ eyeSeparation->setValue ( settings.value ( " /Plugin-Globe/eyeSeparation" ,
255
301
osg::DisplaySettings::instance ()->getEyeSeparation () ).toDouble () );
256
- splitStereoHorizontalSeparation->setValue ( settings.value ( " /Plugin-Globe/splitStereoHorizontalSeparation" ,
302
+ splitStereoHorizontalSeparation->setValue ( settings.value ( " /Plugin-Globe/splitStereoHorizontalSeparation" ,
257
303
osg::DisplaySettings::instance ()->getSplitStereoHorizontalSeparation () ).toInt () );
258
- splitStereoVerticalSeparation->setValue ( settings.value ( " /Plugin-Globe/splitStereoVerticalSeparation" ,
304
+ splitStereoVerticalSeparation->setValue ( settings.value ( " /Plugin-Globe/splitStereoVerticalSeparation" ,
259
305
osg::DisplaySettings::instance ()->getSplitStereoVerticalSeparation () ).toInt () );
260
- splitStereoHorizontalEyeMapping->setCurrentIndex ( settings.value ( " /Plugin-Globe/splitStereoHorizontalEyeMapping" ,
306
+ splitStereoHorizontalEyeMapping->setCurrentIndex ( settings.value ( " /Plugin-Globe/splitStereoHorizontalEyeMapping" ,
261
307
osg::DisplaySettings::instance ()->getSplitStereoHorizontalEyeMapping () ).toInt () );
262
- splitStereoVerticalEyeMapping->setCurrentIndex ( settings.value ( " /Plugin-Globe/splitStereoVerticalEyeMapping" ,
308
+ splitStereoVerticalEyeMapping->setCurrentIndex ( settings.value ( " /Plugin-Globe/splitStereoVerticalEyeMapping" ,
263
309
osg::DisplaySettings::instance ()->getSplitStereoVerticalEyeMapping () ).toInt () );
264
310
}
265
311
@@ -313,11 +359,11 @@ void QgsGlobePluginDialog::setStereoConfig()
313
359
osg::DisplaySettings::instance ()->setEyeSeparation ( eyeSeparation->value () );
314
360
osg::DisplaySettings::instance ()->setSplitStereoHorizontalSeparation ( splitStereoHorizontalSeparation->value () );
315
361
osg::DisplaySettings::instance ()->setSplitStereoVerticalSeparation ( splitStereoVerticalSeparation->value () );
316
- osg::DisplaySettings::instance ()->setSplitStereoHorizontalEyeMapping (
362
+ osg::DisplaySettings::instance ()->setSplitStereoHorizontalEyeMapping (
317
363
(osg::DisplaySettings::SplitStereoHorizontalEyeMapping) splitStereoHorizontalEyeMapping->currentIndex () );
318
- osg::DisplaySettings::instance ()->setSplitStereoVerticalEyeMapping (
364
+ osg::DisplaySettings::instance ()->setSplitStereoVerticalEyeMapping (
319
365
(osg::DisplaySettings::SplitStereoVerticalEyeMapping) splitStereoVerticalEyeMapping->currentIndex () );
320
-
366
+
321
367
}
322
368
323
369
void QgsGlobePluginDialog::saveStereoConfig ()
0 commit comments