Skip to content

Commit

Permalink
Merge pull request #58568 from gacarrillor/stacked_diagrams
Browse files Browse the repository at this point in the history
[feature] Introduce stacked diagrams
  • Loading branch information
3nids authored Sep 27, 2024
2 parents 9302008 + b8f9760 commit ca3b40c
Show file tree
Hide file tree
Showing 79 changed files with 5,364 additions and 998 deletions.
4 changes: 4 additions & 0 deletions python/PyQt6/core/auto_additions/qgsdiagramrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
"""
# --
QgsDiagramLayerSettings.Single = QgsDiagramLayerSettings.DiagramType.Single
QgsDiagramLayerSettings.Stacked = QgsDiagramLayerSettings.DiagramType.Stacked
QgsDiagramSettings.Height = QgsDiagramSettings.LabelPlacementMethod.Height
QgsDiagramSettings.XHeight = QgsDiagramSettings.LabelPlacementMethod.XHeight
QgsDiagramSettings.Up = QgsDiagramSettings.DiagramOrientation.Up
Expand All @@ -72,6 +74,8 @@
QgsDiagramSettings.Right = QgsDiagramSettings.DiagramOrientation.Right
QgsDiagramSettings.Clockwise = QgsDiagramSettings.Direction.Clockwise
QgsDiagramSettings.Counterclockwise = QgsDiagramSettings.Direction.Counterclockwise
QgsDiagramSettings.Horizontal = QgsDiagramSettings.StackedDiagramMode.Horizontal
QgsDiagramSettings.Vertical = QgsDiagramSettings.StackedDiagramMode.Vertical
try:
QgsDiagramSettings.__attribute_docs__ = {'sizeType': 'Diagram size unit', 'sizeScale': 'Diagram size unit scale', 'lineSizeUnit': 'Line unit index', 'lineSizeScale': 'Line unit scale', 'opacity': 'Opacity, from 0 (transparent) to 1.0 (opaque)', 'rotationOffset': 'Rotation offset, in degrees clockwise from horizontal.', 'maximumScale': 'The maximum map scale (i.e. most "zoomed in" scale) at which the diagrams will be visible.\nThe scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.\nA scale of 0 indicates no maximum scale visibility.\n\n.. seealso:: :py:func:`minimumScale`', 'minimumScale': 'The minimum map scale (i.e. most "zoomed out" scale) at which the diagrams will be visible.\nThe scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.\nA scale of 0 indicates no minimum scale visibility.\n\n.. seealso:: :py:func:`maximumScale`', 'minimumSize': 'Scale diagrams smaller than mMinimumSize to mMinimumSize'}
except NameError:
Expand Down
5 changes: 5 additions & 0 deletions python/PyQt6/core/auto_additions/qgsstackeddiagram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# The following has been generated automatically from src/core/diagram/qgsstackeddiagram.h
try:
QgsStackedDiagram.__group__ = ['diagram']
except NameError:
pass
6 changes: 4 additions & 2 deletions python/PyQt6/core/auto_generated/diagram/qgsdiagram.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ Base class for all diagram types.
sipType = sipType_QgsHistogramDiagram;
else if ( sipCpp->diagramName() == QLatin1String( "Text" ) )
sipType = sipType_QgsTextDiagram;
else if ( sipCpp->diagramName() == QLatin1String( "Stacked" ) )
else if ( sipCpp->diagramName() == QLatin1String( "StackedBar" ) )
sipType = sipType_QgsStackedBarDiagram;
else if ( sipCpp->diagramName() == QLatin1String( "Stacked" ) )
sipType = sipType_QgsStackedDiagram;
else
sipType = NULL;
%End
Expand Down Expand Up @@ -107,7 +109,7 @@ Calculates a size to match the current settings and rendering context
Calculates a length to match the current settings and rendering context

:param l: The length to convert
:param s: Unused
:param s: The settings that specify the size type
:param c: The rendering specifying the proper scale units for pixel conversion

:return: The converted length for rendering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@




class QgsHistogramDiagram: QgsDiagram /NoDefaultCtors/
{
%Docstring(signature="appended")
Expand All @@ -21,6 +20,7 @@ A histogram style diagram.
#include "qgshistogramdiagram.h"
%End
public:

QgsHistogramDiagram();

virtual QgsHistogramDiagram *clone() const /Factory/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@




class QgsPieDiagram: QgsDiagram /NoDefaultCtors/
{
%Docstring(signature="appended")
Expand All @@ -19,6 +18,7 @@ A pie chart diagram.
#include "qgspiediagram.h"
%End
public:

QgsPieDiagram();

virtual QgsPieDiagram *clone() const /Factory/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@




class QgsStackedBarDiagram: QgsDiagram /NoDefaultCtors/
{
%Docstring(signature="appended")
Expand All @@ -24,6 +23,7 @@ A stacked bar chart diagram.
#include "qgsstackedbardiagram.h"
%End
public:

QgsStackedBarDiagram();

virtual QgsStackedBarDiagram *clone() const /Factory/;
Expand Down
60 changes: 60 additions & 0 deletions python/PyQt6/core/auto_generated/diagram/qgsstackeddiagram.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/diagram/qgsstackeddiagram.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/





class QgsStackedDiagram : QgsDiagram /NoDefaultCtors/
{
%Docstring(signature="appended")
A diagram composed of several subdiagrams, located side by side.

.. versionadded:: 3.40
%End

%TypeHeaderCode
#include "qgsstackeddiagram.h"
%End
public:

QgsStackedDiagram();

virtual QgsStackedDiagram *clone() const /Factory/;


void subDiagramPosition( QPointF &newPos, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramSettings &subSettings );
%Docstring
Calculates the position for the next subdiagram, updating the ``newPos`` object.

:param newPos: out: position of the previous diagram
:param c: renderer context
:param s: stacked diagram settings
:param subSettings: previous subdiagram settings
%End

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;

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/diagram/qgsstackeddiagram.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@




class QgsTextDiagram: QgsDiagram /NoDefaultCtors/
{
%Docstring(signature="appended")
Expand All @@ -19,6 +18,7 @@ A text based diagram.
#include "qgstextdiagram.h"
%End
public:

enum Shape /BaseType=IntEnum/
{
Circle,
Expand Down
Loading

0 comments on commit ca3b40c

Please sign in to comment.