Skip to content
Permalink
Browse files

[GRASS] outputType module attribute

  • Loading branch information
blazek committed Aug 31, 2015
1 parent 9a89d52 commit 0edcf6c42acb0270bb7bf16f854419d66b0b6424
Showing with 30 additions and 4 deletions.
  1. +4 −4 src/plugins/grass/modules/v.kernel.qgm
  2. +26 −0 src/plugins/grass/qgsgrassmoduleparam.cpp
@@ -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>
@@ -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
@@ -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;

0 comments on commit 0edcf6c

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