26 QList< QgsMapClippingRegion > res;
27 const QList< QgsMapClippingRegion > regions = context.
clippingRegions();
28 res.reserve( regions.size() );
30 std::copy_if( regions.begin(), regions.end(), std::back_inserter( res ), [layer](
const QgsMapClippingRegion & region )
32 return region.appliesToLayer( layer );
45 if ( region.geometry().type() != Qgis::GeometryType::Polygon )
51 result = region.geometry();
73 QgsDebugMsg( QStringLiteral(
"Could not transform clipping region to layer CRS" ) );
88 if ( region.geometry().type() != Qgis::GeometryType::Polygon )
97 result = region.geometry();
119 QgsDebugMsg( QStringLiteral(
"Could not transform clipping region to layer CRS" ) );
134 if ( region.geometry().type() != Qgis::GeometryType::Polygon )
139 case Qgis::LayerType::Vector:
144 case Qgis::LayerType::VectorTile:
150 case Qgis::LayerType::Mesh:
151 case Qgis::LayerType::Raster:
152 case Qgis::LayerType::Plugin:
153 case Qgis::LayerType::PointCloud:
154 case Qgis::LayerType::Annotation:
155 case Qgis::LayerType::Group:
164 result = region.geometry();
174 return QPainterPath();
189 if ( region.geometry().type() != Qgis::GeometryType::Polygon )
202 result = region.geometry();
224 QgsDebugMsg( QStringLiteral(
"Could not transform clipping region to layer CRS" ) );
LayerType
Types of layers that can be added to a map.
virtual QPainterPath asQPainterPath() const =0
Returns the geometry represented as a QPainterPath.
Custom exception class for Coordinate Reference System related exceptions.
A geometry is the spatial representation of a feature.
const QgsAbstractGeometry * constGet() const SIP_HOLDGIL
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
void mapToPixel(const QgsMapToPixel &mtp)
Transforms the geometry from map units to pixels in place.
QgsGeometry intersection(const QgsGeometry &geometry, const QgsGeometryParameters ¶meters=QgsGeometryParameters()) const
Returns a geometry representing the points shared by this geometry and other.
bool convertGeometryCollectionToSubclass(Qgis::GeometryType geomType)
Converts geometry collection to a the desired geometry type subclass (multi-point,...
A map clipping region (in map coordinates and CRS).
@ ClipPainterOnly
Applying clipping on the painter only (i.e. feature boundaries will be unchanged, but may be invisibl...
@ ClipToIntersection
Clip the geometry of these features to the region prior to rendering (i.e. feature boundaries will fo...
static QPainterPath calculatePainterClipRegion(const QList< QgsMapClippingRegion > ®ions, const QgsRenderContext &context, Qgis::LayerType layerType, bool &shouldClip)
Returns a QPainterPath representing the intersection of clipping regions from context which should be...
static QList< QgsMapClippingRegion > collectClippingRegionsForLayer(const QgsRenderContext &context, const QgsMapLayer *layer)
Collects the list of map clipping regions from a context which apply to a map layer.
static QgsGeometry calculateLabelIntersectionGeometry(const QList< QgsMapClippingRegion > ®ions, const QgsRenderContext &context, bool &shouldClip)
Returns the geometry representing the intersection of clipping regions from context which should be u...
static QgsGeometry calculateFeatureIntersectionGeometry(const QList< QgsMapClippingRegion > ®ions, const QgsRenderContext &context, bool &shouldClip)
Returns the geometry representing the intersection of clipping regions from context which should be u...
static QgsGeometry calculateFeatureRequestGeometry(const QList< QgsMapClippingRegion > ®ions, const QgsRenderContext &context, bool &shouldFilter)
Returns the geometry representing the intersection of clipping regions from context.
Base class for all map layer types.
Contains information about the context of a rendering operation.
QList< QgsMapClippingRegion > clippingRegions() const
Returns the list of clipping regions to apply during the render.
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.