File indexing completed on 2024-05-19 03:59:18
0001 /* 0002 * This file is part of KQuickCharts 0003 * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #ifndef LINESEGMENTNODE_H 0009 #define LINESEGMENTNODE_H 0010 0011 #include <QColor> 0012 #include <QSGGeometryNode> 0013 #include <QVector2D> 0014 0015 class QRectF; 0016 class LineChartMaterial; 0017 0018 /** 0019 * @todo write docs 0020 */ 0021 class LineSegmentNode : public QSGGeometryNode 0022 { 0023 public: 0024 LineSegmentNode(); 0025 0026 /** 0027 * Default constructor 0028 */ 0029 explicit LineSegmentNode(const QRectF &rect); 0030 0031 /** 0032 * Destructor 0033 */ 0034 ~LineSegmentNode(); 0035 0036 void setRect(const QRectF &rect); 0037 void setAspect(float xAspect, float yAspect); 0038 void setSmoothing(float smoothing); 0039 void setLineWidth(float width); 0040 void setLineColor(const QColor &color); 0041 void setFillColor(const QColor &color); 0042 void setValues(const QList<QVector2D> &values); 0043 void setFarLeft(const QVector2D &value); 0044 void setFarRight(const QVector2D &value); 0045 0046 void update(); 0047 0048 private: 0049 QRectF m_rect; 0050 float m_lineWidth = 0.0; 0051 float m_xAspect = 1.0; 0052 float m_yAspect = 1.0; 0053 float m_smoothing = 0.1; 0054 QVector2D m_farLeft; 0055 QVector2D m_farRight; 0056 QList<QVector2D> m_values; 0057 QSGGeometry *m_geometry = nullptr; 0058 LineChartMaterial *m_material = nullptr; 0059 QColor m_lineColor; 0060 QColor m_fillColor; 0061 }; 0062 0063 #endif // LINESEGMENTNODE_H