QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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
25#include <QObject>
26#include <QPainter>
27#include <QString>
28
29class QDomDocument;
30class QDomElement;
32class QgsFillSymbol;
33
43{
44 public:
45
51
61
68 void removeOverview( const QString &overviewId );
69
76 void moveOverviewUp( const QString &overviewId );
77
84 void moveOverviewDown( const QString &overviewId );
85
89 QgsLayoutItemMapOverview *overview( const QString &overviewId ) const;
90
94 QgsLayoutItemMapOverview *overview( int index ) const;
95
100 QgsLayoutItemMapOverview &operator[]( int index ); // cppcheck-suppress duplInheritedMember
101
105 QList< QgsLayoutItemMapOverview * > asList() const; // cppcheck-suppress duplInheritedMember
106 bool readXml( const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context ) override;
107
114 QList< QgsMapLayer * > modifyMapLayerList( const QList< QgsMapLayer * > &layers );
115
116};
117
126{
127 Q_OBJECT
128
129 public:
130
138
139 void draw( QPainter *painter ) override;
140 bool writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
141 bool readXml( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context ) override;
142 void finalizeRestoreFromXml() override;
143 bool usesAdvancedEffects() const override;
144
150
156
163
169
175 const QgsFillSymbol *frameSymbol() const; SIP_SKIP
176
181 QPainter::CompositionMode blendMode() const { return mBlendMode; }
182
187 void setBlendMode( QPainter::CompositionMode mode );
188
194 bool inverted() const { return mInverted; }
195
201 void setInverted( bool inverted );
202
207 bool centered() const { return mCentered; }
208
213 void setCentered( bool centered );
214
219 void connectSignals();
220
230 QgsVectorLayer *asMapLayer();
231
232 QgsMapLayer *mapLayer() override;
233
234 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
235
236 public slots:
237
241 void overviewExtentChanged();
242
243 private:
244
245 QgsLayoutItemMapOverview() = delete;
246
247 QString mFrameMapUuid;
248 QPointer< QgsLayoutItemMap > mFrameMap;
249
251 std::unique_ptr< QgsFillSymbol > mFrameSymbol;
252
254 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
255
257 bool mInverted = false;
258
260 bool mCentered = false;
261
262 std::unique_ptr< QgsVectorLayer > mExtentLayer;
263
265 void createDefaultFrameSymbol();
266
267};
268
269#endif // QgsLayoutItemMapOVERVIEW_H
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
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.
QgsLayoutItemMapItemStack(QgsLayoutItemMap *map)
Constructor for QgsLayoutItemMapItemStack, attached to the specified map.
QgsLayoutItemMapItem & operator[](int index)
Returns a reference to an item at the specified index within the stack.
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.
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.
void addOverview(QgsLayoutItemMapOverview *overview)
Adds a new map overview to the stack and takes ownership of the overview.
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...
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 draw(QPainter *painter) override
Draws the item on to a destination painter.
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 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...
QgsLayoutItemMapOverview(const QString &name, QgsLayoutItemMap *map)
Constructor for QgsLayoutItemMapOverview.
QgsLayoutItemMap * linkedMap()
Returns the source map to show the overview extent of.
Layout graphical items for displaying a map.
Base class for all map layer types.
Definition qgsmaplayer.h:80
A container for the context for various read/write operations on objects.
An interface for classes which can visit style entity (e.g.
Represents a vector layer which manages a vector based dataset.
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_TRANSFER
Definition qgis_sip.h:36