Skip to content

Commit 309920a

Browse files
authored
Merge pull request #8733 from m-kuhn/geometry_check_api_docs
Add geometry check to API documentation
2 parents d2b3575 + 4b72941 commit 309920a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+655
-49
lines changed

doc/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ IF(WITH_APIDOC)
9696
${CMAKE_SOURCE_DIR}/src/analysis/processing
9797
${CMAKE_SOURCE_DIR}/src/analysis/raster
9898
${CMAKE_SOURCE_DIR}/src/analysis/vector
99+
${CMAKE_SOURCE_DIR}/src/analysis/vector/geometry_checker
99100
${CMAKE_SOURCE_DIR}/src/3d
100101
${CMAKE_SOURCE_DIR}/src/3d/chunks
101102
${CMAKE_SOURCE_DIR}/src/3d/symbols

python/analysis/auto_generated/vector/geometry_checker/qgsfeaturepool.sip.in

+6-2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@ A feature pool is based on a vector layer and caches features.
2727
#include "qgsfeaturepool.h"
2828
%End
2929
public:
30+
3031
QgsFeaturePool( QgsVectorLayer *layer );
32+
%Docstring
33+
Creates a new feature pool for ``layer``.
34+
%End
3135
virtual ~QgsFeaturePool();
3236

3337
bool getFeature( QgsFeatureId id, QgsFeature &feature, QgsFeedback *feedback = 0 );
3438
%Docstring
35-
Retrieve the feature with the specified ``id`` into ``feature``.
39+
Retrieves the feature with the specified ``id`` into ``feature``.
3640
It will be retrieved from the cache or from the underlying layer if unavailable.
3741
If the feature is neither available from the cache nor from the layer it will return false.
3842
If ``feedback`` is specified, the call may return if the feedback is canceled.
@@ -55,7 +59,7 @@ Implementations will remove the feature from the layer or from the data provider
5559

5660
QgsVectorLayer *layer() const;
5761
%Docstring
58-
Get a pointer to the underlying layer.
62+
Gets a pointer to the underlying layer.
5963
May return a ``None`` if the layer has been deleted.
6064
This must only be called from the main thread.
6165
%End

python/analysis/auto_generated/vector/geometry_checker/qgsgeometrycheck.sip.in

+4
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ Returns the context
164164
protected:
165165

166166

167+
168+
169+
170+
167171
};
168172

