Skip to content

Commit 32e6d9c

Browse files
committedOct 5, 2015
[GRASS] removed warnings from raster provider
1 parent 6d2367f commit 32e6d9c

File tree

7 files changed

+144
-65
lines changed

7 files changed

+144
-65
lines changed
 

‎src/plugins/grass/qgsgrassregion.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ QgsGrassRegionEdit::QgsGrassRegionEdit( QgsMapCanvas* canvas )
4141
mDraw = false;
4242
mRubberBand = new QgsRubberBand( mCanvas, QGis::Polygon );
4343
mSrcRubberBand = new QgsRubberBand( mCanvas, QGis::Polygon );
44-
mCrs = QgsGrass::crs( QgsGrass::getDefaultGisdbase(), QgsGrass::getDefaultLocation() );
44+
QString error;
45+
mCrs = QgsGrass::crs( QgsGrass::getDefaultGisdbase(), QgsGrass::getDefaultLocation(), error );
4546
QgsDebugMsg( "mCrs: " + mCrs.toWkt() );
4647
setTransform();
4748
connect( canvas, SIGNAL( destinationCrsChanged() ), this, SLOT( setTransform() ) );
@@ -312,7 +313,8 @@ void QgsGrassRegion::mapsetChanged()
312313
mRegionEdit = new QgsGrassRegionEdit( mCanvas );
313314
connect( mRegionEdit, SIGNAL( captureEnded() ), this, SLOT( onCaptureFinished() ) );
314315

315-
mCrs = QgsGrass::crs( QgsGrass::getDefaultGisdbase(), QgsGrass::getDefaultLocation() );
316+
QString error;
317+
mCrs = QgsGrass::crs( QgsGrass::getDefaultGisdbase(), QgsGrass::getDefaultLocation(), error );
316318
reloadRegion();
317319
}
318320
}

‎src/providers/grass/qgsgrass.cpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,7 @@ QString QgsGrass::getInfo( const QString& info, const QString& gisdbase,
18471847
}
18481848

