QGIS API Documentation  3.8.0-Zanzibar (11aff65)
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsGeometryCheckError Class Reference

This represents an error reported by a geometry check. More...

#include <qgsgeometrycheckerror.h>

Inheritance diagram for QgsGeometryCheckError:
Inheritance graph
[legend]

Public Types

enum  Status { StatusPending, StatusFixFailed, StatusFixed, StatusObsolete }
 The status of an error. More...
 
enum  ValueType { ValueLength, ValueArea, ValueOther }
 Describes the type of an error value. More...
 

Public Member Functions

 QgsGeometryCheckError (const QgsGeometryCheck *check, const QgsGeometryCheckerUtils::LayerFeature &layerFeature, const QgsPointXY &errorLocation, QgsVertexId vidx=QgsVertexId(), const QVariant &value=QVariant(), ValueType valueType=ValueOther)
 Create a new geometry check error with the parent check and for the layerFeature pair at the errorLocation. More...
 
virtual ~QgsGeometryCheckError ()=default
 
virtual QgsRectangle affectedAreaBBox () const
 The bounding box of the affected area of the error. More...
 
const QgsGeometryCheckcheck () const
 The geometry check that created this error. More...
 
virtual bool closeMatch (QgsGeometryCheckError *) const
 Check if this error is almost equal to other. More...
 
virtual QString description () const
 The error description. More...
 
QgsFeatureId featureId () const
 The id of the feature on which this error has been detected. More...
 
QgsGeometry geometry () const
 The geometry of the error in map units. More...
 
virtual bool handleChanges (const QgsGeometryCheck::Changes &changes)
 Apply a list of changes. More...
 
virtual QIcon icon () const
 Returns an icon that should be shown for this kind of error. More...
 
virtual QMap< QString, QgsFeatureIdsinvolvedFeatures () const
 Returns a list of involved features. More...
 
virtual bool isEqual (QgsGeometryCheckError *other) const
 Check if this error is equal to other. More...
 
const QString & layerId () const
 The id of the layer on which this error has been detected. More...
 
const QgsPointXYlocation () const
 The location of the error in map units. More...
 
const QgsGeometryCheckErroroperator= (const QgsGeometryCheckError &)=delete
 
QString resolutionMessage () const
 A message with details, how the error has been resolved. More...
 
void setFixed (int method)
 Set the status to fixed and specify the method that has been used to fix the error. More...
 
void setFixFailed (const QString &reason)
 Set the error status to failed and specify the reason for failure. More...
 
void setObsolete ()
 Set the error status to obsolete. More...
 
Status status () const
 The status of the error. More...
 
virtual void update (const QgsGeometryCheckError *other)
 Update this error with the information from other. More...
 
QVariant value () const
 An additional value for the error. More...
 
ValueType valueType () const
 The type of the value. More...
 
const QgsVertexIdvidx () const
 The id of the affected vertex. More...
 

Protected Member Functions

 QgsGeometryCheckError (const QgsGeometryCheck *check, const QString &layerId, QgsFeatureId featureId, const QgsGeometry &geometry, const QgsPointXY &errorLocation, QgsVertexId vidx=QgsVertexId(), const QVariant &value=QVariant(), ValueType valueType=ValueOther)
 Create a new geometry check error with the parent check and for the layer with layerId and featureId. More...
 

Protected Attributes

const QgsGeometryCheckmCheck = nullptr
 
QgsPointXY mErrorLocation
 
QgsFeatureId mFeatureId
 
QgsGeometry mGeometry
 
QString mLayerId
 
QString mResolutionMessage
 
Status mStatus
 
QVariant mValue
 
ValueType mValueType
 
QgsVertexId mVidx
 

Detailed Description

This represents an error reported by a geometry check.

Note
This class is a technology preview and unstable API.
Since
QGIS 3.4

Definition at line 35 of file qgsgeometrycheckerror.h.

Member Enumeration Documentation

◆ Status

The status of an error.

Enumerator
StatusPending 

The error is detected and pending to be handled.

StatusFixFailed 

A fix has been tried on the error but failed.

StatusFixed 

The error is fixed.

StatusObsolete 

The error is obsolete because of other modifications.

Definition at line 42 of file qgsgeometrycheckerror.h.

◆ ValueType

Describes the type of an error value.

Enumerator
ValueLength 

The value is a length.

ValueArea 

The value is an area.

ValueOther 

The value if of another type.

Definition at line 53 of file qgsgeometrycheckerror.h.

Constructor & Destructor Documentation

◆ QgsGeometryCheckError() [1/2]

QgsGeometryCheckError::QgsGeometryCheckError ( const QgsGeometryCheck check,
const QgsGeometryCheckerUtils::LayerFeature layerFeature,
const QgsPointXY errorLocation,
QgsVertexId  vidx = QgsVertexId(),
const QVariant &  value = QVariant(),
ValueType  valueType = ValueOther 
)

Create a new geometry check error with the parent check and for the layerFeature pair at the errorLocation.

Optionally the vertex can be specified via vixd and a value with its value Type for additional information.

Definition at line 40 of file qgsgeometrycheckerror.cpp.

◆ ~QgsGeometryCheckError()

virtual QgsGeometryCheckError::~QgsGeometryCheckError ( )
virtualdefault

◆ QgsGeometryCheckError() [2/2]

QgsGeometryCheckError::QgsGeometryCheckError ( const QgsGeometryCheck check,
const QString &  layerId,
QgsFeatureId  featureId,
const QgsGeometry geometry,
const QgsPointXY errorLocation,
QgsVertexId  vidx = QgsVertexId(),
const QVariant &  value = QVariant(),
ValueType  valueType = ValueOther 
)
protected

Create a new geometry check error with the parent check and for the layer with layerId and featureId.

The geometry of the error and the errorLocation need to be specified in map coordinates. Optionally the vertex can be specified via vixd and a value with its value Type for additional information.

Definition at line 21 of file qgsgeometrycheckerror.cpp.

Member Function Documentation

◆ affectedAreaBBox()

QgsRectangle QgsGeometryCheckError::affectedAreaBBox ( ) const
virtual

The bounding box of the affected area of the error.

Reimplemented in QgsGeometryGapCheckError, and QgsGeometryMissingVertexCheckError.

Definition at line 88 of file qgsgeometrycheckerror.cpp.

◆ check()

const QgsGeometryCheck* QgsGeometryCheckError::check ( ) const
inline

The geometry check that created this error.

Definition at line 80 of file qgsgeometrycheckerror.h.

◆ closeMatch()

bool QgsGeometryCheckError::closeMatch ( QgsGeometryCheckError ) const
virtual

Check if this error is almost equal to other.

If this returns true, it can be used to update existing errors after re-checking.

Reimplemented in QgsGeometryOverlapCheckError, and QgsGeometryGapCheckError.

Definition at line 114 of file qgsgeometrycheckerror.cpp.

◆ description()

virtual QString QgsGeometryCheckError::description ( ) const
inlinevirtual

The error description.

By default the description of the parent check will be returned.

Reimplemented in QgsGeometryOverlapCheckError.

Definition at line 106 of file qgsgeometrycheckerror.h.

◆ featureId()

QgsFeatureId QgsGeometryCheckError::featureId ( ) const
inline

The id of the feature on which this error has been detected.

Definition at line 90 of file qgsgeometrycheckerror.h.

◆ geometry()

QgsGeometry QgsGeometryCheckError::geometry ( ) const

The geometry of the error in map units.

Definition at line 83 of file qgsgeometrycheckerror.cpp.

◆ handleChanges()

bool QgsGeometryCheckError::handleChanges ( const QgsGeometryCheck::Changes changes)
virtual

Apply a list of changes.

Reimplemented in QgsGeometryCheckErrorSingle, QgsGeometryOverlapCheckError, and QgsGeometryGapCheckError.

Definition at line 119 of file qgsgeometrycheckerror.cpp.

◆ icon()

QIcon QgsGeometryCheckError::icon ( ) const
virtual

Returns an icon that should be shown for this kind of error.

Since
QGIS 3.8

Reimplemented in QgsGeometryOverlapCheckError, QgsGeometryGapCheckError, and QgsGeometryMissingVertexCheckError.

Definition at line 190 of file qgsgeometrycheckerror.cpp.

◆ involvedFeatures()

QMap< QString, QgsFeatureIds > QgsGeometryCheckError::involvedFeatures ( ) const
virtual

Returns a list of involved features.

By default returns an empty map. The map keys are layer ids, the map value is a set of feature ids.

Since
QGIS 3.8

Reimplemented in QgsGeometryOverlapCheckError, QgsGeometryGapCheckError, and QgsGeometryMissingVertexCheckError.

Definition at line 185 of file qgsgeometrycheckerror.cpp.

◆ isEqual()

bool QgsGeometryCheckError::isEqual ( QgsGeometryCheckError other) const
virtual

