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
31KPlotPoint::KPlotPoint()
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
48QPointF KPlotPoint::position() const
49{
50 return d->point;
51}
52
53void KPlotPoint::setPosition(const QPointF &pos)
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
78QString KPlotPoint::label() const
79{
80 return d->label;
81}
82
83void KPlotPoint::setLabel(const QString &label)
84{
85 d->label = label;
86}
87
88double KPlotPoint::barWidth() const
89{
90 return d->barWidth;
91}
92
93void KPlotPoint::setBarWidth(double w)
94{
95 d->barWidth = w;
96}
97

source code of kplotting/src/kplotpoint.cpp