Skip to content

Commit

Permalink
Small data defined code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 7, 2015
1 parent 3747aae commit 479ef79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
Expand Up @@ -163,31 +163,31 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& propertie
//compatibility with old project file format
if ( !properties["width_field"].isEmpty() )
{
layer->setDataDefinedProperty( "width", new QgsDataDefined( new QgsExpression( properties["width_field"] ) ) );
layer->setDataDefinedProperty( "width", new QgsDataDefined( properties["width_field"] ) );
}
if ( !properties["height_field"].isEmpty() )
{
layer->setDataDefinedProperty( "height", new QgsDataDefined( new QgsExpression( properties["height_field"] ) ) );
layer->setDataDefinedProperty( "height", new QgsDataDefined( properties["height_field"] ) );
}
if ( !properties["rotation_field"].isEmpty() )
{
layer->setDataDefinedProperty( "rotation", new QgsDataDefined( new QgsExpression( properties["rotation_field"] ) ) );
layer->setDataDefinedProperty( "rotation", new QgsDataDefined( properties["rotation_field"] ) );
}
if ( !properties["outline_width_field"].isEmpty() )
{
layer->setDataDefinedProperty( "outline_width", new QgsDataDefined( new QgsExpression( properties[ "outline_width_field" ] ) ) );
layer->setDataDefinedProperty( "outline_width", new QgsDataDefined( properties[ "outline_width_field" ] ) );
}
if ( !properties["fill_color_field"].isEmpty() )
{
layer->setDataDefinedProperty( "fill_color", new QgsDataDefined( new QgsExpression( properties["fill_color_field"] ) ) );
layer->setDataDefinedProperty( "fill_color", new QgsDataDefined( properties["fill_color_field"] ) );
}
if ( !properties["outline_color_field"].isEmpty() )
{
layer->setDataDefinedProperty( "outline_color", new QgsDataDefined( new QgsExpression( properties["outline_color_field"] ) ) );
layer->setDataDefinedProperty( "outline_color", new QgsDataDefined( properties["outline_color_field"] ) );
}
if ( !properties["symbol_name_field"].isEmpty() )
{
layer->setDataDefinedProperty( "symbol_name", new QgsDataDefined( new QgsExpression( properties["symbol_name_field"] ) ) );
layer->setDataDefinedProperty( "symbol_name", new QgsDataDefined( properties["symbol_name_field"] ) );
}

return layer;
Expand Down
6 changes: 3 additions & 3 deletions src/core/symbology-ng/qgsrulebasedrendererv2.cpp
Expand Up @@ -1220,7 +1220,7 @@ void QgsRuleBasedRendererV2::convertToDataDefinedSymbology( QgsSymbolV2* symbol,
if ( ! sizeScaleField.isNull() )
{
sizeExpression = QString( "%1*(%2)" ).arg( msl->size() ).arg( sizeScaleField );
msl->setDataDefinedProperty( "size", new QgsDataDefined( new QgsExpression( sizeExpression ) ) );
msl->setDataDefinedProperty( "size", new QgsDataDefined( sizeExpression ) );
}
if ( ! rotationField.isNull() )
{
Expand All @@ -1237,7 +1237,7 @@ void QgsRuleBasedRendererV2::convertToDataDefinedSymbology( QgsSymbolV2* symbol,
{
QgsLineSymbolLayerV2* lsl = static_cast<QgsLineSymbolLayerV2*>( symbol->symbolLayer( j ) );
sizeExpression = QString( "%1*(%2)" ).arg( lsl->width() ).arg( sizeScaleField );
lsl->setDataDefinedProperty( "width", new QgsDataDefined( new QgsExpression( sizeExpression ) ) );
lsl->setDataDefinedProperty( "width", new QgsDataDefined( sizeExpression ) );
}
if ( symbol->symbolLayer( j )->layerType() == "MarkerLine" )
{
Expand All @@ -1246,7 +1246,7 @@ void QgsRuleBasedRendererV2::convertToDataDefinedSymbology( QgsSymbolV2* symbol,
{
QgsMarkerSymbolLayerV2* msl = static_cast<QgsMarkerSymbolLayerV2*>( marker->symbolLayer( k ) );
sizeExpression = QString( "%1*(%2)" ).arg( msl->size() ).arg( sizeScaleField );
msl->setDataDefinedProperty( "size", new QgsDataDefined( new QgsExpression( sizeExpression ) ) );
msl->setDataDefinedProperty( "size", new QgsDataDefined( sizeExpression ) );
}
}
}
Expand Down

0 comments on commit 479ef79

Please sign in to comment.