Skip to content

Commit

Permalink
QgsCoordinateReferenceSystem::readXML() returns false on failure
Browse files Browse the repository at this point in the history
simplified a check for valid crs
  • Loading branch information
SebDieBln committed Dec 11, 2015
1 parent 2d0be1c commit ac1ee1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/core/composer/qgscomposermapgrid.cpp
Expand Up @@ -400,16 +400,9 @@ bool QgsComposerMapGrid::readXML( const QDomElement& itemElem, const QDomDocumen
} }
} }



if ( !mCRS.readXML( itemElem ) )
QDomElement crsElem = itemElem.firstChildElement( "spatialrefsys" );
if ( !crsElem.isNull() )
{
mCRS.readXML( itemElem );
}
else
{
mCRS = QgsCoordinateReferenceSystem(); mCRS = QgsCoordinateReferenceSystem();
}
mBlendMode = ( QPainter::CompositionMode )( itemElem.attribute( "blendMode", "0" ).toUInt() ); mBlendMode = ( QPainter::CompositionMode )( itemElem.attribute( "blendMode", "0" ).toUInt() );


//annotation //annotation
Expand Down
4 changes: 3 additions & 1 deletion src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -1148,6 +1148,7 @@ QString QgsCoordinateReferenceSystem::toWkt() const
bool QgsCoordinateReferenceSystem::readXML( const QDomNode & theNode ) bool QgsCoordinateReferenceSystem::readXML( const QDomNode & theNode )
{ {
QgsDebugMsg( "Reading Spatial Ref Sys from xml ------------------------!" ); QgsDebugMsg( "Reading Spatial Ref Sys from xml ------------------------!" );
bool result = true;
QDomNode srsNode = theNode.namedItem( "spatialrefsys" ); QDomNode srsNode = theNode.namedItem( "spatialrefsys" );


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


bool QgsCoordinateReferenceSystem::writeXML( QDomNode & theNode, QDomDocument & theDoc ) const bool QgsCoordinateReferenceSystem::writeXML( QDomNode & theNode, QDomDocument & theDoc ) const
Expand Down

0 comments on commit ac1ee1c

Please sign in to comment.