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

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. More...
 
QList< QgsComposerMapItem * > asList () const
 Returns a list of QgsComposerMapItems contained by the stack. More...
 
const QgsComposerMapItemconstItem (const QString &itemId) const
 Returns a const reference to an item within the stack. More...
 
QgsComposerMapItemitem (const QString &itemId) const
 Returns a reference to an item within the stack. More...
 
QgsComposerMapItemitem (const int index) const
 Returns a reference to an item within the stack. More...
 
void moveItemDown (const QString &itemId)
 Moves an item up the stack, causing it to be rendered above other items. More...
 
void moveItemUp (const QString &itemId)
 Moves an item up the stack, causing it to be rendered above other items. More...
 
QgsComposerMapItemoperator[] (int idx)
 Returns a reference to an item within the stack. More...
 
void removeItem (const QString &itemId)
 Removes an item from the stack and deletes the corresponding QgsComposerMapItem. More...
 
void removeItems ()
 Clears the item stack and deletes all QgsComposerMapItems contained by the stack. More...
 
- Protected Attributes inherited from QgsComposerMapItemStack
QgsComposerMapmComposerMap
 
QList< QgsComposerMapItem * > mItems
 

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

Definition at line 45 of file qgscomposermapgrid.h.

Constructor & Destructor Documentation

QgsComposerMapGridStack::QgsComposerMapGridStack ( QgsComposerMap map)

Constructor for QgsComposerMapGridStack.

Parameters
mapQgsComposerMap the grid stack is attached to

Definition at line 38 of file qgscomposermapgrid.cpp.

QgsComposerMapGridStack::~QgsComposerMapGridStack ( )
virtual

Definition at line 44 of file qgscomposermapgrid.cpp.

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

Definition at line 48 of file qgscomposermapgrid.cpp.

QList< QgsComposerMapGrid * > QgsComposerMapGridStack::asList ( ) const

Returns a list of QgsComposerMapGrids contained by the stack.

Returns
list of grids

Definition at line 86 of file qgscomposermapgrid.cpp.

void QgsComposerMapGridStack::calculateMaxGridExtension ( double &  top,
double &  right,
double &  bottom,
double &  left 
) const

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

This method calculates the distance for each side of the map item separately

Parameters
topstorage for top extension
rightstorage for right extension
bottomstorage for bottom extension
leftstorage for left extension
Note
added in QGIS 2.12
See also
maxGridExtension()

Definition at line 135 of file qgscomposermapgrid.cpp.

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

Definition at line 68 of file qgscomposermapgrid.cpp.

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

Definition at line 74 of file qgscomposermapgrid.cpp.

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

Definition at line 80 of file qgscomposermapgrid.cpp.

double QgsComposerMapGridStack::maxGridExtension ( ) const

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

Returns
maximum grid extension
See also
calculateMaxGridExtension()

Definition at line 125 of file qgscomposermapgrid.cpp.

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

Definition at line 63 of file qgscomposermapgrid.cpp.

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

Definition at line 58 of file qgscomposermapgrid.cpp.

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

Definition at line 101 of file qgscomposermapgrid.cpp.

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

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.

Definition at line 108 of file qgscomposermapgrid.cpp.

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

Definition at line 53 of file qgscomposermapgrid.cpp.


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