39void QgsDiagramLayerSettings::initPropertyDefinitions()
 
   41  if ( !sPropertyDefinitions.isEmpty() )
 
   44  const QString origin = QStringLiteral( 
"diagram" );
 
   65  initPropertyDefinitions();
 
   66  return sPropertyDefinitions;
 
 
   71  initPropertyDefinitions();
 
 
   76  , mPlacement( rh.mPlacement )
 
   77  , mPlacementFlags( rh.mPlacementFlags )
 
   78  , mPriority( rh.mPriority )
 
   79  , mZIndex( rh.mZIndex )
 
   80  , mObstacle( rh.mObstacle )
 
   81  , mDistance( rh.mDistance )
 
   82  , mRenderer( rh.mRenderer ? rh.mRenderer->clone() : nullptr )
 
   83  , mShowAll( rh.mShowAll )
 
   84  , mDataDefinedProperties( rh.mDataDefinedProperties )
 
   86  initPropertyDefinitions();
 
 
   91  mPlacement = rh.mPlacement;
 
   92  mPlacementFlags = rh.mPlacementFlags;
 
   93  mPriority = rh.mPriority;
 
   95  mObstacle = rh.mObstacle;
 
   96  mDistance = rh.mDistance;
 
   97  mRenderer = rh.mRenderer ? rh.mRenderer->
clone() : 
nullptr;
 
   99  mShowAll = rh.mShowAll;
 
  100  mDataDefinedProperties = rh.mDataDefinedProperties;
 
 
  111  if ( diagramRenderer == mRenderer )
 
  115  mRenderer = diagramRenderer;
 
 
  125  const QDomNodeList propertyElems = elem.elementsByTagName( QStringLiteral( 
"properties" ) );
 
  126  if ( !propertyElems.isEmpty() )
 
  128    ( void )mDataDefinedProperties.
readXml( propertyElems.at( 0 ).toElement(), sPropertyDefinitions );
 
  132    mDataDefinedProperties.
clear();
 
  135  mPlacement = 
static_cast< Placement >( elem.attribute( QStringLiteral( 
"placement" ) ).toInt() );
 
  136  mPlacementFlags = 
static_cast< LinePlacementFlag >( elem.attribute( QStringLiteral( 
"linePlacementFlags" ) ).toInt() );
 
  137  mPriority = elem.attribute( QStringLiteral( 
"priority" ) ).toInt();
 
  138  mZIndex = elem.attribute( QStringLiteral( 
"zIndex" ) ).toDouble();
 
  139  mObstacle = elem.attribute( QStringLiteral( 
"obstacle" ) ).toInt();
 
  140  mDistance = elem.attribute( QStringLiteral( 
"dist" ) ).toDouble();
 
  141  mShowAll = ( elem.attribute( QStringLiteral( 
"showAll" ), QStringLiteral( 
"0" ) ) != QLatin1String( 
"0" ) );
 
 
  146  QDomElement diagramLayerElem = doc.createElement( QStringLiteral( 
"DiagramLayerSettings" ) );
 
  147  QDomElement propertiesElem = doc.createElement( QStringLiteral( 
"properties" ) );
 
  148  ( void )mDataDefinedProperties.
writeXml( propertiesElem, sPropertyDefinitions );
 
  149  diagramLayerElem.appendChild( propertiesElem );
 
  150  diagramLayerElem.setAttribute( QStringLiteral( 
"placement" ), mPlacement );
 
  151  diagramLayerElem.setAttribute( QStringLiteral( 
"linePlacementFlags" ), mPlacementFlags );
 
  152  diagramLayerElem.setAttribute( QStringLiteral( 
"priority" ), mPriority );
 
  153  diagramLayerElem.setAttribute( QStringLiteral( 
"zIndex" ), mZIndex );
 
  154  diagramLayerElem.setAttribute( QStringLiteral( 
"obstacle" ), mObstacle );
 
  155  diagramLayerElem.setAttribute( QStringLiteral( 
"dist" ), QString::number( mDistance ) );
 
  156  diagramLayerElem.setAttribute( QStringLiteral( 
"showAll" ), mShowAll );
 
  157  layerElem.appendChild( diagramLayerElem );
 
 
  162  return mDataDefinedProperties.
