Skip to content
Permalink
Browse files
QgsGrass::Exception reverted to std::runtime_error because with QgsEx…
…ception could not be caught

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13157 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Mar 25, 2010
1 parent 2285b5a commit 89d2bac8d55c3e368ade54a81a90da270f4f6a3a
@@ -141,21 +141,15 @@ void QgsGrassSelect::setLocations()

QString ldpath = egisdbase->text() + "/" + d[i];

/* TODO: G_is_location() was added to GRASS 6.1 06-05-24,
enable its use after some period (others do update) */
#if 0
if ( QgsGrass::versionMajor() > 6 || QgsGrass::versionMinor() > 0 )
{
if ( !G_is_location( ldpath.toLocal8Bit().constData() ) ) continue;
}
else
{
#endif
QString chf = egisdbase->text() + "/" + d[i] + "/PERMANENT/DEFAULT_WIND";
if ( !QFile::exists( chf ) ) continue;
#if 0
}
#endif

// if type is MAPSET check also if at least one mapset owned by user exists
if ( QgsGrassSelect::type == QgsGrassSelect::MAPSET )
@@ -1128,7 +1128,7 @@ QgsCoordinateReferenceSystem GRASS_EXPORT QgsGrass::crs( QString gisdbase, QStri
crs.createFromWkt( wkt );

}
catch ( QgsException &e )
catch ( QgsGrass::Exception &e )
{
QMessageBox::warning( 0, QObject::tr( "Warning" ),
QObject::tr( "Cannot get projection " ) + "\n" + e.what() );
@@ -1151,7 +1151,7 @@ QgsRectangle GRASS_EXPORT QgsGrass::extent( QString gisdbase, QString location,
}
return QgsRectangle( list[0].toDouble(), list[1].toDouble(), list[2].toDouble(), list[3].toDouble() ) ;
}
catch ( QgsException &e )
catch ( QgsGrass::Exception &e )
{
QMessageBox::warning( 0, QObject::tr( "Warning" ),
QObject::tr( "Cannot get raster extent" ) + "\n" + e.what() );
@@ -1174,7 +1174,7 @@ QMap<QString, QString> GRASS_EXPORT QgsGrass::query( QString gisdbase, QString l
result[list[0]] = list[1];
}
}
catch ( QgsException &e )
catch ( QgsGrass::Exception &e )
{
QMessageBox::warning( 0, QObject::tr( "Warning" ),
QObject::tr( "Cannot query raster " ) + "\n" + e.what() );
@@ -23,6 +23,7 @@ extern "C"
#include <grass/form.h>
}

#include <stdexcept>
#include "qgsexception.h"
#include <QString>
#include <QMap>
@@ -35,10 +36,20 @@ class QgsRectangle;
class QgsGrass
{
public:
// This does not work (gcc/Linux), such exception cannot be caught
// so I have enabled the old version, if you are able to fix it, please
// check first if it realy works, i.e. can be caught!
/*
struct Exception : public QgsException
{
Exception( const QString &msg ) : QgsException( msg ) {}
};
*/
struct Exception : public std::runtime_error
{
//Exception( const std::string &msg ) : std::runtime_error( msg ) {}
Exception( const QString &msg ) : std::runtime_error( msg.toUtf8().constData() ) {}
};

//! Get info about the mode
/*! QgsGrass may be running in active or passive mode.
@@ -104,8 +104,7 @@ QImage* QgsGrassRasterProvider::draw( QgsRectangle const & viewExtent, int pixe
{
data = QgsGrass::runModule ( mGisdbase, mLocation, cmd, arguments );
}
//catch ( QgsGrass::Exception &e ) // does not work
catch ( QgsException &e )
catch ( QgsGrass::Exception &e )
{
QMessageBox::warning( 0, QObject::tr( "Warning" ), QObject::tr( "Cannot draw raster" ) + "\n"
+ e.what() );

0 comments on commit 89d2bac

Please sign in to comment.