Skip to content
Permalink
Browse files

handle better mumltiple empty output

git-svn-id: http://svn.osgeo.org/qgis/trunk@12937 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek
rblazek committed Feb 12, 2010
1 parent da64d77 commit 49523422b0d3729707030d83eb0e0917b11d1dc3
Showing with 32 additions and 4 deletions.
  1. +1 −0 src/plugins/grass/qgsgrassmapcalc.h
  2. +27 −4 src/plugins/grass/qgsgrassmodule.cpp
  3. +4 −0 src/plugins/grass/qgsgrassmodule.h
@@ -66,6 +66,7 @@ class QgsGrassMapcalc: public QMainWindow, private Ui::QgsGrassMapcalcBase,
QStringList checkRegion();
bool inputRegion( struct Cell_head *window, bool all );
QStringList output( int type );
bool hasOutput ( int type ) { return true; }

/** \brief recieves contentsMousePressEvent from view */
void mousePressEvent( QMouseEvent* );
@@ -229,8 +229,8 @@ QgsGrassModule::QgsGrassModule( QgsGrassTools *tools, QString moduleName, QgisIn
}

// Hide display if there is no output
if ( mOptions->output( QgsGrassModuleOption::Vector ).size() == 0
&& mOptions->output( QgsGrassModuleOption::Raster ).size() == 0 )
if ( !mOptions->hasOutput( QgsGrassModuleOption::Vector )
&& !mOptions->hasOutput( QgsGrassModuleOption::Raster ) )
{
mViewButton->hide();
}
@@ -766,7 +766,6 @@ void QgsGrassModuleStandardOptions::thawOutput()
#endif
}


QStringList QgsGrassModuleStandardOptions::output( int type )
{
QgsDebugMsg( "called." );
@@ -785,14 +784,38 @@ QStringList QgsGrassModuleStandardOptions::output( int type )
if ( opt->outputType() == type )
{
QString out = opt->value();
list.append( out );
if ( !out.isEmpty() ) {
list.append( out );
}
}
}
}

return list;
}

bool QgsGrassModuleStandardOptions::hasOutput( int type )
{
QgsDebugMsg( "called." );
QStringList list;

for ( unsigned int i = 0; i < mItems.size(); i++ )
{
QgsGrassModuleOption *opt = dynamic_cast<QgsGrassModuleOption *>( mItems[i] );
if ( !opt )
continue;

QgsDebugMsg( "opt->key() = " + opt->key() );

if ( opt->isOutput() )
{
if ( opt->outputType() == type ) return true;
}
}

return false;
}

QStringList QgsGrassModuleStandardOptions::ready()
{
QgsDebugMsg( "entered." );
@@ -192,6 +192,9 @@ class QgsGrassModuleOptions
//! Get list of current output maps
virtual QStringList output( int type ) { return QStringList() ; }

//! Has any output
virtual bool hasOutput ( int type ) { return true; }

//! Has raster input or output
virtual bool usesRegion() { return false; }

@@ -265,6 +268,7 @@ class QgsGrassModuleStandardOptions: QWidget, public QgsGrassModuleOptions
void thawOutput();
QStringList ready() ;
QStringList output( int type );
bool hasOutput ( int type );
QStringList checkRegion();
bool usesRegion();
bool requestsRegion();

0 comments on commit 4952342

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