@@ -69,24 +69,25 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
69
69
70
70
// constructor
71
71
GlobePlugin::GlobePlugin ( QgisInterface* theQgisInterface )
72
- : QgisPlugin( sName , sDescription , sPluginVersion , sPluginType ),
73
- mQGisIface( theQgisInterface ),
74
- mQActionPointer( NULL ),
75
- mQActionSettingsPointer( NULL ),
76
- viewer(),
77
- mQDockWidget( tr( " Globe" ) ),
78
- mSettingsDialog( &viewer, theQgisInterface->mainWindow (), QgisGui::ModalDialogFlags ),
79
- mQgisMapLayer( 0 ),
80
- mTileSource( 0 ),
81
- mElevationManager( NULL ),
82
- mObjectPlacer( NULL )
72
+ : QgisPlugin( sName , sDescription , sPluginVersion , sPluginType )
73
+ , mQGisIface( theQgisInterface )
74
+ , mQActionPointer( NULL )
75
+ , mQActionSettingsPointer( NULL )
76
+ , viewer()
77
+ , mQgisMapLayer( 0 )
78
+ , mTileSource( 0 )
79
+ , mElevationManager( NULL )
80
+ , mObjectPlacer( NULL )
83
81
{
84
82
mIsGlobeRunning = false ;
85
83
// needed to be "seen" by other plugins by doing
86
84
// iface.mainWindow().findChild( QObject, "globePlugin" )
87
85
// needed until https://trac.osgeo.org/qgis/changeset/15224
88
86
this ->setObjectName ( " globePlugin" );
89
87
this ->setParent ( theQgisInterface->mainWindow () );
88
+
89
+ mSettingsDialog = new QgsGlobePluginDialog ( &viewer, theQgisInterface->mainWindow (), QgisGui::ModalDialogFlags );
90
+ mQDockWidget = new QDockWidgetGlobe ( tr ( " Globe" ), theQgisInterface->mainWindow () );
90
91
}
91
92
92
93
// destructor
@@ -190,19 +191,19 @@ void GlobePlugin::initGui()
190
191
// Add menu
191
192
mQGisIface ->addPluginToMenu ( tr ( " &Globe" ), mQActionPointer );
192
193
mQGisIface ->addPluginToMenu ( tr ( " &Globe" ), mQActionSettingsPointer );
193
- mQDockWidget . setWidget ( &viewer );
194
+ mQDockWidget -> setWidget ( &viewer );
194
195
195
196
connect ( mQGisIface ->mapCanvas () , SIGNAL ( extentsChanged () ),
196
197
this , SLOT ( extentsChanged () ) );
197
198
connect ( mQGisIface ->mapCanvas (), SIGNAL ( layersChanged () ),
198
199
this , SLOT ( layersChanged () ) );
199
- connect ( & mSettingsDialog , SIGNAL ( elevationDatasourcesChanged () ),
200
+ connect ( mSettingsDialog , SIGNAL ( elevationDatasourcesChanged () ),
200
201
this , SLOT ( layersChanged () ) );
201
202
connect ( mQGisIface ->mainWindow (), SIGNAL ( projectRead () ), this ,
202
203
SLOT ( projectReady () ) );
203
204
connect ( mQGisIface , SIGNAL ( newProjectCreated () ), this ,
204
205
SLOT ( blankProjectReady () ) );
205
- connect ( & mQDockWidget , SIGNAL ( globeClosed () ), this ,
206
+ connect ( mQDockWidget , SIGNAL ( globeClosed () ), this ,
206
207
SLOT ( setGlobeNotRunning () ) );
207
208
connect ( this , SIGNAL ( xyCoordinates ( const QgsPoint & ) ),
208
209
mQGisIface ->mapCanvas (), SIGNAL ( xyCoordinates ( const QgsPoint & ) ) );
@@ -214,7 +215,7 @@ void GlobePlugin::run()
214
215
if ( !getenv ( " OSGNOTIFYLEVEL" ) ) osgEarth::setNotifyLevel ( osg::DEBUG_INFO );
215
216
#endif
216
217
217
- mQGisIface ->addDockWidget ( Qt::RightDockWidgetArea, & mQDockWidget );
218
+ mQGisIface ->addDockWidget ( Qt::RightDockWidgetArea, mQDockWidget );
218
219
219
220
viewer.show ();
220
221
@@ -266,8 +267,8 @@ void GlobePlugin::run()
266
267
267
268
void GlobePlugin::settings ()
268
269
{
269
- mSettingsDialog . updatePointLayers ();
270
- if ( mSettingsDialog . exec () )
270
+ mSettingsDialog -> updatePointLayers ();
271
+ if ( mSettingsDialog -> exec () )
271
272
{
272
273
// viewer stereo settings set by mSettingsDialog and stored in QSettings
273
274
}
@@ -324,12 +325,12 @@ void GlobePlugin::setupMap()
324
325
mObjectPlacer = new osgEarth::Util::ObjectPlacer ( mMapNode );
325
326
326
327
// place 3D model on point layer
327
- if ( mSettingsDialog . modelLayer () && !mSettingsDialog . modelPath ().isEmpty () )
328
+ if ( mSettingsDialog -> modelLayer () && !mSettingsDialog -> modelPath ().isEmpty () )
328
329
{
329
- osg::Node* model = osgDB::readNodeFile ( mSettingsDialog . modelPath ().toStdString () );
330
+ osg::Node* model = osgDB::readNodeFile ( mSettingsDialog -> modelPath ().toStdString () );
330
331
if ( model )
331
332
{
332
- QgsVectorLayer* layer = mSettingsDialog . modelLayer ();
333
+ QgsVectorLayer* layer = mSettingsDialog -> modelLayer ();
333
334
QgsAttributeList fetchAttributes;
334
335
layer->select ( fetchAttributes ); // TODO: select only visible features
335
336
QgsFeature feature;
@@ -346,13 +347,13 @@ void GlobePlugin::setupMap()
346
347
void GlobePlugin::projectReady ()
347
348
{
348
349
blankProjectReady ();
349
- mSettingsDialog . readElevationDatasources ();
350
+ mSettingsDialog -> readElevationDatasources ();
350
351
}
351
352
352
353
void GlobePlugin::blankProjectReady ()
353
354
{ // needs at least http://trac.osgeo.org/qgis/changeset/14452
354
- mSettingsDialog . elevationDatasources ()->clearContents ();
355
- mSettingsDialog . elevationDatasources ()->setRowCount ( 0 );
355
+ mSettingsDialog -> elevationDatasources ()->clearContents ();
356
+ mSettingsDialog -> elevationDatasources ()->setRowCount ( 0 );
356
357
}
357
358
358
359
void GlobePlugin::showCurrentCoordinates ( double lon, double lat )
@@ -696,7 +697,7 @@ void GlobePlugin::layersChanged()
696
697
// Add elevation layers
697
698
QSettings settings;
698
699
QString cacheDirectory = settings.value ( " cache/directory" , QgsApplication::qgisSettingsDirPath () + " cache" ).toString ();
699
- QTableWidget* table = mSettingsDialog . elevationDatasources ();
700
+ QTableWidget* table = mSettingsDialog -> elevationDatasources ();
700
701
for ( int i = 0 ; i < table->rowCount (); ++i )
701
702
{
702
703
QString type = table->item ( i, 0 )->text ();
0 commit comments