18491849
QgsCoordinateReferenceSystem QgsGrass::crs( const QString& gisdbase, const QString& location,
1850-
bool interactive )
1850+
QString &error )
18511851
{
18521852
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
18531853
QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem();
@@ -1860,10 +1860,8 @@ QgsCoordinateReferenceSystem QgsGrass::crs( const QString& gisdbase, const QStri
18601860
}
18611861
catch ( QgsGrass::Exception &e )
18621862
{
1863-
if ( interactive )
1864-
{
1865-
warning( tr( "Cannot get projection " ) + "\n" + e.what() );
1866-
}
1863+
error = tr( "Cannot get projection " ) + "\n" + e.what();
1864+
QgsDebugMsg( error );
18671865
}
18681866

18691867
return crs;
@@ -1910,7 +1908,7 @@ QgsCoordinateReferenceSystem QgsGrass::crsDirect( const QString& gisdbase, const
19101908

19111909
QgsRectangle QgsGrass::extent( const QString& gisdbase, const QString& location,
19121910
const QString& mapset, const QString& map,
1913-
QgsGrassObject::Type type, bool interactive )
1911+
QgsGrassObject::Type type, QString &error )
19141912
{
19151913
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
19161914

@@ -1926,16 +1924,13 @@ QgsRectangle QgsGrass::extent( const QString& gisdbase, const QString& location,
19261924
}
19271925
catch ( QgsGrass::Exception &e )
19281926
{
1929-
if ( interactive )
1930-
{
1931-
warning( tr( "Cannot get raster extent" ) + "\n" + e.what() );
1932-
}
1927+
error = tr( "Cannot get raster extent" ) + " : " + e.what();
19331928
}
19341929
return QgsRectangle( 0, 0, 0, 0 );
19351930
}
19361931

1937-
void QgsGrass::size( const QString& gisdbase, const QString& location,
1938-
const QString& mapset, const QString& map, int *cols, int *rows )
1932+
void QgsGrass::size( const QString& gisdbase, const QString& location, const QString& mapset,
1933+
const QString& map, int *cols, int *rows, QString &error )
19391934
{
19401935
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
19411936

@@ -1954,7 +1949,8 @@ void QgsGrass::size( const QString& gisdbase, const QString& location,
19541949
}
19551950
catch ( QgsGrass::Exception &e )
19561951
{
1957-
warning( tr( "Cannot get raster extent" ) + "\n" + e.what() );
1952+
error = tr( "Cannot get raster extent" ) + " : " + e.what();
1953+
QgsDebugMsg( error );
19581954
}
19591955

19601956
QgsDebugMsg( QString( "raster size = %1 %2" ).arg( *cols ).arg( *rows ) );
@@ -1966,7 +1962,7 @@ QHash<QString, QString> QgsGrass::info( const QString& gisdbase, const QString&
19661962
const QString& info,
19671963
const QgsRectangle& extent,
19681964
int sampleRows, int sampleCols,
1969-
int timeOut, bool interactive )
1965+
int timeOut, QString &error )
19701966
{
19711967
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
19721968
QHash<QString, QString> inf;
@@ -1990,15 +1986,14 @@ QHash<QString, QString> QgsGrass::info( const QString& gisdbase, const QString&
19901986
}
19911987
catch ( QgsGrass::Exception &e )
19921988
{
1993-
if ( interactive )
1994-
{
1995-
warning( tr( "Cannot get map info" ) + "\n" + e.what() );
1996-
}
1989+
error = tr( "Cannot get map info" ) + "\n" + e.what();
1990+
QgsDebugMsg( error );
19971991
}
19981992
return inf;
19991993
}
20001994

2001-
QList<QgsGrass::Color> QgsGrass::colors( QString gisdbase, QString location, QString mapset, QString map )
1995+
QList<QgsGrass::Color> QgsGrass::colors( QString gisdbase, QString location, QString mapset,
1996+
QString map, QString& error )
20021997
{
20031998
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
20041999
QList<QgsGrass::Color> ct;
@@ -2022,7 +2017,8 @@ QList<QgsGrass::Color> QgsGrass::colors( QString gisdbase, QString location, QSt
20222017
}
20232018
catch ( QgsGrass::Exception &e )
20242019
{
2025-
warning( tr( "Cannot get colors" ) + "\n" + e.what() );
2020+
error = tr( "Cannot get colors" ) + " : " + e.what();
2021+
QgsDebugMsg( error );
20262022
}
20272023
return ct;
20282024
}

‎src/providers/grass/qgsgrass.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -411,35 +411,35 @@ class GRASS_LIB_EXPORT QgsGrass : public QObject
411411
int sampleCols = 0, int timeOut = 30000 );
412412

413413
// ! Get location projection
414-
static QgsCoordinateReferenceSystem crs( const QString& gisdbase, const QString& location, bool interactive = true );
414+
static QgsCoordinateReferenceSystem crs( const QString& gisdbase, const QString& location, QString &error );
415415

416416
// ! Get location projection calling directly GRASS library
417417
static QgsCoordinateReferenceSystem crsDirect( const QString& gisdbase, const QString& location );
418418

419419
// ! Get map extent
420-
// @param interactive - show warning dialog on error
420+
// @param error set to error if happens
421421
static QgsRectangle extent( const QString& gisdbase, const QString& location,
422422
const QString& mapset, const QString& map,
423-
QgsGrassObject::Type type = QgsGrassObject::None, bool interactive = true );
423+
QgsGrassObject::Type type, QString &error );
424424

425425
// ! Get raster map size
426-
static void size( const QString& gisdbase, const QString& location,
427-
const QString& mapset, const QString& map, int *cols, int *rows );
426+
static void size( const QString& gisdbase, const QString& location, const QString& mapset,
427+
const QString& map, int *cols, int *rows, QString &error );
428428

429429
// ! Get raster info, info is either 'info' or 'stats'
430430
// extent and sampleSize are stats options
431-
// @param interactive - show warning dialog on error
431+
// @param error set to error if happens
432432
static QHash<QString, QString> info( const QString& gisdbase, const QString& location,
433433
const QString& mapset, const QString& map,
434434
QgsGrassObject::Type type,
435-
const QString& info = "info",
436-
const QgsRectangle& extent = QgsRectangle(),
437-
int sampleRows = 0, int sampleCols = 0,
438-
int timeOut = 30000, bool interactive = true );
435+
const QString& info,
436+
const QgsRectangle& extent,
437+
int sampleRows, int sampleCols,
438+
int timeOut, QString &error );
439439

