Skip to content
Permalink
Browse files

Consider alpha component of colors in data defined symbology

  • Loading branch information
mhugent committed Apr 3, 2013
1 parent c04a219 commit 80f7b5abb27a378645b0c09da52686372f074a31
@@ -154,11 +154,11 @@ void QgsSimpleFillSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderCon
{
if ( mColorExpression )
{
brush.setColor( QColor( mColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() ) );
brush.setColor( QgsSymbolLayerV2Utils::decodeColor( mColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() ) );

This comment has been minimized.

Copy link
@jef-n

jef-n Apr 3, 2013

Member

Now the brand new color widget is wrong, isn't it? I had it implemented using decodeColor/encodeColor and found that the expression needed to produce Qt color names - and thinking about it, I found it more appealing.

}
if ( mColorBorderExpression )
{
pen.setColor( QColor( mColorBorderExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() ) );
pen.setColor( QgsSymbolLayerV2Utils::decodeColor( mColorBorderExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() ) );
}
if ( mWidthBorderExpression )
{
@@ -1147,14 +1147,12 @@ void QgsSVGFillSymbolLayer::applyDataDefinedSettings( const QgsSymbolV2RenderCon
QColor svgFillColor = mSvgFillColor;
if ( mFillColorExpression )
{
QString colorString = mFillColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString();
svgFillColor = QgsSymbolLayerV2Utils::decodeColor( colorString );
svgFillColor = QgsSymbolLayerV2Utils::decodeColor( mFillColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() );
}
QColor svgOutlineColor = mSvgOutlineColor;
if ( mOutlineColorExpression )
{
QString colorString = mOutlineColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString();
svgOutlineColor = QgsSymbolLayerV2Utils::decodeColor( colorString );
svgOutlineColor = QgsSymbolLayerV2Utils::decodeColor( mOutlineColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() );
}
double outlineWidth = mSvgOutlineWidth;
if ( mOutlineWidthExpression )
@@ -1733,7 +1731,7 @@ void QgsLinePatternFillSymbolLayer::applyDataDefinedSettings( const QgsSymbolV2R
QColor color = mColor;
if ( mColorExpression )
{
color = QColor( mColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() );
color = QgsSymbolLayerV2Utils::decodeColor( mColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() );
}
applyPattern( context, mBrush, lineAngle, distance, lineWidth, color );
}
@@ -509,7 +509,7 @@ void QgsSimpleLineSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderCon
//color
if ( mStrokeColorExpression )
{
pen.setColor( QColor( mStrokeColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() ) );
pen.setColor( QgsSymbolLayerV2Utils::decodeColor( mStrokeColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() ) );
}

//offset
@@ -512,11 +512,11 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV

if ( mColorExpression )
{
mBrush.setColor( QColor( mColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() ) );
mBrush.setColor( QgsSymbolLayerV2Utils::decodeColor( mColorExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() ) );
}
if ( mColorBorderExpression )
{
mPen.setColor( QColor( mColorBorderExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() ) );
mPen.setColor( QgsSymbolLayerV2Utils::decodeColor( mColorBorderExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() ) );
}

p->setBrush( context.selected() ? mSelBrush : mBrush );
@@ -1093,15 +1093,13 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
QColor fillColor = mFillColor;
if ( mFillExpression )
{
QString colorString = mFillExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString();
fillColor = QgsSymbolLayerV2Utils::decodeColor( colorString );
fillColor = QgsSymbolLayerV2Utils::decodeColor( mFillExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() );
}

QColor outlineColor = mOutlineColor;
if ( mOutlineExpression )
{
QString colorString = mOutlineExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString();
outlineColor = QgsSymbolLayerV2Utils::decodeColor( colorString );
outlineColor = QgsSymbolLayerV2Utils::decodeColor( mOutlineExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString() );
}


0 comments on commit 80f7b5a

Please sign in to comment.
You can’t perform that action at this time.