prepare( context );
 
 
  167  QSet< QString > referenced;
 
 
  179  enabled = ( elem.attribute( QStringLiteral( 
"enabled" ), QStringLiteral( 
"1" ) ) != QLatin1String( 
"0" ) );
 
  182    font.fromString( elem.attribute( QStringLiteral( 
"font" ) ) );
 
  184  backgroundColor.setNamedColor( elem.attribute( QStringLiteral( 
"backgroundColor" ) ) );
 
  185  backgroundColor.setAlpha( elem.attribute( QStringLiteral( 
"backgroundAlpha" ) ).toInt() );
 
  186  size.setWidth( elem.attribute( QStringLiteral( 
"width" ) ).toDouble() );
 
  187  size.setHeight( elem.attribute( QStringLiteral( 
"height" ) ).toDouble() );
 
  188  if ( elem.hasAttribute( QStringLiteral( 
"transparency" ) ) )
 
  190    opacity = 1 - elem.attribute( QStringLiteral( 
"transparency" ), QStringLiteral( 
"0" ) ).toInt() / 255.0;
 
  194    opacity = elem.attribute( QStringLiteral( 
"opacity" ), QStringLiteral( 
"1.00" ) ).toDouble();
 
  197  penColor.setNamedColor( elem.attribute( QStringLiteral( 
"penColor" ) ) );
 
  198  const int penAlpha = elem.attribute( QStringLiteral( 
"penAlpha" ), QStringLiteral( 
"255" ) ).toInt();
 
  200  penWidth = elem.attribute( QStringLiteral( 
"penWidth" ) ).toDouble();
 
  202  mDirection = 
