Skip to content

Commit

Permalink
Remove getPrefix from geometry checker methods
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 17, 2018
1 parent 805e7ec commit ed11552
Show file tree
Hide file tree
Showing 45 changed files with 60 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void QgsGeometryAngleCheck::fixError( QgsGeometryCheckError *error, int method,
}
}

QStringList QgsGeometryAngleCheck::getResolutionMethods() const
QStringList QgsGeometryAngleCheck::resolutionMethods() const
{
static QStringList methods = QStringList() << tr( "Delete node with small angle" ) << tr( "No action" );
return methods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ANALYSIS_EXPORT QgsGeometryAngleCheck : public QgsGeometryCheck
{}
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Minimal angle" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryAngleCheck" ); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ bool QgsGeometryAreaCheck::mergeWithNeighbor( const QString &layerId, QgsFeature
return true;
}

QStringList QgsGeometryAreaCheck::getResolutionMethods() const
QStringList QgsGeometryAreaCheck::resolutionMethods() const
{
static QStringList methods = QStringList()
<< tr( "Merge with neighboring polygon with longest shared edge" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ANALYSIS_EXPORT QgsGeometryAreaCheck : public QgsGeometryCheck
{}
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Minimal area" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryAreaCheck" ); }
enum ResolutionMethod { MergeLongestEdge, MergeLargestArea, MergeIdenticalAttribute, Delete, NoChange };
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/vector/geometry_checker/qgsgeometrycheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ bool QgsGeometryCheckError::handleChanges( const QgsGeometryCheck::Changes &chan
// If the check is checking the feature at geometry nodes level, the
// error almost certainly invalid after a geometry change. In the other
// cases, it might likely still be valid.
return mCheck->getCheckType() != QgsGeometryCheck::FeatureNodeCheck;
return mCheck->checkType() != QgsGeometryCheck::FeatureNodeCheck;
}
}
else if ( change.what == QgsGeometryCheck::ChangePart )
Expand Down
14 changes: 7 additions & 7 deletions src/analysis/vector/geometry_checker/qgsgeometrycheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct ANALYSIS_EXPORT QgsGeometryCheckerContext
const QMap<QString, QgsFeaturePool *> featurePools;
};

