/*************************************************************************** qgsgeometrycontainedcheck.h --------------------- begin : September 2015 copyright : (C) 2014 by Sandro Mani / Sourcepole AG email : smani at sourcepole dot ch *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGS_GEOMETRY_COVER_CHECK_H #define QGS_GEOMETRY_COVER_CHECK_H #include "qgsgeometrycheck.h" class QgsGeometryContainedCheckError : public QgsGeometryCheckError { public: QgsGeometryContainedCheckError( const QgsGeometryCheck *check, const QString &layerId, QgsFeatureId featureId, const QgsPoint &errorLocation, QgsFeatureId otherId ) : QgsGeometryCheckError( check, layerId, featureId, errorLocation, QgsVertexId(), otherId, ValueOther ) , mOtherId( otherId ) { } QgsFeatureId otherId() const { return mOtherId; } bool isEqual( QgsGeometryCheckError *other ) const override { return other->check() == check() && other->featureId() == featureId() && static_cast( other )->otherId() == otherId(); } virtual QString description() const override { return QApplication::translate( "QgsGeometryContainedCheckError", "Within %1" ).arg( otherId() ); } private: QgsFeatureId mOtherId; }; class QgsGeometryContainedCheck : public QgsGeometryCheck { Q_OBJECT public: explicit QgsGeometryContainedCheck( const QMap &featurePools ) : QgsGeometryCheck( FeatureCheck, {QgsWkbTypes::PolygonGeometry}, featurePools ) {} void collectErrors( QList &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap &ids = QMap() ) const override; void fixError( QgsGeometryCheckError *error, int method, const QMap &mergeAttributeIndices, Changes &changes ) const override; QStringList getResolutionMethods() const override; QString errorDescription() const override { return tr( "Within" ); } QString errorName() const override { return QStringLiteral( "QgsGeometryContainedCheck" ); } private: enum ResolutionMethod { Delete, NoChange }; }; #endif // QGS_GEOMETRY_COVER_CHECK_H