diff --git a/python/auto_sip.blacklist b/python/auto_sip.blacklist index 50014fa1ee6..ac1515b5810 100644 --- a/python/auto_sip.blacklist +++ b/python/auto_sip.blacklist @@ -42,11 +42,6 @@ core/composer/qgspaperitem.sip core/composer/qgsscalebarstyle.sip core/composer/qgssingleboxscalebarstyle.sip core/composer/qgsticksscalebarstyle.sip -core/diagram/qgsdiagram.sip -core/diagram/qgshistogramdiagram.sip -core/diagram/qgspiediagram.sip -core/diagram/qgstextdiagram.sip -core/qgsdiagramrenderer.sip core/effects/qgsblureffect.sip core/effects/qgscoloreffect.sip core/effects/qgseffectstack.sip diff --git a/python/core/diagram/qgsdiagram.sip b/python/core/diagram/qgsdiagram.sip index 2cbdd7a6704..e5c7036287b 100644 --- a/python/core/diagram/qgsdiagram.sip +++ b/python/core/diagram/qgsdiagram.sip @@ -1,81 +1,135 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/diagram/qgsdiagram.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + class QgsDiagram { +%Docstring + Base class for all diagram types* +%End + %TypeHeaderCode -#include +#include "qgsdiagram.h" %End public: virtual ~QgsDiagram(); - /** Returns an instance that is equivalent to this one - * @note added in 2.4 */ + virtual QgsDiagram *clone() const = 0 /Factory/; +%Docstring + Returns an instance that is equivalent to this one +.. versionadded:: 2.4 + :rtype: QgsDiagram +%End void clearCache(); - /** Returns a prepared expression for the specified context. - * @param expression expression string - * @param context expression context - * @note added in QGIS 2.12 - */ QgsExpression *getExpression( const QString &expression, const QgsExpressionContext &context ); +%Docstring + Returns a prepared expression for the specified context. + \param expression expression string + \param context expression context +.. versionadded:: 2.12 + :rtype: QgsExpression +%End - /** Draws the diagram at the given position (in pixel coordinates)*/ virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ) = 0; - virtual QString diagramName() const = 0; - /** Returns the size in map units the diagram will use to render.*/ - virtual QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ) = 0; - /** Returns the size in map units the diagram will use to render. Interpolate size*/ - virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) = 0; +%Docstring +Draws the diagram at the given position (in pixel coordinates) +%End + + virtual QString diagramName() const = 0; +%Docstring + Get a descriptive name for this diagram type. + :rtype: str +%End + virtual QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ) = 0; +%Docstring +Returns the size in map units the diagram will use to render. + :rtype: QSizeF +%End + virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) = 0; +%Docstring +Returns the size in map units the diagram will use to render. Interpolate size + :rtype: QSizeF +%End - /** Returns the size of the legend item for the diagram corresponding to a specified value. - * @param value value to return legend item size for - * @param s diagram settings - * @param is interpolation settings - * @note added in QGIS 2.16 - */ virtual double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const = 0; +%Docstring + Returns the size of the legend item for the diagram corresponding to a specified value. + \param value value to return legend item size for + \param s diagram settings + \param is interpolation settings +.. versionadded:: 2.16 + :rtype: float +%End protected: QgsDiagram(); QgsDiagram( const QgsDiagram &other ); - /** Changes the pen width to match the current settings and rendering context - * @param pen The pen to modify - * @param s The settings that specify the pen width - * @param c The rendering specifying the proper scale units for pixel conversion - */ void setPenWidth( QPen &pen, const QgsDiagramSettings &s, const QgsRenderContext &c ); +%Docstring + Changes the pen width to match the current settings and rendering context + \param pen The pen to modify + \param s The settings that specify the pen width + \param c The rendering specifying the proper scale units for pixel conversion +%End - /** Calculates a size to match the current settings and rendering context - * @param size The size to convert - * @param s The settings that specify the size type - * @param c The rendering specifying the proper scale units for pixel conversion - * - * @return The converted size for rendering - */ QSizeF sizePainterUnits( QSizeF size, const QgsDiagramSettings &s, const QgsRenderContext &c ); +%Docstring + Calculates a size to match the current settings and rendering context + \param size The size to convert + \param s The settings that specify the size type + \param c The rendering specifying the proper scale units for pixel conversion + + :return: The converted size for rendering + :rtype: QSizeF +%End - /** Calculates a length to match the current settings and rendering context - * @param l The length to convert - * @param s Unused - * @param c The rendering specifying the proper scale units for pixel conversion - * - * @return The converted length for rendering - */ double sizePainterUnits( double l, const QgsDiagramSettings &s, const QgsRenderContext &c ); +%Docstring + Calculates a length to match the current settings and rendering context + \param l The length to convert + \param s Unused + \param c The rendering specifying the proper scale units for pixel conversion + + :return: The converted length for rendering + :rtype: float +%End - /** Calculates a size to match the current settings and rendering context - * @param s The settings that contain the font size and size type - * @param c The rendering specifying the proper scale units for pixel conversion - * - * @return The properly scaled font for rendering - */ QFont scaledFont( const QgsDiagramSettings &s, const QgsRenderContext &c ); +%Docstring + Calculates a size to match the current settings and rendering context + \param s The settings that contain the font size and size type + \param c The rendering specifying the proper scale units for pixel conversion + + :return: The properly scaled font for rendering + :rtype: QFont +%End - /** Returns the scaled size of a diagram for a value, respecting the specified diagram interpolation settings. - * @param value value to calculate corresponding circular size for - * @param s diagram settings - * @param is interpolation settings - * @note added in QGIS 2.16 - */ QSizeF sizeForValue( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const; +%Docstring + Returns the scaled size of a diagram for a value, respecting the specified diagram interpolation settings. + \param value value to calculate corresponding circular size for + \param s diagram settings + \param is interpolation settings +.. versionadded:: 2.16 + :rtype: QSizeF +%End + }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/diagram/qgsdiagram.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/diagram/qgshistogramdiagram.sip b/python/core/diagram/qgshistogramdiagram.sip index 77a9329539e..bea7e92cd5f 100644 --- a/python/core/diagram/qgshistogramdiagram.sip +++ b/python/core/diagram/qgshistogramdiagram.sip @@ -1,18 +1,45 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/diagram/qgshistogramdiagram.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + + + class QgsHistogramDiagram: QgsDiagram { + %TypeHeaderCode -#include +#include "qgshistogramdiagram.h" %End public: QgsHistogramDiagram(); - ~QgsHistogramDiagram(); virtual QgsHistogramDiagram *clone() const /Factory/; - void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ); + virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ); + + + virtual QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ); + + virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ); + + virtual double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const; + + virtual QString diagramName() const; - QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ); - QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ); - double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const; - QString diagramName() const; }; + + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/diagram/qgshistogramdiagram.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/diagram/qgspiediagram.sip b/python/core/diagram/qgspiediagram.sip index 301cec1020a..1c54b875c16 100644 --- a/python/core/diagram/qgspiediagram.sip +++ b/python/core/diagram/qgspiediagram.sip @@ -1,18 +1,42 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/diagram/qgspiediagram.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + class QgsPieDiagram: QgsDiagram { + %TypeHeaderCode -#include +#include "qgspiediagram.h" %End public: QgsPieDiagram(); - ~QgsPieDiagram(); virtual QgsPieDiagram *clone() const /Factory/; - void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ); + virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ); + + + virtual QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ); + + virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ); + + virtual double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const; + + virtual QString diagramName() const; - QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ); - QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ); - double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const; - QString diagramName() const; }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/diagram/qgspiediagram.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/diagram/qgstextdiagram.sip b/python/core/diagram/qgstextdiagram.sip index 2ff5148a8a1..cca962b8927 100644 --- a/python/core/diagram/qgstextdiagram.sip +++ b/python/core/diagram/qgstextdiagram.sip @@ -1,9 +1,20 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/diagram/qgstextdiagram.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + class QgsTextDiagram: QgsDiagram { -%TypeHeaderCode -#include -%End +%TypeHeaderCode +#include "qgstextdiagram.h" +%End public: enum Shape { @@ -19,14 +30,26 @@ class QgsTextDiagram: QgsDiagram }; QgsTextDiagram(); - ~QgsTextDiagram(); virtual QgsTextDiagram *clone() const /Factory/; - void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ); + virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ); - QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ); - QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ); - double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const; - QString diagramName() const; + virtual QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ); + + virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ); + + virtual double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const; + + + virtual QString diagramName() const; + }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/diagram/qgstextdiagram.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/qgsdiagramrenderer.sip b/python/core/qgsdiagramrenderer.sip index f346340666b..92cf08f9a63 100644 --- a/python/core/qgsdiagramrenderer.sip +++ b/python/core/qgsdiagramrenderer.sip @@ -1,30 +1,41 @@ -/** \ingroup core - * \class QgsDiagramLayerSettings - * \brief Stores the settings for rendering of all diagrams for a layer. - * - * 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. - */ +/************************************************************************ + * 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 { -%TypeHeaderCode -#include +%Docstring + Stores the settings for rendering of all diagrams for a layer. + + 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: - //avoid inclusion of QgsPalLabeling + enum Placement { - AroundPoint, // Point / Polygon - OverPoint, // Point / Polygon - Line, // Line / Polygon - Curved, // Line - Horizontal, // Polygon - Free // Polygon + AroundPoint, + OverPoint, + Line, + Curved, + Horizontal, + Free }; - //! Line placement flags for controlling line based placements enum LinePlacementFlag { OnLine, @@ -34,202 +45,262 @@ class QgsDiagramLayerSettings }; typedef QFlags LinePlacementFlags; - /** Data definable properties. - * @note added in QGIS 2.16 - */ + enum Property { - BackgroundColor, /*!< Diagram background color */ - StrokeColor, /*!< Stroke color */ - StrokeWidth, /*!< Stroke width */ - PositionX, /*! x-coordinate data defined diagram position */ - PositionY, /*! y-coordinate data defined diagram position */ - Distance, /*! Distance to diagram from feature */ - Priority, /*! Diagram priority (between 0 and 10) */ - ZIndex, /*! Z-index for diagram ordering */ - IsObstacle, /*! Whether diagram features act as obstacles for other diagrams/labels */ - Show, /*! Whether to show the diagram */ - AlwaysShow, /*! Whether the diagram should always be shown, even if it overlaps other diagrams/labels */ - StartAngle, /*! Angle offset for pie diagram */ + BackgroundColor, + StrokeColor, + StrokeWidth, + PositionX, + PositionY, + Distance, + Priority, + ZIndex, + IsObstacle, + Show, + AlwaysShow, + StartAngle, }; - /** - * Returns the diagram property definitions. - * @note added in QGIS 3.0 - */ static const QgsPropertiesDefinition &propertyDefinitions(); +%Docstring + Returns the diagram property definitions. +.. versionadded:: 3.0 + :rtype: QgsPropertiesDefinition +%End QgsDiagramLayerSettings(); +%Docstring + Constructor for QgsDiagramLayerSettings. +%End - //! Copy constructor QgsDiagramLayerSettings( const QgsDiagramLayerSettings &rh ); +%Docstring +Copy constructor +%End + ~QgsDiagramLayerSettings(); - /** Returns the diagram placement. - * @see setPlacement() - * @note added in QGIS 2.16 - */ Placement placement() const; +%Docstring + Returns the diagram placement. +.. seealso:: setPlacement() +.. versionadded:: 2.16 + :rtype: Placement +%End - /** Sets the diagram placement. - * @param value placement value - * @see getPlacement() - * @note added in QGIS 2.16 - */ void setPlacement( Placement value ); +%Docstring + Sets the diagram placement. + \param value placement value +.. seealso:: placement() +.. versionadded:: 2.16 +%End - /** Returns the diagram placement flags. These are only used if the diagram placement - * is set to a line type. - * @see setLinePlacementFlags() - * @note added in QGIS 2.16 - */ LinePlacementFlags linePlacementFlags() const; +%Docstring + Returns the diagram placement flags. These are only used if the diagram placement + is set to a line type. +.. seealso:: setLinePlacementFlags() +.. versionadded:: 2.16 + :rtype: LinePlacementFlags +%End - /** Sets the the diagram placement flags. These are only used if the diagram placement - * is set to a line type. - * @param flags placement value - * @see getPlacement() - * @note added in QGIS 2.16 - */ 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:: getPlacement() +.. versionadded:: 2.16 +%End - /** Returns the diagram priority. - * @returns 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 - * @see setPriority() - * @note added in QGIS 2.16 - */ 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:: setPriority() +.. versionadded:: 2.16 + :rtype: int +%End - /** Sets the diagram priority. - * @param value priority, where 0 = low and 10 = high - * @see getPriority() - * @note added in QGIS 2.16 - */ void setPriority( int value ); +%Docstring + Sets the diagram priority. + \param value priority, where 0 = low and 10 = high +.. seealso:: priority() +.. versionadded:: 2.16 +%End - /** 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 - * @see setZIndex() - * @note added in QGIS 2.16 - */ 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:: setZIndex() +.. versionadded:: 2.16 + :rtype: float +%End - /** 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 - * @see getZIndex() - * @note added in QGIS 2.16 - */ 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:: zIndex() +.. versionadded:: 2.16 +%End - /** Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagrams. - * @see setIsObstacle() - * @note added in QGIS 2.16 - */ bool isObstacle() const; +%Docstring + Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagrams. +.. seealso:: setIsObstacle() +.. versionadded:: 2.16 + :rtype: bool +%End - /** 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 - * @see isObstacle() - * @note added in QGIS 2.16 - */ 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:: isObstacle() +.. versionadded:: 2.16 +%End - /** Returns the distance between the diagram and the feature (in mm). - * @see setDistance() - * @note added in QGIS 2.16 - */ double distance() const; +%Docstring + Returns the distance between the diagram and the feature (in mm). +.. seealso:: setDistance() +.. versionadded:: 2.16 + :rtype: float +%End - /** Sets the distance between the diagram and the feature. - * @param distance distance in mm - * @see distance() - * @note added in QGIS 2.16 - */ void setDistance( double distance ); +%Docstring + Sets the distance between the diagram and the feature. + \param distance distance in mm +.. seealso:: distance() +.. versionadded:: 2.16 +%End - /** Returns the diagram renderer associated with the layer. - * @see setRenderer() - * @note added in QGIS 2.16 - */ QgsDiagramRenderer *renderer(); +%Docstring + Returns the diagram renderer associated with the layer. +.. seealso:: setRenderer() +.. versionadded:: 2.16 + :rtype: QgsDiagramRenderer +%End - /** Returns the diagram renderer associated with the layer. - * @see setRenderer() - * @note added in QGIS 2.16 - */ - //const QgsDiagramRenderer *renderer() const; - /** Sets the diagram renderer associated with the layer. - * @param diagramRenderer diagram renderer. Ownership is transferred to the object. - * @see renderer() - * @note added in QGIS 2.16 - */ 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:: renderer() +.. versionadded:: 2.16 +%End - /** Returns the coordinate transform associated with the layer, or an - * invalid transform if no transformation is required. - * @see setCoordinateTransform() - * @note added in QGIS 2.16 - */ QgsCoordinateTransform coordinateTransform() const; +%Docstring + Returns the coordinate transform associated with the layer, or an + invalid transform if no transformation is required. +.. seealso:: setCoordinateTransform() +.. versionadded:: 2.16 + :rtype: QgsCoordinateTransform +%End - /** Sets the coordinate transform associated with the layer. - * @param transform coordinate transform. Ownership is transferred to the object. - * @see coordinateTransform() - * @note added in QGIS 2.16 - */ 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:: coordinateTransform() +.. versionadded:: 2.16 +%End - /** Returns whether the layer should show all diagrams, including overlapping diagrams - * @see setShowAllDiagrams() - * @note added in QGIS 2.16 - */ bool showAllDiagrams() const; +%Docstring + Returns whether the layer should show all diagrams, including overlapping diagrams +.. seealso:: setShowAllDiagrams() +.. versionadded:: 2.16 + :rtype: bool +%End - /** Sets whether the layer should show all diagrams, including overlapping diagrams - * @param showAllDiagrams set to true to show all diagrams - * @see showAllDiagrams() - * @note added in QGIS 2.16 - */ 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:: showAllDiagrams() +.. versionadded:: 2.16 +%End - void readXml( const QDomElement& elem ); - void writeXml( QDomElement& layerElem, QDomDocument& doc ) const; - bool prepare( const QgsExpressionContext& context = QgsExpressionContext() ) const; + void readXml( const QDomElement &elem ); +%Docstring + Reads the diagram settings from a DOM element. +.. seealso:: writeXml() +%End + + void writeXml( QDomElement &layerElem, QDomDocument &doc ) const; +%Docstring + Writes the diagram settings to a DOM element. +.. seealso:: 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. +.. versionadded:: 3.0 + :rtype: bool +%End - /** Returns the set of any fields referenced by the layer's diagrams. - * @param context expression context the diagrams will be drawn using - * @note added in QGIS 2.16 - */ 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 +.. versionadded:: 2.16 + :rtype: set of str +%End QgsPropertyCollection &dataDefinedProperties(); +%Docstring + Returns a reference to the diagram's property collection, used for data defined overrides. +.. versionadded:: 3.0 +.. seealso:: setDataDefinedProperties() + :rtype: QgsPropertyCollection +%End - //const dataDefinedProperties &properties() const; 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. +.. versionadded:: 3.0 +.. seealso:: dataDefinedProperties() +%End }; -/** \ingroup core - * \class QgsDiagramSettings - * \brief Stores the settings for rendering a single diagram. - * - * 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. - */ class QgsDiagramSettings { +%Docstring + Stores the settings for rendering a single diagram. + + 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 +#include "qgsdiagramrenderer.h" %End public: @@ -239,7 +310,6 @@ class QgsDiagramSettings XHeight }; - //! Orientation of histogram enum DiagramOrientation { Up, @@ -253,28 +323,34 @@ class QgsDiagramSettings QFont font; QList< QColor > categoryColors; QList< QString > categoryAttributes; - //! @note added in 2.10 QList< QString > categoryLabels; +%Docstring +.. versionadded:: 2.10 +%End QSizeF size; //size - /** Diagram size unit - */ QgsUnitTypes::RenderUnit sizeType; +%Docstring + Diagram size unit +%End - /** Diagram size unit scale - * @note added in 2.16 - */ QgsMapUnitScale sizeScale; +%Docstring + Diagram size unit scale +.. versionadded:: 2.16 +%End - /** Line unit index - * @note added in 2.16 - */ QgsUnitTypes::RenderUnit lineSizeUnit; +%Docstring + Line unit index +.. versionadded:: 2.16 +%End - /** Line unit scale - * @note added in 2.16 - */ QgsMapUnitScale lineSizeScale; +%Docstring + Line unit scale +.. versionadded:: 2.16 +%End QColor backgroundColor; QColor penColor; @@ -287,259 +363,392 @@ class QgsDiagramSettings int angleOffset; bool scaleBasedVisibility; - //scale range (-1 if no lower / upper bound ) double minScaleDenominator; double maxScaleDenominator; - //! Scale diagrams smaller than mMinimumSize to mMinimumSize double minimumSize; +%Docstring +Scale diagrams smaller than mMinimumSize to mMinimumSize +%End - void readXml( const QDomElement& elem ); - void writeXml( QDomElement& rendererElem, QDomDocument& doc ) const; + void readXml( const QDomElement &elem ); +%Docstring +Reads diagram settings from XML +%End + void writeXml( QDomElement &rendererElem, QDomDocument &doc ) const; +%Docstring +Writes diagram settings to XML +%End - /** Returns list of legend nodes for the diagram - * @note caller is responsible for deletion of QgsLayerTreeModelLegendNodes - * @note added in 2.10 - */ QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/; +%Docstring + Returns list of legend nodes for the diagram +.. note:: + + caller is responsible for deletion of QgsLayerTreeModelLegendNodes +.. versionadded:: 2.10 + :rtype: list of QgsLayerTreeModelLegendNode +%End }; -//additional diagram settings for interpolated size rendering class QgsDiagramInterpolationSettings { +%Docstring + Additional diagram settings for interpolated size rendering. +%End + %TypeHeaderCode -#include +#include "qgsdiagramrenderer.h" %End public: QSizeF lowerSize; QSizeF upperSize; double lowerValue; double upperValue; - //! Name of the field for classification + QString classificationField; +%Docstring +Name of the field for classification +%End + QString classificationAttributeExpression; bool classificationAttributeIsExpression; }; -/** \ingroup core - * \class QgsDiagramRenderer - * \brief Evaluates and returns the diagram settings relating to a diagram for a specific feature. - */ class QgsDiagramRenderer { +%Docstring + Evaluates and returns the diagram settings relating to a diagram for a specific feature. +%End + %TypeHeaderCode -#include +#include "qgsdiagramrenderer.h" %End public: QgsDiagramRenderer(); virtual ~QgsDiagramRenderer(); - /** Returns new instance that is equivalent to this one - * @note added in 2.4 */ virtual QgsDiagramRenderer *clone() const = 0 /Factory/; +%Docstring + Returns new instance that is equivalent to this one +.. versionadded:: 2.4 + :rtype: QgsDiagramRenderer +%End - /** Returns size of the diagram for a feature in map units. Returns an invalid QSizeF in case of error*/ 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 + :rtype: QSizeF +%End virtual QString rendererName() const = 0; +%Docstring + :rtype: str +%End - /** Returns attribute indices needed for diagram rendering*/ virtual QList diagramAttributes() const = 0; +%Docstring +Returns attribute indices needed for diagram rendering + :rtype: list of str +%End - /** Returns the set of any fields required for diagram rendering - * @param context expression context the diagrams will be drawn using - * @param fields layer fields - * @note added in QGIS 2.16 - */ 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 +.. versionadded:: 2.16 + :rtype: set of str +%End - void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, QPointF pos, const QgsPropertyCollection &properties = QgsPropertyCollection() ); + 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; +%Docstring + :rtype: QgsDiagram +%End - /** Returns list with all diagram settings in the renderer*/ virtual QList diagramSettings() const = 0; +%Docstring +Returns list with all diagram settings in the renderer + :rtype: list of QgsDiagramSettings +%End - virtual void readXml( const QDomElement& elem, const QgsReadWriteContext &context ) = 0; - virtual void writeXml( QDomElement& layerElem, QDomDocument& doc, const QgsReadWriteContext &context ) const = 0; + 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:: 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:: readXml() +%End - /** Returns list of legend nodes for the diagram - * @note caller is responsible for deletion of QgsLayerTreeModelLegendNodes - * @note added in 2.10 - */ virtual QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/; +%Docstring + Returns list of legend nodes for the diagram +.. note:: + + caller is responsible for deletion of QgsLayerTreeModelLegendNodes +.. versionadded:: 2.10 + :rtype: list of QgsLayerTreeModelLegendNode +%End - /** Returns true if renderer will show legend items for diagram attributes. - * @note added in QGIS 2.16 - * @see setAttributeLegend() - * @see sizeLegend() - */ bool attributeLegend() const; +%Docstring + Returns true if renderer will show legend items for diagram attributes. +.. versionadded:: 2.16 +.. seealso:: setAttributeLegend() +.. seealso:: sizeLegend() + :rtype: bool +%End - /** Sets whether the renderer will show legend items for diagram attributes. - * @param enabled set to true to show diagram attribute legend - * @note added in QGIS 2.16 - * @see attributeLegend() - * @see setSizeLegend() - */ 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 +.. versionadded:: 2.16 +.. seealso:: attributeLegend() +.. seealso:: setSizeLegend() +%End - /** Returns true if renderer will show legend items for diagram sizes. - * @note added in QGIS 2.16 - * @see setSizeLegend() - * @see attributeLegend() - * @see sizeLegendSymbol() - */ bool sizeLegend() const; +%Docstring + Returns true if renderer will show legend items for diagram sizes. +.. versionadded:: 2.16 +.. seealso:: setSizeLegend() +.. seealso:: attributeLegend() +.. seealso:: sizeLegendSymbol() + :rtype: bool +%End - /** Sets whether the renderer will show legend items for diagram sizes. - * @param enabled set to true to show diagram size legend - * @note added in QGIS 2.16 - * @see sizeLegend() - * @see setAttributeLegend() - * @see setSizeLegendSymbol() - */ void setSizeLegend( bool enabled ); +%Docstring + Sets whether the renderer will show legend items for diagram sizes. + \param enabled set to true to show diagram size legend +.. versionadded:: 2.16 +.. seealso:: sizeLegend() +.. seealso:: setAttributeLegend() +.. seealso:: setSizeLegendSymbol() +%End - /** Returns the marker symbol used for rendering the diagram size legend. - * @note added in QGIS 2.16 - * @see setSizeLegendSymbol() - * @see sizeLegend() - */ QgsMarkerSymbol *sizeLegendSymbol() const; +%Docstring + Returns the marker symbol used for rendering the diagram size legend. +.. versionadded:: 2.16 +.. seealso:: setSizeLegendSymbol() +.. seealso:: sizeLegend() + :rtype: QgsMarkerSymbol +%End - /** Sets the marker symbol used for rendering the diagram size legend. - * @param symbol marker symbol, ownership is transferred to the renderer. - * @note added in QGIS 2.16 - * @see sizeLegendSymbol() - * @see setSizeLegend() - */ void setSizeLegendSymbol( QgsMarkerSymbol *symbol /Transfer/ ); +%Docstring + Sets the marker symbol used for rendering the diagram size legend. + \param symbol marker symbol, ownership is transferred to the renderer. +.. versionadded:: 2.16 +.. seealso:: sizeLegendSymbol() +.. seealso:: setSizeLegend() +%End protected: QgsDiagramRenderer( const QgsDiagramRenderer &other ); - //QgsDiagramRenderer &operator=( const QgsDiagramRenderer &other ); - /** Returns diagram settings for a feature (or false if the diagram for the feature is not to be rendered). Used internally within renderDiagram() - * @param feature the feature - * @param c render context - * @param s out: diagram settings for the feature - */ virtual bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const = 0; - - /** Returns size of the diagram (in painter units) or an invalid size in case of error*/ - virtual QSizeF diagramSize( const QgsFeature &features, const QgsRenderContext &c ) const = 0; - - /** Converts size from mm to map units*/ - void convertSizeToMapUnits( QSizeF &size, const QgsRenderContext &context ) const; - - /** Returns the paint device dpi (or -1 in case of error*/ - static int dpiPaintDevice( const QPainter* ); - - //read / write diagram - void _readXml( const QDomElement& elem, const QgsReadWriteContext &context ); - void _writeXml( QDomElement& rendererElem, QDomDocument& doc, const QgsReadWriteContext &context ) const; -}; - -/** Renders the diagrams for all features with the same settings*/ -class QgsSingleCategoryDiagramRenderer : QgsDiagramRenderer -{ -%TypeHeaderCode -#include +%Docstring + Returns diagram settings for a feature (or false if the diagram for the feature is not to be rendered). Used internally within renderDiagram() + \param feature the feature + \param c render context + \param s out: diagram settings for the feature + :rtype: bool %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 + :rtype: QSizeF +%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 + :rtype: int +%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 + Renders the diagrams for all features with the same settings +%End + +%TypeHeaderCode +#include "qgsdiagramrenderer.h" +%End public: QgsSingleCategoryDiagramRenderer(); - ~QgsSingleCategoryDiagramRenderer(); virtual QgsSingleCategoryDiagramRenderer *clone() const /Factory/; - QString rendererName() const; - QList diagramAttributes() const; + virtual QString rendererName() const; + + virtual QList diagramAttributes() const; void setDiagramSettings( const QgsDiagramSettings &s ); - QList diagramSettings() const; + virtual QList diagramSettings() const; + + + virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ); + + virtual void writeXml( QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context ) const; - void readXml( const QDomElement& elem, const QgsReadWriteContext &context ); - void writeXml( QDomElement& layerElem, QDomDocument& doc, const QgsReadWriteContext &context ) const; virtual QList< QgsLayerTreeModelLegendNode * > legendItems( QgsLayerTreeLayer *nodeLayer ) const /Factory/; - protected: - bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const; - QSizeF diagramSize( const QgsFeature&, const QgsRenderContext &c ) const; + 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 -%End +%TypeHeaderCode +#include "qgsdiagramrenderer.h" +%End public: QgsLinearlyInterpolatedDiagramRenderer(); - ~QgsLinearlyInterpolatedDiagramRenderer(); virtual QgsLinearlyInterpolatedDiagramRenderer *clone() const /Factory/; - /** Returns list with all diagram settings in the renderer*/ - QList diagramSettings() const; + + virtual QList diagramSettings() const; + +%Docstring +Returns list with all diagram settings in the renderer + :rtype: list of QgsDiagramSettings +%End void setDiagramSettings( const QgsDiagramSettings &s ); - QList diagramAttributes() const; + virtual QList diagramAttributes() const; + virtual QSet< QString > referencedFields( const QgsExpressionContext &context = QgsExpressionContext() ) const; - QString rendererName() const; + virtual QString rendererName() const; void setLowerValue( double val ); double lowerValue() const; +%Docstring + :rtype: float +%End void setUpperValue( double val ); double upperValue() const; +%Docstring + :rtype: float +%End void setLowerSize( QSizeF s ); QSizeF lowerSize() const; +%Docstring + :rtype: QSizeF +%End void setUpperSize( QSizeF s ); QSizeF upperSize() const; +%Docstring + :rtype: QSizeF +%End - /** - * Returns the field name used for interpolating the diagram size. - * @see setClassificationField() - * @note added in QGIS 3.0 - */ QString classificationField() const; +%Docstring + Returns the field name used for interpolating the diagram size. +.. seealso:: setClassificationField() +.. versionadded:: 3.0 + :rtype: str +%End - /** - * Sets the field name used for interpolating the diagram size. - * @see classificationField() - * @note added in QGIS 3.0 - */ void setClassificationField( const QString &field ); +%Docstring + Sets the field name used for interpolating the diagram size. +.. seealso:: classificationField() +.. versionadded:: 3.0 +%End QString classificationAttributeExpression() const; +%Docstring + :rtype: str +%End void setClassificationAttributeExpression( const QString &expression ); bool classificationAttributeIsExpression() const; +%Docstring + :rtype: bool +%End void setClassificationAttributeIsExpression( bool isExpression ); - void readXml( const QDomElement& elem, const QgsReadWriteContext &context ); - void writeXml( QDomElement& layerElem, QDomDocument& doc, const QgsReadWriteContext &context ) 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: - bool diagramSettings( const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s ) const; - QSizeF diagramSize( const QgsFeature&, const QgsRenderContext &c ) const; + 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 * + ************************************************************************/ diff --git a/src/core/qgsdiagramrenderer.h b/src/core/qgsdiagramrenderer.h index 0239cd0768b..f7429a5a0ea 100644 --- a/src/core/qgsdiagramrenderer.h +++ b/src/core/qgsdiagramrenderer.h @@ -43,7 +43,7 @@ class QgsVectorLayer; class QgsLayerTreeModelLegendNode; class QgsLayerTreeLayer; -namespace pal { class Layer; } +namespace pal { class Layer; } SIP_SKIP /** \ingroup core * \class QgsDiagramLayerSettings @@ -212,8 +212,9 @@ class CORE_EXPORT QgsDiagramLayerSettings /** Returns the diagram renderer associated with the layer. * \see setRenderer() * \since QGIS 2.16 + * \note not available in Python bindings */ - const QgsDiagramRenderer *renderer() const { return mRenderer; } + const QgsDiagramRenderer *renderer() const { return mRenderer; } SIP_SKIP /** Sets the diagram renderer associated with the layer. * \param diagramRenderer diagram renderer. Ownership is transferred to the object. @@ -284,8 +285,9 @@ class CORE_EXPORT QgsDiagramLayerSettings /** Returns a reference to the diagram's property collection, used for data defined overrides. * \since QGIS 3.0 * \see setProperties() + * \note not available in Python bindings */ - const QgsPropertyCollection &dataDefinedProperties() const { return mDataDefinedProperties; } + const QgsPropertyCollection &dataDefinedProperties() const { return mDataDefinedProperties; } SIP_SKIP /** Sets the diagram's property collection, used for data defined overrides. * \param collection property collection. Existing properties will be replaced.