Skip to content

Commit dd40a3d

Browse files
committedMay 24, 2017
sipify diagram classes
1 parent 8157cf6 commit dd40a3d

File tree

7 files changed

+689
-355
lines changed

7 files changed

+689
-355
lines changed
 

‎python/auto_sip.blacklist

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ core/composer/qgspaperitem.sip
4242
core/composer/qgsscalebarstyle.sip
4343
core/composer/qgssingleboxscalebarstyle.sip
4444
core/composer/qgsticksscalebarstyle.sip
45-
core/diagram/qgsdiagram.sip
46-
core/diagram/qgshistogramdiagram.sip
47-
core/diagram/qgspiediagram.sip
48-
core/diagram/qgstextdiagram.sip
49-
core/qgsdiagramrenderer.sip
5045
core/effects/qgsblureffect.sip
5146
core/effects/qgscoloreffect.sip
5247
core/effects/qgseffectstack.sip

‎python/core/diagram/qgsdiagram.sip

Lines changed: 102 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,135 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/diagram/qgsdiagram.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
112
class QgsDiagram
213
{
14+
%Docstring
15+
Base class for all diagram types*
16+
%End
17+
318
%TypeHeaderCode
4-
#include <qgsdiagram.h>
19+
#include "qgsdiagram.h"
520
%End
621
public:
722
virtual ~QgsDiagram();
8-
/** Returns an instance that is equivalent to this one
9-
* @note added in 2.4 */
23+
1024
virtual QgsDiagram *clone() const = 0 /Factory/;
25+
%Docstring
26+
Returns an instance that is equivalent to this one
27+
.. versionadded:: 2.4
28+
:rtype: QgsDiagram
29+
%End
1130

1231
void clearCache();
1332

14-
/** Returns a prepared expression for the specified context.
15-
* @param expression expression string
16-
* @param context expression context
17-
* @note added in QGIS 2.12
18-
*/
1933
QgsExpression *getExpression( const QString &expression, const QgsExpressionContext &context );
34+
%Docstring
35+
Returns a prepared expression for the specified context.
36+
\param expression expression string
37+
\param context expression context
38+
.. versionadded:: 2.12
39+
:rtype: QgsExpression
40+
%End
2041

21-
/** Draws the diagram at the given position (in pixel coordinates)*/
2242
virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position ) = 0;
43+
%Docstring
44+
Draws the diagram at the given position (in pixel coordinates)
45+
%End
46+
2347
virtual QString diagramName() const = 0;
24-
/** Returns the size in map units the diagram will use to render.*/
48+
%Docstring
49+
Get a descriptive name for this diagram type.
50+
:rtype: str
51+
%End
2552
virtual QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s ) = 0;
26-
/** Returns the size in map units the diagram will use to render. Interpolate size*/
53+
%Docstring
54+
Returns the size in map units the diagram will use to render.
55+
:rtype: QSizeF
56+
%End
2757
virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) = 0;
58+
%Docstring
59+
Returns the size in map units the diagram will use to render. Interpolate size
60+
:rtype: QSizeF
61+
%End
2862

29-
/** Returns the size of the legend item for the diagram corresponding to a specified value.
30-
* @param value value to return legend item size for
31-
* @param s diagram settings
32-
* @param is interpolation settings
33-
* @note added in QGIS 2.16
34-
*/
3563
virtual double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const = 0;
64+
%Docstring
65+
Returns the size of the legend item for the diagram corresponding to a specified value.
66+
\param value value to return legend item size for
67+
\param s diagram settings
68+
\param is interpolation settings
69+
.. versionadded:: 2.16
70+
:rtype: float
71+
%End
3672

3773
protected:
3874
QgsDiagram();
3975
QgsDiagram( const QgsDiagram &other );
4076

41-
/** Changes the pen width to match the current settings and rendering context
42-
* @param pen The pen to modify
43-
* @param s The settings that specify the pen width
44-
* @param c The rendering specifying the proper scale units for pixel conversion
45-
*/
4677
void setPenWidth( QPen &pen, const QgsDiagramSettings &s, const QgsRenderContext &c );
78+
%Docstring
79+
Changes the pen width to match the current settings and rendering context
80+
\param pen The pen to modify
81+
\param s The settings that specify the pen width
82+
\param c The rendering specifying the proper scale units for pixel conversion
83+
%End
4784

