Skip to content
Permalink
Browse files

Better error reporting from is valid check

  • Loading branch information
m-kuhn committed Oct 1, 2018
1 parent ed27442 commit baf1e52f7fd467c1d87738d736e73de637ff9e58
@@ -49,7 +49,11 @@ QList<QgsSingleGeometryCheckError *> QgsGeometryIsValidCheck::processGeometry( c
QList<QgsSingleGeometryCheckError *> result;
for ( const auto &error : qgis::as_const( errors ) )
{
result << new QgsSingleGeometryCheckError( this, geometry, QgsGeometry( qgis::make_unique<QgsPoint>( error.where() ) ) );
QgsGeometry errorGeometry;
if ( error.hasWhere() )
errorGeometry = QgsGeometry( qgis::make_unique<QgsPoint>( error.where() ) );

result << new QgsGeometryIsValidCheckError( this, geometry, errorGeometry, error.what() );
}
return result;
}
@@ -89,3 +93,15 @@ QgsGeometryCheck::CheckType QgsGeometryIsValidCheck::factoryCheckType()
return QgsGeometryCheck::FeatureNodeCheck;
}
///@endcond

QgsGeometryIsValidCheckError::QgsGeometryIsValidCheckError( const QgsSingleGeometryCheck *check, const QgsGeometry &geometry, const QgsGeometry &errorLocation, const QString &errorDescription )
: QgsSingleGeometryCheckError( check, geometry, errorLocation )
, mDescription( errorDescription )
{

}

QString QgsGeometryIsValidCheckError::description() const
{
return mDescription;
}
@@ -20,6 +20,17 @@ email : matthias@opengis.ch

#include "qgssinglegeometrycheck.h"

class ANALYSIS_EXPORT QgsGeometryIsValidCheckError : public QgsSingleGeometryCheckError
{
public:
QgsGeometryIsValidCheckError( const QgsSingleGeometryCheck *check, const QgsGeometry &geometry, const QgsGeometry &errorLocation, const QString &errorDescription );

QString description() const override;

private:
QString mDescription;
};

/**
* Checks if geometries are valid using the backend configured in the QGIS settings.
* This does not offer any fixes but makes sure that all geometries are valid.

0 comments on commit baf1e52

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