QgsLayoutItemMapOverview class
An individual overview which is drawn above the map content in a QgsLayoutItemMap, and shows the extent of another QgsLayoutItemMap.
Contents
Base classes
- class QgsLayoutItemMapItem
- An item which is drawn inside a QgsLayoutItemMap, e.g., a grid or map overview.
Constructors, destructors, conversion operators
- QgsLayoutItemMapOverview(const QString& name, QgsLayoutItemMap* map)
- Constructor for QgsLayoutItemMapOverview.
Public functions
- auto asMapLayer() -> QgsVectorLayer*
- Returns a vector layer to render as part of the QgsLayoutItemMap render, containing a feature representing the overview extent (and with an appropriate renderer set matching the overview's frameSymbol() ).
- auto blendMode() const -> QPainter::CompositionMode
- Retrieves the blending mode used for drawing the overview.
- auto centered() const -> bool
- Returns whether the extent of the map is forced to center on the overview.
- void connectSignals()
- Reconnects signals for overview map, so that overview correctly follows changes to source map's extent.
- void draw(QPainter* painter) override
- Draws the item on to a destination painter.
- void finalizeRestoreFromXml() override
- Called after all pending items have been restored from XML.
- auto frameSymbol() -> QgsFillSymbol*
- Returns the fill symbol used for drawing the overview extent.
- auto frameSymbol() const -> const QgsFillSymbol*
- Returns the fill symbol used for drawing the overview extent.
- auto inverted() const -> bool
- Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent of the overview map.
- auto linkedMap() -> QgsLayoutItemMap*
- Returns the source map to show the overview extent of.
- auto readXml(const QDomElement& element, const QDomDocument& doc, const QgsReadWriteContext& context) -> bool override
- Sets the map item state from a DOM document, where element is the DOM node corresponding to a 'LayoutMapGrid' tag.
- void setBlendMode(QPainter::CompositionMode mode)
- Sets the blending mode used for drawing the overview.
- void setCentered(bool centered)
- Sets whether the extent of the map is forced to center on the overview.
- void setFrameSymbol(QgsFillSymbol* symbol)
- Sets the fill symbol used for drawing the overview extent.
- void setInverted(bool inverted)
- Sets whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent of the overview map.
- void setLinkedMap(QgsLayoutItemMap* map)
- Sets the map to show the overview extent of.
- auto usesAdvancedEffects() const -> bool override
- Returns true if the item is drawn using advanced effects, such as blend modes.
- auto writeXml(QDomElement& element, QDomDocument& document, const QgsReadWriteContext& context) const -> bool override
- Stores map item state in a DOM element, where element is the DOM element corresponding to a 'LayoutMap' tag.
Public slots
- void overviewExtentChanged()
- Handles recentering of the map and redrawing of the map's overview.
Function documentation
QgsLayoutItemMapOverview:: QgsLayoutItemMapOverview(const QString& name,
QgsLayoutItemMap* map)
Constructor for QgsLayoutItemMapOverview.
| Parameters | |
|---|---|
| name | friendly display name for overview |
| map | QgsLayoutItemMap the overview is attached to |
QgsVectorLayer* QgsLayoutItemMapOverview:: asMapLayer()
Returns a vector layer to render as part of the QgsLayoutItemMap render, containing a feature representing the overview extent (and with an appropriate renderer set matching the overview's frameSymbol() ).
Ownership of the layer remain with the overview item.
QPainter::CompositionMode QgsLayoutItemMapOverview:: blendMode() const
Retrieves the blending mode used for drawing the overview.
bool QgsLayoutItemMapOverview:: centered() const
Returns whether the extent of the map is forced to center on the overview.
void QgsLayoutItemMapOverview:: finalizeRestoreFromXml() override
Called after all pending items have been restored from XML.
Map items can use this method to run steps which must take place after all items have been restored to the layout, such as connecting to signals emitted by other items, which may not have existed in the layout at the time readXml() was called. E.g. an overview can use this to connect to its linked map item after restoration from XML.
QgsFillSymbol* QgsLayoutItemMapOverview:: frameSymbol()
Returns the fill symbol used for drawing the overview extent.
const QgsFillSymbol* QgsLayoutItemMapOverview:: frameSymbol() const
Returns the fill symbol used for drawing the overview extent.
bool QgsLayoutItemMapOverview:: inverted() const
Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent of the overview map.
QgsLayoutItemMap* QgsLayoutItemMapOverview:: linkedMap()
Returns the source map to show the overview extent of.
bool QgsLayoutItemMapOverview:: readXml(const QDomElement& element,
const QDomDocument& doc,
const QgsReadWriteContext& context) override
Sets the map item state from a DOM document, where element is the DOM node corresponding to a 'LayoutMapGrid' tag.
void QgsLayoutItemMapOverview:: setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the overview.
void QgsLayoutItemMapOverview:: setCentered(bool centered)
Sets whether the extent of the map is forced to center on the overview.
void QgsLayoutItemMapOverview:: setFrameSymbol(QgsFillSymbol* symbol)
Sets the fill symbol used for drawing the overview extent.
Ownership is transferred to the overview.
void QgsLayoutItemMapOverview:: setInverted(bool inverted)
Sets whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent of the overview map.
void QgsLayoutItemMapOverview:: setLinkedMap(QgsLayoutItemMap* map)
Sets the map to show the overview extent of.
bool QgsLayoutItemMapOverview:: writeXml(QDomElement& element,
QDomDocument& document,
const QgsReadWriteContext& context) const override
Stores map item state in a DOM element, where element is the DOM element corresponding to a 'LayoutMap' tag.