Skip to content

Commit

Permalink
Doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Sep 28, 2018
1 parent bee5470 commit 903e943
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 13 deletions.
Expand Up @@ -79,9 +79,16 @@ the Free Software Foundation; either version 2 of the License, or *
struct Change
{
Change();

Change( ChangeWhat _what, ChangeType _type, QgsVertexId _vidx = QgsVertexId() );
%Docstring
Create a new Change
%End

ChangeWhat what;

ChangeType type;

QgsVertexId vidx;
bool operator==( const Change &other );
};
Expand All @@ -91,19 +98,77 @@ the Free Software Foundation; either version 2 of the License, or *
QgsGeometryCheck( CheckType checkType,
const QgsGeometryCheckContext *context,
const QVariantMap &configuration );
%Docstring
Create a new geometry check.
%End
virtual ~QgsGeometryCheck();


virtual bool isCompatible( QgsVectorLayer *layer ) const;
%Docstring
Returns if this geometry check is compatible with ``layer``.
By default it checks for the geometry type in ``compatibleGeometryTypes``().

.. versionadded:: 3.4
%End

virtual QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const = 0;
%Docstring
A list of geometry types for which this check can be performed.

.. versionadded:: 3.4
%End

virtual QgsGeometryCheck::Flags flags() const;
%Docstring
Flags for this geometry check.
%End

virtual void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors /In,Out/, QStringList &messages /In,Out/, QgsFeedback *feedback = 0, const LayerFeatureIds &ids = QgsGeometryCheck::LayerFeatureIds() ) const = 0;
%Docstring
The main worker method.
Check all features available from ``featurePools`` and write errors found to ``errors``.
Other status messages can be written to ``messages``.
Progress should be reported to ``feedback``. Only features and layers listed in ``ids`` should be checked.

.. versionadded:: 3.4
%End


virtual void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = 0, const LayerFeatureIds &ids = QgsGeometryCheck::LayerFeatureIds() ) const = 0;
virtual QStringList resolutionMethods() const = 0;
%Docstring
Returns a list of descriptions for available resolutions for errors. The index will be passed as ``method`` to :py:func:`fixError`.

.. versionadded:: 3.4
%End

virtual QString description() const = 0;
%Docstring
Returns a human readable description for this check.

.. versionadded:: 3.4
%End

virtual QString id() const = 0;
%Docstring
Returns an id for this check.

.. versionadded:: 3.4
%End

CheckType checkType() const;
%Docstring
Returns the check type.

.. versionadded:: 3.4
%End

const QgsGeometryCheckContext *context() const;
%Docstring
Returns the context

.. versionadded:: 3.4
%End

protected:

Expand Down
126 changes: 114 additions & 12 deletions src/analysis/vector/geometry_checker/qgsgeometrycheck.h
Expand Up @@ -67,26 +67,41 @@ class ANALYSIS_EXPORT QgsGeometryCheck
#endif
};

/**
* Description of a change to indicate at which level a change occured.
*
* \since Python bindings since QGIS 3.4
*/
enum ChangeWhat
{
ChangeFeature,
ChangePart,
ChangeRing,
ChangeNode
ChangeFeature, //!< This change happens on feature level
ChangePart, //!< This change happens on part level
ChangeRing, //!< This change happens on ring level
ChangeNode //!< This change happens on node level
};

/**
* Description of the type of a change.
*
* \since Python bindings since QGIS 3.4
*/
enum ChangeType
{
ChangeAdded,
ChangeRemoved,
ChangeChanged
ChangeAdded, //!< Something has been added
ChangeRemoved, //!< Something has been removed
ChangeChanged //!< Something has been updated
};

/**
* The type of a check.
*
* \since Python bindings since QGIS 3.4
*/
enum CheckType
{
FeatureNodeCheck,
FeatureCheck,
LayerCheck
FeatureNodeCheck, //!< The check controls individual nodes
FeatureCheck, //!< The check controls geometries as a whole
LayerCheck //!< The check controls a whole layer (topology checks)
};

enum Flag
Expand All @@ -98,25 +113,53 @@ class ANALYSIS_EXPORT QgsGeometryCheck
Q_DECLARE_FLAGS( Flags, Flag )
Q_FLAG( Flags )

/**
* Descripts a change to fix a geometry.
*
* \since Python bindings since QGIS 3.4
*/
struct Change
{
Change() = default;

/**
* Create a new Change
*/
Change( ChangeWhat _what, ChangeType _type, QgsVertexId _vidx = QgsVertexId() )
: what( _what )
, type( _type )
, vidx( _vidx )
{}

/**
* What level this change affects.
*/
ChangeWhat what;

/**
* What action this change performs.
*/
ChangeType type;

/**
* The index of the part / ring / vertex, depending on \see what.
*/
QgsVertexId vidx;
bool operator==( const Change &other )
{
return what == other.what && type == other.type && vidx == other.vidx;
}
};

/**
* A collection of changes.
* Grouped by layer id and feature id.
*/
typedef QMap<QString, QMap<QgsFeatureId, QList<Change> > > Changes;

/**
* Create a new geometry check.
*/
QgsGeometryCheck( CheckType checkType,
const QgsGeometryCheckContext *context,
const QVariantMap &configuration )
Expand All @@ -134,17 +177,76 @@ class ANALYSIS_EXPORT QgsGeometryCheck
}
#endif

/**
* Returns if this geometry check is compatible with \a layer.
* By default it checks for the geometry type in \a compatibleGeometryTypes().
*
* \since QGIS 3.4
*/
virtual bool isCompatible( QgsVectorLayer *layer ) const;

/**
* A list of geometry types for which this check can be performed.
*
* \since QGIS 3.4
*/
virtual QList<QgsWkbTypes::GeometryType> compatibleGeometryTypes() const = 0;

/**
* Flags for this geometry check.
*/
virtual QgsGeometryCheck::Flags flags() const {return nullptr;}

virtual void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors, QStringList &messages, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = QgsGeometryCheck::LayerFeatureIds() ) const = 0;
//! Fix the error \a error with the specified \a method.
/**
* The main worker method.
* Check all features available from \a featurePools and write errors found to \a errors.
* Other status messages can be written to \a messages.
* Progress should be reported to \a feedback. Only features and layers listed in \a ids should be checked.
*
* \since QGIS 3.4
*/
virtual void collectErrors( const QMap<QString, QgsFeaturePool *> &featurePools, QList<QgsGeometryCheckError *> &errors SIP_INOUT, QStringList &messages SIP_INOUT, QgsFeedback *feedback = nullptr, const LayerFeatureIds &ids = QgsGeometryCheck::LayerFeatureIds() ) const = 0;

/**
* Fix the error \a error with the specified \a method.
*
* \since QGIS 3.4
*/
virtual void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes SIP_INOUT ) const SIP_SKIP;

/**
* Returns a list of descriptions for available resolutions for errors. The index will be passed as ``method`` to \see fixError().
*
* \since QGIS 3.4
*/
virtual QStringList resolutionMethods() const = 0;

/**
* Returns a human readable description for this check.
*
* \since QGIS 3.4
*/
virtual QString description() const = 0;

/**
* Returns an id for this check.
*
* \since QGIS 3.4
*/
virtual QString id() const = 0;

/**
* Returns the check type.
*
* \since QGIS 3.4
*/
CheckType checkType() const { return mCheckType; }

/**
* Returns the context
*
* \since QGIS 3.4
*/
const QgsGeometryCheckContext *context() const { return mContext; }

protected:
Expand Down

0 comments on commit 903e943

Please sign in to comment.