Skip to content
Permalink
Browse files

Add checkType() method to all checks

  • Loading branch information
m-kuhn committed Sep 30, 2018
1 parent e63526f commit 6a5a602bf47bd83e4b0b9d5d6b174efa249a8ab8
Showing with 69 additions and 41 deletions.
  1. +2 −2 src/analysis/vector/geometry_checker/qgsgeometryareacheck.h
  2. +1 −1 src/analysis/vector/geometry_checker/qgsgeometrycontainedcheck.h
  3. +8 −5 src/analysis/vector/geometry_checker/qgsgeometrydanglecheck.h
  4. +9 −5 src/analysis/vector/geometry_checker/qgsgeometrydegeneratepolygoncheck.h
  5. +1 −0 src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.h
  6. +3 −2 src/analysis/vector/geometry_checker/qgsgeometryduplicatenodescheck.h
  7. +3 −2 src/analysis/vector/geometry_checker/qgsgeometryfollowboundariescheck.h
  8. +3 −2 src/analysis/vector/geometry_checker/qgsgeometryholecheck.h
  9. +3 −2 src/analysis/vector/geometry_checker/qgsgeometrylineintersectioncheck.h
  10. +3 −2 src/analysis/vector/geometry_checker/qgsgeometrylinelayerintersectioncheck.h
  11. +3 −2 src/analysis/vector/geometry_checker/qgsgeometrymultipartcheck.h
  12. +5 −0 src/analysis/vector/geometry_checker/qgsgeometryoverlapcheck.cpp
  13. +1 −2 src/analysis/vector/geometry_checker/qgsgeometryoverlapcheck.h
  14. +3 −2 src/analysis/vector/geometry_checker/qgsgeometrypointcoveredbylinecheck.h
  15. +3 −2 src/analysis/vector/geometry_checker/qgsgeometrypointinpolygoncheck.h
  16. +3 −2 src/analysis/vector/geometry_checker/qgsgeometrysegmentlengthcheck.h
  17. +3 −2 src/analysis/vector/geometry_checker/qgsgeometryselfcontactcheck.h
  18. +2 −2 src/analysis/vector/geometry_checker/qgsgeometrysliverpolygoncheck.h
  19. +7 −2 src/analysis/vector/geometry_checker/qgsgeometrytypecheck.cpp
  20. +3 −2 src/analysis/vector/geometry_checker/qgsgeometrytypecheck.h
@@ -40,9 +40,9 @@ class ANALYSIS_EXPORT QgsGeometryAreaCheck : public QgsGeometryCheck

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

private:
@@ -42,7 +42,7 @@ class ANALYSIS_EXPORT QgsGeometryContainedCheckError : public QgsGeometryCheckEr
static_cast<QgsGeometryContainedCheckError *>( other )->containingFeature() == containingFeature();
}

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

private:
@@ -26,16 +26,19 @@ class ANALYSIS_EXPORT QgsGeometryDangleCheck : public QgsGeometryCheck
QgsGeometryDangleCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration )
: QgsGeometryCheck( context, configuration )
{}
static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::LineGeometry}; }
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;

QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const override { return factoryCompatibleGeometryTypes(); }
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Dangle" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometryDangleCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }

static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::LineGeometry}; }
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
static QString factoryDescription() { return tr( "Dangle" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometryDangleCheck" ); }
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;

enum ResolutionMethod { NoChange };
@@ -27,16 +27,20 @@ class ANALYSIS_EXPORT QgsGeometryDegeneratePolygonCheck : public QgsGeometryChec

explicit QgsGeometryDegeneratePolygonCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration )
: QgsGeometryCheck( context, configuration ) {}
static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::PolygonGeometry}; }
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const override { return factoryCompatibleGeometryTypes(); }

void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;

QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const override { return factoryCompatibleGeometryTypes(); }
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Polygon with less than three nodes" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometryDegeneratePolygonCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }

