Skip to content
Permalink
Browse files

Unload globe viewer

  • Loading branch information
pka committed Oct 19, 2012
1 parent be2eadf commit a3097b4a27a7b88f4a927c901cb5d246b8aed6a7
@@ -191,18 +191,25 @@ void GlobePlugin::initGui()
// Create the action for tool
mQActionPointer = new QAction( QIcon( ":/globe/globe.png" ), tr( "Launch Globe" ), this );
mQActionSettingsPointer = new QAction( QIcon( ":/globe/globe.png" ), tr( "Globe Settings" ), this );
QAction* actionUnload = new QAction( tr( "Unload Globe" ), this );

// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Overlay data on a 3D globe" ) );
mQActionSettingsPointer->setWhatsThis( tr( "Settings for 3D globe" ) );
// Connect the action to the run
actionUnload->setWhatsThis( tr( "Unload globe" ) );

// Connect actions
connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
// Connect to the setting slot
connect( mQActionSettingsPointer, SIGNAL( triggered() ), this, SLOT( settings() ) );
connect( actionUnload, SIGNAL( triggered() ), this, SLOT( reset() ) );

// Add the icon to the toolbar
mQGisIface->addToolBarIcon( mQActionPointer );

//Add menu
mQGisIface->addPluginToMenu( tr( "&Globe" ), mQActionPointer );
mQGisIface->addPluginToMenu( tr( "&Globe" ), mQActionSettingsPointer );
mQGisIface->addPluginToMenu( tr( "&Globe" ), actionUnload );

connect( mQGisIface->mapCanvas() , SIGNAL( extentsChanged() ),
this, SLOT( extentsChanged() ) );
@@ -340,7 +347,6 @@ void GlobePlugin::setupMap()
GDALOptions driverOptions;
driverOptions.url() = QDir::cleanPath( QgsApplication::pkgDataPath() + "/globe/world.tif" ).toStdString();
ImageLayerOptions layerOptions( "world", driverOptions );
layerOptions.cacheEnabled() = false;
map->addImageLayer( new osgEarth::ImageLayer( layerOptions ) );
*/
TMSOptions imagery;
@@ -669,7 +675,7 @@ void GlobePlugin::setupControls()
#if ENABLE_SYNC_BUTTON
extraControls->setPosition( 5, 231 );
#else
extraControls->setPosition( 3, 231 );
extraControls->setPosition( 35, 231 );
#endif
extraControls->setPadding( 6 );

@@ -828,8 +834,21 @@ void GlobePlugin::elevationLayersChanged()
}
}

void GlobePlugin::reset()
{
if (mViewerWidget) {
delete mViewerWidget;
mViewerWidget = 0;
}
if (mOsgViewer) {
delete mOsgViewer;
mOsgViewer = 0;
}
}

void GlobePlugin::unload()
{
reset();
// remove the GUI
mQGisIface->removePluginMenu( "&Globe", mQActionPointer );
mQGisIface->removeToolBarIcon( mQActionPointer );
@@ -52,6 +52,8 @@ class GlobePlugin : public QObject, public QgisPlugin
void run();
//! Show the settings dialog box
void settings();
//! Reset globe
void reset();
//! unload the plugin
void unload();
//! show the help document
@@ -87,7 +89,6 @@ class GlobePlugin : public QObject, public QgisPlugin
//! get elevation of user right click
double getSelectedElevation();


//! Place an OSG model on the globe
void placeNode( osg::Node* node, double lat, double lon, double alt = 0.0 );

@@ -263,7 +263,6 @@ void QgsGlobePluginDialog::resetElevationDatasources()

void QgsGlobePluginDialog::readElevationDatasources()
{
//showMessageBox("reading");
// clear the widget
elevationDatasourcesWidget->clearContents();
elevationDatasourcesWidget->setRowCount( 0 );
@@ -276,7 +275,7 @@ void QgsGlobePluginDialog::readElevationDatasources()
QgsProject::instance()->readEntry( "Globe-Plugin", "/elevationDatasources/L" + iNum + "/type" ) );
QTableWidgetItem *uri = new QTableWidgetItem(
QgsProject::instance()->readEntry( "Globe-Plugin", "/elevationDatasources/L" + iNum + "/uri" ) );
bool cache = QgsProject::instance()->readBoolEntry( "Globe-Plugin", "/elevationDatasources/L" + iNum + "/cache" );
//bool cache = QgsProject::instance()->readBoolEntry( "Globe-Plugin", "/elevationDatasources/L" + iNum + "/cache" );

elevationDatasourcesWidget->setRowCount( 1 + i );
elevationDatasourcesWidget->setItem( i, 0, type );

0 comments on commit a3097b4

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