Skip to content
Permalink
Browse files

add GRASS vector layers from browser with map + layer name

  • Loading branch information
blazek committed Nov 6, 2014
1 parent 2202b42 commit d74b52e5bdf6f92d407ac8b4cd69a870b8d8b282
@@ -53,9 +53,10 @@ extern "C"
#if GRASS_VERSION_MAJOR >= 7
#define G_suppress_masking Rast_suppress_masking
#define BOUND_BOX bound_box
#if GRASS_VERSION_MINOR >= 1
#define G_available_mapsets G_get_available_mapsets
#endif

#if GRASS_VERSION_MAJOR > 7 || (GRASS_VERSION_MAJOR == 7 && GRASS_VERSION_MINOR >= 1)
#define G_available_mapsets G_get_available_mapsets
#endif

#if !defined(GRASS_VERSION_MAJOR) || \
@@ -117,7 +117,7 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
}
else
{
QgsLayerItem *layer = new QgsLayerItem( map, baseLayerName, path, uri, layerType, "grass" );
QgsLayerItem *layer = new QgsGrassVectorLayerItem( map, name, baseLayerName, path, uri, layerType, "grass" );
map->addChild( layer );
}
}
@@ -140,6 +140,18 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
return items;
}

QgsGrassVectorLayerItem::QgsGrassVectorLayerItem( QgsDataItem* parent, QString mapName, QString layerName, QString path, QString uri, LayerType layerType, QString providerKey )
: QgsLayerItem( parent, layerName, path, uri, layerType, providerKey )
, mMapName( mapName )
{
}

QString QgsGrassVectorLayerItem::layerName() const
{
// to get map + layer when added from browser
return mMapName + " " + name();
}

QGISEXTERN int dataCapabilities()
{
return QgsDataProvider::Dir;
@@ -41,4 +41,16 @@ class QgsGrassMapsetItem : public QgsDataCollectionItem
QString mGisdbase;
};

class QgsGrassVectorLayerItem : public QgsLayerItem
{
public:
QgsGrassVectorLayerItem( QgsDataItem* parent, QString mapName, QString layerName, QString path, QString uri, LayerType layerType, QString providerKey );
~QgsGrassVectorLayerItem() {};

QString layerName() const;

private:
QString mMapName;
};

#endif // QGSGRASSPROVIDERMODULE_H

0 comments on commit d74b52e

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