1/****************************************************************************
2**
3** Copyright (C) 2017 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Data Visualization module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#include "qsurfacedataitem_p.h"
31
32QT_BEGIN_NAMESPACE_DATAVISUALIZATION
33
34/*!
35 * \class QSurfaceDataItem
36 * \inmodule QtDataVisualization
37 * \brief The QSurfaceDataItem class provides a container for resolved data to be added to surface
38 * graphs.
39 * \since QtDataVisualization 1.0
40 *
41 * A surface data item holds the data for a single vertex in a surface graph.
42 * Surface data proxies parse data into QSurfaceDataItem instances for
43 * visualization.
44 *
45 * \sa QSurfaceDataProxy, {Qt Data Visualization C++ Classes}
46 */
47
48/*!
49 * Constructs a surface data item.
50 */
51QSurfaceDataItem::QSurfaceDataItem()
52 : d_ptr(0) // private data doesn't exist by default (optimization)
53
54{
55}
56
57/*!
58 * Constructs a surface data item at the position \a position.
59 */
60QSurfaceDataItem::QSurfaceDataItem(const QVector3D &position)
61 : d_ptr(0),
62 m_position(position)
63{
64}
65
66/*!
67 * Constructs a copy of \a other.
68 */
69QSurfaceDataItem::QSurfaceDataItem(const QSurfaceDataItem &other)
70{
71 operator=(other);
72}
73
74/*!
75 * Deletes a surface data item.
76 */
77QSurfaceDataItem::~QSurfaceDataItem()
78{
79}
80
81/*!
82 * Assigns a copy of \a other to this object.
83 */
84QSurfaceDataItem &QSurfaceDataItem::operator=(const QSurfaceDataItem &other)
85{
86 m_position = other.m_position;
87
88 if (other.d_ptr)
89 createExtraData();
90 else
91 d_ptr = 0;
92
93 return *this;
94}
95
96/*!
97 * \fn void QSurfaceDataItem::setPosition(const QVector3D &pos)
98 * Sets the position \a pos to this data item.
99 */
100
101/*!
102 * \fn QVector3D QSurfaceDataItem::position() const
103 * Returns the position of this data item.
104 */
105
106/*!
107 * \fn void QSurfaceDataItem::setX(float value)
108 * Sets the x-coordinate of the item position to the value \a value.
109 */
110
111/*!
112 * \fn void QSurfaceDataItem::setY(float value)
113 * Sets the y-coordinate of the item position to the value \a value.
114 */
115
116/*!
117 * \fn void QSurfaceDataItem::setZ(float value)
118 * Sets the z-coordinate of the item position to the value \a value.
119 */
120
121/*!
122 * \fn float QSurfaceDataItem::x() const
123 * Returns the x-coordinate of the position of this data item.
124 */
125
126/*!
127 * \fn float QSurfaceDataItem::y() const
128 * Returns the y-coordinate of the position of this data item.
129 */
130
131/*!
132 * \fn float QSurfaceDataItem::z() const
133 * Returns the z-coordinate of the position of this data item.
134 */
135
136/*!
137 * \internal
138 */
139void QSurfaceDataItem::createExtraData()
140{
141 if (!d_ptr)
142 d_ptr = new QSurfaceDataItemPrivate;
143}
144
145QSurfaceDataItemPrivate::QSurfaceDataItemPrivate()
146{
147}
148
149QSurfaceDataItemPrivate::~QSurfaceDataItemPrivate()
150{
151}
152
153QT_END_NAMESPACE_DATAVISUALIZATION
154

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