static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::PolygonGeometry}; }
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
static QString factoryDescription() { return tr( "Polygon with less than three nodes" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometryDegeneratePolygonCheck" ); }
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;

private:
@@ -62,6 +62,7 @@ class ANALYSIS_EXPORT QgsGeometryDuplicateCheck : public QgsGeometryCheck
QStringList resolutionMethods() const override;
QString description() const override { return factoryDescription(); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }

static QList<QgsWkbTypes::GeometryType> factoryCompatibleGeometryTypes() {return {QgsWkbTypes::PointGeometry, QgsWkbTypes::LineGeometry, QgsWkbTypes::PolygonGeometry}; }
static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
@@ -31,10 +31,11 @@ class ANALYSIS_EXPORT QgsGeometryDuplicateNodesCheck : public QgsGeometryCheck
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Duplicate node" ); }
static QString factoryDescription() { return tr( "Duplicate node" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometryDuplicateNodesCheck" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometryDuplicateNodesCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;

enum ResolutionMethod { RemoveDuplicates, NoChange };
@@ -34,10 +34,11 @@ class ANALYSIS_EXPORT QgsGeometryFollowBoundariesCheck : public QgsGeometryCheck
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Polygon does not follow boundaries" ); }
static QString factoryDescription() { return tr( "Polygon does not follow boundaries" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometryFollowBoundariesCheck" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometryFollowBoundariesCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
private:
enum ResolutionMethod { NoChange };
@@ -31,10 +31,11 @@ class ANALYSIS_EXPORT QgsGeometryHoleCheck : public QgsGeometryCheck
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Polygon with hole" ); }
static QString factoryDescription() { return tr( "Polygon with hole" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometryHoleCheck" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometryHoleCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
static QgsGeometryCheck::CheckType factoryCheckType() { return QgsGeometryCheck::FeatureCheck; }

enum ResolutionMethod { RemoveHoles, NoChange };
@@ -32,10 +32,11 @@ class ANALYSIS_EXPORT QgsGeometryLineIntersectionCheck : public QgsGeometryCheck
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Intersection" ); }
static QString factoryDescription() { return tr( "Intersection" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometryLineIntersectionCheck" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometryLineIntersectionCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;

enum ResolutionMethod { NoChange };
@@ -33,10 +33,11 @@ class ANALYSIS_EXPORT QgsGeometryLineLayerIntersectionCheck : public QgsGeometry
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Intersection" ); }
static QString factoryDescription() { return tr( "Intersection" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometryLineLayerIntersectionCheck" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometryLineLayerIntersectionCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;

enum ResolutionMethod { NoChange };
@@ -32,10 +32,11 @@ class ANALYSIS_EXPORT QgsGeometryMultipartCheck : public QgsSingleGeometryCheck
QList<QgsSingleGeometryCheckError *> processGeometry( const QgsGeometry &geometry ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Multipart object with only one feature" ); }
static QString factoryDescription() { return tr( "Multipart object with only one feature" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometryMultipartCheck" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometryMultipartCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
static QgsGeometryCheck::CheckType factoryCheckType() { return QgsGeometryCheck::FeatureCheck; }

enum ResolutionMethod { ConvertToSingle, RemoveObject, NoChange };
@@ -250,6 +250,11 @@ QgsGeometryOverlapCheckError::QgsGeometryOverlapCheckError( const QgsGeometryChe

}

QString QgsGeometryOverlapCheckError::description() const
{
return QCoreApplication::translate( "QgsGeometryTypeCheckError", "Overlap with %1:%2" ).arg( mOverlappedFeature.first, QString::number( mOverlappedFeature.second ) );
}

QgsGeometryCheck::CheckType QgsGeometryOverlapCheck::factoryCheckType()
{
return QgsGeometryCheck::LayerCheck;
@@ -63,8 +63,7 @@ class ANALYSIS_EXPORT QgsGeometryOverlapCheckError : public QgsGeometryCheckErro
return true;
}

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

private:
QPair<QString, QgsFeatureId> mOverlappedFeature;
@@ -32,10 +32,11 @@ class ANALYSIS_EXPORT QgsGeometryPointCoveredByLineCheck : public QgsGeometryChe
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Point not covered by line" ); }
static QString factoryDescription() { return tr( "Point not covered by line" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometryPointCoveredByLineCheck" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometryPointCoveredByLineCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;

enum ResolutionMethod { NoChange };
@@ -32,10 +32,11 @@ class ANALYSIS_EXPORT QgsGeometryPointInPolygonCheck : public QgsGeometryCheck
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Point not in polygon" ); }
static QString factoryDescription() { return tr( "Point not in polygon" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometryPointInPolygonCheck" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometryPointInPolygonCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;

enum ResolutionMethod { NoChange };
@@ -33,10 +33,11 @@ class ANALYSIS_EXPORT QgsGeometrySegmentLengthCheck : public QgsGeometryCheck
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Minimal segment length" ); }
static QString factoryDescription() { return tr( "Minimal segment length" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometrySegmentLengthCheck" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometrySegmentLengthCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;

enum ResolutionMethod { NoChange };
@@ -31,10 +31,11 @@ class ANALYSIS_EXPORT QgsGeometrySelfContactCheck : public QgsSingleGeometryChec
QList<QgsSingleGeometryCheckError *> processGeometry( const QgsGeometry &geometry ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes & ) const override;
QStringList resolutionMethods() const override;
QString factoryDescription() const { return tr( "Self contact" ); }
static QString factoryDescription() { return tr( "Self contact" ); }
QString description() const override { return factoryDescription(); }
QString factoryId() const { return QStringLiteral( "QgsGeometrySelfContactCheck" ); }
static QString factoryId() { return QStringLiteral( "QgsGeometrySelfContactCheck" ); }
QString id() const override { return factoryId(); }
QgsGeometryCheck::CheckType checkType() const override { return factoryCheckType(); }
static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;

enum ResolutionMethod { NoChange };

0 comments on commit 6a5a602

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