mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-03 00:14:12 -05:00 
			
		
		
		
	reverting 3fb0f66 (followup #45348) Using --no-public-is-protected (default on Windows) also works on Linux and fixes #45331 too
		
			
				
	
	
		
			376 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			376 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/layout/qgslayoutitemmapitem.h                               *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 | 
						|
 ************************************************************************/
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class QgsLayoutItemMapItem : QgsLayoutObject
 | 
						|
{
 | 
						|
%Docstring(signature="appended")
 | 
						|
An item which is drawn inside a :py:class:`QgsLayoutItemMap`, e.g., a grid or map overview.
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgslayoutitemmapitem.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    enum StackingPosition
 | 
						|
    {
 | 
						|
      StackBelowMap,
 | 
						|
      StackBelowMapLayer,
 | 
						|
      StackAboveMapLayer,
 | 
						|
      StackBelowMapLabels,
 | 
						|
      StackAboveMapLabels,
 | 
						|
    };
 | 
						|
 | 
						|
    QgsLayoutItemMapItem( const QString &name, QgsLayoutItemMap *map );
 | 
						|
%Docstring
 | 
						|
Constructor for QgsLayoutItemMapItem, attached to the specified ``map``.
 | 
						|
 | 
						|
The ``name`` argument gives a friendly display name for the item.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void draw( QPainter *painter ) = 0;
 | 
						|
%Docstring
 | 
						|
Draws the item on to a destination ``painter``.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
 | 
						|
%Docstring
 | 
						|
Stores map item state in a DOM element, where ``element`` is the DOM element
 | 
						|
corresponding to a 'LayoutMap' tag.
 | 
						|
 | 
						|
.. seealso:: :py:func:`readXml`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context );
 | 
						|
%Docstring
 | 
						|
Sets the map item state from a DOM document, where ``element`` is the DOM
 | 
						|
node corresponding to a 'LayoutMapGrid' tag.
 | 
						|
 | 
						|
.. seealso:: :py:func:`writeXml`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void finalizeRestoreFromXml();
 | 
						|
%Docstring
 | 
						|
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 :py:func:`~QgsLayoutItemMapItem.readXml` was called. E.g. an overview can use this to connect to its linked
 | 
						|
map item after restoration from XML.
 | 
						|
 | 
						|
.. seealso:: :py:func:`readXml`
 | 
						|
%End
 | 
						|
 | 
						|
    void setMap( QgsLayoutItemMap *map );
 | 
						|
%Docstring
 | 
						|
Sets the corresponding layout ``map`` for the item.
 | 
						|
 | 
						|
.. seealso:: :py:func:`map`
 | 
						|
%End
 | 
						|
 | 
						|
    const QgsLayoutItemMap *map() const;
 | 
						|
%Docstring
 | 
						|
Returns the layout item map for the item.
 | 
						|
 | 
						|
.. seealso:: :py:func:`setMap`
 | 
						|
%End
 | 
						|
 | 
						|
    QString id() const;
 | 
						|
%Docstring
 | 
						|
Returns the unique id for the map item.
 | 
						|
%End
 | 
						|
 | 
						|
    void setName( const QString &name );
 | 
						|
%Docstring
 | 
						|
Sets the friendly display ``name`` for the item.
 | 
						|
 | 
						|
.. seealso:: :py:func:`name`
 | 
						|
%End
 | 
						|
 | 
						|
    QString name() const;
 | 
						|
%Docstring
 | 
						|
Returns the friendly display name for the item.
 | 
						|
 | 
						|
.. seealso:: :py:func:`setName`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void setEnabled( bool enabled );
 | 
						|
%Docstring
 | 
						|
Controls whether the item will be drawn. Set ``enabled`` to ``True`` to enable drawing of the item.
 | 
						|
 | 
						|
.. seealso:: :py:func:`enabled`
 | 
						|
%End
 | 
						|
 | 
						|
    bool enabled() const;
 | 
						|
%Docstring
 | 
						|
Returns whether the item will be drawn.
 | 
						|
 | 
						|
.. seealso:: :py:func:`setEnabled`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool usesAdvancedEffects() const;
 | 
						|
%Docstring
 | 
						|
Returns ``True`` if the item is drawn using advanced effects, such as blend modes.
 | 
						|
%End
 | 
						|
 | 
						|
    StackingPosition stackingPosition() const;
 | 
						|
%Docstring
 | 
						|
Returns the item's stacking position, which specifies where the in the map's
 | 
						|
stack the item should be rendered.
 | 
						|
 | 
						|
.. seealso:: :py:func:`setStackingPosition`
 | 
						|
 | 
						|
.. seealso:: :py:func:`stackingLayer`
 | 
						|
 | 
						|
.. versionadded:: 3.6
 | 
						|
%End
 | 
						|
 | 
						|
    void setStackingPosition( StackingPosition position );
 | 
						|
%Docstring
 | 
						|
Sets the item's stacking ``position``, which specifies where the in the map's
 | 
						|
stack the item should be rendered.
 | 
						|
 | 
						|
.. seealso:: :py:func:`stackingPosition`
 | 
						|
 | 
						|
.. seealso:: :py:func:`setStackingLayer`
 | 
						|
 | 
						|
.. versionadded:: 3.6
 | 
						|
%End
 | 
						|
 | 
						|
    QgsMapLayer *stackingLayer() const;
 | 
						|
%Docstring
 | 
						|
Returns the item's stacking layer, which specifies where the in the map's
 | 
						|
stack the item should be rendered.
 | 
						|
 | 
						|
This setting is only used when :py:func:`~QgsLayoutItemMapItem.stackingPosition` is StackBelowMapLayer or
 | 
						|
StackAboveMapLayer.
 | 
						|
 | 
						|
.. seealso:: :py:func:`setStackingLayer`
 | 
						|
 | 
						|
.. seealso:: :py:func:`stackingPosition`
 | 
						|
 | 
						|
.. versionadded:: 3.6
 | 
						|
%End
 | 
						|
 | 
						|
    void setStackingLayer( QgsMapLayer *layer );
 | 
						|
%Docstring
 | 
						|
Sets the item's stacking ``layer``, which specifies where the in the map's
 | 
						|
stack the item should be rendered.
 | 
						|
 | 
						|
This setting is only used when :py:func:`~QgsLayoutItemMapItem.stackingPosition` is StackBelowMapLayer or
 | 
						|
StackAboveMapLayer.
 | 
						|
 | 
						|
.. seealso:: :py:func:`stackingLayer`
 | 
						|
 | 
						|
.. seealso:: :py:func:`setStackingPosition`
 | 
						|
 | 
						|
.. versionadded:: 3.6
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
 | 
						|
%Docstring
 | 
						|
Accepts the specified style entity ``visitor``, causing it to visit all style entities associated
 | 
						|
with the map item.
 | 
						|
 | 
						|
Returns ``True`` if the visitor should continue visiting other objects, or ``False`` if visiting
 | 
						|
should be canceled.
 | 
						|
 | 
						|
.. versionadded:: 3.10
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsMapLayer *mapLayer();
 | 
						|
%Docstring
 | 
						|
Returns the internal map layer used by this item, if available.
 | 
						|
 | 
						|
.. versionadded:: 3.10.1
 | 
						|
%End
 | 
						|
 | 
						|
    virtual QgsExpressionContext createExpressionContext() const;
 | 
						|
 | 
						|
 | 
						|
  protected:
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
class QgsLayoutItemMapItemStack
 | 
						|
{
 | 
						|
%Docstring(signature="appended")
 | 
						|
A collection of map items which are drawn above the map content in a
 | 
						|
:py:class:`QgsLayoutItemMap`. The item stack controls which items are drawn and the
 | 
						|
order they are drawn in.
 | 
						|
 | 
						|
.. seealso:: :py:class:`QgsLayoutItemMapItem`
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgslayoutitemmapitem.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
 | 
						|
    QgsLayoutItemMapItemStack( QgsLayoutItemMap *map );
 | 
						|
%Docstring
 | 
						|
Constructor for QgsLayoutItemMapItemStack, attached to the
 | 
						|
specified ``map``.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual ~QgsLayoutItemMapItemStack();
 | 
						|
 | 
						|
    int size() const;
 | 
						|
%Docstring
 | 
						|
Returns the number of items in the stack.
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) const;
 | 
						|
%Docstring
 | 
						|
Stores the state of the item stack in a DOM node, where ``element`` is the DOM element corresponding to a 'LayoutMap' tag.
 | 
						|
Returns ``True`` if write was successful.
 | 
						|
 | 
						|
.. seealso:: :py:func:`readXml`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual bool readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context ) = 0;
 | 
						|
%Docstring
 | 
						|
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.
 | 
						|
 | 
						|
.. seealso:: :py:func:`writeXml`
 | 
						|
%End
 | 
						|
 | 
						|
    virtual void finalizeRestoreFromXml();
 | 
						|
%Docstring
 | 
						|
Called after all pending items have been restored from XML. Map item stacks 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 :py:func:`~QgsLayoutItemMapItemStack.readXml` was called. E.g. an overview can use this to connect to its linked
 | 
						|
map item after restoration from XML.
 | 
						|
 | 
						|
.. seealso:: :py:func:`readXml`
 | 
						|
%End
 | 
						|
 | 
						|
    void drawItems( QPainter *painter, bool ignoreStacking = true );
 | 
						|
%Docstring
 | 
						|
Draws the items from the stack on a specified ``painter``.
 | 
						|
 | 
						|
If ``ignoreStacking`` is ``True``, then all items will be drawn, regardless
 | 
						|
of their actual stacking position settings. If it is ``False``, only items
 | 
						|
which are set to stack above the map item will be drawn.
 | 
						|
%End
 | 
						|
 | 
						|
    bool containsAdvancedEffects() const;
 | 
						|
%Docstring
 | 
						|
Returns whether any items within the stack contain advanced effects,
 | 
						|
