Merge pull request #2569 from SebDieBln/Improve_CrsReadXML

Improve QgsCoordinateReferenceSystem::readXML()
This commit is contained in:
Nyall Dawson 2015-12-12 11:47:32 +11:00
commit 62f90d0c5e
4 changed files with 8 additions and 13 deletions

View File

@ -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}

View File

@ -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

View File

@ -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

View File

@ -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}