Skip to content

Commit

Permalink
[GRASS] outputType module attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Aug 31, 2015
1 parent 9a89d52 commit 0edcf6c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/plugins/grass/modules/v.kernel.qgm
Expand Up @@ -5,8 +5,8 @@
<option key="input" />
<option key="stddeviation" version_max="6"/>
<option key="radius" version_min="7"/>
<option key="mult" answer="1" advanced="yes" version_max="6"/>
<option key="multiplier" answer="1" advanced="yes" version_min="7"/>
<option key="kernel" answer="Gaussian" advanced="yes"/>
<option key="output" />
<option key="mult" answer="1" advanced="yes" version_max="6"/>
<option key="multiplier" answer="1" advanced="yes" version_min="7"/>
<option key="kernel" answer="Gaussian" advanced="yes"/>
<option key="output" outputType="raster"/>
</qgisgrassmodule>
26 changes: 26 additions & 0 deletions src/plugins/grass/qgsgrassmoduleparam.cpp
Expand Up @@ -254,6 +254,9 @@ QgsGrassModuleOption::QgsGrassModuleOption( QgsGrassModule *module, QString key,
{
QDomElement gelem = gnode.toElement();

// Output option may have missing gisprompt if output may be both vector and raster according to other options (e.g. v.kernel)
// outputType qgm attribute allows to force output type

// Predefined values ?
QDomNode valuesNode = gnode.namedItem( "values" );
QDomElement valuesElem = valuesNode.toElement(); // null if valuesNode is null
Expand Down Expand Up @@ -336,6 +339,29 @@ QgsGrassModuleOption::QgsGrassModuleOption( QgsGrassModule *module, QString key,
// Line edit
mControlType = LineEdit;

// Output option may have missing gisprompt if output may be both vector and raster according to other options (e.g. v.kernel)
// outputType qgm attribute allows to force output type
QgsDebugMsg( "outputType = " + qdesc.attribute( "outputType" ) );
if ( qdesc.hasAttribute( "outputType" ) )
{
QString outputType = qdesc.attribute( "outputType" );
mIsOutput = true;
if ( outputType == "vector" )
{
mOutputElement = "vector";
mOutputType = Vector;
}
else if ( outputType == "raster" )
{
mOutputElement = "cell";
mOutputType = Raster;
}
else
{
mErrors << tr( "Unknown outputType" ) + " : " + outputType;
}
}

if ( gelem.attribute( "type" ) == "integer" )
{
mValueType = Integer;
Expand Down

0 comments on commit 0edcf6c

Please sign in to comment.