Skip to content

Commit

Permalink
Save symbol levels state - fix for #2161
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@12361 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Dec 7, 2009
1 parent ceb9e5e commit a02f0c7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ QDomElement QgsCategorizedSymbolRendererV2::save( QDomDocument& doc )
{
QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
rendererElem.setAttribute( "type", "categorizedSymbol" );
rendererElem.setAttribute( "symbollevels", ( mUsingSymbolLevels ? "1" : "0" ) );
rendererElem.setAttribute( "attr", mAttrName );

// categories
Expand Down
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ QDomElement QgsGraduatedSymbolRendererV2::save( QDomDocument& doc )
{
QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
rendererElem.setAttribute( "type", "graduatedSymbol" );
rendererElem.setAttribute( "symbollevels", ( mUsingSymbolLevels ? "1" : "0" ) );
rendererElem.setAttribute( "attr", mAttrName );

// ranges
Expand Down
6 changes: 5 additions & 1 deletion src/core/symbology-ng/qgsrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,11 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::load( QDomElement& element )
if ( pfCreate == NULL )
return NULL;

return pfCreate( element );
QgsFeatureRendererV2* r = pfCreate( element );
if ( r )
r->setUsingSymbolLevels( element.attribute( "symbollevels", "0" ).toInt() );

return r;
}

QDomElement QgsFeatureRendererV2::save( QDomDocument& doc )
Expand Down
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgssinglesymbolrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ QDomElement QgsSingleSymbolRendererV2::save( QDomDocument& doc )
{
QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
rendererElem.setAttribute( "type", "singleSymbol" );
rendererElem.setAttribute( "symbollevels", ( mUsingSymbolLevels ? "1" : "0" ) );

QgsSymbolV2Map symbols;
symbols["0"] = mSymbol;
Expand Down
3 changes: 3 additions & 0 deletions src/core/symbology-ng/qgssymbollayerv2utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ QgsSymbolLayerV2* QgsSymbolLayerV2Utils::loadSymbolLayer( QDomElement& element )
{
QString layerClass = element.attribute( "class" );
bool locked = element.attribute( "locked" ).toInt();
int pass = element.attribute( "pass" ).toInt();

// parse properties
QgsStringMap props = parseProperties( element );
Expand All @@ -365,6 +366,7 @@ QgsSymbolLayerV2* QgsSymbolLayerV2Utils::loadSymbolLayer( QDomElement& element )
if ( layer )
{
layer->setLocked( locked );
layer->setRenderingPass( pass );
return layer;
}
else
Expand Down Expand Up @@ -399,6 +401,7 @@ QDomElement QgsSymbolLayerV2Utils::saveSymbol( QString name, QgsSymbolV2* symbol
QDomElement layerEl = doc.createElement( "layer" );
layerEl.setAttribute( "class", layer->layerType() );
layerEl.setAttribute( "locked", layer->isLocked() );
layerEl.setAttribute( "pass", layer->renderingPass() );

if ( subSymbols != NULL && layer->subSymbol() != NULL )
{
Expand Down

0 comments on commit a02f0c7

Please sign in to comment.