27 QList<QgsSingleGeometryCheckError *> errors;
30 if ( ( mAllowedTypes & ( 1 <<
static_cast< quint32
>( type ) ) ) == 0 )
51 if ( ( mAllowedTypes & ( 1 <<
static_cast< quint32
>( type ) ) ) != 0 )
58 if ( method == NoChange )
62 else if ( method == Convert )
68 for (
int iPart = 1, nParts = geom->
partCount(); iPart < nParts; ++iPart )
115 if ( !geomCollection )
136 else if ( method == Delete )
150 static const QStringList methods = QStringList()
151 << tr(
"Convert to corresponding multi or single type if possible, otherwise delete feature" )
152 << tr(
"Delete feature" )
153 << tr(
"No action" );
159 return tr(
"Geometry type" );
169 return QStringLiteral(
"QgsGeometryTypeCheck" );
WkbType
The WKB type describes the number of dimensions a geometry has.
@ MultiPolygon
MultiPolygon.
@ MultiLineString
MultiLineString.
@ MultiSurface
MultiSurface.
Abstract base class for all geometries.
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
virtual int partCount() const =0
Returns count of parts contained in the geometry.
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
A feature pool is based on a vector layer and caches features.
virtual void updateFeature(QgsFeature &feature)=0
Updates a feature in this pool.
virtual void deleteFeature(QgsFeatureId fid)=0
Removes a feature from this pool.
bool getFeature(QgsFeatureId id, QgsFeature &feature)
Retrieves the feature with the specified id into feature.
virtual bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
Adds a single feature to the sink.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
This represents an error reported by a geometry check.
QgsFeatureId featureId() const
The id of the feature on which this error has been detected.
void setFixed(int method)
Set the status to fixed and specify the method that has been used to fix the error.
void setFixFailed(const QString &reason)
Set the error status to failed and specify the reason for failure.
void setObsolete()
Set the error status to obsolete.
const QString & layerId() const
The id of the layer on which this error has been detected.
QMap< QString, QMap< QgsFeatureId, QList< QgsGeometryCheck::Change > > > Changes
A collection of changes.
@ ChangeFeature
This change happens on feature level.
CheckType
The type of a check.
@ FeatureCheck
The check controls geometries as a whole.
@ ChangeChanged
Something has been updated.
@ ChangeAdded
Something has been added.
@ ChangeRemoved
Something has been removed.
virtual QString description() const =0
Returns a human readable description for this check.
static QgsAbstractGeometry * getGeomPart(QgsAbstractGeometry *geom, int partIdx)
virtual bool addGeometry(QgsAbstractGeometry *g)
Adds a geometry and takes ownership. Returns true in case of success.
A geometry type check error.
bool isEqual(const QgsSingleGeometryCheckError *other) const override
Check if this error is equal to other.
QString description() const override
A human readable description of this error.
Q_DECL_DEPRECATED QStringList resolutionMethods() const override
Returns a list of descriptions for available resolutions for errors.
QgsGeometryCheck::CheckType checkType() const override
Returns the check type.
static QString factoryId()
QString id() const override
Returns an id for this check.
void fixError(const QMap< QString, QgsFeaturePool * > &featurePools, QgsGeometryCheckError *error, int method, const QMap< QString, int > &mergeAttributeIndices, Changes &changes) const override
Fixes the error error with the specified method.
QList< QgsSingleGeometryCheckError * > processGeometry(const QgsGeometry &geometry) const override
Check the geometry for errors.
static QgsGeometryCheck::CheckType factoryCheckType()
QString description() const override
Returns a human readable description for this check.
static QString factoryDescription()
A geometry is the spatial representation of a feature.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Multi curve geometry collection.
Multi line string geometry collection.
Multi point geometry collection.
Multi polygon geometry collection.
Multi surface geometry collection.
An error from a QgsSingleGeometryCheck.
const QgsSingleGeometryCheck * mCheck
virtual bool isEqual(const QgsSingleGeometryCheckError *other) const
Check if this error is equal to other.
static bool isMultiType(Qgis::WkbType type)
Returns true if the WKB type is a multi type.
static QString displayString(Qgis::WkbType type)
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...
static Qgis::WkbType singleType(Qgis::WkbType type)
Returns the single type for a WKB type.
static Qgis::WkbType multiType(Qgis::WkbType type)
Returns the multi type for a WKB type.
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
static bool isSingleType(Qgis::WkbType type)
Returns true if the WKB type is a single type.
Descripts a change to fix a geometry.