QGIS API Documentation 3.99.0-Master (8e76e220402)
Loading...
Searching...
No Matches
qgslayoutitemmapoverview.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutitemmapoverview.cpp
3 --------------------
4 begin : October 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
19
20#include "qgsexception.h"
21#include "qgsfillsymbol.h"
22#include "qgslayout.h"
23#include "qgslayoutitemmap.h"
24#include "qgslayoututils.h"
25#include "qgspainting.h"
26#include "qgsreadwritecontext.h"
29#include "qgssymbol.h"
30#include "qgssymbollayerutils.h"
31#include "qgsvectorlayer.h"
32
33#include <QPainter>
34#include <QString>
35
36#include "moc_qgslayoutitemmapoverview.cpp"
37
38using namespace Qt::StringLiterals;
39
42 , mExtentLayer( std::make_unique< QgsVectorLayer >( u"Polygon?crs=EPSG:4326"_s, tr( "Overview" ), u"memory"_s, QgsVectorLayer::LayerOptions( map && map->layout() && map->layout()->project() ? map->layout()->project()->transformContext() : QgsCoordinateTransformContext() ) ) )
43{
44 createDefaultFrameSymbol();
45}
46
48
49void QgsLayoutItemMapOverview::createDefaultFrameSymbol()
50{
51 QVariantMap properties;
52 properties.insert( u"color"_s, u"255,0,0,75"_s );
53 properties.insert( u"style"_s, u"solid"_s );
54 properties.insert( u"style_border"_s, u"no"_s );
55 mFrameSymbol = QgsFillSymbol::createSimple( properties );
56
57 mExtentLayer->setRenderer( new QgsSingleSymbolRenderer( mFrameSymbol->clone() ) );
58}
59
60void QgsLayoutItemMapOverview::draw( QPainter *painter )
61{
62 if ( !mEnabled || !mFrameMap || !mMap || !mMap->layout() )
63 {
64 return;
65 }
66 if ( !painter )
67 {
68 return;
69 }
70
71 const QgsLayoutItemMap *overviewFrameMap = linkedMap();
72 if ( !overviewFrameMap )
73 {
74 return;
75 }
76
77 //get polygon for other overview frame map's extent (use visibleExtentPolygon as it accounts for map rotation)
78 QPolygonF otherExtent = overviewFrameMap->visibleExtentPolygon();
79 if ( overviewFrameMap->crs() !=
80 mMap->crs() )
81 {
82 QgsGeometry g = QgsGeometry::fromQPolygonF( otherExtent );
83
84 // reproject extent
85 QgsCoordinateTransform ct( overviewFrameMap->crs(),
86 mMap->crs(), mLayout->project() );
87 g = g.densifyByCount( 20 );
88 try
89 {
90 g.transform( ct );
91 }
92 catch ( QgsCsException & )
93 {
94 }
95
96 otherExtent = g.asQPolygonF();
97 }
98
99 //get current map's extent as a QPolygonF
100 QPolygonF thisExtent = mMap->visibleExtentPolygon();
101 //intersect the two
102 QPolygonF intersectExtent = thisExtent.intersected( otherExtent );
103
104 //setup painter scaling to dots so that raster symbology is drawn to scale
105 double dotsPerMM = painter->device()->logicalDpiX() / 25.4;
106
107 //setup render context
111 QgsExpressionContext expressionContext = createExpressionContext();
112 context.setExpressionContext( expressionContext );
113
114 QgsScopedQPainterState painterState( painter );
115 context.setPainterFlagsUsingContext( painter );
116
117 painter->setCompositionMode( mBlendMode );
118 painter->translate( mMap->mXOffset, mMap->mYOffset );
119 painter->scale( 1 / dotsPerMM, 1 / dotsPerMM ); // scale painter from mm to dots
120
121 mFrameSymbol->startRender( context );
122
123 //construct a polygon corresponding to the intersecting map extent
124 //need to scale line to dots, rather then mm, since the painter has been scaled to dots
125 QTransform mapTransform;
126 QPolygonF thisRectPoly = QPolygonF( QRectF( 0, 0, dotsPerMM * mMap->rect().width(), dotsPerMM * mMap->rect().height() ) );
127
128 //workaround QT Bug #21329
129 thisRectPoly.pop_back();
130 thisExtent.pop_back();
131
132 //create transform from map coordinates to painter coordinates
133 QTransform::quadToQuad( thisExtent, thisRectPoly, mapTransform );
134 QPolygonF intersectPolygon;
135 intersectPolygon = mapTransform.map( intersectExtent );
136
137 QVector<QPolygonF> rings; //empty list
138 if ( !mInverted )
139 {
140 //Render the intersecting map extent
141 mFrameSymbol->renderPolygon( intersectPolygon, &rings, nullptr, context );
142 }
143 else
144 {
145 //We are inverting the overview frame (ie, shading outside the intersecting extent)
146 //Construct a polygon corresponding to the overview map extent
147 QPolygonF outerPolygon;
148 outerPolygon << QPointF( 0, 0 )
149 << QPointF( mMap->rect().width() * dotsPerMM, 0 )
150 << QPointF( mMap->rect().width() * dotsPerMM, mMap->rect().height() * dotsPerMM )
151 << QPointF( 0, mMap->rect().height() * dotsPerMM )
152 << QPointF( 0, 0 );
153
154 //Intersecting extent is an inner ring for the shaded area
155 rings.append( intersectPolygon );
156 mFrameSymbol->renderPolygon( outerPolygon, &rings, nullptr, context );
157 }
158
159 mFrameSymbol->stopRender( context );
160}
161
162bool QgsLayoutItemMapOverview::writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const
163{
164 if ( elem.isNull() )
165 {
166 return false;
167 }
168
169 //overview map frame
170 QDomElement overviewFrameElem = doc.createElement( u"ComposerMapOverview"_s );
171
172 overviewFrameElem.setAttribute( u"frameMap"_s, mFrameMap ? mFrameMap ->uuid() : QString() );
173 overviewFrameElem.setAttribute( u"blendMode"_s, static_cast< int >( QgsPainting::getBlendModeEnum( mBlendMode ) ) );
174 overviewFrameElem.setAttribute( u"inverted"_s, mInverted );
175 overviewFrameElem.setAttribute( u"centered"_s, mCentered );
176
177 QDomElement frameStyleElem = QgsSymbolLayerUtils::saveSymbol( QString(), mFrameSymbol.get(), doc, context );
178 overviewFrameElem.appendChild( frameStyleElem );
179
180 bool ok = QgsLayoutItemMapItem::writeXml( overviewFrameElem, doc, context );
181 elem.appendChild( overviewFrameElem );
182 return ok;
183}
184
185bool QgsLayoutItemMapOverview::readXml( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context )
186{
187 Q_UNUSED( doc )
188 if ( itemElem.isNull() )
189 {
190 return false;
191 }
192
193 bool ok = QgsLayoutItemMapItem::readXml( itemElem, doc, context );
194
195 mFrameMapUuid = itemElem.attribute( u"frameMap"_s );
196 setLinkedMap( nullptr );
197
198 mBlendMode = QgsPainting::getCompositionMode( static_cast< Qgis::BlendMode >( itemElem.attribute( u"blendMode"_s, u"0"_s ).toUInt() ) );
199 mInverted = ( itemElem.attribute( u"inverted"_s, u"0"_s ) != "0"_L1 );
200 mCentered = ( itemElem.attribute( u"centered"_s, u"0"_s ) != "0"_L1 );
201
202 QDomElement frameStyleElem = itemElem.firstChildElement( u"symbol"_s );
203 if ( !frameStyleElem.isNull() )
204 {
205 mFrameSymbol = QgsSymbolLayerUtils::loadSymbol<QgsFillSymbol>( frameStyleElem, context );
206 }
207 return ok;
208}
209
211{
212 if ( !mFrameMapUuid.isEmpty() )
213 {
214 setLinkedMap( qobject_cast< QgsLayoutItemMap * >( mLayout->itemByUuid( mFrameMapUuid, true ) ) );
215 }
216}
217
219{
220 return mBlendMode != QPainter::CompositionMode_SourceOver;
221}
222
224{
225 if ( mFrameMap == map )
226 {
227 //no change
228 return;
229 }
230
231 //disconnect old map
232 if ( mFrameMap )
233 {
236 }
237 mFrameMap = map;
238 //connect to new map signals
240 mMap->invalidateCache();
241}
242
244{
245 return mFrameMap;
246}
247
249{
250 if ( !mMap )
251 {
252 return;
253 }
254
255 if ( mFrameMap )
256 {
259 }
260}
261
263{
264 if ( !mEnabled || !mFrameMap || !mMap || !mMap->layout() )
265 {
266 return nullptr;
267 }
268
269 const QgsLayoutItemMap *overviewFrameMap = linkedMap();
270 if ( !overviewFrameMap )
271 {
272 return nullptr;
273 }
274
275 //get polygon for other overview frame map's extent (use visibleExtentPolygon as it accounts for map rotation)
276 QPolygonF otherExtent = overviewFrameMap->visibleExtentPolygon();
277 QgsGeometry g = QgsGeometry::fromQPolygonF( otherExtent );
278
279 if ( overviewFrameMap->crs() != mMap->crs() )
280 {
281 // reproject extent
282 QgsCoordinateTransform ct( overviewFrameMap->crs(),
283 mMap->crs(), mLayout->project() );
284 g = g.densifyByCount( 20 );
285 try
286 {
287 g.transform( ct );
288 }
289 catch ( QgsCsException & )
290 {
291 }
292 }
293
294 //get current map's extent as a QPolygonF
295 QPolygonF thisExtent = mMap->visibleExtentPolygon();
296 QgsGeometry thisGeom = QgsGeometry::fromQPolygonF( thisExtent );
297 //intersect the two
298 QgsGeometry intersectExtent = thisGeom.intersection( g );
299
300 mExtentLayer->setBlendMode( mBlendMode );
301
302 static_cast< QgsSingleSymbolRenderer * >( mExtentLayer->renderer() )->setSymbol( mFrameSymbol->clone() );
303 mExtentLayer->dataProvider()->truncate();
304 mExtentLayer->setCrs( mMap->crs() );
305
306 if ( mInverted )
307 {
308 intersectExtent = thisGeom.difference( intersectExtent );
309 }
310
311 QgsFeature f;
312 f.setGeometry( intersectExtent );
313 mExtentLayer->dataProvider()->addFeature( f );
314
315 return mExtentLayer.get();
316}
317
319{
320 return mExtentLayer.get();
321}
322
324{
325 if ( mFrameSymbol )
326 {
327 QgsStyleSymbolEntity entity( mFrameSymbol.get() );
328 if ( !visitor->visit( QgsStyleEntityVisitorInterface::StyleLeaf( &entity, u"overview"_s, QObject::tr( "Overview" ) ) ) )
329 return false;
330 }
331
332 return true;
333}
334
336{
337 mFrameSymbol.reset( symbol );
338}
339
341{
342 return mFrameSymbol.get();
343}
344
346{
347 return mFrameSymbol.get();
348}
349
350void QgsLayoutItemMapOverview::setBlendMode( const QPainter::CompositionMode blendMode )
351{
352 mBlendMode = blendMode;
353}
354
356{
357 mInverted = inverted;
358}
359
361{
362 mCentered = centered;
364}
365
367{
368 if ( !mMap )
369 {
370 return;
371 }
372
373 //if using overview centering, update the map's extent
374 if ( mMap->layout() && mCentered && mFrameMap )
375 {
376 QgsRectangle extent = mMap->extent();
377 QgsRectangle otherExtent = mFrameMap->extent();
378
379 QgsPointXY center = otherExtent.center();
380 QgsRectangle movedExtent( center.x() - extent.width() / 2,
381 center.y() - extent.height() / 2,
382 center.x() - extent.width() / 2 + extent.width(),
383 center.y() - extent.height() / 2 + extent.height() );
384 mMap->setExtent( movedExtent );
385 }
386
387 //repaint map so that overview gets updated
388 mMap->invalidateCache();
389}
390
391
392//
393// QgsLayoutItemMapOverviewStack
394//
395
401
406
407void QgsLayoutItemMapOverviewStack::removeOverview( const QString &overviewId )
408{
410}
411
412void QgsLayoutItemMapOverviewStack::moveOverviewUp( const QString &overviewId )
413{
415}
416
417void QgsLayoutItemMapOverviewStack::moveOverviewDown( const QString &overviewId )
418{
420}
421
423{
425 return qobject_cast<QgsLayoutItemMapOverview *>( item );
426}
427
429{
431 return qobject_cast<QgsLayoutItemMapOverview *>( item );
432}
433
434QgsLayoutItemMapOverview &QgsLayoutItemMapOverviewStack::operator[]( int idx ) // cppcheck-suppress duplInheritedMember
435{
436 QgsLayoutItemMapItem *item = mItems.at( idx );
437 QgsLayoutItemMapOverview *overview = qobject_cast<QgsLayoutItemMapOverview *>( item );
438 return *overview;
439}
440
441QList<QgsLayoutItemMapOverview *> QgsLayoutItemMapOverviewStack::asList() const // cppcheck-suppress duplInheritedMember
442{
443 QList< QgsLayoutItemMapOverview * > list;
444 QList< QgsLayoutItemMapItem * >::const_iterator it = mItems.begin();
445 for ( ; it != mItems.end(); ++it )
446 {
447 QgsLayoutItemMapOverview *overview = qobject_cast<QgsLayoutItemMapOverview *>( *it );
448 if ( overview )
449 {
450 list.append( overview );
451 }
452 }
453 return list;
454}
455
456bool QgsLayoutItemMapOverviewStack::readXml( const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context )
457{
458 removeItems();
459
460 //read overview stack
461 QDomNodeList mapOverviewNodeList = elem.elementsByTagName( u"ComposerMapOverview"_s );
462 for ( int i = 0; i < mapOverviewNodeList.size(); ++i )
463 {
464 QDomElement mapOverviewElem = mapOverviewNodeList.at( i ).toElement();
465 QgsLayoutItemMapOverview *mapOverview = new QgsLayoutItemMapOverview( mapOverviewElem.attribute( u"name"_s ), mMap );
466 mapOverview->readXml( mapOverviewElem, doc, context );
467 mItems.append( mapOverview );
468 }
469
470 return true;
471}
472
473QList<QgsMapLayer *> QgsLayoutItemMapOverviewStack::modifyMapLayerList( const QList<QgsMapLayer *> &layers )
474{
475 QList<QgsMapLayer *> res = layers;
476 res.reserve( layers.count() + mItems.count() );
477 for ( QgsLayoutItemMapItem *item : std::as_const( mItems ) )
478 {
479 if ( !item )
480 continue;
481
482 QgsVectorLayer *l = static_cast< QgsLayoutItemMapOverview * >( item )->asMapLayer();
483 if ( !l )
484 continue;
485
486 l->setCustomProperty( u"_noset_layer_expression_context"_s, true );
487
488 switch ( item->stackingPosition() )
489 {
491 continue;
492
495 {
496 QgsMapLayer *stackLayer = item->stackingLayer();
497 if ( !stackLayer )
498 continue;
499
500 auto pos = std::find( res.begin(), res.end(), stackLayer );
501 if ( pos == res.end() )
502 continue;
503
504 if ( item->stackingPosition() == QgsLayoutItemMapItem::StackBelowMapLayer )
505 {
506 pos++;
507 if ( pos == res.end() )
508 {
509 res.push_back( l );
510 break;
511 }
512 }
513 res.insert( pos, l );
514 break;
515 }
516
518 res.push_back( l );
519 break;
520
522 res.push_front( l );
523 break;
524 }
525 }
526
527 return res;
528}
@ Default
Allow raster-based rendering in situations where it is required for correct rendering or where it wil...
Definition qgis.h:2762
@ PreferVector
Prefer vector-based rendering, when the result will still be visually near-identical to a raster-base...
Definition qgis.h:2763
BlendMode
Blending modes defining the available composition modes that can be used when painting.
Definition qgis.h:5037
Contains information about the context in which a coordinate transform is executed.
Handles coordinate transforms between two coordinate systems.
Custom exception class for Coordinate Reference System related exceptions.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:60
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
static std::unique_ptr< QgsFillSymbol > createSimple(const QVariantMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties.
A geometry is the spatial representation of a feature.
QPolygonF asQPolygonF() const
Returns contents of the geometry as a QPolygonF.
QgsGeometry densifyByCount(int extraNodesPerSegment) const
Returns a copy of the geometry which has been densified by adding the specified number of extra nodes...
QgsGeometry difference(const QgsGeometry &geometry, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const
Returns a geometry representing the points making up this geometry that do not make up other.
static QgsGeometry fromQPolygonF(const QPolygonF &polygon)
Construct geometry from a QPolygonF.
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false)
Transforms this geometry as described by the coordinate transform ct.
QgsGeometry intersection(const QgsGeometry &geometry, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const
Returns a geometry representing the points shared by this geometry and other.
void addItem(QgsLayoutItemMapItem *item)
Adds a new map item to the stack and takes ownership of the item.
void removeItem(const QString &itemId)
Removes an item which matching itemId from the stack and deletes the corresponding QgsLayoutItemMapIt...
QgsLayoutItemMapItem * item(int index) const
Returns a reference to the item at the specified index within the stack.
void moveItemUp(const QString &itemId)
Moves an item which matching itemId up the stack, causing it to be rendered above other items.
void removeItems()
Clears the item stack and deletes all QgsLayoutItemMapItems contained by the stack.
QgsLayoutItemMapItemStack(QgsLayoutItemMap *map)
Constructor for QgsLayoutItemMapItemStack, attached to the specified map.
QList< QgsLayoutItemMapItem * > mItems
void moveItemDown(const QString &itemId)
Moves an item which matching itemId up the stack, causing it to be rendered above other items.
An item which is drawn inside a QgsLayoutItemMap, e.g., a grid or map overview.
@ StackBelowMapLabels
Render above all map layers, but below map labels.
@ StackAboveMapLabels
Render above all map layers and labels.
@ StackBelowMapLayer
Render below a specific map layer (see stackingLayer()).
@ StackAboveMapLayer
Render above a specific map layer (see stackingLayer()).
@ StackBelowMap
Render below all map layers.
QgsLayoutItemMap * mMap
Associated map.
virtual bool readXml(const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context)
Sets the map item state from a DOM document, where element is the DOM node corresponding to a 'Layout...
virtual bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores map item state in a DOM element, where element is the DOM element corresponding to a 'LayoutMa...
bool mEnabled
True if item is to be displayed on map.
QString name() const
Returns the friendly display name for the item.
QgsLayoutItemMapItem(const QString &name, QgsLayoutItemMap *map)
Constructor for QgsLayoutItemMapItem, attached to the specified map.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
const QgsLayoutItemMap * map() const
Returns the layout item map for the item.
void moveOverviewUp(const QString &overviewId)
Moves an overview with matching overviewId up the stack, causing it to be rendered above other overvi...
QgsLayoutItemMapOverviewStack(QgsLayoutItemMap *map)
Constructor for QgsLayoutItemMapOverviewStack, attached to the specified map.
QgsLayoutItemMapOverview & operator[](int index)
Returns a reference to an overview at the specified index within the stack.
void addOverview(QgsLayoutItemMapOverview *overview)
Adds a new map overview to the stack and takes ownership of the overview.
bool readXml(const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context) override
Sets the item stack's state from a DOM document, where element is a DOM node corresponding to a 'Layo...
QList< QgsMapLayer * > modifyMapLayerList(const QList< QgsMapLayer * > &layers)
Alters the list of map layers which will be rendered for the link map item, inserting temporary layer...
void moveOverviewDown(const QString &overviewId)
Moves an overview with matching overviewId down the stack, causing it to be rendered below other over...
void removeOverview(const QString &overviewId)
Removes an overview with matching overviewId from the stack and deletes the corresponding QgsLayoutIt...
QList< QgsLayoutItemMapOverview * > asList() const
Returns a list of QgsLayoutItemMapOverviews contained by the stack.
QgsLayoutItemMapOverview * overview(const QString &overviewId) const
Returns a reference to an overview with matching overviewId within the stack.
An individual overview which is drawn above the map content in a QgsLayoutItemMap,...
QgsFillSymbol * frameSymbol()
Returns the fill symbol used for drawing the overview extent.
QPainter::CompositionMode blendMode() const
Retrieves the blending mode used for drawing the overview.
bool usesAdvancedEffects() const override
Returns true if the item is drawn using advanced effects, such as blend modes.
void connectSignals()
Reconnects signals for overview map, so that overview correctly follows changes to source map's exten...
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the overview.
QgsMapLayer * mapLayer() override
Returns the internal map layer used by this item, if available.
QgsVectorLayer * asMapLayer()
Returns a vector layer to render as part of the QgsLayoutItemMap render, containing a feature represe...
void draw(QPainter *painter) override
Draws the item on to a destination painter.
void overviewExtentChanged()
Handles recentering of the map and redrawing of the map's overview.
bool writeXml(QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override
Stores map item state in a DOM element, where element is the DOM element corresponding to a 'LayoutMa...
bool centered() const
Returns whether the extent of the map is forced to center on the overview.
~QgsLayoutItemMapOverview() override
void setLinkedMap(QgsLayoutItemMap *map)
Sets the map to show the overview extent of.
void finalizeRestoreFromXml() override
Called after all pending items have been restored from XML.
void setFrameSymbol(QgsFillSymbol *symbol)
Sets the fill symbol used for drawing the overview extent.
bool inverted() const
Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside the exte...
void setInverted(bool inverted)
Sets whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent ...
bool accept(QgsStyleEntityVisitorInterface *visitor) const override
Accepts the specified style entity visitor, causing it to visit all style entities associated with th...
QgsLayoutItemMapOverview(const QString &name, QgsLayoutItemMap *map)
Constructor for QgsLayoutItemMapOverview.
bool readXml(const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context) override
Sets the map item state from a DOM document, where element is the DOM node corresponding to a 'Layout...
void setCentered(bool centered)
Sets whether the extent of the map is forced to center on the overview.
QgsLayoutItemMap * linkedMap()
Returns the source map to show the overview extent of.
Layout graphical items for displaying a map.
void extentChanged()
Emitted when the map's extent changes.
void mapRotationChanged(double newRotation)
Emitted when the map's rotation changes.
QPolygonF visibleExtentPolygon() const
Returns a polygon representing the current visible map extent, considering map extents and rotation.
QgsCoordinateReferenceSystem crs() const
Returns coordinate reference system used for rendering the map.
const QgsLayout * layout() const
Returns the layout the object is attached to.
QPointer< QgsLayout > mLayout
static QgsRenderContext createRenderContextForLayout(QgsLayout *layout, QPainter *painter, double dpi=-1)
Creates a render context suitable for the specified layout and painter destination.
Base class for all map layer types.
Definition qgsmaplayer.h:83
Q_INVOKABLE void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for layer.
static Qgis::BlendMode getBlendModeEnum(QPainter::CompositionMode blendMode)
Returns a Qgis::BlendMode corresponding to a QPainter::CompositionMode.
static QPainter::CompositionMode getCompositionMode(Qgis::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a Qgis::BlendMode.
Represents a 2D point.
Definition qgspointxy.h:62
double y
Definition qgspointxy.h:66
double x
Definition qgspointxy.h:65
A container for the context for various read/write operations on objects.
A rectangle specified with double values.
QgsPointXY center
Contains information about the context of a rendering operation.
void setPainterFlagsUsingContext(QPainter *painter=nullptr) const
Sets relevant flags on a destination painter, using the flags and settings currently defined for the ...
void setRasterizedRenderingPolicy(Qgis::RasterizedRenderingPolicy policy)
Sets the policy controlling when rasterisation of content during renders is permitted.
Qgis::RasterizedRenderingPolicy rasterizedRenderingPolicy() const
Returns the policy controlling when rasterisation of content during renders is permitted.
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.
Scoped object for saving and restoring a QPainter object's state.
A feature renderer which renders all features with the same symbol.
void setSymbol(QgsSymbol *s)
Sets the symbol which will be rendered for every feature.
An interface for classes which can visit style entity (e.g.
virtual bool visit(const QgsStyleEntityVisitorInterface::StyleLeaf &entity)
Called when the visitor will visit a style entity.
A symbol entity for QgsStyle databases.
Definition qgsstyle.h:1398
static std::unique_ptr< QgsSymbol > loadSymbol(const QDomElement &element, const QgsReadWriteContext &context)
Attempts to load a symbol from a DOM element.
static QDomElement saveSymbol(const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
Represents a vector layer which manages a vector based dataset.
Contains information relating to the style entity currently being visited.