QGIS API Documentation
2.4.0-Chugiak
|
Graphics scene for map printing. More...
#include <qgscomposition.h>
Public Types | |
enum | PlotStyle { Preview = 0, Print, Postscript } |
Plot type. More... | |
enum | GridStyle { Solid, Dots, Crosses } |
Style to draw the snapping grid. More... | |
enum | ZValueDirection { ZValueBelow, ZValueAbove } |
enum | AtlasMode { AtlasOff, PreviewAtlas, ExportAtlas } |
Composition atlas modes. More... | |
Public Slots | |
void | sendItemAddedSignal (QgsComposerItem *item) |
Casts object to the proper subclass type and calls corresponding itemAdded signal. More... | |
void | updateBounds () |
Updates the scene bounds of the composition. More... | |
void | refreshItems () |
Forces items in the composition to refresh. More... | |
void | setSelectedItem (QgsComposerItem *item) |
Clears any selected items and sets an item as the current selection. More... | |
Signals | |
void | paperSizeChanged () |
void | nPagesChanged () |
void | printResolutionChanged () |
Is emitted when the compositions print resolution changes. More... | |
void | selectedItemChanged (QgsComposerItem *selected) |
Is emitted when selected item changed. More... | |
void | composerArrowAdded (QgsComposerArrow *arrow) |
Is emitted when new composer arrow has been added to the view. More... | |
void | composerHtmlFrameAdded (QgsComposerHtml *html, QgsComposerFrame *frame) |
Is emitted when a new composer html has been added to the view. More... | |
void | composerLabelAdded (QgsComposerLabel *label) |
Is emitted when new composer label has been added to the view. More... | |
void | composerMapAdded (QgsComposerMap *map) |
Is emitted when new composer map has been added to the view. More... | |
void | composerScaleBarAdded (QgsComposerScaleBar *scalebar) |
Is emitted when new composer scale bar has been added. More... | |
void | composerLegendAdded (QgsComposerLegend *legend) |
Is emitted when a new composer legend has been added. More... | |
void | composerPictureAdded (QgsComposerPicture *picture) |
Is emitted when a new composer picture has been added. More... | |
void | composerShapeAdded (QgsComposerShape *shape) |
Is emitted when a new composer shape has been added. More... | |
void | composerTableAdded (QgsComposerAttributeTable *table) |
Is emitted when a new composer table has been added. More... | |
void | itemRemoved (QgsComposerItem *) |
Is emitted when a composer item has been removed from the scene. More... | |
void | refreshItemsTriggered () |
Is emitted when item in the composition must be refreshed. More... | |
void | statusMsgChanged (QString message) |
Is emitted when the composition has an updated status bar message for the composer window. More... | |
Public Member Functions | |
Q_DECL_DEPRECATED | QgsComposition (QgsMapRenderer *mapRenderer) |
QgsComposition (const QgsMapSettings &mapSettings) | |
~QgsComposition () | |
void | setPaperSize (double width, double height) |
Changes size of paper item. More... | |
double | paperHeight () const |
Returns height of paper item. More... | |
double | paperWidth () const |
Returns width of paper item. More... | |
double | spaceBetweenPages () const |
void | setNumPages (int pages) |
Note: added in version 1.9. More... | |
int | numPages () const |
Note: added in version 1.9. More... | |
void | setPageStyleSymbol (QgsFillSymbolV2 *symbol) |
Note: added in version 2.1. More... | |
QgsFillSymbolV2 * | pageStyleSymbol () |
Note: added in version 2.1. More... | |
QPointF | positionOnPage (const QPointF &position) const |
Returns the position within a page of a point in the composition. More... | |
int | pageNumberForPoint (const QPointF &position) const |
Returns the page number corresponding to a point in the composition. More... | |
void | setStatusMessage (const QString &message) |
Sets the status bar message for the composer window. More... | |
void | updateSettings () |
Refreshes the composition when composer related options change Note: added in version 2.1. More... | |
void | setSnapToGridEnabled (bool b) |
bool | snapToGridEnabled () const |
void | setGridVisible (bool b) |
bool | gridVisible () const |
void | setSnapLinesVisible (bool visible) |
Hides / shows custom snap lines. More... | |
bool | snapLinesVisible () const |
void | setAlignmentSnap (bool s) |
bool | alignmentSnap () const |
void | setSmartGuidesEnabled (bool b) |
bool | smartGuidesEnabled () const |
void | clearSnapLines () |
Removes all snap lines. More... | |
void | setSnapGridResolution (double r) |
double | snapGridResolution () const |
void | setSnapGridTolerance (double tolerance) |
double | snapGridTolerance () const |
void | setSnapGridOffsetX (double offset) |
double | snapGridOffsetX () const |
void | setSnapGridOffsetY (double offset) |
double | snapGridOffsetY () const |
void | setGridPen (const QPen &p) |
const QPen & | gridPen () const |
void | setGridStyle (GridStyle s) |
GridStyle | gridStyle () const |
void | setAlignmentSnapTolerance (double t) |
double | alignmentSnapTolerance () const |
QUndoStack * | undoStack () |
Returns pointer to undo/redo command storage. More... | |
QgsComposerItem * | composerItemAt (const QPointF &position) |
Returns the topmost composer item. More... | |
QgsComposerItem * | composerItemAt (const QPointF &position, const QgsComposerItem *belowItem) |
Returns the highest composer item at a specified position which is below a specified item. More... | |
int | pageNumberAt (const QPointF &position) const |
Returns the page number (0-bsaed) given a coordinate. More... | |
int | itemPageNumber (const QgsComposerItem *) const |
Returns on which page number (0-based) is displayed an item. More... | |
QList< QgsComposerItem * > | selectedComposerItems () |
QList< const QgsComposerMap * > | composerMapItems () const |
Returns pointers to all composer maps in the scene. More... | |
template<class T > | |
void | composerItems (QList< T * > &itemList) |
Return composer items of a specific type. More... | |
const QgsComposerMap * | getComposerMapById (int id) const |
Returns the composer map with specified id. More... | |
const QgsComposerHtml * | getComposerHtmlByItem (QgsComposerItem *item) const |
Returns the composer html with specified id (a string as named in the composer user interface item properties). More... | |
const QgsComposerItem * | getComposerItemById (QString theId) const |
Returns a composer item given its text identifier. More... | |
const QgsComposerItem * | getComposerItemByUuid (QString theUuid) const |
Returns a composer item given its unique identifier. More... | |
int | printResolution () const |
void | setPrintResolution (int dpi) |
bool | printAsRaster () const |
void | setPrintAsRaster (bool enabled) |
bool | generateWorldFile () const |
void | setGenerateWorldFile (bool enabled) |
QgsComposerMap * | worldFileMap () const |
void | setWorldFileMap (QgsComposerMap *map) |
bool | useAdvancedEffects () const |
Returns true if a composition should use advanced effects such as blend modes. More... | |
void | setUseAdvancedEffects (bool effectsEnabled) |
Used to enable or disable advanced effects such as blend modes in a composition. More... | |
Q_DECL_DEPRECATED QgsMapRenderer * | mapRenderer () |
Returns pointer to map renderer of qgis map canvas. More... | |
const QgsMapSettings & | mapSettings () const |
Return setting of QGIS map canvas. More... | |
QgsComposition::PlotStyle | plotStyle () const |
void | setPlotStyle (QgsComposition::PlotStyle style) |
int | pixelFontSize (double pointSize) const |
Returns the pixel font size for a font that has point size set. More... | |
double | pointFontSize (int pixelSize) const |
Does the inverse calculation and returns points for pixels (equals to mm in QgsComposition) More... | |
bool | writeXML (QDomElement &composerElem, QDomDocument &doc) |
Writes settings to xml (paper dimension) More... | |
bool | readXML (const QDomElement &compositionElem, const QDomDocument &doc) |
Reads settings from xml file. More... | |
bool | loadFromTemplate (const QDomDocument &doc, QMap< QString, QString > *substitutionMap=0, bool addUndoCommands=false) |
Load a template document. More... | |
void | addItemsFromXML (const QDomElement &elem, const QDomDocument &doc, QMap< QgsComposerMap *, int > *mapsToRestore=0, bool addUndoCommands=false, QPointF *pos=0, bool pasteInPlace=false) |
Add items from XML representation to the graphics scene (for project file reading, pasting items from clipboard) More... | |
void | addItemToZList (QgsComposerItem *item) |
Adds item to z list. More... | |
void | removeItemFromZList (QgsComposerItem *item) |
Removes item from z list. More... | |
void | raiseSelectedItems () |
void | raiseItem (QgsComposerItem *item) |
void | lowerSelectedItems () |
void | lowerItem (QgsComposerItem *item) |
void | moveSelectedItemsToTop () |
void | moveItemToTop (QgsComposerItem *item) |
void | moveSelectedItemsToBottom () |
void | moveItemToBottom (QgsComposerItem *item) |
void | selectNextByZOrder (ZValueDirection direction) |
QgsComposerItem * | getComposerItemBelow (QgsComposerItem *item) |
QgsComposerItem * | getComposerItemAbove (QgsComposerItem *item) |
void | alignSelectedItemsLeft () |
void | alignSelectedItemsHCenter () |
void | alignSelectedItemsRight () |
void | alignSelectedItemsTop () |
void | alignSelectedItemsVCenter () |
void | alignSelectedItemsBottom () |
void | lockSelectedItems () |
Lock the selected items. More... | |
void | unlockAllItems () |
Unlock all items. More... | |
void | sortZList () |
Sorts the zList. More... | |
void | refreshZList () |
Rebuilds the z order list based on current order of items in scene. More... | |
QPointF | snapPointToGrid (const QPointF &scenePoint) const |
Snaps a scene coordinate point to grid. More... | |
QList< QGraphicsLineItem * > * | snapLines () |
Returns pointer to snap lines collection. More... | |
QgsComposerMouseHandles * | selectionHandles () |
Returns pointer to selection handles. More... | |
QGraphicsLineItem * | addSnapLine () |
Add a custom snap line (can be horizontal or vertical) More... | |
void | removeSnapLine (QGraphicsLineItem *line) |
Remove custom snap line (and delete the object) More... | |
QGraphicsLineItem * | nearestSnapLine (bool horizontal, double x, double y, double tolerance, QList< QPair< QgsComposerItem *, QgsComposerItem::ItemPositionMode > > &snappedItems) |
Get nearest snap line. More... | |
void | beginCommand (QgsComposerItem *item, const QString &commandText, QgsComposerMergeCommand::Context c=QgsComposerMergeCommand::Unknown) |
Allocates new item command and saves initial state in it. More... | |
void | endCommand () |
Saves end state of item and pushes command to the undo history. More... | |
void | cancelCommand () |
Deletes current command. More... | |
void | beginMultiFrameCommand (QgsComposerMultiFrame *multiFrame, const QString &text) |
void | endMultiFrameCommand () |
void | addMultiFrame (QgsComposerMultiFrame *multiFrame) |
Adds multiframe. More... | |
void | removeMultiFrame (QgsComposerMultiFrame *multiFrame) |
Removes multi frame (but does not delete it) More... | |
void | addComposerArrow (QgsComposerArrow *arrow) |
Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal) More... | |
void | addComposerLabel (QgsComposerLabel *label) |
Adds label to the graphics scene and advices composer to create a widget for it (through signal) More... | |
void | addComposerMap (QgsComposerMap *map, bool setDefaultPreviewStyle=true) |
Adds map to the graphics scene and advices composer to create a widget for it (through signal) More... | |
void | addComposerScaleBar (QgsComposerScaleBar *scaleBar) |
Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal) More... | |
void | addComposerLegend (QgsComposerLegend *legend) |
Adds legend to the graphics scene and advices composer to create a widget for it (through signal) More... | |
void | addComposerPicture (QgsComposerPicture *picture) |
Adds picture to the graphics scene and advices composer to create a widget for it (through signal) More... | |
void | addComposerShape (QgsComposerShape *shape) |
Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal) More... | |
void | addComposerTable (QgsComposerAttributeTable *table) |
Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal) More... | |
void | addComposerHtmlFrame (QgsComposerHtml *html, QgsComposerFrame *frame) |
Adds composer html frame and advices composer to create a widget for it (through signal) More... | |
void | removeComposerItem (QgsComposerItem *item, bool createCommand=true) |
Remove item from the graphics scene. More... | |
void | pushAddRemoveCommand (QgsComposerItem *item, const QString &text, QgsAddRemoveItemCommand::State state=QgsAddRemoveItemCommand::Added) |
Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack. More... | |
void | setPreventCursorChange (bool preventChange) |
If true, prevents any mouse cursor changes by the composition or by any composer items Used by QgsComposer and QgsComposerView to prevent unwanted cursor changes. More... | |
bool | preventCursorChange () |
void | beginPrint (QPrinter &printer) |
Prepare the printer for printing. More... | |
void | beginPrintAsPDF (QPrinter &printer, const QString &file) |
Prepare the printer for printing in a PDF. More... | |
void | doPrint (QPrinter &printer, QPainter &painter) |
Print on a preconfigured printer. More... | |
bool | print (QPrinter &printer) |
Convenience function that prepares the printer and prints. More... | |
bool | exportAsPDF (const QString &file) |
Convenience function that prepares the printer for printing in PDF and prints. More... | |
QImage | printPageAsRaster (int page) |
print composer page to image If the image does not fit into memory, a null image is returned More... | |
void | renderPage (QPainter *p, int page) |
Render a page to a paint device. More... | |
void | computeWorldFileParameters (double &a, double &b, double &c, double &d, double &e, double &f) const |
Compute world file parameters. More... | |
QgsAtlasComposition & | atlasComposition () |
QgsComposition::AtlasMode | atlasMode () const |
Returns the current atlas mode of the composition. More... | |
bool | setAtlasMode (QgsComposition::AtlasMode mode) |
Sets the current atlas mode of the composition. More... | |
QList< QgsPaperItem * > | pages () |
Return pages in the correct order. More... | |
Static Public Member Functions | |
static void | relativeResizeRect (QRectF &rectToResize, const QRectF &boundsBefore, const QRectF &boundsAfter) |
Resizes a QRectF relative to the change from boundsBefore to boundsAfter. More... | |
static double | relativePosition (double position, double beforeMin, double beforeMax, double afterMin, double afterMax) |
Returns a scaled position given a before and after range. More... | |
Protected Member Functions | |
void | init () |
Private Member Functions | |
void | createDefaultPageStyleSymbol () |
QgsComposition () | |
QRectF | compositionBounds () const |
Calculates the bounds of all non-gui items in the composition. More... | |
void | updateZValues (bool addUndoCommands=true) |
Reset z-values of items based on position in z list. More... | |
int | boundingRectOfSelectedItems (QRectF &bRect) |
Returns the bounding rectangle of the selected items in scene coordinates. More... | |
void | loadDefaults () |
Loads default composer settings. More... | |
void | loadSettings () |
Loads composer settings which may change, eg grid color. More... | |
QPointF | minPointFromXml (const QDomElement &elem) const |
Calculates the item minimum position from an xml string. More... | |
void | connectAddRemoveCommandSignals (QgsAddRemoveItemCommand *c) |
void | updatePaperItems () |
void | addPaperItem () |
void | removePaperItems () |
void | deleteAndRemoveMultiFrames () |
Static Private Member Functions | |
static QString | encodeStringForXML (const QString &str) |
Graphics scene for map printing.
The class manages the paper item which always is the item in the back (z-value 0). It maintains the z-Values of the items and stores them in a list in ascending z-Order. This list can be changed to lower/raise items one position or to bring them to front/back.
Definition at line 66 of file qgscomposition.h.
Composition atlas modes.
Enumerator | |
---|---|
AtlasOff | |
PreviewAtlas | |
ExportAtlas |
Definition at line 98 of file qgscomposition.h.
Style to draw the snapping grid.
Enumerator | |
---|---|
Solid | |
Dots | |
Crosses |
Definition at line 80 of file qgscomposition.h.
Enumerator | |
---|---|
ZValueBelow | |
ZValueAbove |
Definition at line 87 of file qgscomposition.h.
QgsComposition::QgsComposition | ( | QgsMapRenderer * | mapRenderer | ) |
Definition at line 53 of file qgscomposition.cpp.
References init().
|
explicit |
Definition at line 62 of file qgscomposition.cpp.
References init().
QgsComposition::~QgsComposition | ( | ) |
Definition at line 155 of file qgscomposition.cpp.
References deleteAndRemoveMultiFrames(), mActiveItemCommand, mActiveMultiFrameCommand, mPageStyleSymbol, and removePaperItems().
|
private |
void QgsComposition::addComposerArrow | ( | QgsComposerArrow * | arrow | ) |
Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal)
Definition at line 2118 of file qgscomposition.cpp.
References composerArrowAdded(), and updateBounds().
Referenced by addItemsFromXML(), and QgsComposerView::mouseReleaseEvent().
void QgsComposition::addComposerHtmlFrame | ( | QgsComposerHtml * | html, |
QgsComposerFrame * | frame | ||
) |
Adds composer html frame and advices composer to create a widget for it (through signal)
Definition at line 2208 of file qgscomposition.cpp.
References composerHtmlFrameAdded(), and updateBounds().
Referenced by QgsComposerHtml::addFrame().
void QgsComposition::addComposerLabel | ( | QgsComposerLabel * | label | ) |
Adds label to the graphics scene and advices composer to create a widget for it (through signal)
Definition at line 2128 of file qgscomposition.cpp.
References composerLabelAdded(), and updateBounds().
Referenced by addItemsFromXML(), and QgsComposerView::mouseReleaseEvent().
void QgsComposition::addComposerLegend | ( | QgsComposerLegend * | legend | ) |
Adds legend to the graphics scene and advices composer to create a widget for it (through signal)
Definition at line 2168 of file qgscomposition.cpp.
References composerLegendAdded(), and updateBounds().
Referenced by addItemsFromXML(), and QgsComposerView::mouseReleaseEvent().
void QgsComposition::addComposerMap | ( | QgsComposerMap * | map, |
bool | setDefaultPreviewStyle = true |
||
) |
Adds map to the graphics scene and advices composer to create a widget for it (through signal)
Definition at line 2138 of file qgscomposition.cpp.
References QgsComposerMap::Cache, QgsComposerMap::cache(), composerMapAdded(), QgsComposerMap::previewMode(), QgsComposerMap::Rectangle, QgsComposerMap::setPreviewMode(), and updateBounds().
Referenced by addItemsFromXML(), and QgsComposerView::mouseReleaseEvent().
void QgsComposition::addComposerPicture | ( | QgsComposerPicture * | picture | ) |
Adds picture to the graphics scene and advices composer to create a widget for it (through signal)
Definition at line 2178 of file qgscomposition.cpp.
References composerPictureAdded(), and updateBounds().
Referenced by addItemsFromXML(), and QgsComposerView::mouseReleaseEvent().
void QgsComposition::addComposerScaleBar | ( | QgsComposerScaleBar * | scaleBar | ) |
Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)
Definition at line 2158 of file qgscomposition.cpp.
References composerScaleBarAdded(), and updateBounds().
Referenced by addItemsFromXML(), and QgsComposerView::mousePressEvent().
void QgsComposition::addComposerShape | ( | QgsComposerShape * | shape | ) |
Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal)
Definition at line 2188 of file qgscomposition.cpp.
References composerShapeAdded(), and updateBounds().
Referenced by addItemsFromXML(), and QgsComposerView::addShape().
void QgsComposition::addComposerTable | ( | QgsComposerAttributeTable * | table | ) |
Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)
Definition at line 2198 of file qgscomposition.cpp.
References composerTableAdded(), and updateBounds().
Referenced by addItemsFromXML(), and QgsComposerView::mouseReleaseEvent().
void QgsComposition::addItemsFromXML | ( | const QDomElement & | elem, |
const QDomDocument & | doc, | ||
QMap< QgsComposerMap *, int > * | mapsToRestore = 0 , |
||
bool | addUndoCommands = false , |
||
QPointF * | pos = 0 , |
||
bool | pasteInPlace = false |
||
) |
Add items from XML representation to the graphics scene (for project file reading, pasting items from clipboard)
elem | items parent element, e.g.<Composer>or <ComposerItemClipboard> |
doc | xml document |
mapsToRestore | for reading from project file: set preview move 'rectangle' to all maps and save the preview states to show composer maps on demand |
addUndoCommands | insert AddItem commands if true (e.g. for copy/paste) |
pos | item position. Optional, take position from xml if 0 |
pasteInPlace | whether the position should be kept but mapped to the page origin. (the page is the page under to the mouse cursor) |
Definition at line 877 of file qgscomposition.cpp.
References addComposerArrow(), addComposerLabel(), addComposerLegend(), addComposerMap(), addComposerPicture(), addComposerScaleBar(), addComposerShape(), addComposerTable(), addMultiFrame(), QgsComposerMap::assignFreeId(), composerItems(), getComposerMapById(), minPointFromXml(), mItemZList, QgsComposerItem::move(), mPageHeight, mSpaceBetweenPages, pageNumberAt(), paperHeight(), QgsComposerMap::previewMode(), pushAddRemoveCommand(), QgsComposerHtml::readXML(), QgsComposerItemGroup::readXML(), QgsComposerShape::readXML(), QgsComposerAttributeTable::readXML(), QgsComposerArrow::readXML(), QgsComposerPicture::readXML(), QgsComposerLabel::readXML(), QgsComposerLegend::readXML(), QgsComposerScaleBar::readXML(), QgsComposerMap::readXML(), QgsComposerMap::Rectangle, refreshZList(), selectedItemChanged(), QgsComposerMultiFrame::setCreateUndoCommands(), QgsComposerItem::setItemPosition(), QgsComposerMap::setPreviewMode(), QgsComposerItem::setSelected(), QgsComposerMap::setUpdatesEnabled(), QgsComposerShape::setUseSymbolV2(), spaceBetweenPages(), and tr.
Referenced by loadFromTemplate(), and QgsComposerView::pasteItems().
void QgsComposition::addItemToZList | ( | QgsComposerItem * | item | ) |
Adds item to z list.
Usually called from constructor of QgsComposerItem
Definition at line 1209 of file qgscomposition.cpp.
References mItemZList.
Referenced by QgsComposerItem::init().
void QgsComposition::addMultiFrame | ( | QgsComposerMultiFrame * | multiFrame | ) |
Adds multiframe.
The object is owned by QgsComposition until removeMultiFrame is called
Definition at line 2104 of file qgscomposition.cpp.
References mMultiFrames, and updateBounds().
Referenced by addItemsFromXML(), QgsComposerMultiFrame::QgsComposerMultiFrame(), and QgsAddRemoveMultiFrameCommand::switchState().
|
private |
Definition at line 2395 of file qgscomposition.cpp.
References mPages, mSpaceBetweenPages, paperHeight(), paperWidth(), and QgsExpression::setSpecialColumn().
Referenced by init(), readXML(), and setNumPages().
QGraphicsLineItem * QgsComposition::addSnapLine | ( | ) |
Add a custom snap line (can be horizontal or vertical)
Definition at line 1767 of file qgscomposition.cpp.
References mGuidesVisible, and mSnapLines.
Referenced by QgsComposerRuler::mousePressEvent(), and readXML().
|
inline |
Definition at line 160 of file qgscomposition.h.
Referenced by QgsComposerMouseHandles::collectAlignCoordinates(), and QgsComposerMouseHandles::snapPoint().
|
inline |
Definition at line 187 of file qgscomposition.h.
Referenced by QgsComposerMouseHandles::alignPos().
void QgsComposition::alignSelectedItemsBottom | ( | ) |
Definition at line 1567 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), QgsProject::dirty(), QgsProject::instance(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), selectedComposerItems(), and tr.
void QgsComposition::alignSelectedItemsHCenter | ( | ) |
Definition at line 1450 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), QgsProject::dirty(), QgsProject::instance(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), selectedComposerItems(), and tr.
void QgsComposition::alignSelectedItemsLeft | ( | ) |
Definition at line 1420 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), QgsProject::dirty(), QgsProject::instance(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), selectedComposerItems(), and tr.
void QgsComposition::alignSelectedItemsRight | ( | ) |
Definition at line 1480 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), QgsProject::dirty(), QgsProject::instance(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), selectedComposerItems(), and tr.
void QgsComposition::alignSelectedItemsTop | ( | ) |
Definition at line 1510 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), QgsProject::dirty(), QgsProject::instance(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), selectedComposerItems(), and tr.
void QgsComposition::alignSelectedItemsVCenter | ( | ) |
Definition at line 1539 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), QgsProject::dirty(), QgsProject::instance(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), selectedComposerItems(), and tr.
|
inline |
Definition at line 448 of file qgscomposition.h.
Referenced by QgsComposerShape::drawShapeUsingSymbol(), QgsComposerPicture::evalPictureExpression(), QgsComposerPicture::init(), QgsPaperItem::initialize(), QgsComposerMap::layersToRender(), loadFromTemplate(), QgsPaperItem::paint(), QgsComposerAttributeTable::QgsComposerAttributeTable(), QgsComposerLabel::QgsComposerLabel(), QgsComposerShape::QgsComposerShape(), QgsComposerLabel::refreshExpressionContext(), and QgsComposerPicture::updatePictureExpression().
|
inline |
Returns the current atlas mode of the composition.
Definition at line 456 of file qgscomposition.h.
Referenced by QgsComposerMap::currentMapExtent(), QgsComposerShape::drawShapeUsingSymbol(), QgsComposerMap::layersToRender(), QgsPaperItem::paint(), QgsComposerLabel::QgsComposerLabel(), QgsComposerLabel::refreshExpressionContext(), QgsAtlasComposition::setHideCoverage(), QgsComposerMap::setNewScale(), QgsAtlasComposition::updateFeatures(), QgsAtlasComposition::updateFilenameExpression(), and QgsComposerMap::zoomContent().
void QgsComposition::beginCommand | ( | QgsComposerItem * | item, |
const QString & | commandText, | ||
QgsComposerMergeCommand::Context | c = QgsComposerMergeCommand::Unknown |
||
) |
Allocates new item command and saves initial state in it.
item | target item |
commandText | descriptive command text |
c | context for merge commands (unknown for non-mergeable commands) |
Definition at line 2035 of file qgscomposition.cpp.
References mActiveItemCommand, QgsComposerItemCommand::savePreviousState(), and QgsComposerMergeCommand::Unknown.
Referenced by QgsComposerItem::beginCommand(), and QgsComposerView::mouseReleaseEvent().
void QgsComposition::beginMultiFrameCommand | ( | QgsComposerMultiFrame * | multiFrame, |
const QString & | text | ||
) |
Definition at line 2079 of file qgscomposition.cpp.
References mActiveMultiFrameCommand, and QgsComposerMultiFrameCommand::savePreviousState().
Referenced by QgsComposerFrame::beginItemCommand(), and QgsComposerView::mouseReleaseEvent().
void QgsComposition::beginPrint | ( | QPrinter & | printer | ) |
Prepare the printer for printing.
Definition at line 2492 of file qgscomposition.cpp.
References printResolution().
Referenced by print().
void QgsComposition::beginPrintAsPDF | ( | QPrinter & | printer, |
const QString & | file | ||
) |
Prepare the printer for printing in a PDF.
Definition at line 2429 of file qgscomposition.cpp.
References QgsPaintEngineHack::fixEngineFlags(), paperHeight(), and paperWidth().
Referenced by exportAsPDF().
|
private |
Returns the bounding rectangle of the selected items in scene coordinates.
Definition at line 1906 of file qgscomposition.cpp.
References selectedComposerItems().
Referenced by alignSelectedItemsBottom(), alignSelectedItemsHCenter(), alignSelectedItemsLeft(), alignSelectedItemsRight(), alignSelectedItemsTop(), and alignSelectedItemsVCenter().
void QgsComposition::cancelCommand | ( | ) |
Deletes current command.
Definition at line 2073 of file qgscomposition.cpp.
References mActiveItemCommand.
Referenced by QgsComposerItem::cancelCommand().
void QgsComposition::clearSnapLines | ( | ) |
|
signal |
Is emitted when new composer arrow has been added to the view.
Referenced by addComposerArrow(), and sendItemAddedSignal().
|
signal |
Is emitted when a new composer html has been added to the view.
Referenced by addComposerHtmlFrame(), and sendItemAddedSignal().
QgsComposerItem * QgsComposition::composerItemAt | ( | const QPointF & | position | ) |
Returns the topmost composer item.
Ignores mPaperItem
Definition at line 377 of file qgscomposition.cpp.
Referenced by QgsComposerView::mousePressEvent(), and QgsComposerView::wheelEvent().
QgsComposerItem * QgsComposition::composerItemAt | ( | const QPointF & | position, |
const QgsComposerItem * | belowItem | ||
) |
Returns the highest composer item at a specified position which is below a specified item.
Ignores mPaperItem
Definition at line 382 of file qgscomposition.cpp.
void QgsComposition::composerItems | ( | QList< T * > & | itemList | ) |
Return composer items of a specific type.
Definition at line 623 of file qgscomposition.h.
Referenced by addItemsFromXML(), QgsAtlasComposition::composerMap(), QgsAtlasComposition::prepareForFeature(), QgsAtlasComposition::readXML(), setAtlasMode(), and QgsAtlasComposition::updateAtlasMaps().
|
signal |
Is emitted when new composer label has been added to the view.
Referenced by addComposerLabel(), and sendItemAddedSignal().
|
signal |
Is emitted when a new composer legend has been added.
Referenced by addComposerLegend(), and sendItemAddedSignal().
|
signal |
Is emitted when new composer map has been added to the view.
Referenced by addComposerMap(), and sendItemAddedSignal().
QList< const QgsComposerMap * > QgsComposition::composerMapItems | ( | ) | const |
Returns pointers to all composer maps in the scene.
Definition at line 444 of file qgscomposition.cpp.
Referenced by QgsComposerMap::assignFreeId(), QgsComposerView::mousePressEvent(), QgsComposerView::mouseReleaseEvent(), and QgsComposerMap::QgsComposerMap().
|
signal |
Is emitted when a new composer picture has been added.
Referenced by addComposerPicture(), and sendItemAddedSignal().
|
signal |
Is emitted when new composer scale bar has been added.
Referenced by addComposerScaleBar(), and sendItemAddedSignal().
|
signal |
Is emitted when a new composer shape has been added.
Referenced by addComposerShape(), and sendItemAddedSignal().
|
signal |
Is emitted when a new composer table has been added.
Referenced by addComposerTable(), and sendItemAddedSignal().
|
private |
Calculates the bounds of all non-gui items in the composition.
Ignores snap lines and mouse handles
Definition at line 196 of file qgscomposition.cpp.
References mPageWidth.
Referenced by updateBounds().
void QgsComposition::computeWorldFileParameters | ( | double & | a, |
double & | b, | ||
double & | c, | ||
double & | d, | ||
double & | e, | ||
double & | f | ||
) | const |
Compute world file parameters.
Definition at line 2581 of file qgscomposition.cpp.
References QgsRectangle::center(), QgsComposerMap::currentMapExtent(), QgsRectangle::height(), M_PI, QgsComposerMap::mapRotation(), mWorldFileMap, paperHeight(), paperWidth(), printResolution(), QgsRectangle::width(), QgsPoint::x(), QgsRectangle::xMinimum(), QgsPoint::y(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
|
private |
Definition at line 2300 of file qgscomposition.cpp.
References itemRemoved(), and sendItemAddedSignal().
Referenced by pushAddRemoveCommand(), and removeComposerItem().
|
private |
Definition at line 336 of file qgscomposition.cpp.
References QgsFillSymbolV2::createSimple(), and mPageStyleSymbol.
Referenced by init().
|
private |
Definition at line 2419 of file qgscomposition.cpp.
References mMultiFrames.
Referenced by loadFromTemplate(), and ~QgsComposition().
void QgsComposition::doPrint | ( | QPrinter & | printer, |
QPainter & | painter | ||
) |
Print on a preconfigured printer.
Definition at line 2455 of file qgscomposition.cpp.
References mPrintAsRaster, numPages(), printPageAsRaster(), and renderPage().
Referenced by print().
|
staticprivate |
Definition at line 2570 of file qgscomposition.cpp.
Referenced by loadFromTemplate().
void QgsComposition::endCommand | ( | ) |
Saves end state of item and pushes command to the undo history.
Definition at line 2055 of file qgscomposition.cpp.
References QgsComposerItemCommand::containsChange(), QgsProject::dirty(), QgsProject::instance(), mActiveItemCommand, mUndoStack, and QgsComposerItemCommand::saveAfterState().
Referenced by QgsComposerItem::endCommand(), and QgsComposerView::mouseReleaseEvent().
void QgsComposition::endMultiFrameCommand | ( | ) |
Definition at line 2086 of file qgscomposition.cpp.
References QgsComposerMultiFrameCommand::containsChange(), QgsProject::dirty(), QgsProject::instance(), mActiveMultiFrameCommand, mUndoStack, and QgsComposerMultiFrameCommand::saveAfterState().
Referenced by QgsComposerFrame::endItemCommand(), and QgsComposerView::mouseReleaseEvent().
bool QgsComposition::exportAsPDF | ( | const QString & | file | ) |
Convenience function that prepares the printer for printing in PDF and prints.
Definition at line 2448 of file qgscomposition.cpp.
References beginPrintAsPDF(), and print().
|
inline |
Definition at line 251 of file qgscomposition.h.
const QgsComposerHtml * QgsComposition::getComposerHtmlByItem | ( | QgsComposerItem * | item | ) | const |
Returns the composer html with specified id (a string as named in the composer user interface item properties).
item | the item. |
Definition at line 480 of file qgscomposition.cpp.
References QgsComposerFrame::multiFrame().
QgsComposerItem * QgsComposition::getComposerItemAbove | ( | QgsComposerItem * | item | ) |
Definition at line 1264 of file qgscomposition.cpp.
References mItemZList.
Referenced by selectNextByZOrder().
QgsComposerItem * QgsComposition::getComposerItemBelow | ( | QgsComposerItem * | item | ) |
Definition at line 1279 of file qgscomposition.cpp.
References mItemZList.
Referenced by selectNextByZOrder().
const QgsComposerItem * QgsComposition::getComposerItemById | ( | QString | theId | ) | const |
Returns a composer item given its text identifier.
Ids are not necessarely unique, but this function returns only one element.
theId | - A QString representing the identifier of the item to retrieve. |
Definition at line 499 of file qgscomposition.cpp.
References QgsComposerItem::id().
const QgsComposerItem * QgsComposition::getComposerItemByUuid | ( | QString | theUuid | ) | const |
Returns a composer item given its unique identifier.
theUuid | A QString representing the UUID of the item to |
Definition at line 554 of file qgscomposition.cpp.
References QgsComposerItem::uuid().
const QgsComposerMap * QgsComposition::getComposerMapById | ( | int | id | ) | const |
Returns the composer map with specified id.
Definition at line 462 of file qgscomposition.cpp.
References QgsComposerMap::id().
Referenced by addItemsFromXML(), QgsComposerMap::assignFreeId(), QgsComposerMap::drawOverviewMapExtent(), QgsComposerMap::overviewExtentChanged(), QgsComposerAttributeTable::readXML(), QgsComposerPicture::readXML(), QgsComposerLegend::readXML(), QgsComposerScaleBar::readXML(), QgsComposerMap::setOverviewFrameMap(), and QgsComposerPicture::setRotationMap().
|
inline |
Definition at line 181 of file qgscomposition.h.
Referenced by QgsPaperGrid::paint().
|
inline |
Definition at line 184 of file qgscomposition.h.
Referenced by QgsPaperGrid::paint().
|
inline |
Definition at line 153 of file qgscomposition.h.
Referenced by QgsPaperGrid::paint().
|
protected |
Definition at line 71 of file qgscomposition.cpp.
References addPaperItem(), AtlasOff, createDefaultPageStyleSymbol(), loadDefaults(), loadSettings(), mActiveItemCommand, mActiveMultiFrameCommand, mAlignmentSnap, mAlignmentSnapTolerance, mAtlasMode, mGenerateWorldFile, mGridVisible, mGuidesVisible, mPageHeight, mPageStyleSymbol, mPageWidth, mPlotStyle, mPreventCursorChange, mPrintAsRaster, mPrintResolution, mSelectionHandles, mSmartGuides, mSnapGridOffsetX, mSnapGridOffsetY, mSnapGridResolution, mSnapGridTolerance, mSnapToGrid, mSpaceBetweenPages, mUseAdvancedEffects, mWorldFileMap, Preview, and updateBounds().
Referenced by QgsComposition().
int QgsComposition::itemPageNumber | ( | const QgsComposerItem * | item | ) | const |
Returns on which page number (0-based) is displayed an item.
Definition at line 420 of file qgscomposition.cpp.
References pageNumberAt().
Referenced by QgsComposerLabel::displayText().
|
signal |
Is emitted when a composer item has been removed from the scene.
Referenced by connectAddRemoveCommandSignals(), loadFromTemplate(), and removeComposerItem().
|
private |
Loads default composer settings.
Definition at line 169 of file qgscomposition.cpp.
References mAlignmentSnapTolerance, mSnapGridOffsetX, mSnapGridOffsetY, mSnapGridResolution, and mSnapGridTolerance.
Referenced by init().
bool QgsComposition::loadFromTemplate | ( | const QDomDocument & | doc, |
QMap< QString, QString > * | substitutionMap = 0 , |
||
bool | addUndoCommands = false |
||
) |
Load a template document.
doc | template document |
substitutionMap | map with text to replace. Text needs to be enclosed by brackets (e.g. '[text]' ) |
addUndoCommands | whether or not to add undo commands |
Definition at line 770 of file qgscomposition.cpp.
References addItemsFromXML(), atlasComposition(), deleteAndRemoveMultiFrames(), encodeStringForXML(), itemRemoved(), mItemZList, mPages, mUndoStack, QgsAtlasComposition::readXML(), and readXML().
|
private |
Loads composer settings which may change, eg grid color.
Definition at line 2003 of file qgscomposition.cpp.
References Crosses, Dots, mGridPen, mGridStyle, and Solid.
Referenced by init(), and updateSettings().
void QgsComposition::lockSelectedItems | ( | ) |
Lock the selected items.
Definition at line 1595 of file qgscomposition.cpp.
References QgsProject::dirty(), QgsProject::instance(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), selectedComposerItems(), and tr.
void QgsComposition::lowerItem | ( | QgsComposerItem * | item | ) |
Definition at line 1347 of file qgscomposition.cpp.
References mItemZList.
Referenced by lowerSelectedItems().
void QgsComposition::lowerSelectedItems | ( | ) |
Definition at line 1333 of file qgscomposition.cpp.
References lowerItem(), selectedComposerItems(), and updateZValues().
|
inline |
Returns pointer to map renderer of qgis map canvas.
Definition at line 266 of file qgscomposition.h.
Referenced by QgsComposerMap::mapRenderer().
|
inline |
Return setting of QGIS map canvas.
Definition at line 270 of file qgscomposition.h.
Referenced by QgsComposerMap::composerMapPosForItem(), QgsAtlasComposition::computeExtent(), QgsComposerMap::containsAdvancedEffects(), QgsComposerMap::containsWMSLayer(), QgsComposerMap::draw(), QgsComposerMap::drawGrid(), QgsComposerMap::drawOverviewMapExtent(), QgsComposerShape::drawShapeUsingSymbol(), QgsComposerAttributeTable::getFeatureAttributes(), QgsComposerMap::initGridAnnotationFormatFromProject(), QgsComposerLegend::layerIdList(), QgsComposerMap::layersToRender(), QgsComposerScaleBar::mapWidth(), QgsPaperItem::paint(), QgsComposerMap::QgsComposerMap(), QgsComposerMap::scale(), QgsComposerMap::setNewScale(), QgsComposerMap::storeCurrentLayerSet(), QgsComposerMap::syncLayerSet(), and QgsComposerMap::zoomContent().
|
private |
Calculates the item minimum position from an xml string.
Definition at line 848 of file qgscomposition.cpp.
References MathUtils::max().
Referenced by addItemsFromXML().
void QgsComposition::moveItemToBottom | ( | QgsComposerItem * | item | ) |
Definition at line 1409 of file qgscomposition.cpp.
References mItemZList.
Referenced by moveSelectedItemsToBottom().
void QgsComposition::moveItemToTop | ( | QgsComposerItem * | item | ) |
Definition at line 1384 of file qgscomposition.cpp.
References mItemZList.
Referenced by moveSelectedItemsToTop().
void QgsComposition::moveSelectedItemsToBottom | ( | ) |
Definition at line 1395 of file qgscomposition.cpp.
References moveItemToBottom(), selectedComposerItems(), and updateZValues().
void QgsComposition::moveSelectedItemsToTop | ( | ) |
Definition at line 1369 of file qgscomposition.cpp.
References moveItemToTop(), selectedComposerItems(), and updateZValues().
QGraphicsLineItem * QgsComposition::nearestSnapLine | ( | bool | horizontal, |
double | x, | ||
double | y, | ||
double | tolerance, | ||
QList< QPair< QgsComposerItem *, QgsComposerItem::ItemPositionMode > > & | snappedItems | ||
) |
Get nearest snap line.
Definition at line 1818 of file qgscomposition.cpp.
References QgsComposerItem::ComposerPaper, QgsComposerItem::LowerMiddle, QgsComposerItem::Middle, QgsComposerItem::MiddleLeft, QgsComposerItem::MiddleRight, mSnapLines, qgsDoubleNear(), QgsComposerItem::type(), and QgsComposerItem::UpperMiddle.
Referenced by QgsComposerRuler::mousePressEvent().
|
signal |
Referenced by setNumPages().
int QgsComposition::numPages | ( | ) | const |
Note: added in version 1.9.
Definition at line 324 of file qgscomposition.cpp.
References mPages.
Referenced by QgsAtlasComposition::beginRender(), doPrint(), QgsComposerMultiFrame::handlePageChange(), QgsComposerRuler::paintEvent(), readXML(), QgsComposerMultiFrame::recalculateFrameSizes(), setNumPages(), setPaperSize(), QgsComposerRuler::setSnapLinePosition(), and QgsComposerMouseHandles::snapPoint().
int QgsComposition::pageNumberAt | ( | const QPointF & | position | ) | const |
Returns the page number (0-bsaed) given a coordinate.
Definition at line 415 of file qgscomposition.cpp.
References paperHeight(), and spaceBetweenPages().
Referenced by addItemsFromXML(), and itemPageNumber().
int QgsComposition::pageNumberForPoint | ( | const QPointF & | position | ) | const |
Returns the page number corresponding to a point in the composition.
Definition at line 364 of file qgscomposition.cpp.
References mPages, paperHeight(), and spaceBetweenPages().
Referenced by setPaperSize().
|
inline |
Return pages in the correct order.
Definition at line 463 of file qgscomposition.h.
|
inline |
Note: added in version 2.1.
Definition at line 128 of file qgscomposition.h.
Referenced by QgsPaperItem::calculatePageMargin(), and QgsPaperItem::paint().
double QgsComposition::paperHeight | ( | ) | const |
Returns height of paper item.
Definition at line 270 of file qgscomposition.cpp.
References mPageHeight.
Referenced by QgsComposerItem::_readXML(), addItemsFromXML(), addPaperItem(), beginPrintAsPDF(), computeWorldFileParameters(), QgsComposerMultiFrame::handlePageChange(), QgsComposerItem::page(), pageNumberAt(), pageNumberForPoint(), QgsComposerItem::pagePos(), QgsComposerRuler::paintEvent(), positionOnPage(), printPageAsRaster(), QgsComposerMultiFrame::recalculateFrameSizes(), QgsComposerItem::setItemPosition(), QgsComposerRuler::setSnapLinePosition(), and QgsComposerMouseHandles::snapPoint().
|
signal |
Referenced by readXML(), and setPaperSize().
double QgsComposition::paperWidth | ( | ) | const |
Returns width of paper item.
Definition at line 275 of file qgscomposition.cpp.
References mPageWidth.
Referenced by addPaperItem(), beginPrintAsPDF(), computeWorldFileParameters(), printPageAsRaster(), QgsComposerRuler::setSnapLinePosition(), and QgsComposerMouseHandles::snapPoint().
int QgsComposition::pixelFontSize | ( | double | pointSize | ) | const |
Returns the pixel font size for a font that has point size set.
The result depends on the resolution (dpi) and of the preview mode. Each item that sets a font should call this function before drawing text
Definition at line 597 of file qgscomposition.cpp.
|
inline |
Definition at line 272 of file qgscomposition.h.
Referenced by QgsComposerMap::draw(), QgsComposerItemGroup::drawFrame(), QgsComposerMap::drawOverviewMapExtent(), QgsComposerItem::drawSelectionBoxes(), QgsComposerArrow::drawSVGMarker(), QgsPaperGrid::paint(), QgsComposerLabel::paint(), QgsPaperItem::paint(), QgsComposerTable::paint(), QgsComposerMouseHandles::paint(), and QgsComposerMap::paint().
double QgsComposition::pointFontSize | ( | int | pixelSize | ) | const |
Does the inverse calculation and returns points for pixels (equals to mm in QgsComposition)
Definition at line 604 of file qgscomposition.cpp.
QPointF QgsComposition::positionOnPage | ( | const QPointF & | position | ) | const |
Returns the position within a page of a point in the composition.
Definition at line 347 of file qgscomposition.cpp.
References mPages, paperHeight(), and spaceBetweenPages().
Referenced by setPaperSize().
|
inline |
Definition at line 416 of file qgscomposition.h.
Referenced by QgsComposerMouseHandles::setViewportCursor().
bool QgsComposition::print | ( | QPrinter & | printer | ) |
Convenience function that prepares the printer and prints.
Definition at line 2502 of file qgscomposition.cpp.
References beginPrint(), and doPrint().
Referenced by exportAsPDF().
|
inline |
Definition at line 248 of file qgscomposition.h.
QImage QgsComposition::printPageAsRaster | ( | int | page | ) |
print composer page to image If the image does not fit into memory, a null image is returned
Definition at line 2517 of file qgscomposition.cpp.
References paperHeight(), paperWidth(), printResolution(), and renderPage().
Referenced by doPrint().
|
inline |
Definition at line 245 of file qgscomposition.h.
Referenced by beginPrint(), QgsPaperItem::calculatePageMargin(), QgsComposerPicture::clippedImageRect(), computeWorldFileParameters(), QgsComposerHtml::htmlUnitsToMM(), QgsComposerLabel::htmlUnitsToMM(), QgsComposerPicture::paint(), printPageAsRaster(), and QgsComposerPicture::setSceneRect().
|
signal |
Is emitted when the compositions print resolution changes.
Referenced by setPrintResolution().
void QgsComposition::pushAddRemoveCommand | ( | QgsComposerItem * | item, |
const QString & | text, | ||
QgsAddRemoveItemCommand::State | state = QgsAddRemoveItemCommand::Added |
||
) |
Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack.
Definition at line 2292 of file qgscomposition.cpp.
References connectAddRemoveCommandSignals(), QgsProject::dirty(), QgsProject::instance(), and undoStack().
Referenced by addItemsFromXML(), QgsComposerView::addShape(), QgsComposerView::mousePressEvent(), QgsComposerView::mouseReleaseEvent(), and removeComposerItem().
void QgsComposition::raiseItem | ( | QgsComposerItem * | item | ) |
Definition at line 1242 of file qgscomposition.cpp.
References mItemZList.
Referenced by raiseSelectedItems().
void QgsComposition::raiseSelectedItems | ( | ) |
Definition at line 1228 of file qgscomposition.cpp.
References raiseItem(), selectedComposerItems(), and updateZValues().
bool QgsComposition::readXML | ( | const QDomElement & | compositionElem, |
const QDomDocument & | doc | ||
) |
Reads settings from xml file.
Definition at line 700 of file qgscomposition.cpp.
References addPaperItem(), addSnapLine(), QgsSymbolLayerV2Utils::loadSymbol(), mAlignmentSnap, mAlignmentSnapTolerance, mGenerateWorldFile, mGridVisible, mGuidesVisible, mPageHeight, mPageStyleSymbol, mPageWidth, mPrintAsRaster, mPrintResolution, mSmartGuides, mSnapGridOffsetX, mSnapGridOffsetY, mSnapGridResolution, mSnapGridTolerance, mSnapToGrid, numPages(), paperSizeChanged(), removePaperItems(), updateBounds(), and updatePaperItems().
Referenced by loadFromTemplate().
|
slot |
Forces items in the composition to refresh.
For instance, this causes maps to redraw and rebuild cached images, html items to reload their source url, and attribute tables to refresh their contents.
Definition at line 184 of file qgscomposition.cpp.
References refreshItemsTriggered().
|
signal |
Is emitted when item in the composition must be refreshed.
Referenced by refreshItems().
void QgsComposition::refreshZList | ( | ) |
Rebuilds the z order list based on current order of items in scene.
Definition at line 1705 of file qgscomposition.cpp.
References QgsComposerItem::ComposerFrame, QgsComposerItem::ComposerPaper, mItemZList, QgsComposerItem::type(), and updateZValues().
Referenced by addItemsFromXML().
|
static |
Returns a scaled position given a before and after range.
Definition at line 2689 of file qgscomposition.cpp.
Referenced by relativeResizeRect().
|
static |
Resizes a QRectF relative to the change from boundsBefore to boundsAfter.
Definition at line 2678 of file qgscomposition.cpp.
References relativePosition().
Referenced by QgsComposerMouseHandles::drawSelectedItemBounds(), QgsComposerMouseHandles::mouseReleaseEvent(), and QgsComposerItemGroup::setSceneRect().
void QgsComposition::removeComposerItem | ( | QgsComposerItem * | item, |
bool | createCommand = true |
||
) |
Remove item from the graphics scene.
Additionally to QGraphicsScene::removeItem, this function considers undo/redo command
Definition at line 2218 of file qgscomposition.cpp.
References QgsComposerItem::beginItemCommand(), QgsComposerItem::ComposerFrame, connectAddRemoveCommandSignals(), QgsComposerItem::endItemCommand(), QgsComposerMultiFrame::frameCount(), QgsComposerMap::isDrawing(), itemRemoved(), QgsComposerItemGroup::items(), pushAddRemoveCommand(), QgsAddRemoveMultiFrameCommand::Removed, QgsAddRemoveItemCommand::Removed, removeMultiFrame(), tr, QgsComposerItem::type(), undoStack(), and updateBounds().
Referenced by QgsComposerView::copyItems(), QgsComposerMultiFrame::deleteFrames(), QgsComposerView::deleteSelectedItems(), and QgsComposerMultiFrame::removeFrame().
void QgsComposition::removeItemFromZList | ( | QgsComposerItem * | item | ) |
Removes item from z list.
Usually called from destructor of QgsComposerItem
Definition at line 1219 of file qgscomposition.cpp.
References mItemZList.
Referenced by QgsComposerItem::~QgsComposerItem().
void QgsComposition::removeMultiFrame | ( | QgsComposerMultiFrame * | multiFrame | ) |
Removes multi frame (but does not delete it)
Definition at line 2111 of file qgscomposition.cpp.
References mMultiFrames, and updateBounds().
Referenced by removeComposerItem(), and QgsAddRemoveMultiFrameCommand::switchState().
|
private |
Definition at line 2409 of file qgscomposition.cpp.
References mPages, and QgsExpression::setSpecialColumn().
Referenced by readXML(), and ~QgsComposition().
void QgsComposition::removeSnapLine | ( | QGraphicsLineItem * | line | ) |
Remove custom snap line (and delete the object)
Definition at line 1783 of file qgscomposition.cpp.
References mSnapLines.
Referenced by QgsComposerRuler::mouseReleaseEvent().
void QgsComposition::renderPage | ( | QPainter * | p, |
int | page | ||
) |
Render a page to a paint device.
Definition at line 2535 of file qgscomposition.cpp.
References mPages, mPlotStyle, Print, and setSnapLinesVisible().
Referenced by doPrint(), and printPageAsRaster().
QList< QgsComposerItem * > QgsComposition::selectedComposerItems | ( | ) |
Definition at line 425 of file qgscomposition.cpp.
Referenced by alignSelectedItemsBottom(), alignSelectedItemsHCenter(), alignSelectedItemsLeft(), alignSelectedItemsRight(), alignSelectedItemsTop(), alignSelectedItemsVCenter(), boundingRectOfSelectedItems(), QgsComposerView::copyItems(), QgsComposerView::deleteSelectedItems(), QgsComposerMouseHandles::drawSelectedItemBounds(), QgsComposerView::endMarqueeSelect(), QgsComposerView::groupItems(), QgsComposerView::keyPressEvent(), lockSelectedItems(), lowerSelectedItems(), QgsComposerView::mousePressEvent(), QgsComposerMouseHandles::mouseReleaseEvent(), moveSelectedItemsToBottom(), moveSelectedItemsToTop(), raiseSelectedItems(), QgsComposerMouseHandles::resetStatusBar(), QgsComposerMouseHandles::selectionBounds(), QgsComposerMouseHandles::selectionRotation(), selectNextByZOrder(), QgsComposerView::ungroupItems(), and QgsComposerMouseHandles::updateHandles().
|
signal |
Is emitted when selected item changed.
If 0, no item is selected
Referenced by addItemsFromXML(), selectNextByZOrder(), sendItemAddedSignal(), setSelectedItem(), and unlockAllItems().
|
inline |
Returns pointer to selection handles.
Definition at line 358 of file qgscomposition.h.
Referenced by QgsComposerView::mousePressEvent(), and QgsComposerView::mouseReleaseEvent().
void QgsComposition::selectNextByZOrder | ( | ZValueDirection | direction | ) |
Definition at line 1296 of file qgscomposition.cpp.
References getComposerItemAbove(), getComposerItemBelow(), selectedComposerItems(), selectedItemChanged(), QgsComposerItem::setSelected(), ZValueAbove, and ZValueBelow.
|
slot |
Casts object to the proper subclass type and calls corresponding itemAdded signal.
Definition at line 2311 of file qgscomposition.cpp.
References composerArrowAdded(), composerHtmlFrameAdded(), composerLabelAdded(), composerLegendAdded(), composerMapAdded(), composerPictureAdded(), composerScaleBarAdded(), composerShapeAdded(), composerTableAdded(), QgsComposerFrame::multiFrame(), selectedItemChanged(), and QgsComposerItem::setSelected().
Referenced by connectAddRemoveCommandSignals().
|
inline |
Definition at line 159 of file qgscomposition.h.
|
inline |
Definition at line 186 of file qgscomposition.h.
bool QgsComposition::setAtlasMode | ( | QgsComposition::AtlasMode | mode | ) |
Sets the current atlas mode of the composition.
Returns false if the mode could not be changed.
Definition at line 2643 of file qgscomposition.cpp.
References QgsComposerMap::atlasDriven(), AtlasOff, QgsAtlasComposition::beginRender(), composerItems(), QgsAtlasComposition::endRender(), mAtlasComposition, mAtlasMode, and QgsComposerMap::toggleAtlasPreview().
Referenced by QgsAtlasComposition::setEnabled().
|
inline |
Definition at line 252 of file qgscomposition.h.
void QgsComposition::setGridPen | ( | const QPen & | p | ) |
Definition at line 1981 of file qgscomposition.cpp.
References mGridPen, and updatePaperItems().
void QgsComposition::setGridStyle | ( | GridStyle | s | ) |
Definition at line 1989 of file qgscomposition.cpp.
References mGridStyle, and updatePaperItems().
void QgsComposition::setGridVisible | ( | bool | b | ) |
Definition at line 1952 of file qgscomposition.cpp.
References mGridVisible, and updatePaperItems().
void QgsComposition::setNumPages | ( | int | pages | ) |
Note: added in version 1.9.
Definition at line 280 of file qgscomposition.cpp.
References addPaperItem(), QgsProject::dirty(), QgsProject::instance(), mPageHeight, mPages, nPagesChanged(), numPages(), QgsExpression::setSpecialColumn(), snapLines(), spaceBetweenPages(), and updateBounds().
Referenced by QgsComposerMultiFrame::recalculateFrameSizes().
void QgsComposition::setPageStyleSymbol | ( | QgsFillSymbolV2 * | symbol | ) |
Note: added in version 2.1.
Definition at line 329 of file qgscomposition.cpp.
References QgsProject::dirty(), QgsProject::instance(), and mPageStyleSymbol.
void QgsComposition::setPaperSize | ( | double | width, |
double | height | ||
) |
Changes size of paper item.
Also moves all items so that they retain their same relative position to the top left corner of their current page.
Definition at line 221 of file qgscomposition.cpp.
References QgsProject::dirty(), QgsProject::instance(), mPageHeight, mPages, mPageWidth, mSpaceBetweenPages, numPages(), pageNumberForPoint(), paperSizeChanged(), positionOnPage(), snapLines(), spaceBetweenPages(), updateBounds(), and QgsComposerItem::updatePagePos().
|
inline |
Definition at line 273 of file qgscomposition.h.
|
inline |
If true, prevents any mouse cursor changes by the composition or by any composer items Used by QgsComposer and QgsComposerView to prevent unwanted cursor changes.
Definition at line 415 of file qgscomposition.h.
Referenced by QgsComposerView::keyPressEvent(), QgsComposerView::keyReleaseEvent(), QgsComposerView::mousePressEvent(), QgsComposerView::mouseReleaseEvent(), and QgsComposerView::setCurrentTool().
|
inline |
Definition at line 249 of file qgscomposition.h.
void QgsComposition::setPrintResolution | ( | int | dpi | ) |
Definition at line 573 of file qgscomposition.cpp.
References QgsProject::dirty(), QgsProject::instance(), mPrintResolution, and printResolutionChanged().
|
slot |
Clears any selected items and sets an item as the current selection.
item | item to set as selected |
Definition at line 189 of file qgscomposition.cpp.
References selectedItemChanged(), and QgsComposerItem::setSelected().
|
inline |
Definition at line 162 of file qgscomposition.h.
void QgsComposition::setSnapGridOffsetX | ( | double | offset | ) |
Definition at line 1969 of file qgscomposition.cpp.
References mSnapGridOffsetX, and updatePaperItems().
void QgsComposition::setSnapGridOffsetY | ( | double | offset | ) |
Definition at line 1975 of file qgscomposition.cpp.
References mSnapGridOffsetY, and updatePaperItems().
void QgsComposition::setSnapGridResolution | ( | double | r | ) |
Definition at line 1958 of file qgscomposition.cpp.
References mSnapGridResolution, and updatePaperItems().
void QgsComposition::setSnapGridTolerance | ( | double | tolerance | ) |
Definition at line 1964 of file qgscomposition.cpp.
References mSnapGridTolerance.
void QgsComposition::setSnapLinesVisible | ( | bool | visible | ) |
Hides / shows custom snap lines.
Definition at line 1801 of file qgscomposition.cpp.
References mGuidesVisible, and mSnapLines.
Referenced by renderPage().
void QgsComposition::setSnapToGridEnabled | ( | bool | b | ) |
Definition at line 1946 of file qgscomposition.cpp.
References mSnapToGrid, and updatePaperItems().
void QgsComposition::setStatusMessage | ( | const QString & | message | ) |
Sets the status bar message for the composer window.
Definition at line 372 of file qgscomposition.cpp.
References statusMsgChanged().
Referenced by QgsComposerMouseHandles::dragMouseMove(), QgsComposerMouseHandles::resetStatusBar(), and QgsComposerMouseHandles::resizeMouseMove().
void QgsComposition::setUseAdvancedEffects | ( | bool | effectsEnabled | ) |
Used to enable or disable advanced effects such as blend modes in a composition.
Definition at line 580 of file qgscomposition.cpp.
References mUseAdvancedEffects, and QgsComposerItem::setEffectsEnabled().
|
inline |
Definition at line 255 of file qgscomposition.h.
|
inline |
Definition at line 163 of file qgscomposition.h.
Referenced by QgsComposerMouseHandles::collectAlignCoordinates(), and QgsComposerMouseHandles::snapPoint().
|
inline |
Definition at line 175 of file qgscomposition.h.
Referenced by QgsPaperGrid::paint().
|
inline |
Definition at line 178 of file qgscomposition.h.
Referenced by QgsPaperGrid::paint().
|
inline |
Definition at line 169 of file qgscomposition.h.
Referenced by QgsPaperGrid::paint().
|
inline |
Definition at line 172 of file qgscomposition.h.
|
inline |
Returns pointer to snap lines collection.
Definition at line 353 of file qgscomposition.h.
Referenced by QgsComposerMouseHandles::collectAlignCoordinates(), setNumPages(), and setPaperSize().
|
inline |
Definition at line 157 of file qgscomposition.h.
QPointF QgsComposition::snapPointToGrid | ( | const QPointF & | scenePoint | ) | const |
Snaps a scene coordinate point to grid.
Definition at line 1734 of file qgscomposition.cpp.
References mPageHeight, mSnapGridOffsetX, mSnapGridOffsetY, mSnapGridResolution, mSnapGridTolerance, mSnapToGrid, and mSpaceBetweenPages.
Referenced by QgsComposerView::mousePressEvent(), QgsComposerView::mouseReleaseEvent(), and QgsComposerMouseHandles::snapPoint().
|
inline |
Definition at line 150 of file qgscomposition.h.
void QgsComposition::sortZList | ( | ) |
Sorts the zList.
The only time where this function needs to be called is from QgsComposer after reading all the items from xml file
Definition at line 1679 of file qgscomposition.cpp.
References mItemZList.
|
inline |
Definition at line 118 of file qgscomposition.h.
Referenced by QgsComposerItem::_readXML(), addItemsFromXML(), QgsComposerMultiFrame::handlePageChange(), QgsComposerItem::page(), pageNumberAt(), pageNumberForPoint(), QgsComposerItem::pagePos(), QgsComposerRuler::paintEvent(), positionOnPage(), QgsComposerMultiFrame::recalculateFrameSizes(), QgsComposerItem::setItemPosition(), setNumPages(), setPaperSize(), QgsComposerRuler::setSnapLinePosition(), and QgsComposerMouseHandles::snapPoint().
|
signal |
Is emitted when the composition has an updated status bar message for the composer window.
Referenced by setStatusMessage().
|
inline |
Returns pointer to undo/redo command storage.
Definition at line 190 of file qgscomposition.h.
Referenced by QgsComposerMouseHandles::mouseReleaseEvent(), QgsComposerView::mouseReleaseEvent(), pushAddRemoveCommand(), and removeComposerItem().
void QgsComposition::unlockAllItems | ( | ) |
Unlock all items.
Definition at line 1613 of file qgscomposition.cpp.
References QgsProject::dirty(), QgsProject::instance(), mUndoStack, QgsComposerItem::positionLock(), QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), selectedItemChanged(), QgsComposerItem::setPositionLock(), QgsComposerItem::setSelected(), and tr.
|
slot |
Updates the scene bounds of the composition.
Definition at line 179 of file qgscomposition.cpp.
References compositionBounds().
Referenced by addComposerArrow(), addComposerHtmlFrame(), addComposerLabel(), addComposerLegend(), addComposerMap(), addComposerPicture(), addComposerScaleBar(), addComposerShape(), addComposerTable(), addMultiFrame(), init(), readXML(), removeComposerItem(), removeMultiFrame(), setNumPages(), and setPaperSize().
|
private |
Definition at line 2386 of file qgscomposition.cpp.
References mPages.
Referenced by readXML(), setGridPen(), setGridStyle(), setGridVisible(), setSnapGridOffsetX(), setSnapGridOffsetY(), setSnapGridResolution(), setSnapToGridEnabled(), and updateSettings().
void QgsComposition::updateSettings | ( | ) |
Refreshes the composition when composer related options change Note: added in version 2.1.
Definition at line 1995 of file qgscomposition.cpp.
References loadSettings(), and updatePaperItems().
|
private |
Reset z-values of items based on position in z list.
Definition at line 1642 of file qgscomposition.cpp.
References QgsProject::dirty(), QgsProject::instance(), mItemZList, mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), and tr.
Referenced by lowerSelectedItems(), moveSelectedItemsToBottom(), moveSelectedItemsToTop(), raiseSelectedItems(), and refreshZList().
|
inline |
Returns true if a composition should use advanced effects such as blend modes.
Definition at line 259 of file qgscomposition.h.
Referenced by QgsComposerMap::draw(), and QgsComposerLegend::drawSymbolV2().
|
inline |
Definition at line 254 of file qgscomposition.h.
bool QgsComposition::writeXML | ( | QDomElement & | composerElem, |
QDomDocument & | doc | ||
) |
Writes settings to xml (paper dimension)
Definition at line 610 of file qgscomposition.cpp.
References QgsComposerItem::ComposerFrame, QgsComposerItem::ComposerPaper, QgsComposerMap::id(), mAlignmentSnap, mAlignmentSnapTolerance, mGenerateWorldFile, mGridVisible, mGuidesVisible, mMultiFrames, mPageHeight, mPages, mPageStyleSymbol, mPageWidth, mPrintAsRaster, mPrintResolution, mSmartGuides, mSnapGridOffsetX, mSnapGridOffsetY, mSnapGridResolution, mSnapGridTolerance, mSnapLines, mSnapToGrid, mWorldFileMap, QgsSymbolLayerV2Utils::saveSymbol(), QgsComposerItem::type(), and QgsComposerItem::writeXML().
|
private |
Definition at line 546 of file qgscomposition.h.
Referenced by beginCommand(), cancelCommand(), endCommand(), init(), and ~QgsComposition().
|
private |
Definition at line 547 of file qgscomposition.h.
Referenced by beginMultiFrameCommand(), endMultiFrameCommand(), init(), and ~QgsComposition().
|
private |
Parameters for alignment snap.
Definition at line 534 of file qgscomposition.h.
Referenced by init(), readXML(), and writeXML().
|
private |
Definition at line 537 of file qgscomposition.h.
Referenced by init(), loadDefaults(), readXML(), and writeXML().
|
private |
The atlas composition object.
It is held by the QgsComposition
Definition at line 550 of file qgscomposition.h.
Referenced by setAtlasMode().
|
private |
Definition at line 552 of file qgscomposition.h.
Referenced by init(), and setAtlasMode().
|
private |
Flag if a world file should be generated on raster export.
Definition at line 516 of file qgscomposition.h.
Referenced by init(), readXML(), and writeXML().
|
private |
Definition at line 530 of file qgscomposition.h.
Referenced by loadSettings(), and setGridPen().
|
private |
Definition at line 531 of file qgscomposition.h.
Referenced by loadSettings(), and setGridStyle().
|
private |
Definition at line 525 of file qgscomposition.h.
Referenced by init(), readXML(), setGridVisible(), and writeXML().
|
private |
Definition at line 535 of file qgscomposition.h.
Referenced by addSnapLine(), init(), readXML(), setSnapLinesVisible(), and writeXML().
|
private |
Maintains z-Order of items.
Starts with item at position 1 (position 0 is always paper item)
Definition at line 504 of file qgscomposition.h.
Referenced by addItemsFromXML(), addItemToZList(), getComposerItemAbove(), getComposerItemBelow(), loadFromTemplate(), lowerItem(), moveItemToBottom(), moveItemToTop(), raiseItem(), refreshZList(), removeItemFromZList(), sortZList(), and updateZValues().
|
private |
Pointer to map renderer of QGIS main map.
Definition at line 490 of file qgscomposition.h.
|
private |
Definition at line 491 of file qgscomposition.h.
|
private |
List multiframe objects.
Definition at line 507 of file qgscomposition.h.
Referenced by addMultiFrame(), deleteAndRemoveMultiFrames(), removeMultiFrame(), and writeXML().
|
private |
Definition at line 495 of file qgscomposition.h.
Referenced by addItemsFromXML(), init(), paperHeight(), readXML(), setNumPages(), setPaperSize(), snapPointToGrid(), and writeXML().
|
private |
Definition at line 496 of file qgscomposition.h.
Referenced by addPaperItem(), loadFromTemplate(), numPages(), pageNumberForPoint(), positionOnPage(), removePaperItems(), renderPage(), setNumPages(), setPaperSize(), updatePaperItems(), and writeXML().
|
private |
Drawing style for page.
Definition at line 500 of file qgscomposition.h.
Referenced by createDefaultPageStyleSymbol(), init(), readXML(), setPageStyleSymbol(), writeXML(), and ~QgsComposition().
|
private |
Definition at line 494 of file qgscomposition.h.
Referenced by compositionBounds(), init(), paperWidth(), readXML(), setPaperSize(), and writeXML().
|
private |
Definition at line 493 of file qgscomposition.h.
Referenced by init(), and renderPage().
|
private |
Definition at line 584 of file qgscomposition.h.
Referenced by init().
|
private |
Flag if map should be printed as a raster (via QImage).
False by default
Definition at line 513 of file qgscomposition.h.
Referenced by doPrint(), init(), readXML(), and writeXML().
|
private |
Dpi for printout.
Definition at line 510 of file qgscomposition.h.
Referenced by init(), readXML(), setPrintResolution(), and writeXML().
|
private |
Definition at line 542 of file qgscomposition.h.
Referenced by init().
|
private |
Definition at line 536 of file qgscomposition.h.
Referenced by init(), readXML(), and writeXML().
|
private |
Definition at line 528 of file qgscomposition.h.
Referenced by init(), loadDefaults(), readXML(), setSnapGridOffsetX(), snapPointToGrid(), and writeXML().
|
private |
Definition at line 529 of file qgscomposition.h.
Referenced by init(), loadDefaults(), readXML(), setSnapGridOffsetY(), snapPointToGrid(), and writeXML().
|
private |
Definition at line 526 of file qgscomposition.h.
Referenced by init(), loadDefaults(), readXML(), setSnapGridResolution(), snapPointToGrid(), and writeXML().
|
private |
Definition at line 527 of file qgscomposition.h.
Referenced by init(), loadDefaults(), readXML(), setSnapGridTolerance(), snapPointToGrid(), and writeXML().
|
private |
Arbitraty snap lines (horizontal and vertical)
Definition at line 540 of file qgscomposition.h.
Referenced by addSnapLine(), clearSnapLines(), nearestSnapLine(), removeSnapLine(), setSnapLinesVisible(), and writeXML().
|
private |
Parameters for snap to grid function.
Definition at line 524 of file qgscomposition.h.
Referenced by init(), readXML(), setSnapToGridEnabled(), snapPointToGrid(), and writeXML().
|
private |
Definition at line 497 of file qgscomposition.h.
Referenced by addItemsFromXML(), addPaperItem(), init(), setPaperSize(), and snapPointToGrid().
|
private |
Definition at line 544 of file qgscomposition.h.
Referenced by alignSelectedItemsBottom(), alignSelectedItemsHCenter(), alignSelectedItemsLeft(), alignSelectedItemsRight(), alignSelectedItemsTop(), alignSelectedItemsVCenter(), endCommand(), endMultiFrameCommand(), loadFromTemplate(), lockSelectedItems(), unlockAllItems(), and updateZValues().
|
private |
Flag if advanced visual effects such as blend modes should be used.
True by default
Definition at line 521 of file qgscomposition.h.
Referenced by init(), and setUseAdvancedEffects().
|
private |
Composer map to use for the world file generation.
Definition at line 518 of file qgscomposition.h.
Referenced by computeWorldFileParameters(), init(), and writeXML().