Skip to content

Commit 6a5a602

Browse files
committed
Add checkType() method to all checks
1 parent e63526f commit 6a5a602

20 files changed

+69
-41
lines changed

src/analysis/vector/geometry_checker/qgsgeometryareacheck.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class ANALYSIS_EXPORT QgsGeometryAreaCheck : public QgsGeometryCheck
4040

4141
static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::PolygonGeometry}; }
4242
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
43-
QString factoryDescription() const { return tr( "Minimal area" ); }
43+
static QString factoryDescription() { return tr( "Minimal area" ); }
4444
QString description() const override { return factoryDescription(); }
45-
QString factoryId() const { return QStringLiteral( "QgsGeometryAreaCheck" ); }
45+
static QString factoryId() { return QStringLiteral( "QgsGeometryAreaCheck" ); }
4646
static QgsGeometryCheck::CheckType factoryCheckType() { return QgsGeometryCheck::FeatureCheck; }
4747

4848
private:

src/analysis/vector/geometry_checker/qgsgeometrycontainedcheck.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ANALYSIS_EXPORT QgsGeometryContainedCheckError : public QgsGeometryCheckEr
4242
static_cast<QgsGeometryContainedCheckError *>( other )->containingFeature() == containingFeature();
4343
}
4444

45-
QString factoryDescription() const { return QApplication::translate( "QgsGeometryContainedCheckError", "Within feature" ); }
45+
static QString factoryDescription() { return QApplication::translate( "QgsGeometryContainedCheckError", "Within feature" ); }
4646
QString description() const override { return factoryDescription(); }
4747

4848
private:

src/analysis/vector/geometry_checker/qgsgeometrydanglecheck.h

+8-5
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,19 @@ class ANALYSIS_EXPORT QgsGeometryDangleCheck : public QgsGeometryCheck
2626
QgsGeometryDangleCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration )
2727
: QgsGeometryCheck( context, configuration )
2828
{}
29-
static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::LineGeometry}; }
30-
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
29+
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
30+
3131
QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const override { return factoryCompatibleGeometryTypes(); }
3232
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
33-
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
3433
QStringList resolutionMethods() const override;
35-
QString factoryDescription() const { return tr( "Dangle" ); }
3634
QString description() const override { return factoryDescription(); }
37-
QString factoryId() const { return QStringLiteral( "QgsGeometryDangleCheck" ); }
3835
QString id() const override { return factoryId(); }
36+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
37+
38+
static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::LineGeometry}; }
39+
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
40+
static QString factoryDescription() { return tr( "Dangle" ); }
41+
static QString factoryId() { return QStringLiteral( "QgsGeometryDangleCheck" ); }
3942
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
4043

4144
enum ResolutionMethod { NoChange };

src/analysis/vector/geometry_checker/qgsgeometrydegeneratepolygoncheck.h

+9-5
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,20 @@ class ANALYSIS_EXPORT QgsGeometryDegeneratePolygonCheck : public QgsGeometryChec
2727

2828
explicit QgsGeometryDegeneratePolygonCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration )
2929
: QgsGeometryCheck( context, configuration ) {}
30-
static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::PolygonGeometry}; }
31-
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
32-
QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const override { return factoryCompatibleGeometryTypes(); }
30+
3331
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
3432
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
33+
34+
QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const override { return factoryCompatibleGeometryTypes(); }
3535
QStringList resolutionMethods() const override;
36-
QString factoryDescription() const { return tr( "Polygon with less than three nodes" ); }
3736
QString description() const override { return factoryDescription(); }
38-
QString factoryId() const { return QStringLiteral( "QgsGeometryDegeneratePolygonCheck" ); }
3937
QString id() const override { return factoryId(); }
38+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
39+
40+
static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::PolygonGeometry}; }
41+
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
42+
static QString factoryDescription() { return tr( "Polygon with less than three nodes" ); }
43+
static QString factoryId() { return QStringLiteral( "QgsGeometryDegeneratePolygonCheck" ); }
4044
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
4145

4246
private:

src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.h

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class ANALYSIS_EXPORT QgsGeometryDuplicateCheck : public QgsGeometryCheck
6262
QStringList resolutionMethods() const override;
6363
QString description() const override { return factoryDescription(); }
6464
QString id() const override { return factoryId(); }
65+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
6566

6667
static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::PointGeometry, QgsWkbTypes::LineGeometry, QgsWkbTypes::PolygonGeometry}; }
6768
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }

src/analysis/vector/geometry_checker/qgsgeometryduplicatenodescheck.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ class ANALYSIS_EXPORT QgsGeometryDuplicateNodesCheck : public QgsGeometryCheck
3131
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
3232
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
3333
QStringList resolutionMethods() const override;
34-
QString factoryDescription() const { return tr( "Duplicate node" ); }
34+
static QString factoryDescription() { return tr( "Duplicate node" ); }
3535
QString description() const override { return factoryDescription(); }
36-
QString factoryId() const { return QStringLiteral( "QgsGeometryDuplicateNodesCheck" ); }
36+
static QString factoryId() { return QStringLiteral( "QgsGeometryDuplicateNodesCheck" ); }
3737
QString id() const override { return factoryId(); }
38+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
3839
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
3940

