Quantum GIS API Documentation  1.8
Public Types | Public Slots | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
QgsQuickPrint Class Reference

A convenience class for quickly printing a map. More...

#include <qgsquickprint.h>

Collaboration diagram for QgsQuickPrint:
Collaboration graph
[legend]

List of all members.

Public Types

enum  SymbolScalingType { ScaleUp, ScaleDown }

Public Slots

void printMap ()
void setTitle (QString theText)
void setName (QString theText)
void setCopyright (QString theText)
void setNorthArrow (QString theFileName)
void setLogo1 (QString theFileName)
void setLogo2 (QString theFileName)
void setOutputPdf (QString theFileName)
void setPageSize (QPrinter::PageSize theSize)
void setMapCanvas (QgsMapCanvas *thepMapCanvas)
 This is just a convenience function to get the.
void setMapRenderer (QgsMapRenderer *thepMapRenderer)
void setMapBackgroundColor (QColor theColor)

Public Member Functions

 QgsQuickPrint ()
virtual ~QgsQuickPrint ()
 Destructor.

Static Public Member Functions

static QString pageSizeToString (QPrinter::PageSize theSize)
static QPrinter::PageSize stringToPageSize (QString theSize)

Private Member Functions

void renderPrintScaleBar (QPainter *thepPainter, QgsMapRenderer *thepMapRenderer, int theMaximumWidth)
QStringList wordWrap (QString theString, QFontMetrics theMetrics, int theWidth)
void scalePointSymbols (int theScaleFactor, SymbolScalingType theDirection)
 Scale symbols in all layers by the specified amount.
void scaleTextLabels (int theScaleFactor, SymbolScalingType theDirection)
 Scale text labels in all layers by the specified amount.

Private Attributes

QgsMapRenderermpMapRenderer
QString mTitleText
QString mNameText
QString mCopyrightText
QString mNorthArrowFile
QString mLogo1File
QString mLogo2File
QString mOutputFileName
QColor mMapBackgroundColor
QPrinter::PageSize mPageSize

Detailed Description

A convenience class for quickly printing a map.

Prints a map with a map title, scale bar, north arrow, legend etc.

Definition at line 35 of file qgsquickprint.h.


Member Enumeration Documentation

Enumerator:
ScaleUp 
ScaleDown 

Definition at line 43 of file qgsquickprint.h.


Constructor & Destructor Documentation

Definition at line 57 of file qgsquickprint.cpp.

References mPageSize.

Destructor.

Definition at line 62 of file qgsquickprint.cpp.


Member Function Documentation

QString QgsQuickPrint::pageSizeToString ( QPrinter::PageSize  theSize) [static]

Definition at line 1045 of file qgsquickprint.cpp.

Referenced by printMap().

void QgsQuickPrint::printMap ( ) [slot]
void QgsQuickPrint::renderPrintScaleBar ( QPainter *  thepPainter,
QgsMapRenderer thepMapRenderer,
int  theMaximumWidth 
) [private]
void QgsQuickPrint::scalePointSymbols ( int  theScaleFactor,
SymbolScalingType  theDirection 
) [private]

Scale symbols in all layers by the specified amount.

Typically used for printing. Each symbol in each layer of the active mapcanvas will be iterated to. If the symbol is a point symbol its size will be multiplied by the scale factor or divided. In order to choose an appropriate scale factor, typically you should divide the print resolution by the screen resolution (often 72dpi or 96dpi).

Parameters:
theScaleFactoramount by which symbol sizes will be multiplied.
theDirectionwhether the sizes should be scaled up or down.
See also:
scaleTextLabels

Definition at line 705 of file qgsquickprint.cpp.

References QgsMapLayerRegistry::instance(), QgsMapRenderer::layerSet(), QgsMapLayerRegistry::mapLayer(), mpMapRenderer, QGis::Point, QgsSymbol::pointSize(), QgsDebugMsg, QgsVectorLayer::renderer(), ScaleUp, QgsSymbol::setPointSize(), QgsRenderer::symbols(), and QgsSymbol::type().

void QgsQuickPrint::scaleTextLabels ( int  theScaleFactor,
SymbolScalingType  theDirection 
) [private]

Scale text labels in all layers by the specified amount.

Typically used for printing. Each label in each layer of the active mapcanvas will be iterated to. The font point size will be multiplied by the scale factor or divided. In order to choose an appropriate scale factor, typically you should divide the print resolution by the screen resolution (often 72dpi or 96dpi).

Parameters:
theScaleFactoramount by which symbol sizes will be multiplied.
theDirectionwhether the sizes should be scaled up or down.
See also:
scalePointSymbols

Definition at line 665 of file qgsquickprint.cpp.

References QgsMapLayerRegistry::instance(), QgsVectorLayer::label(), QgsLabel::labelAttributes(), QgsMapRenderer::layerSet(), QgsMapLayerRegistry::mapLayer(), mpMapRenderer, QgsDebugMsg, ScaleUp, QgsLabelAttributes::setSize(), QgsLabelAttributes::size(), and QgsLabelAttributes::sizeType().

void QgsQuickPrint::setCopyright ( QString  theText) [slot]

Definition at line 74 of file qgsquickprint.cpp.

References mCopyrightText.

void QgsQuickPrint::setLogo1 ( QString  theFileName) [slot]

Definition at line 82 of file qgsquickprint.cpp.

References mLogo1File, and QgsDebugMsg.

void QgsQuickPrint::setLogo2 ( QString  theFileName) [slot]

Definition at line 87 of file qgsquickprint.cpp.

References mLogo2File, and QgsDebugMsg.

void QgsQuickPrint::setMapBackgroundColor ( QColor  theColor) [slot]

Definition at line 105 of file qgsquickprint.cpp.

References mMapBackgroundColor.

void QgsQuickPrint::setMapCanvas ( QgsMapCanvas thepMapCanvas) [slot]

This is just a convenience function to get the.

Definition at line 96 of file qgsquickprint.cpp.

References QgsMapCanvas::canvasColor(), QgsMapCanvas::mapRenderer(), mMapBackgroundColor, and mpMapRenderer.

void QgsQuickPrint::setMapRenderer ( QgsMapRenderer thepMapRenderer) [slot]

Definition at line 101 of file qgsquickprint.cpp.

References mpMapRenderer.

void QgsQuickPrint::setName ( QString  theText) [slot]

Definition at line 70 of file qgsquickprint.cpp.

References mNameText.

void QgsQuickPrint::setNorthArrow ( QString  theFileName) [slot]

Definition at line 78 of file qgsquickprint.cpp.

References mNorthArrowFile.

void QgsQuickPrint::setOutputPdf ( QString  theFileName) [slot]

Definition at line 92 of file qgsquickprint.cpp.

References mOutputFileName.

void QgsQuickPrint::setPageSize ( QPrinter::PageSize  theSize) [slot]

Definition at line 109 of file qgsquickprint.cpp.

References mPageSize.

void QgsQuickPrint::setTitle ( QString  theText) [slot]

Definition at line 66 of file qgsquickprint.cpp.

References mTitleText.

QPrinter::PageSize QgsQuickPrint::stringToPageSize ( QString  theSize) [static]

Definition at line 1080 of file qgsquickprint.cpp.

QStringList QgsQuickPrint::wordWrap ( QString  theString,
QFontMetrics  theMetrics,
int  theWidth 
) [private]

Definition at line 1006 of file qgsquickprint.cpp.

Referenced by printMap().


Member Data Documentation

QString QgsQuickPrint::mCopyrightText [private]

Definition at line 105 of file qgsquickprint.h.

Referenced by printMap(), and setCopyright().

QString QgsQuickPrint::mLogo1File [private]

Definition at line 107 of file qgsquickprint.h.

Referenced by printMap(), and setLogo1().

QString QgsQuickPrint::mLogo2File [private]

Definition at line 108 of file qgsquickprint.h.

Referenced by printMap(), and setLogo2().

Definition at line 110 of file qgsquickprint.h.

Referenced by setMapBackgroundColor(), and setMapCanvas().

QString QgsQuickPrint::mNameText [private]

Definition at line 104 of file qgsquickprint.h.

Referenced by printMap(), and setName().

QString QgsQuickPrint::mNorthArrowFile [private]

Definition at line 106 of file qgsquickprint.h.

Referenced by printMap(), and setNorthArrow().

QString QgsQuickPrint::mOutputFileName [private]

Definition at line 109 of file qgsquickprint.h.

Referenced by printMap(), and setOutputPdf().

QPrinter::PageSize QgsQuickPrint::mPageSize [private]

Definition at line 111 of file qgsquickprint.h.

Referenced by printMap(), QgsQuickPrint(), and setPageSize().

QString QgsQuickPrint::mTitleText [private]

Definition at line 103 of file qgsquickprint.h.

Referenced by printMap(), and setTitle().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines