QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
qgsmapclippingregion.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmapclippingregion.h
3  --------------------------------------
4  Date : June 2020
5  Copyright : (C) 2020 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 QGSMAPCLIPPINGREGION_H
17 #define QGSMAPCLIPPINGREGION_H
18 
19 #include "qgis_core.h"
20 #include "qgsgeometry.h"
21 #include "qgsmaplayer.h"
22 
23 #include <QPointer>
24 
33 class CORE_EXPORT QgsMapClippingRegion
34 {
35  public:
36 
41  enum class FeatureClippingType : int
42  {
43  ClipToIntersection,
44  ClipPainterOnly,
45  NoClipping,
46  };
47 
51  explicit QgsMapClippingRegion( const QgsGeometry &geometry )
52  : mGeometry( geometry )
53  {}
54 
60  QgsGeometry geometry() const;
61 
67  void setGeometry( const QgsGeometry &geometry );
68 
77  {
78  return mFeatureClip;
79  }
80 
89  {
90  mFeatureClip = type;
91  }
92 
99  bool restrictToLayers() const;
100 
107  void setRestrictToLayers( bool enabled );
108 
119  void setRestrictedLayers( const QList< QgsMapLayer * > &layers );
120 
131  QList< QgsMapLayer * > restrictedLayers() const;
132 
136  bool appliesToLayer( const QgsMapLayer *layer ) const;
137 
138  private:
139 
141  QgsGeometry mGeometry;
142 
143  bool mRestrictToLayers = false;
144  QgsWeakMapLayerPointerList mRestrictToLayersList;
145 
146  FeatureClippingType mFeatureClip = FeatureClippingType::ClipToIntersection;
147 
148 };
149 
150 #endif // QGSMAPCLIPPINGREGION_H
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:125
A map clipping region (in map coordinates and CRS).
FeatureClippingType
Feature clipping behavior, which controls how features from vector layers will be clipped.
void setFeatureClip(FeatureClippingType type)
Sets the feature clipping type.
FeatureClippingType featureClip() const
Returns the feature clipping type.
QgsMapClippingRegion(const QgsGeometry &geometry)
Constructor for a map clipping region, with the specified geometry in the destination map CRS.
Base class for all map layer types.
Definition: qgsmaplayer.h:73
QList< QgsWeakMapLayerPointer > QgsWeakMapLayerPointerList
A list of weak pointers to QgsMapLayers.
Definition: qgsmaplayer.h:2137