169173
/************************************************************************

python/analysis/auto_generated/vector/geometry_checker/qgsgeometrycheckerror.sip.in

+98-3
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,120 @@ This represents an error reported by a geometry check.
2727
#include "qgsgeometrycheckerror.h"
2828
%End
2929
public:
30-
enum Status { StatusPending, StatusFixFailed, StatusFixed, StatusObsolete };
31-
enum ValueType { ValueLength, ValueArea, ValueOther };
30+
31+
enum Status
32+
{
33+
StatusPending,
34+
StatusFixFailed,
35+
StatusFixed,
36+
StatusObsolete
37+
};
38+
39+
enum ValueType
40+
{
41+
ValueLength,
42+
ValueArea,
43+
ValueOther
44+
};
3245

3346
QgsGeometryCheckError( const QgsGeometryCheck *check,
3447
const QgsGeometryCheckerUtils::LayerFeature &layerFeature,
3548
const QgsPointXY &errorLocation,
3649
QgsVertexId vidx = QgsVertexId(),
3750
const QVariant &value = QVariant(),
3851
ValueType valueType = ValueOther );
52+
%Docstring
53+
Create a new geometry check error with the parent ``check`` and for the
54+
``layerFeature`` pair at the ``errorLocation``. Optionally the vertex can be
55+
specified via ``vixd`` and a ``value`` with its ``value`` Type for
56+
additional information.
57+
%End
3958

4059
virtual ~QgsGeometryCheckError();
4160

4261

4362
const QgsGeometryCheck *check() const;
63+
%Docstring
64+
The geometry check that created this error.
65+
%End
66+
4467
const QString &layerId() const;
68+
%Docstring
69+
The id of the layer on which this error has been detected.
70+
%End
71+
4572
QgsFeatureId featureId() const;
73+
%Docstring
74+
The id of the feature on which this error has been detected.
75+
%End
76+
4677
QgsGeometry geometry() const;
78+
%Docstring
79+
The geometry of the error in map units.
80+
%End
81+
4782
virtual QgsRectangle affectedAreaBBox() const;
83+
%Docstring
84+
The bounding box of the affected area of the error.
85+
%End
86+
4887
virtual QString description() const;
88+
%Docstring
89+
The error description. By default the description of the parent check
90+
will be returned.
91+
%End
92+
4993
const QgsPointXY &location() const;
94+
%Docstring
95+
The location of the error in map units.
96+
%End
97+
5098
QVariant value() const;
99+
%Docstring
100+
An additional value for the error.
101+
Lengths and areas are provided in map units.
102+
103+
.. seealso:: :py:func:`valueType`
104+
%End
105+
51106
ValueType valueType() const;
107+
%Docstring
108+
The type of the value.
109+
110+
.. seealso:: :py:func:`value`
111+
%End
112+
52113
const QgsVertexId &vidx() const;
114+
%Docstring
115+
The id of the affected vertex. May be valid or not, depending on the
116+
check.
117+
%End
118+
53119
Status status() const;
120+
%Docstring
121+
The status of the error.
122+
%End
123+
54124
QString resolutionMessage() const;
125+
%Docstring
126+
A message with details, how the error has been resolved.
127+
%End
128+
55129
void setFixed( int method );
130+
%Docstring
131+
Set the status to fixed and specify the ``method`` that has been used to
132+
fix the error.
133+
%End
134+
56135
void setFixFailed( const QString &reason );
136+
%Docstring
137+
Set the error status to failed and specify the ``reason`` for failure.
138+
%End
139+
57140
void setObsolete();
141+
%Docstring
142+
Set the error status to obsolete.
143+
%End
58144

59145
virtual bool isEqual( QgsGeometryCheckError *other ) const;
60146
%Docstring
@@ -71,12 +157,13 @@ If this returns true, it can be used to update existing errors after re-checking
71157

72158
virtual void update( const QgsGeometryCheckError *other );
73159
%Docstring
74-
Update this error with the information from \other.
160+
Update this error with the information from ``other``.
75161
Will be used to update existing errors whenever they are re-checked.
76162
%End
77163

78164

79165
protected:
166+
80167
QgsGeometryCheckError( const QgsGeometryCheck *check,
81168
const QString &layerId,
82169
QgsFeatureId featureId,
@@ -85,6 +172,14 @@ Will be used to update existing errors whenever they are re-checked.
85172
QgsVertexId vidx = QgsVertexId(),
86173
const QVariant &value = QVariant(),
87174
ValueType valueType = ValueOther );
175+
%Docstring
176+
Create a new geometry check error with the parent ``check`` and for the
177+
layer with ``layerId`` and ``featureId``.
178+
The ``geometry`` of the error and the ``errorLocation`` need to be
179+
specified in map coordinates.
180+
Optionally the vertex can be specified via ``vixd`` and a ``value`` with
181+
its ``value`` Type for additional information.
182+
%End
88183

89184

90185
};

python/analysis/auto_generated/vector/geometry_checker/qgsgeometrycheckerutils.sip.in

+18-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111

1212

13-
1413
class QgsGeometryCheckerUtils
1514
{
1615
%Docstring
@@ -28,8 +27,16 @@ Contains utilities required for geometry checks.
2827
#include "qgsgeometrycheckerutils.h"
2928
%End
3029
public:
30+
3131
class LayerFeature
3232
{
33+
%Docstring
34+
35+
A layer feature combination to uniquely identify and access a feature in
36+
a set of layers.
37+
38+
.. versionadded:: 3.4
39+
%End
3340

3441
%TypeHeaderCode
3542
#include "qgsgeometrycheckerutils.h"
@@ -62,7 +69,11 @@ Returns the geometry of this feature.
6269
If useMapCrs was specified, it will already be reprojected into the
6370
CRS specified in the context specified in the constructor.
6471
%End
72+
6573
QString id() const;
74+
%Docstring
75+
Returns a combination of the layerId and the feature id.
76+
%End
6677
bool operator==( const QgsGeometryCheckerUtils::LayerFeature &other ) const;
6778
bool operator!=( const QgsGeometryCheckerUtils::LayerFeature &other ) const;
6879

@@ -75,6 +86,12 @@ Returns if the geometry is reprojected to the map CRS or not.
7586

7687
class LayerFeatures
7788
{
89+
%Docstring
90+
91+
Contains a set of layers and feature ids in those layers to pass to a geometry check.
92+
93+
.. versionadded:: 3.4
94+
%End
7895

7996
%TypeHeaderCode
8097
#include "qgsgeometrycheckerutils.h"

python/analysis/auto_generated/vector/geometry_checker/qgsgeometrycheckfactory.sip.in

+8-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ A factory for geometry checks.
3434

3535
virtual QgsGeometryCheck *createGeometryCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration ) const = 0 /Factory/;
3636
%Docstring
37-
Create a new geometry check with ``context`` and ``configuration``.
37+
Creates a new geometry check with ``context`` and ``configuration``.
3838
%End
3939

4040
virtual QString id() const = 0;
@@ -66,6 +66,13 @@ The type of this check.
6666
template<T>
6767
class QgsGeometryCheckFactoryT : QgsGeometryCheckFactory
6868
{
69+
%Docstring
70+
Template to create a factory for a geometry check.
71+
72+
.. note::
73+
74+
Not available in Python bindings.
75+
%End
6976

7077
%TypeHeaderCode
7178
#include "qgsgeometrycheckfactory.h"

python/analysis/auto_generated/vector/geometry_checker/qgsgeometrycheckregistry.sip.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ Ownership is transferred to the caller.
5050

5151
QList<QgsGeometryCheckFactory *> geometryCheckFactories( QgsVectorLayer *layer, QgsGeometryCheck::CheckType type, QgsGeometryCheck::Flags flags = 0 ) const;
5252
%Docstring
53-
Get all geometry check factories that are compatible with ``layer`` and have all of the ``flags`` set.
53+
Returns all geometry check factories that are compatible with ``layer`` and have all of the ``flags`` set.
5454

5555
.. versionadded:: 3.4
5656
%End
5757

5858
void registerGeometryCheck( QgsGeometryCheckFactory *checkFactory /Transfer/ );
5959
%Docstring
60-
Register a new geometry check factory.
60+
Registers a new geometry check factory.
6161

6262
.. versionadded:: 3.4
6363
%End

python/analysis/auto_generated/vector/geometry_checker/qgssinglegeometrycheck.sip.in

+13-1
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ An error from a QgsSingleGeometryCheck.
2828
#include "qgssinglegeometrycheck.h"
2929
%End
3030
public:
31+
3132
QgsSingleGeometryCheckError( const QgsSingleGeometryCheck *check, const QgsGeometry &geometry, const QgsGeometry &errorLocation, const QgsVertexId &vertexId = QgsVertexId() );
33+
%Docstring
34+
Creates a new single geometry check error.
35+
%End
3236

3337
virtual ~QgsSingleGeometryCheckError();
3438

3539
virtual void update( const QgsSingleGeometryCheckError *other );
3640
%Docstring
37-
Update this error with the information from \other.
41+
Update this error with the information from ``other``.
3842
Will be used to update existing errors whenever they are re-checked.
3943
%End
4044

@@ -93,7 +97,11 @@ The single error can be obtained via singleError.
9397
#include "qgssinglegeometrycheck.h"
9498
%End
9599
public:
100+
96101
QgsGeometryCheckErrorSingle( QgsSingleGeometryCheckError *singleError, const QgsGeometryCheckerUtils::LayerFeature &layerFeature );
102+
%Docstring
103+
Creates a new error for a :py:class:`QgsSingleGeometryCheck`.
104+
%End
97105

98106
QgsSingleGeometryCheckError *singleError() const;
99107
%Docstring
@@ -119,8 +127,12 @@ Subclasses need to implement the processGeometry method.
119127
#include "qgssinglegeometrycheck.h"
120128
%End
121129
public:
130+
122131
QgsSingleGeometryCheck( const QgsGeometryCheckContext *context,
123132
const QVariantMap &configuration );
133+
%Docstring
134+
Creates a new single geometry check.
135+
%End
124136

125137
virtual void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools,
126138
QList<QgsGeometryCheckError *> &errors,

src/analysis/vector/geometry_checker/qgsfeaturepool.h

+10-6
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,23 @@ class ANALYSIS_EXPORT QgsFeaturePool : public QgsFeatureSink SIP_ABSTRACT
3939
{
4040

4141
public:
42+
43+
/**
44+
* Creates a new feature pool for \a layer.
45+
*/
4246
QgsFeaturePool( QgsVectorLayer *layer );
4347
virtual ~QgsFeaturePool() = default;
4448