static_cast< Direction >( elem.attribute( QStringLiteral( 
"direction" ), QStringLiteral( 
"1" ) ).toInt() );
 
  204  maximumScale = elem.attribute( QStringLiteral( 
"minScaleDenominator" ), QStringLiteral( 
"-1" ) ).toDouble();
 
  205  minimumScale = elem.attribute( QStringLiteral( 
"maxScaleDenominator" ), QStringLiteral( 
"-1" ) ).toDouble();
 
  206  if ( elem.hasAttribute( QStringLiteral( 
"scaleBasedVisibility" ) ) )
 
  208    scaleBasedVisibility = ( elem.attribute( QStringLiteral( 
"scaleBasedVisibility" ), QStringLiteral( 
"1" ) ) != QLatin1String( 
"0" ) );
 
  216  if ( elem.attribute( QStringLiteral( 
"sizeType" ) ) == QLatin1String( 
"MapUnits" ) )
 
  231  mSpacing = elem.attribute( QStringLiteral( 
"spacing" ) ).toDouble();
 
  236  if ( elem.attribute( QStringLiteral( 
"labelPlacementMethod" ) ) == QLatin1String( 
"Height" ) )
 
  246  if ( elem.attribute( QStringLiteral( 
"diagramOrientation" ) ) == QLatin1String( 
"Left" ) )
 
  250  else if ( elem.attribute( QStringLiteral( 
"diagramOrientation" ) ) == QLatin1String( 
"Right" ) )
 
  254  else if ( elem.attribute( QStringLiteral( 
"diagramOrientation" ) ) == QLatin1String( 
"Down" ) )
 
  264  if ( elem.attribute( QStringLiteral( 
"scaleDependency" ) ) == QLatin1String( 
"Diameter" ) )
 
  273  barWidth = elem.attribute( QStringLiteral( 
"barWidth" ) ).toDouble();
 
  275  if ( elem.hasAttribute( QStringLiteral( 
"angleOffset" ) ) )
 
  276    rotationOffset = std::fmod( 360.0 - elem.attribute( QStringLiteral( 
"angleOffset" ) ).toInt() / 16.0, 360.0 );
 
  278    rotationOffset = elem.attribute( QStringLiteral( 
"rotationOffset" ) ).toDouble();
 
  280  minimumSize = elem.attribute( QStringLiteral( 
"minimumSize" ) ).toDouble();
 
  282  const QDomNodeList axisSymbolNodes = elem.elementsByTagName( QStringLiteral( 
"axisSymbol" ) );
 
  283  if ( axisSymbolNodes.count() > 0 )
 
  285    const QDomElement axisSymbolElem = axisSymbolNodes.at( 0 ).toElement().firstChildElement();
 
  286    mAxisLineSymbol.reset( QgsSymbolLayerUtils::loadSymbol<QgsLineSymbol>( axisSymbolElem, context ) );
 
  290    mAxisLineSymbol = std::make_unique< QgsLineSymbol >();
 
  293  mShowAxis = elem.attribute( QStringLiteral( 
"showAxis" ), QStringLiteral( 
"0" ) ).toInt();
 
  297  const QDomNodeList attributes = elem.elementsByTagName( QStringLiteral( 
"attribute" ) );
 
  300  if ( attributes.length() > 0 )
 
  302    for ( 
int i = 0; i < attributes.size(); i++ )
 
  304      const QDomElement attrElem = attributes.at( i ).toElement();
 
  305      QColor newColor( attrElem.attribute( QStringLiteral( 
"color" ) ) );
 
  306      newColor.setAlphaF( attrElem.attribute( QStringLiteral( 
"colorOpacity" ), QStringLiteral( 
"1.0" ) ).toDouble() );
 
  309      categoryLabels.append( attrElem.attribute( QStringLiteral( 
"label" ) ) );
 
  320    const QStringList colorList = elem.attribute( QStringLiteral( 
"colors" ) ).split( 
'/' );
 
  321    QStringList::const_iterator colorIt = colorList.constBegin();
 
  322    for ( ; colorIt != colorList.constEnd(); ++colorIt )
 
  324      QColor newColor( *colorIt );
 
  330    const QStringList catList = elem.attribute( QStringLiteral( 
"categories" ) ).split( 
'/' );
 
  331    QStringList::const_iterator catIt = catList.constBegin();
 
  332    for ( ; catIt != catList.constEnd(); ++catIt )
 
  339  const QDomElement effectElem = elem.firstChildElement( QStringLiteral( 
"effect" ) );
 
  340  if ( !effectElem.isNull() )
 
 
  348  QDomElement categoryElem = doc.createElement( QStringLiteral( 
"DiagramCategory" ) );
 
  349  categoryElem.setAttribute( QStringLiteral( 
"enabled" ), 
enabled );
 
  351  categoryElem.setAttribute( QStringLiteral( 
"backgroundColor" ), 
backgroundColor.name() );
 
  352  categoryElem.setAttribute( QStringLiteral( 
"backgroundAlpha" ), 
backgroundColor.alpha() );
 
  353  categoryElem.setAttribute( QStringLiteral( 
"width" ), QString::number( 
size.width() ) );
 
  354  categoryElem.setAttribute( QStringLiteral( 
"height" ), QString::number( 
size.height() ) );
 
  355  categoryElem.setAttribute( QStringLiteral( 
"penColor" ), 
penColor.name() );
 
  356  categoryElem.setAttribute( QStringLiteral( 
"penAlpha" ), 
penColor.alpha() );
 
  357  categoryElem.setAttribute( QStringLiteral( 
"penWidth" ), QString::number( 
penWidth ) );
 
  359  categoryElem.setAttribute( QStringLiteral( 
"minScaleDenominator" ), QString::number( 
maximumScale ) );
 
  360  categoryElem.setAttribute( QStringLiteral( 
"maxScaleDenominator" ), QString::number( 
minimumScale ) );
 
  361  categoryElem.setAttribute( QStringLiteral( 
"opacity" ), QString::number( 
opacity ) );
 
  362  categoryElem.setAttribute( QStringLiteral( 
"spacing" ), QString::number( mSpacing ) );
 
  365  categoryElem.setAttribute( QStringLiteral( 
"direction" ), QString::number( mDirection ) );
 
  378    categoryElem.setAttribute( QStringLiteral( 
"labelPlacementMethod" ), QStringLiteral( 
"Height" ) );
 
  382    categoryElem.setAttribute( QStringLiteral( 
"labelPlacementMethod" ), QStringLiteral( 
"XHeight" ) );
 
  387    categoryElem.setAttribute( QStringLiteral( 
"scaleDependency" ), QStringLiteral( 
"Area" ) );
 
  391    categoryElem.setAttribute( QStringLiteral( 
"scaleDependency" ), QStringLiteral( 
"Diameter" ) );
 
  398      categoryElem.setAttribute( QStringLiteral( 
"diagramOrientation" ), QStringLiteral( 
"Left" ) );
 
  402      categoryElem.setAttribute( QStringLiteral( 
"diagramOrientation" ), QStringLiteral( 
"Right" ) );
 
  406      categoryElem.setAttribute( QStringLiteral( 
"diagramOrientation" ), QStringLiteral( 
"Down" ) );
 
  410      categoryElem.setAttribute( QStringLiteral( 
"diagramOrientation" ), QStringLiteral( 
"Up" ) );
 
  414  categoryElem.setAttribute( QStringLiteral( 
"barWidth" ), QString::number( 
barWidth ) );
 
  415  categoryElem.setAttribute( QStringLiteral( 
"minimumSize" ), QString::number( 
minimumSize ) );
 
  416  categoryElem.setAttribute( QStringLiteral( 
"rotationOffset" ), QString::number( 
rotationOffset ) );
 
  419  for ( 
int i = 0; i < nCats; ++i )
 
  421    QDomElement attributeElem = doc.createElement( QStringLiteral( 
"attribute" ) );
 
  424    attributeElem.setAttribute( QStringLiteral( 
"color" ), 
categoryColors.at( i ).name() );
 
  425    attributeElem.setAttribute( QStringLiteral( 
"colorOpacity" ), QString::number( 
categoryColors.at( i ).alphaF() ) );
 
  426    attributeElem.setAttribute( QStringLiteral( 
"label" ), 
categoryLabels.at( i ) );
 
  427    categoryElem.appendChild( attributeElem );
 
  430  categoryElem.setAttribute( QStringLiteral( 
"showAxis" ), mShowAxis ? QStringLiteral( 
"1" ) : QStringLiteral( 
"0" ) );
 
  431  QDomElement axisSymbolElem = doc.createElement( QStringLiteral( 
"axisSymbol" ) );
 
  433  axisSymbolElem.appendChild( symbolElem );
 
  434  categoryElem.appendChild( axisSymbolElem );
 
  437    mPaintEffect->saveProperties( doc, categoryElem );
 
  439  rendererElem.appendChild( categoryElem );
 
 
  451  : mDiagram( other.mDiagram ? other.mDiagram->clone() : nullptr )
 
  452  , mShowAttributeLegend( other.mShowAttributeLegend )
 
 
  482    c.expressionContext().setOriginalValueVariable( s.
penWidth );
 
  489  std::unique_ptr< QgsEffectPainter > effectPainter;
 
  490  if ( effect && effect->
enabled() )
 
  492    effectPainter = std::make_unique< QgsEffectPainter >( 
c, effect );
 
  495  mDiagram->renderDiagram( feature, 
c, s, pos );
 
 
  507  if ( size.isValid() )
 
  510    size.rheight() *= width / size.width();
 
  511    size.setWidth( width );
 
 
  518  QSet< QString > referenced;
 
  524  for ( 
const QString &att : constDiagramAttributes )
 
  528    for ( 
const QString &field : constReferencedColumns )
 
 
  538  if ( !size.isValid() )
 
  544  size.rwidth() *= pixelToMap;
 
  545  size.rheight() *= pixelToMap;
 
 
  552    QPaintDevice *device = painter->device();
 
  555      return device->logicalDpiX();
 
 
  565  const QString diagramType = elem.attribute( QStringLiteral( 
"diagramType" ) );
 
  566  if ( diagramType == QLatin1String( 
"Pie" ) )
 
  570  else if ( diagramType == QLatin1String( 
"Text" ) )
 
  574  else if ( diagramType == QLatin1String( 
"Histogram" ) )
 
  578  else if ( diagramType == QLatin1String( 
"Stacked" ) )
 
  587  mShowAttributeLegend = ( elem.attribute( QStringLiteral( 
"attributeLegend" ), QStringLiteral( 
"1" ) ) != QLatin1String( 
"0" ) );
 
 
  597    rendererElem.setAttribute( QStringLiteral( 
"diagramType" ), 
mDiagram->diagramName() );
 
 
  621  QList<QgsDiagramSettings> settingsList;
 
  622  settingsList.push_back( mSettings );
 
 
  628  const QDomElement categoryElem = elem.firstChildElement( QStringLiteral( 
"DiagramCategory" ) );
 
  629  if ( categoryElem.isNull() )
 
  634  mSettings.