Check if this error is equal to other.

Is reimplemented by subclasses with additional information, comparison of base information is done in parent class.

Reimplemented in QgsGeometryOverlapCheckError, QgsGeometryGapCheckError, QgsGeometryContainedCheckError, and QgsGeometryDuplicateCheckError.

Definition at line 106 of file qgsgeometrycheckerror.cpp.

◆ layerId()

const QString& QgsGeometryCheckError::layerId ( ) const
inline

The id of the layer on which this error has been detected.

Definition at line 85 of file qgsgeometrycheckerror.h.

◆ location()

const QgsPointXY& QgsGeometryCheckError::location ( ) const
inline

The location of the error in map units.

Definition at line 111 of file qgsgeometrycheckerror.h.

◆ operator=()

const QgsGeometryCheckError& QgsGeometryCheckError::operator= ( const QgsGeometryCheckError )
delete

◆ resolutionMessage()

QString QgsGeometryCheckError::resolutionMessage ( ) const
inline

A message with details, how the error has been resolved.

Definition at line 140 of file qgsgeometrycheckerror.h.

◆ setFixed()

void QgsGeometryCheckError::setFixed ( int  method)

Set the status to fixed and specify the method that has been used to fix the error.

Definition at line 93 of file qgsgeometrycheckerror.cpp.

◆ setFixFailed()

void QgsGeometryCheckError::setFixFailed ( const QString &  reason)

Set the error status to failed and specify the reason for failure.

Definition at line 100 of file qgsgeometrycheckerror.cpp.

◆ setObsolete()

void QgsGeometryCheckError::setObsolete ( )
inline

Set the error status to obsolete.

Definition at line 156 of file qgsgeometrycheckerror.h.

◆ status()

Status QgsGeometryCheckError::status ( ) const
inline

The status of the error.

Definition at line 135 of file qgsgeometrycheckerror.h.

◆ update()

void QgsGeometryCheckError::update ( const QgsGeometryCheckError other)
virtual

Update this error with the information from other.

Will be used to update existing errors whenever they are re-checked.

Reimplemented in QgsGeometryGapCheckError.

Definition at line 198 of file qgsgeometrycheckerror.cpp.

◆ value()

QVariant QgsGeometryCheckError::value ( ) const
inline

An additional value for the error.

Lengths and areas are provided in map units.

See also
valueType()

Definition at line 118 of file qgsgeometrycheckerror.h.

◆ valueType()

ValueType QgsGeometryCheckError::valueType ( ) const
inline

The type of the value.

See also
value()

Definition at line 124 of file qgsgeometrycheckerror.h.

◆ vidx()

const QgsVertexId& QgsGeometryCheckError::vidx ( ) const
inline

The id of the affected vertex.

May be valid or not, depending on the check.

Definition at line 130 of file qgsgeometrycheckerror.h.

Member Data Documentation

◆ mCheck

const QgsGeometryCheck* QgsGeometryCheckError::mCheck = nullptr
protected

Definition at line 216 of file qgsgeometrycheckerror.h.

◆ mErrorLocation

QgsPointXY QgsGeometryCheckError::mErrorLocation
protected

Definition at line 220 of file qgsgeometrycheckerror.h.

◆ mFeatureId

QgsFeatureId QgsGeometryCheckError::mFeatureId
protected

Definition at line 218 of file qgsgeometrycheckerror.h.

◆ mGeometry

QgsGeometry QgsGeometryCheckError::mGeometry
protected

Definition at line 219 of file qgsgeometrycheckerror.h.

◆ mLayerId

QString QgsGeometryCheckError::mLayerId
protected

Definition at line 217 of file qgsgeometrycheckerror.h.

◆ mResolutionMessage

QString QgsGeometryCheckError::mResolutionMessage
protected

Definition at line 225 of file qgsgeometrycheckerror.h.

◆ mStatus

Status QgsGeometryCheckError::mStatus
protected

Definition at line 224 of file qgsgeometrycheckerror.h.

◆ mValue

QVariant QgsGeometryCheckError::mValue
protected

Definition at line 222 of file qgsgeometrycheckerror.h.

◆ mValueType

ValueType QgsGeometryCheckError::mValueType
protected

Definition at line 223 of file qgsgeometrycheckerror.h.

◆ mVidx

QgsVertexId QgsGeometryCheckError::mVidx
protected

Definition at line 221 of file qgsgeometrycheckerror.h.


The documentation for this class was generated from the following files: