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

source code of qtdatavis3d/src/datavisualization/data/qsurfacedataitem.cpp