Skip to content
Permalink
Browse files

Merge pull request #2569 from SebDieBln/Improve_CrsReadXML

Improve QgsCoordinateReferenceSystem::readXML()
  • Loading branch information
nyalldawson committed Dec 12, 2015
2 parents 6e3b1da + ac1ee1c commit 62f90d0c5e124bd01c459ef44f4ce23a5bcdbcf0
@@ -185,7 +185,7 @@ class QgsCoordinateReferenceSystem
* @param theNode The node from which state will be restored
* @return bool True on success, False on failure
*/
bool readXML( QDomNode & theNode );
bool readXML( const QDomNode & theNode );
/** Stores state to the given Dom node in the given document.
* Below is an example of the generated tag.
\code{.xml}
@@ -400,16 +400,9 @@ bool QgsComposerMapGrid::readXML( const QDomElement& itemElem, const QDomDocumen
}
}


QDomElement crsElem = itemElem.firstChildElement( "spatialrefsys" );
if ( !crsElem.isNull() )
{
mCRS.readXML( const_cast<QDomElement&>( itemElem ) ); //better would be to change argument in QgsCoordinateReferenceSystem::readXML to const
}
else
{
if ( !mCRS.readXML( itemElem ) )
mCRS = QgsCoordinateReferenceSystem();
}

mBlendMode = ( QPainter::CompositionMode )( itemElem.attribute( "blendMode", "0" ).toUInt() );

//annotation
@@ -1145,9 +1145,10 @@ QString QgsCoordinateReferenceSystem::toWkt() const
return mWkt;
}

bool QgsCoordinateReferenceSystem::readXML( QDomNode & theNode )
bool QgsCoordinateReferenceSystem::readXML( const QDomNode & theNode )
{
QgsDebugMsg( "Reading Spatial Ref Sys from xml ------------------------!" );
bool result = true;
QDomNode srsNode = theNode.namedItem( "spatialrefsys" );

if ( ! srsNode.isNull() )
@@ -1260,8 +1261,9 @@ bool QgsCoordinateReferenceSystem::readXML( QDomNode & theNode )
{
// Return default CRS if none was found in the XML.
createFromId( GEOCRS_ID, InternalCrsId );
result = false;
}
return true;
return result;
}

bool QgsCoordinateReferenceSystem::writeXML( QDomNode & theNode, QDomDocument & theDoc ) const
@@ -230,7 +230,7 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
* @param theNode The node from which state will be restored
* @return bool True on success, False on failure
*/
bool readXML( QDomNode & theNode );
bool readXML( const QDomNode & theNode );
/** Stores state to the given Dom node in the given document.
* Below is an example of the generated tag.
\code{.xml}

0 comments on commit 62f90d0

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