mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-16 00:05:45 -04:00
Merge pull request #2569 from SebDieBln/Improve_CrsReadXML
Improve QgsCoordinateReferenceSystem::readXML()
This commit is contained in:
commit
62f90d0c5e
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user