#include <qgsquickprint.h>
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 | |
QgsMapRenderer * | mpMapRenderer |
QString | mTitleText |
QString | mNameText |
QString | mCopyrightText |
QString | mNorthArrowFile |
QString | mLogo1File |
QString | mLogo2File |
QString | mOutputFileName |
QColor | mMapBackgroundColor |
QPrinter::PageSize | mPageSize |
Prints a map with a map title, scale bar, north arrow, legend etc.
Definition at line 36 of file qgsquickprint.h.
QgsQuickPrint::QgsQuickPrint | ( | ) |
QgsQuickPrint::~QgsQuickPrint | ( | ) | [virtual] |
QString QgsQuickPrint::pageSizeToString | ( | QPrinter::PageSize | theSize | ) | [static] |
QPrinter::PageSize QgsQuickPrint::stringToPageSize | ( | QString | theSize | ) | [static] |
Definition at line 1085 of file qgsquickprint.cpp.
void QgsQuickPrint::printMap | ( | ) | [slot] |
Definition at line 115 of file qgsquickprint.cpp.
References QgsSymbol::brush(), QgsSymbol::getPointSymbolAsImage(), QgsMapLayerRegistry::instance(), QgsSymbol::label(), QgsMapRenderer::layerSet(), QGis::Line, QgsSymbol::lowerValue(), QgsMapLayerRegistry::mapLayer(), mCopyrightText, mLogo1File, mLogo2File, mNameText, mNorthArrowFile, mOutputFileName, mPageSize, mpMapRenderer, mTitleText, QgsMapLayer::name(), QgsMapRenderer::outputDpi(), QgsMapRenderer::outputSize(), pageSizeToString(), QgsSymbol::pen(), QGis::Point, QgsDebugMsg, QgsMapRenderer::render(), QgsVectorLayer::renderer(), renderPrintScaleBar(), QgsMapRenderer::setOutputSize(), QgsRenderer::symbols(), QgsSymbol::type(), QgsSymbol::upperValue(), and wordWrap().
void QgsQuickPrint::setTitle | ( | QString | theText | ) | [slot] |
void QgsQuickPrint::setName | ( | QString | theText | ) | [slot] |
void QgsQuickPrint::setCopyright | ( | QString | theText | ) | [slot] |
void QgsQuickPrint::setNorthArrow | ( | QString | theFileName | ) | [slot] |
void QgsQuickPrint::setLogo1 | ( | QString | theFileName | ) | [slot] |
void QgsQuickPrint::setLogo2 | ( | QString | theFileName | ) | [slot] |
void QgsQuickPrint::setOutputPdf | ( | QString | theFileName | ) | [slot] |
void QgsQuickPrint::setPageSize | ( | QPrinter::PageSize | theSize | ) | [slot] |
void QgsQuickPrint::setMapCanvas | ( | QgsMapCanvas * | thepMapCanvas | ) | [slot] |
This is just a convenience function to get the.
Definition at line 97 of file qgsquickprint.cpp.
References QgsMapCanvas::canvasColor(), QgsMapCanvas::mapRenderer(), mMapBackgroundColor, and mpMapRenderer.
void QgsQuickPrint::setMapRenderer | ( | QgsMapRenderer * | thepMapRenderer | ) | [slot] |
void QgsQuickPrint::setMapBackgroundColor | ( | QColor | theColor | ) | [slot] |
void QgsQuickPrint::renderPrintScaleBar | ( | QPainter * | thepPainter, | |
QgsMapRenderer * | thepMapRenderer, | |||
int | theMaximumWidth | |||
) | [private] |
Definition at line 777 of file qgsquickprint.cpp.
References QGis::Degrees, QGis::Feet, QgsMapRenderer::layerSet(), QgsMapRenderer::mapUnits(), QgsMapRenderer::mapUnitsPerPixel(), QGis::Meters, QgsDebugMsg, and QGis::UnknownUnit.
Referenced by printMap().
QStringList QgsQuickPrint::wordWrap | ( | QString | theString, | |
QFontMetrics | theMetrics, | |||
int | theWidth | |||
) | [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).
theScaleFactor | amount by which symbol sizes will be multiplied. | |
theDirection | whether the sizes should be scaled up or down. |
Definition at line 710 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).
theScaleFactor | amount by which symbol sizes will be multiplied. | |
theDirection | whether the sizes should be scaled up or down. |
Definition at line 670 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().
QgsMapRenderer* QgsQuickPrint::mpMapRenderer [private] |
Definition at line 103 of file qgsquickprint.h.
Referenced by printMap(), scalePointSymbols(), scaleTextLabels(), setMapCanvas(), and setMapRenderer().
QString QgsQuickPrint::mTitleText [private] |
QString QgsQuickPrint::mNameText [private] |
QString QgsQuickPrint::mCopyrightText [private] |
QString QgsQuickPrint::mNorthArrowFile [private] |
QString QgsQuickPrint::mLogo1File [private] |
QString QgsQuickPrint::mLogo2File [private] |
QString QgsQuickPrint::mOutputFileName [private] |
QColor QgsQuickPrint::mMapBackgroundColor [private] |
Definition at line 111 of file qgsquickprint.h.
Referenced by setMapBackgroundColor(), and setMapCanvas().
QPrinter::PageSize QgsQuickPrint::mPageSize [private] |
Definition at line 112 of file qgsquickprint.h.
Referenced by printMap(), QgsQuickPrint(), and setPageSize().