QGIS API Documentation  3.20.0-Odense (decaadbb31)
Public Types | Public Member Functions | List of all members
QgsMapClippingRegion Class Reference

A map clipping region (in map coordinates and CRS). More...

#include <qgsmapclippingregion.h>

Public Types

enum class  FeatureClippingType : int { ClipToIntersection , ClipPainterOnly , NoClipping }
 Feature clipping behavior, which controls how features from vector layers will be clipped. More...
 

Public Member Functions

 QgsMapClippingRegion (const QgsGeometry &geometry)
 Constructor for a map clipping region, with the specified geometry in the destination map CRS. More...
 
bool appliesToLayer (const QgsMapLayer *layer) const
 Returns true if the clipping region should be applied to the specified map layer. More...
 
FeatureClippingType featureClip () const
 Returns the feature clipping type. More...
 
QgsGeometry geometry () const
 Returns the geometry of the clipping region (in the destination map CRS). More...
 
QList< QgsMapLayer * > restrictedLayers () const
 Returns the list of layers to restrict the clipping region effects to. More...
 
bool restrictToLayers () const
 Returns true if clipping should be restricted to a subset of layers. More...
 
void setFeatureClip (FeatureClippingType type)
 Sets the feature clipping type. More...
 
void setGeometry (const QgsGeometry &geometry)
 Sets the clipping region geometry (in the destination map CRS). More...
 
void setRestrictedLayers (const QList< QgsMapLayer * > &layers)
 Sets a list of layers to restrict the clipping region effects to. More...
 
void setRestrictToLayers (bool enabled)
 Sets whether clipping should be restricted to a subset of layers. More...
 

Detailed Description

A map clipping region (in map coordinates and CRS).

Since
QGIS 3.16

Definition at line 33 of file qgsmapclippingregion.h.

Member Enumeration Documentation

◆ FeatureClippingType

Feature clipping behavior, which controls how features from vector layers will be clipped.

Enumerator
ClipToIntersection 

Clip the geometry of these features to the region prior to rendering (i.e. feature boundaries will follow the clip region)

ClipPainterOnly 

Applying clipping on the painter only (i.e. feature boundaries will be unchanged, but may be invisible where the feature falls outside the clipping region)

NoClipping 

Only render features which intersect the clipping region, but do not clip these features to the region.

Definition at line 41 of file qgsmapclippingregion.h.

Constructor & Destructor Documentation

◆ QgsMapClippingRegion()

QgsMapClippingRegion::QgsMapClippingRegion ( const QgsGeometry geometry)
inlineexplicit

Constructor for a map clipping region, with the specified geometry in the destination map CRS.

Definition at line 51 of file qgsmapclippingregion.h.

Member Function Documentation

◆ appliesToLayer()

bool QgsMapClippingRegion::appliesToLayer ( const QgsMapLayer layer) const

Returns true if the clipping region should be applied to the specified map layer.

Definition at line 40 of file qgsmapclippingregion.cpp.

◆ featureClip()

FeatureClippingType QgsMapClippingRegion::featureClip ( ) const
inline

Returns the feature clipping type.

This setting is only used while rendering vector layers, for other layer types it is ignored.

See also
setFeatureClip()

Definition at line 76 of file qgsmapclippingregion.h.

◆ geometry()

QgsGeometry QgsMapClippingRegion::geometry ( ) const

Returns the geometry of the clipping region (in the destination map CRS).

See also
setGeometry().

Definition at line 20 of file qgsmapclippingregion.cpp.

◆ restrictedLayers()

QList< QgsMapLayer * > QgsMapClippingRegion::restrictedLayers ( ) const

Returns the list of layers to restrict the clipping region effects to.

If the list is empty then the clipping will be applied to all layers.

Note
This setting is only used if restrictToLayers() is true.
See also
setRestrictedLayers()
restrictToLayers()

Definition at line 35 of file qgsmapclippingregion.cpp.

◆ restrictToLayers()

bool QgsMapClippingRegion::restrictToLayers ( ) const

Returns true if clipping should be restricted to a subset of layers.

See also
restrictedLayers()
setRestrictToLayers()

Definition at line 55 of file qgsmapclippingregion.cpp.

◆ setFeatureClip()

void QgsMapClippingRegion::setFeatureClip ( FeatureClippingType  type)
inline

Sets the feature clipping type.

This setting is only used while rendering vector layers, for other layer types it is ignored.

See also
featureClip()

Definition at line 88 of file qgsmapclippingregion.h.

◆ setGeometry()

void QgsMapClippingRegion::setGeometry ( const QgsGeometry geometry)

Sets the clipping region geometry (in the destination map CRS).

See also
geometry()

Definition at line 25 of file qgsmapclippingregion.cpp.

◆ setRestrictedLayers()

void QgsMapClippingRegion::setRestrictedLayers ( const QList< QgsMapLayer * > &  layers)

Sets a list of layers to restrict the clipping region effects to.

By default the clipping region applies to all layers.

Note
This setting is only used if restrictToLayers() is true.
See also
restrictedLayers()
setRestrictToLayers()

Definition at line 30 of file qgsmapclippingregion.cpp.

◆ setRestrictToLayers()

void QgsMapClippingRegion::setRestrictToLayers ( bool  enabled)

Sets whether clipping should be restricted to a subset of layers.

See also
setRestrictedLayers()
restrictToLayers()

Definition at line 60 of file qgsmapclippingregion.cpp.


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