QGIS API Documentation 3.99.0-Master (c03dd32cbdd)
Loading...
Searching...
No Matches
qgsgeometrytypecheck.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgeometrytypecheck.h
3 ---------------------
4 begin : September 2015
5 copyright : (C) 2014 by Sandro Mani / Sourcepole AG
6 email : smani at sourcepole dot ch
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16
17#ifndef QGS_GEOMETRY_TYPE_CHECK_H
18#define QGS_GEOMETRY_TYPE_CHECK_H
19
21
22#define SIP_NO_FILE
23
29{
30 public:
40 , mFlatType( flatType )
41 {
42 }
43
44 bool isEqual( const QgsSingleGeometryCheckError *other ) const override;
45
46 QString description() const override;
47
48 private:
49 Qgis::WkbType mFlatType;
50};
51
56class ANALYSIS_EXPORT QgsGeometryTypeCheck : public QgsSingleGeometryCheck
57{
58 Q_DECLARE_TR_FUNCTIONS( QgsGeometryTypeCheck )
59 public:
60 QgsGeometryTypeCheck( QgsGeometryCheckContext *context, const QVariantMap &configuration, int allowedTypes )
61 : QgsSingleGeometryCheck( context, configuration )
62 , mAllowedTypes( allowedTypes )
63 {}
64 QList<Qgis::GeometryType> compatibleGeometryTypes() const override { return factoryCompatibleGeometryTypes(); }
65 QList<QgsSingleGeometryCheckError *> processGeometry( const QgsGeometry &geometry ) const override;
66 void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
67 Q_DECL_DEPRECATED QStringList resolutionMethods() const override;
68 QString description() const override;
69 QString id() const override;
70 QgsGeometryCheck::CheckType checkType() const override;
71
73 static bool factoryIsCompatible( QgsVectorLayer *layer ) SIP_SKIP { return factoryCompatibleGeometryTypes().contains( layer->geometryType() ); }
74 static QString factoryDescription() SIP_SKIP;
75 static QString factoryId() SIP_SKIP;
76 static QgsGeometryCheck::CheckType factoryCheckType() SIP_SKIP;
77
78 private:
79 enum ResolutionMethod
80 {
81 Convert,
82 Delete,
83 NoChange
84 };
85 int mAllowedTypes;
86};
87
88#endif // QGS_GEOMETRY_TYPE_CHECK_H
@ Point
Points.
Definition qgis.h:377
@ Line
Lines.
Definition qgis.h:378
@ Polygon
Polygons.
Definition qgis.h:379
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:291
Base configuration for geometry checks.
This represents an error reported by a geometry check.
Base class for geometry checks.
CheckType
The type of a check.
const QgsGeometryCheckContext * context() const
Returns the context.
QgsGeometryTypeCheckError(const QgsSingleGeometryCheck *check, const QgsGeometry &geometry, const QgsGeometry &errorLocation, Qgis::WkbType flatType)
Constructor for QgsGeometryTypeCheckError.
QList< Qgis::GeometryType > compatibleGeometryTypes() const override
A list of geometry types for which this check can be performed.
static QList< Qgis::GeometryType > factoryCompatibleGeometryTypes()
QgsGeometryTypeCheck(QgsGeometryCheckContext *context, const QVariantMap &configuration, int allowedTypes)
static bool factoryIsCompatible(QgsVectorLayer *layer)
A geometry is the spatial representation of a feature.
An error from a QgsSingleGeometryCheck.
QgsGeometry errorLocation() const
The exact location of the error.
virtual bool isEqual(const QgsSingleGeometryCheckError *other) const
Check if this error is equal to other.
virtual QString description() const
A human readable description of this error.
QgsSingleGeometryCheckError(const QgsSingleGeometryCheck *check, const QgsGeometry &geometry, const QgsGeometry &errorLocation, const QgsVertexId &vertexId=QgsVertexId())
Creates a new single geometry check error.
const QgsSingleGeometryCheck * check() const
The check that created this error.
Base class for geometry checks for a single geometry without any context of the layer or other layers...
QgsSingleGeometryCheck(const QgsGeometryCheckContext *context, const QVariantMap &configuration)
Creates a new single geometry check.
Represents a vector layer which manages a vector based dataset.
#define SIP_SKIP
Definition qgis_sip.h:133