4041
enum ResolutionMethod { RemoveDuplicates, NoChange };

src/analysis/vector/geometry_checker/qgsgeometryfollowboundariescheck.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ class ANALYSIS_EXPORT QgsGeometryFollowBoundariesCheck : public QgsGeometryCheck
3434
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
3535
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
3636
QStringList resolutionMethods() const override;
37-
QString factoryDescription() const { return tr( "Polygon does not follow boundaries" ); }
37+
static QString factoryDescription() { return tr( "Polygon does not follow boundaries" ); }
3838
QString description() const override { return factoryDescription(); }
39-
QString factoryId() const { return QStringLiteral( "QgsGeometryFollowBoundariesCheck" ); }
39+
static QString factoryId() { return QStringLiteral( "QgsGeometryFollowBoundariesCheck" ); }
4040
QString id() const override { return factoryId(); }
41+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
4142
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
4243
private:
4344
enum ResolutionMethod { NoChange };

src/analysis/vector/geometry_checker/qgsgeometryholecheck.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ class ANALYSIS_EXPORT QgsGeometryHoleCheck : public QgsGeometryCheck
3131
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
3232
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
3333
QStringList resolutionMethods() const override;
34-
QString factoryDescription() const { return tr( "Polygon with hole" ); }
34+
static QString factoryDescription() { return tr( "Polygon with hole" ); }
3535
QString description() const override { return factoryDescription(); }
36-
QString factoryId() const { return QStringLiteral( "QgsGeometryHoleCheck" ); }
36+
static QString factoryId() { return QStringLiteral( "QgsGeometryHoleCheck" ); }
3737
QString id() const override { return factoryId(); }
38+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
3839
static QgsGeometryCheck::CheckType factoryCheckType() { return QgsGeometryCheck::FeatureCheck; }
3940

4041
enum ResolutionMethod { RemoveHoles, NoChange };

src/analysis/vector/geometry_checker/qgsgeometrylineintersectioncheck.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ class ANALYSIS_EXPORT QgsGeometryLineIntersectionCheck : public QgsGeometryCheck
3232
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
3333
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
3434
QStringList resolutionMethods() const override;
35-
QString factoryDescription() const { return tr( "Intersection" ); }
35+
static QString factoryDescription() { return tr( "Intersection" ); }
3636
QString description() const override { return factoryDescription(); }
37-
QString factoryId() const { return QStringLiteral( "QgsGeometryLineIntersectionCheck" ); }
37+
static QString factoryId() { return QStringLiteral( "QgsGeometryLineIntersectionCheck" ); }
3838
QString id() const override { return factoryId(); }
39+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
3940
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
4041

4142
enum ResolutionMethod { NoChange };

src/analysis/vector/geometry_checker/qgsgeometrylinelayerintersectioncheck.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ class ANALYSIS_EXPORT QgsGeometryLineLayerIntersectionCheck : public QgsGeometry
3333
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
3434
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
3535
QStringList resolutionMethods() const override;
36-
QString factoryDescription() const { return tr( "Intersection" ); }
36+
static QString factoryDescription() { return tr( "Intersection" ); }
3737
QString description() const override { return factoryDescription(); }
38-
QString factoryId() const { return QStringLiteral( "QgsGeometryLineLayerIntersectionCheck" ); }
38+
static QString factoryId() { return QStringLiteral( "QgsGeometryLineLayerIntersectionCheck" ); }
3939
QString id() const override { return factoryId(); }
40+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
4041
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
4142

4243
enum ResolutionMethod { NoChange };

src/analysis/vector/geometry_checker/qgsgeometrymultipartcheck.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ class ANALYSIS_EXPORT QgsGeometryMultipartCheck : public QgsSingleGeometryCheck
3232
QList<QgsSingleGeometryCheckError *> processGeometry( const QgsGeometry &geometry ) const override;
3333
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
3434
QStringList resolutionMethods() const override;
35-
QString factoryDescription() const { return tr( "Multipart object with only one feature" ); }
35+
static QString factoryDescription() { return tr( "Multipart object with only one feature" ); }
3636
QString description() const override { return factoryDescription(); }
37-
QString factoryId() const { return QStringLiteral( "QgsGeometryMultipartCheck" ); }
37+
static QString factoryId() { return QStringLiteral( "QgsGeometryMultipartCheck" ); }
3838
QString id() const override { return factoryId(); }
39+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
3940
static QgsGeometryCheck::CheckType factoryCheckType() { return QgsGeometryCheck::FeatureCheck; }
4041

4142
enum ResolutionMethod { ConvertToSingle, RemoveObject, NoChange };

src/analysis/vector/geometry_checker/qgsgeometryoverlapcheck.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ QgsGeometryOverlapCheckError::QgsGeometryOverlapCheckError( const QgsGeometryChe
250250

251251
}
252252

253+
QString QgsGeometryOverlapCheckError::description() const
254+
{
255+
return QCoreApplication::translate( "QgsGeometryTypeCheckError", "Overlap with %1:%2" ).arg( mOverlappedFeature.first, QString::number( mOverlappedFeature.second ) );
256+
}
257+
253258
QgsGeometryCheck::CheckType QgsGeometryOverlapCheck::factoryCheckType()
254259
{
255260
return QgsGeometryCheck::LayerCheck;

src/analysis/vector/geometry_checker/qgsgeometryoverlapcheck.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ class ANALYSIS_EXPORT QgsGeometryOverlapCheckError : public QgsGeometryCheckErro
6363
return true;
6464
}
6565

66-
QString factoryDescription() const { return QApplication::translate( "QgsGeometryTypeCheckError", "Overlap with %1:%2" ).arg( mOverlappedFeature.first ).arg( mOverlappedFeature.second ); }
67-
QString description() const override { return factoryDescription(); }
66+
QString description() const override;
6867

6968
private:
7069
QPair<QString, QgsFeatureId> mOverlappedFeature;

src/analysis/vector/geometry_checker/qgsgeometrypointcoveredbylinecheck.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ class ANALYSIS_EXPORT QgsGeometryPointCoveredByLineCheck : public QgsGeometryChe
3232
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
3333
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
3434
QStringList resolutionMethods() const override;
35-
QString factoryDescription() const { return tr( "Point not covered by line" ); }
35+
static QString factoryDescription() { return tr( "Point not covered by line" ); }
3636
QString description() const override { return factoryDescription(); }
37-
QString factoryId() const { return QStringLiteral( "QgsGeometryPointCoveredByLineCheck" ); }
37+
static QString factoryId() { return QStringLiteral( "QgsGeometryPointCoveredByLineCheck" ); }
3838
QString id() const override { return factoryId(); }
39+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
3940
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
4041

4142
enum ResolutionMethod { NoChange };

src/analysis/vector/geometry_checker/qgsgeometrypointinpolygoncheck.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ class ANALYSIS_EXPORT QgsGeometryPointInPolygonCheck : public QgsGeometryCheck
3232
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
3333
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
3434
QStringList resolutionMethods() const override;
35-
QString factoryDescription() const { return tr( "Point not in polygon" ); }
35+
static QString factoryDescription() { return tr( "Point not in polygon" ); }
3636
QString description() const override { return factoryDescription(); }
37-
QString factoryId() const { return QStringLiteral( "QgsGeometryPointInPolygonCheck" ); }
37+
static QString factoryId() { return QStringLiteral( "QgsGeometryPointInPolygonCheck" ); }
3838
QString id() const override { return factoryId(); }
39+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
3940
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
4041

4142
enum ResolutionMethod { NoChange };

src/analysis/vector/geometry_checker/qgsgeometrysegmentlengthcheck.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ class ANALYSIS_EXPORT QgsGeometrySegmentLengthCheck : public QgsGeometryCheck
3333
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
3434
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
3535
QStringList resolutionMethods() const override;
36-
QString factoryDescription() const { return tr( "Minimal segment length" ); }
36+
static QString factoryDescription() { return tr( "Minimal segment length" ); }
3737
QString description() const override { return factoryDescription(); }
38-
QString factoryId() const { return QStringLiteral( "QgsGeometrySegmentLengthCheck" ); }
38+
static QString factoryId() { return QStringLiteral( "QgsGeometrySegmentLengthCheck" ); }
3939
QString id() const override { return factoryId(); }
40+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
4041
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
4142

4243
enum ResolutionMethod { NoChange };

src/analysis/vector/geometry_checker/qgsgeometryselfcontactcheck.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ class ANALYSIS_EXPORT QgsGeometrySelfContactCheck : public QgsSingleGeometryChec
3131
QList<QgsSingleGeometryCheckError *> processGeometry( const QgsGeometry &geometry ) const override;
3232
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes & ) const override;
3333
QStringList resolutionMethods() const override;
34-
QString factoryDescription() const { return tr( "Self contact" ); }
34+
static QString factoryDescription() { return tr( "Self contact" ); }
3535
QString description() const override { return factoryDescription(); }
36-
QString factoryId() const { return QStringLiteral( "QgsGeometrySelfContactCheck" ); }
36+
static QString factoryId() { return QStringLiteral( "QgsGeometrySelfContactCheck" ); }
3737
QString id() const override { return factoryId(); }
38+
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
3839
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
3940

4041
enum ResolutionMethod { NoChange };

0 commit comments

Comments
 (0)