readXml( categoryElem, context );
 
 
  640  QDomElement rendererElem = doc.createElement( QStringLiteral( 
"SingleCategoryDiagramRenderer" ) );
 
  641  mSettings.
writeXml( rendererElem, doc, context );
 
  643  layerElem.appendChild( rendererElem );
 
 
  654  , mSettings( other.mSettings )
 
  655  , mInterpolationSettings( other.mInterpolationSettings )
 
  656  , mDataDefinedSizeLegend( other.mDataDefinedSizeLegend ? new 
QgsDataDefinedSizeLegend( *other.mDataDefinedSizeLegend ) : nullptr )
 
 
  662  delete mDataDefinedSizeLegend;
 
 
  667  if ( &other == 
this )
 
  671  mSettings = other.mSettings;
 
  672  mInterpolationSettings = other.mInterpolationSettings;
 
  673  delete mDataDefinedSizeLegend;
 
 
  685  QList<QgsDiagramSettings> settingsList;
 
  686  settingsList.push_back( mSettings );
 
 
  709    for ( 
const QString &field : constReferencedColumns )
 
 
  723  return mDiagram->diagramSize( feature, 
c, mSettings, mInterpolationSettings );
 
 
  728  mInterpolationSettings.
lowerValue = elem.attribute( QStringLiteral( 
"lowerValue" ) ).toDouble();
 
  729  mInterpolationSettings.
upperValue = elem.attribute( QStringLiteral( 
"upperValue" ) ).toDouble();
 
  730  mInterpolationSettings.
lowerSize.setWidth( elem.attribute( QStringLiteral( 
"lowerWidth" ) ).toDouble() );
 
  731  mInterpolationSettings.
lowerSize.setHeight( elem.attribute( QStringLiteral( 
"lowerHeight" ) ).toDouble() );
 
  732  mInterpolationSettings.
upperSize.setWidth( elem.attribute( QStringLiteral( 
"upperWidth" ) ).toDouble() );
 
  733  mInterpolationSettings.
upperSize.setHeight( elem.attribute( QStringLiteral( 
"upperHeight" ) ).toDouble() );
 
  741    mInterpolationSettings.
classificationField = elem.attribute( QStringLiteral( 
"classificationField" ) );
 
  743  const QDomElement settingsElem = elem.firstChildElement( QStringLiteral( 
"DiagramCategory" ) );
 
  744  if ( !settingsElem.isNull() )
 
  746    mSettings.