class ANALYSIS_EXPORT QgsGeometryCheck : public QObject
class ANALYSIS_EXPORT QgsGeometryCheck : QObject
{
Q_OBJECT

Expand Down Expand Up @@ -76,14 +76,14 @@ class ANALYSIS_EXPORT QgsGeometryCheck : public QObject
{}
virtual void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const = 0;
virtual void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const = 0;
virtual QStringList getResolutionMethods() const = 0;
virtual QStringList resolutionMethods() const = 0;
virtual QString errorDescription() const = 0;
virtual QString errorName() const = 0;
CheckType getCheckType() const { return mCheckType; }
bool getCompatibility( QgsWkbTypes::GeometryType type ) const { return mCompatibleGeometryTypes.contains( type ); }
QgsGeometryCheckerContext *getContext() const { return mContext; }
CheckType checkType() const { return mCheckType; }
bool isCompatible( QgsWkbTypes::GeometryType type ) const { return mCompatibleGeometryTypes.contains( type ); }
QgsGeometryCheckerContext *context() const { return mContext; }

protected:
private:
QMap<QString, QgsFeatureIds> allLayerFeatureIds() const;
void replaceFeatureGeometryPart( const QString &layerId, QgsFeature &feature, int partIdx, QgsAbstractGeometry *newPartGeom, Changes &changes ) const;
void deleteFeatureGeometryPart( const QString &layerId, QgsFeature &feature, int partIdx, Changes &changes ) const;
Expand Down Expand Up @@ -133,7 +133,7 @@ class ANALYSIS_EXPORT QgsGeometryCheckError
void setFixed( int method )
{
mStatus = StatusFixed;
const QStringList methods = mCheck->getResolutionMethods();
const QStringList methods = mCheck->resolutionMethods();
mResolutionMessage = methods[method];
}
void setFixFailed( const QString &reason )
Expand Down
12 changes: 6 additions & 6 deletions src/analysis/vector/geometry_checker/qgsgeometrychecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ QFuture<void> QgsGeometryChecker::execute( int *totalSteps )
{
for ( auto it = mContext->featurePools.constBegin(); it != mContext->featurePools.constEnd(); ++it )
{
if ( check->getCheckType() <= QgsGeometryCheck::FeatureCheck )
if ( check->checkType() <= QgsGeometryCheck::FeatureCheck )
{
*totalSteps += check->getCompatibility( it.value()->getLayer()->geometryType() ) ? it.value()->getFeatureIds().size() : 0;
*totalSteps += check->isCompatible( it.value()->getLayer()->geometryType() ) ? it.value()->getFeatureIds().size() : 0;
}
else
{
Expand Down Expand Up @@ -170,7 +170,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
// - Determine extent to recheck for gaps
for ( QgsGeometryCheckError *err : qgis::as_const( mCheckErrors ) )
{
if ( err->check()->getCheckType() == QgsGeometryCheck::LayerCheck )
if ( err->check()->checkType() == QgsGeometryCheck::LayerCheck )
{
if ( err->affectedAreaBBox().intersects( recheckArea ) )
{
Expand All @@ -191,7 +191,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
QList<QgsGeometryCheckError *> recheckErrors;
for ( const QgsGeometryCheck *check : qgis::as_const( mChecks ) )
{
if ( check->getCheckType() == QgsGeometryCheck::LayerCheck )
if ( check->checkType() == QgsGeometryCheck::LayerCheck )
{
if ( !recheckAreaFeatures.isEmpty() )
{
Expand Down Expand Up @@ -246,9 +246,9 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
// changes weren't handled
!handled ||
// or if it is a FeatureNodeCheck or FeatureCheck error whose feature was rechecked
( err->check()->getCheckType() <= QgsGeometryCheck::FeatureCheck && recheckFeatures[err->layerId()].contains( err->featureId() ) ) ||
( err->check()->checkType() <= QgsGeometryCheck::FeatureCheck && recheckFeatures[err->layerId()].contains( err->featureId() ) ) ||
// or if it is a LayerCheck error within the rechecked area
( err->check()->getCheckType() == QgsGeometryCheck::LayerCheck && recheckArea.contains( err->affectedAreaBBox() ) )
( err->check()->checkType() == QgsGeometryCheck::LayerCheck && recheckArea.contains( err->affectedAreaBBox() ) )
)
)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void QgsGeometryContainedCheck::fixError( QgsGeometryCheckError *error, int meth
}
}

QStringList QgsGeometryContainedCheck::getResolutionMethods() const
QStringList QgsGeometryContainedCheck::resolutionMethods() const
{
static QStringList methods = QStringList()
<< tr( "Delete feature" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ANALYSIS_EXPORT QgsGeometryContainedCheck : public QgsGeometryCheck
: QgsGeometryCheck( FeatureCheck, {QgsWkbTypes::PointGeometry, QgsWkbTypes::LineGeometry, QgsWkbTypes::PolygonGeometry}, context ) {}
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Within" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryContainedCheck" ); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void QgsGeometryDangleCheck::fixError( QgsGeometryCheckError *error, int method,
}
}

QStringList QgsGeometryDangleCheck::getResolutionMethods() const
QStringList QgsGeometryDangleCheck::resolutionMethods() const
{
static QStringList methods = QStringList() << tr( "No action" );
return methods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ANALYSIS_EXPORT QgsGeometryDangleCheck : public QgsGeometryCheck
{}
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Dangle" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryDangleCheck" ); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void QgsGeometryDegeneratePolygonCheck::fixError( QgsGeometryCheckError *error,
}
}

QStringList QgsGeometryDegeneratePolygonCheck::getResolutionMethods() const
QStringList QgsGeometryDegeneratePolygonCheck::resolutionMethods() const
{
static QStringList methods = QStringList() << tr( "Delete feature" ) << tr( "No action" );
return methods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ANALYSIS_EXPORT QgsGeometryDegeneratePolygonCheck : public QgsGeometryChec
: QgsGeometryCheck( FeatureNodeCheck, {QgsWkbTypes::PolygonGeometry}, context ) {}
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Polygon with less than three nodes" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryDegeneratePolygonCheck" ); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void QgsGeometryDuplicateCheck::fixError( QgsGeometryCheckError *error, int meth
}
}

QStringList QgsGeometryDuplicateCheck::getResolutionMethods() const
QStringList QgsGeometryDuplicateCheck::resolutionMethods() const
{
static QStringList methods = QStringList()
<< tr( "No action" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ANALYSIS_EXPORT QgsGeometryDuplicateCheckError : public QgsGeometryCheckEr
const QgsGeometryCheckerUtils::LayerFeature &layerFeature,
const QgsPointXY &errorLocation,
const QMap<QString, QList<QgsFeatureId>> &duplicates )
: QgsGeometryCheckError( check, layerFeature, errorLocation, QgsVertexId(), duplicatesString( check->getContext()->featurePools, duplicates ) )
: QgsGeometryCheckError( check, layerFeature, errorLocation, QgsVertexId(), duplicatesString( check->context()->featurePools, duplicates ) )
, mDuplicates( duplicates )
{ }
QMap<QString, QList<QgsFeatureId>> duplicates() const { return mDuplicates; }
Expand Down Expand Up @@ -56,7 +56,7 @@ class ANALYSIS_EXPORT QgsGeometryDuplicateCheck : public QgsGeometryCheck
: QgsGeometryCheck( FeatureCheck, {QgsWkbTypes::PointGeometry, QgsWkbTypes::LineGeometry, QgsWkbTypes::PolygonGeometry}, context ) {}
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Duplicate" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryDuplicateCheck" ); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void QgsGeometryDuplicateNodesCheck::fixError( QgsGeometryCheckError *error, int
}
}

QStringList QgsGeometryDuplicateNodesCheck::getResolutionMethods() const
QStringList QgsGeometryDuplicateNodesCheck::resolutionMethods() const
{
static QStringList methods = QStringList() << tr( "Delete duplicate node" ) << tr( "No action" );
return methods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ANALYSIS_EXPORT QgsGeometryDuplicateNodesCheck : public QgsGeometryCheck
: QgsGeometryCheck( FeatureNodeCheck, {QgsWkbTypes::LineGeometry, QgsWkbTypes::PolygonGeometry}, context ) {}
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Duplicate node" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryDuplicateNodesCheck" ); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void QgsGeometryFollowBoundariesCheck::fixError( QgsGeometryCheckError *error, i
}
}

QStringList QgsGeometryFollowBoundariesCheck::getResolutionMethods() const
QStringList QgsGeometryFollowBoundariesCheck::resolutionMethods() const
{
static QStringList methods = QStringList() << tr( "No action" );
return methods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ANALYSIS_EXPORT QgsGeometryFollowBoundariesCheck : public QgsGeometryCheck
~QgsGeometryFollowBoundariesCheck() override;
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Polygon does not follow boundaries" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryFollowBoundariesCheck" ); }
private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ bool QgsGeometryGapCheck::mergeWithNeighbor( QgsGeometryGapCheckError *err, Chan
}


QStringList QgsGeometryGapCheck::getResolutionMethods() const
QStringList QgsGeometryGapCheck::resolutionMethods() const
{
static QStringList methods = QStringList() << tr( "Add gap area to neighboring polygon with longest shared edge" ) << tr( "No action" );
return methods;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ANALYSIS_EXPORT QgsGeometryGapCheckError : public QgsGeometryCheckError
bool isEqual( QgsGeometryCheckError *other ) const override
{
QgsGeometryGapCheckError *err = dynamic_cast<QgsGeometryGapCheckError *>( other );
return err && QgsGeometryCheckerUtils::pointsFuzzyEqual( err->location(), location(), mCheck->getContext()->reducedTolerance ) && err->neighbors() == neighbors();
return err && QgsGeometryCheckerUtils::pointsFuzzyEqual( err->location(), location(), mCheck->context()->reducedTolerance ) && err->neighbors() == neighbors();
}

bool closeMatch( QgsGeometryCheckError *other ) const override
Expand Down Expand Up @@ -83,7 +83,7 @@ class ANALYSIS_EXPORT QgsGeometryGapCheck : public QgsGeometryCheck
{}
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Gap" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryGapCheck" ); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void QgsGeometryHoleCheck::fixError( QgsGeometryCheckError *error, int method, c
}
}

QStringList QgsGeometryHoleCheck::getResolutionMethods() const
QStringList QgsGeometryHoleCheck::resolutionMethods() const
{
static QStringList methods = QStringList() << tr( "Remove hole" ) << tr( "No action" );
return methods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ANALYSIS_EXPORT QgsGeometryHoleCheck : public QgsGeometryCheck
: QgsGeometryCheck( FeatureCheck, {QgsWkbTypes::PolygonGeometry}, context ) {}
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Polygon with hole" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryHoleCheck" ); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void QgsGeometryLineIntersectionCheck::fixError( QgsGeometryCheckError *error, i
}
}

QStringList QgsGeometryLineIntersectionCheck::getResolutionMethods() const
QStringList QgsGeometryLineIntersectionCheck::resolutionMethods() const
{
static QStringList methods = QStringList() << tr( "No action" );
return methods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ANALYSIS_EXPORT QgsGeometryLineIntersectionCheck : public QgsGeometryCheck
{}
void collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &messages, QAtomicInt *progressCounter = nullptr, const QMap<QString, QgsFeatureIds> &ids = QMap<QString, QgsFeatureIds>() ) const override;
void fixError( QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
QStringList getResolutionMethods() const override;
QStringList resolutionMethods() const override;
QString errorDescription() const override { return tr( "Intersection" ); }
QString errorName() const override { return QStringLiteral( "QgsGeometryLineIntersectionCheck" ); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void QgsGeometryLineLayerIntersectionCheck::fixError( QgsGeometryCheckError *err
}
}

QStringList QgsGeometryLineLayerIntersectionCheck::getResolutionMethods() const
QStringList QgsGeometryLineLayerIntersectionCheck::resolutionMethods() const
{
static QStringList methods = QStringList() << tr( "No action" );
return methods;
Expand Down
Loading

0 comments on commit ed11552

Please sign in to comment.