Skip to content

Commit 0edcf6c

Browse files
committedAug 31, 2015
[GRASS] outputType module attribute
1 parent 9a89d52 commit 0edcf6c

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed
 

‎src/plugins/grass/modules/v.kernel.qgm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<option key="input" />
66
<option key="stddeviation" version_max="6"/>
77
<option key="radius" version_min="7"/>
8-
<option key="mult" answer="1" advanced="yes" version_max="6"/>
9-
<option key="multiplier" answer="1" advanced="yes" version_min="7"/>
10-
<option key="kernel" answer="Gaussian" advanced="yes"/>
11-
<option key="output" />
8+
<option key="mult" answer="1" advanced="yes" version_max="6"/>
9+
<option key="multiplier" answer="1" advanced="yes" version_min="7"/>
10+
<option key="kernel" answer="Gaussian" advanced="yes"/>
11+
<option key="output" outputType="raster"/>
1212
</qgisgrassmodule>

‎src/plugins/grass/qgsgrassmoduleparam.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ QgsGrassModuleOption::QgsGrassModuleOption( QgsGrassModule *module, QString key,
254254
{
255255
QDomElement gelem = gnode.toElement();
256256

257+
// Output option may have missing gisprompt if output may be both vector and raster according to other options (e.g. v.kernel)
258+
// outputType qgm attribute allows to force output type
259+
257260
// Predefined values ?
258261
QDomNode valuesNode = gnode.namedItem( "values" );
259262
QDomElement valuesElem = valuesNode.toElement(); // null if valuesNode is null
@@ -336,6 +339,29 @@ QgsGrassModuleOption::QgsGrassModuleOption( QgsGrassModule *module, QString key,
336339
// Line edit
337340
mControlType = LineEdit;
338341

342+
// Output option may have missing gisprompt if output may be both vector and raster according to other options (e.g. v.kernel)
343+
// outputType qgm attribute allows to force output type
344+
QgsDebugMsg( "outputType = " + qdesc.attribute( "outputType" ) );
345+
if ( qdesc.hasAttribute( "outputType" ) )
346+
{
347+
QString outputType = qdesc.attribute( "outputType" );
348+
mIsOutput = true;
349+
if ( outputType == "vector" )
350+
{
351+
mOutputElement = "vector";
352+
mOutputType = Vector;
353+
}
354+
else if ( outputType == "raster" )
355+
{
356+
mOutputElement = "cell";
357+
mOutputType = Raster;
358+
}
359+
else
360+
{
361+
mErrors << tr( "Unknown outputType" ) + " : " + outputType;
362+
}
363+
}
364+
339365
if ( gelem.attribute( "type" ) == "integer" )
340366
{
341367
mValueType = Integer;

0 commit comments

Comments
 (0)
Please sign in to comment.