Skip to content

Commit abda865

Browse files
committedOct 15, 2018
Save / restore geometry check configuration
1 parent 550de15 commit abda865

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed
 

‎src/core/qgsgeometryoptions.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,32 @@ void QgsGeometryOptions::setCheckConfiguration( const QString &checkId, const QV
7575

7676
void QgsGeometryOptions::writeXml( QDomNode &node ) const
7777
{
78-
QDomElement geometryOptionsElement = node.ownerDocument().createElement( QStringLiteral( "geometryOptions" ) );
78+
QDomDocument doc = node.ownerDocument();
79+
QDomElement geometryOptionsElement = doc.createElement( QStringLiteral( "geometryOptions" ) );
7980
node.appendChild( geometryOptionsElement );
8081

8182
geometryOptionsElement.setAttribute( QStringLiteral( "removeDuplicateNodes" ), mRemoveDuplicateNodes ? 1 : 0 );
8283
geometryOptionsElement.setAttribute( QStringLiteral( "geometryPrecision" ), mGeometryPrecision );
84+
85+
QDomElement activeCheckListElement = QgsXmlUtils::writeVariant( mGeometryChecks, doc );
86+
activeCheckListElement.setTagName( QStringLiteral( "activeChecks" ) );
87+
geometryOptionsElement.appendChild( activeCheckListElement );
88+
QDomElement checkConfigurationElement = QgsXmlUtils::writeVariant( mCheckConfiguration, doc );
89+
checkConfigurationElement.setTagName( QStringLiteral( "checkConfiguration" ) );
90+
geometryOptionsElement.appendChild( checkConfigurationElement );
8391
}
8492

8593
void QgsGeometryOptions::readXml( const QDomNode &node )
8694
{
8795
QDomElement geometryOptionsElement = node.toElement();
8896
setGeometryPrecision( geometryOptionsElement.attribute( QStringLiteral( "geometryPrecision" ), QStringLiteral( "0.0" ) ).toDouble() );
8997
setRemoveDuplicateNodes( geometryOptionsElement.attribute( QStringLiteral( "removeDuplicateNodes" ), QStringLiteral( "0" ) ).toInt() == 1 );
98+
99+
QDomElement activeChecksElem = node.namedItem( QStringLiteral( "activeChecks" ) ).toElement();
100+
const QVariant activeChecks = QgsXmlUtils::readVariant( activeChecksElem );
101+
setGeometryChecks( activeChecks.toStringList() );
102+
103+
QDomElement checkConfigurationElem = node.namedItem( QStringLiteral( "checkConfiguration" ) ).toElement();
104+
const QVariant checkConfiguration = QgsXmlUtils::readVariant( checkConfigurationElem );
105+
mCheckConfiguration = checkConfiguration.toMap();
90106
}

0 commit comments

Comments
 (0)
Please sign in to comment.