48-
/** Calculates a size to match the current settings and rendering context
49-
* @param size The size to convert
50-
* @param s The settings that specify the size type
51-
* @param c The rendering specifying the proper scale units for pixel conversion
52-
*
53-
* @return The converted size for rendering
54-
*/
5585
QSizeF sizePainterUnits( QSizeF size, const QgsDiagramSettings &s, const QgsRenderContext &c );
86+
%Docstring
87+
Calculates a size to match the current settings and rendering context
88+
\param size The size to convert
89+
\param s The settings that specify the size type
90+
\param c The rendering specifying the proper scale units for pixel conversion
91+
92+
:return: The converted size for rendering
93+
:rtype: QSizeF
94+
%End
5695

57-
/** Calculates a length to match the current settings and rendering context
58-
* @param l The length to convert
59-
* @param s Unused
60-
* @param c The rendering specifying the proper scale units for pixel conversion
61-
*
62-
* @return The converted length for rendering
63-
*/
6496
double sizePainterUnits( double l, const QgsDiagramSettings &s, const QgsRenderContext &c );
97+
%Docstring
98+
Calculates a length to match the current settings and rendering context
99+
\param l The length to convert
100+
\param s Unused
101+
\param c The rendering specifying the proper scale units for pixel conversion
102+
103+
:return: The converted length for rendering
104+
:rtype: float
105+
%End
65106

66-
/** Calculates a size to match the current settings and rendering context
67-
* @param s The settings that contain the font size and size type
68-
* @param c The rendering specifying the proper scale units for pixel conversion
69-
*
70-
* @return The properly scaled font for rendering
71-
*/
72107
QFont scaledFont( const QgsDiagramSettings &s, const QgsRenderContext &c );
108+
%Docstring
109+
Calculates a size to match the current settings and rendering context
110+
\param s The settings that contain the font size and size type
111+
\param c The rendering specifying the proper scale units for pixel conversion
112+
113+
:return: The properly scaled font for rendering
114+
:rtype: QFont
115+
%End
73116

74-
/** Returns the scaled size of a diagram for a value, respecting the specified diagram interpolation settings.
75-
* @param value value to calculate corresponding circular size for
76-
* @param s diagram settings
77-
* @param is interpolation settings
78-
* @note added in QGIS 2.16
79-
*/
80117
QSizeF sizeForValue( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const;
118+
%Docstring
119+
Returns the scaled size of a diagram for a value, respecting the specified diagram interpolation settings.
120+
\param value value to calculate corresponding circular size for
121+
\param s diagram settings
122+
\param is interpolation settings
123+
.. versionadded:: 2.16
124+
:rtype: QSizeF
125+
%End
126+
81127
};
128+
129+
/************************************************************************
130+
* This file has been generated automatically from *
131+
* *
132+
* src/core/diagram/qgsdiagram.h *
133+
* *
134+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
135+
************************************************************************/
Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,45 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/diagram/qgshistogramdiagram.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
114
class QgsHistogramDiagram: QgsDiagram
215
{
16+
317
%TypeHeaderCode
4-
#include <qgshistogramdiagram.h>
18+
#include "qgshistogramdiagram.h"
519
%End
620
public:
721
QgsHistogramDiagram();
8-
~QgsHistogramDiagram();
922

1023
virtual QgsHistogramDiagram *clone() const /Factory/;
1124

12-
void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position );
25+
virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position );
26+
27+
28+
virtual QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s );
29+
30+
virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is );
31+
32+
virtual double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const;
33+
34+
virtual QString diagramName() const;
1335

14-
QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s );
15-
QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is );
16-
double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const;
17-
QString diagramName() const;
1836
};
37+
38+
39+
/************************************************************************
40+
* This file has been generated automatically from *
41+
* *
42+
* src/core/diagram/qgshistogramdiagram.h *
43+
* *
44+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
45+
************************************************************************/

