mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
store and restore layer extents in projects
This commit is contained in:
parent
402ee9d4cf
commit
d690d721c2
@ -48,6 +48,7 @@
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsvectordataprovider.h"
|
||||
#include "qgsmaplayerregistry.h"
|
||||
#include "qgsxmlutils.h"
|
||||
|
||||
|
||||
QgsMapLayer::QgsMapLayer( QgsMapLayer::LayerType type,
|
||||
@ -531,6 +532,11 @@ bool QgsMapLayer::writeLayerXML( QDomElement& layerElement, QDomDocument& docume
|
||||
layerElement.setAttribute( "minimumScale", QString::number( minimumScale() ) );
|
||||
layerElement.setAttribute( "maximumScale", QString::number( maximumScale() ) );
|
||||
|
||||
if ( !mExtent.isNull() )
|
||||
{
|
||||
layerElement.appendChild( QgsXmlUtils::writeRectangle( mExtent, document ) );
|
||||
}
|
||||
|
||||
// ID
|
||||
QDomElement layerId = document.createElement( "id" );
|
||||
QDomText layerIdText = document.createTextNode( id() );
|
||||
@ -1212,6 +1218,12 @@ bool QgsMapLayer::importNamedStyle( QDomDocument& myDocument, QString& myErrorMe
|
||||
setMinimumScale( myRoot.attribute( "minimumScale" ).toDouble() );
|
||||
setMaximumScale( myRoot.attribute( "maximumScale" ).toDouble() );
|
||||
|
||||
QDomNode extentNode = myRoot.namedItem( "extent" );
|
||||
if ( !extentNode.isNull() )
|
||||
{
|
||||
setExtent( QgsXmlUtils::readRectangle( extentNode.toElement() ) );
|
||||
}
|
||||
|
||||
#if 0
|
||||
//read transparency level
|
||||
QDomNode transparencyNode = myRoot.namedItem( "transparencyLevelInt" );
|
||||
|
Loading…
x
Reference in New Issue
Block a user