KPlotting

kplotpoint.cpp
1/* -*- C++ -*-
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2003 Jason Harris <kstars@30doradus.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#include "kplotpoint.h"
9
10#include <QPointF>
11#include <QtAlgorithms>
12
13class KPlotPoint::Private
14{
15public:
16 Private(KPlotPoint *qq, const QPointF &p, const QString &l, double bw)
17 : q(qq)
18 , point(p)
19 , label(l)
20 , barWidth(bw)
21 {
22 }
23
24 KPlotPoint *q;
25
26 QPointF point;
27 QString label;
28 double barWidth;
29};
30
32 : d(new Private(this, QPointF(), QString(), 0.0))
33{
34}
35
36KPlotPoint::KPlotPoint(double x, double y, const QString &label, double barWidth)
37 : d(new Private(this, QPointF(x, y), label, barWidth))
38{
39}
40
41KPlotPoint::KPlotPoint(const QPointF &p, const QString &label, double barWidth)
42 : d(new Private(this, p, label, barWidth))
43{
44}
45
46KPlotPoint::~KPlotPoint() = default;
47
49{
50 return d->point;
51}
52
54{
55 d->point = pos;
56}
57
58double KPlotPoint::x() const
59{
60 return d->point.x();
61}
62
63void KPlotPoint::setX(double x)
64{
65 d->point.setX(x);
66}
67
68double KPlotPoint::y() const
69{
70 return d->point.y();
71}
72
73void KPlotPoint::setY(double y)
74{
75 d->point.setY(y);
76}
77
79{
80 return d->label;
81}
82
83void KPlotPoint::setLabel(const QString &label)
84{
85 d->label = label;
86}
87
89{
90 return d->barWidth;
91}
92
94{
95 d->barWidth = w;
96}
Encapsulates a point in the plot.
Definition kplotpoint.h:30
QPointF position() const
QString label() const
void setBarWidth(double w)
Set the bar-width for the point.
double x() const
void setX(double x)
Set the X-position of the point, in Data units.
double barWidth() const
double y() const
~KPlotPoint()
Destructor.
void setPosition(const QPointF &pos)
Set the position of the point, in data units.
void setY(double y)
Set the Y-position of the point, in Data units.
KPlotPoint()
Default constructor.
void setLabel(const QString &label)
Set the label for the point.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.