Skip to content
Permalink
Browse files

Small data defined code cleanups

  • Loading branch information
nyalldawson committed May 7, 2015
1 parent 3747aae commit 479ef793c1f1910a38b7c813e35203720927e3eb
@@ -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;
@@ -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() )
{
@@ -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" )
{
@@ -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 ) );
}
}
}

0 comments on commit 479ef79

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