QGIS API Documentation 3.99.0-Master (09f76ad7019)
Loading...
Searching...
No Matches
qgslinechartplot.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslinechartplot.h
3 ------------------
4 begin : June 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 QGSLINECHARTPLOT_H
18#define QGSLINECHARTPLOT_H
19
20#include "qgis_core.h"
21#include "qgis_sip.h"
22#include "qgslinesymbol.h"
23#include "qgsmarkersymbol.h"
24#include "qgsplot.h"
25
26#include <QString>
27
28using namespace Qt::StringLiterals;
29
31
32
41class CORE_EXPORT QgsLineChartPlot : public Qgs2DXyPlot
42{
43 public:
44
46 ~QgsLineChartPlot() override = default;
47
48 QString type() const override { return u"line"_s; }
49
50 void renderContent( QgsRenderContext &context, QgsPlotRenderContext &plotContext, const QRectF &plotArea, const QgsPlotData &plotData = QgsPlotData() ) override;
51
52 bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
53 bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
54
58 QgsMarkerSymbol *markerSymbolAt( int index ) const;
59
63 void setMarkerSymbolAt( int index, QgsMarkerSymbol *symbol SIP_TRANSFER );
64
68 int markerSymbolCount() const { return mMarkerSymbols.size(); }
69
73 QgsLineSymbol *lineSymbolAt( int index ) const;
74
78 void setLineSymbolAt( int index, QgsLineSymbol *symbol SIP_TRANSFER );
79
83 int lineSymbolCount() const { return mLineSymbols.size(); }
84
86 static QgsLineChartPlot *create() SIP_FACTORY;
87
89 static QgsVectorLayerAbstractPlotDataGatherer *createDataGatherer( QgsPlot *plot ) SIP_TRANSFERBACK;
90
91 private:
92
93 std::vector<std::unique_ptr<QgsMarkerSymbol>> mMarkerSymbols;
94 std::vector<std::unique_ptr<QgsLineSymbol>> mLineSymbols;
95};
96
97#endif // QGSLINECHARTPLOT_H
virtual void renderContent(QgsRenderContext &context, QgsPlotRenderContext &plotContext, const QRectF &plotArea, const QgsPlotData &plotData=QgsPlotData())
Renders the plot content.
Definition qgsplot.cpp:267
bool readXml(const QDomElement &element, const QgsReadWriteContext &context) override
Reads the plot's properties from an XML element.
Definition qgsplot.cpp:394
Qgs2DXyPlot()
Constructor for Qgs2DXyPlot.
Definition qgsplot.cpp:360
bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Writes the plot's properties into an XML element.
Definition qgsplot.cpp:368
A simple line chart class.
int lineSymbolCount() const
Returns the line symbols list count.
QString type() const override
Returns the plot's type.
~QgsLineChartPlot() override=default
int markerSymbolCount() const
Returns the line symbols list count.
A line symbol type, for rendering LineString and MultiLineString geometries.
A marker symbol type, for rendering Point and MultiPoint geometries.
Encapsulates one or more plot series.
Definition qgsplot.h:300
Contains information about the context of a plot rendering operation.
Definition qgsplot.h:184
Base class for plot/chart/graphs.
Definition qgsplot.h:48
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
An abstract vector layer plot data gatherer base class.
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_TRANSFERBACK
Definition qgis_sip.h:48
#define SIP_FACTORY
Definition qgis_sip.h:84