QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 "qgscomposermapitem.h"
22 #include <QString>
23 #include <QObject>
24 #include <QPainter>
25 
26 class QDomDocument;
27 class QDomElement;
28 class QgsFillSymbolV2;
30 
40 {
41  public:
42 
47 
48  virtual ~QgsComposerMapOverviewStack();
49 
58  void addOverview( QgsComposerMapOverview* overview );
59 
66  void removeOverview( const QString& overviewId );
67 
74  void moveOverviewUp( const QString& overviewId );
75 
82  void moveOverviewDown( const QString& overviewId );
83 
89  const QgsComposerMapOverview* constOverview( const QString& overviewId ) const;
90 
96  QgsComposerMapOverview* overview( const QString& overviewId ) const;
97 
103  QgsComposerMapOverview* overview( const int index ) const;
104 
112 
117 
124  bool readXML( const QDomElement& elem, const QDomDocument& doc ) override;
125 
126 };
127 
135 class CORE_EXPORT QgsComposerMapOverview : public QgsComposerMapItem
136 {
137  Q_OBJECT
138 
139  public:
140 
145  QgsComposerMapOverview( const QString& name, QgsComposerMap* map );
146 
147  virtual ~QgsComposerMapOverview();
148 
152  void draw( QPainter* painter ) override;
153 
159  bool writeXML( QDomElement& elem, QDomDocument & doc ) const override;
160 
166  bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) override;
167 
168  bool usesAdvancedEffects() const override;
169 
174  void setFrameMap( const int mapId );
175 
179  int frameMapId() const { return mFrameMapId; }
180 
185  void setFrameSymbol( QgsFillSymbolV2* symbol );
186 
191  QgsFillSymbolV2* frameSymbol() { return mFrameSymbol; }
192 
198  const QgsFillSymbolV2* frameSymbol() const { return mFrameSymbol; }
199 
204  QPainter::CompositionMode blendMode() const { return mBlendMode; }
205 
210  void setBlendMode( const QPainter::CompositionMode blendMode );
211 
217  bool inverted() const { return mInverted; }
218 
224  void setInverted( const bool inverted );
225 
230  bool centered() const { return mCentered; }
231 
236  void setCentered( const bool centered );
237 
241  void connectSignals();
242 
243  public slots:
244 
247  void overviewExtentChanged();
248 
249  private:
250 
251  QgsComposerMapOverview(); //forbidden
252 
254  int mFrameMapId;
255 
257  QgsFillSymbolV2* mFrameSymbol;
258 
260  QPainter::CompositionMode mBlendMode;
261 
263  bool mInverted;
264 
266  bool mCentered;
267 
269  void createDefaultFrameSymbol();
270 
271 };
272 
273 #endif // QGSCOMPOSERMAPOVERVIEW_H
bool centered() const
Returns whether the extent of the map is forced to center on the overview.
static unsigned index
virtual void draw(QPainter *painter)=0
Draws the item on to a painter.
An item which is drawn inside a QgsComposerMap, eg a grid or map overview.
virtual bool usesAdvancedEffects() const
Returns true if the item is drawn using advanced effects, such as blend modes.
An individual overview which is drawn above the map content in a QgsComposerMap, and shows the extent...
const QgsFillSymbolV2 * frameSymbol() const
Gets the fill symbol used for drawing the overview extent.
QgsFillSymbolV2 * frameSymbol()
Gets the fill symbol used for drawing the overview extent.
QgsComposerMapItem & operator[](int idx)
Returns a reference to an item within the stack.
Object representing map window.
QList< QgsComposerMapItem *> asList() const
Returns a list of QgsComposerMapItems contained by the stack.
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.
int frameMapId() const
Returns id of source map.
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc) override
Sets map item state from a DOM document.
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.
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.