QgsLayoutItem3DMap class
3
Contents
Base classes
- class QgsLayoutItem
- Base class for graphical items within a QgsLayout.
Public static functions
- static auto create(QgsLayout* layout) -> QgsLayoutItem3DMap*
- Returns a new 3D map item for the specified layout.
Constructors, destructors, conversion operators
- QgsLayoutItem3DMap(QgsLayout* layout)
- Constructor for QgsLayoutItem3DMap, with the specified parent layout.
Public functions
- void assignFreeId()
- Sets the map id() to a number not yet used in the layout.
- auto cameraPose() const -> QgsCameraPose
- Returns camera view.
- auto displayName() const -> QString override
- overridden to show "3D Map 1" type names
- void finalizeRestoreFromXml() override
- Called after all pending items have been restored from XML.
- auto icon() const -> QIcon override
- Returns the item's icon.
- auto mapSettings() const -> Qgs3DMapSettings*
- Returns map scene. May be a null pointer if not yet configured.
- void setCameraPose(const QgsCameraPose& pose)
- Configures camera view.
- void setMapSettings(Qgs3DMapSettings* settings)
- Configures map scene.
Protected functions
- void draw(QgsLayoutItemRenderContext& context) override
- Draws the item's contents using the specified item render context.
- auto readPropertiesFromElement(const QDomElement& element, const QDomDocument& document, const QgsReadWriteContext& context) -> bool override
- Sets item state from a DOM element.
- auto writePropertiesToElement(QDomElement& element, QDomDocument& document, const QgsReadWriteContext& context) const -> bool override
- Stores item state within an XML DOM element.
Function documentation
static QgsLayoutItem3DMap* QgsLayoutItem3DMap:: create(QgsLayout* layout)
Returns a new 3D map item for the specified layout.
The caller takes responsibility for deleting the returned object.
QgsLayoutItem3DMap:: QgsLayoutItem3DMap(QgsLayout* layout)
Constructor for QgsLayoutItem3DMap, with the specified parent layout.
Ownership is transferred to the layout.
void QgsLayoutItem3DMap:: assignFreeId()
Sets the map id() to a number not yet used in the layout.
The existing id() is kept if it is not in use.
void QgsLayoutItem3DMap:: finalizeRestoreFromXml() override
Called after all pending items have been restored from XML.
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. a scalebar can use this to connect to its linked map item after restoration from XML.
void QgsLayoutItem3DMap:: setMapSettings(Qgs3DMapSettings* settings)
Configures map scene.
Ownership is transferred to the item.
void QgsLayoutItem3DMap:: draw(QgsLayoutItemRenderContext& context) override protected
Draws the item's contents using the specified item render context.
Note that the context's painter has been scaled so that painter units are pixels. Use the QgsRenderContext methods to convert from millimeters or other units to the painter's units.
bool QgsLayoutItem3DMap:: readPropertiesFromElement(const QDomElement& element,
const QDomDocument& document,
const QgsReadWriteContext& context) override protected
Sets item state from a DOM element.
| Parameters | |
|---|---|
| element | is the DOM element for the item |
| document | DOM document |
| context | read write context |
Note that item subclasses should not rely on all other items being present in the layout at the time this method is called. Instead, any connections and links to other items must be made in the finalizeRestoreFromXml() method. E.g. when restoring a scalebar, the connection to the linked map's signals should be implemented in finalizeRestoreFromXml(), not readPropertiesFromElement().
bool QgsLayoutItem3DMap:: writePropertiesToElement(QDomElement& element,
QDomDocument& document,
const QgsReadWriteContext& context) const override protected
Stores item state within an XML DOM element.
| Parameters | |
|---|---|
| element | is the DOM element to store the item's properties in |
| document | DOM document |
| context | read write context |