KD Chart API Documentation 3.1
Loading...
Searching...
No Matches
KDChartPlotterDiagramCompressor.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of the KD Chart library.
4**
5** SPDX-FileCopyrightText: 2001 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6**
7** SPDX-License-Identifier: MIT
8**
9****************************************************************************/
10
11#ifndef PLOTTERDIAGRAMCOMPRESSOR_H
12#define PLOTTERDIAGRAMCOMPRESSOR_H
13
14#include <QtCore/QAbstractItemModel>
15#include <QtCore/QDateTime>
16#include <QtCore/QObject>
17#include <QtCore/QPointer>
18#include <QtCore/QVector>
19
20#include <cmath>
21#include <limits>
22
23namespace KDChart {
24
26{
29public:
37 {
38 public:
42 {
43 }
45 {
46 const qreal dx = key - other.key;
47 const qreal dy = value - other.value;
48 return std::sqrt(dx * dx + dy * dy);
49 }
50
51 inline bool operator==(const DataPoint &other)
52 {
53 return key == other.key && value == other.value;
54 }
55
56 inline bool operator!=(const DataPoint &other)
57 {
58 return !(*this == other);
59 }
60
63 bool hidden = false;
65 };
66
68 {
70
71 public:
73 ~Iterator();
74 bool isValid() const;
77 Iterator &operator+=(int value);
80 Iterator &operator-=(int value);
82 bool operator==(const Iterator &other) const;
83 bool operator!=(const Iterator &other) const;
84 void invalidate();
85
86 protected:
88
89 private:
90 void handleSlopeForward(const DataPoint &dp);
92 QVector<DataPoint> m_buffer;
93 int m_index;
94 int m_dataset;
95 int m_bufferIndex;
96 int m_rebuffer;
97 QDateTime m_timeOfCreation;
98 };
99
102 {
103 public:
105 {
106 }
108 : first(first)
109 , second(second)
110 {
111 }
112 int first = -1;
113 int second = -1;
114
115 bool operator==(const CachePosition &rhs) const
116 {
117 return first == rhs.first && second == rhs.second;
118 }
119 };
120 explicit PlotterDiagramCompressor(QObject *parent = nullptr);
121 ~PlotterDiagramCompressor() override;
122 Iterator begin(int dataSet);
123 Iterator end(int dataSet);
124 void setMergeRadius(qreal radius);
125 void setMergeRadiusPercentage(qreal radius);
127 QAbstractItemModel *model() const;
128 DataPoint data(const CachePosition &pos) const;
129 int rowCount() const;
130 int datasetCount() const;
132 void setMaxSlopeChange(qreal value);
133 qreal maxSlopeChange() const;
134 void cleanCache();
140
141private:
142 class Private;
143 Private *d;
144};
145}
146
147#endif // PLOTTERDIAGRAMCOMPRESSOR_H
QPair< QPointF, QPointF > dataBoundaries() const
DataPoint data(const CachePosition &pos) const
void setForcedDataBoundaries(const QPair< qreal, qreal > &bounds, Qt::Orientation direction)
Q_ENUMS(...)
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
T qobject_cast(QObject *object)
Orientation

© 2001 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-chart/
Generated on Wed May 1 2024 00:01:10 for KD Chart API Documentation by doxygen 1.9.8