Skip to content
Permalink
Browse files
Consider scale for data defined symbology properties
  • Loading branch information
mhugent committed Sep 16, 2013
1 parent c84ad6e commit b1444bbcd5419d952d41b16205c80754074df13d
@@ -247,7 +247,7 @@ void QgsEllipseSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
mPen.setColor( mOutlineColor );
mPen.setWidthF( mOutlineWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOutlineWidthUnit ) );
mBrush.setColor( mFillColor );
prepareExpressions( context.layer() );
prepareExpressions( context.layer(), context.renderContext().rendererScale() );
}

void QgsEllipseSymbolLayerV2::stopRender( QgsSymbolV2RenderContext & )
@@ -152,7 +152,7 @@ void QgsSimpleFillSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context
mSelPen = QPen( selPenColor );
mPen.setStyle( mBorderStyle );
mPen.setWidthF( mBorderWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mBorderWidthUnit ) );
prepareExpressions( context.layer() );
prepareExpressions( context.layer(), context.renderContext().rendererScale() );
}

void QgsSimpleFillSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context )
@@ -576,7 +576,7 @@ void QgsSVGFillSymbolLayer::startRender( QgsSymbolV2RenderContext& context )
mOutline->startRender( context.renderContext() );
}

prepareExpressions( context.layer() );
prepareExpressions( context.layer(), context.renderContext().rendererScale() );
}

void QgsSVGFillSymbolLayer::stopRender( QgsSymbolV2RenderContext& context )
@@ -1096,7 +1096,7 @@ void QgsLinePatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& conte
mOutline->startRender( context.renderContext() );
}

prepareExpressions( context.layer() );
prepareExpressions( context.layer(), context.renderContext().rendererScale() );
}

void QgsLinePatternFillSymbolLayer::stopRender( QgsSymbolV2RenderContext & )
@@ -1467,7 +1467,7 @@ void QgsPointPatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& cont
{
mOutline->startRender( context.renderContext() );
}
prepareExpressions( context.layer() );
prepareExpressions( context.layer(), context.renderContext().rendererScale() );
}

void QgsPointPatternFillSymbolLayer::stopRender( QgsSymbolV2RenderContext& context )
@@ -159,7 +159,7 @@ void QgsSimpleLineSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context
mSelPen.setColor( selColor );

//prepare expressions for data defined properties
prepareExpressions( context.layer() );
prepareExpressions( context.layer(), context.renderContext().rendererScale() );
}

void QgsSimpleLineSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context )
@@ -538,7 +538,7 @@ void QgsMarkerLineSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context
mMarker->startRender( context.renderContext(), context.layer() );

//prepare expressions for data defined properties
prepareExpressions( context.layer() );
prepareExpressions( context.layer(), context.renderContext().rendererScale() );
}

void QgsMarkerLineSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context )
@@ -211,7 +211,7 @@ void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& contex
mSelCache = QImage();
}

prepareExpressions( context.layer() );
prepareExpressions( context.layer(), context.renderContext().rendererScale() );
}


@@ -830,7 +830,7 @@ void QgsSvgMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
{
mOrigSize = mSize; // save in case the size would be data defined
Q_UNUSED( context );
prepareExpressions( context.layer() );
prepareExpressions( context.layer(), context.renderContext().rendererScale() );
}

void QgsSvgMarkerSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context )
@@ -76,7 +76,7 @@ void QgsSymbolLayerV2::removeDataDefinedProperties()
mDataDefinedProperties.clear();
}

void QgsSymbolLayerV2::prepareExpressions( const QgsVectorLayer* vl )
void QgsSymbolLayerV2::prepareExpressions( const QgsVectorLayer* vl, double scale )
{
if ( !vl )
{
@@ -90,6 +90,10 @@ void QgsSymbolLayerV2::prepareExpressions( const QgsVectorLayer* vl )
if ( it.value() )
{
it.value()->prepare( fields );
if ( scale > 0 )
{
it.value()->setScale( scale );
}
}
}
}
@@ -108,7 +108,7 @@ class CORE_EXPORT QgsSymbolLayerV2
static const bool selectFillBorder = false; // Fill symbol layer also selects border symbology
static const bool selectFillStyle = false; // Fill symbol uses symbol layer style..

virtual void prepareExpressions( const QgsVectorLayer* vl );
virtual void prepareExpressions( const QgsVectorLayer* vl, double scale = -1 );
virtual QgsExpression* expression( const QString& property );
/**Saves data defined properties to string map*/
void saveDataDefinedProperties( QgsStringMap& stringMap ) const;

0 comments on commit b1444bb

Please sign in to comment.