4549
/**
46-
* Retrieve the feature with the specified \a id into \a feature.
50+
* Retrieves the feature with the specified \a id into \a feature.
4751
* It will be retrieved from the cache or from the underlying layer if unavailable.
4852
* If the feature is neither available from the cache nor from the layer it will return false.
4953
* If \a feedback is specified, the call may return if the feedback is canceled.
5054
*/
5155
bool getFeature( QgsFeatureId id, QgsFeature &feature, QgsFeedback *feedback = nullptr );
5256

5357
/**
54-
* Get features for the provided \a request. No features will be fetched
58+
* Gets features for the provided \a request. No features will be fetched
5559
* from the cache and the request is sent directly to the underlying feature source.
5660
* Results of the request are cached in the pool and the ids of all the features
5761
* are returned. This can be used to warm the cache for a particular area of interest
@@ -81,22 +85,22 @@ class ANALYSIS_EXPORT QgsFeaturePool : public QgsFeatureSink SIP_ABSTRACT
8185
QgsFeatureIds allFeatureIds() const SIP_SKIP;
8286

8387
/**
84-
* Get all feature ids in the bounding box \a rect. It will use a spatial index to
88+
* Gets all feature ids in the bounding box \a rect. It will use a spatial index to
8589
* determine the ids.
8690
*
8791
* \note not available in Python bindings
8892
*/
8993
QgsFeatureIds getIntersects( const QgsRectangle &rect ) const SIP_SKIP;
9094

9195
/**
92-
* Get a pointer to the underlying layer.
96+
* Gets a pointer to the underlying layer.
9397
* May return a ``nullptr`` if the layer has been deleted.
9498
* This must only be called from the main thread.
9599
*/
96100
QgsVectorLayer *layer() const;
97101

98102
/**
99-
* Get a QPointer to the underlying layer.
103+
* Gets a QPointer to the underlying layer.
100104
* Note that access to any methods of the object
101105
* will need to be done on the main thread and
102106
* the pointer will need to be checked for validity
@@ -142,7 +146,7 @@ class ANALYSIS_EXPORT QgsFeaturePool : public QgsFeatureSink SIP_ABSTRACT
142146
void removeFeature( const QgsFeatureId featureId );
143147

144148
/**
145-
* Set all the feature ids governed by this feature pool.
149+
* Sets all the feature ids governed by this feature pool.
146150
* Should be called by subclasses constructor and whenever
147151
* they insert a new feature.
148152
*

0 commit comments

Comments
 (0)