readXml( settingsElem );
 
  749  delete mDataDefinedSizeLegend;
 
  751  const QDomElement ddsLegendSizeElem = elem.firstChildElement( QStringLiteral( 
"data-defined-size-legend" ) );
 
  752  if ( !ddsLegendSizeElem.isNull() )
 
  759    if ( elem.attribute( QStringLiteral( 
"sizeLegend" ), QStringLiteral( 
"0" ) ) != QLatin1String( 
"0" ) )
 
  762      const QDomElement sizeLegendSymbolElem = elem.firstChildElement( QStringLiteral( 
"symbol" ) );
 
  763      if ( !sizeLegendSymbolElem.isNull() && sizeLegendSymbolElem.attribute( QStringLiteral( 
"name" ) ) == QLatin1String( 
"sizeSymbol" ) )
 
  765        mDataDefinedSizeLegend->
setSymbol( QgsSymbolLayerUtils::loadSymbol<QgsMarkerSymbol>( sizeLegendSymbolElem, context ) );
 
  770      mDataDefinedSizeLegend = 
nullptr;
 
 
  779  QDomElement rendererElem = doc.createElement( QStringLiteral( 
"LinearlyInterpolatedDiagramRenderer" ) );
 
  780  rendererElem.setAttribute( QStringLiteral( 
"lowerValue" ), QString::number( mInterpolationSettings.
lowerValue ) );
 
  781  rendererElem.setAttribute( QStringLiteral( 
"upperValue" ), QString::number( mInterpolationSettings.
upperValue ) );
 
  782  rendererElem.setAttribute( QStringLiteral( 
"lowerWidth" ), QString::number( mInterpolationSettings.
lowerSize.width() ) );
 
  783  rendererElem.setAttribute( QStringLiteral( 
"lowerHeight" ), QString::number( mInterpolationSettings.
lowerSize.height() ) );
 
  784  rendererElem.setAttribute( QStringLiteral( 
"upperWidth" ), QString::number( mInterpolationSettings.
upperSize.width() ) );
 
  785  rendererElem.setAttribute( QStringLiteral( 
"upperHeight" ), QString::number( mInterpolationSettings.
upperSize.height() ) );
 
  792    rendererElem.setAttribute( QStringLiteral( 
"classificationField" ), mInterpolationSettings.
classificationField );
 
  794  mSettings.
writeXml( rendererElem, doc );
 
  796  if ( mDataDefinedSizeLegend )
 
  798    QDomElement ddsLegendElem = doc.createElement( QStringLiteral( 
"data-defined-size-legend" ) );
 
  799    mDataDefinedSizeLegend->
writeXml( ddsLegendElem, context );
 
  800    rendererElem.appendChild( ddsLegendElem );
 
  804  layerElem.appendChild( rendererElem );
 
 
  809  QList< QgsLayerTreeModelLegendNode * > list;
 
  813    QPixmap pix( 16, 16 );
 
 
  822  return mAxisLineSymbol.get();
 
 
  843  return mPaintEffect.get();
 
 
  848  if ( effect != mPaintEffect.get() )
 
  849    mPaintEffect.reset( effect );
 
 
  860  : enabled( other.enabled )
 
  862  , categoryColors( other.categoryColors )
 
  863  , categoryAttributes( other.categoryAttributes )
 
  864  , categoryLabels( other.categoryLabels )
 
  866  , sizeType( other.sizeType )
 
  867  , sizeScale( other.sizeScale )
 
  868  , lineSizeUnit( other.lineSizeUnit )
 
  869  , lineSizeScale( other.lineSizeScale )
 
  870  , backgroundColor( other.backgroundColor )
 
  871  , penColor( other.penColor )
 
  872  , penWidth( other.penWidth )
 
  873  , labelPlacementMethod( other.labelPlacementMethod )
 
  874  , diagramOrientation( other.diagramOrientation )
 
  875  , barWidth( other.barWidth )
 
  876  , opacity( other.opacity )
 
  877  , scaleByArea( other.scaleByArea )
 
  878  , rotationOffset( other.rotationOffset )
 
  879  , scaleBasedVisibility( other.scaleBasedVisibility )
 
  880  , maximumScale( other.maximumScale )
 
  881  , minimumScale( other.minimumScale )
 
  882  , minimumSize( other.minimumSize )
 
  883  , mSpacing( other.mSpacing )
 
  884  , mSpacingUnit( other.mSpacingUnit )
 
  885  , mSpacingMapUnitScale( other.mSpacingMapUnitScale )
 
  886  , mDirection( other.mDirection )
 
  887  , mShowAxis( other.mShowAxis )
 
  888  , mAxisLineSymbol( other.mAxisLineSymbol ? other.mAxisLineSymbol->clone() : nullptr )
 
  889  , mPaintEffect( other.mPaintEffect ? other.mPaintEffect->clone() : nullptr )
 
 
  919  mSpacing = other.mSpacing;
 
  920  mSpacingUnit = other.mSpacingUnit;
 
  921  mSpacingMapUnitScale = other.mSpacingMapUnitScale;
 
  922  mDirection = other.mDirection;
 
  923  mAxisLineSymbol.reset( other.mAxisLineSymbol ? other.mAxisLineSymbol->clone() : nullptr );
 
  924  mShowAxis = other.mShowAxis;
 
  925  mPaintEffect.reset( other.mPaintEffect ? other.mPaintEffect->clone() : nullptr );
 
 
  941  return QList< QgsLayerTreeModelLegendNode * >();
 
 
  946  QList< QgsLayerTreeModelLegendNode * > nodes;
 
 
  955  QList< QgsLayerTreeModelLegendNode * > nodes;
 
  959  if ( mDataDefinedSizeLegend && 
mDiagram )
 
  969    QList<QgsDataDefinedSizeLegend::SizeClass> sizeClasses;
 
  970    if ( ddSizeLegend.
classes().isEmpty() )
 
  974      for ( 
const double v : prettyBreaks )
 
  976        const double size = 
