Skip to content

Commit

Permalink
Save / restore geometry check configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 15, 2018
1 parent 550de15 commit abda865
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/core/qgsgeometryoptions.cpp
Expand Up @@ -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.