File indexing completed on 2024-06-09 04:18: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 KCHARTPOLARDIAGRAM_H 0010 #define KCHARTPOLARDIAGRAM_H 0011 0012 0013 #include "KChartPosition.h" 0014 #include "KChartAbstractPolarDiagram.h" 0015 0016 QT_BEGIN_NAMESPACE 0017 class QPolygonF; 0018 QT_END_NAMESPACE 0019 0020 namespace KChart { 0021 0022 /** 0023 * @brief PolarDiagram defines a common polar diagram 0024 */ 0025 class KCHART_EXPORT PolarDiagram : public AbstractPolarDiagram 0026 { 0027 Q_OBJECT 0028 0029 Q_DISABLE_COPY( PolarDiagram ) 0030 KCHART_DECLARE_DERIVED_DIAGRAM( PolarDiagram, PolarCoordinatePlane ) 0031 0032 public: 0033 explicit PolarDiagram( 0034 QWidget* parent = nullptr, PolarCoordinatePlane* plane = nullptr ); 0035 ~PolarDiagram() override; 0036 0037 protected: 0038 // Implement AbstractDiagram 0039 /** \reimpl */ 0040 void paint ( PaintContext* paintContext ) override; 0041 0042 public: 0043 /** \reimpl */ 0044 void resize ( const QSizeF& area ) override; 0045 0046 // Implement AbstractPolarDiagram 0047 /** \reimpl */ 0048 qreal valueTotals () const override; 0049 /** \reimpl */ 0050 qreal numberOfValuesPerDataset() const override; 0051 /** \reimpl */ 0052 qreal numberOfGridRings() const override; 0053 0054 0055 /** 0056 * Creates an exact copy of this diagram. 0057 */ 0058 virtual PolarDiagram * clone() const; 0059 0060 /** \deprecated Use PolarCoordinatePlane::setStartPosition( qreal degrees ) instead. */ 0061 void setZeroDegreePosition( int degrees ); 0062 /** \deprecated Use qreal PolarCoordinatePlane::startPosition instead. */ 0063 int zeroDegreePosition() const; 0064 0065 void setRotateCircularLabels( bool rotateCircularLabels ); 0066 bool rotateCircularLabels() const; 0067 0068 /** Close each of the data series by connecting the last point to its 0069 * respective start point 0070 */ 0071 void setCloseDatasets( bool closeDatasets ); 0072 bool closeDatasets() const; 0073 0074 void setShowDelimitersAtPosition( Position position, 0075 bool showDelimiters ); 0076 void setShowLabelsAtPosition( Position position, 0077 bool showLabels ); 0078 0079 bool showDelimitersAtPosition( Position position ) const; 0080 0081 bool showLabelsAtPosition( Position position ) const; 0082 0083 virtual void paint ( PaintContext* paintContext, 0084 bool calculateListAndReturnScale, 0085 qreal& newZoomX, qreal& newZoomY ); // KChart 3: references -> pointers 0086 0087 protected: 0088 /** \reimpl */ 0089 const QPair<QPointF, QPointF> calculateDataBoundaries() const override; 0090 void paintEvent ( QPaintEvent* ) override; 0091 void resizeEvent ( QResizeEvent* ) override; 0092 virtual void paintPolarMarkers( PaintContext* ctx, const QPolygonF& polygon ); 0093 0094 }; // End of class PolarDiagram 0095 0096 } 0097 0098 0099 #endif // KCHARTPOLARDIAGRAM_H