QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 #include "qgslayoutitemmap.h"
20 #include "qgslayout.h"
21 #include "qgssymbollayerutils.h"
22 #include "qgssymbol.h"
23 #include "qgsmapsettings.h"
24 #include "qgspainting.h"
25 #include "qgspathresolver.h"
26 #include "qgsreadwritecontext.h"
27 #include "qgslayoututils.h"
28 #include "qgsexception.h"
29 #include "qgsvectorlayer.h"
31 
32 #include <QPainter>
33 
35  : QgsLayoutItemMapItem( name, map )
36  , mExtentLayer( qgis::make_unique< QgsVectorLayer >( QStringLiteral( "Polygon?crs=EPSG:4326" ), QStringLiteral( "overview" ), QStringLiteral( "memory" ), QgsVectorLayer::LayerOptions( map && map->layout() && map->layout()->project() ? map->layout()->project()->transformContext() : QgsCoordinateTransformContext() ) ) )
37 {
38  createDefaultFrameSymbol();
39 }
40 
42 
43 void QgsLayoutItemMapOverview::createDefaultFrameSymbol()
44 {
45  QgsStringMap properties;
46  properties.insert( QStringLiteral( "color" ), QStringLiteral( "255,0,0,75" ) );
47  properties.insert( QStringLiteral( "style" ), QStringLiteral( "solid" ) );
48  properties.insert( QStringLiteral( "style_border" ), QStringLiteral( "no" ) );
49  mFrameSymbol.reset( QgsFillSymbol::createSimple( properties ) );
50 
51  mExtentLayer->setRenderer( new QgsSingleSymbolRenderer( mFrameSymbol->clone() ) );
52 }
53 
54 void QgsLayoutItemMapOverview::draw( QPainter *painter )
55 {
56  if ( !mEnabled || !mFrameMap || !mMap || !mMap->layout() )
57  {
58  return;
59  }
60  if ( !painter )
61  {
62  return;
63  }
64 
65  const QgsLayoutItemMap *overviewFrameMap = linkedMap();
66  if ( !overviewFrameMap )
67  {
68  return;
69  }
70 
71  //get polygon for other overview frame map's extent (use visibleExtentPolygon as it accounts for map rotation)
72  QPolygonF otherExtent = overviewFrameMap->visibleExtentPolygon();
73  if ( overviewFrameMap->crs() !=
74  mMap->crs() )
75  {
76  QgsGeometry g = QgsGeometry::fromQPolygonF( otherExtent );
77 
78  // reproject extent
79  QgsCoordinateTransform ct( overviewFrameMap->crs(),
80  mMap->crs(), mLayout->project() );
81  g = g.densifyByCount( 20 );
82  try
83  {
84  g.transform( ct );
85  }
86  catch ( QgsCsException & )
87  {
88  }
89 
90  otherExtent = g.asQPolygonF();
91  }
92 
93  //get current map's extent as a QPolygonF
94  QPolygonF thisExtent = mMap->visibleExtentPolygon();
95  //intersect the two
96  QPolygonF intersectExtent = thisExtent.intersected( otherExtent );
97 
98  //setup painter scaling to dots so that raster symbology is drawn to scale
99  double dotsPerMM = painter->device()->logicalDpiX() / 25.4;
100 
101  //setup render context
103  context.setForceVectorOutput( true );
104  QgsExpressionContext expressionContext = createExpressionContext();
105  context.setExpressionContext( expressionContext );
106 
107  painter->save();
108  painter->setCompositionMode( mBlendMode );
109  painter->translate( mMap->mXOffset, mMap->mYOffset );
110  painter->scale( 1 / dotsPerMM, 1 / dotsPerMM ); // scale painter from mm to dots
111  painter->setRenderHint( QPainter::Antialiasing );
112 
113  mFrameSymbol->startRender( context );
114 
115  //construct a polygon corresponding to the intersecting map extent
116  //need to scale line to dots, rather then mm, since the painter has been scaled to dots
117  QTransform mapTransform;
118  QPolygonF thisRectPoly = QPolygonF( QRectF( 0, 0, dotsPerMM * mMap->rect().width(), dotsPerMM * mMap->rect().height() ) );
119 
120  //workaround QT Bug #21329
121  thisRectPoly.pop_back();
122  thisExtent.pop_back();
123 
124  //create transform from map coordinates to painter coordinates
125  QTransform::quadToQuad( thisExtent, thisRectPoly, mapTransform );
126  QPolygonF intersectPolygon;
127  intersectPolygon = mapTransform.map( intersectExtent );
128 
129  QList<QPolygonF> rings; //empty list
130  if ( !mInverted )
131  {
132  //Render the intersecting map extent
133  mFrameSymbol->renderPolygon( intersectPolygon, &rings, nullptr, context );
134  }
135  else
136  {
137  //We are inverting the overview frame (ie, shading outside the intersecting extent)
138  //Construct a polygon corresponding to the overview map extent
139  QPolygonF outerPolygon;
140  outerPolygon << QPointF( 0, 0 )
141  << QPointF( mMap->rect().width() * dotsPerMM, 0 )
142  << QPointF( mMap->rect().width() * dotsPerMM, mMap->rect().height() * dotsPerMM )
143  << QPointF( 0, mMap->rect().height() * dotsPerMM )
144  << QPointF( 0, 0 );
145 
146  //Intersecting extent is an inner ring for the shaded area
147  rings.append( intersectPolygon );
148  mFrameSymbol->renderPolygon( outerPolygon, &rings, nullptr, context );
149  }
150 
151  mFrameSymbol->stopRender( context );
152  painter->restore();
153 }
154 
155 bool QgsLayoutItemMapOverview::writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const
156 {
157  if ( elem.isNull() )
158  {
159  return false;
160  }
161 
162  //overview map frame
163  QDomElement overviewFrameElem = doc.createElement( QStringLiteral( "ComposerMapOverview" ) );
164 
165  overviewFrameElem.setAttribute( QStringLiteral( "frameMap" ), mFrameMap ? mFrameMap ->uuid() : QString() );
166  overviewFrameElem.setAttribute( QStringLiteral( "blendMode" ), QgsPainting::getBlendModeEnum( mBlendMode ) );
167  overviewFrameElem.setAttribute( QStringLiteral( "inverted" ), mInverted );
168  overviewFrameElem.setAttribute( QStringLiteral( "centered" ), mCentered );
169 
170  QDomElement frameStyleElem = QgsSymbolLayerUtils::saveSymbol( QString(), mFrameSymbol.get(), doc, context );
171  overviewFrameElem.appendChild( frameStyleElem );
172 
173  bool ok = QgsLayoutItemMapItem::writeXml( overviewFrameElem, doc, context );
174  elem.appendChild( overviewFrameElem );
175  return ok;
176 }
177 
178 bool QgsLayoutItemMapOverview::readXml( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context )
179 {
180  Q_UNUSED( doc )
181  if ( itemElem.isNull() )
182  {
183  return false;
184  }
185 
186  bool ok = QgsLayoutItemMapItem::readXml( itemElem, doc, context );
187 
188  mFrameMapUuid = itemElem.attribute( QStringLiteral( "frameMap" ) );
189  setLinkedMap( nullptr );
190 
191  mBlendMode = QgsPainting::getCompositionMode( static_cast< QgsPainting::BlendMode >( itemElem.attribute( QStringLiteral( "blendMode" ), QStringLiteral( "0" ) ).toUInt() ) );
192  mInverted = ( itemElem.attribute( QStringLiteral( "inverted" ), QStringLiteral( "0" ) ) != QLatin1String( "0" ) );
193  mCentered = ( itemElem.attribute( QStringLiteral( "centered" ), QStringLiteral( "0" ) ) != QLatin1String( "0" ) );
194 
195  QDomElement frameStyleElem = itemElem.firstChildElement( QStringLiteral( "symbol" ) );
196  if ( !frameStyleElem.isNull() )
197  {
198  mFrameSymbol.reset( QgsSymbolLayerUtils::loadSymbol<QgsFillSymbol>( frameStyleElem, context ) );
199  }
200  return ok;
201 }
202 
204 {
205  if ( !mFrameMapUuid.isEmpty() )
206  {
207  setLinkedMap( qobject_cast< QgsLayoutItemMap * >( mLayout->itemByUuid( mFrameMapUuid, true ) ) );
208  }
209 }
210 
212 {
213  return mBlendMode != QPainter::CompositionMode_SourceOver;
214 }
215 
217 {
218  if ( mFrameMap == map )
219  {
220  //no change
221  return;
222  }
223 
224  //disconnect old map
225  if ( mFrameMap )
226  {
229  }
230  mFrameMap = map;
231  //connect to new map signals
232  connectSignals();
234 }
235 
237 {
238  return mFrameMap;
239 }
240 
242 {
243  if ( !mMap )
244  {
245  return;
246  }
247 
248  if ( mFrameMap )
249  {
252  }
253 }
254 
256 {
257  if ( !mEnabled || !mFrameMap || !mMap || !mMap->layout() )
258  {
259  return nullptr;
260  }
261 
262  const QgsLayoutItemMap *overviewFrameMap = linkedMap();
263  if ( !overviewFrameMap )
264  {
265  return nullptr;
266  }
267 
268  //get polygon for other overview frame map's extent (use visibleExtentPolygon as it accounts for map rotation)
269  QPolygonF otherExtent = overviewFrameMap->visibleExtentPolygon();
270  QgsGeometry g = QgsGeometry::fromQPolygonF( otherExtent );
271 
272  if ( overviewFrameMap->crs() != mMap->crs() )
273  {
274  // reproject extent
275  QgsCoordinateTransform ct( overviewFrameMap->crs(),
276  mMap->crs(), mLayout->project() );
277  g = g.densifyByCount( 20 );
278  try
279  {
280  g.transform( ct );
281  }
282  catch ( QgsCsException & )
283  {
284  }
285  }
286 
287  //get current map's extent as a QPolygonF
288  QPolygonF thisExtent = mMap->visibleExtentPolygon();
289  QgsGeometry thisGeom = QgsGeometry::fromQPolygonF( thisExtent );
290  //intersect the two
291  QgsGeometry intersectExtent = thisGeom.intersection( g );
292 
293  mExtentLayer->setBlendMode( mBlendMode );
294 
295  static_cast< QgsSingleSymbolRenderer * >( mExtentLayer->renderer() )->setSymbol( mFrameSymbol->clone() );
296  mExtentLayer->dataProvider()->truncate();
297  mExtentLayer->setCrs( mMap->crs() );
298 
299  if ( mInverted )
300  {
301  intersectExtent = thisGeom.difference( intersectExtent );
302  }
303 
304  QgsFeature f;
305  f.setGeometry( intersectExtent );
306  mExtentLayer->dataProvider()->addFeature( f );
307 
308  return mExtentLayer.get();
309 }
310 
312 {
313  mFrameSymbol.reset( symbol );
314 }
315 
317 {
318  return mFrameSymbol.get();
319 }
320 
322 {
323  return mFrameSymbol.get();
324 }
325 
326 void QgsLayoutItemMapOverview::setBlendMode( const QPainter::CompositionMode blendMode )
327 {
328  mBlendMode = blendMode;
329 }
330 
332 {
333  mInverted = inverted;
334 }
335 
337 {
338  mCentered = centered;
340 }
341 
343 {
344  if ( !mMap )
345  {
346  return;
347  }
348 
349  //if using overview centering, update the map's extent
350  if ( mMap->layout() && mCentered && mFrameMap )
351  {
352  QgsRectangle extent = mMap->extent();
353  QgsRectangle otherExtent = mFrameMap->extent();
354 
355  QgsPointXY center = otherExtent.center();
356  QgsRectangle movedExtent( center.x() - extent.width() / 2,
357  center.y() - extent.height() / 2,
358  center.x() - extent.width() / 2 + extent.width(),
359  center.y() - extent.height() / 2 + extent.height() );
360  mMap->setExtent( movedExtent );
361  }
362 
363  //repaint map so that overview gets updated
365 }
366 
367 
368 //
369 // QgsLayoutItemMapOverviewStack
370 //
371 
374 {
375 
376 }
377 
379 {
381 }
382 
383 void QgsLayoutItemMapOverviewStack::removeOverview( const QString &overviewId )
384 {
386 }
387 
388 void QgsLayoutItemMapOverviewStack::moveOverviewUp( const QString &overviewId )
389 {
391 }
392 
393 void QgsLayoutItemMapOverviewStack::moveOverviewDown( const QString &overviewId )
394 {
396 }
397 
399 {
401  return qobject_cast<QgsLayoutItemMapOverview *>( item );
402 }
403 
405 {
407  return qobject_cast<QgsLayoutItemMapOverview *>( item );
408 }
409 
411 {
412  QgsLayoutItemMapItem *item = mItems.at( idx );
414  return *overview;
415 }
416 
417 QList<QgsLayoutItemMapOverview *> QgsLayoutItemMapOverviewStack::asList() const
418 {
419  QList< QgsLayoutItemMapOverview * > list;
420  QList< QgsLayoutItemMapItem * >::const_iterator it = mItems.begin();
421  for ( ; it != mItems.end(); ++it )
422  {
424  if ( overview )
425  {
426  list.append( overview );
427  }
428  }
429  return list;
430 }
431 
432 bool QgsLayoutItemMapOverviewStack::readXml( const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context )
433 {
434  removeItems();
435 
436  //read overview stack
437  QDomNodeList mapOverviewNodeList = elem.elementsByTagName( QStringLiteral( "ComposerMapOverview" ) );
438  for ( int i = 0; i < mapOverviewNodeList.size(); ++i )
439  {
440  QDomElement mapOverviewElem = mapOverviewNodeList.at( i ).toElement();
441  QgsLayoutItemMapOverview *mapOverview = new QgsLayoutItemMapOverview( mapOverviewElem.attribute( QStringLiteral( "name" ) ), mMap );
442  mapOverview->readXml( mapOverviewElem, doc, context );
443  mItems.append( mapOverview );
444  }
445 
446  return true;
447 }
448 
449 QList<QgsMapLayer *> QgsLayoutItemMapOverviewStack::modifyMapLayerList( const QList<QgsMapLayer *> &layers )
450 {
451  QList<QgsMapLayer *> res = layers;
452  res.reserve( layers.count() + mItems.count() );
453  for ( QgsLayoutItemMapItem *item : qgis::as_const( mItems ) )
454  {
455  if ( !item )
456  continue;
457 
458  QgsVectorLayer *l = static_cast< QgsLayoutItemMapOverview * >( item )->asMapLayer();
459  if ( !l )
460  continue;
461 
462  switch ( item->stackingPosition() )
463  {
465  continue;
466 
469  {
470  QgsMapLayer *stackLayer = item->stackingLayer();
471  if ( !stackLayer )
472  continue;
473 
474  auto pos = std::find( res.begin(), res.end(), stackLayer );
475  if ( pos == res.end() )
476  continue;
477 
479  {
480  pos++;
481  if ( pos == res.end() )
482  {
483  res.push_back( l );
484  break;
485  }
486  }
487  res.insert( pos, l );
488  break;
489  }
490 
492  res.push_back( l );
493  break;
494 
496  res.push_front( l );
497  break;
498  }
499  }
500 
501  return res;
502 }
void setForceVectorOutput(bool force)
Sets whether rendering operations should use vector operations instead of any faster raster shortcuts...
The class is used as a container of context for various read/write operations on other objects...
void setLinkedMap(QgsLayoutItemMap *map)
Sets the map to show the overview extent of.
A rectangle specified with double values.
Definition: qgsrectangle.h:41
Base class for all map layer types.
Definition: qgsmaplayer.h:78
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...
QgsExpressionContext createExpressionContext() const override
Creates an expression context relating to the objects&#39; current state.
void moveOverviewUp(const QString &overviewId)
Moves an overview with matching overviewId up the stack, causing it to be rendered above other overvi...
void setFrameSymbol(QgsFillSymbol *symbol)
Sets the fill symbol used for drawing the overview extent.
An individual overview which is drawn above the map content in a QgsLayoutItemMap, and shows the extent of another QgsLayoutItemMap.
OperationResult transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection direction=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
void setInverted(bool inverted)
Sets whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent ...
void setExtent(const QgsRectangle &extent)
Sets a new extent for the map.
QgsLayoutItemMapOverview(const QString &name, QgsLayoutItemMap *map)
Constructor for QgsLayoutItemMapOverview.
double y
Definition: qgspointxy.h:48
An item which is drawn inside a QgsLayoutItemMap, e.g., a grid or map overview.
static QgsFillSymbol * createSimple(const QgsStringMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties. ...
Definition: qgssymbol.cpp:1184
A class to represent a 2D point.
Definition: qgspointxy.h:43
void extentChanged()
Emitted when the map&#39;s extent changes.
void draw(QPainter *painter) override
Draws the item on to a destination painter.
static QgsPainting::BlendMode getBlendModeEnum(QPainter::CompositionMode blendMode)
Returns a BlendMode corresponding to a QPainter::CompositionMode.
Definition: qgspainting.cpp:80
Render above a specific map layer (see stackingLayer())
A collection of map items which are drawn above the map content in a QgsLayoutItemMap.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:111
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 &#39;Layout...
static QPainter::CompositionMode getCompositionMode(QgsPainting::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
Definition: qgspainting.cpp:20
QList< QgsLayoutItemMapOverview *> asList() const
Returns a list of QgsLayoutItemMapOverviews contained by the stack.
void invalidateCache() override
void finalizeRestoreFromXml() override
Called after all pending items have been restored from XML.
QgsFillSymbol * frameSymbol()
Returns the fill symbol used for drawing the overview extent.
QgsGeometry intersection(const QgsGeometry &geometry) const
Returns a geometry representing the points shared by this geometry and other.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:55
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the overview.
QMap< QString, QString > QgsStringMap
Definition: qgis.h:587
void connectSignals()
Reconnects signals for overview map, so that overview correctly follows changes to source map&#39;s exten...
Render below a specific map layer (see stackingLayer())
void removeItems()
Clears the item stack and deletes all QgsLayoutItemMapItems contained by the stack.
QgsLayoutItemMapOverview * overview(const QString &overviewId) const
Returns a reference to an overview with matching overviewId within the stack.
Render above all map layers, but below map labels.
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.
QgsLayoutItemMap * mMap
Associated map.
bool inverted() const
Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside the exte...
bool mEnabled
True if item is to be displayed on map.
QgsRectangle extent() const
Returns the current map extent.
Layout graphical items for displaying a map.
const QgsLayout * layout() const
Returns the layout the object is attached to.
double width() const
Returns the width of the rectangle.
Definition: qgsrectangle.h:202
QgsGeometry densifyByCount(int extraNodesPerSegment) const
Returns a copy of the geometry which has been densified by adding the specified number of extra nodes...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void addItem(QgsLayoutItemMapItem *item)
Adds a new map item to the stack and takes ownership of the item.
~QgsLayoutItemMapOverview() override
QPainter::CompositionMode blendMode() const
Retrieves the blending mode used for drawing the overview.
StackingPosition stackingPosition() const
Returns the item&#39;s stacking position, which specifies where the in the map&#39;s stack the item should be...
static QgsRenderContext createRenderContextForLayout(QgsLayout *layout, QPainter *painter, double dpi=-1)
Creates a render context suitable for the specified layout and painter destination.
QPointer< QgsLayout > mLayout
void moveOverviewDown(const QString &overviewId)
Moves an overview with matching overviewId down the stack, causing it to be rendered below other over...
QgsMapLayer * stackingLayer() const
Returns the item&#39;s stacking layer, which specifies where the in the map&#39;s stack the item should be re...
bool readXml(const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context) override
Sets the item stack&#39;s state from a DOM document, where element is a DOM node corresponding to a &#39;Layo...
Contains information about the context in which a coordinate transform is executed.
void moveItemUp(const QString &itemId)
Moves an item which matching itemId up the stack, causing it to be rendered above other items...
void setCentered(bool centered)
Sets whether the extent of the map is forced to center on the overview.
double x
Definition: qgspointxy.h:47
QPolygonF visibleExtentPolygon() const
Returns a polygon representing the current visible map extent, considering map extents and rotation...
void mapRotationChanged(double newRotation)
Emitted when the map&#39;s rotation changes.
const QgsLayoutItemMap * map() const
Returns the layout item map for the item.
QgsLayoutItemMapOverviewStack(QgsLayoutItemMap *map)
Constructor for QgsLayoutItemMapOverviewStack, attached to the specified 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 &#39;Layout...
void removeOverview(const QString &overviewId)
Removes an overview with matching overviewId from the stack and deletes the corresponding QgsLayoutIt...
Contains information about the context of a rendering operation.
void overviewExtentChanged()
Handles recentering of the map and redrawing of the map&#39;s overview.
bool usesAdvancedEffects() const override
Returns true if the item is drawn using advanced effects, such as blend modes.
QgsLayoutItemMapItem * item(const QString &itemId) const
Returns a reference to an item which matching itemId within the stack.
QgsCoordinateReferenceSystem crs() const
Returns coordinate reference system used for rendering the map.
void setGeometry(const QgsGeometry &geometry)
Set the feature&#39;s geometry.
Definition: qgsfeature.cpp:137
static QgsGeometry fromQPolygonF(const QPolygonF &polygon)
Construct geometry from a QPolygonF.
static QDomElement saveSymbol(const QString &symbolName, QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
Class for doing transforms between two map coordinate systems.
bool centered() const
Returns whether the extent of the map is forced to center on the overview.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Definition: qgssymbol.h:1061
void removeItem(const QString &itemId)
Removes an item which matching itemId from the stack and deletes the corresponding QgsLayoutItemMapIt...
Custom exception class for Coordinate Reference System related exceptions.
Definition: qgsexception.h:65
QgsVectorLayer * asMapLayer()
Returns a vector layer to render as part of the QgsLayoutItemMap render, containing a feature represe...
QgsPointXY center() const
Returns the center point of the rectangle.
Definition: qgsrectangle.h:230
void moveItemDown(const QString &itemId)
Moves an item which matching itemId up the stack, causing it to be rendered above other items...
QList< QgsLayoutItemMapItem *> mItems
Represents a vector layer which manages a vector based data sets.
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 &#39;LayoutMa...
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.
Render above all map layers and labels.
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 &#39;LayoutMa...
double height() const
Returns the height of the rectangle.
Definition: qgsrectangle.h:209
QgsLayoutItemMap * linkedMap()
Returns the source map to show the overview extent of.
Render below all map layers.
QgsGeometry difference(const QgsGeometry &geometry) const
Returns a geometry representing the points making up this geometry that do not make up other...