QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgslayertreefiltersettings.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayertreefiltersettings.h
3 --------------------------------------
4 Date : March 2023
5 Copyright : (C) 2023 by Nyall Dawson
6 Email : nyall dot dawson 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#ifndef QGSLAYERTREEFILTERSETTINGS_H
17#define QGSLAYERTREEFILTERSETTINGS_H
18
19#include "qgis_core.h"
20#include "qgis.h"
22#include "qgsgeometry.h"
23#include "qgsmaplayer.h"
24
25#include <QString>
26#include <QMap>
27#include <memory>
28
29class QgsMapSettings;
30class QgsLayerTree;
32
40{
41 public:
42
46 explicit QgsLayerTreeFilterSettings( const QgsMapSettings &settings );
47
49
51
53
57 QgsMapSettings &mapSettings();
58
65 QMap<QString, QString> layerFilterExpressions() const;
66
72 void setLayerFilterExpressions( const QMap<QString, QString> &expressions );
73
77 void setLayerFilterExpressionsFromLayerTree( QgsLayerTree *tree );
78
86 QString layerFilterExpression( const QString &layerId ) const;
87
98 QgsGeometry filterPolygon() const;
99
110 void setFilterPolygon( const QgsGeometry &polygon );
111
117 Qgis::LayerTreeFilterFlags flags() const;
118
124 void setFlags( Qgis::LayerTreeFilterFlags flags );
125
134 void addVisibleExtentForLayer( QgsMapLayer *layer, const QgsReferencedGeometry &polygon );
135
146 QgsGeometry combinedVisibleExtentForLayer( const QgsMapLayer *layer );
147
156 QList<QgsMapLayer *> layers() const;
157
158 private:
159
160 QMap<QString, QString> mLayerFilterExpressions;
161
162 std::unique_ptr<QgsMapSettings> mMapSettings;
163
164 QgsGeometry mFilterPolygon;
165
167
169
170 // geometry must be in layer CRS
171 QMap<QString, QVector< QgsGeometry > > mLayerExtents;
172
173};
174
175#endif // QGSLAYERTREEFILTERSETTINGS_H
QFlags< LayerTreeFilterFlag > LayerTreeFilterFlags
Layer tree filter flags.
Definition qgis.h:4248
A geometry is the spatial representation of a feature.
Contains settings relating to filtering the contents of QgsLayerTreeModel and views.
Namespace with helper functions for layer tree operations.
Base class for all map layer types.
Definition qgsmaplayer.h:76
The QgsMapSettings class contains configuration for rendering of the map.
A QgsGeometry with associated coordinate reference system.
QList< QgsWeakMapLayerPointer > QgsWeakMapLayerPointerList
A list of weak pointers to QgsMapLayers.