QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
116  QList< QgsComposerMapOverview* > asList() const;
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 
197  const QgsFillSymbolV2* frameSymbol() const { return mFrameSymbol; }
198 
203  QPainter::CompositionMode blendMode() const { return mBlendMode; }
204 
209  void setBlendMode( const QPainter::CompositionMode blendMode );
210 
216  bool inverted() const { return mInverted; }
217 
223  void setInverted( const bool inverted );
224 
229  bool centered() const { return mCentered; }
230 
235  void setCentered( const bool centered );
236 
240  void connectSignals();
241 
242  public slots:
243 
246  void overviewExtentChanged();
247 
248  private:
249 
250  QgsComposerMapOverview(); //forbidden
251 
253  int mFrameMapId;
254 
256  QgsFillSymbolV2* mFrameSymbol;
257 
259  QPainter::CompositionMode mBlendMode;
260 
262  bool mInverted;
263 
265  bool mCentered;
266 
268  void createDefaultFrameSymbol();
269 
270 };
271 
272 #endif // QGSCOMPOSERMAPOVERVIEW_H