Skip to content

Commit 62cb55a

Browse files
committedMay 27, 2016
ending store and restore layer extents in projects
1 parent adf47dc commit 62cb55a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎src/core/qgsmaplayer.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,12 @@ bool QgsMapLayer::readLayerXML( const QDomElement& layerElement )
426426
setMinimumScale( layerElement.attribute( "minimumScale" ).toFloat() );
427427
setMaximumScale( layerElement.attribute( "maximumScale" ).toFloat() );
428428

429+
QDomNode extentNode = layerElement.namedItem( "extent" );
430+
if ( !extentNode.isNull() )
431+
{
432+
setExtent( QgsXmlUtils::readRectangle( extentNode.toElement() ) );
433+
}
434+
429435
// set name
430436
mnl = layerElement.namedItem( "layername" );
431437
mne = mnl.toElement();
@@ -1257,6 +1263,11 @@ void QgsMapLayer::exportNamedStyle( QDomDocument &doc, QString &errorMsg )
12571263
myRootNode.setAttribute( "minimumScale", QString::number( minimumScale() ) );
12581264
myRootNode.setAttribute( "maximumScale", QString::number( maximumScale() ) );
12591265

1266+
if ( !mExtent.isNull() )
1267+
{
1268+
myRootNode.appendChild( QgsXmlUtils::writeRectangle( mExtent, myDocument ) );
1269+
}
1270+
12601271
#if 0
12611272
// <transparencyLevelInt>
12621273
QDomElement transparencyLevelIntElement = myDocument.createElement( "transparencyLevelInt" );

0 commit comments

Comments
 (0)
Please sign in to comment.