Skip to content
Permalink
Browse files

Browser GRASS multilayer map fix

  • Loading branch information
blazek committed Feb 19, 2015
1 parent f5315fe commit 09a52830cb4f6496b87e1d71f401b51bf266e6c1
Showing with 8 additions and 3 deletions.
  1. +2 −0 src/core/qgsdataitem.cpp
  2. +6 −3 src/providers/grass/qgsgrassprovidermodule.cpp
@@ -493,6 +493,7 @@ void QgsDataItem::setParent( QgsDataItem* parent )

void QgsDataItem::addChildItem( QgsDataItem * child, bool refresh )
{
Q_ASSERT( child );
QgsDebugMsg( QString( "path = %1 add child #%2 - %3 - %4" ).arg( mPath ).arg( mChildren.size() ).arg( child->mName ).arg( child->mType ) );

int i;
@@ -551,6 +552,7 @@ int QgsDataItem::findItem( QVector<QgsDataItem*> items, QgsDataItem * item )
{
for ( int i = 0; i < items.size(); i++ )
{
Q_ASSERT_X( items[i], "findItem", QString( "item %1 is NULL" ).arg( i ).toAscii() );
QgsDebugMsgLevel( QString::number( i ) + " : " + items[i]->mPath + " x " + item->mPath, 2 );
if ( items[i]->equal( item ) )
return i;
@@ -117,21 +117,24 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
layerType = QgsLayerItem::Polygon;

QString layerPath = mapPath + QDir::separator() + layerName;
if ( layerNames.size() == 1 )
if ( !map )
{
/* This may happen (one layer only) in GRASS 7 with points (no topo layers) */
QgsLayerItem *layer = new QgsLayerItem( this, name + " " + baseLayerName, layerPath, uri, layerType, "grass" );
layer->setState( Populated );
items.append( layer );
}
else if ( map )
else
{
QgsLayerItem *layer = new QgsGrassVectorLayerItem( map, name, baseLayerName, layerPath, uri, layerType, "grass" );
map->addChild( layer );
}
}
if ( layerNames.size() != 1 )
if ( map )
{
map->setState( Populated );
items.append( map );
}
}

QStringList rasterNames = QgsGrass::rasters( mDirPath );

0 comments on commit 09a5283

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