QGIS/python/core/auto_generated/layertree/qgslegendpatchshape.sip.in
Nyall Dawson 3f6b490218 Sipify
2025-04-02 11:11:10 +10:00

183 lines
5.4 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layertree/qgslegendpatchshape.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsLegendPatchShape
{
%Docstring(signature="appended")
Represents a patch shape for use in map legends.
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgslegendpatchshape.h"
%End
public:
QgsLegendPatchShape();
%Docstring
Constructor for a null QgsLegendPatchShape.
A null QgsLegendPatchShape indicates that the default legend patch shape
should be used instead.
%End
QgsLegendPatchShape( Qgis::SymbolType type,
const QgsGeometry &geometry,
bool preserveAspectRatio = true );
%Docstring
Constructor for QgsLegendPatchShape.
The ``type`` argument specifies the symbol type associated with this
patch.
The ``geometry`` argument gives the shape of the patch to render. See
:py:func:`~QgsLegendPatchShape.setGeometry` for further details on the
geometry requirements.
If ``preserveAspectRatio`` is ``True``, then the patch shape should
preserve its aspect ratio when it is resized to fit a desired legend
patch size.
%End
bool isNull() const;
%Docstring
Returns ``True`` if the patch shape is a null QgsLegendPatchShape, which
indicates that the default legend patch shape should be used instead.
%End
Qgis::SymbolType symbolType() const;
%Docstring
Returns the symbol type associated with this patch.
.. seealso:: :py:func:`setSymbolType`
%End
void setSymbolType( Qgis::SymbolType type );
%Docstring
Sets the symbol ``type`` associated with this patch.
.. seealso:: :py:func:`symbolType`
%End
QgsGeometry geometry() const;
%Docstring
Returns the geometry for the patch shape.
.. seealso:: :py:func:`setGeometry`
%End
void setGeometry( const QgsGeometry &geometry );
%Docstring
Sets the ``geometry`` for the patch shape.
The origin and size of the ``geometry`` is not important, as the legend
renderer will automatically scale and transform the geometry to match
the desired overall patch bounds.
Geometries for legend patches are rendered respecting the traditional "y
values increase toward the top of the map" convention, as opposed to the
standard computer graphics convention of "y values increase toward the
bottom of the display".
.. warning::
The geometry type should match the patch shape's :py:func:`~QgsLegendPatchShape.symbolType`,
e.g. a fill symbol type should only have Polygon or MultiPolygon geometries
set, while a line symbol type must have LineString or MultiLineString geometries.
.. seealso:: :py:func:`geometry`
%End
bool preserveAspectRatio() const;
%Docstring
Returns ``True`` if the patch shape should preserve its aspect ratio
when it is resized to fit a desired legend patch size.
.. seealso:: :py:func:`setPreserveAspectRatio`
%End
void setPreserveAspectRatio( bool preserve );
%Docstring
Sets whether the patch shape should ``preserve`` its aspect ratio when
it is resized to fit a desired legend patch size.
The default behavior is to respect the
:py:func:`~QgsLegendPatchShape.geometry`'s aspect ratio.
.. seealso:: :py:func:`setPreserveAspectRatio`
%End
bool scaleToOutputSize() const;
%Docstring
Returns ``True`` if the patch shape should by resized to the desired
target size when rendering.
Resizing to the target size is the default behavior.
.. seealso:: :py:func:`setScaleToOutputSize`
.. versionadded:: 3.22
%End
void setScaleToOutputSize( bool scale );
%Docstring
Sets whether the patch shape should by resized to the desired target
size when rendering.
Resizing to the target size is the default behavior.
.. seealso:: :py:func:`scaleToOutputSize`
.. versionadded:: 3.22
%End
QgsGeometry scaledGeometry( QSizeF size ) const;
%Docstring
Returns the patch shape's geometry, scaled to the given size.
Note that if :py:func:`~QgsLegendPatchShape.scaleToOutputSize` is
``False`` then no scaling will be applied.
.. versionadded:: 3.22
%End
QList< QList< QPolygonF > > toQPolygonF( Qgis::SymbolType type, QSizeF size ) const;
%Docstring
Converts the patch shape to a set of QPolygonF objects representing how
the patch should be drawn for a symbol of the given ``type`` at the
specified ``size`` (as geometry parts and rings).
%End
void readXml( const QDomElement &element, const QgsReadWriteContext &context );
%Docstring
Read settings from a DOM ``element``.
.. seealso:: :py:func:`writeXml`
%End
void writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
Write settings into a DOM ``element``.
.. seealso:: :py:func:`readXml`
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layertree/qgslegendpatchshape.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/