1 | // Copyright (C) 2017 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qscatterdataitem_p.h" |
5 | |
6 | QT_BEGIN_NAMESPACE |
7 | |
8 | /*! |
9 | * \class QScatterDataItem |
10 | * \inmodule QtDataVisualization |
11 | * \brief The QScatterDataItem class provides a container for resolved data to be added to scatter |
12 | * graphs. |
13 | * \since QtDataVisualization 1.0 |
14 | * |
15 | * A scatter data item holds the data for a single rendered item in a scatter |
16 | * graph. Scatter data proxies parse data into QScatterDataItem instances for |
17 | * visualization. |
18 | * |
19 | * \sa QScatterDataProxy, {Qt Data Visualization C++ Classes} |
20 | */ |
21 | |
22 | /*! |
23 | * Constructs a scatter data item. |
24 | */ |
25 | QScatterDataItem::QScatterDataItem() |
26 | : d_ptr(0) // private data doesn't exist by default (optimization) |
27 | |
28 | { |
29 | } |
30 | |
31 | /*! |
32 | * Constructs a scatter data item at the position \a position. |
33 | */ |
34 | QScatterDataItem::QScatterDataItem(const QVector3D &position) |
35 | : d_ptr(0), |
36 | m_position(position) |
37 | { |
38 | } |
39 | |
40 | /*! |
41 | * Constructs a scatter data item at the position \a position with the rotation |
42 | * \a rotation. |
43 | */ |
44 | QScatterDataItem::QScatterDataItem(const QVector3D &position, const QQuaternion &rotation) |
45 | : d_ptr(0), |
46 | m_position(position), |
47 | m_rotation(rotation) |
48 | { |
49 | } |
50 | |
51 | /*! |
52 | * Constructs a copy of \a other. |
53 | */ |
54 | QScatterDataItem::QScatterDataItem(const QScatterDataItem &other) |
55 | { |
56 | operator=(other); |
57 | } |
58 | |
59 | /*! |
60 | * Deletes a scatter data item. |
61 | */ |
62 | QScatterDataItem::~QScatterDataItem() |
63 | { |
64 | } |
65 | |
66 | /*! |
67 | * Assigns a copy of \a other to this object. |
68 | */ |
69 | QScatterDataItem &QScatterDataItem::operator=(const QScatterDataItem &other) |
70 | { |
71 | m_position = other.m_position; |
72 | m_rotation = other.m_rotation; |
73 | |
74 | if (other.d_ptr) |
75 | createExtraData(); |
76 | else |
77 | d_ptr = 0; |
78 | |
79 | return *this; |
80 | } |
81 | |
82 | /*! |
83 | * \fn void QScatterDataItem::setPosition(const QVector3D &pos) |
84 | * Sets the position \a pos for this data item. |
85 | */ |
86 | |
87 | /*! |
88 | * \fn QVector3D QScatterDataItem::position() const |
89 | * Returns the position of this data item. |
90 | */ |
91 | |
92 | /*! |
93 | * \fn void QScatterDataItem::setRotation(const QQuaternion &rot) |
94 | * Sets the rotation \a rot for this data item. |
95 | * The value of \a rot should be a normalized QQuaternion. |
96 | * If the series also has rotation, item rotation is multiplied by it. |
97 | * Defaults to no rotation. |
98 | */ |
99 | |
100 | /*! |
101 | * \fn QQuaternion QScatterDataItem::rotation() const |
102 | * Returns the rotation of this data item. |
103 | * \sa setRotation() |
104 | */ |
105 | |
106 | /*! |
107 | * \fn void QScatterDataItem::setX(float value) |
108 | * Sets the x-coordinate of the item position to the value \a value. |
109 | */ |
110 | |
111 | /*! |
112 | * \fn void QScatterDataItem::setY(float value) |
113 | * Sets the y-coordinate of the item position to the value \a value. |
114 | */ |
115 | |
116 | /*! |
117 | * \fn void QScatterDataItem::setZ(float value) |
118 | * Sets the z-coordinate of the item position to the value \a value. |
119 | */ |
120 | |
121 | /*! |
122 | * \fn float QScatterDataItem::x() const |
123 | * Returns the x-coordinate of the position of this data item. |
124 | */ |
125 | |
126 | /*! |
127 | * \fn float QScatterDataItem::y() const |
128 | * Returns the y-coordinate of the position of this data item. |
129 | */ |
130 | |
131 | /*! |
132 | * \fn float QScatterDataItem::z() const |
133 | * Returns the z-coordinate of the position of this data item. |
134 | */ |
135 | |
136 | /*! |
137 | * \internal |
138 | */ |
139 | void QScatterDataItem::() |
140 | { |
141 | if (!d_ptr) |
142 | d_ptr = new QScatterDataItemPrivate; |
143 | } |
144 | |
145 | QScatterDataItemPrivate::QScatterDataItemPrivate() |
146 | { |
147 | } |
148 | |
149 | QScatterDataItemPrivate::~QScatterDataItemPrivate() |
150 | { |
151 | } |
152 | |
153 | QT_END_NAMESPACE |
154 | |