Skip to content

Commit

Permalink
Fix for label buffer drawing triggered off of just its data defined s…
Browse files Browse the repository at this point in the history
…ize in the past (<2.0)
  • Loading branch information
dakcarto committed May 24, 2013
1 parent 7083449 commit 8742a9e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
26 changes: 12 additions & 14 deletions src/core/qgspallabeling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ QgsPalLayerSettings::QgsPalLayerSettings()

// text buffer
bufferDraw = false;
bufferDrawOld = false; // on when old style buffer triggered by just size is found
bufferSize = 1.0;
bufferSizeInMapUnits = false;
bufferColor = Qt::white;
Expand Down Expand Up @@ -755,6 +754,13 @@ void QgsPalLayerSettings::readDataDefinedProperty( QgsVectorLayer* layer,
{
//upgrade any existing property to field name-based
layer->setCustomProperty( newPropertyName, QVariant( updateDataDefinedString( ddString ) ) );

// fix for buffer drawing triggered off of just its data defined size in the past (<2.0)
if ( oldIndx == 7 ) // old bufferSize enum
{
bufferDraw = true;
layer->setCustomProperty( "labeling/bufferDraw", true );
}
}

// remove old-style field index-based property
Expand Down Expand Up @@ -849,7 +855,6 @@ void QgsPalLayerSettings::readFromLayer( QgsVectorLayer* layer )

// fix for buffer being keyed off of just its size in the past
QVariant drawBuffer = layer->customProperty( "labeling/bufferDraw", QVariant() );
bufferDrawOld = !drawBuffer.isValid();
if ( drawBuffer.isValid() )
{
bufferDraw = drawBuffer.toBool();
Expand Down Expand Up @@ -2511,25 +2516,18 @@ void QgsPalLayerSettings::parseTextBuffer()
drawBuffer = exprVal.toBool();
}

if ( !drawBuffer )
{
return;
}

// data defined buffer size?
double bufrSize = bufferSize;
if ( dataDefinedValEval( "doublepos", QgsPalLayerSettings::BufferSize, exprVal ) )
{
bufrSize = exprVal.toDouble();
}

// FIXME: find better solution for temporarily turning on buffer, when previously defined by size
// fix for buffer being keyed off of just its size in the past
// if ( bufrSize > 0.0 && bufferDrawOld )
// {
// drawBuffer = bufferDraw = true;
// }

if ( !drawBuffer )
{
return;
}

// data defined buffer transparency?
int bufTransp = bufferTransp;
if ( dataDefinedValEval( "transp", QgsPalLayerSettings::BufferTransp, exprVal ) )
Expand Down
1 change: 0 additions & 1 deletion src/core/qgspallabeling.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ class CORE_EXPORT QgsPalLayerSettings
//-- text buffer

bool bufferDraw;
bool bufferDrawOld; // on when old style buffer triggered by just size is found
double bufferSize; // buffer size
bool bufferSizeInMapUnits; //true if buffer is in map units (otherwise in mm)
QColor bufferColor;
Expand Down

0 comments on commit 8742a9e

Please sign in to comment.