Skip to content
Permalink
Browse files

refactoring of setStereoMode done

  • Loading branch information
Marco Bernasocchi authored and pka committed Nov 20, 2010
1 parent ef6dc30 commit 0f85a6c693418c0de18d3c40d16a16a891c7cd83
@@ -41,6 +41,7 @@ QgsGlobePluginDialog::QgsGlobePluginDialog( QWidget* parent, Qt::WFlags fl )
setupUi( this );
stereoMode = settings.value( "/Plugin-Globe/stereoMode", "OFF" ).toString();
comboStereoMode->setCurrentIndex( comboStereoMode->findText( stereoMode ) );
//showMessageBox("constructor " + stereoMode);
}

//destructor
@@ -58,46 +59,6 @@ QString QgsGlobePluginDialog::openFile()
return path;
}

void QgsGlobePluginDialog::setStereoMode()
{
//TODO: Call QgsGLWidgetAdapter::setStereoMode(QString stereoMode)
//from GlobePlugin::settings() instead of code duplication
settings.setValue( "/Plugin-Globe/stereoMode", stereoMode );
if("OFF" == stereoMode)
{
osg::DisplaySettings::instance()->setStereo( false );
}
else if("ADVANCED" == stereoMode)
{
//osg::DisplaySettings::instance()->set
}
else
{
osg::DisplaySettings::instance()->setStereo( true );

if("ANAGLYPHIC" == stereoMode)
{
osg::DisplaySettings::instance()->setStereoMode( osg::DisplaySettings::ANAGLYPHIC );
}
else if("VERTICAL_SPLIT" == stereoMode)
{
osg::DisplaySettings::instance()->setStereoMode( osg::DisplaySettings::VERTICAL_SPLIT );
}
else if("HORIZONTAL_SPLIT" == stereoMode)
{
osg::DisplaySettings::instance()->setStereoMode( osg::DisplaySettings::HORIZONTAL_SPLIT );
}
else if("QUAD_BUFFER" == stereoMode)
{
osg::DisplaySettings::instance()->setStereoMode( osg::DisplaySettings::QUAD_BUFFER );
}
else
{
showMessageBox("This stereo mode has not been implemented yet. Defaulting to ANAGLYPHIC");
}
}
}

void QgsGlobePluginDialog::restartGlobe()
{
//showMessageBox("TODO: restart globe");
@@ -194,7 +155,6 @@ void QgsGlobePluginDialog::on_buttonBox_accepted()
// Close dialog box
*/
setStereoMode();

if ( globeRunning() )
{
@@ -211,6 +171,7 @@ void QgsGlobePluginDialog::on_buttonBox_rejected()
void QgsGlobePluginDialog::on_comboStereoMode_currentIndexChanged( QString mode )
{
stereoMode = mode;
//showMessageBox("index_changed " + stereoMode);
}

void QgsGlobePluginDialog::showMessageBox( QString text )
@@ -28,10 +28,10 @@ class QgsGlobePluginDialog:public QDialog, private Ui::QgsGlobePluginDialogGuiBa
Q_OBJECT

public:
QString stereoMode;
QgsGlobePluginDialog( QWidget * parent = 0, Qt::WFlags fl = 0 );
~QgsGlobePluginDialog();

QString stereoMode;

private:
QString earthFile;
QString openFile();
@@ -34,7 +34,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="elevation">
<attribute name="title">
@@ -56,7 +56,7 @@
<number>2</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>true</bool>
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
@@ -95,15 +95,10 @@ void QgsGLWidgetAdapter::setStereoMode()
void QgsGLWidgetAdapter::setStereoMode(QString stereoMode)
{
settings.setValue( "/Plugin-Globe/stereoMode", stereoMode );

if("OFF" == stereoMode)
{
osg::DisplaySettings::instance()->setStereo( false );
}
else if("ADVANCED" == stereoMode)
{
//osg::DisplaySettings::instance()->set
}
else
{
osg::DisplaySettings::instance()->setStereo( true );
@@ -127,6 +122,7 @@ void QgsGLWidgetAdapter::setStereoMode(QString stereoMode)
else
{
//should never get here
settings.setValue( "/Plugin-Globe/stereoMode", "ANAGLYPHIC" );
QMessageBox msgBox;
msgBox.setText("This stereo mode has not been implemented yet. Defaulting to ANAGLYPHIC");
msgBox.exec();

0 comments on commit 0f85a6c

Please sign in to comment.
You can’t perform that action at this time.