Skip to content
Permalink
Browse files

use QgsMapLayer::isSpatial()

  • Loading branch information
3nids committed Jan 20, 2018
1 parent 86024ef commit 123470b26fad06b57138edb00684d13614af982c
Showing with 7 additions and 22 deletions.
  1. +7 −22 src/core/layertree/qgslayertree.cpp
@@ -62,15 +62,11 @@ void QgsLayerTree::setCustomLayerOrder( const QStringList &customLayerOrder )
{
// configuration from 2.x projects might have non spatial layers
QgsMapLayer *layer = nodeLayer->layer();
if ( layer->type() == QgsMapLayer::VectorLayer )
if ( !layer || !layer->isSpatial() )
{
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer );
if ( vl && !vl->isSpatial() )
{
continue;
}
continue;
}
layers.append( nodeLayer->layer() );
layers.append( layer );
}
}
setCustomLayerOrder( layers );
@@ -88,13 +84,9 @@ QList<QgsMapLayer *> QgsLayerTree::layerOrder() const
for ( const auto &treeLayer : findLayers() )
{
QgsMapLayer *layer = treeLayer->layer();
if ( layer && layer->type() == QgsMapLayer::VectorLayer )
if ( !layer || !layer->isSpatial() )
{
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer );
if ( vl && !vl->isSpatial() )
{
continue;
}
continue;
}
layers.append( layer );
}
@@ -222,16 +214,9 @@ void QgsLayerTree::addMissingLayers()

for ( const auto layer : findLayers() )
{
if ( !mCustomLayerOrder.contains( layer->layer() ) && layer->layer() )
if ( !mCustomLayerOrder.contains( layer->layer() ) &&
layer->layer() && layer->layer()->isSpatial() )
{
if ( layer->layer()->type() == QgsMapLayer::VectorLayer )
{
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer->layer() );
if ( vl && !vl->isSpatial() )
{
continue;
}
}
mCustomLayerOrder.append( layer->layer() );
changed = true;
}

0 comments on commit 123470b

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