Skip to content

Commit

Permalink
[GRASS] fixed stds input
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Feb 11, 2016
1 parent dfdb420 commit c8161aa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/plugins/grass/qgsgrassmoduleinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ bool QgsGrassModuleInputProxy::filterAcceptsRow( int sourceRow, const QModelInde
}
}

return mType == itemType;
return mType == itemType || ( mType == QgsGrassObject::Stds && ( itemType == QgsGrassObject::Strds || itemType == QgsGrassObject::Stvds || itemType == QgsGrassObject::Str3ds ) );
}

bool QgsGrassModuleInputProxy::lessThan( const QModelIndex & left, const QModelIndex & right ) const
Expand Down Expand Up @@ -942,6 +942,10 @@ QgsGrassModuleInput::QgsGrassModuleInput( QgsGrassModule *module,
{
mType = QgsGrassObject::Str3ds;
}
else if ( element == "stds" )
{
mType = QgsGrassObject::Stds;
}
else
{
mErrors << tr( "GRASS element %1 not supported" ).arg( element );
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/grass/qgsgrassmoduleoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions(
QString age = promptElem.attribute( "age" );
//QgsDebugMsg("element = " + element + " age = " + age);
if ( age == "old" && ( element == "vector" || element == "cell" ||
element == "strds" || element == "stvds" || element == "str3ds" ) )
element == "strds" || element == "stvds" ||
element == "str3ds" || element == "stds" ) )
{
QgsGrassModuleInput *mi = new QgsGrassModuleInput(
mModule, this, key, confDomElement, descDocElem, gnode, mDirect, this );
Expand Down
14 changes: 12 additions & 2 deletions src/providers/grass/qgsgrass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ QString QgsGrassObject::elementShort( Type type )
return "stvds";
else if ( type == Str3ds )
return "str3ds";
else if ( type == Stds )
return "stds";
else
return "";
}
Expand Down Expand Up @@ -1540,7 +1542,8 @@ QStringList QgsGrass::grassObjects( const QgsGrassObject& mapsetObject, QgsGrass
QgsDebugMsg( "mapset is not readable" );
return QStringList();
}
else if ( type == QgsGrassObject::Strds || type == QgsGrassObject::Stvds || type == QgsGrassObject::Str3ds )
else if ( type == QgsGrassObject::Strds || type == QgsGrassObject::Stvds
|| type == QgsGrassObject::Str3ds || type == QgsGrassObject::Stds )
{
#if GRASS_VERSION_MAJOR >= 7
QString cmd = gisbase() + "/scripts/t.list";
Expand All @@ -1556,7 +1559,14 @@ QStringList QgsGrass::grassObjects( const QgsGrassObject& mapsetObject, QgsGrass
}
else
{
arguments << "type=" + QgsGrassObject::elementShort( type );
if ( type == QgsGrassObject::Stds )
{
arguments << "type=strds,stvds,str3ds";
}
else
{
arguments << "type=" + QgsGrassObject::elementShort( type );
}

int timeout = -1; // What timeout to use? It can take long time on network or database
try
Expand Down
2 changes: 1 addition & 1 deletion src/providers/grass/qgsgrass.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class GRASS_LIB_EXPORT QgsGrassObject
public:
//! Element type
enum Type { None, Location, Mapset, Raster, Group, Vector, Region,
Strds, Stvds, Str3ds
Strds, Stvds, Str3ds, Stds
};

QgsGrassObject() : mType( None ) {}
Expand Down

0 comments on commit c8161aa

Please sign in to comment.