File indexing completed on 2024-12-15 04:02:33

0001 /*
0002  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
0003  *
0004  * This file is part of the KD Chart library.
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #ifndef PLOTTERDIAGRAMCOMPRESSOR_P_H
0010 #define PLOTTERDIAGRAMCOMPRESSOR_P_H
0011 
0012 #include "KChartPlotterDiagramCompressor.h"
0013 
0014 #include <QPointF>
0015 #include <QDateTime>
0016 
0017 typedef QPair< QPointF, QPointF > Boundaries;
0018 
0019 namespace KChart
0020 {
0021 
0022 class Q_DECL_HIDDEN PlotterDiagramCompressor::Private : public QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     Private( PlotterDiagramCompressor *parent );
0027     QModelIndexList mapToModel( const CachePosition& pos );
0028     void calculateDataBoundaries();    
0029     void setBoundaries( const Boundaries &bound );
0030     bool forcedBoundaries( Qt::Orientation orient ) const;
0031     bool inBoundaries( Qt::Orientation orient, const PlotterDiagramCompressor::DataPoint &dp ) const;
0032     PlotterDiagramCompressor *m_parent;
0033     QAbstractItemModel *m_model;
0034     qreal m_mergeRadius;
0035     qreal m_maxSlopeRadius;
0036     QVector< QVector< DataPoint > > m_bufferlist;
0037     Boundaries m_boundary;
0038     QPair< qreal, qreal > m_forcedXBoundaries;
0039     QPair< qreal, qreal > m_forcedYBoundaries;
0040     QDateTime m_timeOfLastInvalidation;
0041     PlotterDiagramCompressor::CompressionMode m_mode;
0042     QVector< qreal > m_accumulatedDistances;
0043     //QVector< PlotterDiagramCompressor::Iterator > exisitingIterators;
0044 public Q_SLOTS:
0045     void rowsInserted( const QModelIndex& parent, int start, int end );
0046     void clearBuffer();
0047     void setModelToZero();
0048 };
0049 
0050 }
0051 
0052 #endif // PLOTTERDIAGRAMCOMPRESSOR_P_H