Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgsquickprint.h
Go to the documentation of this file.
1 /***************************************************************************
2  quickprint.h
3  -------------------
4  begin : Jan 21, 2004
5  copyright : (C) 2004 by Tim Sutton
6  email : tim@linfiniti.com
7 
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 /* $Id: plugin.h 7796 2007-12-16 22:11:38Z homann $ */
19 #ifndef QGSQUICKPRINT_H
20 #define QGSQUICKPRINT_H
21 
22 //QT4 includes
23 #include <QObject>
24 #include <QColor>
25 #include <QPrinter>
26 
27 //QGIS includes
28 #include <qgsmaprenderer.h>
29 #include <qgsmapcanvas.h>
30 
31 
36 class GUI_EXPORT QgsQuickPrint: public QObject
37 {
38  Q_OBJECT
39  public:
40 
41  QgsQuickPrint();
43  virtual ~QgsQuickPrint();
44  enum SymbolScalingType {ScaleUp, ScaleDown};
45  static QString pageSizeToString( QPrinter::PageSize theSize );
46  static QPrinter::PageSize stringToPageSize( QString theSize );
47 
48  public slots:
49  void printMap();
50  void setTitle( QString theText );
51  void setName( QString theText );
52  void setCopyright( QString theText );
53  void setNorthArrow( QString theFileName );
54  void setLogo1( QString theFileName );
55  void setLogo2( QString theFileName );
56  void setOutputPdf( QString theFileName );
57  void setPageSize( QPrinter::PageSize theSize );
59  //map render from the mapcanvas
60  void setMapCanvas( QgsMapCanvas * thepMapCanvas );
61  void setMapRenderer( QgsMapRenderer * thepMapRenderer );
62  void setMapBackgroundColor( QColor theColor );
63  private:
64  void renderPrintScaleBar( QPainter * thepPainter,
65  QgsMapRenderer * thepMapRenderer,
66  int theMaximumWidth );
67  QStringList wordWrap( QString theString,
68  QFontMetrics theMetrics,
69  int theWidth );
85  void scalePointSymbols( int theScaleFactor, SymbolScalingType theDirection );
101  void scaleTextLabels( int theScaleFactor, SymbolScalingType theDirection );
102 
104  QString mTitleText;
105  QString mNameText;
106  QString mCopyrightText;
108  QString mLogo1File;
109  QString mLogo2File;
112  QPrinter::PageSize mPageSize;
113 };
114 
115 #endif //QGSQUICKPRINT_H