QGIS API Documentation  3.9.0-Master (b837e65662)
Public Member Functions | List of all members
QgsWmsLegendNode Class Reference

Implementation of legend node interface for displaying WMS legend entries. More...

#include <qgslayertreemodellegendnode.h>

Inheritance diagram for QgsWmsLegendNode:
Inheritance graph
[legend]

Public Member Functions

 QgsWmsLegendNode (QgsLayerTreeLayer *nodeLayer, QObject *parent=nullptr)
 Constructor for QgsWmsLegendNode. More...
 
QVariant data (int role) const override
 Returns data associated with the item. Must be implemented in derived class. More...
 
QSizeF drawSymbol (const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const override
 Draws symbol on the left side of the item. More...
 
void exportSymbolToJson (const QgsLegendSettings &settings, const QgsRenderContext &context, QJsonObject &json) const override
 Adds a symbol in base64 string within a JSON object with the key "icon". More...
 
void invalidateMapBasedData () override
 Notification from model that information from associated map view has changed. More...
 
- Public Member Functions inherited from QgsLayerTreeModelLegendNode
virtual ItemMetrics draw (const QgsLegendSettings &settings, ItemContext *ctx)
 Entry point called from QgsLegendRenderer to do the rendering. More...
 
virtual QSizeF drawSymbolText (const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize) const
 Draws label on the right side of the item. More...
 
void exportSymbolTextToJson (const QgsLegendSettings &settings, QJsonObject &json) const
 Adds a label in a JSON object with the key "title". More...
 
void exportToJson (const QgsLegendSettings &settings, const QgsRenderContext &context, QJsonObject &json)
 Entry point called from QgsLegendRenderer to do the rendering in a JSON object. More...
 
virtual Qt::ItemFlags flags () const
 Returns item flags associated with the item. Default implementation returns Qt::ItemIsEnabled. More...
 
virtual bool isEmbeddedInParent () const
 
virtual bool isScaleOK (double scale) const
 
QgsLayerTreeLayerlayerNode () const
 Returns pointer to the parent layer node. More...
 
QgsLayerTreeModelmodel () const
 Returns pointer to model owning this legend node. More...
 
virtual bool setData (const QVariant &value, int role)
 Sets some data associated with the item. Default implementation does nothing and returns false. More...
 
virtual void setEmbeddedInParent (bool embedded)
 
virtual void setUserLabel (const QString &userLabel)
 
virtual QString userLabel () const
 

Additional Inherited Members

- Public Types inherited from QgsLayerTreeModelLegendNode
enum  LegendNodeRoles { RuleKeyRole = Qt::UserRole, ParentRuleKeyRole }
 
- Signals inherited from QgsLayerTreeModelLegendNode
void dataChanged ()
 Emitted on internal data change so the layer tree model can forward the signal to views. More...
 
- Protected Member Functions inherited from QgsLayerTreeModelLegendNode
 QgsLayerTreeModelLegendNode (QgsLayerTreeLayer *nodeL, QObject *parent=nullptr)
 Construct the node with pointer to its parent layer node. More...
 
QgsRenderContextcreateTemporaryRenderContext () const
 Returns a temporary context or nullptr if legendMapViewData are not valid. More...
 
- Protected Attributes inherited from QgsLayerTreeModelLegendNode
bool mEmbeddedInParent
 
QgsLayerTreeLayermLayerNode = nullptr
 
QString mUserLabel
 

Detailed Description

Implementation of legend node interface for displaying WMS legend entries.

Since
QGIS 2.8

Definition at line 504 of file qgslayertreemodellegendnode.h.

Constructor & Destructor Documentation

◆ QgsWmsLegendNode()

QgsWmsLegendNode::QgsWmsLegendNode ( QgsLayerTreeLayer nodeLayer,
QObject *  parent = nullptr 
)

Constructor for QgsWmsLegendNode.

Parameters
nodeLayerlayer node
parentattach a parent QObject to the legend node.

Definition at line 923 of file qgslayertreemodellegendnode.cpp.

Member Function Documentation

◆ data()

QVariant QgsWmsLegendNode::data ( int  role) const
overridevirtual

Returns data associated with the item. Must be implemented in derived class.

Implements QgsLayerTreeModelLegendNode.

Definition at line 961 of file qgslayertreemodellegendnode.cpp.

◆ drawSymbol()

QSizeF QgsWmsLegendNode::drawSymbol ( const QgsLegendSettings settings,
ItemContext ctx,
double  itemHeight 
) const
overridevirtual

Draws symbol on the left side of the item.

Parameters
settingsLegend layout configuration
ctxContext for rendering - may be nullptr if only doing layout without actual rendering
itemHeightMinimal height of the legend item - used for correct positioning when rendering
Returns
Real size of the symbol (may be bigger than "normal" symbol size from settings)

Reimplemented from QgsLayerTreeModelLegendNode.

Definition at line 976 of file qgslayertreemodellegendnode.cpp.

◆ exportSymbolToJson()

void QgsWmsLegendNode::exportSymbolToJson ( const QgsLegendSettings settings,
const QgsRenderContext context,
QJsonObject &  json 
) const
overridevirtual

Adds a symbol in base64 string within a JSON object with the key "icon".

Parameters
settingsLegend layout configuration
contextRendering context
jsonThe json object to update
Since
QGIS 3.8

Reimplemented from QgsLayerTreeModelLegendNode.

Definition at line 1007 of file qgslayertreemodellegendnode.cpp.

◆ invalidateMapBasedData()

void QgsWmsLegendNode::invalidateMapBasedData ( )
overridevirtual

Notification from model that information from associated map view has changed.

Default implementation does nothing.

Reimplemented from QgsLayerTreeModelLegendNode.

Definition at line 1079 of file qgslayertreemodellegendnode.cpp.


The documentation for this class was generated from the following files: