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