QGIS API Documentation  2.99.0-Master (7d4f81d)
qgscomposermapoverview.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposermapoverview.h
3  --------------------
4  begin : July 2014
5  copyright : (C) 2014 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 QGSCOMPOSERMAPOVERVIEW_H
19 #define QGSCOMPOSERMAPOVERVIEW_H
20 
21 #include "qgis_core.h"
22 #include "qgis_sip.h"
23 #include "qgis.h"
24 #include "qgscomposermapitem.h"
25 #include <QString>
26 #include <QObject>
27 #include <QPainter>
28 
29 class QDomDocument;
30 class QDomElement;
31 class QgsFillSymbol;
33 
43 {
44  public:
45 
50 
59  void addOverview( QgsComposerMapOverview *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 
90  const QgsComposerMapOverview *constOverview( const QString &overviewId ) const;
91 
97  QgsComposerMapOverview *overview( const QString &overviewId ) const;
98 
104  QgsComposerMapOverview *overview( const int index ) const;
105 
113 
117  QList< QgsComposerMapOverview * > asList() const;
118 
125  bool readXml( const QDomElement &elem, const QDomDocument &doc ) override;
126 
127 };
128 
136 class CORE_EXPORT QgsComposerMapOverview : public QgsComposerMapItem
137 {
138  Q_OBJECT
139 
140  public:
141 
146  QgsComposerMapOverview( const QString &name, QgsComposerMap *map );
147 
148  virtual ~QgsComposerMapOverview();
149 
153  void draw( QPainter *painter ) override;
154 
160  bool writeXml( QDomElement &elem, QDomDocument &doc ) const override;
161 
167  bool readXml( const QDomElement &itemElem, const QDomDocument &doc ) override;
168 
169  bool usesAdvancedEffects() const override;
170 
175  void setFrameMap( const int mapId );
176 
180  int frameMapId() const { return mFrameMapId; }
181 
186  void setFrameSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
187 
192  QgsFillSymbol *frameSymbol() { return mFrameSymbol; }
193 
199  const QgsFillSymbol *frameSymbol() const { return mFrameSymbol; } SIP_SKIP
200 
205  QPainter::CompositionMode blendMode() const { return mBlendMode; }
206 
211  void setBlendMode( const QPainter::CompositionMode blendMode );
212 
218  bool inverted() const { return mInverted; }
219 
225  void setInverted( const bool inverted );
226 
231  bool centered() const { return mCentered; }
232 
237  void setCentered( const bool centered );
238 
242  void connectSignals();
243 
244  public slots:
245 
248  void overviewExtentChanged();
249 
250  private:
251 
252  QgsComposerMapOverview(); //forbidden
253 
255  int mFrameMapId;
256 
258  QgsFillSymbol *mFrameSymbol = nullptr;
259 
261  QPainter::CompositionMode mBlendMode;
262 
264  bool mInverted;
265 
267  bool mCentered;
268 
270  void createDefaultFrameSymbol();
271 
272 };
273 
274 #endif // QGSCOMPOSERMAPOVERVIEW_H
bool centered() const
Returns whether the extent of the map is forced to center on the overview.
virtual bool readXml(const QDomElement &itemElem, const QDomDocument &doc) override
Sets map item state from a DOM document.
virtual void draw(QPainter *painter)=0
Draws the item on to a painter.
virtual bool writeXml(QDomElement &elem, QDomDocument &doc) const override
Stores map item state in DOM element.
virtual bool readXml(const QDomElement &elem, const QDomDocument &doc)=0
Sets the item stack&#39;s state from a DOM document.
An item which is drawn inside a QgsComposerMap, e.g., a grid or map overview.
An individual overview which is drawn above the map content in a QgsComposerMap, and shows the extent...
#define SIP_SKIP
Definition: qgis_sip.h:119
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsComposerMapItem & operator[](int idx)
Returns a reference to an item within the stack.
QgsFillSymbol * frameSymbol()
Gets the fill symbol used for drawing the overview extent.
Object representing map window.
QList< QgsComposerMapItem *> asList() const
Returns a list of QgsComposerMapItems contained by the stack.
const QgsFillSymbol * frameSymbol() const
Gets 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...
A collection of map items which are drawn above the map content in a QgsComposerMap.
virtual bool usesAdvancedEffects() const
Returns true if the item is drawn using advanced effects, such as blend modes.
int frameMapId() const
Returns id of source map.
QPainter::CompositionMode blendMode() const
Retrieves the blending mode used for drawing the overview.
A collection of overviews which are drawn above the map content in a QgsComposerMap.