QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsgeometrycheckfactory.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgeometrycheckfactory.h
3 --------------------------------------
4 Date : September 2018
5 Copyright : (C) 2018 Matthias Kuhn
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#ifndef QGSGEOMETRYCHECKFACTORY_H
17#define QGSGEOMETRYCHECKFACTORY_H
18
19#include <QString>
20#include <QMap>
21#include <QVariantMap>
22
23#include "qgsgeometrycheck.h"
24#include "qgis_sip.h"
25#include "qgis_analysis.h"
26
29
32
34
44{
45 public:
51 virtual ~QgsGeometryCheckFactory() = default;
52
56 virtual QgsGeometryCheck *createGeometryCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration ) const = 0 SIP_FACTORY;
57
61 virtual QString id() const = 0;
62
66 virtual QString description() const = 0;
67
71 virtual bool isCompatible( QgsVectorLayer *layer ) const = 0;
72
76 virtual QgsGeometryCheck::Flags flags() const = 0;
77
82};
83
90template<class T>
92{
93 public:
94 QgsGeometryCheck *createGeometryCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration ) const override
95 {
96 return new T( context, configuration );
97 }
98
99 QString description() const override
100 {
101 return T::factoryDescription();
102 }
103
104 QString id() const override
105 {
106 return T::factoryId();
107 }
108
109 bool isCompatible( QgsVectorLayer *layer ) const override
110 {
111 return T::factoryIsCompatible( layer );
112 }
113
115 {
116 return T::factoryFlags();
117 }
118
120 {
121 return T::factoryCheckType();
122 }
123};
124
125
126#endif // QGSGEOMETRYCHECKFACTORY_H
Base configuration for geometry checks.
Template to create a factory for a geometry check.
QString id() const override
The unique id for this geometry check.
QgsGeometryCheck * createGeometryCheck(const QgsGeometryCheckContext *context, const QVariantMap &configuration) const override
Creates a new geometry check with context and configuration.
QString description() const override
A human readable description for this check.
QgsGeometryCheck::CheckType checkType() const override
The type of this check.
QgsGeometryCheck::Flags flags() const override
Flags for this check.
bool isCompatible(QgsVectorLayer *layer) const override
Checks if this check should be made available for layer.
A factory for geometry checks.
virtual bool isCompatible(QgsVectorLayer *layer) const =0
Checks if this check should be made available for layer.
virtual QgsGeometryCheck::CheckType checkType() const =0
The type of this check.
virtual QString id() const =0
The unique id for this geometry check.
virtual QgsGeometryCheck * createGeometryCheck(const QgsGeometryCheckContext *context, const QVariantMap &configuration) const =0
Creates a new geometry check with context and configuration.
virtual QgsGeometryCheck::Flags flags() const =0
Flags for this check.
virtual ~QgsGeometryCheckFactory()=default
Destructor.
virtual QString description() const =0
A human readable description for this check.
This class implements a geometry check.
QFlags< Flag > Flags
CheckType
The type of a check.
Base class for geometry checks for a single geometry without any context of the layer or other layers...
Represents a vector layer which manages a vector based data sets.
#define SIP_ABSTRACT
Definition qgis_sip.h:213
#define SIP_FACTORY
Definition qgis_sip.h:76