such as blending modes.
 | 
						|
%End
 | 
						|
 | 
						|
    bool hasEnabledItems() const;
 | 
						|
%Docstring
 | 
						|
Returns ``True`` if the stack has any currently enabled items.
 | 
						|
 | 
						|
.. versionadded:: 3.10
 | 
						|
%End
 | 
						|
 | 
						|
    QgsLayoutItemMapItem *item( int index ) const;
 | 
						|
%Docstring
 | 
						|
Returns a reference to the item at the specified ``index`` within the stack.
 | 
						|
%End
 | 
						|
 | 
						|
  protected:
 | 
						|
 | 
						|
    void addItem( QgsLayoutItemMapItem *item /Transfer/ );
 | 
						|
%Docstring
 | 
						|
Adds a new map item to the stack and takes ownership of the item.
 | 
						|
The item will be added to the end of the stack, and rendered
 | 
						|
above any existing map items already present in the stack.
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   After adding an item to the stack :py:func:`~QgsLayoutItemMapItemStack.update`
 | 
						|
   should be called for the :py:class:`QgsLayoutItemMap` to prevent rendering artifacts.
 | 
						|
 | 
						|
.. seealso:: :py:func:`removeItem`
 | 
						|
%End
 | 
						|
 | 
						|
    void removeItem( const QString &itemId );
 | 
						|
%Docstring
 | 
						|
Removes an item which matching ``itemId`` from the stack and deletes the corresponding :py:class:`QgsLayoutItemMapItem`
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   After removing an item from the stack, :py:func:`~QgsLayoutItemMapItemStack.update`
 | 
						|
   should be called for the :py:class:`QgsLayoutItemMap` to prevent rendering artifacts.
 | 
						|
 | 
						|
.. seealso:: :py:func:`addItem`
 | 
						|
%End
 | 
						|
 | 
						|
    void moveItemUp( const QString &itemId );
 | 
						|
%Docstring
 | 
						|
Moves an item which matching ``itemId`` up the stack, causing it to be rendered above other items.
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   After moving an item within the stack, :py:func:`~QgsLayoutItemMapItemStack.update` should be
 | 
						|
   called for the :py:class:`QgsLayoutItemMap` to redraw the map with the new item stack order.
 | 
						|
 | 
						|
.. seealso:: :py:func:`moveItemDown`
 | 
						|
%End
 | 
						|
 | 
						|
    void moveItemDown( const QString &itemId );
 | 
						|
%Docstring
 | 
						|
Moves an item which matching ``itemId`` up the stack, causing it to be rendered above other items.
 | 
						|
 | 
						|
.. note::
 | 
						|
 | 
						|
   After moving an item within the stack, :py:func:`~QgsLayoutItemMapItemStack.update` should be
 | 
						|
   called for the :py:class:`QgsLayoutItemMap` to redraw the map with the new item stack order.
 | 
						|
 | 
						|
.. seealso:: :py:func:`moveItemUp`
 | 
						|
%End
 | 
						|
 | 
						|
    QgsLayoutItemMapItem *item( const QString &itemId ) const;
 | 
						|
%Docstring
 | 
						|
Returns a reference to an item which matching ``itemId`` within the stack.
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    QList< QgsLayoutItemMapItem * > asList() const;
 | 
						|
%Docstring
 | 
						|
Returns a list of :py:class:`QgsLayoutItemMapItems` contained by the stack.
 | 
						|
%End
 | 
						|
 | 
						|
  protected:
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    void removeItems();
 | 
						|
%Docstring
 | 
						|
Clears the item stack and deletes all :py:class:`QgsLayoutItemMapItems` contained
 | 
						|
by the stack
 | 
						|
%End
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/layout/qgslayoutitemmapitem.h                               *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 | 
						|
 ************************************************************************/
 |