Skip to content

Commit

Permalink
fix some tests and some doxygen warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 19, 2013
1 parent dd5e1b5 commit 4109a10
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 43 deletions.
27 changes: 15 additions & 12 deletions src/core/raster/qgsrastershader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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 )
Expand Down
27 changes: 15 additions & 12 deletions src/core/raster/qgsrastershaderfunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsmarkersymbollayerv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 14 additions & 10 deletions src/core/symbology-ng/qgssymbollayerv2utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 )
{
Expand Down Expand Up @@ -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 ) );
}
}
Expand Down Expand Up @@ -1439,21 +1443,21 @@ 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" )
{
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 ) );
}
}
Expand Down Expand Up @@ -2254,7 +2258,7 @@ bool QgsSymbolLayerV2Utils::functionFromSldElement( QDomElement &element, QStrin
}
else
{
function = expr->expression();
function = expr->dump();
}

delete expr;
Expand Down
10 changes: 5 additions & 5 deletions tests/src/core/testqgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
}

Expand Down
4 changes: 2 additions & 2 deletions tests/testdata/symbol_layer/QgsSVGFillSymbolLayer.sld
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
<se:GraphicFill>
<se:Graphic>
<se:ExternalGraphic>
<OnlineResource xlink:type="simple" xlink:href="C:/Program Files/qgis1.8.0/./svg/accommodation/accommodation_camping.svg"/>
<OnlineResource xlink:type="simple" xlink:href="file:accommodation/accommodation_camping.svg"/>
<Format>image/svg+xml</Format>
</se:ExternalGraphic>
<se:Size>6</se:Size>
<se:SvgParameter name="stroke">#000000</se:SvgParameter>
<se:SvgParameter name="stroke-width">3</se:SvgParameter>
<se:Rotation>
<ogc:Literal>4</ogc:Literal>
<ogc:Literal>3</ogc:Literal>
</se:Rotation>
</se:Graphic>
</se:GraphicFill>
Expand Down
2 changes: 1 addition & 1 deletion tests/testdata/symbol_layer/QgsSvgMarkerSymbolLayerV2.sld
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<se:PointSymbolizer>
<se:Graphic>
<se:ExternalGraphic>
<OnlineResource xlink:type="simple" xlink:href="C:/Program Files/qgis1.8.0/svg/gpsicons/skull.svg"/>
<OnlineResource xlink:type="simple" xlink:href="file:gpsicons/skull.svg"/>
<Format>image/svg+xml</Format>
</se:ExternalGraphic>
<se:Size>12</se:Size>
Expand Down

0 comments on commit 4109a10

Please sign in to comment.