Quantum GIS API Documentation  1.8
src/gui/qgsquickprint.h
Go to the documentation of this file.
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 #ifndef QGSQUICKPRINT_H
00019 #define QGSQUICKPRINT_H
00020 
00021 //QT4 includes
00022 #include <QObject>
00023 #include <QColor>
00024 #include <QPrinter>
00025 
00026 //QGIS includes
00027 #include <qgsmaprenderer.h>
00028 #include <qgsmapcanvas.h>
00029 
00030 
00035 class GUI_EXPORT QgsQuickPrint: public QObject
00036 {
00037     Q_OBJECT
00038   public:
00039 
00040     QgsQuickPrint();
00042     virtual ~QgsQuickPrint();
00043     enum SymbolScalingType {ScaleUp, ScaleDown};
00044     static QString pageSizeToString( QPrinter::PageSize theSize );
00045     static QPrinter::PageSize stringToPageSize( QString theSize );
00046 
00047   public slots:
00048     void printMap();
00049     void setTitle( QString theText );
00050     void setName( QString theText );
00051     void setCopyright( QString theText );
00052     void setNorthArrow( QString theFileName );
00053     void setLogo1( QString theFileName );
00054     void setLogo2( QString theFileName );
00055     void setOutputPdf( QString theFileName );
00056     void setPageSize( QPrinter::PageSize theSize );
00058     //map render from the mapcanvas
00059     void setMapCanvas( QgsMapCanvas * thepMapCanvas );
00060     void setMapRenderer( QgsMapRenderer * thepMapRenderer );
00061     void setMapBackgroundColor( QColor theColor );
00062   private:
00063     void renderPrintScaleBar( QPainter * thepPainter,
00064                               QgsMapRenderer * thepMapRenderer,
00065                               int theMaximumWidth );
00066     QStringList wordWrap( QString theString,
00067                           QFontMetrics theMetrics,
00068                           int theWidth );
00084     void scalePointSymbols( int theScaleFactor, SymbolScalingType theDirection );
00100     void scaleTextLabels( int theScaleFactor, SymbolScalingType theDirection );
00101 
00102     QgsMapRenderer * mpMapRenderer;
00103     QString mTitleText;
00104     QString mNameText;
00105     QString mCopyrightText;
00106     QString mNorthArrowFile;
00107     QString mLogo1File;
00108     QString mLogo2File;
00109     QString mOutputFileName;
00110     QColor mMapBackgroundColor;
00111     QPrinter::PageSize mPageSize;
00112 };
00113 
00114 #endif //QGSQUICKPRINT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines