| 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 "qscatterdataitem_p.h" | 
| 31 |  | 
| 32 | QT_BEGIN_NAMESPACE_DATAVISUALIZATION | 
| 33 |  | 
| 34 | /*! | 
| 35 |  * \class QScatterDataItem | 
| 36 |  * \inmodule QtDataVisualization | 
| 37 |  * \brief The QScatterDataItem class provides a container for resolved data to be added to scatter | 
| 38 |  * graphs. | 
| 39 |  * \since QtDataVisualization 1.0 | 
| 40 |  * | 
| 41 |  * A scatter data item holds the data for a single rendered item in a scatter | 
| 42 |  * graph. Scatter data proxies parse data into QScatterDataItem instances for | 
| 43 |  * visualization. | 
| 44 |  * | 
| 45 |  * \sa QScatterDataProxy, {Qt Data Visualization C++ Classes} | 
| 46 |  */ | 
| 47 |  | 
| 48 | /*! | 
| 49 |  * Constructs a scatter data item. | 
| 50 |  */ | 
| 51 | QScatterDataItem::QScatterDataItem() | 
| 52 |     : d_ptr(0) // private data doesn't exist by default (optimization) | 
| 53 |  | 
| 54 | { | 
| 55 | } | 
| 56 |  | 
| 57 | /*! | 
| 58 |  * Constructs a scatter data item at the position \a position. | 
| 59 |  */ | 
| 60 | QScatterDataItem::QScatterDataItem(const QVector3D &position) | 
| 61 |     : d_ptr(0), | 
| 62 |       m_position(position) | 
| 63 | { | 
| 64 | } | 
| 65 |  | 
| 66 | /*! | 
| 67 |  * Constructs a scatter data item at the position \a position with the rotation | 
| 68 |  * \a rotation. | 
| 69 |  */ | 
| 70 | QScatterDataItem::QScatterDataItem(const QVector3D &position, const QQuaternion &rotation) | 
| 71 |     : d_ptr(0), | 
| 72 |       m_position(position), | 
| 73 |       m_rotation(rotation) | 
| 74 | { | 
| 75 | } | 
| 76 |  | 
| 77 | /*! | 
| 78 |  * Constructs a copy of \a other. | 
| 79 |  */ | 
| 80 | QScatterDataItem::QScatterDataItem(const QScatterDataItem &other) | 
| 81 | { | 
| 82 |     operator=(other); | 
| 83 | } | 
| 84 |  | 
| 85 | /*! | 
| 86 |  * Deletes a scatter data item. | 
| 87 |  */ | 
| 88 | QScatterDataItem::~QScatterDataItem() | 
| 89 | { | 
| 90 | } | 
| 91 |  | 
| 92 | /*! | 
| 93 |  *  Assigns a copy of \a other to this object. | 
| 94 |  */ | 
| 95 | QScatterDataItem &QScatterDataItem::operator=(const QScatterDataItem &other) | 
| 96 | { | 
| 97 |     m_position = other.m_position; | 
| 98 |     m_rotation = other.m_rotation; | 
| 99 |  | 
| 100 |     if (other.d_ptr) | 
| 101 |         createExtraData(); | 
| 102 |     else | 
| 103 |         d_ptr = 0; | 
| 104 |  | 
| 105 |     return *this; | 
| 106 | } | 
| 107 |  | 
| 108 | /*! | 
| 109 |  * \fn void QScatterDataItem::setPosition(const QVector3D &pos) | 
| 110 |  * Sets the position \a pos for this data item. | 
| 111 |  */ | 
| 112 |  | 
| 113 | /*! | 
| 114 |  * \fn QVector3D QScatterDataItem::position() const | 
| 115 |  * Returns the position of this data item. | 
| 116 |  */ | 
| 117 |  | 
| 118 | /*! | 
| 119 |  * \fn void QScatterDataItem::setRotation(const QQuaternion &rot) | 
| 120 |  * Sets the rotation \a rot for this data item. | 
| 121 |  * The value of \a rot should be a normalized QQuaternion. | 
| 122 |  * If the series also has rotation, item rotation is multiplied by it. | 
| 123 |  * Defaults to no rotation. | 
| 124 |  */ | 
| 125 |  | 
| 126 | /*! | 
| 127 |  * \fn QQuaternion QScatterDataItem::rotation() const | 
| 128 |  * Returns the rotation of this data item. | 
| 129 |  * \sa setRotation() | 
| 130 |  */ | 
| 131 |  | 
| 132 | /*! | 
| 133 |  * \fn void QScatterDataItem::setX(float value) | 
| 134 |  * Sets the x-coordinate of the item position to the value \a value. | 
| 135 |  */ | 
| 136 |  | 
| 137 | /*! | 
| 138 |  * \fn void QScatterDataItem::setY(float value) | 
| 139 |  * Sets the y-coordinate of the item position to the value \a value. | 
| 140 |  */ | 
| 141 |  | 
| 142 | /*! | 
| 143 |  * \fn void QScatterDataItem::setZ(float value) | 
| 144 |  * Sets the z-coordinate of the item position to the value \a value. | 
| 145 |  */ | 
| 146 |  | 
| 147 | /*! | 
| 148 |  * \fn float QScatterDataItem::x() const | 
| 149 |  * Returns the x-coordinate of the position of this data item. | 
| 150 |  */ | 
| 151 |  | 
| 152 | /*! | 
| 153 |  * \fn float QScatterDataItem::y() const | 
| 154 |  * Returns the y-coordinate of the position of this data item. | 
| 155 |  */ | 
| 156 |  | 
| 157 | /*! | 
| 158 |  * \fn float QScatterDataItem::z() const | 
| 159 |  * Returns the z-coordinate of the position of this data item. | 
| 160 |  */ | 
| 161 |  | 
| 162 | /*! | 
| 163 |  * \internal | 
| 164 |  */ | 
| 165 | void QScatterDataItem::() | 
| 166 | { | 
| 167 |     if (!d_ptr) | 
| 168 |         d_ptr = new QScatterDataItemPrivate; | 
| 169 | } | 
| 170 |  | 
| 171 | QScatterDataItemPrivate::QScatterDataItemPrivate() | 
| 172 | { | 
| 173 | } | 
| 174 |  | 
| 175 | QScatterDataItemPrivate::~QScatterDataItemPrivate() | 
| 176 | { | 
| 177 | } | 
| 178 |  | 
| 179 | QT_END_NAMESPACE_DATAVISUALIZATION | 
| 180 |  |