QGIS API Documentation
3.8.0-Zanzibar (11aff65)
|
A collection of grids which is drawn above the map content in a QgsLayoutItemMap. More...
#include <qgslayoutitemmapgrid.h>
Public Member Functions | |
QgsLayoutItemMapGridStack (QgsLayoutItemMap *map) | |
Constructor for QgsLayoutItemMapGridStack, attached to the specified map. More... | |
void | addGrid (QgsLayoutItemMapGrid *grid) |
Adds a new map grid to the stack and takes ownership of the grid. More... | |
QList< QgsLayoutItemMapGrid *> | asList () const |
Returns a list of QgsLayoutItemMapGrids 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 QgsLayoutItemMap's item rect. More... | |
QgsLayoutItemMapGrid * | grid (const QString &gridId) const |
Returns a reference to a grid with matching gridId within the stack. More... | |
QgsLayoutItemMapGrid * | grid (int index) const |
Returns a reference to a grid at the specified index within the stack. More... | |
double | maxGridExtension () const |
Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap's item rect. More... | |
void | moveGridDown (const QString &gridId) |
Moves a grid with matching gridId down the stack, causing it to be rendered below other grids. More... | |
void | moveGridUp (const QString &gridId) |
Moves a grid with matching gridId up the stack, causing it to be rendered above other grids. More... | |
QgsLayoutItemMapGrid & | operator[] (int index) |
Returns a reference to a grid at the specified index within the stack. More... | |
bool | readXml (const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context) override |
Sets the item stack's state from a DOM document, where element is a DOM node corresponding to a 'LayoutMap' tag. More... | |
void | removeGrid (const QString &gridId) |
Removes a grid with matching gridId from the stack and deletes the corresponding QgsLayoutItemMapGrid. More... | |
Public Member Functions inherited from QgsLayoutItemMapItemStack | |
QgsLayoutItemMapItemStack (QgsLayoutItemMap *map) | |
Constructor for QgsLayoutItemMapItemStack, attached to the specified map. More... | |
virtual | ~QgsLayoutItemMapItemStack () |
bool | containsAdvancedEffects () const |
Returns whether any items within the stack contain advanced effects, such as blending modes. More... | |
void | drawItems (QPainter *painter, bool ignoreStacking=true) |
Draws the items from the stack on a specified painter. More... | |
virtual void | finalizeRestoreFromXml () |
Called after all pending items have been restored from XML. More... | |
int | size () const |
Returns the number of items in the stack. More... | |
virtual bool | writeXml (QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) const |
Stores the state of the item stack in a DOM node, where element is the DOM element corresponding to a 'LayoutMap' tag. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from QgsLayoutItemMapItemStack | |
void | addItem (QgsLayoutItemMapItem *item) |
Adds a new map item to the stack and takes ownership of the item. More... | |
QList< QgsLayoutItemMapItem *> | asList () const |
Returns a list of QgsLayoutItemMapItems contained by the stack. More... | |
QgsLayoutItemMapItem * | item (const QString &itemId) const |
Returns a reference to an item which matching itemId within the stack. More... | |
QgsLayoutItemMapItem * | item (int index) const |
Returns a reference to the item at the specified index within the stack. More... | |
void | moveItemDown (const QString &itemId) |
Moves an item which matching itemId up the stack, causing it to be rendered above other items. More... | |
void | moveItemUp (const QString &itemId) |
Moves an item which matching itemId up the stack, causing it to be rendered above other items. More... | |
QgsLayoutItemMapItem & | operator[] (int index) |
Returns a reference to an item at the specified index within the stack. More... | |
void | removeItem (const QString &itemId) |
Removes an item which matching itemId from the stack and deletes the corresponding QgsLayoutItemMapItem. More... | |
void | removeItems () |
Clears the item stack and deletes all QgsLayoutItemMapItems contained by the stack. More... | |
Protected Attributes inherited from QgsLayoutItemMapItemStack | |
QList< QgsLayoutItemMapItem *> | mItems |
QgsLayoutItemMap * | mMap = nullptr |
A collection of grids which is drawn above the map content in a QgsLayoutItemMap.
The grid stack controls which grids are drawn and the order they are drawn in.
Definition at line 44 of file qgslayoutitemmapgrid.h.
QgsLayoutItemMapGridStack::QgsLayoutItemMapGridStack | ( | QgsLayoutItemMap * | map | ) |
Constructor for QgsLayoutItemMapGridStack, attached to the specified map.
Definition at line 43 of file qgslayoutitemmapgrid.cpp.
void QgsLayoutItemMapGridStack::addGrid | ( | QgsLayoutItemMapGrid * | 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.
Definition at line 49 of file qgslayoutitemmapgrid.cpp.
QList< QgsLayoutItemMapGrid * > QgsLayoutItemMapGridStack::asList | ( | ) | const |
Returns a list of QgsLayoutItemMapGrids contained by the stack.
Definition at line 81 of file qgslayoutitemmapgrid.cpp.
void QgsLayoutItemMapGridStack::calculateMaxGridExtension | ( | double & | top, |
double & | right, | ||
double & | bottom, | ||
double & | left | ||
) | const |
Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap's item rect.
This method calculates the distance for each side of the map item separately.
Definition at line 128 of file qgslayoutitemmapgrid.cpp.
QgsLayoutItemMapGrid * QgsLayoutItemMapGridStack::grid | ( | const QString & | gridId | ) | const |
Returns a reference to a grid with matching gridId within the stack.
Definition at line 69 of file qgslayoutitemmapgrid.cpp.
QgsLayoutItemMapGrid * QgsLayoutItemMapGridStack::grid | ( | int | index | ) | const |
Returns a reference to a grid at the specified index within the stack.
Definition at line 75 of file qgslayoutitemmapgrid.cpp.
double QgsLayoutItemMapGridStack::maxGridExtension | ( | ) | const |
Calculates the maximum distance grids within the stack extend beyond the QgsLayoutItemMap's item rect.
Definition at line 118 of file qgslayoutitemmapgrid.cpp.
void QgsLayoutItemMapGridStack::moveGridDown | ( | const QString & | gridId | ) |
Moves a grid with matching gridId down the stack, causing it to be rendered below other grids.
Definition at line 64 of file qgslayoutitemmapgrid.cpp.
void QgsLayoutItemMapGridStack::moveGridUp | ( | const QString & | gridId | ) |
Moves a grid with matching gridId up the stack, causing it to be rendered above other grids.
Definition at line 59 of file qgslayoutitemmapgrid.cpp.
QgsLayoutItemMapGrid & QgsLayoutItemMapGridStack::operator[] | ( | int | index | ) |
Returns a reference to a grid at the specified index within the stack.
Definition at line 94 of file qgslayoutitemmapgrid.cpp.
|
overridevirtual |
Sets the item stack's state from a DOM document, where element is a DOM node corresponding to a 'LayoutMap' tag.
Returns true
if read was successful.
Implements QgsLayoutItemMapItemStack.
Definition at line 101 of file qgslayoutitemmapgrid.cpp.
void QgsLayoutItemMapGridStack::removeGrid | ( | const QString & | gridId | ) |
Removes a grid with matching gridId from the stack and deletes the corresponding QgsLayoutItemMapGrid.
Definition at line 54 of file qgslayoutitemmapgrid.cpp.