QgsEllipseSymbolLayerV2* QgsEllipseSymbolLayerV2::clone() const { QgsEllipseSymbolLayerV2* m = new QgsEllipseSymbolLayerV2(); m->setSymbolName( mSymbolName ); m->setSymbolWidth( mSymbolWidth ); m->setSymbolHeight( mSymbolHeight ); m->setOutlineStyle( mOutlineStyle ); m->setOffset( mOffset ); m->setOffsetUnit( mOffsetUnit ); m->setOffsetMapUnitScale( mOffsetMapUnitScale ); m->setOutlineStyle( mOutlineStyle ); m->setPenJoinStyle( mPenJoinStyle ); m->setOutlineWidth( mOutlineWidth ); m->setColor( color() ); m->setOutlineColor( mOutlineColor ); m->setSymbolWidthUnit( mSymbolWidthUnit ); m->setSymbolWidthMapUnitScale( mSymbolWidthMapUnitScale ); m->setSymbolHeightUnit( mSymbolHeightUnit ); m->setSymbolHeightMapUnitScale( mSymbolHeightMapUnitScale ); m->setOutlineWidthUnit( mOutlineWidthUnit ); m->setOutlineWidthMapUnitScale( mOutlineWidthMapUnitScale ); m->setAngle( mAngle ); m->setHorizontalAnchorPoint( mHorizontalAnchorPoint ); m->setVerticalAnchorPoint( mVerticalAnchorPoint ); copyDataDefinedProperties( m ); copyPaintEffect( m ); return m; }
QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& properties ) { QgsEllipseSymbolLayerV2* layer = new QgsEllipseSymbolLayerV2(); if ( properties.contains( "symbol_name" ) ) { layer->setSymbolName( properties[ "symbol_name" ] ); } if ( properties.contains( "symbol_width" ) ) { layer->setSymbolWidth( properties["symbol_width"].toDouble() ); } if ( properties.contains( "symbol_width_unit" ) ) { layer->setSymbolWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["symbol_width_unit"] ) ); } if ( properties.contains( "symbol_width_map_unit_scale" ) ) { layer->setSymbolWidthMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( properties["symbol_width_map_unit_scale"] ) ); } if ( properties.contains( "symbol_height" ) ) { layer->setSymbolHeight( properties["symbol_height"].toDouble() ); } if ( properties.contains( "symbol_height_unit" ) ) { layer->setSymbolHeightUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["symbol_height_unit"] ) ); } if ( properties.contains( "symbol_height_map_unit_scale" ) ) { layer->setSymbolHeightMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( properties["symbol_height_map_unit_scale"] ) ); } if ( properties.contains( "angle" ) ) { layer->setAngle( properties["angle"].toDouble() ); } if ( properties.contains( "outline_style" ) ) { layer->setOutlineStyle( QgsSymbolLayerV2Utils::decodePenStyle( properties["outline_style"] ) ); } else if ( properties.contains( "line_style" ) ) { layer->setOutlineStyle( QgsSymbolLayerV2Utils::decodePenStyle( properties["line_style"] ) ); } if ( properties.contains( "joinstyle" ) ) { layer->setPenJoinStyle( QgsSymbolLayerV2Utils::decodePenJoinStyle( properties["joinstyle"] ) ); } if ( properties.contains( "outline_width" ) ) { layer->setOutlineWidth( properties["outline_width"].toDouble() ); } else if ( properties.contains( "line_width" ) ) { layer->setOutlineWidth( properties["line_width"].toDouble() ); } if ( properties.contains( "outline_width_unit" ) ) { layer->setOutlineWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["outline_width_unit"] ) ); } else if ( properties.contains( "line_width_unit" ) ) { layer->setOutlineWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["line_width_unit"] ) ); } if ( properties.contains( "outline_width_map_unit_scale" ) ) { layer->setOutlineWidthMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( properties["outline_width_map_unit_scale"] ) ); } if ( properties.contains( "fill_color" ) ) { //pre 2.5 projects used "fill_color" layer->setFillColor( QgsSymbolLayerV2Utils::decodeColor( properties["fill_color"] ) ); } else if ( properties.contains( "color" ) ) { layer->setFillColor( QgsSymbolLayerV2Utils::decodeColor( properties["color"] ) ); } if ( properties.contains( "outline_color" ) ) { layer->setOutlineColor( QgsSymbolLayerV2Utils::decodeColor( properties["outline_color"] ) ); } else if ( properties.contains( "line_color" ) ) { layer->setOutlineColor( QgsSymbolLayerV2Utils::decodeColor( properties["line_color"] ) ); } if ( properties.contains( "size" ) ) { layer->setSize( properties["size"].toDouble() ); } if ( properties.contains( "size_unit" ) ) { layer->setSizeUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["size_unit"] ) ); } if ( properties.contains( "size_map_unit_scale" ) ) { layer->setSizeMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( properties["size_map_unit_scale"] ) ); } if ( properties.contains( "offset" ) ) { layer->setOffset( QgsSymbolLayerV2Utils::decodePoint( properties["offset"] ) ); } if ( properties.contains( "offset_unit" ) ) { layer->setOffsetUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["offset_unit"] ) ); } if ( properties.contains( "offset_map_unit_scale" ) ) { layer->setOffsetMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( properties["offset_map_unit_scale"] ) ); } if ( properties.contains( "horizontal_anchor_point" ) ) { layer->setHorizontalAnchorPoint( QgsMarkerSymbolLayerV2::HorizontalAnchorPoint( properties[ "horizontal_anchor_point" ].toInt() ) ); } if ( properties.contains( "vertical_anchor_point" ) ) { layer->setVerticalAnchorPoint( QgsMarkerSymbolLayerV2::VerticalAnchorPoint( properties[ "vertical_anchor_point" ].toInt() ) ); } //data defined properties layer->restoreDataDefinedProperties( properties ); //compatibility with old project file format if ( !properties["width_field"].isEmpty() ) { layer->setDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH, new QgsDataDefined( properties["width_field"] ) ); } if ( !properties["height_field"].isEmpty() ) { layer->setDataDefinedProperty( QgsSymbolLayerV2::EXPR_HEIGHT, new QgsDataDefined( properties["height_field"] ) ); } if ( !properties["rotation_field"].isEmpty() ) { layer->setDataDefinedProperty( QgsSymbolLayerV2::EXPR_ROTATION, new QgsDataDefined( properties["rotation_field"] ) ); } if ( !properties["outline_width_field"].isEmpty() ) { layer->setDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, new QgsDataDefined( properties[ "outline_width_field" ] ) ); } if ( !properties["fill_color_field"].isEmpty() ) { layer->setDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL_COLOR, new QgsDataDefined( properties["fill_color_field"] ) ); } if ( !properties["outline_color_field"].isEmpty() ) { layer->setDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_COLOR, new QgsDataDefined( properties["outline_color_field"] ) ); } if ( !properties["symbol_name_field"].isEmpty() ) { layer->setDataDefinedProperty( QgsSymbolLayerV2::EXPR_SYMBOL_NAME, new QgsDataDefined( properties["symbol_name_field"] ) ); } return layer; }