QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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:
50
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
99 QgsLayoutItemMapOverview &operator[]( int index ); // cppcheck-suppress duplInheritedMember
100
104 QList< QgsLayoutItemMapOverview * > asList() const; // cppcheck-suppress duplInheritedMember
105 bool readXml( const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context ) override;
106
113 QList< QgsMapLayer * > modifyMapLayerList( const QList< QgsMapLayer * > &layers );
114};
115
124{
125 Q_OBJECT
126
127 public:
135
136 void draw( QPainter *painter ) override;
137 bool writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
138 bool readXml( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context ) override;
139 void finalizeRestoreFromXml() override;
140 bool usesAdvancedEffects() const override;
141
147
153
160
166
172 const QgsFillSymbol *frameSymbol() const SIP_SKIP;
173
178 QPainter::CompositionMode blendMode() const { return mBlendMode; }
179
184 void setBlendMode( QPainter::CompositionMode mode );
185
191 bool inverted() const { return mInverted; }
192
198 void setInverted( bool inverted );
199
204 bool centered() const { return mCentered; }
205
210 void setCentered( bool centered );
211
216 void connectSignals();
217
227 QgsVectorLayer *asMapLayer();
228
229 QgsMapLayer *mapLayer() override;
230
231 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
232
233 public slots:
234
238 void overviewExtentChanged();
239
240 private:
241 QgsLayoutItemMapOverview() = delete;
242
243 QString mFrameMapUuid;
244 QPointer< QgsLayoutItemMap > mFrameMap;
245
247 std::unique_ptr< QgsFillSymbol > mFrameSymbol;
248
250 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
251
253 bool mInverted = false;
254
256 bool mCentered = false;
257
258 std::unique_ptr< QgsVectorLayer > mExtentLayer;
259
261 void createDefaultFrameSymbol();
262};
263
264#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:83
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:133
#define SIP_TRANSFER
Definition qgis_sip.h:35