29 QgsLayerSettings settings;
30 settings.name = layer->name();
32 settings.mNamedStyle = layer->styleManager()->currentStyle();
36 layer->setCustomProperty(
"readSLD",
false );
40 layer->exportSldStyle( sldDoc, errMsg );
41 ( void )settings.mSldStyle.setContent( sldDoc.toString(), true );
43 switch ( layer->type() )
51 settings.mOpacity = vLayer->
opacity();
73 mLayerSettings[layer] = settings;
81 QgsLayerSettings settings = mLayerSettings[layer];
82 layer->styleManager()->setCurrentStyle( settings.mNamedStyle );
83 layer->setName( mLayerSettings[layer].name );
87 QDomElement root = settings.mSldStyle.firstChildElement(
"StyledLayerDescriptor" );
88 QDomElement el = root.firstChildElement(
"NamedLayer" );
89 if ( layer->customProperty(
"readSLD",
false ).toBool() )
91 layer->readSld( el, errMsg );
93 layer->removeCustomProperty(
"readSLD" );
95 switch ( layer->type() )
104 vLayer->
selectByIds( settings.mSelectedFeatureIds );
Base class for all map layer types.
double opacity() const
Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1...
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
void selectByIds(const QgsFeatureIds &ids, SelectBehavior behavior=SetSelection)
Selects matching features using a list of feature IDs.
QgsRasterRenderer * renderer() const
const QgsFeatureIds & selectedFeatureIds() const
Returns a list of the selected features IDs in this layer.
~QgsLayerRestorer()
Destructor.
QgsLayerRestorer(const QList< QgsMapLayer *> &layers)
Constructor for QgsLayerRestorer.
virtual bool setSubsetString(const QString &subset)
Sets the string (typically sql) used to define a subset of the layer.
void setOpacity(double opacity)
Sets the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1...
Represents a vector layer which manages a vector based data sets.
void setOpacity(double opacity)
Sets the opacity for the vector layer, where opacity is a value between 0 (totally transparent) and 1...