mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-26 00:08:20 -04:00
65 lines
3.0 KiB
C++
65 lines
3.0 KiB
C++
/***************************************************************************
|
|
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<QgsGeometryContainedCheckError *>( 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<QString, QgsFeaturePool *> &featurePools )
|
|
: QgsGeometryCheck( FeatureCheck, {QgsWkbTypes::PolygonGeometry}, featurePools ) {}
|
|
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;
|
|
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
|