QGIS API Documentation  2.99.0-Master (ae4d26a)
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 
44 {
45  public:
46 
52 
62  void addOverview( QgsComposerMapOverview *overview SIP_TRANSFER );
63 
71  void removeOverview( const QString &overviewId );
72 
80  void moveOverviewUp( const QString &overviewId );
81 
89  void moveOverviewDown( const QString &overviewId );
90 
97  const QgsComposerMapOverview *constOverview( const QString &overviewId ) const;
98 
105  QgsComposerMapOverview *overview( const QString &overviewId ) const;
106 
113  QgsComposerMapOverview *overview( const int index ) const;
114 
123 
128  QList< QgsComposerMapOverview * > asList() const;
129 
137  bool readXml( const QDomElement &elem, const QDomDocument &doc ) override;
138 
139 };
140 
149 class CORE_EXPORT QgsComposerMapOverview : public QgsComposerMapItem
150 {
151  Q_OBJECT
152 
153  public:
154 
160  QgsComposerMapOverview( const QString &name, QgsComposerMap *map );
161 
162  virtual ~QgsComposerMapOverview();
163 
168  void draw( QPainter *painter ) override;
169 
176  bool writeXml( QDomElement &elem, QDomDocument &doc ) const override;
177 
184  bool readXml( const QDomElement &itemElem, const QDomDocument &doc ) override;
185 
186  bool usesAdvancedEffects() const override;
187 
193  void setFrameMap( const int mapId );
194 
199  int frameMapId() const { return mFrameMapId; }
200 
206  void setFrameSymbol( QgsFillSymbol *symbol SIP_TRANSFER );
207 
213  QgsFillSymbol *frameSymbol() { return mFrameSymbol; }
214 
221  const QgsFillSymbol *frameSymbol() const { return mFrameSymbol; } SIP_SKIP
222 
228  QPainter::CompositionMode blendMode() const { return mBlendMode; }
229 
235  void setBlendMode( const QPainter::CompositionMode blendMode );
236 
243  bool inverted() const { return mInverted; }
244 
251  void setInverted( const bool inverted );
252 
258  bool centered() const { return mCentered; }
259 
265  void setCentered( const bool centered );
266 
271  void connectSignals();
272 
273  public slots:
274 
278  void overviewExtentChanged();
279 
280  private:
281 
282  QgsComposerMapOverview(); //forbidden
283 
285  int mFrameMapId = -1;
286 
288  QgsFillSymbol *mFrameSymbol = nullptr;
289 
291  QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
292 
294  bool mInverted = false;
295 
297  bool mCentered = false;
298 
300  void createDefaultFrameSymbol();
301 
302 };
303 
304 #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.