1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "qsurfacedataitem_p.h"
5
6QT_BEGIN_NAMESPACE
7
8/*!
9 * \class QSurfaceDataItem
10 * \inmodule QtGraphs
11 * \brief The QSurfaceDataItem class provides a container for resolved data to be added to surface
12 * graphs.
13 *
14 * A surface data item holds the data for a single vertex in a surface graph.
15 * Surface data proxies parse data into QSurfaceDataItem instances for
16 * surface graphs.
17 *
18 * \sa QSurfaceDataProxy, {Qt Graphs C++ Classes}
19 */
20
21/*!
22 * Constructs a surface data item.
23 */
24QSurfaceDataItem::QSurfaceDataItem()
25 : d_ptr(0) // private data doesn't exist by default (optimization)
26
27{
28}
29
30/*!
31 * Constructs a surface data item at the position \a position.
32 */
33QSurfaceDataItem::QSurfaceDataItem(const QVector3D &position)
34 : d_ptr(0),
35 m_position(position)
36{
37}
38
39/*!
40 * Constructs a copy of \a other.
41 */
42QSurfaceDataItem::QSurfaceDataItem(const QSurfaceDataItem &other)
43{
44 operator=(other);
45}
46
47/*!
48 * Deletes a surface data item.
49 */
50QSurfaceDataItem::~QSurfaceDataItem()
51{
52}
53
54/*!
55 * Assigns a copy of \a other to this object.
56 */
57QSurfaceDataItem &QSurfaceDataItem::operator=(const QSurfaceDataItem &other)
58{
59 m_position = other.m_position;
60
61 if (other.d_ptr)
62 createExtraData();
63 else
64 d_ptr = 0;
65
66 return *this;
67}
68
69/*!
70 * \fn void QSurfaceDataItem::setPosition(const QVector3D &pos)
71 * Sets the position \a pos to this data item.
72 */
73
74/*!
75 * \fn QVector3D QSurfaceDataItem::position() const
76 * Returns the position of this data item.
77 */
78
79/*!
80 * \fn void QSurfaceDataItem::setX(float value)
81 * Sets the x-coordinate of the item position to the value \a value.
82 */
83
84/*!
85 * \fn void QSurfaceDataItem::setY(float value)
86 * Sets the y-coordinate of the item position to the value \a value.
87 */
88
89/*!
90 * \fn void QSurfaceDataItem::setZ(float value)
91 * Sets the z-coordinate of the item position to the value \a value.
92 */
93
94/*!
95 * \fn float QSurfaceDataItem::x() const
96 * Returns the x-coordinate of the position of this data item.
97 */
98
99/*!
100 * \fn float QSurfaceDataItem::y() const
101 * Returns the y-coordinate of the position of this data item.
102 */
103
104/*!
105 * \fn float QSurfaceDataItem::z() const
106 * Returns the z-coordinate of the position of this data item.
107 */
108
109/*!
110 * \internal
111 */
112void QSurfaceDataItem::createExtraData()
113{
114 if (!d_ptr)
115 d_ptr = new QSurfaceDataItemPrivate;
116}
117
118QSurfaceDataItemPrivate::QSurfaceDataItemPrivate()
119{
120}
121
122QSurfaceDataItemPrivate::~QSurfaceDataItemPrivate()
123{
124}
125
126QT_END_NAMESPACE
127

source code of qtgraphs/src/graphs/data/qsurfacedataitem.cpp