00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef QGSQUICKPRINT_H
00020 #define QGSQUICKPRINT_H
00021
00022
00023 #include <QObject>
00024 #include <QColor>
00025 #include <QPrinter>
00026
00027
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
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