QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsLayerTreeFilterSettings Class Reference

Contains settings relating to filtering the contents of QgsLayerTreeModel and views. More...

#include <qgslayertreefiltersettings.h>

Public Member Functions

 QgsLayerTreeFilterSettings (const QgsLayerTreeFilterSettings &other)
 
 QgsLayerTreeFilterSettings (const QgsMapSettings &settings)
 Constructor for QgsLayerTreeFilterSettings, using the specified map settings.
 
 ~QgsLayerTreeFilterSettings ()
 
void addVisibleExtentForLayer (QgsMapLayer *layer, const QgsReferencedGeometry &polygon)
 Adds a visible extent polygon for a map layer.
 
QgsGeometry combinedVisibleExtentForLayer (const QgsMapLayer *layer)
 Returns the combined visible extent for a layer.
 
QgsGeometry filterPolygon () const
 Returns the optional filter polygon, used when testing for symbols to show in the legend.
 
Qgis::LayerTreeFilterFlags flags () const
 Returns the filter flags.
 
QString layerFilterExpression (const QString &layerId) const
 Returns the filter expression to use for the layer with the specified layerId, or an empty string if no expression is set for the layer.
 
QMap< QString, QString > layerFilterExpressions () const
 Returns the map of layer IDs to legend filter expression.
 
QList< QgsMapLayer * > layers () const
 Returns the layers which should be shown in the legend.
 
QgsMapSettingsmapSettings ()
 Returns the map settings used to filter the legend content.
 
QgsLayerTreeFilterSettingsoperator= (const QgsLayerTreeFilterSettings &other)
 
void setFilterPolygon (const QgsGeometry &polygon)
 Sets the optional filter polygon, used when testing for symbols to show in the legend.
 
void setFlags (Qgis::LayerTreeFilterFlags flags)
 Sets the filter flags.
 
void setLayerFilterExpressions (const QMap< QString, QString > &expressions)
 Sets the map of layer IDs to legend filter expression.
 
void setLayerFilterExpressionsFromLayerTree (QgsLayerTree *tree)
 Sets layer filter expressions using a layer tree.
 

Detailed Description

Contains settings relating to filtering the contents of QgsLayerTreeModel and views.

Since
QGIS 3.32

Definition at line 39 of file qgslayertreefiltersettings.h.

Constructor & Destructor Documentation

◆ QgsLayerTreeFilterSettings() [1/2]

QgsLayerTreeFilterSettings::QgsLayerTreeFilterSettings ( const QgsMapSettings settings)
explicit

Constructor for QgsLayerTreeFilterSettings, using the specified map settings.

Definition at line 25 of file qgslayertreefiltersettings.cpp.

◆ ~QgsLayerTreeFilterSettings()

QgsLayerTreeFilterSettings::~QgsLayerTreeFilterSettings ( )
default

◆ QgsLayerTreeFilterSettings() [2/2]

QgsLayerTreeFilterSettings::QgsLayerTreeFilterSettings ( const QgsLayerTreeFilterSettings other)

Definition at line 33 of file qgslayertreefiltersettings.cpp.

Member Function Documentation

◆ addVisibleExtentForLayer()

void QgsLayerTreeFilterSettings::addVisibleExtentForLayer ( QgsMapLayer layer,
const QgsReferencedGeometry polygon 
)

Adds a visible extent polygon for a map layer.

If layer is already included in the layers contained within mapSettings() (or previously added by calling this method) then this polygon extent will be unioned with the existing extent.

The layer will be appended to the list of layers to use during the legend hit test. (See layers()).

Definition at line 111 of file qgslayertreefiltersettings.cpp.

◆ combinedVisibleExtentForLayer()

QgsGeometry QgsLayerTreeFilterSettings::combinedVisibleExtentForLayer ( const QgsMapLayer layer)

Returns the combined visible extent for a layer.

The combined visible extent includes:

The returned geometry will always be in the layer's CRS.

Definition at line 128 of file qgslayertreefiltersettings.cpp.

◆ filterPolygon()

QgsGeometry QgsLayerTreeFilterSettings::filterPolygon ( ) const

Returns the optional filter polygon, used when testing for symbols to show in the legend.

The CRS of the polygon will match the destination CRS of mapSettings().

If not set then the filter visibility extent will use the extent of mapSettings().

See also
setFilterPolygon()

Definition at line 91 of file qgslayertreefiltersettings.cpp.

◆ flags()

Qgis::LayerTreeFilterFlags QgsLayerTreeFilterSettings::flags ( ) const

Returns the filter flags.

See also
setFlags()

Definition at line 101 of file qgslayertreefiltersettings.cpp.

◆ layerFilterExpression()

QString QgsLayerTreeFilterSettings::layerFilterExpression ( const QString &  layerId) const

Returns the filter expression to use for the layer with the specified layerId, or an empty string if no expression is set for the layer.

See also
layerFilterExpressions()
setLayerFilterExpressions()

Definition at line 86 of file qgslayertreefiltersettings.cpp.

◆ layerFilterExpressions()

QMap< QString, QString > QgsLayerTreeFilterSettings::layerFilterExpressions ( ) const

Returns the map of layer IDs to legend filter expression.

See also
layerFilterExpression()
setLayerFilterExpressions()

Definition at line 60 of file qgslayertreefiltersettings.cpp.

◆ layers()

QList< QgsMapLayer * > QgsLayerTreeFilterSettings::layers ( ) const

Returns the layers which should be shown in the legend.

This includes all layers from the mapSettings() and any additional layers added by calls to addVisibleExtentForLayer().

See also
addVisibleExtentForLayer()

Definition at line 165 of file qgslayertreefiltersettings.cpp.

◆ mapSettings()

QgsMapSettings & QgsLayerTreeFilterSettings::mapSettings ( )

Returns the map settings used to filter the legend content.

Definition at line 55 of file qgslayertreefiltersettings.cpp.

◆ operator=()

QgsLayerTreeFilterSettings & QgsLayerTreeFilterSettings::operator= ( const QgsLayerTreeFilterSettings other)

Definition at line 44 of file qgslayertreefiltersettings.cpp.

◆ setFilterPolygon()

void QgsLayerTreeFilterSettings::setFilterPolygon ( const QgsGeometry polygon)

Sets the optional filter polygon, used when testing for symbols to show in the legend.

The CRS of the polygon must match the destination CRS of mapSettings().

If not set then the filter visibility extent will use the extent of mapSettings().

See also
filterPolygon()

Definition at line 96 of file qgslayertreefiltersettings.cpp.

◆ setFlags()

void QgsLayerTreeFilterSettings::setFlags ( Qgis::LayerTreeFilterFlags  flags)

Sets the filter flags.

See also
flags()

Definition at line 106 of file qgslayertreefiltersettings.cpp.

◆ setLayerFilterExpressions()

void QgsLayerTreeFilterSettings::setLayerFilterExpressions ( const QMap< QString, QString > &  expressions)

Sets the map of layer IDs to legend filter expression.

See also
layerFilterExpressions()

Definition at line 65 of file qgslayertreefiltersettings.cpp.

◆ setLayerFilterExpressionsFromLayerTree()

void QgsLayerTreeFilterSettings::setLayerFilterExpressionsFromLayerTree ( QgsLayerTree tree)

Sets layer filter expressions using a layer tree.

Definition at line 70 of file qgslayertreefiltersettings.cpp.


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