Skip to content

Commit

Permalink
Mask renderer: reuse existing renderer as embedded
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Mercier committed May 23, 2014
1 parent 3ec7337 commit 84b1577
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/gui/symbology-ng/qgsmaskrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,21 @@ QgsMaskRendererV2Widget::QgsMaskRendererV2Widget( QgsVectorLayer* layer, QgsStyl

// try to recognize the previous renderer
// (null renderer means "no previous renderer")
if ( !renderer || renderer->type() != "maskRenderer" )
if ( !renderer )
{
// a new renderer
mRenderer.reset( new QgsMaskRendererV2() );
}
else if ( renderer && renderer->type() != "maskRenderer" )
{
// an existing renderer, but not a mask renderer
// create a mask renderer, with the existing renderer embedded
mRenderer.reset( new QgsMaskRendererV2( renderer ) );
}
else
{
mRenderer.reset( static_cast<QgsMaskRendererV2*>( renderer ) );
// an existing mask renderer
mRenderer.reset( static_cast<QgsMaskRendererV2*>(renderer) );
}

int currentEmbeddedIdx = 0;
Expand Down

0 comments on commit 84b1577

Please sign in to comment.