QGIS API Documentation 3.35.0-Master (f6e073f0eed)
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
54
56
60 QgsMapSettings &mapSettings();
61
68 QMap<QString, QString> layerFilterExpressions() const;
69
75 void setLayerFilterExpressions( const QMap<QString, QString> &expressions );
76
80 void setLayerFilterExpressionsFromLayerTree( QgsLayerTree *tree );
81
89 QString layerFilterExpression( const QString &layerId ) const;
90
101 QgsGeometry filterPolygon() const;
102
113 void setFilterPolygon( const QgsGeometry &polygon );
114
120 Qgis::LayerTreeFilterFlags flags() const;
121
127 void setFlags( Qgis::LayerTreeFilterFlags flags );
128
137 void addVisibleExtentForLayer( QgsMapLayer *layer, const QgsReferencedGeometry &polygon );
138
149 QgsGeometry combinedVisibleExtentForLayer( const QgsMapLayer *layer );
150
159 QList<QgsMapLayer *> layers() const;
160
161 private:
162
163 QMap<QString, QString> mLayerFilterExpressions;
164
165 std::unique_ptr<QgsMapSettings> mMapSettings;
166
167 QgsGeometry mFilterPolygon;
168
169 Qgis::LayerTreeFilterFlags mFlags;
170
172
173 // geometry must be in layer CRS
174 QMap<QString, QVector< QgsGeometry > > mLayerExtents;
175
176};
177
178#endif // QGSLAYERTREEFILTERSETTINGS_H
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:75
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.