Skip to content
Permalink
Browse files

Revert "Use permissive parseColor method for evaluating data defined …

…colors"

This reverts commit 79c0d5b.

The change broke parsing of colors in the format 0,0,255,255
  • Loading branch information
nyalldawson committed May 7, 2015
1 parent 4082de1 commit 1ff6b272c191f0033ecbc93d72fed4c2c0f034c1
@@ -2331,7 +2331,7 @@ bool QgsPalLayerSettings::dataDefinedValEval( const QString& valType,
{
QString colorstr = exprVal.toString().trimmed();
QgsDebugMsgLevel( dbgStr.arg( colorstr ), 4 );
QColor color = QgsSymbolLayerV2Utils::parseColor( colorstr );
QColor color = QgsSymbolLayerV2Utils::decodeColor( colorstr );

if ( color.isValid() )
{
@@ -209,12 +209,12 @@ void QgsEllipseSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Rend
if ( hasDataDefinedProperty( "fill_color" ) )
{
QString colorString = evaluateDataDefinedProperty( "fill_color", context.feature() ).toString();
mBrush.setColor( QColor( QgsSymbolLayerV2Utils::parseColor( colorString ) ) );
mBrush.setColor( QColor( QgsSymbolLayerV2Utils::decodeColor( colorString ) ) );
}
if ( hasDataDefinedProperty( "outline_color" ) )
{
QString colorString = evaluateDataDefinedProperty( "outline_color", context.feature() ).toString();
mPen.setColor( QColor( QgsSymbolLayerV2Utils::parseColor( colorString ) ) );
mPen.setColor( QColor( QgsSymbolLayerV2Utils::decodeColor( colorString ) ) );
}
double scaledWidth = mSymbolWidth;
double scaledHeight = mSymbolHeight;
@@ -82,15 +82,15 @@ void QgsSimpleFillSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderCon

if ( hasDataDefinedProperty( "color" ) )
{
brush.setColor( QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() ) );
brush.setColor( QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() ) );
}
if ( hasDataDefinedProperty( "fill_style" ) )
{
brush.setStyle( QgsSymbolLayerV2Utils::decodeBrushStyle( evaluateDataDefinedProperty( "fill_style", context.feature() ).toString() ) );
}
if ( hasDataDefinedProperty( "color_border" ) )
{
pen.setColor( QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color_border", context.feature() ).toString() ) );
pen.setColor( QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color_border", context.feature() ).toString() ) );
}
if ( hasDataDefinedProperty( "width_border" ) )
{
@@ -389,7 +389,7 @@ QColor QgsSimpleFillSymbolLayerV2::dxfColor( const QgsSymbolV2RenderContext& con
{
if ( hasDataDefinedProperty( "border_color" ) )
{
return QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "border_color", context.feature() ).toString() );
return QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "border_color", context.feature() ).toString() );
}
return mBorderColor;
}
@@ -403,7 +403,7 @@ QColor QgsSimpleFillSymbolLayerV2::dxfBrushColor( const QgsSymbolV2RenderContext
{
if ( hasDataDefinedProperty( "color" ) )
{
return QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() );
return QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() );
}
return mColor;
}
@@ -540,14 +540,14 @@ void QgsGradientFillSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderC
QColor color = mColor;
if ( hasDataDefinedProperty( "color" ) )
{
color = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() );
color = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() );
}

//second gradient color
QColor color2 = mColor2;
if ( hasDataDefinedProperty( "color2" ) )
{
color2 = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color2", context.feature() ).toString() );
color2 = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color2", context.feature() ).toString() );
}

//gradient rotation angle
@@ -1020,14 +1020,14 @@ void QgsShapeburstFillSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2Rende
color = mColor;
if ( hasDataDefinedProperty( "color" ) )
{
color = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() );
color = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() );
}

//second gradient color
color2 = mColor2;
if ( hasDataDefinedProperty( "color2" ) )
{
color2 = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color2", context.feature() ).toString() );
color2 = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color2", context.feature() ).toString() );
}

