diff --git a/src/core/raster/qgsrastershader.cpp b/src/core/raster/qgsrastershader.cpp index 625e501e4609..b8b7ca873f46 100644 --- a/src/core/raster/qgsrastershader.cpp +++ b/src/core/raster/qgsrastershader.cpp @@ -37,12 +37,13 @@ QgsRasterShader::~QgsRasterShader() } /** - Generates and new RGB value based on one input value + Generates and new RGBA value based on one input value - @param theValue The original value to base a new RGB value on - @param theReturnRedValue The red component of the new RGB value - @param theReturnGreenValue The green component of the new RGB value - @param theReturnBlueValue The blue component of the new RGB value + @param theValue The original value to base a new RGBA value on + @param theReturnRedValue The red component of the new RGBA value + @param theReturnGreenValue The green component of the new RGBA value + @param theReturnBlueValue The blue component of the new RGBA value + @param theReturnAlpha The alpha component of the new RGBA value @return True if the return values are valid otherwise false */ bool QgsRasterShader::shade( double theValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue , int *theReturnAlpha ) @@ -55,15 +56,17 @@ bool QgsRasterShader::shade( double theValue, int* theReturnRedValue, int* theRe return false; } /** - Generates and new RGB value based on an original RGB value + Generates and new RGBA value based on an original RGBA value - @param theRedValue The red component of the original value to base a new RGB value on - @param theGreenValue The green component of the original value to base a new RGB value on - @param theBlueValue The blue component of the original value to base a new RGB value on - @param theReturnRedValue The red component of the new RGB value - @param theReturnGreenValue The green component of the new RGB value - @param theReturnBlueValue The blue component of the new RGB value + @param theRedValue The red component of the original value to base a new RGBA value on + @param theGreenValue The green component of the original value to base a new RGBA value on + @param theBlueValue The blue component of the original value to base a new RGBA value on + @param theAlphaValue The alpha component of the original value to base a new RGBA value on + @param theReturnRedValue The red component of the new RGBA value + @param theReturnGreenValue The green component of the new RGBA value + @param theReturnBlueValue The blue component of the new RGBA value + @param theReturnAlphaValue The alpha component of the new RGBA value @return True if the return values are valid otherwise false */ bool QgsRasterShader::shade( double theRedValue, double theGreenValue, double theBlueValue, double theAlphaValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue, int* theReturnAlphaValue ) diff --git a/src/core/raster/qgsrastershaderfunction.cpp b/src/core/raster/qgsrastershaderfunction.cpp index 4bf4a873bb99..dd2ee8106238 100644 --- a/src/core/raster/qgsrastershaderfunction.cpp +++ b/src/core/raster/qgsrastershaderfunction.cpp @@ -55,12 +55,13 @@ void QgsRasterShaderFunction::setMinimumValue( double theValue ) } /** - Generates and new RGB value based on one input value + Generates and new RGBA value based on one input value - @param theValue The original value to base a new RGB value on - @param theReturnRedValue The red component of the new RGB value - @param theReturnGreenValue The green component of the new RGB value - @param theReturnBlueValue The blue component of the new RGB value + @param theValue The original value to base a new RGBA value on + @param theReturnRedValue The red component of the new RGBA value + @param theReturnGreenValue The green component of the new RGBA value + @param theReturnBlueValue The blue component of the new RGBA value + @param theReturnAlphaValue The blue component of the new RGBA value @return True if the return values are valid otherwise false */ bool QgsRasterShaderFunction::shade( double theValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue, int* theReturnAlphaValue ) @@ -76,15 +77,17 @@ bool QgsRasterShaderFunction::shade( double theValue, int* theReturnRedValue, in } /** - Generates and new RGB value based on an original RGB value + Generates and new RGBA value based on an original RGBA value - @param theRedValue The red component of the original value to base a new RGB value on - @param theGreenValue The green component of the original value to base a new RGB value on - @param theBlueValue The blue component of the original value to base a new RGB value on - @param theReturnRedValue The red component of the new RGB value - @param theReturnGreenValue The green component of the new RGB value - @param theReturnBlueValue The blue component of the new RGB value + @param theRedValue The red component of the original value to base a new RGBA value on + @param theGreenValue The green component of the original value to base a new RGBA value on + @param theBlueValue The blue component of the original value to base a new RGBA value on + @param theAlphaValue The alpha component of the original value to base a new RGBA value on + @param theReturnRedValue The red component of the new RGBA value + @param theReturnGreenValue The green component of the new RGBA value + @param theReturnBlueValue The blue component of the new RGBA value + @param theReturnAlphaValue The alpha component of the new RGBA value @return True if the return values are valid otherwise false */ bool QgsRasterShaderFunction::shade( double theRedValue, double theGreenValue, double theBlueValue, double theAlphaValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue , int *theReturnAlphaValue ) diff --git a/src/core/symbology-ng/qgsmarkersymbollayerv2.h b/src/core/symbology-ng/qgsmarkersymbollayerv2.h index d6f428742d0d..ccfd287946a0 100644 --- a/src/core/symbology-ng/qgsmarkersymbollayerv2.h +++ b/src/core/symbology-ng/qgsmarkersymbollayerv2.h @@ -103,7 +103,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2 ////////// -#define DEFAULT_SVGMARKER_NAME "/symbol/Star1.svg" +#define DEFAULT_SVGMARKER_NAME "/crosses/Star1.svg" #define DEFAULT_SVGMARKER_SIZE 2*DEFAULT_POINT_SIZE #define DEFAULT_SVGMARKER_ANGLE 0 diff --git a/src/core/symbology-ng/qgssymbollayerv2utils.cpp b/src/core/symbology-ng/qgssymbollayerv2utils.cpp index 9161dc817551..592a23972e0d 100644 --- a/src/core/symbology-ng/qgssymbollayerv2utils.cpp +++ b/src/core/symbology-ng/qgssymbollayerv2utils.cpp @@ -1179,14 +1179,14 @@ bool QgsSymbolLayerV2Utils::needLinePatternFill( QDomElement &element ) QString name; QColor fillColor, borderColor; double size, borderWidth; - if ( !QgsSymbolLayerV2Utils::wellKnownMarkerFromSld( graphicElem, name, fillColor, borderColor, borderWidth, size ) ) + if ( !wellKnownMarkerFromSld( graphicElem, name, fillColor, borderColor, borderWidth, size ) ) return false; if ( name != "horline" ) return false; QString angleFunc; - if ( !QgsSymbolLayerV2Utils::rotationFromSldElement( graphicElem, angleFunc ) ) + if ( !rotationFromSldElement( graphicElem, angleFunc ) ) return false; bool ok; @@ -1197,7 +1197,11 @@ bool QgsSymbolLayerV2Utils::needLinePatternFill( QDomElement &element ) return true; } -bool QgsSymbolLayerV2Utils::needPointPatternFill( QDomElement &element ) { Q_UNUSED( element ); return false; } +bool QgsSymbolLayerV2Utils::needPointPatternFill( QDomElement &element ) +{ + Q_UNUSED( element ); + return false; +} bool QgsSymbolLayerV2Utils::needSvgFill( QDomElement &element ) { @@ -1256,11 +1260,11 @@ bool QgsSymbolLayerV2Utils::convertPolygonSymbolizerToPointMarker( QDomElement & { QgsStringMap map; map["name"] = "square"; - map["color"] = QgsSymbolLayerV2Utils::encodeColor( validFill ? fillColor : Qt::transparent ); - map["color_border"] = QgsSymbolLayerV2Utils::encodeColor( validBorder ? borderColor : Qt::transparent ); + map["color"] = encodeColor( validFill ? fillColor : Qt::transparent ); + map["color_border"] = encodeColor( validBorder ? borderColor : Qt::transparent ); map["size"] = QString::number( 6 ); map["angle"] = QString::number( 0 ); - map["offset"] = QgsSymbolLayerV2Utils::encodePoint( QPointF( 0, 0 ) ); + map["offset"] = encodePoint( QPointF( 0, 0 ) ); layers.append( QgsSymbolLayerV2Registry::instance()->createSymbolLayer( "SimpleMarker", map ) ); } } @@ -1439,7 +1443,7 @@ bool QgsSymbolLayerV2Utils::convertPolygonSymbolizerToPointMarker( QDomElement & if ( !qgsDoubleNear( angle, 0.0 ) ) map["angle"] = QString::number( angle ); if ( !offset.isNull() ) - map["offset"] = QgsSymbolLayerV2Utils::encodePoint( offset ); + map["offset"] = encodePoint( offset ); layers.append( QgsSymbolLayerV2Registry::instance()->createSymbolLayer( "SvgMarker", map ) ); } else if ( format == "ttf" ) @@ -1447,13 +1451,13 @@ bool QgsSymbolLayerV2Utils::convertPolygonSymbolizerToPointMarker( QDomElement & QgsStringMap map; map["font"] = name; map["chr"] = markIndex; - map["color"] = QgsSymbolLayerV2Utils::encodeColor( validFill ? fillColor : Qt::transparent ); + map["color"] = encodeColor( validFill ? fillColor : Qt::transparent ); if ( size > 0 ) map["size"] = QString::number( size ); if ( !qgsDoubleNear( angle, 0.0 ) ) map["angle"] = QString::number( angle ); if ( !offset.isNull() ) - map["offset"] = QgsSymbolLayerV2Utils::encodePoint( offset ); + map["offset"] = encodePoint( offset ); layers.append( QgsSymbolLayerV2Registry::instance()->createSymbolLayer( "FontMarker", map ) ); } } @@ -2254,7 +2258,7 @@ bool QgsSymbolLayerV2Utils::functionFromSldElement( QDomElement &element, QStrin } else { - function = expr->expression(); + function = expr->dump(); } delete expr; diff --git a/tests/src/core/testqgsexpression.cpp b/tests/src/core/testqgsexpression.cpp index a98e6115cc1e..955c5f36b09b 100644 --- a/tests/src/core/testqgsexpression.cpp +++ b/tests/src/core/testqgsexpression.cpp @@ -351,14 +351,14 @@ class TestQgsExpression: public QObject QTest::newRow( "negative age" ) << "age('2012-06-28','2012-06-30')" << false << QVariant::fromValue( QgsExpression::Interval( -172800 ) ); // Color functions - QTest::newRow( "ramp color" ) << "ramp_color('Spectral',0.3)" << false << QVariant( "#fdbe73" ); - QTest::newRow( "color rgb" ) << "color_rgb(255,127,0)" << false << QVariant( "#ff7f00" ); + QTest::newRow( "ramp color" ) << "ramp_color('Spectral',0.3)" << false << QVariant( "253,190,115,255" ); + QTest::newRow( "color rgb" ) << "color_rgb(255,127,0)" << false << QVariant( "255,127,0" ); QTest::newRow( "color rgba" ) << "color_rgba(255,127,0,200)" << false << QVariant( "255,127,0,200" ); - QTest::newRow( "color hsl" ) << "color_hsl(100,50,70)" << false << QVariant( "#a6d98c" ); + QTest::newRow( "color hsl" ) << "color_hsl(100,50,70)" << false << QVariant( "166,217,140" ); QTest::newRow( "color hsla" ) << "color_hsla(100,50,70,200)" << false << QVariant( "166,217,140,200" ); - QTest::newRow( "color hsv" ) << "color_hsv(40,100,100)" << false << QVariant( "#ffaa00" ); + QTest::newRow( "color hsv" ) << "color_hsv(40,100,100)" << false << QVariant( "255,170,0" ); QTest::newRow( "color hsva" ) << "color_hsva(40,100,100,200)" << false << QVariant( "255,170,0,200" ); - QTest::newRow( "color cmyk" ) << "color_cmyk(100,50,33,10)" << false << QVariant( "#00739a" ); + QTest::newRow( "color cmyk" ) << "color_cmyk(100,50,33,10)" << false << QVariant( "0,115,154" ); QTest::newRow( "color cmyka" ) << "color_cmyka(50,25,90,60,200)" << false << QVariant( "51,76,10,200" ); } diff --git a/tests/testdata/symbol_layer/QgsSVGFillSymbolLayer.sld b/tests/testdata/symbol_layer/QgsSVGFillSymbolLayer.sld index bc40f651b773..941c0787e30b 100644 --- a/tests/testdata/symbol_layer/QgsSVGFillSymbolLayer.sld +++ b/tests/testdata/symbol_layer/QgsSVGFillSymbolLayer.sld @@ -12,14 +12,14 @@ - + image/svg+xml 6 #000000 3 - 4 + 3 diff --git a/tests/testdata/symbol_layer/QgsSvgMarkerSymbolLayerV2.sld b/tests/testdata/symbol_layer/QgsSvgMarkerSymbolLayerV2.sld index 9b0271577304..7ca614de8a2e 100644 --- a/tests/testdata/symbol_layer/QgsSvgMarkerSymbolLayerV2.sld +++ b/tests/testdata/symbol_layer/QgsSvgMarkerSymbolLayerV2.sld @@ -10,7 +10,7 @@ - + image/svg+xml 12