mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
Address comments provided during the QEP review phase
This commit is contained in:
parent
abcb1785c9
commit
75ec5e4962
@ -122,7 +122,7 @@ try:
|
|||||||
QgsApplication.defaultStyleModel = staticmethod(QgsApplication.defaultStyleModel)
|
QgsApplication.defaultStyleModel = staticmethod(QgsApplication.defaultStyleModel)
|
||||||
QgsApplication.fontManager = staticmethod(QgsApplication.fontManager)
|
QgsApplication.fontManager = staticmethod(QgsApplication.fontManager)
|
||||||
QgsApplication.sensorRegistry = staticmethod(QgsApplication.sensorRegistry)
|
QgsApplication.sensorRegistry = staticmethod(QgsApplication.sensorRegistry)
|
||||||
QgsApplication.chartRegistry = staticmethod(QgsApplication.chartRegistry)
|
QgsApplication.chartPlotRegistry = staticmethod(QgsApplication.chartPlotRegistry)
|
||||||
QgsApplication.messageLog = staticmethod(QgsApplication.messageLog)
|
QgsApplication.messageLog = staticmethod(QgsApplication.messageLog)
|
||||||
QgsApplication.authManager = staticmethod(QgsApplication.authManager)
|
QgsApplication.authManager = staticmethod(QgsApplication.authManager)
|
||||||
QgsApplication.authConfigurationStorageRegistry = staticmethod(QgsApplication.authConfigurationStorageRegistry)
|
QgsApplication.authConfigurationStorageRegistry = staticmethod(QgsApplication.authConfigurationStorageRegistry)
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
# The following has been generated automatically from src/core/plot/qgschart.h
|
|
||||||
try:
|
|
||||||
QgsBarChart.create = staticmethod(QgsBarChart.create)
|
|
||||||
QgsBarChart.__overridden_methods__ = ['type', 'renderContent', 'writeXml', 'readXml']
|
|
||||||
QgsBarChart.__group__ = ['plot']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
QgsLineChart.create = staticmethod(QgsLineChart.create)
|
|
||||||
QgsLineChart.__overridden_methods__ = ['type', 'renderContent', 'writeXml', 'readXml']
|
|
||||||
QgsLineChart.__group__ = ['plot']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
13
python/PyQt6/core/auto_additions/qgschartplot.py
Normal file
13
python/PyQt6/core/auto_additions/qgschartplot.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# The following has been generated automatically from src/core/plot/qgschartplot.h
|
||||||
|
try:
|
||||||
|
QgsBarChartPlot.create = staticmethod(QgsBarChartPlot.create)
|
||||||
|
QgsBarChartPlot.__overridden_methods__ = ['type', 'renderContent', 'writeXml', 'readXml']
|
||||||
|
QgsBarChartPlot.__group__ = ['plot']
|
||||||
|
except (NameError, AttributeError):
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
QgsLineChartPlot.create = staticmethod(QgsLineChartPlot.create)
|
||||||
|
QgsLineChartPlot.__overridden_methods__ = ['type', 'renderContent', 'writeXml', 'readXml']
|
||||||
|
QgsLineChartPlot.__group__ = ['plot']
|
||||||
|
except (NameError, AttributeError):
|
||||||
|
pass
|
12
python/PyQt6/core/auto_additions/qgschartplotregistry.py
Normal file
12
python/PyQt6/core/auto_additions/qgschartplotregistry.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# The following has been generated automatically from src/core/plot/qgschartplotregistry.h
|
||||||
|
try:
|
||||||
|
QgsChartPlotRegistry.__attribute_docs__ = {'chartAdded': 'Emitted whenever a new chart type is added to the registry, with the\nspecified ``type`` and visible ``name``.\n', 'chartAboutToBeRemoved': 'Emitted whenever a new chart type is added to the registry, with the\nspecified ``type`` and visible ``name``.\n'}
|
||||||
|
QgsChartPlotRegistry.__signal_arguments__ = {'chartAdded': ['type: str', 'name: str'], 'chartAboutToBeRemoved': ['type: str']}
|
||||||
|
QgsChartPlotRegistry.__group__ = ['plot']
|
||||||
|
except (NameError, AttributeError):
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
QgsChartPlotAbstractMetadata.__abstract_methods__ = ['createChart']
|
||||||
|
QgsChartPlotAbstractMetadata.__group__ = ['plot']
|
||||||
|
except (NameError, AttributeError):
|
||||||
|
pass
|
@ -1,12 +0,0 @@
|
|||||||
# The following has been generated automatically from src/core/plot/qgschartregistry.h
|
|
||||||
try:
|
|
||||||
QgsChartRegistry.__attribute_docs__ = {'chartAdded': 'Emitted whenever a new chart type is added to the registry, with the\nspecified ``type`` and visible ``name``.\n', 'chartAboutToBeRemoved': 'Emitted whenever a new chart type is added to the registry, with the\nspecified ``type`` and visible ``name``.\n'}
|
|
||||||
QgsChartRegistry.__signal_arguments__ = {'chartAdded': ['type: str', 'name: str'], 'chartAboutToBeRemoved': ['type: str']}
|
|
||||||
QgsChartRegistry.__group__ = ['plot']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
QgsChartAbstractMetadata.__abstract_methods__ = ['createChart']
|
|
||||||
QgsChartAbstractMetadata.__group__ = ['plot']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
@ -1,7 +1,7 @@
|
|||||||
/************************************************************************
|
/************************************************************************
|
||||||
* This file has been generated automatically from *
|
* This file has been generated automatically from *
|
||||||
* *
|
* *
|
||||||
* src/core/plot/qgschart.h *
|
* src/core/plot/qgschartplot.h *
|
||||||
* *
|
* *
|
||||||
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QgsBarChart : Qgs2DXyPlot
|
class QgsBarChartPlot : Qgs2DXyPlot
|
||||||
{
|
{
|
||||||
%Docstring(signature="appended")
|
%Docstring(signature="appended")
|
||||||
A simple bar chart class.
|
A simple bar chart class.
|
||||||
@ -22,12 +22,12 @@ A simple bar chart class.
|
|||||||
%End
|
%End
|
||||||
|
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
#include "qgschart.h"
|
#include "qgschartplot.h"
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QgsBarChart();
|
QgsBarChartPlot();
|
||||||
~QgsBarChart();
|
~QgsBarChartPlot();
|
||||||
|
|
||||||
virtual QString type() const;
|
virtual QString type() const;
|
||||||
|
|
||||||
@ -39,7 +39,17 @@ A simple bar chart class.
|
|||||||
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
|
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
|
||||||
|
|
||||||
|
|
||||||
static QgsBarChart *create();
|
QgsFillSymbol *fillSymbol( int index ) const;
|
||||||
|
%Docstring
|
||||||
|
Returns the fill symbol at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
void setFillSymbol( int index, QgsFillSymbol *symbol /Transfer/ );
|
||||||
|
%Docstring
|
||||||
|
Sets the marker ``symbol`` at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
static QgsBarChartPlot *create();
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns a new bar chart.
|
Returns a new bar chart.
|
||||||
%End
|
%End
|
||||||
@ -47,7 +57,7 @@ Returns a new bar chart.
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class QgsLineChart : Qgs2DXyPlot
|
class QgsLineChartPlot : Qgs2DXyPlot
|
||||||
{
|
{
|
||||||
%Docstring(signature="appended")
|
%Docstring(signature="appended")
|
||||||
A simple line chart class.
|
A simple line chart class.
|
||||||
@ -60,12 +70,12 @@ A simple line chart class.
|
|||||||
%End
|
%End
|
||||||
|
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
#include "qgschart.h"
|
#include "qgschartplot.h"
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QgsLineChart();
|
QgsLineChartPlot();
|
||||||
~QgsLineChart();
|
~QgsLineChartPlot();
|
||||||
|
|
||||||
virtual QString type() const;
|
virtual QString type() const;
|
||||||
|
|
||||||
@ -77,7 +87,27 @@ A simple line chart class.
|
|||||||
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
|
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
|
||||||
|
|
||||||
|
|
||||||
static QgsLineChart *create();
|
QgsMarkerSymbol *markerSymbol( int index ) const;
|
||||||
|
%Docstring
|
||||||
|
Returns the marker symbol at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
void setMarkerSymbol( int index, QgsMarkerSymbol *symbol /Transfer/ );
|
||||||
|
%Docstring
|
||||||
|
Sets the marker ``symbol`` at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
QgsLineSymbol *lineSymbol( int seriesIndex ) const;
|
||||||
|
%Docstring
|
||||||
|
Returns the line symbol at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
void setLineSymbol( int seriesIndex, QgsLineSymbol *symbol /Transfer/ );
|
||||||
|
%Docstring
|
||||||
|
Sets the marker ``symbol`` at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
static QgsLineChartPlot *create();
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns a new line chart.
|
Returns a new line chart.
|
||||||
%End
|
%End
|
||||||
@ -87,7 +117,7 @@ Returns a new line chart.
|
|||||||
/************************************************************************
|
/************************************************************************
|
||||||
* This file has been generated automatically from *
|
* This file has been generated automatically from *
|
||||||
* *
|
* *
|
||||||
* src/core/plot/qgschart.h *
|
* src/core/plot/qgschartplot.h *
|
||||||
* *
|
* *
|
||||||
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
||||||
************************************************************************/
|
************************************************************************/
|
@ -0,0 +1,148 @@
|
|||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/core/plot/qgschartplotregistry.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
class QgsChartPlotAbstractMetadata
|
||||||
|
{
|
||||||
|
%Docstring(signature="appended")
|
||||||
|
Stores metadata about a chart class.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
In C++ you can use :py:class:`QgsChartPlotAbstractMetadata` convenience class.
|
||||||
|
|
||||||
|
.. versionadded:: 4.0
|
||||||
|
%End
|
||||||
|
|
||||||
|
%TypeHeaderCode
|
||||||
|
#include "qgschartplotregistry.h"
|
||||||
|
%End
|
||||||
|
public:
|
||||||
|
|
||||||
|
QgsChartPlotAbstractMetadata( const QString &type, const QString &visibleName );
|
||||||
|
%Docstring
|
||||||
|
Constructor for QgsChartPlotAbstractMetadata with the specified class
|
||||||
|
``type``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
virtual ~QgsChartPlotAbstractMetadata();
|
||||||
|
|
||||||
|
QString type() const;
|
||||||
|
%Docstring
|
||||||
|
Returns the unique type code for the chart class.
|
||||||
|
%End
|
||||||
|
|
||||||
|
QString visibleName() const;
|
||||||
|
%Docstring
|
||||||
|
Returns a translated, user visible name for the chart class.
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
|
virtual QgsPlot *createChart() = 0 /TransferBack/;
|
||||||
|
%Docstring
|
||||||
|
Creates a chart of this class.
|
||||||
|
%End
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class QgsChartPlotRegistry : QObject
|
||||||
|
{
|
||||||
|
%Docstring(signature="appended")
|
||||||
|
Registry of available chart types.
|
||||||
|
|
||||||
|
:py:class:`QgsChartPlotRegistry` is not usually directly created, but
|
||||||
|
rather accessed through :py:func:`QgsApplication.chartRegistry()`.
|
||||||
|
|
||||||
|
.. versionadded:: 4.0
|
||||||
|
%End
|
||||||
|
|
||||||
|
%TypeHeaderCode
|
||||||
|
#include "qgschartplotregistry.h"
|
||||||
|
%End
|
||||||
|
public:
|
||||||
|
|
||||||
|
QgsChartPlotRegistry( QObject *parent = 0 );
|
||||||
|
%Docstring
|
||||||
|
Creates a new empty item registry.
|
||||||
|
|
||||||
|
QgsChartPlotRegistry is not usually directly created, but rather
|
||||||
|
accessed through :py:func:`QgsApplication.chartRegistry()`.
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`populate`
|
||||||
|
%End
|
||||||
|
~QgsChartPlotRegistry();
|
||||||
|
|
||||||
|
bool populate();
|
||||||
|
%Docstring
|
||||||
|
Populates the registry with standard chart types. If called on a
|
||||||
|
non-empty registry then this will have no effect and will return
|
||||||
|
``False``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
|
QgsChartPlotAbstractMetadata *chartMetadata( const QString &type ) const;
|
||||||
|
%Docstring
|
||||||
|
Returns the metadata for the specified chart ``type``. Returns ``None``
|
||||||
|
if a corresponding type was not found in the registry.
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
|
bool addChartType( QgsChartPlotAbstractMetadata *metadata /Transfer/ );
|
||||||
|
%Docstring
|
||||||
|
Registers a new chart type.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Takes ownership of the metadata instance.
|
||||||
|
%End
|
||||||
|
|
||||||
|
bool removeChartType( const QString &type );
|
||||||
|
%Docstring
|
||||||
|
Removes a new a chart type from the registry.
|
||||||
|
%End
|
||||||
|
|
||||||
|
QgsPlot *createChart( const QString &type ) const /TransferBack/;
|
||||||
|
%Docstring
|
||||||
|
Creates a new instance of a chart given the ``type``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
QMap<QString, QString> chartTypes() const;
|
||||||
|
%Docstring
|
||||||
|
Returns a map of available charts types to translated name.
|
||||||
|
%End
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void chartAdded( const QString &type, const QString &name );
|
||||||
|
%Docstring
|
||||||
|
Emitted whenever a new chart type is added to the registry, with the
|
||||||
|
specified ``type`` and visible ``name``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
void chartAboutToBeRemoved( const QString &type );
|
||||||
|
%Docstring
|
||||||
|
Emitted whenever a new chart type is added to the registry, with the
|
||||||
|
specified ``type`` and visible ``name``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
private:
|
||||||
|
QgsChartPlotRegistry( const QgsChartPlotRegistry &rh );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/core/plot/qgschartplotregistry.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
||||||
|
************************************************************************/
|
@ -79,42 +79,6 @@ Returns the series' name.
|
|||||||
void setName( const QString &name );
|
void setName( const QString &name );
|
||||||
%Docstring
|
%Docstring
|
||||||
Sets the series' name.
|
Sets the series' name.
|
||||||
%End
|
|
||||||
|
|
||||||
QgsMarkerSymbol *markerSymbol() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the marker symbol to be used by various chart types when
|
|
||||||
rendering the series' data.
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setMarkerSymbol( QgsMarkerSymbol *markerSymbol /Transfer/ );
|
|
||||||
%Docstring
|
|
||||||
Sets the marker symbol to be used by various chart types when rendering
|
|
||||||
the series' data.
|
|
||||||
%End
|
|
||||||
|
|
||||||
QgsLineSymbol *lineSymbol() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the line symbol to be used by various chart types when rendering
|
|
||||||
the series' data.
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setLineSymbol( QgsLineSymbol *lineSymbol /Transfer/ );
|
|
||||||
%Docstring
|
|
||||||
Sets the line symbol to be used by various chart types when rendering
|
|
||||||
the series' data.
|
|
||||||
%End
|
|
||||||
|
|
||||||
QgsFillSymbol *fillSymbol() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the fill symbol to be used by various chart types when rendering
|
|
||||||
the series' data.
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setFillSymbol( QgsFillSymbol *fillSymbol /Transfer/ );
|
|
||||||
%Docstring
|
|
||||||
Sets the fill symbol to be used by various chart types when rendering
|
|
||||||
the series' data.
|
|
||||||
%End
|
%End
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -926,7 +926,7 @@ Returns the application's sensor registry, used for sensor types.
|
|||||||
.. versionadded:: 3.32
|
.. versionadded:: 3.32
|
||||||
%End
|
%End
|
||||||
|
|
||||||
static QgsChartRegistry *chartRegistry() /KeepReference/;
|
static QgsChartPlotRegistry *chartPlotRegistry() /KeepReference/;
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns the application's chart registry, used for chart types.
|
Returns the application's chart registry, used for chart types.
|
||||||
|
|
||||||
|
@ -518,8 +518,8 @@
|
|||||||
%Include auto_generated/painting/qgspaintenginehack.sip
|
%Include auto_generated/painting/qgspaintenginehack.sip
|
||||||
%Include auto_generated/painting/qgspainting.sip
|
%Include auto_generated/painting/qgspainting.sip
|
||||||
%Include auto_generated/pdf/qgspdfrenderer.sip
|
%Include auto_generated/pdf/qgspdfrenderer.sip
|
||||||
%Include auto_generated/plot/qgschart.sip
|
%Include auto_generated/plot/qgschartplot.sip
|
||||||
%Include auto_generated/plot/qgschartregistry.sip
|
%Include auto_generated/plot/qgschartplotregistry.sip
|
||||||
%Include auto_generated/plot/qgsplot.sip
|
%Include auto_generated/plot/qgsplot.sip
|
||||||
%Include auto_generated/pointcloud/qgspointcloudattribute.sip
|
%Include auto_generated/pointcloud/qgspointcloudattribute.sip
|
||||||
%Include auto_generated/pointcloud/qgspointcloudattributebyramprenderer.sip
|
%Include auto_generated/pointcloud/qgspointcloudattributebyramprenderer.sip
|
||||||
|
@ -111,7 +111,7 @@ try:
|
|||||||
QgsApplication.defaultStyleModel = staticmethod(QgsApplication.defaultStyleModel)
|
QgsApplication.defaultStyleModel = staticmethod(QgsApplication.defaultStyleModel)
|
||||||
QgsApplication.fontManager = staticmethod(QgsApplication.fontManager)
|
QgsApplication.fontManager = staticmethod(QgsApplication.fontManager)
|
||||||
QgsApplication.sensorRegistry = staticmethod(QgsApplication.sensorRegistry)
|
QgsApplication.sensorRegistry = staticmethod(QgsApplication.sensorRegistry)
|
||||||
QgsApplication.chartRegistry = staticmethod(QgsApplication.chartRegistry)
|
QgsApplication.chartPlotRegistry = staticmethod(QgsApplication.chartPlotRegistry)
|
||||||
QgsApplication.messageLog = staticmethod(QgsApplication.messageLog)
|
QgsApplication.messageLog = staticmethod(QgsApplication.messageLog)
|
||||||
QgsApplication.authManager = staticmethod(QgsApplication.authManager)
|
QgsApplication.authManager = staticmethod(QgsApplication.authManager)
|
||||||
QgsApplication.authConfigurationStorageRegistry = staticmethod(QgsApplication.authConfigurationStorageRegistry)
|
QgsApplication.authConfigurationStorageRegistry = staticmethod(QgsApplication.authConfigurationStorageRegistry)
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
# The following has been generated automatically from src/core/plot/qgschart.h
|
|
||||||
try:
|
|
||||||
QgsBarChart.create = staticmethod(QgsBarChart.create)
|
|
||||||
QgsBarChart.__overridden_methods__ = ['type', 'renderContent', 'writeXml', 'readXml']
|
|
||||||
QgsBarChart.__group__ = ['plot']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
QgsLineChart.create = staticmethod(QgsLineChart.create)
|
|
||||||
QgsLineChart.__overridden_methods__ = ['type', 'renderContent', 'writeXml', 'readXml']
|
|
||||||
QgsLineChart.__group__ = ['plot']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
13
python/core/auto_additions/qgschartplot.py
Normal file
13
python/core/auto_additions/qgschartplot.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# The following has been generated automatically from src/core/plot/qgschartplot.h
|
||||||
|
try:
|
||||||
|
QgsBarChartPlot.create = staticmethod(QgsBarChartPlot.create)
|
||||||
|
QgsBarChartPlot.__overridden_methods__ = ['type', 'renderContent', 'writeXml', 'readXml']
|
||||||
|
QgsBarChartPlot.__group__ = ['plot']
|
||||||
|
except (NameError, AttributeError):
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
QgsLineChartPlot.create = staticmethod(QgsLineChartPlot.create)
|
||||||
|
QgsLineChartPlot.__overridden_methods__ = ['type', 'renderContent', 'writeXml', 'readXml']
|
||||||
|
QgsLineChartPlot.__group__ = ['plot']
|
||||||
|
except (NameError, AttributeError):
|
||||||
|
pass
|
12
python/core/auto_additions/qgschartplotregistry.py
Normal file
12
python/core/auto_additions/qgschartplotregistry.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# The following has been generated automatically from src/core/plot/qgschartplotregistry.h
|
||||||
|
try:
|
||||||
|
QgsChartPlotRegistry.__attribute_docs__ = {'chartAdded': 'Emitted whenever a new chart type is added to the registry, with the\nspecified ``type`` and visible ``name``.\n', 'chartAboutToBeRemoved': 'Emitted whenever a new chart type is added to the registry, with the\nspecified ``type`` and visible ``name``.\n'}
|
||||||
|
QgsChartPlotRegistry.__signal_arguments__ = {'chartAdded': ['type: str', 'name: str'], 'chartAboutToBeRemoved': ['type: str']}
|
||||||
|
QgsChartPlotRegistry.__group__ = ['plot']
|
||||||
|
except (NameError, AttributeError):
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
QgsChartPlotAbstractMetadata.__abstract_methods__ = ['createChart']
|
||||||
|
QgsChartPlotAbstractMetadata.__group__ = ['plot']
|
||||||
|
except (NameError, AttributeError):
|
||||||
|
pass
|
@ -1,12 +0,0 @@
|
|||||||
# The following has been generated automatically from src/core/plot/qgschartregistry.h
|
|
||||||
try:
|
|
||||||
QgsChartRegistry.__attribute_docs__ = {'chartAdded': 'Emitted whenever a new chart type is added to the registry, with the\nspecified ``type`` and visible ``name``.\n', 'chartAboutToBeRemoved': 'Emitted whenever a new chart type is added to the registry, with the\nspecified ``type`` and visible ``name``.\n'}
|
|
||||||
QgsChartRegistry.__signal_arguments__ = {'chartAdded': ['type: str', 'name: str'], 'chartAboutToBeRemoved': ['type: str']}
|
|
||||||
QgsChartRegistry.__group__ = ['plot']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
QgsChartAbstractMetadata.__abstract_methods__ = ['createChart']
|
|
||||||
QgsChartAbstractMetadata.__group__ = ['plot']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
@ -1,7 +1,7 @@
|
|||||||
/************************************************************************
|
/************************************************************************
|
||||||
* This file has been generated automatically from *
|
* This file has been generated automatically from *
|
||||||
* *
|
* *
|
||||||
* src/core/plot/qgschart.h *
|
* src/core/plot/qgschartplot.h *
|
||||||
* *
|
* *
|
||||||
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QgsBarChart : Qgs2DXyPlot
|
class QgsBarChartPlot : Qgs2DXyPlot
|
||||||
{
|
{
|
||||||
%Docstring(signature="appended")
|
%Docstring(signature="appended")
|
||||||
A simple bar chart class.
|
A simple bar chart class.
|
||||||
@ -22,12 +22,12 @@ A simple bar chart class.
|
|||||||
%End
|
%End
|
||||||
|
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
#include "qgschart.h"
|
#include "qgschartplot.h"
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QgsBarChart();
|
QgsBarChartPlot();
|
||||||
~QgsBarChart();
|
~QgsBarChartPlot();
|
||||||
|
|
||||||
virtual QString type() const;
|
virtual QString type() const;
|
||||||
|
|
||||||
@ -39,7 +39,17 @@ A simple bar chart class.
|
|||||||
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
|
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
|
||||||
|
|
||||||
|
|
||||||
static QgsBarChart *create();
|
QgsFillSymbol *fillSymbol( int index ) const;
|
||||||
|
%Docstring
|
||||||
|
Returns the fill symbol at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
void setFillSymbol( int index, QgsFillSymbol *symbol /Transfer/ );
|
||||||
|
%Docstring
|
||||||
|
Sets the marker ``symbol`` at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
static QgsBarChartPlot *create();
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns a new bar chart.
|
Returns a new bar chart.
|
||||||
%End
|
%End
|
||||||
@ -47,7 +57,7 @@ Returns a new bar chart.
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class QgsLineChart : Qgs2DXyPlot
|
class QgsLineChartPlot : Qgs2DXyPlot
|
||||||
{
|
{
|
||||||
%Docstring(signature="appended")
|
%Docstring(signature="appended")
|
||||||
A simple line chart class.
|
A simple line chart class.
|
||||||
@ -60,12 +70,12 @@ A simple line chart class.
|
|||||||
%End
|
%End
|
||||||
|
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
#include "qgschart.h"
|
#include "qgschartplot.h"
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QgsLineChart();
|
QgsLineChartPlot();
|
||||||
~QgsLineChart();
|
~QgsLineChartPlot();
|
||||||
|
|
||||||
virtual QString type() const;
|
virtual QString type() const;
|
||||||
|
|
||||||
@ -77,7 +87,27 @@ A simple line chart class.
|
|||||||
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
|
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
|
||||||
|
|
||||||
|
|
||||||
static QgsLineChart *create();
|
QgsMarkerSymbol *markerSymbol( int index ) const;
|
||||||
|
%Docstring
|
||||||
|
Returns the marker symbol at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
void setMarkerSymbol( int index, QgsMarkerSymbol *symbol /Transfer/ );
|
||||||
|
%Docstring
|
||||||
|
Sets the marker ``symbol`` at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
QgsLineSymbol *lineSymbol( int seriesIndex ) const;
|
||||||
|
%Docstring
|
||||||
|
Returns the line symbol at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
void setLineSymbol( int seriesIndex, QgsLineSymbol *symbol /Transfer/ );
|
||||||
|
%Docstring
|
||||||
|
Sets the marker ``symbol`` at a given ``index``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
static QgsLineChartPlot *create();
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns a new line chart.
|
Returns a new line chart.
|
||||||
%End
|
%End
|
||||||
@ -87,7 +117,7 @@ Returns a new line chart.
|
|||||||
/************************************************************************
|
/************************************************************************
|
||||||
* This file has been generated automatically from *
|
* This file has been generated automatically from *
|
||||||
* *
|
* *
|
||||||
* src/core/plot/qgschart.h *
|
* src/core/plot/qgschartplot.h *
|
||||||
* *
|
* *
|
||||||
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
||||||
************************************************************************/
|
************************************************************************/
|
148
python/core/auto_generated/plot/qgschartplotregistry.sip.in
Normal file
148
python/core/auto_generated/plot/qgschartplotregistry.sip.in
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/core/plot/qgschartplotregistry.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
class QgsChartPlotAbstractMetadata
|
||||||
|
{
|
||||||
|
%Docstring(signature="appended")
|
||||||
|
Stores metadata about a chart class.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
In C++ you can use :py:class:`QgsChartPlotAbstractMetadata` convenience class.
|
||||||
|
|
||||||
|
.. versionadded:: 4.0
|
||||||
|
%End
|
||||||
|
|
||||||
|
%TypeHeaderCode
|
||||||
|
#include "qgschartplotregistry.h"
|
||||||
|
%End
|
||||||
|
public:
|
||||||
|
|
||||||
|
QgsChartPlotAbstractMetadata( const QString &type, const QString &visibleName );
|
||||||
|
%Docstring
|
||||||
|
Constructor for QgsChartPlotAbstractMetadata with the specified class
|
||||||
|
``type``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
virtual ~QgsChartPlotAbstractMetadata();
|
||||||
|
|
||||||
|
QString type() const;
|
||||||
|
%Docstring
|
||||||
|
Returns the unique type code for the chart class.
|
||||||
|
%End
|
||||||
|
|
||||||
|
QString visibleName() const;
|
||||||
|
%Docstring
|
||||||
|
Returns a translated, user visible name for the chart class.
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
|
virtual QgsPlot *createChart() = 0 /TransferBack/;
|
||||||
|
%Docstring
|
||||||
|
Creates a chart of this class.
|
||||||
|
%End
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class QgsChartPlotRegistry : QObject
|
||||||
|
{
|
||||||
|
%Docstring(signature="appended")
|
||||||
|
Registry of available chart types.
|
||||||
|
|
||||||
|
:py:class:`QgsChartPlotRegistry` is not usually directly created, but
|
||||||
|
rather accessed through :py:func:`QgsApplication.chartRegistry()`.
|
||||||
|
|
||||||
|
.. versionadded:: 4.0
|
||||||
|
%End
|
||||||
|
|
||||||
|
%TypeHeaderCode
|
||||||
|
#include "qgschartplotregistry.h"
|
||||||
|
%End
|
||||||
|
public:
|
||||||
|
|
||||||
|
QgsChartPlotRegistry( QObject *parent = 0 );
|
||||||
|
%Docstring
|
||||||
|
Creates a new empty item registry.
|
||||||
|
|
||||||
|
QgsChartPlotRegistry is not usually directly created, but rather
|
||||||
|
accessed through :py:func:`QgsApplication.chartRegistry()`.
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`populate`
|
||||||
|
%End
|
||||||
|
~QgsChartPlotRegistry();
|
||||||
|
|
||||||
|
bool populate();
|
||||||
|
%Docstring
|
||||||
|
Populates the registry with standard chart types. If called on a
|
||||||
|
non-empty registry then this will have no effect and will return
|
||||||
|
``False``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
|
QgsChartPlotAbstractMetadata *chartMetadata( const QString &type ) const;
|
||||||
|
%Docstring
|
||||||
|
Returns the metadata for the specified chart ``type``. Returns ``None``
|
||||||
|
if a corresponding type was not found in the registry.
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
|
bool addChartType( QgsChartPlotAbstractMetadata *metadata /Transfer/ );
|
||||||
|
%Docstring
|
||||||
|
Registers a new chart type.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Takes ownership of the metadata instance.
|
||||||
|
%End
|
||||||
|
|
||||||
|
bool removeChartType( const QString &type );
|
||||||
|
%Docstring
|
||||||
|
Removes a new a chart type from the registry.
|
||||||
|
%End
|
||||||
|
|
||||||
|
QgsPlot *createChart( const QString &type ) const /TransferBack/;
|
||||||
|
%Docstring
|
||||||
|
Creates a new instance of a chart given the ``type``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
QMap<QString, QString> chartTypes() const;
|
||||||
|
%Docstring
|
||||||
|
Returns a map of available charts types to translated name.
|
||||||
|
%End
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void chartAdded( const QString &type, const QString &name );
|
||||||
|
%Docstring
|
||||||
|
Emitted whenever a new chart type is added to the registry, with the
|
||||||
|
specified ``type`` and visible ``name``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
void chartAboutToBeRemoved( const QString &type );
|
||||||
|
%Docstring
|
||||||
|
Emitted whenever a new chart type is added to the registry, with the
|
||||||
|
specified ``type`` and visible ``name``.
|
||||||
|
%End
|
||||||
|
|
||||||
|
private:
|
||||||
|
QgsChartPlotRegistry( const QgsChartPlotRegistry &rh );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/core/plot/qgschartplotregistry.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
||||||
|
************************************************************************/
|
@ -79,42 +79,6 @@ Returns the series' name.
|
|||||||
void setName( const QString &name );
|
void setName( const QString &name );
|
||||||
%Docstring
|
%Docstring
|
||||||
Sets the series' name.
|
Sets the series' name.
|
||||||
%End
|
|
||||||
|
|
||||||
QgsMarkerSymbol *markerSymbol() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the marker symbol to be used by various chart types when
|
|
||||||
rendering the series' data.
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setMarkerSymbol( QgsMarkerSymbol *markerSymbol /Transfer/ );
|
|
||||||
%Docstring
|
|
||||||
Sets the marker symbol to be used by various chart types when rendering
|
|
||||||
the series' data.
|
|
||||||
%End
|
|
||||||
|
|
||||||
QgsLineSymbol *lineSymbol() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the line symbol to be used by various chart types when rendering
|
|
||||||
the series' data.
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setLineSymbol( QgsLineSymbol *lineSymbol /Transfer/ );
|
|
||||||
%Docstring
|
|
||||||
Sets the line symbol to be used by various chart types when rendering
|
|
||||||
the series' data.
|
|
||||||
%End
|
|
||||||
|
|
||||||
QgsFillSymbol *fillSymbol() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the fill symbol to be used by various chart types when rendering
|
|
||||||
the series' data.
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setFillSymbol( QgsFillSymbol *fillSymbol /Transfer/ );
|
|
||||||
%Docstring
|
|
||||||
Sets the fill symbol to be used by various chart types when rendering
|
|
||||||
the series' data.
|
|
||||||
%End
|
%End
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -926,7 +926,7 @@ Returns the application's sensor registry, used for sensor types.
|
|||||||
.. versionadded:: 3.32
|
.. versionadded:: 3.32
|
||||||
%End
|
%End
|
||||||
|
|
||||||
static QgsChartRegistry *chartRegistry() /KeepReference/;
|
static QgsChartPlotRegistry *chartPlotRegistry() /KeepReference/;
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns the application's chart registry, used for chart types.
|
Returns the application's chart registry, used for chart types.
|
||||||
|
|
||||||
|
@ -518,8 +518,8 @@
|
|||||||
%Include auto_generated/painting/qgspaintenginehack.sip
|
%Include auto_generated/painting/qgspaintenginehack.sip
|
||||||
%Include auto_generated/painting/qgspainting.sip
|
%Include auto_generated/painting/qgspainting.sip
|
||||||
%Include auto_generated/pdf/qgspdfrenderer.sip
|
%Include auto_generated/pdf/qgspdfrenderer.sip
|
||||||
%Include auto_generated/plot/qgschart.sip
|
%Include auto_generated/plot/qgschartplot.sip
|
||||||
%Include auto_generated/plot/qgschartregistry.sip
|
%Include auto_generated/plot/qgschartplotregistry.sip
|
||||||
%Include auto_generated/plot/qgsplot.sip
|
%Include auto_generated/plot/qgsplot.sip
|
||||||
%Include auto_generated/pointcloud/qgspointcloudattribute.sip
|
%Include auto_generated/pointcloud/qgspointcloudattribute.sip
|
||||||
%Include auto_generated/pointcloud/qgspointcloudattributebyramprenderer.sip
|
%Include auto_generated/pointcloud/qgspointcloudattributebyramprenderer.sip
|
||||||
|
@ -90,8 +90,8 @@ set(QGIS_CORE_SRCS
|
|||||||
gps/qgssatelliteinformation.cpp
|
gps/qgssatelliteinformation.cpp
|
||||||
gps/qgsvectorlayergpslogger.cpp
|
gps/qgsvectorlayergpslogger.cpp
|
||||||
|
|
||||||
plot/qgschart.cpp
|
plot/qgschartplot.cpp
|
||||||
plot/qgschartregistry.cpp
|
plot/qgschartplotregistry.cpp
|
||||||
plot/qgsplot.cpp
|
plot/qgsplot.cpp
|
||||||
|
|
||||||
symbology/qgs25drenderer.cpp
|
symbology/qgs25drenderer.cpp
|
||||||
@ -1741,8 +1741,8 @@ set(QGIS_CORE_HDRS
|
|||||||
|
|
||||||
pdf/qgspdfrenderer.h
|
pdf/qgspdfrenderer.h
|
||||||
|
|
||||||
plot/qgschart.h
|
plot/qgschartplot.h
|
||||||
plot/qgschartregistry.h
|
plot/qgschartplotregistry.h
|
||||||
plot/qgsplot.h
|
plot/qgsplot.h
|
||||||
|
|
||||||
pointcloud/qgspointcloudattribute.h
|
pointcloud/qgspointcloudattribute.h
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
qgsplot.cpp
|
qgschartplot.cpp
|
||||||
---------------
|
---------------
|
||||||
begin : March 2022
|
begin : June 2025
|
||||||
copyright : (C) 2022 by Nyall Dawson
|
copyright : (C) 2025 by Mathieu
|
||||||
email : nyall dot dawson at gmail dot com
|
email : mathieu at opengis dot ch
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -15,7 +15,7 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "qgschart.h"
|
#include "qgschartplot.h"
|
||||||
#include "qgsexpressioncontextutils.h"
|
#include "qgsexpressioncontextutils.h"
|
||||||
#include "qgssymbol.h"
|
#include "qgssymbol.h"
|
||||||
#include "qgssymbollayer.h"
|
#include "qgssymbollayer.h"
|
||||||
@ -23,8 +23,13 @@
|
|||||||
#include "qgslinesymbol.h"
|
#include "qgslinesymbol.h"
|
||||||
#include "qgsmarkersymbol.h"
|
#include "qgsmarkersymbol.h"
|
||||||
|
|
||||||
void QgsBarChart::renderContent( QgsRenderContext &context, const QRectF &plotArea, const QgsPlotData &plotData )
|
void QgsBarChartPlot::renderContent( QgsRenderContext &context, const QRectF &plotArea, const QgsPlotData &plotData )
|
||||||
{
|
{
|
||||||
|
if ( mFillSymbols.empty() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QList<QgsAbstractPlotSeries *> seriesList = plotData.series();
|
const QList<QgsAbstractPlotSeries *> seriesList = plotData.series();
|
||||||
if ( seriesList.isEmpty() )
|
if ( seriesList.isEmpty() )
|
||||||
{
|
{
|
||||||
@ -51,11 +56,12 @@ void QgsBarChart::renderContent( QgsRenderContext &context, const QRectF &plotAr
|
|||||||
int seriesIndex = 0;
|
int seriesIndex = 0;
|
||||||
for ( const QgsAbstractPlotSeries *series : seriesList )
|
for ( const QgsAbstractPlotSeries *series : seriesList )
|
||||||
{
|
{
|
||||||
if ( !series->fillSymbol() )
|
QgsFillSymbol *symbol = fillSymbol( seriesIndex % mFillSymbols.size() );
|
||||||
|
if ( !symbol )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
series->fillSymbol()->startRender( context );
|
symbol->startRender( context );
|
||||||
|
|
||||||
const double barStartAdjustement = -( barsWidth / 2 ) + barWidth * seriesIndex;
|
const double barStartAdjustement = -( barsWidth / 2 ) + barWidth * seriesIndex;
|
||||||
if ( const QgsXyPlotSeries *xySeries = dynamic_cast<const QgsXyPlotSeries *>( series ) )
|
if ( const QgsXyPlotSeries *xySeries = dynamic_cast<const QgsXyPlotSeries *>( series ) )
|
||||||
@ -86,40 +92,70 @@ void QgsBarChart::renderContent( QgsRenderContext &context, const QRectF &plotAr
|
|||||||
plotArea.y() + plotArea.height() - zero );
|
plotArea.y() + plotArea.height() - zero );
|
||||||
|
|
||||||
chartScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "chart_value" ), pair.second, true ) );
|
chartScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "chart_value" ), pair.second, true ) );
|
||||||
series->fillSymbol()->renderPolygon( QPolygonF( QRectF( topLeft, bottomRight ) ), nullptr, nullptr, context );
|
symbol->renderPolygon( QPolygonF( QRectF( topLeft, bottomRight ) ), nullptr, nullptr, context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
series->fillSymbol()->stopRender( context );
|
symbol->stopRender( context );
|
||||||
seriesIndex++;
|
seriesIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.painter()->restore();
|
context.painter()->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsBarChart::writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const
|
QgsFillSymbol *QgsBarChartPlot::fillSymbol( int index ) const
|
||||||
|
{
|
||||||
|
if ( index < 0 || index >= static_cast<int>( mFillSymbols.size() ) )
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mFillSymbols[index].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsBarChartPlot::setFillSymbol( int index, QgsFillSymbol *symbol )
|
||||||
|
{
|
||||||
|
if ( index < 0 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( index + 1 >= static_cast<int>( mFillSymbols.size() ) )
|
||||||
|
{
|
||||||
|
mFillSymbols.resize( index + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
mFillSymbols[index].reset( symbol );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QgsBarChartPlot::writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const
|
||||||
{
|
{
|
||||||
Qgs2DXyPlot::writeXml( element, document, context );
|
Qgs2DXyPlot::writeXml( element, document, context );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsBarChart::readXml( const QDomElement &element, const QgsReadWriteContext &context )
|
bool QgsBarChartPlot::readXml( const QDomElement &element, const QgsReadWriteContext &context )
|
||||||
{
|
{
|
||||||
Qgs2DXyPlot::readXml( element, context );
|
Qgs2DXyPlot::readXml( element, context );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsBarChart *QgsBarChart::create()
|
QgsBarChartPlot *QgsBarChartPlot::create()
|
||||||
{
|
{
|
||||||
return new QgsBarChart();
|
return new QgsBarChartPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// QgsLineChart
|
// QgsLineChartPlot
|
||||||
//
|
//
|
||||||
|
|
||||||
void QgsLineChart::renderContent( QgsRenderContext &context, const QRectF &plotArea, const QgsPlotData &plotData )
|
void QgsLineChartPlot::renderContent( QgsRenderContext &context, const QRectF &plotArea, const QgsPlotData &plotData )
|
||||||
{
|
{
|
||||||
|
if ( mLineSymbols.empty() && mMarkerSymbols.empty() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QList<QgsAbstractPlotSeries *> seriesList = plotData.series();
|
const QList<QgsAbstractPlotSeries *> seriesList = plotData.series();
|
||||||
if ( seriesList.isEmpty() )
|
if ( seriesList.isEmpty() )
|
||||||
{
|
{
|
||||||
@ -144,19 +180,21 @@ void QgsLineChart::renderContent( QgsRenderContext &context, const QRectF &plotA
|
|||||||
int seriesIndex = 0;
|
int seriesIndex = 0;
|
||||||
for ( const QgsAbstractPlotSeries *series : seriesList )
|
for ( const QgsAbstractPlotSeries *series : seriesList )
|
||||||
{
|
{
|
||||||
if ( !series->lineSymbol() && !series->markerSymbol() )
|
QgsLineSymbol *lSymbol = !mLineSymbols.empty() ? lineSymbol( seriesIndex % mLineSymbols.size() ) : nullptr;
|
||||||
|
QgsMarkerSymbol *mSymbol = !mMarkerSymbols.empty() ? markerSymbol( seriesIndex % mMarkerSymbols.size() ) : nullptr;
|
||||||
|
if ( !lSymbol && !mSymbol )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( series->lineSymbol() )
|
if ( lSymbol )
|
||||||
{
|
{
|
||||||
series->lineSymbol()->startRender( context );
|
lSymbol->startRender( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( series->markerSymbol() )
|
if ( mSymbol )
|
||||||
{
|
{
|
||||||
series->markerSymbol()->startRender( context );
|
mSymbol->startRender( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( const QgsXyPlotSeries *xySeries = dynamic_cast<const QgsXyPlotSeries *>( series ) )
|
if ( const QgsXyPlotSeries *xySeries = dynamic_cast<const QgsXyPlotSeries *>( series ) )
|
||||||
@ -191,7 +229,7 @@ void QgsLineChart::renderContent( QgsRenderContext &context, const QRectF &plotA
|
|||||||
dataIndex++;
|
dataIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( series->lineSymbol() )
|
if ( lSymbol )
|
||||||
{
|
{
|
||||||
chartScope->removeVariable( QStringLiteral( "chart_value" ) );
|
chartScope->removeVariable( QStringLiteral( "chart_value" ) );
|
||||||
QVector<QPointF> line;
|
QVector<QPointF> line;
|
||||||
@ -205,24 +243,22 @@ void QgsLineChart::renderContent( QgsRenderContext &context, const QRectF &plotA
|
|||||||
{
|
{
|
||||||
if ( !line.isEmpty() )
|
if ( !line.isEmpty() )
|
||||||
{
|
{
|
||||||
series->lineSymbol()->renderPolyline( QPolygonF( line ), nullptr, context );
|
lSymbol->renderPolyline( QPolygonF( line ), nullptr, context );
|
||||||
line.clear();
|
line.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !line.isEmpty() )
|
if ( !line.isEmpty() )
|
||||||
{
|
{
|
||||||
series->lineSymbol()->renderPolyline( QPolygonF( line ), nullptr, context );
|
lSymbol->renderPolyline( QPolygonF( line ), nullptr, context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( series->markerSymbol() )
|
if ( mSymbol )
|
||||||
{
|
{
|
||||||
int pointIndex = 0;
|
int pointIndex = 0;
|
||||||
for ( const QPointF &point : points )
|
for ( const QPointF &point : points )
|
||||||
{
|
{
|
||||||
if ( !point.isNull() )
|
if ( !point.isNull() )
|
||||||
{
|
|
||||||
if ( series->markerSymbol() )
|
|
||||||
{
|
{
|
||||||
double value = 0;
|
double value = 0;
|
||||||
if ( xAxis().type() == Qgis::PlotAxisType::ValueType )
|
if ( xAxis().type() == Qgis::PlotAxisType::ValueType )
|
||||||
@ -242,21 +278,20 @@ void QgsLineChart::renderContent( QgsRenderContext &context, const QRectF &plotA
|
|||||||
}
|
}
|
||||||
|
|
||||||
chartScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "chart_value" ), value, true ) );
|
chartScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "chart_value" ), value, true ) );
|
||||||
series->markerSymbol()->renderPoint( point, nullptr, context );
|
mSymbol->renderPoint( point, nullptr, context );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pointIndex++;
|
pointIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( series->lineSymbol() )
|
if ( lSymbol )
|
||||||
{
|
{
|
||||||
series->lineSymbol()->stopRender( context );
|
lSymbol->stopRender( context );
|
||||||
}
|
}
|
||||||
if ( series->markerSymbol() )
|
if ( mSymbol )
|
||||||
{
|
{
|
||||||
series->markerSymbol()->stopRender( context );
|
mSymbol->stopRender( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
seriesIndex++;
|
seriesIndex++;
|
||||||
@ -265,19 +300,69 @@ void QgsLineChart::renderContent( QgsRenderContext &context, const QRectF &plotA
|
|||||||
context.painter()->restore();
|
context.painter()->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsLineChart::writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const
|
QgsMarkerSymbol *QgsLineChartPlot::markerSymbol( int index ) const
|
||||||
|
{
|
||||||
|
if ( index < 0 || index >= static_cast<int>( mMarkerSymbols.size() ) )
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mMarkerSymbols[index].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsLineChartPlot::setMarkerSymbol( int index, QgsMarkerSymbol *symbol )
|
||||||
|
{
|
||||||
|
if ( index < 0 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( index + 1 >= static_cast<int>( mMarkerSymbols.size() ) )
|
||||||
|
{
|
||||||
|
mMarkerSymbols.resize( index + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
mMarkerSymbols[index].reset( symbol );
|
||||||
|
}
|
||||||
|
|
||||||
|
QgsLineSymbol *QgsLineChartPlot::lineSymbol( int index ) const
|
||||||
|
{
|
||||||
|
if ( index < 0 || index >= static_cast<int>( mLineSymbols.size() ) )
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mLineSymbols[index].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsLineChartPlot::setLineSymbol( int index, QgsLineSymbol *symbol )
|
||||||
|
{
|
||||||
|
if ( index < 0 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( index + 1 >= static_cast<int>( mLineSymbols.size() ) )
|
||||||
|
{
|
||||||
|
mLineSymbols.resize( index + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
mLineSymbols[index].reset( symbol );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QgsLineChartPlot::writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const
|
||||||
{
|
{
|
||||||
Qgs2DXyPlot::writeXml( element, document, context );
|
Qgs2DXyPlot::writeXml( element, document, context );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsLineChart::readXml( const QDomElement &element, const QgsReadWriteContext &context )
|
bool QgsLineChartPlot::readXml( const QDomElement &element, const QgsReadWriteContext &context )
|
||||||
{
|
{
|
||||||
Qgs2DXyPlot::readXml( element, context );
|
Qgs2DXyPlot::readXml( element, context );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsLineChart *QgsLineChart::create()
|
QgsLineChartPlot *QgsLineChartPlot::create()
|
||||||
{
|
{
|
||||||
return new QgsLineChart();
|
return new QgsLineChartPlot();
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
qgschart.h
|
qgschartplot.h
|
||||||
---------------
|
---------------
|
||||||
begin : June 2025
|
begin : June 2025
|
||||||
copyright : (C) 2025 by Mathieu
|
copyright : (C) 2025 by Mathieu
|
||||||
@ -14,11 +14,14 @@
|
|||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifndef QGSCHART_H
|
#ifndef QGSCHARTPLOT_H
|
||||||
#define QGSCHART_H
|
#define QGSCHARTPLOT_H
|
||||||
|
|
||||||
#include "qgis_core.h"
|
#include "qgis_core.h"
|
||||||
#include "qgis_sip.h"
|
#include "qgis_sip.h"
|
||||||
|
#include "qgsfillsymbol.h"
|
||||||
|
#include "qgslinesymbol.h"
|
||||||
|
#include "qgsmarkersymbol.h"
|
||||||
#include "qgsplot.h"
|
#include "qgsplot.h"
|
||||||
|
|
||||||
|
|
||||||
@ -30,12 +33,12 @@
|
|||||||
* \ingroup core
|
* \ingroup core
|
||||||
* \since QGIS 4.0
|
* \since QGIS 4.0
|
||||||
*/
|
*/
|
||||||
class CORE_EXPORT QgsBarChart : public Qgs2DXyPlot
|
class CORE_EXPORT QgsBarChartPlot : public Qgs2DXyPlot
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QgsBarChart() = default;
|
QgsBarChartPlot() = default;
|
||||||
~QgsBarChart() = default;
|
~QgsBarChartPlot() = default;
|
||||||
|
|
||||||
QString type() const override { return QStringLiteral( "bar" ); }
|
QString type() const override { return QStringLiteral( "bar" ); }
|
||||||
|
|
||||||
@ -44,11 +47,22 @@ class CORE_EXPORT QgsBarChart : public Qgs2DXyPlot
|
|||||||
bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
|
bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
|
||||||
bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
|
bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the fill symbol at a given \a index.
|
||||||
|
*/
|
||||||
|
QgsFillSymbol *fillSymbol( int index ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the marker \a symbol at a given \a index.
|
||||||
|
*/
|
||||||
|
void setFillSymbol( int index, QgsFillSymbol *symbol SIP_TRANSFER );
|
||||||
|
|
||||||
//! Returns a new bar chart.
|
//! Returns a new bar chart.
|
||||||
static QgsBarChart *create();
|
static QgsBarChartPlot *create();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
std::vector<std::unique_ptr<QgsFillSymbol>> mFillSymbols;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -60,12 +74,12 @@ class CORE_EXPORT QgsBarChart : public Qgs2DXyPlot
|
|||||||
* \ingroup core
|
* \ingroup core
|
||||||
* \since QGIS 4.0
|
* \since QGIS 4.0
|
||||||
*/
|
*/
|
||||||
class CORE_EXPORT QgsLineChart : public Qgs2DXyPlot
|
class CORE_EXPORT QgsLineChartPlot : public Qgs2DXyPlot
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QgsLineChart() = default;
|
QgsLineChartPlot() = default;
|
||||||
~QgsLineChart() = default;
|
~QgsLineChartPlot() = default;
|
||||||
|
|
||||||
QString type() const override { return QStringLiteral( "line" ); }
|
QString type() const override { return QStringLiteral( "line" ); }
|
||||||
|
|
||||||
@ -74,11 +88,33 @@ class CORE_EXPORT QgsLineChart : public Qgs2DXyPlot
|
|||||||
bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
|
bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
|
||||||
bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
|
bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the marker symbol at a given \a index.
|
||||||
|
*/
|
||||||
|
QgsMarkerSymbol *markerSymbol( int index ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the marker \a symbol at a given \a index.
|
||||||
|
*/
|
||||||
|
void setMarkerSymbol( int index, QgsMarkerSymbol *symbol SIP_TRANSFER );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the line symbol at a given \a index.
|
||||||
|
*/
|
||||||
|
QgsLineSymbol *lineSymbol( int seriesIndex ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the marker \a symbol at a given \a index.
|
||||||
|
*/
|
||||||
|
void setLineSymbol( int seriesIndex, QgsLineSymbol *symbol SIP_TRANSFER );
|
||||||
|
|
||||||
//! Returns a new line chart.
|
//! Returns a new line chart.
|
||||||
static QgsLineChart *create();
|
static QgsLineChartPlot *create();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
std::vector<std::unique_ptr<QgsMarkerSymbol>> mMarkerSymbols;
|
||||||
|
std::vector<std::unique_ptr<QgsLineSymbol>> mLineSymbols;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // QGSCHARTPLOT_H
|
@ -1,5 +1,5 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
qgschartregistry.cpp
|
qgschartplotregistry.cpp
|
||||||
------------------------
|
------------------------
|
||||||
begin : June 2025
|
begin : June 2025
|
||||||
copyright : (C) 2025 by Mathieu Pellerin
|
copyright : (C) 2025 by Mathieu Pellerin
|
||||||
@ -16,38 +16,38 @@
|
|||||||
|
|
||||||
#include "qgsconfig.h"
|
#include "qgsconfig.h"
|
||||||
|
|
||||||
#include "qgschartregistry.h"
|
#include "qgschartplotregistry.h"
|
||||||
#include "moc_qgschartregistry.cpp"
|
#include "moc_qgschartplotregistry.cpp"
|
||||||
#include "qgschart.h"
|
#include "qgschartplot.h"
|
||||||
#include "qgsplot.h"
|
#include "qgsplot.h"
|
||||||
|
|
||||||
QgsChartRegistry::QgsChartRegistry( QObject *parent )
|
QgsChartPlotRegistry::QgsChartPlotRegistry( QObject *parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsChartRegistry::~QgsChartRegistry()
|
QgsChartPlotRegistry::~QgsChartPlotRegistry()
|
||||||
{
|
{
|
||||||
qDeleteAll( mMetadata );
|
qDeleteAll( mMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsChartRegistry::populate()
|
bool QgsChartPlotRegistry::populate()
|
||||||
{
|
{
|
||||||
if ( !mMetadata.isEmpty() )
|
if ( !mMetadata.isEmpty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
addChartType( new QgsChartMetadata( QLatin1String( "bar" ), QObject::tr( "Bar chart" ), QgsBarChart::create ) );
|
addChartType( new QgsChartPlotMetadata( QLatin1String( "bar" ), QObject::tr( "Bar chart" ), QgsBarChartPlot::create ) );
|
||||||
addChartType( new QgsChartMetadata( QLatin1String( "line" ), QObject::tr( "Line chart" ), QgsLineChart::create ) );
|
addChartType( new QgsChartPlotMetadata( QLatin1String( "line" ), QObject::tr( "Line chart" ), QgsLineChartPlot::create ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsChartAbstractMetadata *QgsChartRegistry::chartMetadata( const QString &type ) const
|
QgsChartPlotAbstractMetadata *QgsChartPlotRegistry::chartMetadata( const QString &type ) const
|
||||||
{
|
{
|
||||||
return mMetadata.value( type );
|
return mMetadata.value( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsChartRegistry::addChartType( QgsChartAbstractMetadata *metadata )
|
bool QgsChartPlotRegistry::addChartType( QgsChartPlotAbstractMetadata *metadata )
|
||||||
{
|
{
|
||||||
if ( !metadata || mMetadata.contains( metadata->type() ) )
|
if ( !metadata || mMetadata.contains( metadata->type() ) )
|
||||||
return false;
|
return false;
|
||||||
@ -57,7 +57,7 @@ bool QgsChartRegistry::addChartType( QgsChartAbstractMetadata *metadata )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsChartRegistry::removeChartType( const QString &type )
|
bool QgsChartPlotRegistry::removeChartType( const QString &type )
|
||||||
{
|
{
|
||||||
if ( !mMetadata.contains( type ) )
|
if ( !mMetadata.contains( type ) )
|
||||||
return false;
|
return false;
|
||||||
@ -67,7 +67,7 @@ bool QgsChartRegistry::removeChartType( const QString &type )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsPlot *QgsChartRegistry::createChart( const QString &type ) const
|
QgsPlot *QgsChartPlotRegistry::createChart( const QString &type ) const
|
||||||
{
|
{
|
||||||
if ( !mMetadata.contains( type ) )
|
if ( !mMetadata.contains( type ) )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -75,7 +75,7 @@ QgsPlot *QgsChartRegistry::createChart( const QString &type ) const
|
|||||||
return mMetadata[type]->createChart();
|
return mMetadata[type]->createChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QString> QgsChartRegistry::chartTypes() const
|
QMap<QString, QString> QgsChartPlotRegistry::chartTypes() const
|
||||||
{
|
{
|
||||||
QMap<QString, QString> types;
|
QMap<QString, QString> types;
|
||||||
for ( auto it = mMetadata.constBegin(); it != mMetadata.constEnd(); ++it )
|
for ( auto it = mMetadata.constBegin(); it != mMetadata.constEnd(); ++it )
|
@ -1,5 +1,5 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
qgschartregistry.h
|
qgschartplotregistry.h
|
||||||
------------------------
|
------------------------
|
||||||
begin : June 2025
|
begin : June 2025
|
||||||
copyright : (C) 2025 by Mathieu Pellerin
|
copyright : (C) 2025 by Mathieu Pellerin
|
||||||
@ -13,8 +13,8 @@
|
|||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifndef QGSCHARTREGISTRY_H
|
#ifndef QGSCHARTPLOTREGISTRY_H
|
||||||
#define QGSCHARTREGISTRY_H
|
#define QGSCHARTPLOTREGISTRY_H
|
||||||
|
|
||||||
#include "qgis_core.h"
|
#include "qgis_core.h"
|
||||||
#include "qgis_sip.h"
|
#include "qgis_sip.h"
|
||||||
@ -23,24 +23,25 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
|
* \class QgsChartPlotAbstractMetadata
|
||||||
* \brief Stores metadata about a chart class.
|
* \brief Stores metadata about a chart class.
|
||||||
*
|
*
|
||||||
* \note In C++ you can use QgsChartAbstractMetadata convenience class.
|
* \note In C++ you can use QgsChartPlotAbstractMetadata convenience class.
|
||||||
* \since QGIS 4.0
|
* \since QGIS 4.0
|
||||||
*/
|
*/
|
||||||
class CORE_EXPORT QgsChartAbstractMetadata
|
class CORE_EXPORT QgsChartPlotAbstractMetadata
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for QgsChartAbstractMetadata with the specified class \a type.
|
* Constructor for QgsChartPlotAbstractMetadata with the specified class \a type.
|
||||||
*/
|
*/
|
||||||
QgsChartAbstractMetadata( const QString &type, const QString &visibleName )
|
QgsChartPlotAbstractMetadata( const QString &type, const QString &visibleName )
|
||||||
: mType( type )
|
: mType( type )
|
||||||
, mVisibleName( visibleName )
|
, mVisibleName( visibleName )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~QgsChartAbstractMetadata() = default;
|
virtual ~QgsChartPlotAbstractMetadata() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the unique type code for the chart class.
|
* Returns the unique type code for the chart class.
|
||||||
@ -79,37 +80,38 @@ class CORE_EXPORT QgsChartAbstractMetadata
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Chart creation function
|
//! Chart creation function
|
||||||
typedef std::function<QgsPlot *()> QgsChartCreateFunc SIP_SKIP;
|
typedef std::function<QgsPlot *()> QgsChartPlotCreateFunc SIP_SKIP;
|
||||||
|
|
||||||
#ifndef SIP_RUN
|
#ifndef SIP_RUN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
|
* \class QgsChartPlotMetadata
|
||||||
* \brief Convenience metadata class that uses static functions to create charts and their configuration widgets.
|
* \brief Convenience metadata class that uses static functions to create charts and their configuration widgets.
|
||||||
* \note not available in Python bindings
|
* \note not available in Python bindings
|
||||||
*/
|
*/
|
||||||
class CORE_EXPORT QgsChartMetadata : public QgsChartAbstractMetadata
|
class CORE_EXPORT QgsChartPlotMetadata : public QgsChartPlotAbstractMetadata
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for QgsChartMetadata with the specified class \a type.
|
* Constructor for QgsChartMetadata with the specified class \a type.
|
||||||
*/
|
*/
|
||||||
QgsChartMetadata( const QString &type, const QString &visibleName,
|
QgsChartPlotMetadata( const QString &type, const QString &visibleName,
|
||||||
const QgsChartCreateFunc &pfCreate )
|
const QgsChartPlotCreateFunc &pfCreate )
|
||||||
: QgsChartAbstractMetadata( type, visibleName )
|
: QgsChartPlotAbstractMetadata( type, visibleName )
|
||||||
, mCreateFunc( pfCreate )
|
, mCreateFunc( pfCreate )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the classes' chart creation function.
|
* Returns the classes' chart creation function.
|
||||||
*/
|
*/
|
||||||
QgsChartCreateFunc createFunction() const { return mCreateFunc; }
|
QgsChartPlotCreateFunc createFunction() const { return mCreateFunc; }
|
||||||
|
|
||||||
QgsPlot *createChart() override { return mCreateFunc ? mCreateFunc() : nullptr; }
|
QgsPlot *createChart() override { return mCreateFunc ? mCreateFunc() : nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QgsChartCreateFunc mCreateFunc = nullptr;
|
QgsChartPlotCreateFunc mCreateFunc = nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -117,15 +119,15 @@ class CORE_EXPORT QgsChartMetadata : public QgsChartAbstractMetadata
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
* \class QgsChartRegistry
|
* \class QgsChartPlotRegistry
|
||||||
* \brief Registry of available chart types.
|
* \brief Registry of available chart types.
|
||||||
*
|
*
|
||||||
* QgsChartRegistry is not usually directly created, but rather accessed through
|
* QgsChartPlotRegistry is not usually directly created, but rather accessed through
|
||||||
* QgsApplication::chartRegistry().
|
* QgsApplication::chartRegistry().
|
||||||
*
|
*
|
||||||
* \since QGIS 4.0
|
* \since QGIS 4.0
|
||||||
*/
|
*/
|
||||||
class CORE_EXPORT QgsChartRegistry : public QObject
|
class CORE_EXPORT QgsChartPlotRegistry : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -134,13 +136,13 @@ class CORE_EXPORT QgsChartRegistry : public QObject
|
|||||||
/**
|
/**
|
||||||
* Creates a new empty item registry.
|
* Creates a new empty item registry.
|
||||||
*
|
*
|
||||||
* QgsChartRegistry is not usually directly created, but rather accessed through
|
* QgsChartPlotRegistry is not usually directly created, but rather accessed through
|
||||||
* QgsApplication::chartRegistry().
|
* QgsApplication::chartRegistry().
|
||||||
*
|
*
|
||||||
* \see populate()
|
* \see populate()
|
||||||
*/
|
*/
|
||||||
QgsChartRegistry( QObject *parent = nullptr );
|
QgsChartPlotRegistry( QObject *parent = nullptr );
|
||||||
~QgsChartRegistry() override;
|
~QgsChartPlotRegistry() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the registry with standard chart types. If called on a non-empty registry
|
* Populates the registry with standard chart types. If called on a non-empty registry
|
||||||
@ -148,14 +150,14 @@ class CORE_EXPORT QgsChartRegistry : public QObject
|
|||||||
*/
|
*/
|
||||||
bool populate();
|
bool populate();
|
||||||
|
|
||||||
QgsChartRegistry( const QgsChartRegistry &rh ) = delete;
|
QgsChartPlotRegistry( const QgsChartPlotRegistry &rh ) = delete;
|
||||||
QgsChartRegistry &operator=( const QgsChartRegistry &rh ) = delete;
|
QgsChartPlotRegistry &operator=( const QgsChartPlotRegistry &rh ) = delete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the metadata for the specified chart \a type. Returns NULLPTR if
|
* Returns the metadata for the specified chart \a type. Returns NULLPTR if
|
||||||
* a corresponding type was not found in the registry.
|
* a corresponding type was not found in the registry.
|
||||||
*/
|
*/
|
||||||
QgsChartAbstractMetadata *chartMetadata( const QString &type ) const;
|
QgsChartPlotAbstractMetadata *chartMetadata( const QString &type ) const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IMPORTANT: While it seems like /Factory/ would be the correct annotations here, that's not
|
* IMPORTANT: While it seems like /Factory/ would be the correct annotations here, that's not
|
||||||
@ -176,7 +178,7 @@ class CORE_EXPORT QgsChartRegistry : public QObject
|
|||||||
* Registers a new chart type.
|
* Registers a new chart type.
|
||||||
* \note Takes ownership of the metadata instance.
|
* \note Takes ownership of the metadata instance.
|
||||||
*/
|
*/
|
||||||
bool addChartType( QgsChartAbstractMetadata *metadata SIP_TRANSFER );
|
bool addChartType( QgsChartPlotAbstractMetadata *metadata SIP_TRANSFER );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a new a chart type from the registry.
|
* Removes a new a chart type from the registry.
|
||||||
@ -210,14 +212,14 @@ class CORE_EXPORT QgsChartRegistry : public QObject
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
#ifdef SIP_RUN
|
#ifdef SIP_RUN
|
||||||
QgsChartRegistry( const QgsChartRegistry &rh );
|
QgsChartPlotRegistry( const QgsChartPlotRegistry &rh );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QMap<QString, QgsChartAbstractMetadata *> mMetadata;
|
QMap<QString, QgsChartPlotAbstractMetadata *> mMetadata;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //QGSCHARTREGISTRY_H
|
#endif //QGSCHARTPLOTREGISTRY_H
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -965,36 +965,6 @@ void QgsAbstractPlotSeries::setName( const QString &name )
|
|||||||
mName = name;
|
mName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsMarkerSymbol *QgsAbstractPlotSeries::markerSymbol() const
|
|
||||||
{
|
|
||||||
return mMarkerSymbol.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAbstractPlotSeries::setMarkerSymbol( QgsMarkerSymbol *markerSymbol )
|
|
||||||
{
|
|
||||||
mMarkerSymbol.reset( markerSymbol );
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsLineSymbol *QgsAbstractPlotSeries::lineSymbol() const
|
|
||||||
{
|
|
||||||
return mLineSymbol.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAbstractPlotSeries::setLineSymbol( QgsLineSymbol *lineSymbol )
|
|
||||||
{
|
|
||||||
mLineSymbol.reset( lineSymbol );
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsFillSymbol *QgsAbstractPlotSeries::fillSymbol() const
|
|
||||||
{
|
|
||||||
return mFillSymbol.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAbstractPlotSeries::setFillSymbol( QgsFillSymbol *fillSymbol )
|
|
||||||
{
|
|
||||||
mFillSymbol.reset( fillSymbol );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// QgsXyPlotSeries
|
// QgsXyPlotSeries
|
||||||
//
|
//
|
||||||
|
@ -95,52 +95,12 @@ class CORE_EXPORT QgsAbstractPlotSeries
|
|||||||
*/
|
*/
|
||||||
void setName( const QString &name );
|
void setName( const QString &name );
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the marker symbol to be used by various chart types when
|
|
||||||
* rendering the series' data.
|
|
||||||
*/
|
|
||||||
QgsMarkerSymbol *markerSymbol() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the marker symbol to be used by various chart types when
|
|
||||||
* rendering the series' data.
|
|
||||||
*/
|
|
||||||
void setMarkerSymbol( QgsMarkerSymbol *markerSymbol SIP_TRANSFER );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the line symbol to be used by various chart types when
|
|
||||||
* rendering the series' data.
|
|
||||||
*/
|
|
||||||
QgsLineSymbol *lineSymbol() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the line symbol to be used by various chart types when
|
|
||||||
* rendering the series' data.
|
|
||||||
*/
|
|
||||||
void setLineSymbol( QgsLineSymbol *lineSymbol SIP_TRANSFER );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the fill symbol to be used by various chart types when
|
|
||||||
* rendering the series' data.
|
|
||||||
*/
|
|
||||||
QgsFillSymbol *fillSymbol() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the fill symbol to be used by various chart types when
|
|
||||||
* rendering the series' data.
|
|
||||||
*/
|
|
||||||
void setFillSymbol( QgsFillSymbol *fillSymbol SIP_TRANSFER );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef SIP_RUN
|
#ifdef SIP_RUN
|
||||||
QgsAbstractPlotSeries( const QgsAbstractPlotSeries &other );
|
QgsAbstractPlotSeries( const QgsAbstractPlotSeries &other );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString mName;
|
QString mName;
|
||||||
|
|
||||||
std::unique_ptr<QgsMarkerSymbol> mMarkerSymbol;
|
|
||||||
std::unique_ptr<QgsLineSymbol> mLineSymbol;
|
|
||||||
std::unique_ptr<QgsFillSymbol> mFillSymbol;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
#include "qgssymbollayerregistry.h"
|
#include "qgssymbollayerregistry.h"
|
||||||
#include "qgssymbollayerutils.h"
|
#include "qgssymbollayerutils.h"
|
||||||
#include "qgscalloutsregistry.h"
|
#include "qgscalloutsregistry.h"
|
||||||
#include "qgschartregistry.h"
|
#include "qgschartplotregistry.h"
|
||||||
#include "qgspluginlayerregistry.h"
|
#include "qgspluginlayerregistry.h"
|
||||||
#include "qgsclassificationmethodregistry.h"
|
#include "qgsclassificationmethodregistry.h"
|
||||||
#include "qgsmessagelog.h"
|
#include "qgsmessagelog.h"
|
||||||
@ -2538,9 +2538,9 @@ QgsSensorRegistry *QgsApplication::sensorRegistry()
|
|||||||
return members()->mSensorRegistry.get();
|
return members()->mSensorRegistry.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsChartRegistry *QgsApplication::chartRegistry()
|
QgsChartPlotRegistry *QgsApplication::chartPlotRegistry()
|
||||||
{
|
{
|
||||||
return members()->mChartRegistry.get();
|
return members()->mChartPlotRegistry.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsGpsConnectionRegistry *QgsApplication::gpsConnectionRegistry()
|
QgsGpsConnectionRegistry *QgsApplication::gpsConnectionRegistry()
|
||||||
@ -2842,9 +2842,9 @@ QgsApplication::ApplicationMembers::ApplicationMembers()
|
|||||||
profiler->end();
|
profiler->end();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
profiler->start( tr( "Setup chart registry" ) );
|
profiler->start( tr( "Setup chart plot registry" ) );
|
||||||
mChartRegistry = std::make_unique<QgsChartRegistry>();
|
mChartPlotRegistry = std::make_unique<QgsChartPlotRegistry>();
|
||||||
mChartRegistry->populate();
|
mChartPlotRegistry->populate();
|
||||||
profiler->end();
|
profiler->end();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -2921,7 +2921,7 @@ QgsApplication::ApplicationMembers::~ApplicationMembers()
|
|||||||
mPageSizeRegistry.reset();
|
mPageSizeRegistry.reset();
|
||||||
mAnnotationItemRegistry.reset();
|
mAnnotationItemRegistry.reset();
|
||||||
mSensorRegistry.reset();
|
mSensorRegistry.reset();
|
||||||
mChartRegistry.reset();
|
mChartPlotRegistry.reset();
|
||||||
mLayoutItemRegistry.reset();
|
mLayoutItemRegistry.reset();
|
||||||
mPointCloudRendererRegistry.reset();
|
mPointCloudRendererRegistry.reset();
|
||||||
mTiledSceneRendererRegistry.reset();
|
mTiledSceneRendererRegistry.reset();
|
||||||
|
@ -63,7 +63,7 @@ class QgsNetworkContentFetcherRegistry;
|
|||||||
class QgsValidityCheckRegistry;
|
class QgsValidityCheckRegistry;
|
||||||
class QTranslator;
|
class QTranslator;
|
||||||
class QgsCalloutRegistry;
|
class QgsCalloutRegistry;
|
||||||
class QgsChartRegistry;
|
class QgsChartPlotRegistry;
|
||||||
class QgsBookmarkManager;
|
class QgsBookmarkManager;
|
||||||
class QgsStyleModel;
|
class QgsStyleModel;
|
||||||
class QgsNumericFormatRegistry;
|
class QgsNumericFormatRegistry;
|
||||||
@ -876,7 +876,7 @@ class CORE_EXPORT QgsApplication : public QApplication
|
|||||||
* Returns the application's chart registry, used for chart types.
|
* Returns the application's chart registry, used for chart types.
|
||||||
* \since QGIS 4.0
|
* \since QGIS 4.0
|
||||||
*/
|
*/
|
||||||
static QgsChartRegistry *chartRegistry() SIP_KEEPREFERENCE;
|
static QgsChartPlotRegistry *chartPlotRegistry() SIP_KEEPREFERENCE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the application's message log.
|
* Returns the application's message log.
|
||||||
@ -1211,7 +1211,7 @@ class CORE_EXPORT QgsApplication : public QApplication
|
|||||||
std::unique_ptr<QgsLayoutItemRegistry > mLayoutItemRegistry;
|
std::unique_ptr<QgsLayoutItemRegistry > mLayoutItemRegistry;
|
||||||
std::unique_ptr<QgsAnnotationItemRegistry > mAnnotationItemRegistry;
|
std::unique_ptr<QgsAnnotationItemRegistry > mAnnotationItemRegistry;
|
||||||
std::unique_ptr<QgsSensorRegistry > mSensorRegistry;
|
std::unique_ptr<QgsSensorRegistry > mSensorRegistry;
|
||||||
std::unique_ptr<QgsChartRegistry > mChartRegistry;
|
std::unique_ptr<QgsChartPlotRegistry > mChartPlotRegistry;
|
||||||
std::unique_ptr<QgsBookmarkManager > mBookmarkManager;
|
std::unique_ptr<QgsBookmarkManager > mBookmarkManager;
|
||||||
std::unique_ptr<QgsTileDownloadManager > mTileDownloadManager;
|
std::unique_ptr<QgsTileDownloadManager > mTileDownloadManager;
|
||||||
std::unique_ptr<QgsStyleModel > mStyleModel;
|
std::unique_ptr<QgsStyleModel > mStyleModel;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user