QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsmaplayerlegend.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaplayerlegend.cpp
3  --------------------------------------
4  Date : July 2014
5  Copyright : (C) 2014 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgsmaplayerlegend.h"
17 #include "qgsiconutils.h"
18 #include "qgsimagecache.h"
19 #include "qgssettings.h"
20 #include "qgslayertree.h"
22 #include "qgsmeshlayer.h"
23 #include "qgspluginlayer.h"
24 #include "qgsrasterlayer.h"
25 #include "qgsrenderer.h"
26 #include "qgsvectorlayer.h"
27 #include "qgspointcloudlayer.h"
28 #include "qgsdiagramrenderer.h"
29 #include "qgssymbollayerutils.h"
30 #include "qgspointcloudrenderer.h"
31 #include "qgsrasterrenderer.h"
32 #include "qgscolorramplegendnode.h"
33 #include "qgsvectorlayerlabeling.h"
34 #include "qgsrulebasedlabeling.h"
35 
37  : QObject( parent )
38 {
39 }
40 
41 void QgsMapLayerLegend::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
42 {
43  Q_UNUSED( elem )
44  Q_UNUSED( context )
45 }
46 
47 QDomElement QgsMapLayerLegend::writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const
48 {
49  Q_UNUSED( doc )
50  Q_UNUSED( context )
51  return QDomElement();
52 }
53 
55 {
56  return new QgsDefaultVectorLayerLegend( vl );
57 }
58 
60 {
61  return new QgsDefaultRasterLayerLegend( rl );
62 }
63 
65 {
66  return new QgsDefaultMeshLayerLegend( ml );
67 }
68 
70 {
71  return new QgsDefaultPointCloudLayerLegend( layer );
72 }
73 
74 // -------------------------------------------------------------------------
75 
76 
77 void QgsMapLayerLegendUtils::setLegendNodeOrder( QgsLayerTreeLayer *nodeLayer, const QList<int> &order )
78 {
79  QStringList orderStr;
80  const auto constOrder = order;
81  for ( const int id : constOrder )
82  orderStr << QString::number( id );
83  const QString str = orderStr.isEmpty() ? QStringLiteral( "empty" ) : orderStr.join( QLatin1Char( ',' ) );
84 
85  nodeLayer->setCustomProperty( QStringLiteral( "legend/node-order" ), str );
86 }
87 
88 static int _originalLegendNodeCount( QgsLayerTreeLayer *nodeLayer )
89 {
90  // this is not particularly efficient way of finding out number of legend nodes
91  const QList<QgsLayerTreeModelLegendNode *> lst = nodeLayer->layer()->legend()->createLayerTreeModelLegendNodes( nodeLayer );
92  const int numNodes = lst.count();
93  qDeleteAll( lst );
94  return numNodes;
95 }
96 
97 static QList<int> _makeNodeOrder( QgsLayerTreeLayer *nodeLayer )
98 {
99  if ( !nodeLayer->layer() || !nodeLayer->layer()->legend() )
100  {
101  QgsDebugMsg( QStringLiteral( "Legend node order manipulation is invalid without existing legend" ) );
102  return QList<int>();
103  }
104 
105  const int numNodes = _originalLegendNodeCount( nodeLayer );
106 
107  QList<int> order;
108  order.reserve( numNodes );
109  for ( int i = 0; i < numNodes; ++i )
110  order << i;
111  return order;
112 }
113 
115 {
116  const QString orderStr = nodeLayer->customProperty( QStringLiteral( "legend/node-order" ) ).toString();
117 
118  if ( orderStr.isEmpty() )
119  return _makeNodeOrder( nodeLayer );
120 
121  if ( orderStr == QLatin1String( "empty" ) )
122  return QList<int>();
123 
124  const int numNodes = _originalLegendNodeCount( nodeLayer );
125 
126  QList<int> lst;
127  const auto constSplit = orderStr.split( ',' );
128  for ( const QString &item : constSplit )
129  {
130  bool ok;
131  const int id = item.toInt( &ok );
132  if ( !ok || id < 0 || id >= numNodes )
133  return _makeNodeOrder( nodeLayer );
134 
135  lst << id;
136  }
137 
138  return lst;
139 }
140 
142 {
143  return nodeLayer->customProperties().contains( QStringLiteral( "legend/node-order" ) );
144 }
145 
146 void QgsMapLayerLegendUtils::setLegendNodeUserLabel( QgsLayerTreeLayer *nodeLayer, int originalIndex, const QString &newLabel )
147 {
148  nodeLayer->setCustomProperty( "legend/label-" + QString::number( originalIndex ), newLabel );
149 }
150 
151 QString QgsMapLayerLegendUtils::legendNodeUserLabel( QgsLayerTreeLayer *nodeLayer, int originalIndex )
152 {
153  return nodeLayer->customProperty( "legend/label-" + QString::number( originalIndex ) ).toString();
154 }
155 
157 {
158  return nodeLayer->customProperties().contains( "legend/label-" + QString::number( originalIndex ) );
159 }
160 
162 {
163  QDomDocument patchDoc;
164  QDomElement patchElem = patchDoc.createElement( QStringLiteral( "patch" ) );
165  shape.writeXml( patchElem, patchDoc, QgsReadWriteContext() );
166  patchDoc.appendChild( patchElem );
167  nodeLayer->setCustomProperty( "legend/patch-shape-" + QString::number( originalIndex ), patchDoc.toString() );
168 }
169 
171 {
172  const QString patchDef = nodeLayer->customProperty( "legend/patch-shape-" + QString::number( originalIndex ) ).toString();
173  if ( patchDef.isEmpty() )
174  return QgsLegendPatchShape();
175 
176  QDomDocument doc( QStringLiteral( "patch" ) );
177  doc.setContent( patchDef );
178  QgsLegendPatchShape shape;
179  shape.readXml( doc.documentElement(), QgsReadWriteContext() );
180  return shape;
181 }
182 
183 void QgsMapLayerLegendUtils::setLegendNodeSymbolSize( QgsLayerTreeLayer *nodeLayer, int originalIndex, QSizeF size )
184 {
185  if ( size.isValid() )
186  nodeLayer->setCustomProperty( "legend/symbol-size-" + QString::number( originalIndex ), QgsSymbolLayerUtils::encodeSize( size ) );
187  else
188  nodeLayer->removeCustomProperty( "legend/symbol-size-" + QString::number( originalIndex ) );
189 }
190 
192 {
193  const QString size = nodeLayer->customProperty( "legend/symbol-size-" + QString::number( originalIndex ) ).toString();
194  if ( size.isEmpty() )
195  return QSizeF();
196  else
197  return QgsSymbolLayerUtils::decodeSize( size );
198 }
199 
200 void QgsMapLayerLegendUtils::setLegendNodeCustomSymbol( QgsLayerTreeLayer *nodeLayer, int originalIndex, const QgsSymbol *symbol )
201 {
202  if ( symbol )
203  {
204  QDomDocument doc;
205  QgsReadWriteContext rwContext;
206  rwContext.setPathResolver( QgsProject::instance()->pathResolver() );
207  const QDomElement elem = QgsSymbolLayerUtils::saveSymbol( QStringLiteral( "custom symbol" ), symbol, doc, rwContext );
208  doc.appendChild( elem );
209  nodeLayer->setCustomProperty( "legend/custom-symbol-" + QString::number( originalIndex ), doc.toString() );
210  }
211  else
212  nodeLayer->removeCustomProperty( "legend/custom-symbol-" + QString::number( originalIndex ) );
213 }
214 
216 {
217  const QString symbolDef = nodeLayer->customProperty( "legend/custom-symbol-" + QString::number( originalIndex ) ).toString();
218  if ( symbolDef.isEmpty() )
219  return nullptr;
220 
221  QDomDocument doc;
222  doc.setContent( symbolDef );
223  const QDomElement elem = doc.documentElement();
224 
225  QgsReadWriteContext rwContext;
226  rwContext.setPathResolver( QgsProject::instance()->pathResolver() );
227 
228  return QgsSymbolLayerUtils::loadSymbol( elem, rwContext );
229 }
230 
232 {
233  if ( settings )
234  {
235  QDomDocument doc;
236  QgsReadWriteContext rwContext;
237  rwContext.setPathResolver( QgsProject::instance()->pathResolver() );
238  QDomElement elem = doc.createElement( QStringLiteral( "rampSettings" ) );
239  settings->writeXml( doc, elem, rwContext );
240  doc.appendChild( elem );
241  nodeLayer->setCustomProperty( "legend/custom-ramp-settings-" + QString::number( originalIndex ), doc.toString() );
242  }
243  else
244  nodeLayer->removeCustomProperty( "legend/custom-ramp-settings-" + QString::number( originalIndex ) );
245 }
246 
248 {
249  const QString settingsDef = nodeLayer->customProperty( "legend/custom-ramp-settings-" + QString::number( originalIndex ) ).toString();
250  if ( settingsDef.isEmpty() )
251  return nullptr;
252 
253  QDomDocument doc;
254  doc.setContent( settingsDef );
255  const QDomElement elem = doc.documentElement();
256 
257  QgsReadWriteContext rwContext;
258  rwContext.setPathResolver( QgsProject::instance()->pathResolver() );
259 
261  settings.readXml( elem, rwContext );
262  return new QgsColorRampLegendNodeSettings( settings );
263 }
264 
265 void QgsMapLayerLegendUtils::setLegendNodeColumnBreak( QgsLayerTreeLayer *nodeLayer, int originalIndex, bool columnBreakBeforeNode )
266 {
267  if ( columnBreakBeforeNode )
268  nodeLayer->setCustomProperty( "legend/column-break-" + QString::number( originalIndex ), QStringLiteral( "1" ) );
269  else
270  nodeLayer->removeCustomProperty( "legend/column-break-" + QString::number( originalIndex ) );
271 }
272 
274 {
275  return nodeLayer->customProperty( "legend/column-break-" + QString::number( originalIndex ) ).toInt();
276 }
277 
278 void QgsMapLayerLegendUtils::applyLayerNodeProperties( QgsLayerTreeLayer *nodeLayer, QList<QgsLayerTreeModelLegendNode *> &nodes )
279 {
280  // handle user labels
281  int i = 0;
282  const auto constNodes = nodes;
283  for ( QgsLayerTreeModelLegendNode *legendNode : constNodes )
284  {
285  const QString userLabel = QgsMapLayerLegendUtils::legendNodeUserLabel( nodeLayer, i );
286  if ( !userLabel.isNull() )
287  legendNode->setUserLabel( userLabel );
288 
289  if ( QgsSymbolLegendNode *symbolNode = dynamic_cast< QgsSymbolLegendNode * >( legendNode ) )
290  {
292  symbolNode->setPatchShape( shape );
293 
294  symbolNode->setCustomSymbol( QgsMapLayerLegendUtils::legendNodeCustomSymbol( nodeLayer, i ) );
295  }
296  else if ( QgsColorRampLegendNode *colorRampNode = dynamic_cast< QgsColorRampLegendNode * >( legendNode ) )
297  {
298  const std::unique_ptr< QgsColorRampLegendNodeSettings > settings( QgsMapLayerLegendUtils::legendNodeColorRampSettings( nodeLayer, i ) );
299  if ( settings )
300  {
301  colorRampNode->setSettings( *settings );
302  }
303  }
304 
305  const QSizeF userSize = QgsMapLayerLegendUtils::legendNodeSymbolSize( nodeLayer, i );
306  if ( userSize.isValid() )
307  {
308  legendNode->setUserPatchSize( userSize );
309  }
310 
311  if ( legendNodeColumnBreak( nodeLayer, i ) )
312  legendNode->setColumnBreak( true );
313 
314  i++;
315  }
316 
317  // handle user order of nodes
319  {
320  const QList<int> order = QgsMapLayerLegendUtils::legendNodeOrder( nodeLayer );
321 
322  QList<QgsLayerTreeModelLegendNode *> newOrder;
323  QSet<int> usedIndices;
324  const auto constOrder = order;
325  for ( const int idx : constOrder )
326  {
327  if ( usedIndices.contains( idx ) )
328  {
329  QgsDebugMsg( QStringLiteral( "invalid node order. ignoring." ) );
330  return;
331  }
332 
333  newOrder << nodes[idx];
334  usedIndices << idx;
335  }
336 
337  // delete unused nodes
338  for ( int i = 0; i < nodes.count(); ++i )
339  {
340  if ( !usedIndices.contains( i ) )
341  delete nodes[i];
342  }
343 
344  nodes = newOrder;
345  }
346 
347 }
348 
349 // -------------------------------------------------------------------------
350 
351 
353  : mLayer( vl )
354 {
356  connect( mLayer, &QgsMapLayer::nameChanged, this, &QgsMapLayerLegend::itemsChanged );
357 }
358 
359 QList<QgsLayerTreeModelLegendNode *> QgsDefaultVectorLayerLegend::createLayerTreeModelLegendNodes( QgsLayerTreeLayer *nodeLayer )
360 {
361  QList<QgsLayerTreeModelLegendNode *> nodes;
362 
363  if ( mLayer )
364  {
365  const QString placeholderImage = mLayer->legendPlaceholderImage();
366  if ( !placeholderImage.isEmpty() )
367  {
368  bool fitsInCache;
369  const QImage img = QgsApplication::imageCache()->pathAsImage( placeholderImage, QSize(), false, 1.0, fitsInCache );
370  nodes << new QgsImageLegendNode( nodeLayer, img );
371  return nodes;
372  }
373  }
374 
375  QgsFeatureRenderer *r = mLayer->renderer();
376  if ( !r )
377  return nodes;
378 
379  if ( nodeLayer->customProperty( QStringLiteral( "showFeatureCount" ), 0 ).toBool() )
380  mLayer->countSymbolFeatures();
381 
382  const QgsSettings settings;
383  if ( settings.value( QStringLiteral( "qgis/showLegendClassifiers" ), false ).toBool() && !r->legendClassificationAttribute().isEmpty() )
384  {
385  nodes.append( new QgsSimpleLegendNode( nodeLayer, r->legendClassificationAttribute() ) );
386  }
387 
388  const auto constLegendSymbolItems = r->legendSymbolItems();
389  for ( const QgsLegendSymbolItem &i : constLegendSymbolItems )
390  {
391  if ( auto *lDataDefinedSizeLegendSettings = i.dataDefinedSizeLegendSettings() )
392  nodes << new QgsDataDefinedSizeLegendNode( nodeLayer, *lDataDefinedSizeLegendSettings );
393  else
394  {
395  QgsSymbolLegendNode *legendNode = new QgsSymbolLegendNode( nodeLayer, i );
396  if ( mTextOnSymbolEnabled && mTextOnSymbolContent.contains( i.ruleKey() ) )
397  {
398  legendNode->setTextOnSymbolLabel( mTextOnSymbolContent.value( i.ruleKey() ) );
399  legendNode->setTextOnSymbolTextFormat( mTextOnSymbolTextFormat );
400  }
401  nodes << legendNode;
402  }
403  }
404 
405  if ( nodes.count() == 1 && nodes[0]->data( Qt::EditRole ).toString().isEmpty() )
406  nodes[0]->setEmbeddedInParent( true );
407 
408 
409  if ( mLayer->diagramsEnabled() )
410  {
411  const auto constLegendItems = mLayer->diagramRenderer()->legendItems( nodeLayer );
412  for ( QgsLayerTreeModelLegendNode *i : constLegendItems )
413  {
414  nodes.append( i );
415  }
416  }
417 
418  if ( mLayer->labelsEnabled() && mShowLabelLegend )
419  {
420  const QgsAbstractVectorLayerLabeling *labeling = mLayer->labeling();
421  if ( labeling )
422  {
423  const QStringList pList = labeling->subProviders();
424  for ( int i = 0; i < pList.size(); ++i )
425  {
426  const QgsPalLayerSettings s = labeling->settings( pList.at( i ) );
427  QString description;
428  const QgsRuleBasedLabeling *ruleBasedLabeling = dynamic_cast<const QgsRuleBasedLabeling *>( labeling );
429  if ( ruleBasedLabeling && ruleBasedLabeling->rootRule() )
430  {
431  const QgsRuleBasedLabeling::Rule *rule = ruleBasedLabeling->rootRule()->findRuleByKey( pList.at( i ) );
432  if ( rule )
433  {
434  description = rule->description();
435  }
436  }
437  QgsVectorLabelLegendNode *node = new QgsVectorLabelLegendNode( nodeLayer, s );
438  node->setUserLabel( description );
439  nodes.append( node );
440  }
441  }
442  }
443 
444 
445  return nodes;
446 }
447 
448 void QgsDefaultVectorLayerLegend::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
449 {
450  mTextOnSymbolEnabled = false;
451  mTextOnSymbolTextFormat = QgsTextFormat();
452  mTextOnSymbolContent.clear();
453 
454  mShowLabelLegend = elem.attribute( QStringLiteral( "showLabelLegend" ), QStringLiteral( "0" ) ).compare( QStringLiteral( "1" ), Qt::CaseInsensitive ) == 0;
455 
456  const QDomElement tosElem = elem.firstChildElement( QStringLiteral( "text-on-symbol" ) );
457  if ( !tosElem.isNull() )
458  {
459  mTextOnSymbolEnabled = true;
460  const QDomElement tosFormatElem = tosElem.firstChildElement( QStringLiteral( "text-style" ) );
461  mTextOnSymbolTextFormat.readXml( tosFormatElem, context );
462  const QDomElement tosContentElem = tosElem.firstChildElement( QStringLiteral( "content" ) );
463  QDomElement tosContentItemElem = tosContentElem.firstChildElement( QStringLiteral( "item" ) );
464  while ( !tosContentItemElem.isNull() )
465  {
466  mTextOnSymbolContent.insert( tosContentItemElem.attribute( QStringLiteral( "key" ) ), tosContentItemElem.attribute( QStringLiteral( "value" ) ) );
467  tosContentItemElem = tosContentItemElem.nextSiblingElement( QStringLiteral( "item" ) );
468  }
469  }
470 }
471 
472 QDomElement QgsDefaultVectorLayerLegend::writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const
473 {
474  QDomElement elem = doc.createElement( QStringLiteral( "legend" ) );
475  elem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "default-vector" ) );
476  elem.setAttribute( QStringLiteral( "showLabelLegend" ), mShowLabelLegend );
477 
478  if ( mTextOnSymbolEnabled )
479  {
480  QDomElement tosElem = doc.createElement( QStringLiteral( "text-on-symbol" ) );
481  const QDomElement tosFormatElem = mTextOnSymbolTextFormat.writeXml( doc, context );
482  tosElem.appendChild( tosFormatElem );
483  QDomElement tosContentElem = doc.createElement( QStringLiteral( "content" ) );
484  for ( auto it = mTextOnSymbolContent.constBegin(); it != mTextOnSymbolContent.constEnd(); ++it )
485  {
486  QDomElement tosContentItemElem = doc.createElement( QStringLiteral( "item" ) );
487  tosContentItemElem.setAttribute( QStringLiteral( "key" ), it.key() );
488  tosContentItemElem.setAttribute( QStringLiteral( "value" ), it.value() );
489  tosContentElem.appendChild( tosContentItemElem );
490  }
491  tosElem.appendChild( tosContentElem );
492  elem.appendChild( tosElem );
493  }
494 
495  return elem;
496 }
497 
498 
499 // -------------------------------------------------------------------------
500 
501 
503  : mLayer( rl )
504 {
506 }
507 
508 QList<QgsLayerTreeModelLegendNode *> QgsDefaultRasterLayerLegend::createLayerTreeModelLegendNodes( QgsLayerTreeLayer *nodeLayer )
509 {
510  QList<QgsLayerTreeModelLegendNode *> nodes;
511 
512  // temporary solution for WMS. Ideally should be done with a delegate.
513  if ( mLayer->dataProvider() && mLayer->dataProvider()->supportsLegendGraphic() )
514  {
515  nodes << new QgsWmsLegendNode( nodeLayer );
516  }
517 
518  const QString placeholderImage = mLayer->legendPlaceholderImage();
519  if ( !placeholderImage.isEmpty() )
520  {
521  bool fitsInCache;
522  const QImage img = QgsApplication::imageCache()->pathAsImage( placeholderImage, QSize(), false, 1.0, fitsInCache );
523  nodes << new QgsImageLegendNode( nodeLayer, img );
524  }
525  else if ( mLayer->renderer() )
526  nodes.append( mLayer->renderer()->createLegendNodes( nodeLayer ) );
527  return nodes;
528 }
529 
530 // -------------------------------------------------------------------------
531 
533  : mLayer( ml )
534 {
536 }
537 
538 QList<QgsLayerTreeModelLegendNode *> QgsDefaultMeshLayerLegend::createLayerTreeModelLegendNodes( QgsLayerTreeLayer *nodeLayer )
539 {
540  QList<QgsLayerTreeModelLegendNode *> nodes;
541 
542  const QgsMeshRendererSettings rendererSettings = mLayer->rendererSettings();
543 
544  const int indexScalar = rendererSettings.activeScalarDatasetGroup();
545  const int indexVector = rendererSettings.activeVectorDatasetGroup();
546 
547  QString name;
548  if ( indexScalar > -1 && indexVector > -1 && indexScalar != indexVector )
549  name = QString( "%1 / %2" ).arg( mLayer->datasetGroupMetadata( indexScalar ).name(), mLayer->datasetGroupMetadata( indexVector ).name() );
550  else if ( indexScalar > -1 )
551  name = mLayer->datasetGroupMetadata( indexScalar ).name();
552  else if ( indexVector > -1 )
553  name = mLayer->datasetGroupMetadata( indexVector ).name();
554  else
555  {
556  // neither contours nor vectors get rendered - no legend needed
557  return nodes;
558  }
559 
560  nodes << new QgsSimpleLegendNode( nodeLayer, name );
561 
562  if ( indexScalar > -1 )
563  {
564  const QgsMeshRendererScalarSettings settings = rendererSettings.scalarSettings( indexScalar );
565  const QgsColorRampShader shader = settings.colorRampShader();
566  switch ( shader.colorRampType() )
567  {
569  if ( ! shader.legendSettings() || shader.legendSettings()->useContinuousLegend() )
570  {
571  // for interpolated shaders we use a ramp legend node
572  if ( !shader.colorRampItemList().isEmpty() )
573  {
574  nodes << new QgsColorRampLegendNode( nodeLayer, shader.createColorRamp(),
576  shader.minimumValue(),
577  shader.maximumValue() );
578  }
579  break;
580  }
581  Q_FALLTHROUGH();
584  {
585  // for all others we use itemised lists
586  QgsLegendColorList items;
587  settings.colorRampShader().legendSymbologyItems( items );
588  for ( const QPair< QString, QColor > &item : items )
589  {
590  nodes << new QgsRasterSymbolLegendNode( nodeLayer, item.second, item.first );
591  }
592  break;
593  }
594  }
595  }
596 
597  return nodes;
598 }
599 
600 //
601 // QgsDefaultPointCloudLayerLegend
602 //
603 
605  : mLayer( layer )
606 {
608 }
609 
611 {
612  QgsPointCloudRenderer *renderer = mLayer->renderer();
613  if ( !renderer )
614  return QList<QgsLayerTreeModelLegendNode *>();
615 
616  return renderer->createLegendNodes( nodeLayer );
617 }
QgsMapLayerLegendUtils::setLegendNodePatchShape
static void setLegendNodePatchShape(QgsLayerTreeLayer *nodeLayer, int originalIndex, const QgsLegendPatchShape &shape)
Sets the legend patch shape for the legend node belonging to nodeLayer at the specified originalIndex...
Definition: qgsmaplayerlegend.cpp:161
QgsDefaultVectorLayerLegend::readXml
void readXml(const QDomElement &elem, const QgsReadWriteContext &context) override
Reads configuration from a DOM element previously written by writeXml()
Definition: qgsmaplayerlegend.cpp:448
QgsReadWriteContext::setPathResolver
void setPathResolver(const QgsPathResolver &resolver)
Sets up path resolver for conversion between relative and absolute paths.
Definition: qgsreadwritecontext.cpp:52
QgsVectorLayer::diagramsEnabled
bool diagramsEnabled() const
Returns whether the layer contains diagrams which are enabled and should be drawn.
Definition: qgsvectorlayer.cpp:799
QgsMapLayerLegendUtils::applyLayerNodeProperties
static void applyLayerNodeProperties(QgsLayerTreeLayer *nodeLayer, QList< QgsLayerTreeModelLegendNode * > &nodes)
update according to layer node's custom properties (order of items, user labels for items)
Definition: qgsmaplayerlegend.cpp:278
QgsMapLayerLegendUtils::legendNodeColorRampSettings
static QgsColorRampLegendNodeSettings * legendNodeColorRampSettings(QgsLayerTreeLayer *nodeLayer, int originalIndex)
Returns the custom legend color ramp settings for the legend node belonging to nodeLayer at the speci...
Definition: qgsmaplayerlegend.cpp:247
QgsDefaultVectorLayerLegend
Default legend implementation for vector layers.
Definition: qgsmaplayerlegend.h:236
qgsrasterlayer.h
QgsRuleBasedLabeling::rootRule
QgsRuleBasedLabeling::Rule * rootRule()
Definition: qgsrulebasedlabeling.cpp:460
QgsRuleBasedLabeling::Rule
A child rule for QgsRuleBasedLabeling.
Definition: qgsrulebasedlabeling.h:55
qgslayertreemodellegendnode.h
QgsImageCache::pathAsImage
QImage pathAsImage(const QString &path, const QSize size, const bool keepAspectRatio, const double opacity, bool &fitsInCache, bool blocking=false, double targetDpi=96, int frameNumber=-1, bool *isMissing=nullptr)
Returns the specified path rendered as an image.
Definition: qgsimagecache.cpp:137
QgsMeshRendererSettings
Represents all mesh renderer settings.
Definition: qgsmeshrenderersettings.h:590
QgsSettings::value
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
Definition: qgssettings.cpp:161
QgsDefaultPointCloudLayerLegend::QgsDefaultPointCloudLayerLegend
QgsDefaultPointCloudLayerLegend(QgsPointCloudLayer *layer)
Creates an instance for the given point cloud layer.
Definition: qgsmaplayerlegend.cpp:604
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
QgsMapLayerLegendUtils::legendNodeColumnBreak
static bool legendNodeColumnBreak(QgsLayerTreeLayer *nodeLayer, int originalIndex)
Returns whether a forced column break should occur before the node.
Definition: qgsmaplayerlegend.cpp:273
QgsPalLayerSettings
Contains settings for how a map layer will be labeled.
Definition: qgspallabeling.h:86
QgsPointCloudLayer
Represents a map layer supporting display of point clouds.
Definition: qgspointcloudlayer.h:45
QgsMapLayerLegend::defaultMeshLegend
static QgsMapLayerLegend * defaultMeshLegend(QgsMeshLayer *ml)
Create new legend implementation for mesh layer.
Definition: qgsmaplayerlegend.cpp:64
QgsSimpleLegendNode
Implementation of legend node interface for displaying arbitrary label with icon.
Definition: qgslayertreemodellegendnode.h:544
qgssymbollayerutils.h
QgsColorRampLegendNode
A legend node which renders a color ramp.
Definition: qgscolorramplegendnode.h:34
QgsLayerTreeModelLegendNode::setUserPatchSize
virtual void setUserPatchSize(QSizeF size)
Sets the user (overridden) size for the legend node.
Definition: qgslayertreemodellegendnode.cpp:77
QgsPointCloudRenderer::createLegendNodes
virtual QList< QgsLayerTreeModelLegendNode * > createLegendNodes(QgsLayerTreeLayer *nodeLayer)
Creates a set of legend nodes representing the renderer.
Definition: qgspointcloudrenderer.cpp:152
QgsMapLayerLegend
The QgsMapLayerLegend class is abstract interface for implementations of legends for one map layer.
Definition: qgsmaplayerlegend.h:47
QgsRasterShaderFunction::maximumValue
double maximumValue() const
Returns the minimum value for the raster shader.
Definition: qgsrastershaderfunction.h:119
QgsRuleBasedLabeling::Rule::findRuleByKey
const QgsRuleBasedLabeling::Rule * findRuleByKey(const QString &key) const
Try to find a rule given its unique key.
Definition: qgsrulebasedlabeling.cpp:201
QgsMapLayerLegend::writeXml
virtual QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Writes configuration to a DOM element, to be used later with readXml()
Definition: qgsmaplayerlegend.cpp:47
QgsProject::instance
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:480
qgscolorramplegendnode.h
QgsMapLayerLegendUtils::setLegendNodeColumnBreak
static void setLegendNodeColumnBreak(QgsLayerTreeLayer *nodeLayer, int originalIndex, bool columnBreakBeforeNode)
Sets whether a forced column break should occur before the node.
Definition: qgsmaplayerlegend.cpp:265
qgsrasterrenderer.h
QgsDefaultMeshLayerLegend::createLayerTreeModelLegendNodes
QList< QgsLayerTreeModelLegendNode * > createLayerTreeModelLegendNodes(QgsLayerTreeLayer *nodeLayer) override
Returns list of legend nodes to be used for a particular layer tree layer node.
Definition: qgsmaplayerlegend.cpp:538
QgsFeatureRenderer::legendSymbolItems
virtual QgsLegendSymbolList legendSymbolItems() const
Returns a list of symbology items for the legend.
Definition: qgsrenderer.cpp:377
QgsSettings
This class is a composition of two QSettings instances:
Definition: qgssettings.h:61
QgsMapLayerLegend::createLayerTreeModelLegendNodes
virtual QList< QgsLayerTreeModelLegendNode * > createLayerTreeModelLegendNodes(QgsLayerTreeLayer *nodeLayer)=0
Returns list of legend nodes to be used for a particular layer tree layer node.
QgsSymbol
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:92
QgsDebugMsg
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
QgsVectorLayer::diagramRenderer
const QgsDiagramRenderer * diagramRenderer() const
Definition: qgsvectorlayer.h:892
QgsDataDefinedSizeLegendNode
Produces legend node with a marker symbol.
Definition: qgslayertreemodellegendnode.h:707
QgsPointCloudLayer::renderer
QgsPointCloudRenderer * renderer()
Returns the 2D renderer for the point cloud.
Definition: qgspointcloudlayer.cpp:706
QgsDefaultRasterLayerLegend
Default legend implementation for raster layers.
Definition: qgsmaplayerlegend.h:318
QgsMapLayer::legend
QgsMapLayerLegend * legend() const
Can be nullptr.
Definition: qgsmaplayer.cpp:2087
QgsColorRampShader
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
Definition: qgscolorrampshader.h:42
QgsRuleBasedLabeling
Rule based labeling for a vector layer.
Definition: qgsrulebasedlabeling.h:42
QgsFeatureRenderer::legendClassificationAttribute
virtual QString legendClassificationAttribute() const
If supported by the renderer, return classification attribute for the use in legend.
Definition: qgsrenderer.h:382
QgsLegendPatchShape
Represents a patch shape for use in map legends.
Definition: qgslegendpatchshape.h:33
QgsVectorLabelLegendNode
Produces legend node for a labeling text symbol.
Definition: qgslayertreemodellegendnode.h:731
QgsRasterDataProvider::supportsLegendGraphic
virtual bool supportsLegendGraphic() const
Returns whether the provider supplies a legend graphic.
Definition: qgsrasterdataprovider.h:273
QgsRasterLayer::renderer
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
Definition: qgsrasterlayer.cpp:1758
QgsMeshLayer::rendererSettings
QgsMeshRendererSettings rendererSettings() const
Returns renderer settings.
Definition: qgsmeshlayer.cpp:344
QgsColorRampShader::Discrete
@ Discrete
Assigns the color of the higher class for every pixel between two class breaks.
Definition: qgscolorrampshader.h:51
QgsTextFormat
Container for all settings relating to text rendering.
Definition: qgstextformat.h:40
QgsLegendSymbolItem
The class stores information about one class/rule of a vector layer renderer in a unified way that ca...
Definition: qgslegendsymbolitem.h:36
QgsColorRampShader::createColorRamp
QgsColorRamp * createColorRamp() const
Creates a gradient color ramp from shader settings.
Definition: qgscolorrampshader.cpp:138
QgsMapLayerLegendUtils::setLegendNodeOrder
static void setLegendNodeOrder(QgsLayerTreeLayer *nodeLayer, const QList< int > &order)
Definition: qgsmaplayerlegend.cpp:77
qgsrulebasedlabeling.h
QgsMeshRendererSettings::activeScalarDatasetGroup
int activeScalarDatasetGroup() const
Returns the active scalar dataset group.
Definition: qgsmeshrenderersettings.cpp:507
qgspointcloudlayer.h
QgsColorRampShader::legendSymbologyItems
void legendSymbologyItems(QList< QPair< QString, QColor > > &symbolItems) const override
Returns legend symbology items if provided by renderer.
Definition: qgscolorrampshader.cpp:554
QgsMeshRendererSettings::scalarSettings
QgsMeshRendererScalarSettings scalarSettings(int groupIndex) const
Returns renderer settings.
Definition: qgsmeshrenderersettings.h:624
QgsColorRampShader::Exact
@ Exact
Assigns the color of the exact matching value in the color ramp item list.
Definition: qgscolorrampshader.h:52
QgsDefaultMeshLayerLegend::QgsDefaultMeshLayerLegend
QgsDefaultMeshLayerLegend(QgsMeshLayer *ml)
Creates an instance for the given mesh layer.
Definition: qgsmaplayerlegend.cpp:532
QgsDiagramRenderer::legendItems
virtual QList< QgsLayerTreeModelLegendNode * > legendItems(QgsLayerTreeLayer *nodeLayer) const
Returns list of legend nodes for the diagram.
Definition: qgsdiagramrenderer.cpp:938
QgsMeshRendererScalarSettings::colorRampShader
QgsColorRampShader colorRampShader() const
Returns color ramp shader function.
Definition: qgsmeshrenderersettings.cpp:81
QgsColorRampLegendNodeSettings::writeXml
void writeXml(QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context) const
Writes settings to an XML element.
Definition: qgscolorramplegendnodesettings.cpp:98
QgsDefaultVectorLayerLegend::writeXml
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const override
Writes configuration to a DOM element, to be used later with readXml()
Definition: qgsmaplayerlegend.cpp:472
QgsAbstractVectorLayerLabeling::subProviders
virtual QStringList subProviders() const
Gets list of sub-providers within the layer's labeling.
Definition: qgsvectorlayerlabeling.h:76
QgsMeshRendererSettings::activeVectorDatasetGroup
int activeVectorDatasetGroup() const
Returns the active vector dataset group.
Definition: qgsmeshrenderersettings.cpp:517
QgsVectorLayer::labeling
const QgsAbstractVectorLayerLabeling * labeling() const
Access to const labeling configuration.
Definition: qgsvectorlayer.h:1656
QgsMeshLayer
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:98
QgsMapLayerLegend::defaultVectorLegend
static QgsMapLayerLegend * defaultVectorLegend(QgsVectorLayer *vl)
Create new legend implementation for vector layer.
Definition: qgsmaplayerlegend.cpp:54
QgsLayerTreeLayer
Layer tree node points to a map layer.
Definition: qgslayertreelayer.h:43
QgsMapLayer::nameChanged
void nameChanged()
Emitted when the name has been changed.
QgsApplication::imageCache
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images.
Definition: qgsapplication.cpp:2365
QgsMapLayerLegendUtils::setLegendNodeCustomSymbol
static void setLegendNodeCustomSymbol(QgsLayerTreeLayer *nodeLayer, int originalIndex, const QgsSymbol *symbol)
Sets a custom legend symbol for the legend node belonging to nodeLayer at the specified originalIndex...
Definition: qgsmaplayerlegend.cpp:200
QgsWmsLegendNode
Implementation of legend node interface for displaying WMS legend entries.
Definition: qgslayertreemodellegendnode.h:658
QgsSymbolLayerUtils::loadSymbol
static QgsSymbol * loadSymbol(const QDomElement &element, const QgsReadWriteContext &context)
Attempts to load a symbol from a DOM element.
Definition: qgssymbollayerutils.cpp:1214
QgsDefaultRasterLayerLegend::QgsDefaultRasterLayerLegend
QgsDefaultRasterLayerLegend(QgsRasterLayer *rl)
Definition: qgsmaplayerlegend.cpp:502
QgsTextFormat::readXml
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Read settings from a DOM element.
Definition: qgstextformat.cpp:488
qgsrenderer.h
QgsMapLayer::legendPlaceholderImage
QString legendPlaceholderImage() const
Returns path to the placeholder image or an empty string if a generated legend is shown.
Definition: qgsmaplayer.h:1516
QgsRasterLayer
Represents a raster layer.
Definition: qgsrasterlayer.h:76
QgsMapLayerLegendUtils::hasLegendNodeOrder
static bool hasLegendNodeOrder(QgsLayerTreeLayer *nodeLayer)
Definition: qgsmaplayerlegend.cpp:141
QgsMapLayerLegend::QgsMapLayerLegend
QgsMapLayerLegend(QObject *parent=nullptr)
Constructor for QgsMapLayerLegend.
Definition: qgsmaplayerlegend.cpp:36
QgsLayerTreeLayer::layer
QgsMapLayer * layer() const
Returns the map layer associated with this node.
Definition: qgslayertreelayer.h:82
qgslayertree.h
qgsdiagramrenderer.h
QgsLayerTreeModelLegendNode::setEmbeddedInParent
virtual void setEmbeddedInParent(bool embedded)
Definition: qgslayertreemodellegendnode.h:117
QgsMapLayer::rendererChanged
void rendererChanged()
Signal emitted when renderer is changed.
QgsColorRampLegendNodeSettings::useContinuousLegend
bool useContinuousLegend() const
Returns true if a continuous gradient legend will be used.
Definition: qgscolorramplegendnodesettings.cpp:193
QgsMeshDatasetGroupMetadata::name
QString name() const
Returns name of the dataset group.
Definition: qgsmeshdataset.cpp:167
QgsSymbolLayerUtils::encodeSize
static QString encodeSize(QSizeF size)
Encodes a QSizeF to a string.
Definition: qgssymbollayerutils.cpp:602
QgsAbstractVectorLayerLabeling
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
Definition: qgsvectorlayerlabeling.h:41
QgsRasterShaderFunction::minimumValue
double minimumValue() const
Returns the maximum value for the raster shader.
Definition: qgsrastershaderfunction.h:112
QgsWms::legendNode
QgsLayerTreeModelLegendNode * legendNode(const QString &rule, QgsLayerTreeModel &model)
Definition: qgswmsgetlegendgraphics.cpp:363
QgsMapLayerLegendUtils::legendNodeOrder
static QList< int > legendNodeOrder(QgsLayerTreeLayer *nodeLayer)
Definition: qgsmaplayerlegend.cpp:114
QgsLayerTreeNode::customProperties
QStringList customProperties() const
Returns list of keys stored in custom properties.
Definition: qgslayertreenode.cpp:231
qgsmeshlayer.h
qgsvectorlayer.h
QgsMapLayerLegend::defaultRasterLegend
static QgsMapLayerLegend * defaultRasterLegend(QgsRasterLayer *rl)
Create new legend implementation for raster layer.
Definition: qgsmaplayerlegend.cpp:59
QgsColorRampShader::colorRampItemList
QList< QgsColorRampShader::ColorRampItem > colorRampItemList() const
Returns the custom colormap.
Definition: qgscolorrampshader.h:132
QgsColorRampShader::colorRampType
Type colorRampType() const
Returns the color ramp type.
Definition: qgscolorrampshader.h:135
QgsMapLayerLegendUtils::setLegendNodeUserLabel
static void setLegendNodeUserLabel(QgsLayerTreeLayer *nodeLayer, int originalIndex, const QString &newLabel)
Definition: qgsmaplayerlegend.cpp:146
QgsMeshRendererScalarSettings
Represents a mesh renderer settings for scalar datasets.
Definition: qgsmeshrenderersettings.h:94
QgsDefaultMeshLayerLegend
Default legend implementation for mesh layers.
Definition: qgsmaplayerlegend.h:337
QgsLayerTreeModelLegendNode::setUserLabel
virtual void setUserLabel(const QString &userLabel)
Definition: qgslayertreemodellegendnode.h:120
QgsMapLayerLegendUtils::legendNodePatchShape
static QgsLegendPatchShape legendNodePatchShape(QgsLayerTreeLayer *nodeLayer, int originalIndex)
Returns the legend patch shape for the legend node belonging to nodeLayer at the specified originalIn...
Definition: qgsmaplayerlegend.cpp:170
QgsMapLayerLegendUtils::setLegendNodeColorRampSettings
static void setLegendNodeColorRampSettings(QgsLayerTreeLayer *nodeLayer, int originalIndex, const QgsColorRampLegendNodeSettings *settings)
Sets a custom legend color ramp settings for the legend node belonging to nodeLayer at the specified ...
Definition: qgsmaplayerlegend.cpp:231
QgsFeatureRenderer
Definition: qgsrenderer.h:101
QgsLayerTreeNode::setCustomProperty
void setCustomProperty(const QString &key, const QVariant &value)
Sets a custom property for the node. Properties are stored in a map and saved in project file.
Definition: qgslayertreenode.cpp:208
str
#define str(x)
Definition: qgis.cpp:37
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
qgsimagecache.h
QgsLayerTreeNode::customProperty
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer. Properties are stored in a map and saved in project file.
Definition: qgslayertreenode.cpp:217
QgsMapLayerLegend::itemsChanged
void itemsChanged()
Emitted when existing items/nodes got invalid and should be replaced by new ones.
QgsDefaultVectorLayerLegend::createLayerTreeModelLegendNodes
QList< QgsLayerTreeModelLegendNode * > createLayerTreeModelLegendNodes(QgsLayerTreeLayer *nodeLayer) override
Returns list of legend nodes to be used for a particular layer tree layer node.
Definition: qgsmaplayerlegend.cpp:359
QgsRuleBasedLabeling::Rule::description
QString description() const
A human readable description for this rule.
Definition: qgsrulebasedlabeling.h:118
qgssettings.h
QgsImageLegendNode
Implementation of legend node interface for displaying arbitrary raster image.
Definition: qgslayertreemodellegendnode.h:576
QgsPointCloudRenderer
Abstract base class for 2d point cloud renderers.
Definition: qgspointcloudrenderer.h:296
QgsMapLayerLegendUtils::setLegendNodeSymbolSize
static void setLegendNodeSymbolSize(QgsLayerTreeLayer *nodeLayer, int originalIndex, QSizeF size)
Sets the legend symbol size for the legend node belonging to nodeLayer at the specified originalIndex...
Definition: qgsmaplayerlegend.cpp:183
QgsLegendColorList
QList< QPair< QString, QColor > > QgsLegendColorList
Definition: qgsrasterlayer.h:55
QgsMapLayerLegendUtils::legendNodeUserLabel
static QString legendNodeUserLabel(QgsLayerTreeLayer *nodeLayer, int originalIndex)
Definition: qgsmaplayerlegend.cpp:151
qgsmaplayerlegend.h
qgsiconutils.h
qgspluginlayer.h
QgsVectorLayer::countSymbolFeatures
QgsVectorLayerFeatureCounter * countSymbolFeatures(bool storeSymbolFids=false)
Count features for symbols.
Definition: qgsvectorlayer.cpp:827
QgsDefaultRasterLayerLegend::createLayerTreeModelLegendNodes
QList< QgsLayerTreeModelLegendNode * > createLayerTreeModelLegendNodes(QgsLayerTreeLayer *nodeLayer) override
Returns list of legend nodes to be used for a particular layer tree layer node.
Definition: qgsmaplayerlegend.cpp:508
QgsMeshLayer::datasetGroupMetadata
QgsMeshDatasetGroupMetadata datasetGroupMetadata(const QgsMeshDatasetIndex &index) const
Returns the dataset groups metadata.
Definition: qgsmeshlayer.cpp:404
QgsColorRampLegendNodeSettings::readXml
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads settings from an XML element.
Definition: qgscolorramplegendnodesettings.cpp:122
qgsvectorlayerlabeling.h
QgsRasterSymbolLegendNode
Implementation of legend node interface for displaying raster legend entries.
Definition: qgslayertreemodellegendnode.h:606
QgsMapLayerLegendUtils::legendNodeCustomSymbol
static QgsSymbol * legendNodeCustomSymbol(QgsLayerTreeLayer *nodeLayer, int originalIndex)
Returns the custom legend symbol for the legend node belonging to nodeLayer at the specified original...
Definition: qgsmaplayerlegend.cpp:215
QgsDefaultPointCloudLayerLegend
Default legend implementation for point cloud layers.
Definition: qgsmaplayerlegend.h:356
QgsSymbolLegendNode
Implementation of legend node interface for displaying preview of vector symbols and their labels and...
Definition: qgslayertreemodellegendnode.h:358
QgsMapLayerLegendUtils::hasLegendNodeUserLabel
static bool hasLegendNodeUserLabel(QgsLayerTreeLayer *nodeLayer, int originalIndex)
Definition: qgsmaplayerlegend.cpp:156
QgsLayerTreeNode::removeCustomProperty
void removeCustomProperty(const QString &key)
Remove a custom property from layer. Properties are stored in a map and saved in project file.
Definition: qgslayertreenode.cpp:222
QgsColorRampShader::Interpolated
@ Interpolated
Interpolates the color between two class breaks linearly.
Definition: qgscolorrampshader.h:50
qgspointcloudrenderer.h
QgsLegendPatchShape::writeXml
void writeXml(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) const
Write settings into a DOM element.
Definition: qgslegendpatchshape.cpp:222
QgsMapLayerLegendUtils::legendNodeSymbolSize
static QSizeF legendNodeSymbolSize(QgsLayerTreeLayer *nodeLayer, int originalIndex)
Returns the legend node symbol size for the legend node belonging to nodeLayer at the specified origi...
Definition: qgsmaplayerlegend.cpp:191
QgsTextFormat::writeXml
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Write settings into a DOM element.
Definition: qgstextformat.cpp:671
QgsMapLayerLegend::defaultPointCloudLegend
static QgsMapLayerLegend * defaultPointCloudLegend(QgsPointCloudLayer *layer)
Create new legend implementation for a point cloud layer.
Definition: qgsmaplayerlegend.cpp:69
QgsSymbolLayerUtils::saveSymbol
static QDomElement saveSymbol(const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
Definition: qgssymbollayerutils.cpp:1397
QgsRasterRenderer::createLegendNodes
virtual QList< QgsLayerTreeModelLegendNode * > createLegendNodes(QgsLayerTreeLayer *nodeLayer)
Creates a set of legend nodes representing the renderer.
Definition: qgsrasterrenderer.cpp:110
QgsSymbolLayerUtils::decodeSize
static QSizeF decodeSize(const QString &string)
Decodes a QSizeF from a string.
Definition: qgssymbollayerutils.cpp:607
QgsDefaultVectorLayerLegend::QgsDefaultVectorLayerLegend
QgsDefaultVectorLayerLegend(QgsVectorLayer *vl)
Definition: qgsmaplayerlegend.cpp:352
QgsAbstractVectorLayerLabeling::settings
virtual QgsPalLayerSettings settings(const QString &providerId=QString()) const =0
Gets associated label settings.
QgsLegendPatchShape::readXml
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Read settings from a DOM element.
Definition: qgslegendpatchshape.cpp:215
QgsColorRampLegendNodeSettings
Settings for a color ramp legend node.
Definition: qgscolorramplegendnodesettings.h:37
QgsRasterLayer::dataProvider
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
Definition: qgsrasterlayer.cpp:257
QgsVectorLayer::labelsEnabled
bool labelsEnabled() const
Returns whether the layer contains labels which are enabled and should be drawn.
Definition: qgsvectorlayer.cpp:789
QgsMapLayerLegend::readXml
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Reads configuration from a DOM element previously written by writeXml()
Definition: qgsmaplayerlegend.cpp:41
QgsDefaultPointCloudLayerLegend::createLayerTreeModelLegendNodes
QList< QgsLayerTreeModelLegendNode * > createLayerTreeModelLegendNodes(QgsLayerTreeLayer *nodeLayer) override
Returns list of legend nodes to be used for a particular layer tree layer node.
Definition: qgsmaplayerlegend.cpp:610
QgsVectorLayer::renderer
QgsFeatureRenderer * renderer()
Returns the feature renderer used for rendering the features in the layer in 2D map views.
Definition: qgsvectorlayer.h:903
QgsColorRampShader::legendSettings
const QgsColorRampLegendNodeSettings * legendSettings() const
Returns the color ramp shader legend settings.
Definition: qgscolorrampshader.cpp:641
QgsLayerTreeModelLegendNode::setColumnBreak
virtual void setColumnBreak(bool breakBeforeNode)
Sets whether a forced column break should occur before the node.
Definition: qgslayertreemodellegendnode.h:150
QgsLayerTreeModelLegendNode
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...
Definition: qgslayertreemodellegendnode.h:49