QGIS/python/PyQt6/core/auto_generated/qgsdiagramrenderer.sip.in

880 lines
22 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsdiagramrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsDiagramLayerSettings
{
%Docstring(signature="appended")
Stores the settings for rendering of all diagrams for a layer.
:py:class:`QgsDiagramSettings` stores the settings related to rendering the individual diagrams themselves, while
:py:class:`QgsDiagramLayerSettings` stores settings which control how ALL diagrams within a layer are rendered.
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
enum Placement /BaseType=IntEnum/
{
AroundPoint,
OverPoint,
Line,
Curved,
Horizontal,
Free
};
enum LinePlacementFlag /BaseType=IntEnum/
{
OnLine,
AboveLine,
BelowLine,
MapOrientation,
};
typedef QFlags<QgsDiagramLayerSettings::LinePlacementFlag> LinePlacementFlags;
enum class Property /BaseType=IntEnum/
{
BackgroundColor,
StrokeColor,
StrokeWidth,
PositionX,
PositionY,
Distance,
Priority,
ZIndex,
IsObstacle,
Show,
AlwaysShow,
StartAngle,
};
static const QgsPropertiesDefinition &propertyDefinitions();
%Docstring
Returns the diagram property definitions.
%End
QgsDiagramLayerSettings();
%Docstring
Constructor for QgsDiagramLayerSettings.
%End
QgsDiagramLayerSettings( const QgsDiagramLayerSettings &rh );
%Docstring
Copy constructor
%End
~QgsDiagramLayerSettings();
Placement placement() const;
%Docstring
Returns the diagram placement.
.. seealso:: :py:func:`setPlacement`
%End
void setPlacement( Placement value );
%Docstring
Sets the diagram placement.
:param value: placement value
.. seealso:: :py:func:`placement`
%End
LinePlacementFlags linePlacementFlags() const;
%Docstring
Returns the diagram placement flags. These are only used if the diagram placement
is set to a line type.
.. seealso:: :py:func:`setLinePlacementFlags`
%End
void setLinePlacementFlags( LinePlacementFlags flags );
%Docstring
Sets the the diagram placement flags. These are only used if the diagram placement
is set to a line type.
:param flags: placement value
.. seealso:: :py:func:`linePlacementFlags`
%End
int priority() const;
%Docstring
Returns the diagram priority.
:return: diagram priority, where 0 = low and 10 = high
.. note::
placement priority is shared with labeling, so diagrams with a high priority may displace labels
and vice-versa
.. seealso:: :py:func:`setPriority`
%End
void setPriority( int value );
%Docstring
Sets the diagram priority.
:param value: priority, where 0 = low and 10 = high
.. seealso:: :py:func:`priority`
%End
double zIndex() const;
%Docstring
Returns the diagram z-index. Diagrams (or labels) with a higher z-index are drawn over diagrams
with a lower z-index.
.. note::
z-index ordering is shared with labeling, so diagrams with a high z-index may be drawn over labels
with a low z-index and vice-versa
.. seealso:: :py:func:`setZIndex`
%End
void setZIndex( double index );
%Docstring
Sets the diagram z-index. Diagrams (or labels) with a higher z-index are drawn over diagrams
with a lower z-index.
:param index: diagram z-index
.. seealso:: :py:func:`zIndex`
%End
bool isObstacle() const;
%Docstring
Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.
.. seealso:: :py:func:`setIsObstacle`
%End
void setIsObstacle( bool isObstacle );
%Docstring
Sets whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.
:param isObstacle: set to ``True`` for feature to act as obstacle
.. seealso:: :py:func:`isObstacle`
%End
double distance() const;
%Docstring
Returns the distance between the diagram and the feature (in mm).
.. seealso:: :py:func:`setDistance`
%End
void setDistance( double distance );
%Docstring
Sets the distance between the diagram and the feature.
:param distance: distance in mm
.. seealso:: :py:func:`distance`
%End
QgsDiagramRenderer *renderer();
%Docstring
Returns the diagram renderer associated with the layer.
.. seealso:: :py:func:`setRenderer`
%End
void setRenderer( QgsDiagramRenderer *diagramRenderer /Transfer/ );
%Docstring
Sets the diagram renderer associated with the layer.
:param diagramRenderer: diagram renderer. Ownership is transferred to the object.
.. seealso:: :py:func:`renderer`
%End
QgsCoordinateTransform coordinateTransform() const;
%Docstring
Returns the coordinate transform associated with the layer, or an
invalid transform if no transformation is required.
.. seealso:: :py:func:`setCoordinateTransform`
%End
void setCoordinateTransform( const QgsCoordinateTransform &transform );
%Docstring
Sets the coordinate transform associated with the layer.
:param transform: coordinate transform. Ownership is transferred to the object.
.. seealso:: :py:func:`coordinateTransform`
%End
bool showAllDiagrams() const;
%Docstring
Returns whether the layer should show all diagrams, including overlapping diagrams
.. seealso:: :py:func:`setShowAllDiagrams`
%End
void setShowAllDiagrams( bool showAllDiagrams );
%Docstring
Sets whether the layer should show all diagrams, including overlapping diagrams
:param showAllDiagrams: set to ``True`` to show all diagrams
.. seealso:: :py:func:`showAllDiagrams`
%End
void readXml( const QDomElement &elem );
%Docstring
Reads the diagram settings from a DOM element.
.. seealso:: :py:func:`writeXml`
%End
void writeXml( QDomElement &layerElem, QDomDocument &doc ) const;
%Docstring
Writes the diagram settings to a DOM element.
.. seealso:: :py:func:`readXml`
%End
bool prepare( const QgsExpressionContext &context = QgsExpressionContext() ) const;
%Docstring
Prepares the diagrams for a specified expression context. Calling prepare before rendering
multiple diagrams allows precalculation of expensive setup tasks such as parsing expressions.
Returns ``True`` if preparation was successful.
%End
QSet< QString > referencedFields( const QgsExpressionContext &context = QgsExpressionContext() ) const;
%Docstring
Returns the set of any fields referenced by the layer's diagrams.
:param context: expression context the diagrams will be drawn using
%End
QgsPropertyCollection &dataDefinedProperties();
%Docstring
Returns a reference to the diagram's property collection, used for data defined overrides.
.. seealso:: :py:func:`setDataDefinedProperties`
%End
void setDataDefinedProperties( const QgsPropertyCollection &collection );
%Docstring
Sets the diagram's property collection, used for data defined overrides.
:param collection: property collection. Existing properties will be replaced.
.. seealso:: :py:func:`dataDefinedProperties`
.. seealso:: Property
%End
};
class QgsDiagramSettings
{
%Docstring(signature="appended")
Stores the settings for rendering a single diagram.
:py:class:`QgsDiagramSettings` stores the settings related to rendering the individual diagrams themselves, while
QgsDiagramLayerSettings stores settings which control how ALL diagrams within a layer are rendered.
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
enum LabelPlacementMethod /BaseType=IntEnum/
{
Height,
XHeight
};
enum DiagramOrientation /BaseType=IntEnum/
{
Up,
Down,
Left,
Right
};
enum Direction /BaseType=IntEnum/
{
Clockwise,
Counterclockwise,
};
QgsDiagramSettings();
%Docstring
Constructor for QgsDiagramSettings
%End
~QgsDiagramSettings();
QgsDiagramSettings( const QgsDiagramSettings &other );
%Docstring
Copy constructor
%End
bool enabled;
QFont font;
QList< QColor > categoryColors;
QList< QString > categoryAttributes;
QList< QString > categoryLabels;
QSizeF size; //size
Qgis::RenderUnit sizeType;
QgsMapUnitScale sizeScale;
Qgis::RenderUnit lineSizeUnit;
QgsMapUnitScale lineSizeScale;
QColor backgroundColor;
QColor penColor;
double penWidth;
LabelPlacementMethod labelPlacementMethod;
DiagramOrientation diagramOrientation;
double barWidth;
double opacity;
bool scaleByArea;
double rotationOffset;
bool scaleBasedVisibility;
double maximumScale;
double minimumScale;
double minimumSize;
double spacing() const;
%Docstring
Returns the spacing between diagram contents.
Spacing units can be retrieved by calling :py:func:`~QgsDiagramSettings.spacingUnit`.
.. seealso:: :py:func:`setSpacing`
.. seealso:: :py:func:`spacingUnit`
.. seealso:: :py:func:`spacingMapUnitScale`
.. versionadded:: 3.12
%End
void setSpacing( double spacing );
%Docstring
Sets the ``spacing`` between diagram contents.
Spacing units are set via :py:func:`~QgsDiagramSettings.setSpacingUnit`.
.. seealso:: :py:func:`spacing`
.. seealso:: :py:func:`setSpacingUnit`
.. seealso:: :py:func:`setSpacingMapUnitScale`
.. versionadded:: 3.12
%End
void setSpacingUnit( Qgis::RenderUnit unit );
%Docstring
Sets the ``unit`` for the content spacing.
.. seealso:: :py:func:`spacingUnit`
.. seealso:: :py:func:`setSpacing`
.. seealso:: :py:func:`setSpacingMapUnitScale`
.. versionadded:: 3.12
%End
Qgis::RenderUnit spacingUnit() const;
%Docstring
Returns the units for the content spacing.
.. seealso:: :py:func:`setSpacingUnit`
.. seealso:: :py:func:`spacing`
.. seealso:: :py:func:`spacingMapUnitScale`
.. versionadded:: 3.12
%End
void setSpacingMapUnitScale( const QgsMapUnitScale &scale );
%Docstring
Sets the map unit ``scale`` for the content spacing.
.. seealso:: :py:func:`spacingMapUnitScale`
.. seealso:: :py:func:`setSpacing`
.. seealso:: :py:func:`setSpacingUnit`
.. versionadded:: 3.12
%End
const QgsMapUnitScale &spacingMapUnitScale() const;
%Docstring
Returns the map unit scale for the content spacing.
.. seealso:: :py:func:`setSpacingMapUnitScale`
.. seealso:: :py:func:`spacing`
.. seealso:: :py:func:`spacingUnit`
.. versionadded:: 3.12
%End
Direction direction() const;
%Docstring
Returns the chart's angular direction.
.. seealso:: :py:func:`setDirection`
.. versionadded:: 3.12
%End
void setDirection( Direction direction );
%Docstring
Sets the chart's angular ``direction``.
.. seealso:: :py:func:`direction`
.. versionadded:: 3.12
%End
void readXml( const QDomElement &elem, const QgsReadWriteContext &context = QgsReadWriteContext() );
%Docstring
Reads diagram settings from XML
%End
void writeXml( QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context = QgsReadWriteContext() ) const;
%Docstring
Writes diagram settings to XML
%End
QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/;
%Docstring
Returns list of legend nodes for the diagram
.. note::
caller is responsible for deletion of :py:class:`QgsLayerTreeModelLegendNodes`
%End
QgsLineSymbol *axisLineSymbol() const;
%Docstring
Returns the line symbol to use for rendering axis in diagrams.
.. seealso:: :py:func:`setAxisLineSymbol`
.. seealso:: :py:func:`showAxis`
.. versionadded:: 3.12
%End
void setAxisLineSymbol( QgsLineSymbol *symbol /Transfer/ );
%Docstring
Sets the line ``symbol`` to use for rendering axis in diagrams.
Ownership of ``symbol`` is transferred to the settings.
.. seealso:: :py:func:`axisLineSymbol`
.. seealso:: :py:func:`setShowAxis`
.. versionadded:: 3.12
%End
bool showAxis() const;
%Docstring
Returns ``True`` if the diagram axis should be shown.
.. seealso:: :py:func:`setShowAxis`
.. seealso:: :py:func:`axisLineSymbol`
.. versionadded:: 3.12
%End
void setShowAxis( bool showAxis );
%Docstring
Sets whether the diagram axis should be shown.
.. seealso:: :py:func:`showAxis`
.. seealso:: :py:func:`setAxisLineSymbol`
.. versionadded:: 3.12
%End
QgsPaintEffect *paintEffect() const;
%Docstring
Returns the paint effect to use while rendering diagrams.
.. seealso:: :py:func:`setPaintEffect`
.. versionadded:: 3.12
%End
void setPaintEffect( QgsPaintEffect *effect /Transfer/ );
%Docstring
Sets the paint ``effect`` to use while rendering diagrams.
Ownership of ``effect`` is transferred to the settings.
.. seealso:: :py:func:`paintEffect`
.. versionadded:: 3.12
%End
};
class QgsDiagramInterpolationSettings
{
%Docstring(signature="appended")
Additional diagram settings for interpolated size rendering.
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
QSizeF lowerSize;
QSizeF upperSize;
double lowerValue;
double upperValue;
QString classificationField;
QString classificationAttributeExpression;
bool classificationAttributeIsExpression;
};
class QgsDiagramRenderer
{
%Docstring(signature="appended")
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
%ConvertToSubClassCode
if ( sipCpp->rendererName() == QLatin1String( "SingleCategory" ) )
sipType = sipType_QgsSingleCategoryDiagramRenderer;
else if ( sipCpp->rendererName() == QLatin1String( "LinearlyInterpolated" ) )
sipType = sipType_QgsLinearlyInterpolatedDiagramRenderer;
else
sipType = NULL;
%End
public:
QgsDiagramRenderer();
%Docstring
Constructor for QgsDiagramRenderer.
%End
virtual ~QgsDiagramRenderer();
virtual QgsDiagramRenderer *clone() const = 0 /Factory/;
%Docstring
Returns new instance that is equivalent to this one
%End
virtual QSizeF sizeMapUnits( const QgsFeature &feature, const QgsRenderContext &c ) const;
%Docstring
Returns size of the diagram for a feature in map units. Returns an invalid QSizeF in case of error
%End
virtual QString rendererName() const = 0;
virtual QList<QString> diagramAttributes() const = 0;
%Docstring
Returns attribute indices needed for diagram rendering
%End
virtual QSet< QString > referencedFields( const QgsExpressionContext &context = QgsExpressionContext() ) const;
%Docstring
Returns the set of any fields required for diagram rendering
:param context: expression context the diagrams will be drawn using
%End
void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, QPointF pos, const QgsPropertyCollection &properties = QgsPropertyCollection() ) const;
%Docstring
Renders the diagram for a specified feature at a specific position in the passed render context.
%End
void setDiagram( QgsDiagram *d /Transfer/ );
QgsDiagram *diagram() const;
virtual QList<QgsDiagramSettings> diagramSettings() const = 0;
%Docstring
Returns list with all diagram settings in the renderer
%End
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0;
%Docstring
Reads diagram state from a DOM element. Subclasses should ensure that _readXml() is called
by their readXml implementation to restore the general QgsDiagramRenderer settings.
.. seealso:: :py:func:`writeXml`
%End
virtual void writeXml( QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context ) const = 0;
%Docstring
Writes diagram state to a DOM element. Subclasses should ensure that _writeXml() is called
by their writeXml implementation to save the general QgsDiagramRenderer settings.
.. seealso:: :py:func:`readXml`
%End
virtual QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/;
%Docstring
Returns list of legend nodes for the diagram
.. note::
caller is responsible for deletion of :py:class:`QgsLayerTreeModelLegendNodes`
%End
bool attributeLegend() const;
%Docstring
Returns ``True`` if renderer will show legend items for diagram attributes.
.. seealso:: :py:func:`setAttributeLegend`
%End
void setAttributeLegend( bool enabled );
%Docstring
Sets whether the renderer will show legend items for diagram attributes.
:param enabled: set to ``True`` to show diagram attribute legend
.. seealso:: :py:func:`attributeLegend`
%End
protected:
QgsDiagramRenderer( const QgsDiagramRenderer &other );
virtual bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const = 0;
%Docstring
Returns diagram settings for a feature (or ``False`` if the diagram for the feature is not to be rendered). Used internally within :py:func:`~QgsDiagramRenderer.renderDiagram`
:param feature: the feature
:param c: render context
:param s: out: diagram settings for the feature
%End
virtual QSizeF diagramSize( const QgsFeature &features, const QgsRenderContext &c ) const = 0;
%Docstring
Returns size of the diagram (in painter units) or an invalid size in case of error
%End
void convertSizeToMapUnits( QSizeF &size, const QgsRenderContext &context ) const;
%Docstring
Converts size from mm to map units
%End
static int dpiPaintDevice( const QPainter * );
%Docstring
Returns the paint device dpi (or -1 in case of error
%End
void _readXml( const QDomElement &elem, const QgsReadWriteContext &context );
%Docstring
Reads internal QgsDiagramRenderer state from a DOM element.
.. seealso:: _writeXml
%End
void _writeXml( QDomElement &rendererElem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
Writes internal QgsDiagramRenderer diagram state to a DOM element.
.. seealso:: _readXml
%End
};
class QgsSingleCategoryDiagramRenderer : QgsDiagramRenderer
{
%Docstring(signature="appended")
Renders the diagrams for all features with the same settings
%End
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
QgsSingleCategoryDiagramRenderer();
%Docstring
Constructor for QgsSingleCategoryDiagramRenderer
%End
virtual QgsSingleCategoryDiagramRenderer *clone() const /Factory/;
virtual QString rendererName() const;
virtual QList<QString> diagramAttributes() const;
void setDiagramSettings( const QgsDiagramSettings &s );
virtual QList<QgsDiagramSettings> diagramSettings() const;
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
virtual void writeXml( QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
virtual QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/;
protected:
virtual bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const;
virtual QSizeF diagramSize( const QgsFeature &, const QgsRenderContext &c ) const;
};
class QgsLinearlyInterpolatedDiagramRenderer : QgsDiagramRenderer
{
%TypeHeaderCode
#include "qgsdiagramrenderer.h"
%End
public:
QgsLinearlyInterpolatedDiagramRenderer();
~QgsLinearlyInterpolatedDiagramRenderer();
QgsLinearlyInterpolatedDiagramRenderer( const QgsLinearlyInterpolatedDiagramRenderer &other );
%Docstring
Copy constructor
%End
virtual QgsLinearlyInterpolatedDiagramRenderer *clone() const /Factory/;
virtual QList<QgsDiagramSettings> diagramSettings() const;
%Docstring
Returns list with all diagram settings in the renderer
%End
void setDiagramSettings( const QgsDiagramSettings &s );
virtual QList<QString> diagramAttributes() const;
virtual QSet< QString > referencedFields( const QgsExpressionContext &context = QgsExpressionContext() ) const;
virtual QString rendererName() const;
void setLowerValue( double val );
double lowerValue() const;
void setUpperValue( double val );
double upperValue() const;
void setLowerSize( QSizeF s );
QSizeF lowerSize() const;
void setUpperSize( QSizeF s );
QSizeF upperSize() const;
QString classificationField() const;
%Docstring
Returns the field name used for interpolating the diagram size.
.. seealso:: :py:func:`setClassificationField`
%End
void setClassificationField( const QString &field );
%Docstring
Sets the field name used for interpolating the diagram size.
.. seealso:: :py:func:`classificationField`
%End
QString classificationAttributeExpression() const;
void setClassificationAttributeExpression( const QString &expression );
bool classificationAttributeIsExpression() const;
void setClassificationAttributeIsExpression( bool isExpression );
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
virtual void writeXml( QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
virtual QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/;
void setDataDefinedSizeLegend( QgsDataDefinedSizeLegend *settings /Transfer/ );
%Docstring
Configures appearance of legend. Takes ownership of the passed settings objects.
%End
QgsDataDefinedSizeLegend *dataDefinedSizeLegend() const;
%Docstring
Returns configuration of appearance of legend. Will return ``None`` if no configuration has been set.
%End
protected:
virtual bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const;
virtual QSizeF diagramSize( const QgsFeature &, const QgsRenderContext &c ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsdiagramrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/