Skip to content

Commit 58e5351

Browse files
committedMay 15, 2018
Don't add GEOS warnings to message log
This dramatically slows down rendering, especially when labeling is used. E.g. because labeling clips features, or because the rendering simplification code results in invalid geometries - this then fires multiple geos warnings when labeling tests for geometry validity, etc. But these warnings are useless, because the original geometry is valid and users cannot repair them.... yet they slow things RIIIIIIGHHHT DOOOOWN. Well behaved code, which requires access to geos errors, should be using QgsGeometry::lastError instead.
1 parent 4d36f37 commit 58e5351

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed
 

‎src/core/geometry/qgsgeos.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ email : marco.hugentobler at sourcepole dot com
1818
#include "qgsgeometrycollection.h"
1919
#include "qgsgeometryfactory.h"
2020
#include "qgslinestring.h"
21-
#include "qgsmessagelog.h"
2221
#include "qgsmulticurve.h"
2322
#include "qgsmultilinestring.h"
2423
#include "qgsmultipoint.h"
@@ -34,14 +33,12 @@ email : marco.hugentobler at sourcepole dot com
3433
#define CATCH_GEOS(r) \
3534
catch (GEOSException &e) \
3635
{ \
37-
QgsMessageLog::logMessage( QObject::tr( "Exception: %1" ).arg( e.what() ), QObject::tr("GEOS") ); \
3836
return r; \
3937
}
4038

4139
#define CATCH_GEOS_WITH_ERRMSG(r) \
4240
catch (GEOSException &e) \
4341
{ \
44-
QgsMessageLog::logMessage( QObject::tr( "Exception: %1" ).arg( e.what() ), QObject::tr("GEOS") ); \
4542
if ( errorMsg ) \
4643
{ \
4744
*errorMsg = e.what(); \
@@ -1053,9 +1050,8 @@ geos::unique_ptr QgsGeos::createGeosCollection( int typeId, const QVector<GEOSGe
10531050
{
10541051
geom.reset( GEOSGeom_createCollection_r( geosinit.ctxt, typeId, geomarr, nNotNullGeoms ) );
10551052
}
1056-
catch ( GEOSException &e )
1053+
catch ( GEOSException & )
10571054
{
1058-
QgsMessageLog::logMessage( QObject::tr( "Exception: %1" ).arg( e.what() ), QObject::tr( "GEOS" ) );
10591055
}
10601056

10611057
delete [] geomarr;
@@ -1751,7 +1747,7 @@ GEOSCoordSequence *QgsGeos::createCoordinateSequence( const QgsCurve *curve, dou
17511747
coordSeq = GEOSCoordSeq_create_r( geosinit.ctxt, numOutPoints, coordDims );
17521748
if ( !coordSeq )
17531749
{
1754-
QgsMessageLog::logMessage( QObject::tr( "Could not create coordinate sequence for %1 points in %2 dimensions" ).arg( numPoints ).arg( coordDims ), QObject::tr( "GEOS" ) );
1750+
QgsDebugMsg( QStringLiteral( "GEOS Exception: Could not create coordinate sequence for %1 points in %2 dimensions" ).arg( numPoints ).arg( coordDims ) );
17551751
return nullptr;
17561752
}
17571753
if ( precision > 0. )
@@ -1813,7 +1809,7 @@ geos::unique_ptr QgsGeos::createGeosPointXY( double x, double y, bool hasZ, doub
18131809
GEOSCoordSequence *coordSeq = GEOSCoordSeq_create_r( geosinit.ctxt, 1, coordDims );
18141810
if ( !coordSeq )
18151811
{
1816-
QgsMessageLog::logMessage( QObject::tr( "Could not create coordinate sequence for point with %1 dimensions" ).arg( coordDims ), QObject::tr( "GEOS" ) );
1812+
QgsDebugMsg( QStringLiteral( "GEOS Exception: Could not create coordinate sequence for point with %1 dimensions" ).arg( coordDims ) );
18171813
return nullptr;
18181814
}
18191815
if ( precision > 0. )
@@ -2363,7 +2359,6 @@ geos::unique_ptr QgsGeos::reshapeLine( const GEOSGeometry *line, const GEOSGeome
23632359
}
23642360
catch ( GEOSException &e )
23652361
{
2366-
QgsMessageLog::logMessage( QObject::tr( "Exception: %1" ).arg( e.what() ), QObject::tr( "GEOS" ) );
23672362
atLeastTwoIntersections = false;
23682363
}
23692364

@@ -2582,7 +2577,6 @@ geos::unique_ptr QgsGeos::reshapePolygon( const GEOSGeometry *polygon, const GEO
25822577
}
25832578
catch ( GEOSException &e )
25842579
{
2585-
QgsMessageLog::logMessage( QObject::tr( "Exception: %1" ).arg( e.what() ), QObject::tr( "GEOS" ) );
25862580
nIntersections = 0;
25872581
}
25882582

0 commit comments

Comments
 (0)
Please sign in to comment.