Skip to content

Commit

Permalink
More doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Dec 22, 2018
1 parent c8be505 commit 525a3da
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ A feature pool is based on a vector layer and caches features.
#include "qgsfeaturepool.h"
%End
public:

QgsFeaturePool( QgsVectorLayer *layer );
%Docstring
Creates a new feature pool for ``layer``.
%End
virtual ~QgsFeaturePool();

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

QgsVectorLayer *layer() const;
%Docstring
Get a pointer to the underlying layer.
Gets a pointer to the underlying layer.
May return a ``None`` if the layer has been deleted.
This must only be called from the main thread.
%End
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ Returns the geometry of this feature.
If useMapCrs was specified, it will already be reprojected into the
CRS specified in the context specified in the constructor.
%End

QString id() const;
%Docstring
Returns a combination of the layerId and the feature id.
%End
bool operator==( const QgsGeometryCheckerUtils::LayerFeature &other ) const;
bool operator!=( const QgsGeometryCheckerUtils::LayerFeature &other ) const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ A factory for geometry checks.

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

virtual QString id() const = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ Ownership is transferred to the caller.

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

.. versionadded:: 3.4
%End

void registerGeometryCheck( QgsGeometryCheckFactory *checkFactory /Transfer/ );
%Docstring
Register a new geometry check factory.
Registers a new geometry check factory.

.. versionadded:: 3.4
%End
Expand Down
16 changes: 10 additions & 6 deletions src/analysis/vector/geometry_checker/qgsfeaturepool.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,23 @@ class ANALYSIS_EXPORT QgsFeaturePool : public QgsFeatureSink SIP_ABSTRACT
{

public:

/**
* Creates a new feature pool for \a layer.
*/
QgsFeaturePool( QgsVectorLayer *layer );
virtual ~QgsFeaturePool() = default;

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

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

/**
* Get all feature ids in the bounding box \a rect. It will use a spatial index to
* Gets all feature ids in the bounding box \a rect. It will use a spatial index to
* determine the ids.
*
* \note not available in Python bindings
*/
QgsFeatureIds getIntersects( const QgsRectangle &rect ) const SIP_SKIP;

/**
* Get a pointer to the underlying layer.
* Gets a pointer to the underlying layer.
* May return a ``nullptr`` if the layer has been deleted.
* This must only be called from the main thread.
*/
QgsVectorLayer *layer() const;

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

/**
* Set all the feature ids governed by this feature pool.
* Sets all the feature ids governed by this feature pool.
* Should be called by subclasses constructor and whenever
* they insert a new feature.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ class ANALYSIS_EXPORT QgsGeometryCheckerUtils
* CRS specified in the context specified in the constructor.
*/
const QgsGeometry &geometry() const;

/**
* Returns a combination of the layerId and the feature id.
*/
QString id() const;
bool operator==( const QgsGeometryCheckerUtils::LayerFeature &other ) const;
bool operator!=( const QgsGeometryCheckerUtils::LayerFeature &other ) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ANALYSIS_EXPORT QgsGeometryCheckFactory SIP_ABSTRACT
virtual ~QgsGeometryCheckFactory() = default;

/**
* Create a new geometry check with \a context and \a configuration.
* Creates a new geometry check with \a context and \a configuration.
*/
virtual QgsGeometryCheck *createGeometryCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration ) const = 0 SIP_FACTORY;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ class ANALYSIS_EXPORT QgsGeometryCheckRegistry
QgsGeometryCheck *geometryCheck( const QString &checkId, QgsGeometryCheckContext *context, const QVariantMap &geometryCheckConfig ) SIP_FACTORY;

/**
* Get all geometry check factories that are compatible with \a layer and have all of the \a flags set.
* Returns all geometry check factories that are compatible with \a layer and have all of the \a flags set.
*
* \since QGIS 3.4
*/
QList<QgsGeometryCheckFactory *> geometryCheckFactories( QgsVectorLayer *layer, QgsGeometryCheck::CheckType type, QgsGeometryCheck::Flags flags = nullptr ) const;

/**
* Register a new geometry check factory.
* Registers a new geometry check factory.
*
* \since QGIS 3.4
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,20 @@ class ANALYSIS_EXPORT QgsGeometryMissingVertexCheck : public QgsGeometryCheck
Q_GADGET

public:

/**
* The available resolutions for missing vertex check.
*/
enum ResolutionMethod
{
NoChange,
AddMissingVertex
NoChange, //!< Do nothing
AddMissingVertex //! Add the missing vertex
};
Q_ENUM( ResolutionMethod )

/**
* Creates a new missing vertex geometry check with \a context and the provided \a geometryCheckConfiguration.
*/
explicit QgsGeometryMissingVertexCheck( const QgsGeometryCheckContext *context, const QVariantMap &geometryCheckConfiguration );
void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback, const LayerFeatureIds &ids = LayerFeatureIds() ) const override;
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ email : matthias@opengis.ch
class ANALYSIS_EXPORT QgsVectorDataProviderFeaturePool : public QgsFeaturePool
{
public:

/**
* Creates a new feature pool for the data provider of \a layer.
* If \a selectedOnly is set to true, only selected features will be managed by the pool.
*/
QgsVectorDataProviderFeaturePool( QgsVectorLayer *layer, bool selectedOnly = false );

bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = nullptr ) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class ANALYSIS_EXPORT QgsVectorLayerFeaturePool : public QObject, public QgsFeat
Q_OBJECT

public:

/**
* Creates a new feature pool for \a layer.
*/
QgsVectorLayerFeaturePool( QgsVectorLayer *layer );

bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = nullptr ) override;
Expand Down
2 changes: 1 addition & 1 deletion tests/code_layout/acceptable_missing_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@
"QgsGeometryChecker": [],
"QgsGeometryFollowBoundariesCheck": ["factoryDescription()", "factoryId()", "factoryCompatibleGeometryTypes()", "factoryIsCompatible(QgsVectorLayer *layer)", "ResolutionMethod", "factoryCheckType()", "QgsGeometryFollowBoundariesCheck(QgsGeometryCheckContext *context, const QVariantMap &configuration, QgsVectorLayer *checkLayer)"],
"QgsGeometryMultipartCheck": ["factoryDescription()", "factoryId()", "factoryCompatibleGeometryTypes()", "factoryIsCompatible(QgsVectorLayer *layer)", "ResolutionMethod", "factoryCheckType()", "QgsGeometryMultipartCheck(QgsGeometryCheckContext *context, const QVariantMap &configuration)"],
"QgsGeometrySelfIntersectionCheckError": [],
"QgsGeometrySelfIntersectionCheckError": ["QgsGeometrySelfIntersectionCheckError(const QgsSingleGeometryCheck *check, const QgsGeometry &geometry, const QgsGeometry &errorLocation, QgsVertexId vertexId, const QgsGeometryUtils::SelfIntersection &intersection)", "intersection() const"],
"QgsGeometryGapCheckError": ["QgsGeometrySelfIntersectionCheckError(const QgsSingleGeometryCheck *check, const QgsGeometry &geometry, const QgsGeometry &errorLocation, QgsVertexId vertexId, const QgsGeometryUtils::SelfIntersection &intersection)", "intersection() const"],
"QgsGeometryPointCoveredByLineCheck": ["factoryDescription()", "factoryId()", "factoryCompatibleGeometryTypes()", "factoryIsCompatible(QgsVectorLayer *layer)", "ResolutionMethod", "factoryCheckType()", "QgsGeometryPointCoveredByLineCheck(QgsGeometryCheckContext *context, const QVariantMap &configuration)"],
"QgsGeometrySelfIntersectionCheck": ["QgsGeometrySelfIntersectionCheck(const QgsGeometryCheckContext *context, const QVariantMap &configuration=QVariantMap())", "ResolutionMethod"],
Expand Down

0 comments on commit 525a3da

Please sign in to comment.