Quantum GIS API Documentation
1.7.4
|
00001 /*************************************************************************** 00002 quickprint.h 00003 ------------------- 00004 begin : Jan 21, 2004 00005 copyright : (C) 2004 by Tim Sutton 00006 email : tim@linfiniti.com 00007 00008 ***************************************************************************/ 00009 00010 /*************************************************************************** 00011 * * 00012 * This program is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU General Public License as published by * 00014 * the Free Software Foundation; either version 2 of the License, or * 00015 * (at your option) any later version. * 00016 * * 00017 ***************************************************************************/ 00018 /* $Id: plugin.h 7796 2007-12-16 22:11:38Z homann $ */ 00019 #ifndef QGSQUICKPRINT_H 00020 #define QGSQUICKPRINT_H 00021 00022 //QT4 includes 00023 #include <QObject> 00024 #include <QColor> 00025 #include <QPrinter> 00026 00027 //QGIS includes 00028 #include <qgsmaprenderer.h> 00029 #include <qgsmapcanvas.h> 00030 00031 00036 class GUI_EXPORT QgsQuickPrint: public QObject 00037 { 00038 Q_OBJECT 00039 public: 00040 00041 QgsQuickPrint(); 00043 virtual ~QgsQuickPrint(); 00044 enum SymbolScalingType {ScaleUp, ScaleDown}; 00045 static QString pageSizeToString( QPrinter::PageSize theSize ); 00046 static QPrinter::PageSize stringToPageSize( QString theSize ); 00047 00048 public slots: 00049 void printMap(); 00050 void setTitle( QString theText ); 00051 void setName( QString theText ); 00052 void setCopyright( QString theText ); 00053 void setNorthArrow( QString theFileName ); 00054 void setLogo1( QString theFileName ); 00055 void setLogo2( QString theFileName ); 00056 void setOutputPdf( QString theFileName ); 00057 void setPageSize( QPrinter::PageSize theSize ); 00059 //map render from the mapcanvas 00060 void setMapCanvas( QgsMapCanvas * thepMapCanvas ); 00061 void setMapRenderer( QgsMapRenderer * thepMapRenderer ); 00062 void setMapBackgroundColor( QColor theColor ); 00063 private: 00064 void renderPrintScaleBar( QPainter * thepPainter, 00065 QgsMapRenderer * thepMapRenderer, 00066 int theMaximumWidth ); 00067 QStringList wordWrap( QString theString, 00068 QFontMetrics theMetrics, 00069 int theWidth ); 00085 void scalePointSymbols( int theScaleFactor, SymbolScalingType theDirection ); 00101 void scaleTextLabels( int theScaleFactor, SymbolScalingType theDirection ); 00102 00103 QgsMapRenderer * mpMapRenderer; 00104 QString mTitleText; 00105 QString mNameText; 00106 QString mCopyrightText; 00107 QString mNorthArrowFile; 00108 QString mLogo1File; 00109 QString mLogo2File; 00110 QString mOutputFileName; 00111 QColor mMapBackgroundColor; 00112 QPrinter::PageSize mPageSize; 00113 }; 00114 00115 #endif //QGSQUICKPRINT_H