1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Charts module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30// W A R N I N G
31// -------------
32//
33// This file is not part of the Qt Chart API. It exists purely as an
34// implementation detail. This header file may change from version to
35// version without notice, or even be removed.
36//
37// We mean it.
38
39#ifndef GLXYSERIESDATA_H
40#define GLXYSERIESDATA_H
41
42#include <QtCore/QMap>
43#include <QtCharts/QAbstractSeries>
44#include <QtCharts/QXYSeries>
45#include <QtCharts/private/qchartglobal_p.h>
46#include <QtGui/QVector3D>
47#include <QtGui/QVector2D>
48#include <QtGui/QMatrix4x4>
49
50QT_CHARTS_BEGIN_NAMESPACE
51
52class AbstractDomain;
53
54struct GLXYSeriesData {
55 QVector<float> array;
56 bool dirty;
57 QVector3D color;
58 float width;
59 QAbstractSeries::SeriesType type;
60 QVector2D min;
61 QVector2D delta;
62 bool visible;
63 QMatrix4x4 matrix;
64public:
65 GLXYSeriesData &operator=(const GLXYSeriesData &data) {
66 array = data.array;
67 dirty = data.dirty;
68 color = data.color;
69 width = data.width;
70 type = data.type;
71 min = data.min;
72 delta = data.delta;
73 visible = data.visible;
74 matrix = data.matrix;
75 return *this;
76 }
77};
78
79typedef QMap<const QXYSeries *, GLXYSeriesData *> GLXYDataMap;
80
81class Q_CHARTS_PRIVATE_EXPORT GLXYSeriesDataManager : public QObject
82{
83 Q_OBJECT
84
85public:
86 GLXYSeriesDataManager(QObject *parent = 0);
87 ~GLXYSeriesDataManager();
88
89 void setPoints(QXYSeries *series, const AbstractDomain *domain);
90
91 void removeSeries(const QXYSeries *series);
92
93 GLXYDataMap &dataMap() { return m_seriesDataMap; }
94
95 // These functions are needed by qml side, so they must be inline
96 bool mapDirty() const { return m_mapDirty; }
97 void clearAllDirty() {
98 m_mapDirty = false;
99 foreach (GLXYSeriesData *data, m_seriesDataMap.values())
100 data->dirty = false;
101 }
102 void handleAxisReverseChanged(const QList<QAbstractSeries *> &seriesList);
103
104public Q_SLOTS:
105 void cleanup();
106 void handleSeriesPenChange();
107 void handleSeriesOpenGLChange();
108 void handleSeriesVisibilityChange();
109 void handleScatterColorChange();
110 void handleScatterMarkerSizeChange();
111
112Q_SIGNALS:
113 void seriesRemoved(const QXYSeries *series);
114
115private:
116 GLXYDataMap m_seriesDataMap;
117 bool m_mapDirty;
118};
119
120QT_CHARTS_END_NAMESPACE
121
122#endif
123

source code of qtcharts/src/charts/xychart/glxyseriesdata_p.h