Skip to content
Permalink
Browse files

Save / restore geometry check configuration

  • Loading branch information
m-kuhn committed Sep 26, 2018
1 parent 550de15 commit abda86562219a94f1381bb37a565c6e19b9ca129
Showing with 17 additions and 1 deletion.
  1. +17 −1 src/core/qgsgeometryoptions.cpp
@@ -75,16 +75,32 @@ void QgsGeometryOptions::setCheckConfiguration( const QString &checkId, const QV

void QgsGeometryOptions::writeXml( QDomNode &node ) const
{
QDomElement geometryOptionsElement = node.ownerDocument().createElement( QStringLiteral( "geometryOptions" ) );
QDomDocument doc = node.ownerDocument();
QDomElement geometryOptionsElement = doc.createElement( QStringLiteral( "geometryOptions" ) );
node.appendChild( geometryOptionsElement );

geometryOptionsElement.setAttribute( QStringLiteral( "removeDuplicateNodes" ), mRemoveDuplicateNodes ? 1 : 0 );
geometryOptionsElement.setAttribute( QStringLiteral( "geometryPrecision" ), mGeometryPrecision );

QDomElement activeCheckListElement = QgsXmlUtils::writeVariant( mGeometryChecks, doc );
activeCheckListElement.setTagName( QStringLiteral( "activeChecks" ) );
geometryOptionsElement.appendChild( activeCheckListElement );
QDomElement checkConfigurationElement = QgsXmlUtils::writeVariant( mCheckConfiguration, doc );
checkConfigurationElement.setTagName( QStringLiteral( "checkConfiguration" ) );
geometryOptionsElement.appendChild( checkConfigurationElement );
}

void QgsGeometryOptions::readXml( const QDomNode &node )
{
QDomElement geometryOptionsElement = node.toElement();
setGeometryPrecision( geometryOptionsElement.attribute( QStringLiteral( "geometryPrecision" ), QStringLiteral( "0.0" ) ).toDouble() );
setRemoveDuplicateNodes( geometryOptionsElement.attribute( QStringLiteral( "removeDuplicateNodes" ), QStringLiteral( "0" ) ).toInt() == 1 );

QDomElement activeChecksElem = node.namedItem( QStringLiteral( "activeChecks" ) ).toElement();
const QVariant activeChecks = QgsXmlUtils::readVariant( activeChecksElem );
setGeometryChecks( activeChecks.toStringList() );

QDomElement checkConfigurationElem = node.namedItem( QStringLiteral( "checkConfiguration" ) ).toElement();
const QVariant checkConfiguration = QgsXmlUtils::readVariant( checkConfigurationElem );
mCheckConfiguration = checkConfiguration.toMap();
}

0 comments on commit abda865

Please sign in to comment.
You can’t perform that action at this time.