//blur radius
@@ -2123,12 +2123,12 @@ void QgsSVGFillSymbolLayer::applyDataDefinedSettings( const QgsSymbolV2RenderCon
QColor svgFillColor = mSvgFillColor;
if ( hasDataDefinedProperty( "svgFillColor" ) )
{
svgFillColor = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "svgFillColor", context.feature() ).toString() );
svgFillColor = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "svgFillColor", context.feature() ).toString() );
}
QColor svgOutlineColor = mSvgOutlineColor;
if ( hasDataDefinedProperty( "svgOutlineColor" ) )
{
svgOutlineColor = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "svgOutlineColor", context.feature() ).toString() );
svgOutlineColor = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "svgOutlineColor", context.feature() ).toString() );
}
double outlineWidth = mSvgOutlineWidth;
if ( hasDataDefinedProperty( "svgOutlineWidth" ) )
@@ -2820,7 +2820,7 @@ void QgsLinePatternFillSymbolLayer::applyDataDefinedSettings( const QgsSymbolV2R
QColor color = mColor;
if ( hasDataDefinedProperty( "color" ) )
{
color = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() );
color = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() );
}
applyPattern( context, mBrush, lineAngle, distance, lineWidth, color );
}
@@ -479,7 +479,7 @@ void QgsSimpleLineSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderCon
//color
if ( hasDataDefinedProperty( "color" ) )
{
pen.setColor( QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() ) );
pen.setColor( QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() ) );
}

//offset
@@ -585,7 +585,7 @@ QColor QgsSimpleLineSymbolLayerV2::dxfColor( const QgsSymbolV2RenderContext& con
{
if ( hasDataDefinedProperty( "color" ) )
{
return ( QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() ) );
return ( QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() ) );
}
return mColor;
}
@@ -563,12 +563,12 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV

if ( hasDataDefinedProperty( "color" ) )
{
mBrush.setColor( QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() ) );
mBrush.setColor( QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color", context.feature() ).toString() ) );
}
if ( hasDataDefinedProperty( "color_border" ) )
{
mPen.setColor( QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color_border", context.feature() ).toString() ) );
mSelPen.setColor( QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color_border", context.feature() ).toString() ) );
mPen.setColor( QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color_border", context.feature() ).toString() ) );
mSelPen.setColor( QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color_border", context.feature() ).toString() ) );
}
if ( hasDataDefinedProperty( "outline_width" ) )
{
@@ -831,11 +831,11 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
QColor bc = mBrush.color();
if ( hasDataDefinedProperty( "color" ) )
{
bc = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color", f ).toString() );
bc = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color", f ).toString() );
}
if ( hasDataDefinedProperty( "color_border" ) )
{
pc = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "color_border", f ).toString() );
pc = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "color_border", f ).toString() );
}

//offset
@@ -1294,13 +1294,13 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
QColor fillColor = mFillColor;
if ( hasDataDefinedProperty( "fill" ) )
{
fillColor = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "fill", context.feature() ).toString() );
fillColor = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "fill", context.feature() ).toString() );
}

QColor outlineColor = mOutlineColor;
if ( hasDataDefinedProperty( "outline" ) )
{
outlineColor = QgsSymbolLayerV2Utils::parseColor( evaluateDataDefinedProperty( "outline", context.feature() ).toString() );
outlineColor = QgsSymbolLayerV2Utils::decodeColor( evaluateDataDefinedProperty( "outline", context.feature() ).toString() );
}

bool fitsInCache = true;
@@ -336,8 +336,8 @@ QgsFeatureRendererV2* QgsPointDisplacementRenderer::create( QDomElement& symbolo
labelFont.fromString( symbologyElem.attribute( "labelFont", "" ) );
r->setLabelFont( labelFont );
r->setCircleWidth( symbologyElem.attribute( "circleWidth", "0.4" ).toDouble() );
r->setCircleColor( QgsSymbolLayerV2Utils::parseColor( symbologyElem.attribute( "circleColor", "" ) ) );
r->setLabelColor( QgsSymbolLayerV2Utils::parseColor( symbologyElem.attribute( "labelColor", "" ) ) );
r->setCircleColor( QgsSymbolLayerV2Utils::decodeColor( symbologyElem.attribute( "circleColor", "" ) ) );
r->setLabelColor( QgsSymbolLayerV2Utils::decodeColor( symbologyElem.attribute( "labelColor", "" ) ) );
r->setCircleRadiusAddition( symbologyElem.attribute( "circleRadiusAddition", "0.0" ).toDouble() );
r->setMaxLabelScaleDenominator( symbologyElem.attribute( "maxLabelScaleDenominator", "-1" ).toDouble() );
r->setTolerance( symbologyElem.attribute( "tolerance", "0.00001" ).toDouble() );

0 comments on commit 1ff6b27

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