QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
qgslayoutitemmapoverview.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutitemmapoverview.h
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
18#ifndef QgsLayoutItemMapOVERVIEW_H
19#define QgsLayoutItemMapOVERVIEW_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
24#include <QString>
25#include <QObject>
26#include <QPainter>
27
28class QDomDocument;
29class QDomElement;
31class QgsFillSymbol;
32
42{
43 public:
44
50
59 void addOverview( QgsLayoutItemMapOverview *overview SIP_TRANSFER );
60
67 void removeOverview( const QString &overviewId );
68
75 void moveOverviewUp( const QString &overviewId );
76
83 void moveOverviewDown( const QString &overviewId );
84
88 QgsLayoutItemMapOverview *overview( const QString &overviewId ) const;
89
93 QgsLayoutItemMapOverview *overview( int index ) const;
94
100
104 QList< QgsLayoutItemMapOverview * > asList() const;
105 bool readXml( const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context ) override;
106
113 QList< QgsMapLayer * > modifyMapLayerList( const QList< QgsMapLayer * > &layers );
114
115};
116
125{
126 Q_OBJECT
127
128 public:
129
135 QgsLayoutItemMapOverview( const QString &name, QgsLayoutItemMap *map );
137
138 void draw( QPainter *painter ) override;
139 bool writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
140 bool readXml( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context ) override;
141 void finalizeRestoreFromXml() override;
142 bool usesAdvancedEffects() const override;
143
148 void setLinkedMap( QgsLayoutItemMap *map );
149
154 QgsLayoutItemMap *linkedMap();
155
161 void setFrameSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
162
167 QgsFillSymbol *frameSymbol();
168
174 const QgsFillSymbol *frameSymbol() const; SIP_SKIP
175
180 QPainter::CompositionMode blendMode() const { return mBlendMode; }
181
186 void setBlendMode( QPainter::CompositionMode mode );
187
193 bool inverted() const { return mInverted; }
194
200 void setInverted( bool inverted );
201
206 bool centered() const { return mCentered; }
207
212 void setCentered( bool centered );
213
218 void connectSignals();
219
229 QgsVectorLayer *asMapLayer();
230
231 QgsMapLayer *mapLayer() override;
232
233 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
234
235 public slots:
236
240 void overviewExtentChanged();
241
242 private:
243
244 QgsLayoutItemMapOverview() = delete;
245
246 QString mFrameMapUuid;
247 QPointer< QgsLayoutItemMap > mFrameMap;
248
250 std::unique_ptr< QgsFillSymbol > mFrameSymbol;
251
253 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
254
256 bool mInverted = false;
257
259 bool mCentered = false;
260
261 std::unique_ptr< QgsVectorLayer > mExtentLayer;
262
264 void createDefaultFrameSymbol();
265
266};
267
268#endif // QgsLayoutItemMapOVERVIEW_H
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A collection of map items which are drawn above the map content in a QgsLayoutItemMap.
virtual bool writeXml(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) const
Stores the state of the item stack in a DOM node, where element is the DOM element corresponding to a...
virtual void finalizeRestoreFromXml()
Called after all pending items have been restored from XML.
virtual bool readXml(const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context)=0
Sets the item stack's state from a DOM document, where element is a DOM node corresponding to a 'Layo...
QList< QgsLayoutItemMapItem * > asList() const
Returns a list of QgsLayoutItemMapItems contained by the stack.
QgsLayoutItemMapItem & operator[](int index)
Returns a reference to an item at the specified index within the stack.
An item which is drawn inside a QgsLayoutItemMap, e.g., a grid or map overview.
A collection of overviews which are drawn above the map content in a QgsLayoutItemMap.
An individual overview which is drawn above the map content in a QgsLayoutItemMap,...
QPainter::CompositionMode blendMode() const
Retrieves the blending mode used for drawing the overview.
bool centered() const
Returns whether the extent of the map is forced to center on the overview.
~QgsLayoutItemMapOverview() override
bool inverted() const
Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside the exte...
Layout graphical items for displaying a map.
Base class for all map layer types.
Definition qgsmaplayer.h:75
The class is used as a container of context for various read/write operations on other objects.
An interface for classes which can visit style entity (e.g.
Represents a vector layer which manages a vector based data sets.
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_TRANSFER
Definition qgis_sip.h:36