QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
26 mGeometryChecks =
QgsSettings().
value( QStringLiteral(
"geometry_validation/default_checks" ) ).toString().split(
',' ) ;
31 return mRemoveDuplicateNodes;
36 mRemoveDuplicateNodes = value;
42 return mGeometryPrecision;
47 mGeometryPrecision = value;
53 return mGeometryPrecision != 0.0 || mRemoveDuplicateNodes;
58 if ( mGeometryPrecision != 0.0 )
59 geometry = geometry.
snappedToGrid( mGeometryPrecision, mGeometryPrecision );
61 if ( mRemoveDuplicateNodes )
67 return mGeometryChecks;
78 return mCheckConfiguration.value( checkId ).toMap();
89 QDomDocument doc = node.ownerDocument();
90 QDomElement geometryOptionsElement = doc.createElement( QStringLiteral(
"geometryOptions" ) );
91 node.appendChild( geometryOptionsElement );
93 geometryOptionsElement.setAttribute( QStringLiteral(
"removeDuplicateNodes" ), mRemoveDuplicateNodes ? 1 : 0 );
94 geometryOptionsElement.setAttribute( QStringLiteral(
"geometryPrecision" ), mGeometryPrecision );
97 activeCheckListElement.setTagName( QStringLiteral(
"activeChecks" ) );
98 geometryOptionsElement.appendChild( activeCheckListElement );
100 checkConfigurationElement.setTagName( QStringLiteral(
"checkConfiguration" ) );
101 geometryOptionsElement.appendChild( checkConfigurationElement );
106 QDomElement geometryOptionsElement = node.toElement();
107 setGeometryPrecision( geometryOptionsElement.attribute( QStringLiteral(
"geometryPrecision" ), QStringLiteral(
"0.0" ) ).toDouble() );
108 setRemoveDuplicateNodes( geometryOptionsElement.attribute( QStringLiteral(
"removeDuplicateNodes" ), QStringLiteral(
"0" ) ).toInt() == 1 );
110 QDomElement activeChecksElem = node.namedItem( QStringLiteral(
"activeChecks" ) ).toElement();
114 QDomElement checkConfigurationElem = node.namedItem( QStringLiteral(
"checkConfiguration" ) ).toElement();
void checkConfigurationChanged()
Access the configuration for the check checkId.
double geometryPrecision() const
The precision in which geometries on this layer should be saved.
void removeDuplicateNodesChanged()
Automatically remove duplicate nodes on all geometries which are edited on this layer.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
bool removeDuplicateNodes(double epsilon=4 *std::numeric_limits< double >::epsilon(), bool useZValues=false)
Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerat...
QStringList geometryChecks() const
A list of activated geometry checks.
void setGeometryChecks(const QStringList &geometryChecks)
A list of activated geometry checks.
bool removeDuplicateNodes() const
Automatically remove duplicate nodes on all geometries which are edited on this layer.
bool isActive() const
Determines if at least one fix is enabled.
static QVariant readVariant(const QDomElement &element)
Read a QVariant from a QDomElement.
void apply(QgsGeometry &geometry) const
Apply any fixes configured on this class to geometry.
void writeXml(QDomNode &node) const
Write the geometry options to the node.
void setGeometryPrecision(double value)
The precision in which geometries on this layer should be saved.
QgsGeometryOptions()
Create a new QgsGeometryOptions object.
void geometryPrecisionChanged()
The precision in which geometries on this layer should be saved.
void setRemoveDuplicateNodes(bool value)
Automatically remove duplicate nodes on all geometries which are edited on this layer.
QgsGeometry snappedToGrid(double hSpacing, double vSpacing, double dSpacing=0, double mSpacing=0) const
Returns a new geometry with all points or vertices snapped to the closest point of the grid.
void setCheckConfiguration(const QString &checkId, const QVariantMap &checkConfiguration)
Set the configuration for the check checkId.
void geometryChecksChanged()
A list of activated geometry checks.
static QDomElement writeVariant(const QVariant &value, QDomDocument &doc)
Write a QVariant to a QDomElement.
QVariantMap checkConfiguration(const QString &checkId) const
Access the configuration for the check checkId.
void readXml(const QDomNode &node)
Read the geometry options from node.