Quantum GIS API Documentation
1.8
|
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... | |
Public Slots | |
void | sendItemAddedSignal (QgsComposerItem *item) |
Casts object to the proper subclass type and calls corresponding itemAdded signal. | |
Signals | |
void | paperSizeChanged () |
void | selectedItemChanged (QgsComposerItem *selected) |
Is emitted when selected item changed. | |
void | composerArrowAdded (QgsComposerArrow *arrow) |
Is emitted when new composer arrow has been added to the view. | |
void | composerLabelAdded (QgsComposerLabel *label) |
Is emitted when new composer label has been added to the view. | |
void | composerMapAdded (QgsComposerMap *map) |
Is emitted when new composer map has been added to the view. | |
void | composerScaleBarAdded (QgsComposerScaleBar *scalebar) |
Is emitted when new composer scale bar has been added. | |
void | composerLegendAdded (QgsComposerLegend *legend) |
Is emitted when a new composer legend has been added. | |
void | composerPictureAdded (QgsComposerPicture *picture) |
Is emitted when a new composer picture has been added. | |
void | composerShapeAdded (QgsComposerShape *shape) |
Is emitted when a new composer shape has been added. | |
void | composerTableAdded (QgsComposerAttributeTable *table) |
Is emitted when a new composer table has been added. | |
void | itemRemoved (QgsComposerItem *) |
Is emitted when a composer item has been removed from the scene. | |
Public Member Functions | |
QgsComposition (QgsMapRenderer *mapRenderer) | |
~QgsComposition () | |
void | setPaperSize (double width, double height) |
Changes size of paper item. | |
double | paperHeight () const |
Returns height of paper item. | |
double | paperWidth () const |
Returns width of paper item. | |
void | setSnapToGridEnabled (bool b) |
bool | snapToGridEnabled () const |
void | setSnapGridResolution (double r) |
double | snapGridResolution () 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 |
QUndoStack * | undoStack () |
Returns pointer to undo/redo command storage. | |
QgsComposerItem * | composerItemAt (const QPointF &position) |
Returns the topmost composer item. | |
QList< QgsComposerItem * > | selectedComposerItems () |
QList< const QgsComposerMap * > | composerMapItems () const |
Returns pointers to all composer maps in the scene. | |
const QgsComposerMap * | getComposerMapById (int id) const |
Returns the composer map with specified id. | |
int | printResolution () const |
void | setPrintResolution (int dpi) |
bool | printAsRaster () const |
void | setPrintAsRaster (bool enabled) |
double | selectionTolerance () const |
void | setSelectionTolerance (double tol) |
QgsMapRenderer * | mapRenderer () |
Returns pointer to map renderer of qgis map canvas. | |
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. | |
double | pointFontSize (int pixelSize) const |
Does the inverse calculation and returns points for pixels (equals to mm in QgsComposition) | |
bool | writeXML (QDomElement &composerElem, QDomDocument &doc) |
Writes settings to xml (paper dimension) | |
bool | readXML (const QDomElement &compositionElem, const QDomDocument &doc) |
Reads settings from xml file. | |
void | addItemsFromXML (const QDomElement &elem, const QDomDocument &doc, QMap< QgsComposerMap *, int > *mapsToRestore=0, bool addUndoCommands=false, QPointF *pos=0) |
Add items from XML representation to the graphics scene (for project file reading, pasting items from clipboard) | |
void | addItemToZList (QgsComposerItem *item) |
Adds item to z list. | |
void | removeItemFromZList (QgsComposerItem *item) |
Removes item from z list. | |
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 | alignSelectedItemsLeft () |
void | alignSelectedItemsHCenter () |
void | alignSelectedItemsRight () |
void | alignSelectedItemsTop () |
void | alignSelectedItemsVCenter () |
void | alignSelectedItemsBottom () |
void | sortZList () |
Sorts the zList. | |
QPointF | snapPointToGrid (const QPointF &scenePoint) const |
Snaps a scene coordinate point to grid. | |
void | beginCommand (QgsComposerItem *item, const QString &commandText, QgsComposerMergeCommand::Context c=QgsComposerMergeCommand::Unknown) |
Allocates new item command and saves initial state in it. | |
void | endCommand () |
Saves end state of item and pushes command to the undo history. | |
void | cancelCommand () |
Deletes current command. | |
void | addComposerArrow (QgsComposerArrow *arrow) |
Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerLabel (QgsComposerLabel *label) |
Adds label to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerMap (QgsComposerMap *map, bool setDefaultPreviewStyle=true) |
Adds map to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerScaleBar (QgsComposerScaleBar *scaleBar) |
Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerLegend (QgsComposerLegend *legend) |
Adds legend to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerPicture (QgsComposerPicture *picture) |
Adds picture to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerShape (QgsComposerShape *shape) |
Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerTable (QgsComposerAttributeTable *table) |
Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal) | |
void | removeComposerItem (QgsComposerItem *item) |
Remove item from the graphics scene. | |
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. | |
Private Member Functions | |
QgsComposition () | |
void | updateZValues () |
Reset z-values of items based on position in z list. | |
int | boundingRectOfSelectedItems (QRectF &bRect) |
Returns the bounding rectangle of the selected items in scene coordinates. | |
void | loadSettings () |
void | saveSettings () |
void | connectAddRemoveCommandSignals (QgsAddRemoveItemCommand *c) |
Private Attributes | |
QgsMapRenderer * | mMapRenderer |
Pointer to map renderer of QGIS main map. | |
QgsComposition::PlotStyle | mPlotStyle |
QgsPaperItem * | mPaperItem |
QLinkedList< QgsComposerItem * > | mItemZList |
Maintains z-Order of items. | |
int | mPrintResolution |
Dpi for printout. | |
bool | mPrintAsRaster |
Flag if map should be printed as a raster (via QImage). | |
double | mSelectionTolerance |
Distance tolerance for item selection (in mm) | |
bool | mSnapToGrid |
Parameters for snap to grid function. | |
double | mSnapGridResolution |
double | mSnapGridOffsetX |
double | mSnapGridOffsetY |
QPen | mGridPen |
GridStyle | mGridStyle |
QUndoStack | mUndoStack |
QgsComposerItemCommand * | mActiveCommand |
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 49 of file qgscomposition.h.
Style to draw the snapping grid.
Definition at line 63 of file qgscomposition.h.
QgsComposition::QgsComposition | ( | QgsMapRenderer * | mapRenderer | ) |
Definition at line 35 of file qgscomposition.cpp.
References loadSettings(), mPaperItem, and mPrintResolution.
Definition at line 57 of file qgscomposition.cpp.
References mPaperItem.
QgsComposition::QgsComposition | ( | ) | [private] |
Definition at line 50 of file qgscomposition.cpp.
References loadSettings().
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 993 of file qgscomposition.cpp.
References composerArrowAdded(), selectedItemChanged(), and QgsComposerItem::setSelected().
Referenced by addItemsFromXML(), and QgsComposerView::mouseReleaseEvent().
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 1002 of file qgscomposition.cpp.
References composerLabelAdded(), selectedItemChanged(), and QgsComposerItem::setSelected().
Referenced by addItemsFromXML(), and QgsComposerView::mousePressEvent().
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 1046 of file qgscomposition.cpp.
References composerLegendAdded(), composerMapItems(), selectedItemChanged(), QgsComposerLegend::setComposerMap(), and QgsComposerItem::setSelected().
Referenced by addItemsFromXML(), and QgsComposerView::mousePressEvent().
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 1011 of file qgscomposition.cpp.
References QgsComposerMap::Cache, QgsComposerMap::cache(), composerMapAdded(), QgsComposerMap::previewMode(), QgsComposerMap::Rectangle, selectedItemChanged(), QgsComposerMap::setPreviewMode(), and QgsComposerItem::setSelected().
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 1061 of file qgscomposition.cpp.
References composerPictureAdded(), selectedItemChanged(), and QgsComposerItem::setSelected().
Referenced by addItemsFromXML(), and QgsComposerView::mousePressEvent().
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 1031 of file qgscomposition.cpp.
References composerMapItems(), composerScaleBarAdded(), selectedItemChanged(), QgsComposerScaleBar::setComposerMap(), and QgsComposerItem::setSelected().
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 1070 of file qgscomposition.cpp.
References composerShapeAdded(), selectedItemChanged(), and QgsComposerItem::setSelected().
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 1079 of file qgscomposition.cpp.
References composerTableAdded(), selectedItemChanged(), and QgsComposerItem::setSelected().
Referenced by addItemsFromXML(), and QgsComposerView::mousePressEvent().
void QgsComposition::addItemsFromXML | ( | const QDomElement & | elem, |
const QDomDocument & | doc, | ||
QMap< QgsComposerMap *, int > * | mapsToRestore = 0 , |
||
bool | addUndoCommands = false , |
||
QPointF * | pos = 0 |
||
) |
Add items from XML representation to the graphics scene (for project file reading, pasting items from clipboard)
elem | items parent element, e.g. <Composer> <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 |
Definition at line 263 of file qgscomposition.cpp.
References addComposerArrow(), addComposerLabel(), addComposerLegend(), addComposerMap(), addComposerPicture(), addComposerScaleBar(), addComposerShape(), addComposerTable(), QgsComposerMap::previewMode(), pushAddRemoveCommand(), QgsComposerAttributeTable::readXML(), QgsComposerShape::readXML(), QgsComposerPicture::readXML(), QgsComposerArrow::readXML(), QgsComposerLabel::readXML(), QgsComposerLegend::readXML(), QgsComposerScaleBar::readXML(), QgsComposerMap::readXML(), QgsComposerMap::Rectangle, QgsComposerItem::setItemPosition(), and QgsComposerMap::setPreviewMode().
Referenced by QgsComposerView::keyPressEvent().
void QgsComposition::addItemToZList | ( | QgsComposerItem * | item | ) |
Adds item to z list.
Usually called from constructor of QgsComposerItem
Definition at line 411 of file qgscomposition.cpp.
References mItemZList, and QgsDebugMsg.
Referenced by QgsComposerItem::init().
Definition at line 693 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), and selectedComposerItems().
Definition at line 572 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), and selectedComposerItems().
Definition at line 541 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), and selectedComposerItems().
Definition at line 603 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), and selectedComposerItems().
Definition at line 634 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), and selectedComposerItems().
Definition at line 664 of file qgscomposition.cpp.
References boundingRectOfSelectedItems(), mUndoStack, QgsComposerItemCommand::saveAfterState(), QgsComposerItemCommand::savePreviousState(), and selectedComposerItems().
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 950 of file qgscomposition.cpp.
References mActiveCommand, QgsComposerItemCommand::savePreviousState(), and QgsComposerMergeCommand::Unknown.
Referenced by QgsComposerItem::beginCommand(), and QgsComposerView::mouseReleaseEvent().
int QgsComposition::boundingRectOfSelectedItems | ( | QRectF & | bRect | ) | [private] |
Returns the bounding rectangle of the selected items in scene coordinates.
Definition at line 784 of file qgscomposition.cpp.
References selectedComposerItems().
Referenced by alignSelectedItemsBottom(), alignSelectedItemsHCenter(), alignSelectedItemsLeft(), alignSelectedItemsRight(), alignSelectedItemsTop(), and alignSelectedItemsVCenter().
void QgsComposition::cancelCommand | ( | ) |
Deletes current command.
Definition at line 987 of file qgscomposition.cpp.
References mActiveCommand.
Referenced by QgsComposerItem::cancelCommand().
void QgsComposition::composerArrowAdded | ( | QgsComposerArrow * | arrow | ) | [signal] |
Is emitted when new composer arrow has been added to the view.
Referenced by addComposerArrow(), and sendItemAddedSignal().
QgsComposerItem * QgsComposition::composerItemAt | ( | const QPointF & | position | ) |
Returns the topmost composer item.
Ignores mPaperItem
Definition at line 86 of file qgscomposition.cpp.
References mPaperItem, and mSelectionTolerance.
Referenced by QgsComposerView::mousePressEvent(), and QgsComposerView::wheelEvent().
void QgsComposition::composerLabelAdded | ( | QgsComposerLabel * | label | ) | [signal] |
Is emitted when new composer label has been added to the view.
Referenced by addComposerLabel(), and sendItemAddedSignal().
void QgsComposition::composerLegendAdded | ( | QgsComposerLegend * | legend | ) | [signal] |
Is emitted when a new composer legend has been added.
Referenced by addComposerLegend(), and sendItemAddedSignal().
void QgsComposition::composerMapAdded | ( | QgsComposerMap * | map | ) | [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 130 of file qgscomposition.cpp.
Referenced by addComposerLegend(), addComposerScaleBar(), QgsComposerView::mousePressEvent(), and QgsComposerMap::QgsComposerMap().
void QgsComposition::composerPictureAdded | ( | QgsComposerPicture * | picture | ) | [signal] |
Is emitted when a new composer picture has been added.
Referenced by addComposerPicture(), and sendItemAddedSignal().
void QgsComposition::composerScaleBarAdded | ( | QgsComposerScaleBar * | scalebar | ) | [signal] |
Is emitted when new composer scale bar has been added.
Referenced by addComposerScaleBar(), and sendItemAddedSignal().
void QgsComposition::composerShapeAdded | ( | QgsComposerShape * | shape | ) | [signal] |
Is emitted when a new composer shape has been added.
Referenced by addComposerShape(), and sendItemAddedSignal().
void QgsComposition::composerTableAdded | ( | QgsComposerAttributeTable * | table | ) | [signal] |
Is emitted when a new composer table has been added.
Referenced by addComposerTable(), and sendItemAddedSignal().
void QgsComposition::connectAddRemoveCommandSignals | ( | QgsAddRemoveItemCommand * | c | ) | [private] |
Definition at line 1128 of file qgscomposition.cpp.
References itemRemoved(), and sendItemAddedSignal().
Referenced by pushAddRemoveCommand(), and removeComposerItem().
void QgsComposition::endCommand | ( | ) |
Saves end state of item and pushes command to the undo history.
Definition at line 970 of file qgscomposition.cpp.
References QgsComposerItemCommand::containsChange(), mActiveCommand, mUndoStack, and QgsComposerItemCommand::saveAfterState().
Referenced by QgsComposerItem::endCommand(), and QgsComposerView::mouseReleaseEvent().
const QgsComposerMap * QgsComposition::getComposerMapById | ( | int | id | ) | const |
Returns the composer map with specified id.
Definition at line 148 of file qgscomposition.cpp.
References QgsComposerMap::id().
Referenced by QgsComposerAttributeTable::readXML(), QgsComposerPicture::readXML(), QgsComposerLegend::readXML(), QgsComposerScaleBar::readXML(), and QgsComposerPicture::setRotationMap().
const QPen& QgsComposition::gridPen | ( | ) | const [inline] |
Definition at line 95 of file qgscomposition.h.
Referenced by QgsPaperItem::paint().
GridStyle QgsComposition::gridStyle | ( | ) | const [inline] |
Definition at line 98 of file qgscomposition.h.
Referenced by QgsPaperItem::paint().
void QgsComposition::itemRemoved | ( | QgsComposerItem * | ) | [signal] |
Is emitted when a composer item has been removed from the scene.
Referenced by connectAddRemoveCommandSignals(), and removeComposerItem().
void QgsComposition::loadSettings | ( | ) | [private] |
Definition at line 890 of file qgscomposition.cpp.
References Crosses, Dots, mGridPen, mGridStyle, mSelectionTolerance, and Solid.
Referenced by QgsComposition().
void QgsComposition::lowerItem | ( | QgsComposerItem * | item | ) |
Definition at line 474 of file qgscomposition.cpp.
References mItemZList.
Referenced by lowerSelectedItems().
void QgsComposition::lowerSelectedItems | ( | ) |
Definition at line 460 of file qgscomposition.cpp.
References lowerItem(), selectedComposerItems(), and updateZValues().
QgsMapRenderer* QgsComposition::mapRenderer | ( | ) | [inline] |
Returns pointer to map renderer of qgis map canvas.
Definition at line 125 of file qgscomposition.h.
Referenced by QgsComposerLegend::layerIdList(), and QgsComposerMap::QgsComposerMap().
void QgsComposition::moveItemToBottom | ( | QgsComposerItem * | item | ) |
Definition at line 530 of file qgscomposition.cpp.
References mItemZList.
Referenced by moveSelectedItemsToBottom().
void QgsComposition::moveItemToTop | ( | QgsComposerItem * | item | ) |
Definition at line 505 of file qgscomposition.cpp.
References mItemZList.
Referenced by moveSelectedItemsToTop().
Definition at line 516 of file qgscomposition.cpp.
References moveItemToBottom(), selectedComposerItems(), and updateZValues().
Definition at line 490 of file qgscomposition.cpp.
References moveItemToTop(), selectedComposerItems(), and updateZValues().
double QgsComposition::paperHeight | ( | ) | const |
Returns height of paper item.
Definition at line 76 of file qgscomposition.cpp.
References mPaperItem.
Referenced by readXML().
void QgsComposition::paperSizeChanged | ( | ) | [signal] |
Referenced by setPaperSize().
double QgsComposition::paperWidth | ( | ) | const |
Returns width of paper item.
Definition at line 81 of file qgscomposition.cpp.
References mPaperItem.
Referenced by readXML().
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 169 of file qgscomposition.cpp.
QgsComposition::PlotStyle QgsComposition::plotStyle | ( | ) | const [inline] |
Definition at line 127 of file qgscomposition.h.
Referenced by QgsComposerItemGroup::drawFrame(), QgsComposerItem::drawSelectionBoxes(), QgsComposerArrow::drawSVGMarker(), QgsPaperItem::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 176 of file qgscomposition.cpp.
bool QgsComposition::printAsRaster | ( | ) | const [inline] |
Definition at line 118 of file qgscomposition.h.
int QgsComposition::printResolution | ( | ) | const [inline] |
Definition at line 115 of file qgscomposition.h.
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 1121 of file qgscomposition.cpp.
References connectAddRemoveCommandSignals(), and undoStack().
Referenced by addItemsFromXML(), QgsComposerView::addShape(), QgsComposerView::mousePressEvent(), QgsComposerView::mouseReleaseEvent(), and removeComposerItem().
void QgsComposition::raiseItem | ( | QgsComposerItem * | item | ) |
Definition at line 445 of file qgscomposition.cpp.
References mItemZList.
Referenced by raiseSelectedItems().
void QgsComposition::raiseSelectedItems | ( | ) |
Definition at line 431 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 217 of file qgscomposition.cpp.
References mPaperItem, mPrintAsRaster, mPrintResolution, mSnapGridOffsetX, mSnapGridOffsetY, mSnapGridResolution, mSnapToGrid, paperHeight(), and paperWidth().
void QgsComposition::removeComposerItem | ( | QgsComposerItem * | item | ) |
Remove item from the graphics scene.
Additionally to QGraphicsScene::removeItem, this function considers undo/redo command
Definition at line 1088 of file qgscomposition.cpp.
References connectAddRemoveCommandSignals(), QgsComposerMap::isDrawing(), itemRemoved(), QgsComposerItemGroup::items(), pushAddRemoveCommand(), QgsAddRemoveItemCommand::Removed, and undoStack().
Referenced by QgsComposerView::keyPressEvent().
void QgsComposition::removeItemFromZList | ( | QgsComposerItem * | item | ) |
Removes item from z list.
Usually called from destructor of QgsComposerItem
Definition at line 422 of file qgscomposition.cpp.
References mItemZList.
Referenced by QgsComposerItem::~QgsComposerItem().
void QgsComposition::saveSettings | ( | ) | [private] |
Definition at line 924 of file qgscomposition.cpp.
References Crosses, Dots, mGridPen, mGridStyle, mSelectionTolerance, and Solid.
Referenced by setGridPen(), setGridStyle(), setSelectionTolerance(), setSnapGridOffsetX(), setSnapGridOffsetY(), setSnapGridResolution(), and setSnapToGridEnabled().
QList< QgsComposerItem * > QgsComposition::selectedComposerItems | ( | ) |
Definition at line 111 of file qgscomposition.cpp.
Referenced by alignSelectedItemsBottom(), alignSelectedItemsHCenter(), alignSelectedItemsLeft(), alignSelectedItemsRight(), alignSelectedItemsTop(), alignSelectedItemsVCenter(), boundingRectOfSelectedItems(), QgsComposerView::groupItems(), QgsComposerView::keyPressEvent(), lowerSelectedItems(), moveSelectedItemsToBottom(), moveSelectedItemsToTop(), raiseSelectedItems(), and QgsComposerView::ungroupItems().
void QgsComposition::selectedItemChanged | ( | QgsComposerItem * | selected | ) | [signal] |
Is emitted when selected item changed.
If 0, no item is selected
Referenced by addComposerArrow(), addComposerLabel(), addComposerLegend(), addComposerMap(), addComposerPicture(), addComposerScaleBar(), addComposerShape(), addComposerTable(), and sendItemAddedSignal().
double QgsComposition::selectionTolerance | ( | ) | const [inline] |
Definition at line 121 of file qgscomposition.h.
void QgsComposition::sendItemAddedSignal | ( | QgsComposerItem * | item | ) | [slot] |
Casts object to the proper subclass type and calls corresponding itemAdded signal.
Definition at line 1139 of file qgscomposition.cpp.
References composerArrowAdded(), composerLabelAdded(), composerLegendAdded(), composerMapAdded(), composerPictureAdded(), composerScaleBarAdded(), composerShapeAdded(), composerTableAdded(), selectedItemChanged(), and QgsComposerItem::setSelected().
Referenced by connectAddRemoveCommandSignals().
void QgsComposition::setGridPen | ( | const QPen & | p | ) |
Definition at line 864 of file qgscomposition.cpp.
References mGridPen, mPaperItem, and saveSettings().
void QgsComposition::setGridStyle | ( | GridStyle | s | ) |
Definition at line 874 of file qgscomposition.cpp.
References mGridStyle, mPaperItem, and saveSettings().
void QgsComposition::setPaperSize | ( | double | width, |
double | height | ||
) |
Changes size of paper item.
Definition at line 67 of file qgscomposition.cpp.
References mPaperItem, and paperSizeChanged().
void QgsComposition::setPlotStyle | ( | QgsComposition::PlotStyle | style | ) | [inline] |
Definition at line 128 of file qgscomposition.h.
void QgsComposition::setPrintAsRaster | ( | bool | enabled | ) | [inline] |
Definition at line 119 of file qgscomposition.h.
void QgsComposition::setPrintResolution | ( | int | dpi | ) | [inline] |
Definition at line 116 of file qgscomposition.h.
void QgsComposition::setSelectionTolerance | ( | double | tol | ) |
Definition at line 884 of file qgscomposition.cpp.
References mSelectionTolerance, and saveSettings().
void QgsComposition::setSnapGridOffsetX | ( | double | offset | ) |
Definition at line 844 of file qgscomposition.cpp.
References mPaperItem, mSnapGridOffsetX, and saveSettings().
void QgsComposition::setSnapGridOffsetY | ( | double | offset | ) |
Definition at line 854 of file qgscomposition.cpp.
References mPaperItem, mSnapGridOffsetY, and saveSettings().
void QgsComposition::setSnapGridResolution | ( | double | r | ) |
Definition at line 834 of file qgscomposition.cpp.
References mPaperItem, mSnapGridResolution, and saveSettings().
void QgsComposition::setSnapToGridEnabled | ( | bool | b | ) |
Definition at line 824 of file qgscomposition.cpp.
References mPaperItem, mSnapToGrid, and saveSettings().
double QgsComposition::snapGridOffsetX | ( | ) | const [inline] |
Definition at line 89 of file qgscomposition.h.
Referenced by QgsPaperItem::paint().
double QgsComposition::snapGridOffsetY | ( | ) | const [inline] |
Definition at line 92 of file qgscomposition.h.
Referenced by QgsPaperItem::paint().
double QgsComposition::snapGridResolution | ( | ) | const [inline] |
Definition at line 86 of file qgscomposition.h.
Referenced by QgsPaperItem::paint().
QPointF QgsComposition::snapPointToGrid | ( | const QPointF & | scenePoint | ) | const |
Snaps a scene coordinate point to grid.
Definition at line 770 of file qgscomposition.cpp.
References mSnapGridOffsetX, mSnapGridOffsetY, mSnapGridResolution, and mSnapToGrid.
Referenced by QgsComposerItem::changeItemRectangle(), QgsComposerView::mousePressEvent(), and QgsComposerView::mouseReleaseEvent().
bool QgsComposition::snapToGridEnabled | ( | ) | const [inline] |
Definition at line 83 of file qgscomposition.h.
Referenced by QgsPaperItem::paint().
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 744 of file qgscomposition.cpp.
References mItemZList.
QUndoStack* QgsComposition::undoStack | ( | ) | [inline] |
Returns pointer to undo/redo command storage.
Definition at line 101 of file qgscomposition.h.
Referenced by pushAddRemoveCommand(), and removeComposerItem().
void QgsComposition::updateZValues | ( | ) | [private] |
Reset z-values of items based on position in z list.
Definition at line 722 of file qgscomposition.cpp.
References mItemZList, mUndoStack, QgsComposerItemCommand::saveAfterState(), and QgsComposerItemCommand::savePreviousState().
Referenced by lowerSelectedItems(), moveSelectedItemsToBottom(), moveSelectedItemsToTop(), and raiseSelectedItems().
bool QgsComposition::writeXML | ( | QDomElement & | composerElem, |
QDomDocument & | doc | ||
) |
Writes settings to xml (paper dimension)
Definition at line 182 of file qgscomposition.cpp.
References mPaperItem, mPrintAsRaster, mPrintResolution, mSnapGridOffsetX, mSnapGridOffsetY, mSnapGridResolution, and mSnapToGrid.
Definition at line 249 of file qgscomposition.h.
Referenced by beginCommand(), cancelCommand(), and endCommand().
QPen QgsComposition::mGridPen [private] |
Definition at line 244 of file qgscomposition.h.
Referenced by loadSettings(), saveSettings(), and setGridPen().
GridStyle QgsComposition::mGridStyle [private] |
Definition at line 245 of file qgscomposition.h.
Referenced by loadSettings(), saveSettings(), and setGridStyle().
QLinkedList<QgsComposerItem*> QgsComposition::mItemZList [private] |
Maintains z-Order of items.
Starts with item at position 1 (position 0 is always paper item)
Definition at line 228 of file qgscomposition.h.
Referenced by addItemToZList(), lowerItem(), moveItemToBottom(), moveItemToTop(), raiseItem(), removeItemFromZList(), sortZList(), and updateZValues().
QgsMapRenderer* QgsComposition::mMapRenderer [private] |
Pointer to map renderer of QGIS main map.
Definition at line 223 of file qgscomposition.h.
QgsPaperItem* QgsComposition::mPaperItem [private] |
Definition at line 225 of file qgscomposition.h.
Referenced by composerItemAt(), paperHeight(), paperWidth(), QgsComposition(), readXML(), setGridPen(), setGridStyle(), setPaperSize(), setSnapGridOffsetX(), setSnapGridOffsetY(), setSnapGridResolution(), setSnapToGridEnabled(), writeXML(), and ~QgsComposition().
Definition at line 224 of file qgscomposition.h.
bool QgsComposition::mPrintAsRaster [private] |
Flag if map should be printed as a raster (via QImage).
False by default
Definition at line 234 of file qgscomposition.h.
Referenced by readXML(), and writeXML().
int QgsComposition::mPrintResolution [private] |
Dpi for printout.
Definition at line 231 of file qgscomposition.h.
Referenced by QgsComposition(), readXML(), and writeXML().
double QgsComposition::mSelectionTolerance [private] |
Distance tolerance for item selection (in mm)
Definition at line 237 of file qgscomposition.h.
Referenced by composerItemAt(), loadSettings(), saveSettings(), and setSelectionTolerance().
double QgsComposition::mSnapGridOffsetX [private] |
Definition at line 242 of file qgscomposition.h.
Referenced by readXML(), setSnapGridOffsetX(), snapPointToGrid(), and writeXML().
double QgsComposition::mSnapGridOffsetY [private] |
Definition at line 243 of file qgscomposition.h.
Referenced by readXML(), setSnapGridOffsetY(), snapPointToGrid(), and writeXML().
double QgsComposition::mSnapGridResolution [private] |
Definition at line 241 of file qgscomposition.h.
Referenced by readXML(), setSnapGridResolution(), snapPointToGrid(), and writeXML().
bool QgsComposition::mSnapToGrid [private] |
Parameters for snap to grid function.
Definition at line 240 of file qgscomposition.h.
Referenced by readXML(), setSnapToGridEnabled(), snapPointToGrid(), and writeXML().
QUndoStack QgsComposition::mUndoStack [private] |
Definition at line 247 of file qgscomposition.h.
Referenced by alignSelectedItemsBottom(), alignSelectedItemsHCenter(), alignSelectedItemsLeft(), alignSelectedItemsRight(), alignSelectedItemsTop(), alignSelectedItemsVCenter(), endCommand(), and updateZValues().