Ejemplo n.º 1
0
QgsFeatureRendererV2* QgsHeatmapRenderer::create( QDomElement& element )
{
  QgsHeatmapRenderer* r = new QgsHeatmapRenderer();
  r->setRadius( element.attribute( "radius", "50.0" ).toFloat() );
  r->setRadiusUnit(( QgsSymbolV2::OutputUnit )element.attribute( "radius_unit", "0" ).toInt() );
  r->setRadiusMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( element.attribute( "radius_map_unit_scale", QString() ) ) );
  r->setMaximumValue( element.attribute( "max_value", "0.0" ).toFloat() );
  r->setRenderQuality( element.attribute( "quality", "0" ).toInt() );
  r->setWeightExpression( element.attribute( "weight_expression" ) );

  QDomElement sourceColorRampElem = element.firstChildElement( "colorramp" );
  if ( !sourceColorRampElem.isNull() && sourceColorRampElem.attribute( "name" ) == "[source]" )
  {
    r->setColorRamp( QgsSymbolLayerV2Utils::loadColorRamp( sourceColorRampElem ) );
  }
  r->setInvertRamp( element.attribute( "invert_ramp", "0" ).toInt() );
  return r;
}
Ejemplo n.º 2
0
QgsFeatureRendererV2* QgsHeatmapRenderer::clone() const
{
  QgsHeatmapRenderer* newRenderer = new QgsHeatmapRenderer();
  if ( mGradientRamp )
  {
    newRenderer->setColorRamp( mGradientRamp->clone() );
  }
  newRenderer->setInvertRamp( mInvertRamp );
  newRenderer->setRadius( mRadius );
  newRenderer->setRadiusUnit( mRadiusUnit );
  newRenderer->setRadiusMapUnitScale( mRadiusMapUnitScale );
  newRenderer->setMaximumValue( mExplicitMax );
  newRenderer->setRenderQuality( mRenderQuality );
  newRenderer->setWeightExpression( mWeightExpressionString );
  copyPaintEffect( newRenderer );

  return newRenderer;
}