‎python/core/diagram/qgspiediagram.sip

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/diagram/qgspiediagram.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
112
class QgsPieDiagram: QgsDiagram
213
{
14+
315
%TypeHeaderCode
4-
#include <qgspiediagram.h>
16+
#include "qgspiediagram.h"
517
%End
618
public:
719
QgsPieDiagram();
8-
~QgsPieDiagram();
920

1021
virtual QgsPieDiagram *clone() const /Factory/;
1122

12-
void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position );
23+
virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position );
24+
25+
26+
virtual QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s );
27+
28+
virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is );
29+
30+
virtual double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const;
31+
32+
virtual QString diagramName() const;
1333

14-
QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s );
15-
QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is );
16-
double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const;
17-
QString diagramName() const;
1834
};
35+
36+
/************************************************************************
37+
* This file has been generated automatically from *
38+
* *
39+
* src/core/diagram/qgspiediagram.h *
40+
* *
41+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
42+
************************************************************************/
Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/diagram/qgstextdiagram.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
112
class QgsTextDiagram: QgsDiagram
213
{
14+
315
%TypeHeaderCode
4-
#include <qgstextdiagram.h>
16+
#include "qgstextdiagram.h"
517
%End
6-
718
public:
819
enum Shape
920
{
@@ -19,14 +30,26 @@ class QgsTextDiagram: QgsDiagram
1930
};
2031

2132
QgsTextDiagram();
22-
~QgsTextDiagram();
2333
virtual QgsTextDiagram *clone() const /Factory/;
2434

25-
void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position );
35+
virtual void renderDiagram( const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position );
2636

27-
QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s );
28-
QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is );
29-
double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const;
3037

31-
QString diagramName() const;
38+
virtual QSizeF diagramSize( const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s );
39+
40+
virtual QSizeF diagramSize( const QgsFeature &feature, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is );
41+
42+
virtual double legendSize( double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is ) const;
43+
44+
45+
virtual QString diagramName() const;
46+
3247
};
48+
49+
/************************************************************************
50+
* This file has been generated automatically from *
51+
* *
52+
* src/core/diagram/qgstextdiagram.h *
53+
* *
54+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
55+
************************************************************************/

‎python/core/qgsdiagramrenderer.sip

Lines changed: 486 additions & 277 deletions
Large diffs are not rendered by default.

‎src/core/qgsdiagramrenderer.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class QgsVectorLayer;
4343
class QgsLayerTreeModelLegendNode;
4444
class QgsLayerTreeLayer;
4545

46-
namespace pal { class Layer; }
46+
namespace pal { class Layer; } SIP_SKIP
4747

4848
/** \ingroup core
4949
* \class QgsDiagramLayerSettings
@@ -212,8 +212,9 @@ class CORE_EXPORT QgsDiagramLayerSettings
212212
/** Returns the diagram renderer associated with the layer.
213213
* \see setRenderer()
214214
* \since QGIS 2.16
215+
* \note not available in Python bindings
215216
*/
216-
const QgsDiagramRenderer *renderer() const { return mRenderer; }
217+
const QgsDiagramRenderer *renderer() const { return mRenderer; } SIP_SKIP
217218

218219
/** Sets the diagram renderer associated with the layer.
219220
* \param diagramRenderer diagram renderer. Ownership is transferred to the object.
@@ -284,8 +285,9 @@ class CORE_EXPORT QgsDiagramLayerSettings
284285
/** Returns a reference to the diagram's property collection, used for data defined overrides.
285286
* \since QGIS 3.0
286287
* \see setProperties()
288+
* \note not available in Python bindings
287289
*/
288-
const QgsPropertyCollection &dataDefinedProperties() const { return mDataDefinedProperties; }
290+
const QgsPropertyCollection &dataDefinedProperties() const { return mDataDefinedProperties; } SIP_SKIP
289291

290292
/** Sets the diagram's property collection, used for data defined overrides.
291293
* \param collection property collection. Existing properties will be replaced.

0 commit comments

Comments
 (0)
Please sign in to comment.