Skip to content

Commit

Permalink
[Globe] Fix typos, fix model layer logic
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Jun 15, 2016
1 parent f9c589e commit 4ba2433
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -892,14 +892,17 @@ void GlobePlugin::updateLayers()
}
mLayerExtents.clear();

QStringList drapedLayers;
QStringList selectedLayers = mDockWidget->getSelectedLayers();

// Disconnect any previous repaintRequested signals
foreach ( const QString& layerId, mTileSource->layerSet() )
{
QgsMapLayer* mapLayer = QgsMapLayerRegistry::instance()->mapLayer( layerId );
if ( mapLayer )
disconnect( mapLayer, SIGNAL( repaintRequested() ), this, SLOT( layerChanged() ) );
if ( dynamic_cast<QgsVectorLayer*>( mapLayer ) )
connect( static_cast<QgsVectorLayer*>( mapLayer ), SIGNAL( layerTransparencyChanged( int ) ), this, SLOT( layerChanged() ) );
disconnect( static_cast<QgsVectorLayer*>( mapLayer ), SIGNAL( layerTransparencyChanged( int ) ), this, SLOT( layerChanged() ) );
}
osgEarth::ModelLayerVector modelLayers;
mMapNode->getMap()->getModelLayers( modelLayers );
Expand All @@ -909,12 +912,11 @@ void GlobePlugin::updateLayers()
if ( mapLayer )
disconnect( mapLayer, SIGNAL( repaintRequested() ), this, SLOT( layerChanged() ) );
if ( dynamic_cast<QgsVectorLayer*>( mapLayer ) )
connect( static_cast<QgsVectorLayer*>( mapLayer ), SIGNAL( layerTransparencyChanged( int ) ), this, SLOT( layerChanged() ) );
disconnect( static_cast<QgsVectorLayer*>( mapLayer ), SIGNAL( layerTransparencyChanged( int ) ), this, SLOT( layerChanged() ) );
if ( !selectedLayers.contains( QString::fromStdString( modelLayer->getName() ) ) )
mMapNode->getMap()->removeModelLayer( modelLayer );
}

QStringList drapedLayers;
QStringList selectedLayers = mDockWidget->getSelectedLayers();

Q_FOREACH ( const QString& layerId, selectedLayers )
{
QgsMapLayer* mapLayer = QgsMapLayerRegistry::instance()->mapLayer( layerId );
Expand All @@ -929,8 +931,8 @@ void GlobePlugin::updateLayers()

if ( layerConfig && ( layerConfig->renderingMode == QgsGlobeVectorLayerConfig::RenderingModeModelSimple || layerConfig->renderingMode == QgsGlobeVectorLayerConfig::RenderingModeModelAdvanced ) )
{
mMapNode->getMap()->removeModelLayer( mMapNode->getMap()->getModelLayerByName( mapLayer->id().toStdString() ) );
addModelLayer( static_cast<QgsVectorLayer*>( mapLayer ), layerConfig );
if ( !mMapNode->getMap()->getModelLayerByName( mapLayer->id().toStdString() ) )
addModelLayer( static_cast<QgsVectorLayer*>( mapLayer ), layerConfig );
}
else
{
Expand Down

0 comments on commit 4ba2433

Please sign in to comment.