File indexing completed on 2024-12-15 04:02:36
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 KCHARTABSTRACTTERNARYDIAGRAM_P_H 0010 #define KCHARTABSTRACTTERNARYDIAGRAM_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 "KChartAbstractTernaryDiagram.h" 0024 0025 #include "KChartTernaryCoordinatePlane.h" 0026 #include <KChartAbstractDiagram_p.h> 0027 #include <KChartAbstractThreeDAttributes.h> 0028 #include <KChartGridAttributes.h> 0029 #include "KChartPainterSaver_p.h" 0030 #include "KChartMath_p.h" 0031 0032 #include "ReverseMapper.h" 0033 #include "ChartGraphicsItem.h" 0034 0035 namespace KChart { 0036 0037 /** 0038 * \internal 0039 */ 0040 class Q_DECL_HIDDEN AbstractTernaryDiagram::Private : public AbstractDiagram::Private 0041 { 0042 friend class AbstractTernaryDiagram; 0043 public: 0044 Private(); 0045 ~Private() override {} 0046 0047 Private( const Private& rhs ) : 0048 AbstractDiagram::Private( rhs ), 0049 // Do not copy axes and reference diagrams. 0050 axesList(), 0051 referenceDiagram( nullptr ), 0052 referenceDiagramOffset() 0053 { 0054 } 0055 0056 TernaryAxisList axesList; 0057 0058 AbstractTernaryDiagram* referenceDiagram; 0059 QPointF referenceDiagramOffset; 0060 0061 void drawPoint( QPainter* p, int row, int column, 0062 const QPointF& widgetLocation ) 0063 { 0064 // Q_ASSERT( false ); // unused, to be removed 0065 static const qreal Diameter = 5.0; 0066 static const qreal Radius = Diameter / 2.0; 0067 QRectF ellipseRect( widgetLocation - QPointF( Radius, Radius ), 0068 QSizeF( Diameter, Diameter ) ); 0069 p->drawEllipse( ellipseRect ); 0070 0071 reverseMapper.addRect( row, column, ellipseRect ); 0072 } 0073 0074 virtual void paint( PaintContext* paintContext ) 0075 { 0076 paintContext->painter()->setRenderHint( QPainter::Antialiasing, 0077 antiAliasing ); 0078 if ( !axesList.isEmpty() ) { 0079 0080 for ( TernaryAxis* axis : qAsConst(axesList) ) { 0081 PainterSaver s( paintContext->painter() ); 0082 axis->paintCtx( paintContext ); 0083 } 0084 } 0085 } 0086 }; 0087 0088 KCHART_IMPL_DERIVED_DIAGRAM( AbstractTernaryDiagram, AbstractDiagram, TernaryCoordinatePlane ) 0089 } 0090 0091 #endif /* KCHARTABSTRACTTERNARYDIAGRAM_P_H */