mDiagram->legendSize( v, mSettings, mInterpolationSettings );
 
  983      const auto constClasses = ddSizeLegend.
classes();
 
  986        const double size = 
mDiagram->legendSize( sc.size, mSettings, mInterpolationSettings );
 
  995      if ( 
auto *lDataDefinedSizeLegendSettings = si.dataDefinedSizeLegendSettings() )
 
 
 1007  delete mDataDefinedSizeLegend;
 
 1008  mDataDefinedSizeLegend = settings;
 
 
 1013  return mDataDefinedSizeLegend;
 
 
QColor valueAsColor(int key, const QgsExpressionContext &context, const QColor &defaultColor=QColor(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a color.
 
double valueAsDouble(int key, const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a double.
 
virtual bool readXml(const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions)
Reads property collection state from an XML element.
 
virtual bool writeXml(QDomElement &collectionElem, const QgsPropertiesDefinition &definitions) const
Writes the current state of the property collection into an XML element.
 
static QgsPaintEffectRegistry * paintEffectRegistry()
Returns the application's paint effect registry, used for managing paint effects.
 
static QString colorToString(const QColor &color)
Encodes a color into a string value.
 
Produces legend node with a marker symbol.
 
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
 
QList< QgsDataDefinedSizeLegend::SizeClass > classes() const
Returns list of classes: each class is a pair of symbol size (in units used by the symbol) and label.
 
void setSymbol(QgsMarkerSymbol *symbol SIP_TRANSFER)
Sets marker symbol that will be used to draw markers in legend.
 
QgsMarkerSymbol * symbol() const
Returns marker symbol that will be used to draw markers in legend.
 
void setClasses(const QList< QgsDataDefinedSizeLegend::SizeClass > &classes)
Sets list of classes: each class is a pair of symbol size (in units used by the symbol) and label.
 
static QgsDataDefinedSizeLegend * readXml(const QDomElement &elem, const QgsReadWriteContext &context) SIP_FACTORY
Creates instance from given element and returns it (caller takes ownership). Returns nullptr on error...
 
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const
Writes configuration to the given XML element.
 
QgsLegendSymbolList legendSymbolList() const
Generates legend symbol items according to the configuration.
 
bool classificationAttributeIsExpression
 
QString classificationField
Name of the field for classification.
 
QString classificationAttributeExpression
 
Stores the settings for rendering of all diagrams for a layer.
 
LinePlacementFlag
Line placement flags for controlling line based placements.
 
QgsDiagramLayerSettings & operator=(const QgsDiagramLayerSettings &rh)
 
void setRenderer(QgsDiagramRenderer *diagramRenderer)
Sets the diagram renderer associated with the layer.
 
~QgsDiagramLayerSettings()
 
@ PositionX
X-coordinate data defined diagram position.
 
@ Distance
Distance to diagram from feature.
 
@ PositionY
Y-coordinate data defined diagram position.
 
@ Show
Whether to show the diagram.
 
@ Priority
Diagram priority (between 0 and 10)
 
@ ZIndex
Z-index for diagram ordering.
 
@ StrokeColor
Stroke color.
 
@ BackgroundColor
Diagram background color.
 
@ StartAngle
Angle offset for pie diagram.
 
@ IsObstacle
Whether diagram features act as obstacles for other diagrams/labels.
 
@ StrokeWidth
Stroke width.
 
@ AlwaysShow
Whether the diagram should always be shown, even if it overlaps other diagrams/labels.
 
void readXml(const QDomElement &elem)
Reads the diagram settings from a DOM element.
 
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the diagram property definitions.
 
QgsDiagramLayerSettings()
Constructor for QgsDiagramLayerSettings.
 
QSet< QString > referencedFields(const QgsExpressionContext &context=QgsExpressionContext()) const
Returns the set of any fields referenced by the layer's diagrams.
 
void writeXml(QDomElement &layerElem, QDomDocument &doc) const
Writes the diagram settings to a DOM element.
 
bool prepare(const QgsExpressionContext &context=QgsExpressionContext()) const
Prepares the diagrams for a specified expression context.
 
void setCoordinateTransform(const QgsCoordinateTransform &transform)
Sets the coordinate transform associated with the layer.
 
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
 
virtual QList< QgsLayerTreeModelLegendNode * > legendItems(QgsLayerTreeLayer *nodeLayer) const
Returns list of legend nodes for the diagram.
 
virtual QSizeF diagramSize(const QgsFeature &features, const QgsRenderContext &c) const =0
Returns size of the diagram (in painter units) or an invalid size in case of error.
 
void _writeXml(QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context) const
Writes internal QgsDiagramRenderer diagram state to a DOM element.
 
virtual QSet< QString > referencedFields(const QgsExpressionContext &context=QgsExpressionContext()) const
Returns the set of any fields required for diagram rendering.
 
void renderDiagram(const QgsFeature &feature, QgsRenderContext &c, QPointF pos, const QgsPropertyCollection &properties=QgsPropertyCollection()) const
Renders the diagram for a specified feature at a specific position in the passed render context.
 
void _readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Reads internal QgsDiagramRenderer state from a DOM element.
 
QgsDiagramRenderer & operator=(const QgsDiagramRenderer &other)
 
virtual QSizeF sizeMapUnits(const QgsFeature &feature, const QgsRenderContext &c) const
Returns size of the diagram for a feature in map units. Returns an invalid QSizeF in case of error.
 
virtual QList< QString > diagramAttributes() const =0
Returns attribute indices needed for diagram rendering.
 
std::unique_ptr< QgsDiagram > mDiagram
Reference to the object that does the real diagram rendering.
 
void convertSizeToMapUnits(QSizeF &size, const QgsRenderContext &context) const
Converts size from mm to map units.
 
virtual QList< QgsDiagramSettings > diagramSettings() const =0
Returns list with all diagram settings in the renderer.
 
bool mShowAttributeLegend
Whether to show an attribute legend for the diagrams.
 
QgsDiagramRenderer()=default
Constructor for QgsDiagramRenderer.
 
void setDiagram(QgsDiagram *d)
 
virtual QgsDiagramRenderer * clone() const =0
Returns new instance that is equivalent to this one.
 
static int dpiPaintDevice(const QPainter *)
Returns the paint device dpi (or -1 in case of error.
 
Stores the settings for rendering a single diagram.
 
Direction direction() const
Returns the chart's angular direction.
 
void setDirection(Direction direction)
Sets the chart's angular direction.
 
bool showAxis() const
Returns true if the diagram axis should be shown.
 
LabelPlacementMethod labelPlacementMethod
 
void readXml(const QDomElement &elem, const QgsReadWriteContext &context=QgsReadWriteContext())
Reads diagram settings from XML.
 
double opacity
Opacity, from 0 (transparent) to 1.0 (opaque)
 
QgsDiagramSettings & operator=(const QgsDiagramSettings &other)
 
QgsLineSymbol * axisLineSymbol() const
Returns the line symbol to use for rendering axis in diagrams.
 
Qgis::RenderUnit sizeType
Diagram size unit.
 
QList< QString > categoryAttributes
 
QList< QString > categoryLabels
 
QgsDiagramSettings()
Constructor for QgsDiagramSettings.
 
DiagramOrientation diagramOrientation
 
QList< QgsLayerTreeModelLegendNode * > legendItems(QgsLayerTreeLayer *nodeLayer) const
Returns list of legend nodes for the diagram.
 
QgsMapUnitScale lineSizeScale
Line unit scale.
 
void writeXml(QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context=QgsReadWriteContext()) const
Writes diagram settings to XML.
 
QList< QColor > categoryColors
 
double rotationOffset
Rotation offset, in degrees clockwise from horizontal.
 
QgsMapUnitScale sizeScale
Diagram size unit scale.
 
double minimumScale
The minimum map scale (i.e.
 
bool scaleBasedVisibility
 
double maximumScale
The maximum map scale (i.e.
 
void setAxisLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol to use for rendering axis in diagrams.
 
Qgis::RenderUnit lineSizeUnit
Line unit index.
 
double minimumSize
Scale diagrams smaller than mMinimumSize to mMinimumSize.
 
Direction
Angular directions.
 
void setShowAxis(bool showAxis)
Sets whether the diagram axis should be shown.
 
void setPaintEffect(QgsPaintEffect *effect)
Sets the paint effect to use while rendering diagrams.
 
QgsPaintEffect * paintEffect() const
Returns the paint effect to use while rendering diagrams.
 
Base class for all diagram types.
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
Class for parsing and evaluation of expressions (formerly called "search strings").
 
QSet< QString > referencedColumns() const
Gets list of columns referenced by the expression.
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
static bool setFromXmlChildNode(QFont &font, const QDomElement &element, const QString &childNode)
Sets the properties of a font to match the properties stored in an XML child node.
 
static QDomElement toXmlElement(const QFont &font, QDomDocument &document, const QString &elementName)
Returns a DOM element containing the properties of the font.
 
A histogram style diagram.
 
Layer tree node points to a map layer.
 
The class stores information about one class/rule of a vector layer renderer in a unified way that ca...
 
A line symbol type, for rendering LineString and MultiLineString geometries.
 
QgsLinearlyInterpolatedDiagramRenderer()
 
void setDataDefinedSizeLegend(QgsDataDefinedSizeLegend *settings)
Configures appearance of legend.
 
QSizeF diagramSize(const QgsFeature &, const QgsRenderContext &c) const override
Returns size of the diagram (in painter units) or an invalid size in case of error.
 
QList< QString > diagramAttributes() const override
Returns attribute indices needed for diagram rendering.
 
QSet< QString > referencedFields(const QgsExpressionContext &context=QgsExpressionContext()) const override
Returns the set of any fields required for diagram rendering.
 
QList< QgsDiagramSettings > diagramSettings() const override
Returns list with all diagram settings in the renderer.
 
void writeXml(QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context) const override
Writes diagram state to a DOM element.
 
QgsLinearlyInterpolatedDiagramRenderer * clone() const override
Returns new instance that is equivalent to this one.
 
QList< QgsLayerTreeModelLegendNode * > legendItems(QgsLayerTreeLayer *nodeLayer) const override
Returns list of legend nodes for the diagram.
 
void readXml(const QDomElement &elem, const QgsReadWriteContext &context) override
Reads diagram state from a DOM element.
 
QgsDataDefinedSizeLegend * dataDefinedSizeLegend() const
Returns configuration of appearance of legend.
 
~QgsLinearlyInterpolatedDiagramRenderer() override
 
QgsLinearlyInterpolatedDiagramRenderer & operator=(const QgsLinearlyInterpolatedDiagramRenderer &other)
 
double mapUnitsPerPixel() const
Returns the current map units per pixel.
 
A marker symbol type, for rendering Point and MultiPoint geometries.
 
static QgsMarkerSymbol * createSimple(const QVariantMap &properties)
Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
 
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
 
void setSizeMapUnitScale(const QgsMapUnitScale &scale) const
Sets the size map unit scale for the whole symbol (including all symbol layers).
 
void setSizeUnit(Qgis::RenderUnit unit) const
Sets the size units for the whole symbol (including all symbol layers).
 
static QgsPaintEffect * defaultStack()
Returns a new effect stack consisting of a sensible selection of default effects.
 
static bool isDefaultStack(QgsPaintEffect *effect)
Tests whether a paint effect matches the default effects stack.
 
Base class for visual effects which can be applied to QPicture drawings.
 
bool enabled() const
Returns whether the effect is enabled.
 
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
 
void clear() final
Removes all properties from the collection.
 
bool prepare(const QgsExpressionContext &context=QgsExpressionContext()) const final
Prepares the collection against a specified expression context.
 
bool hasActiveProperties() const final
Returns true if the collection has any active properties, or false if all properties within the colle...
 
QSet< QString > referencedFields(const QgsExpressionContext &context=QgsExpressionContext(), bool ignoreContext=false) const final
Returns the set of any fields referenced by the active properties from the collection.
 
Definition for a property.
 
@ Double
Double value (including negative values)
 
@ StrokeWidth
Line stroke width.
 
@ Rotation
Rotation (value between 0-360 degrees)
 
@ ColorWithAlpha
Color with alpha channel.
 
@ DoublePositive
Positive double value (including 0)
 
The class is used as a container of context for various read/write operations on other objects.
 
Contains information about the context of a rendering operation.
 
double scaleFactor() const
Returns the scaling factor for the render to convert painter units to physical sizes.
 
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
 
Implementation of legend node interface for displaying arbitrary label with icon.
 
Renders the diagrams for all features with the same settings.
 
QSizeF diagramSize(const QgsFeature &, const QgsRenderContext &c) const override
Returns size of the diagram (in painter units) or an invalid size in case of error.
 
void writeXml(QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context) const override
Writes diagram state to a DOM element.
 
QgsSingleCategoryDiagramRenderer * clone() const override
Returns new instance that is equivalent to this one.
 
QgsSingleCategoryDiagramRenderer()=default
Constructor for QgsSingleCategoryDiagramRenderer.
 
QList< QgsLayerTreeModelLegendNode * > legendItems(QgsLayerTreeLayer *nodeLayer) const override
Returns list of legend nodes for the diagram.
 
void readXml(const QDomElement &elem, const QgsReadWriteContext &context) override
Reads diagram state from a DOM element.
 
QList< QgsDiagramSettings > diagramSettings() const override
Returns list with all diagram settings in the renderer.
 
A stacked bar chart diagram.
 
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
 
static QList< double > prettyBreaks(double minimum, double maximum, int classes)
Computes a sequence of about 'classes' equally spaced round values which cover the range of values fr...
 
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
 
static QDomElement saveSymbol(const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
 
Implementation of legend node interface for displaying preview of vector symbols and their labels and...
 
static Q_INVOKABLE Qgis::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
 
static Q_INVOKABLE QString encodeUnit(Qgis::DistanceUnit unit)
Encodes a distance unit to a string.
 
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
 
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
 
Definition of one class for the legend.