File indexing completed on 2024-12-15 04:02:32
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 KCHARTPLOTTER_P_H 0010 #define KCHARTPLOTTER_P_H 0011 0012 // 0013 // W A R N I N G 0014 // ------------- 0015 // 0016 // This file is not part of the KD Chart API. It exists purely as an 0017 // implementation detail. This header file may change from version to 0018 // version without notice, or even be removed. 0019 // 0020 // We mean it. 0021 // 0022 0023 #include "KChartPlotter.h" 0024 0025 #include <QPainterPath> 0026 0027 #include "KChartThreeDLineAttributes.h" 0028 #include "KChartAbstractCartesianDiagram_p.h" 0029 #include "KChartCartesianDiagramDataCompressor_p.h" 0030 #include "KChartPlotterDiagramCompressor.h" 0031 #include "KChartMath_p.h" 0032 0033 0034 namespace KChart { 0035 0036 class PaintContext; 0037 0038 /** 0039 * \internal 0040 */ 0041 class Q_DECL_HIDDEN Plotter::Private : public QObject, public AbstractCartesianDiagram::Private 0042 { 0043 Q_OBJECT 0044 friend class Plotter; 0045 friend class PlotterType; 0046 0047 public: 0048 Private(); 0049 Private( const Private& rhs ); 0050 ~Private() override; 0051 0052 void setCompressorResolution( 0053 const QSizeF& size, 0054 const AbstractCoordinatePlane* plane ); 0055 0056 PlotterType* implementor; // the current type 0057 PlotterType* normalPlotter; 0058 PlotterType* percentPlotter; 0059 PlotterType* stackedPlotter; 0060 PlotterDiagramCompressor plotterCompressor; 0061 Plotter::CompressionMode useCompression; 0062 qreal mergeRadiusPercentage; 0063 protected: 0064 void init(); 0065 public Q_SLOTS: 0066 void changedProperties(); 0067 }; 0068 0069 KCHART_IMPL_DERIVED_DIAGRAM( Plotter, AbstractCartesianDiagram, CartesianCoordinatePlane ) 0070 0071 class Plotter::PlotterType 0072 { 0073 public: 0074 explicit PlotterType( Plotter* d ) 0075 : m_private( d->d_func() ) 0076 { 0077 m_private->init(); 0078 } 0079 virtual ~PlotterType() {} 0080 virtual Plotter::PlotType type() const = 0; 0081 virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const = 0; 0082 virtual void paint( PaintContext* ctx ) = 0; 0083 Plotter* diagram() const; 0084 0085 Plotter::CompressionMode useCompression() const; 0086 void setUseCompression( Plotter::CompressionMode value ); 0087 PlotterDiagramCompressor& plotterCompressor() const; 0088 0089 Plotter::Private* plotterPrivate() const { return m_private; } 0090 0091 protected: 0092 // make some elements of m_private available to derived classes: 0093 AttributesModel* attributesModel() const; 0094 QModelIndex attributesModelRootIndex() const; 0095 ReverseMapper& reverseMapper(); 0096 CartesianDiagramDataCompressor& compressor() const; 0097 0098 int datasetDimension() const; 0099 0100 Plotter::Private* m_private; 0101 // TODO: do we need them or not? (currently unused, but maybe there are supposed to be several 0102 // compressors 0103 PlotterDiagramCompressor m_plotterCompressor; 0104 Plotter::CompressionMode m_useCompression; 0105 }; 0106 } 0107 0108 #endif /* KCHARTLINEDIAGRAM_P_H */