440440
// ! List of Color
441-
static QList<QgsGrass::Color> colors( QString gisdbase, QString location,
442-
QString mapset, QString map );
441+
static QList<QgsGrass::Color> colors( QString gisdbase, QString location, QString mapset,
442+
QString map, QString& error );
443443

444444
// ! Get map value / feature info
445445
static QMap<QString, QString> query( QString gisdbase, QString location,

‎src/providers/grass/qgsgrassprovider.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ bool QgsGrassProvider::isValid()
443443

444444
QgsCoordinateReferenceSystem QgsGrassProvider::crs()
445445
{
446-
return QgsGrass::crs( mGrassObject.gisdbase(), mGrassObject.location() );
446+
QString error;
447+
return QgsGrass::crs( mGrassObject.gisdbase(), mGrassObject.location(), error );
447448
}
448449

449450
int QgsGrassProvider::grassLayer()

‎src/providers/grass/qgsgrassrasterprovider.cpp

Lines changed: 74 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
static QString PROVIDER_KEY = "grassraster";
4545
static QString PROVIDER_DESCRIPTION = QString( "GRASS %1 raster provider" ).arg( GRASS_VERSION_MAJOR );
4646

47+
// Do not use warning dialogs, providers are also created on threads (rendering) where dialogs connot be used (constructing QPixmap icon)
48+
4749
QgsGrassRasterProvider::QgsGrassRasterProvider( QString const & uri )
4850
: QgsRasterDataProvider( uri )
4951
, mValid( false )
@@ -94,14 +96,21 @@ QgsGrassRasterProvider::QgsGrassRasterProvider( QString const & uri )
9496
mRasterValue.start( mGisdbase, mLocation, mMapset, mMapName );
9597
//mValidNoDataValue = true;
9698

97-
mCrs = QgsGrass::crs( mGisdbase, mLocation );
99+
QString error;
100+
mCrs = QgsGrass::crs( mGisdbase, mLocation, error );
101+
appendIfError( error );
98102
QgsDebugMsg( "mCrs: " + mCrs.toWkt() );
99103

100104
// the block size can change of course when the raster is overridden
101105
// ibut it is only called once when statistics are calculated
102-
QgsGrass::size( mGisdbase, mLocation, mMapset, mMapName, &mCols, &mRows );
106+
error.clear();
107+
QgsGrass::size( mGisdbase, mLocation, mMapset, mMapName, &mCols, &mRows, error );
108+
appendIfError( error );
103109

104-
mInfo = QgsGrass::info( mGisdbase, mLocation, mMapset, mMapName, QgsGrassObject::Raster );
110+
error.clear();
111+
mInfo = QgsGrass::info( mGisdbase, mLocation, mMapset, mMapName, QgsGrassObject::Raster,
112+
"info", QgsRectangle(), 0, 0, 3000, error );
113+
appendIfError( error );
105114

106115
mGrassDataType = mInfo["TYPE"].toInt();
107116
QgsDebugMsg( "mGrassDataType = " + QString::number( mGrassDataType ) );
@@ -177,6 +186,7 @@ QImage* QgsGrassRasterProvider::draw( QgsRectangle const & viewExtent, int pixe
177186
QgsDebugMsg( "pixelWidth = " + QString::number( pixelWidth ) );
178187
QgsDebugMsg( "pixelHeight = " + QString::number( pixelHeight ) );
179188
QgsDebugMsg( "viewExtent: " + viewExtent.toString() );
189+
clearLastError();
180190

181191
QImage *image = new QImage( pixelWidth, pixelHeight, QImage::Format_ARGB32 );
182192
image->fill( QColor( Qt::gray ).rgb() );
@@ -198,9 +208,9 @@ QImage* QgsGrassRasterProvider::draw( QgsRectangle const & viewExtent, int pixe
198208
}
199209
catch ( QgsGrass::Exception &e )
200210
{
201-
QMessageBox::warning( 0, QObject::tr( "Warning" ), QObject::tr( "Cannot draw raster" ) + "\n"
202-
+ e.what() );
203-
211+
QString error = tr( "Cannot draw raster" ) + " : " + e.what();
212+
QgsDebugMsg( error );
213+
appendError( error );
204214
// We don't set mValid to false, because the raster can be recreated and work next time
205215
return image;
206216
}
@@ -219,6 +229,7 @@ void QgsGrassRasterProvider::readBlock( int bandNo, int xBlock, int yBlock, void
219229
{
220230
Q_UNUSED( xBlock );
221231
QgsDebugMsg( "Entered" );
232+
clearLastError();
222233
// TODO: optimize, see extent()
223234

224235
QgsDebugMsg( "yBlock = " + QString::number( yBlock ) );
@@ -251,9 +262,9 @@ void QgsGrassRasterProvider::readBlock( int bandNo, int xBlock, int yBlock, void
251262
}
252263
catch ( QgsGrass::Exception &e )
253264
{
254-
QMessageBox::warning( 0, QObject::tr( "Warning" ), QObject::tr( "Cannot draw raster" ) + "\n"
255-
+ e.what() );
256-
265+
QString error = tr( "Cannot read raster" ) + " : " + e.what();
266+
QgsDebugMsg( error );
267+
appendError( error );
257268
// We don't set mValid to false, because the raster can be recreated and work next time
258269
}
259270
QgsDebugMsg( QString( "%1 bytes read from modules stdout" ).arg( data.size() ) );
@@ -263,8 +274,9 @@ void QgsGrassRasterProvider::readBlock( int bandNo, int xBlock, int yBlock, void
263274
QgsDebugMsg( QString( "mCols = %1 mYBlockSize = %2 dataTypeSize = %3" ).arg( mCols ).arg( mYBlockSize ).arg( dataTypeSize( bandNo ) ) );
264275
if ( size != data.size() )
265276
{
266-
QMessageBox::warning( 0, QObject::tr( "Warning" ),
267-
QString( "%1 bytes expected but %2 byte were read from qgis.d.rast" ).arg( size ).arg( data.size() ) );
277+
QString error = tr( "%1 bytes expected but %2 byte were read from qgis.d.rast" ).arg( size ).arg( data.size() );
278+
QgsDebugMsg( error );
279+
appendError( error );
268280
size = size < data.size() ? size : data.size();
269281
}
270282
memcpy( block, data.data(), size );
@@ -276,6 +288,7 @@ void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const & viewEx
276288
QgsDebugMsg( "pixelWidth = " + QString::number( pixelWidth ) );
277289
QgsDebugMsg( "pixelHeight = " + QString::number( pixelHeight ) );
278290
QgsDebugMsg( "viewExtent: " + viewExtent.toString() );
291+
clearLastError();
279292

280293
if ( pixelWidth <= 0 || pixelHeight <= 0 )
281294
return;
@@ -298,8 +311,9 @@ void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const & viewEx
298311
}
299312
catch ( QgsGrass::Exception &e )
300313
{
301-
QMessageBox::warning( 0, QObject::tr( "Warning" ), QObject::tr( "Cannot draw raster" ) + "\n"
302-
+ e.what() );
314+
QString error = tr( "Cannot read raster" ) + " : " + e.what();
315+
QgsDebugMsg( error );
316+
appendError( error );
303317

304318
// We don't set mValid to false, because the raster can be recreated and work next time
305319
return;
@@ -310,8 +324,9 @@ void QgsGrassRasterProvider::readBlock( int bandNo, QgsRectangle const & viewEx
310324
int size = pixelWidth * pixelHeight * dataTypeSize( bandNo );
311325
if ( size != data.size() )
312326
{
313-
QMessageBox::warning( 0, QObject::tr( "Warning" ),
314-
QString( "%1 bytes expected but %2 byte were read from qgis.d.rast" ).arg( size ).arg( data.size() ) );
327+
QString error = tr( "%1 bytes expected but %2 byte were read from qgis.d.rast" ).arg( size ).arg( data.size() );
328+
QgsDebugMsg( error );
329+
appendError( error );
315330
size = size < data.size() ? size : data.size();
316331
}
317332
memcpy( block, data.data(), size );
@@ -341,9 +356,11 @@ QgsRasterBandStats QgsGrassRasterProvider::bandStatistics( int theBandNo, int th
341356
// 0.001 / cell should be sufficient using 0.005 to be sure + constant (ms)
342357
int timeout = 30000 + 0.005 * xSize() * ySize();
343358

344-
QHash<QString, QString> info = QgsGrass::info( mGisdbase, mLocation, mMapset, mMapName, QgsGrassObject::Raster, "stats", extent, sampleRows, sampleCols, timeout );
359+
QString error;
360+
QHash<QString, QString> info = QgsGrass::info( mGisdbase, mLocation, mMapset, mMapName, QgsGrassObject::Raster,
361+
"stats", extent, sampleRows, sampleCols, timeout, error );
345362

346-
if ( info.isEmpty() )
363+
if ( info.isEmpty() || !error.isEmpty() )
347364
{
348365
return myRasterBandStats;
349366
}
@@ -381,7 +398,12 @@ QList<QgsColorRampShader::ColorRampItem> QgsGrassRasterProvider::colorTable( int
381398
// for now we just believe that they are continuous, i.e. end and beginning
382399
// of the ramp with the same value has the same color
383400
// we are also expecting ordered CT records in the list
384-
QList<QgsGrass::Color> colors = QgsGrass::colors( mGisdbase, mLocation, mMapset, mMapName );
401+
QString error;
402+
QList<QgsGrass::Color> colors = QgsGrass::colors( mGisdbase, mLocation, mMapset, mMapName, error );
403+
if ( !error.isEmpty() )
404+
{
405+
return ct;
406+
}
385407
QList<QgsGrass::Color>::iterator i;
386408

387409
double v = 0.0, r = 0.0, g = 0.0, b = 0.0;
@@ -419,7 +441,8 @@ QgsRectangle QgsGrassRasterProvider::extent()
419441
// The extend can change of course so we get always fresh, to avoid running always the module
420442
// we should save mExtent and mLastModified and check if the map was modified
421443

422-
mExtent = QgsGrass::extent( mGisdbase, mLocation, mMapset, mMapName, QgsGrassObject::Raster );
444+
QString error;
445+
mExtent = QgsGrass::extent( mGisdbase, mLocation, mMapset, mMapName, QgsGrassObject::Raster, error );
423446

424447
QgsDebugMsg( "Extent got" );
425448
return mExtent;
@@ -561,14 +584,34 @@ bool QgsGrassRasterProvider::isValid()
561584
return mValid;
562585
}
563586

587+
void QgsGrassRasterProvider::setLastError( QString error )
588+
{
589+
mLastErrorTitle = tr( "GRASS raster provider" );
590+
mLastError = error;
591+
}
592+
593+
void QgsGrassRasterProvider::clearLastError()
594+
{
595+
mLastErrorTitle.clear();
596+
mLastError.clear();
597+
}
598+
599+
void QgsGrassRasterProvider::appendIfError( QString error )
600+
{
601+
if ( !error.isEmpty() )
602+
{
603+
appendError( ERR( error ) );
604+
}
605+
}
606+
564607
QString QgsGrassRasterProvider::lastErrorTitle()
565608
{
566-
return QString( "Not implemented" );
609+
return mLastErrorTitle;
567610
}
568611

569612
QString QgsGrassRasterProvider::lastError()
570613
{
571-
return QString( "Not implemented" );
614+
return mLastError;
572615
}
573616

574617
QString QgsGrassRasterProvider::name() const
@@ -647,7 +690,16 @@ void QgsGrassRasterValue::start( QString gisdbase, QString location,
647690

648691
arguments.append( "info=query" );
649692
arguments.append( "rast=" + mMapName + "@" + mMapset );
650-
mProcess = QgsGrass::startModule( mGisdbase, mLocation, mMapset, module, arguments, mGisrcFile );
693+
try
694+
{
695+
mProcess = QgsGrass::startModule( mGisdbase, mLocation, mMapset, module, arguments, mGisrcFile );
696+
}
697+
catch ( QgsGrass::Exception &e )
698+
{
699+
QString error = e.what();
700+
Q_UNUSED( error )
701+
QgsDebugMsg( error );
702+
}
651703
}
652704
QgsGrassRasterValue::~QgsGrassRasterValue()
653705
{

‎src/providers/grass/qgsgrassrasterprovider.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ class QgsGrassRasterProvider : public QgsRasterDataProvider
208208

209209
virtual QDateTime dataTimestamp() const override;
210210
private:
211-
211+
void setLastError( QString error );
212+
void clearLastError();
213+
// append error if it is not empty
214+
void appendIfError( QString error );
212215
/**
213216
* Flag indicating if the layer data source is a valid layer
214217
*/
@@ -232,6 +235,9 @@ class QgsGrassRasterProvider : public QgsRasterDataProvider
232235
QgsGrassRasterValue mRasterValue;
233236

234237
double mNoDataValue;
238+
239+
QString mLastErrorTitle;
240+
QString mLastError;
235241
};
236242

237243
#endif

‎tests/src/providers/grass/testqgsgrassprovider.cpp

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,16 @@ void TestQgsGrassProvider::info()
417417
{
418418
es = expectedStats.value( map );
419419
// TODO: QgsGrass::info() may open dialog window on error which blocks tests
420+
QString error;
420421
QHash<QString, QString> info = QgsGrass::info( tmpGisdbase, mLocation, "test", map, QgsGrassObject::Raster, "stats",
421-
expectedExtent, 10, 10, 5000, false );
422+
expectedExtent, 10, 10, 5000, error );
423+
if ( !error.isEmpty() )
424+
{
425+
ok = false;
426+
reportRow( "error: " + error );
427+
continue;
428+
}
429+
422430
reportRow( "map: " + map );
423431
QgsRasterBandStats s;
424432
s.minimumValue = info["MIN"].toDouble();
@@ -429,9 +437,14 @@ void TestQgsGrassProvider::info()
429437
compare( es.minimumValue, s.minimumValue, ok );
430438
compare( es.maximumValue, s.maximumValue, ok );
431439

432-
QgsRectangle extent = QgsGrass::extent( tmpGisdbase, mLocation, "test", map, QgsGrassObject::Raster, false );
440+
QgsRectangle extent = QgsGrass::extent( tmpGisdbase, mLocation, "test", map, QgsGrassObject::Raster, error );
433441
reportRow( "expectedExtent: " + expectedExtent.toString() );
434442
reportRow( "extent: " + extent.toString() );
443+
if ( !error.isEmpty() )
444+
{
445+
ok = false;
446+
reportRow( "error: " + error );
447+
}
435448
if ( extent != expectedExtent )
436449
{
437450
ok = false;
@@ -443,19 +456,28 @@ void TestQgsGrassProvider::info()
443456
expectedCrs.createFromOgcWmsCrs( "EPSG:4326" );
444457

445458
reportRow( "expectedCrs: " + expectedCrs.toWkt() );
446-
QgsCoordinateReferenceSystem crs = QgsGrass::crs( tmpGisdbase, mLocation );
447-
if ( !crs.isValid() )
459+
QString error;
460+
QgsCoordinateReferenceSystem crs = QgsGrass::crs( tmpGisdbase, mLocation, error );
461+
if ( !error.isEmpty() )
448462
{
449-
reportRow( "crs: cannot read crs: " + QgsGrass::errorMessage() );
450463
ok = false;
464+
reportRow( "crs: cannot read crs: " + error );
451465
}
452466
else
453467
{
454-
reportRow( "crs: " + crs.toWkt() );
455-
if ( crs != expectedCrs )
468+
if ( !crs.isValid() )
456469
{
470+
reportRow( "crs: cannot read crs: " + QgsGrass::errorMessage() );
457471
ok = false;
458472
}
473+
else
474+
{
475+
reportRow( "crs: " + crs.toWkt() );
476+
if ( crs != expectedCrs )
477+
{
478+
ok = false;
479+
}
480+
}
459481
}
460482
removeRecursively( tmpGisdbase );
461483
GVERIFY( ok );

0 commit comments

Comments
 (0)
Please sign in to comment.