KPlotting

kplotpoint.cpp
1 /* -*- C++ -*-
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2003 Jason Harris <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "kplotpoint.h"
9 
10 #include <QPointF>
11 #include <QtAlgorithms>
12 
13 class KPlotPoint::Private
14 {
15 public:
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 
36 KPlotPoint::KPlotPoint(double x, double y, const QString &label, double barWidth)
37  : d(new Private(this, QPointF(x, y), label, barWidth))
38 {
39 }
40 
41 KPlotPoint::KPlotPoint(const QPointF &p, const QString &label, double barWidth)
42  : d(new Private(this, p, label, barWidth))
43 {
44 }
45 
47 {
48  delete d;
49 }
50 
52 {
53  return d->point;
54 }
55 
57 {
58  d->point = pos;
59 }
60 
61 double KPlotPoint::x() const
62 {
63  return d->point.x();
64 }
65 
66 void KPlotPoint::setX(double x)
67 {
68  d->point.setX(x);
69 }
70 
71 double KPlotPoint::y() const
72 {
73  return d->point.y();
74 }
75 
76 void KPlotPoint::setY(double y)
77 {
78  d->point.setY(y);
79 }
80 
82 {
83  return d->label;
84 }
85 
86 void KPlotPoint::setLabel(const QString &label)
87 {
88  d->label = label;
89 }
90 
91 double KPlotPoint::barWidth() const
92 {
93  return d->barWidth;
94 }
95 
97 {
98  d->barWidth = w;
99 }
Encapsulates a point in the plot. A KPlotPoint consists of X and Y coordinates (in Data units),...
Definition: kplotpoint.h:27
~KPlotPoint()
Destructor.
Definition: kplotpoint.cpp:46
void setX(double x)
Set the X-position of the point, in Data units.
Definition: kplotpoint.cpp:66
void setPosition(const QPointF &pos)
Set the position of the point, in data units.
Definition: kplotpoint.cpp:56
double y() const
Definition: kplotpoint.cpp:71
void setBarWidth(double w)
Set the bar-width for the point.
Definition: kplotpoint.cpp:96
double barWidth() const
Definition: kplotpoint.cpp:91
KPlotPoint()
Default constructor.
Definition: kplotpoint.cpp:31
void setY(double y)
Set the Y-position of the point, in Data units.
Definition: kplotpoint.cpp:76
void setLabel(const QString &label)
Set the label for the point.
Definition: kplotpoint.cpp:86
QString label() const
Definition: kplotpoint.cpp:81
double x() const
Definition: kplotpoint.cpp:61
QPointF position() const
Definition: kplotpoint.cpp:51
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 3 2023 04:13:54 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.