QgsFeatureRendererV2* QgsPointDisplacementRenderer::create( QDomElement& symbologyElem ) { QgsPointDisplacementRenderer* r = new QgsPointDisplacementRenderer(); r->setLabelAttributeName( symbologyElem.attribute( "labelAttributeName" ) ); QFont labelFont; labelFont.fromString( symbologyElem.attribute( "labelFont", "" ) ); r->setLabelFont( labelFont ); r->setCircleWidth( symbologyElem.attribute( "circleWidth", "0.4" ).toDouble() ); r->setCircleColor( QgsSymbolLayerV2Utils::decodeColor( symbologyElem.attribute( "circleColor", "" ) ) ); r->setLabelColor( QgsSymbolLayerV2Utils::decodeColor( symbologyElem.attribute( "labelColor", "" ) ) ); r->setCircleRadiusAddition( symbologyElem.attribute( "circleRadiusAddition", "0.0" ).toDouble() ); r->setMaxLabelScaleDenominator( symbologyElem.attribute( "maxLabelScaleDenominator", "-1" ).toDouble() ); //look for an embedded renderer <renderer-v2> QDomElement embeddedRendererElem = symbologyElem.firstChildElement( "renderer-v2" ); if ( !embeddedRendererElem.isNull() ) { r->setEmbeddedRenderer( QgsFeatureRendererV2::load( embeddedRendererElem ) ); } //center symbol QDomElement centerSymbolElem = symbologyElem.firstChildElement( "symbol" ); if ( !centerSymbolElem.isNull() ) { r->setCenterSymbol( dynamic_cast<QgsMarkerSymbolV2*>( QgsSymbolLayerV2Utils::loadSymbol( centerSymbolElem ) ) ); } return r; }
QgsFeatureRendererV2* QgsPointDisplacementRenderer::create( QDomElement& symbologyElem ) { QgsPointDisplacementRenderer* r = new QgsPointDisplacementRenderer(); r->setLabelAttributeName( symbologyElem.attribute( "labelAttributeName" ) ); QFont labelFont; if ( !QgsFontUtils::setFromXmlChildNode( labelFont, symbologyElem, "labelFontProperties" ) ) { labelFont.fromString( symbologyElem.attribute( "labelFont", "" ) ); } r->setLabelFont( labelFont ); r->setPlacement(( Placement )symbologyElem.attribute( "placement", "0" ).toInt() ); r->setCircleWidth( symbologyElem.attribute( "circleWidth", "0.4" ).toDouble() ); r->setCircleColor( QgsSymbolLayerV2Utils::decodeColor( symbologyElem.attribute( "circleColor", "" ) ) ); r->setLabelColor( QgsSymbolLayerV2Utils::decodeColor( symbologyElem.attribute( "labelColor", "" ) ) ); r->setCircleRadiusAddition( symbologyElem.attribute( "circleRadiusAddition", "0.0" ).toDouble() ); r->setMaxLabelScaleDenominator( symbologyElem.attribute( "maxLabelScaleDenominator", "-1" ).toDouble() ); r->setTolerance( symbologyElem.attribute( "tolerance", "0.00001" ).toDouble() ); r->setToleranceUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( symbologyElem.attribute( "toleranceUnit", "MapUnit" ) ) ); r->setToleranceMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( symbologyElem.attribute( "toleranceUnitScale" ) ) ); //look for an embedded renderer <renderer-v2> QDomElement embeddedRendererElem = symbologyElem.firstChildElement( "renderer-v2" ); if ( !embeddedRendererElem.isNull() ) { r->setEmbeddedRenderer( QgsFeatureRendererV2::load( embeddedRendererElem ) ); } //center symbol QDomElement centerSymbolElem = symbologyElem.firstChildElement( "symbol" ); if ( !centerSymbolElem.isNull() ) { r->setCenterSymbol( QgsSymbolLayerV2Utils::loadSymbol<QgsMarkerSymbolV2>( centerSymbolElem ) ); } return r; }
QgsFeatureRenderer *QgsPointDisplacementRenderer::create( QDomElement &symbologyElem, const QgsReadWriteContext &context ) { QgsPointDisplacementRenderer *r = new QgsPointDisplacementRenderer(); r->setLabelAttributeName( symbologyElem.attribute( QStringLiteral( "labelAttributeName" ) ) ); QFont labelFont; if ( !QgsFontUtils::setFromXmlChildNode( labelFont, symbologyElem, QStringLiteral( "labelFontProperties" ) ) ) { labelFont.fromString( symbologyElem.attribute( QStringLiteral( "labelFont" ), QString() ) ); } r->setLabelFont( labelFont ); r->setPlacement( static_cast< Placement >( symbologyElem.attribute( QStringLiteral( "placement" ), QStringLiteral( "0" ) ).toInt() ) ); r->setCircleWidth( symbologyElem.attribute( QStringLiteral( "circleWidth" ), QStringLiteral( "0.4" ) ).toDouble() ); r->setCircleColor( QgsSymbolLayerUtils::decodeColor( symbologyElem.attribute( QStringLiteral( "circleColor" ), QString() ) ) ); r->setLabelColor( QgsSymbolLayerUtils::decodeColor( symbologyElem.attribute( QStringLiteral( "labelColor" ), QString() ) ) ); r->setCircleRadiusAddition( symbologyElem.attribute( QStringLiteral( "circleRadiusAddition" ), QStringLiteral( "0.0" ) ).toDouble() ); r->setMinimumLabelScale( symbologyElem.attribute( QStringLiteral( "maxLabelScaleDenominator" ), QStringLiteral( "-1" ) ).toDouble() ); r->setTolerance( symbologyElem.attribute( QStringLiteral( "tolerance" ), QStringLiteral( "0.00001" ) ).toDouble() ); r->setToleranceUnit( QgsUnitTypes::decodeRenderUnit( symbologyElem.attribute( QStringLiteral( "toleranceUnit" ), QStringLiteral( "MapUnit" ) ) ) ); r->setToleranceMapUnitScale( QgsSymbolLayerUtils::decodeMapUnitScale( symbologyElem.attribute( QStringLiteral( "toleranceUnitScale" ) ) ) ); //look for an embedded renderer <renderer-v2> QDomElement embeddedRendererElem = symbologyElem.firstChildElement( QStringLiteral( "renderer-v2" ) ); if ( !embeddedRendererElem.isNull() ) { r->setEmbeddedRenderer( QgsFeatureRenderer::load( embeddedRendererElem, context ) ); } //center symbol QDomElement centerSymbolElem = symbologyElem.firstChildElement( QStringLiteral( "symbol" ) ); if ( !centerSymbolElem.isNull() ) { r->setCenterSymbol( QgsSymbolLayerUtils::loadSymbol<QgsMarkerSymbol>( centerSymbolElem, context ) ); } return r; }
QgsFeatureRendererV2* QgsPointDisplacementRenderer::clone() { QgsPointDisplacementRenderer* r = new QgsPointDisplacementRenderer( mLabelAttributeName ); r->setEmbeddedRenderer( mRenderer->clone() ); r->setCircleWidth( mCircleWidth ); r->setCircleColor( mCircleColor ); r->setLabelFont( mLabelFont ); r->setLabelColor( mLabelColor ); r->setCircleRadiusAddition( mCircleRadiusAddition ); r->setMaxLabelScaleDenominator( mMaxLabelScaleDenominator ); r->setTolerance( mTolerance ); if ( mCenterSymbol ) { r->setCenterSymbol( dynamic_cast<QgsMarkerSymbolV2*>( mCenterSymbol->clone() ) ); } return r; }
QgsPointDisplacementRenderer* QgsPointDisplacementRenderer::clone() const { QgsPointDisplacementRenderer* r = new QgsPointDisplacementRenderer( mLabelAttributeName ); r->setEmbeddedRenderer( mRenderer->clone() ); r->setCircleWidth( mCircleWidth ); r->setCircleColor( mCircleColor ); r->setLabelFont( mLabelFont ); r->setLabelColor( mLabelColor ); r->setPlacement( mPlacement ); r->setCircleRadiusAddition( mCircleRadiusAddition ); r->setMaxLabelScaleDenominator( mMaxLabelScaleDenominator ); r->setTolerance( mTolerance ); r->setToleranceUnit( mToleranceUnit ); r->setToleranceMapUnitScale( mToleranceMapUnitScale ); if ( mCenterSymbol ) { r->setCenterSymbol( mCenterSymbol->clone() ); } copyRendererData( r ); return r; }