QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgsvectorlayerplotdatagatherer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorlayerplotdatagatherer.h
3 -----------------
4 begin : August 2025
5 copyright : (C) 2025 by Mathieu
6 email : mathieu at opengis dot ch
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSVECTORLAYERPLOTDATAGATHERER_H
18#define QGSVECTORLAYERPLOTDATAGATHERER_H
19
20#include "qgis.h"
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgsplot.h"
24#include "qgstaskmanager.h"
26
36{
37 Q_OBJECT
38
39#ifdef SIP_RUN
42 {
43 if ( dynamic_cast<QgsVectorLayerXyPlotDataGatherer *>( item ) != NULL )
44 {
45 sipType = sipType_QgsVectorLayerXyPlotDataGatherer;
46 }
47 else
48 {
49 sipType = sipType_QgsVectorLayerAbstractPlotDataGatherer;
50 }
51 }
52 else
53 {
54 sipType = NULL;
55 }
57#endif
58
59 public:
60
63
65 virtual QgsPlotData data() const = 0;
66
68 void setFeatureIterator( QgsFeatureIterator &iterator ) { mIterator = iterator; }
69
71 void setExpressionContext( const QgsExpressionContext &context ) { mExpressionContext = context; }
72
73 protected:
76};
77
78
88{
89 Q_OBJECT
90
91 public:
96 {
97 explicit XySeriesDetails( const QString &name, const QString &xExpression, const QString &yExpression, const QString &filterExpression = QString() )
98 : name( name )
102 {}
103
104 QString name;
105 QString xExpression;
106 QString yExpression;
108 };
109
116
118 void setSeriesDetails( const QList<QgsVectorLayerXyPlotDataGatherer::XySeriesDetails> &details );
119
124 void setPredefinedCategories( const QStringList &categories );
125
126 bool run() override;
127
128 QgsPlotData data() const override;
129
130 protected:
132
133 private:
135 QList<QgsVectorLayerXyPlotDataGatherer::XySeriesDetails> mSeriesDetails;
136 QStringList mPredefinedCategories;
137};
138
139#endif // QGSVECTORLAYERPLOTDATAGATHERER_H
PlotAxisType
Plots axis types.
Definition qgis.h:3448
@ Interval
The axis represents a range of values.
Definition qgis.h:3449
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Wrapper for iterator of features from vector data provider or vector layer.
Encapsulates one or more plot series.
Definition qgsplot.h:303
virtual bool run()=0
Performs the task's operation.
QgsTask(const QString &description=QString(), QgsTask::Flags flags=AllFlags)
Constructor for QgsTask.
void setFeatureIterator(QgsFeatureIterator &iterator)
Sets the feature iterator used to gather data from.
~QgsVectorLayerAbstractPlotDataGatherer() override=default
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used when evaluating values being gathered.
virtual QgsPlotData data() const =0
Returns the plot data.
An vector layer plot data gatherer class for XY series.
QgsPlotData data() const override
Returns the plot data.
void setPredefinedCategories(const QStringList &categories)
Sets the predefined categories list that will be used to restrict the categories used when gathering ...
void setSeriesDetails(const QList< QgsVectorLayerXyPlotDataGatherer::XySeriesDetails > &details)
Sets the series details list that will be used to prepare the data being gathered.
QgsVectorLayerXyPlotDataGatherer(Qgis::PlotAxisType xAxisType=Qgis::PlotAxisType::Interval)
The vector layer XY plot data gatherer constructor.
~QgsVectorLayerXyPlotDataGatherer() override=default
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:198
#define SIP_END
Definition qgis_sip.h:215
XySeriesDetails(const QString &name, const QString &xExpression, const QString &yExpression, const QString &filterExpression=QString())