QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | List of all members
QgsComposerMapGridStack Class Reference

A collection of grids which is drawn above the map content in a QgsComposerMap. More...

#include <qgscomposermapgrid.h>

Inheritance diagram for QgsComposerMapGridStack:
Inheritance graph
[legend]

Public Member Functions

 QgsComposerMapGridStack (QgsComposerMap *map)
 Constructor for QgsComposerMapGridStack.
virtual ~QgsComposerMapGridStack ()
void addGrid (QgsComposerMapGrid *grid)
 Adds a new map grid to the stack and takes ownership of the grid.
void removeGrid (const QString &gridId)
 Removes a grid from the stack and deletes the corresponding QgsComposerMapGrid.
void moveGridUp (const QString &gridId)
 Moves a grid up the stack, causing it to be rendered above other grids.
void moveGridDown (const QString &gridId)
 Moves a grid down the stack, causing it to be rendered below other grids.
const QgsComposerMapGridconstGrid (const QString &gridId) const
 Returns a const reference to a grid within the stack.
QgsComposerMapGridgrid (const QString &gridId) const
 Returns a reference to a grid within the stack.
QgsComposerMapGridgrid (const int index) const
 Returns a reference to a grid within the stack.
QgsComposerMapGridoperator[] (int idx)
 Returns a reference to a grid within the stack.
QList< QgsComposerMapGrid * > asList () const
 Returns a list of QgsComposerMapGrids contained by the stack.
bool readXML (const QDomElement &elem, const QDomDocument &doc)
 Sets the grid stack's state from a DOM document.
double maxGridExtension () const
 Calculates the maximum distance grids within the stack extend beyond the QgsComposerMap's item rect.
- Public Member Functions inherited from QgsComposerMapItemStack
 QgsComposerMapItemStack (QgsComposerMap *map)
 Constructor for QgsComposerMapItemStack.
virtual ~QgsComposerMapItemStack ()
int size () const
 Returns the number of items in the stack.
virtual bool writeXML (QDomElement &elem, QDomDocument &doc) const
 Stores the state of the item stack in a DOM node.
void drawItems (QPainter *painter)
 Draws the items from the stack on a specified painter.
bool containsAdvancedEffects () const
 Returns whether any items within the stack contain advanced effects, such as blending modes.

Additional Inherited Members

- Protected Member Functions inherited from QgsComposerMapItemStack
void addItem (QgsComposerMapItem *item)
 Adds a new map item to the stack and takes ownership of the item.
void removeItem (const QString &itemId)
 Removes an item from the stack and deletes the corresponding QgsComposerMapItem.
void moveItemUp (const QString &itemId)
 Moves an item up the stack, causing it to be rendered above other items.
void moveItemDown (const QString &itemId)
 Moves an item up the stack, causing it to be rendered above other items.
const QgsComposerMapItemconstItem (const QString &itemId) const
 Returns a const reference to an item within the stack.
QgsComposerMapItemitem (const QString &itemId) const
 Returns a reference to an item within the stack.
QgsComposerMapItemitem (const int index) const
 Returns a reference to an item within the stack.
void removeItems ()
 Clears the item stack and deletes all QgsComposerMapItems contained by the stack.
- Protected Attributes inherited from QgsComposerMapItemStack
QList< QgsComposerMapItem * > mItems
QgsComposerMapmComposerMap

Detailed Description

A collection of grids which is drawn above the map content in a QgsComposerMap.

The grid stack controls which grids are drawn and the order they are drawn in.

Note
added in QGIS 2.5
See Also
QgsComposerMapGrid

Constructor & Destructor Documentation

QgsComposerMapGridStack::QgsComposerMapGridStack ( QgsComposerMap map)

Constructor for QgsComposerMapGridStack.

Parameters
mapQgsComposerMap the grid stack is attached to
QgsComposerMapGridStack::~QgsComposerMapGridStack ( )
virtual

Member Function Documentation

void QgsComposerMapGridStack::addGrid ( QgsComposerMapGrid grid)

Adds a new map grid to the stack and takes ownership of the grid.

The grid will be added to the end of the stack, and rendered above any existing map grids already present in the stack.

Parameters
gridQgsComposerMapGrid to add to the stack
Note
after adding a grid to the stack, updateBoundingRect() and update() should be called for the QgsComposerMap to prevent rendering artifacts
See Also
removeGrid
QList< QgsComposerMapGrid * > QgsComposerMapGridStack::asList ( ) const

Returns a list of QgsComposerMapGrids contained by the stack.

Returns
list of grids

Reimplemented from QgsComposerMapItemStack.

const QgsComposerMapGrid * QgsComposerMapGridStack::constGrid ( const QString &  gridId) const

Returns a const reference to a grid within the stack.

Parameters
gridIdid for the QgsComposerMapGrid to find
Returns
const reference to grid, if found
See Also
grid
QgsComposerMapGrid * QgsComposerMapGridStack::grid ( const QString &  gridId) const

Returns a reference to a grid within the stack.

Parameters
gridIdid for the QgsComposerMapGrid to find
Returns
reference to grid if found
See Also
constGrid
QgsComposerMapGrid * QgsComposerMapGridStack::grid ( const int  index) const

Returns a reference to a grid within the stack.

Parameters
indexgrid position in the stack
Returns
reference to grid if found
See Also
constGrid
double QgsComposerMapGridStack::maxGridExtension ( ) const

Calculates the maximum distance grids within the stack extend beyond the QgsComposerMap's item rect.

Returns
maximum grid extension
void QgsComposerMapGridStack::moveGridDown ( const QString &  gridId)

Moves a grid down the stack, causing it to be rendered below other grids.

Parameters
gridIdid for the QgsComposerMapGrid to move down
Note
after moving a grid within the stack, update() should be called for the QgsComposerMap to redraw the map with the new grid stack order
See Also
moveGridUp
void QgsComposerMapGridStack::moveGridUp ( const QString &  gridId)

Moves a grid up the stack, causing it to be rendered above other grids.

Parameters
gridIdid for the QgsComposerMapGrid to move up
Note
after moving a grid within the stack, update() should be called for the QgsComposerMap to redraw the map with the new grid stack order
See Also
moveGridDown
QgsComposerMapGrid & QgsComposerMapGridStack::operator[] ( int  idx)

Returns a reference to a grid within the stack.

Parameters
idxgrid position in the stack
Returns
reference to grid if found
See Also
constGrid
grid

Reimplemented from QgsComposerMapItemStack.

bool QgsComposerMapGridStack::readXML ( const QDomElement &  elem,
const QDomDocument &  doc 
)
virtual

Sets the grid stack's state from a DOM document.

Parameters
elemis DOM node corresponding to 'a ComposerMap' tag
docDOM document
Returns
true if read was successful
See Also
writeXML

Implements QgsComposerMapItemStack.

void QgsComposerMapGridStack::removeGrid ( const QString &  gridId)

Removes a grid from the stack and deletes the corresponding QgsComposerMapGrid.

Parameters
gridIdid for the QgsComposerMapGrid to remove
Note
after removing a grid from the stack, updateBoundingRect() and update() should be called for the QgsComposerMap to prevent rendering artifacts
See Also
addGrid

The documentation for this class was generated from the following files: