1// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef _USE_MATH_DEFINES
6# define _USE_MATH_DEFINES // For MSVC
7#endif
8
9#include "qtorusgeometryview.h"
10
11#include <Qt3DExtras/qtorusgeometry.h>
12
13QT_BEGIN_NAMESPACE
14
15namespace Qt3DExtras {
16
17/*!
18 * \qmltype TorusGeometryView
19 * \instantiates Qt3DExtras::QTorusGeometryView
20 * \inqmlmodule Qt3D.Extras
21 * \brief A toroidal mesh.
22 */
23
24/*!
25 * \qmlproperty int TorusGeometryView::rings
26 *
27 * Holds the number of rings in the mesh.
28 */
29
30/*!
31 * \qmlproperty int TorusGeometryView::slices
32 *
33 * Holds the number of slices in the mesh.
34 */
35
36/*!
37 * \qmlproperty real TorusGeometryView::radius
38 *
39 * Holds the outer radius of the torus.
40 */
41
42/*!
43 * \qmlproperty real TorusGeometryView::minorRadius
44 *
45 * Holds the inner radius of the torus.
46 */
47
48/*!
49 * \class Qt3DExtras::QTorusGeometryView
50 \ingroup qt3d-extras-geometries
51 * \inheaderfile Qt3DExtras/QTorusGeometryView
52 * \inmodule Qt3DExtras
53 *
54 * \inherits Qt3DCore::QGeometryView
55 *
56 * \brief A toroidal mesh.
57 */
58
59/*!
60 * Constructs a new QTorusGeometryView with \a parent.
61 */
62QTorusGeometryView::QTorusGeometryView(QNode *parent)
63 : Qt3DCore::QGeometryView(parent)
64{
65 QTorusGeometry *geometry = new QTorusGeometry(this);
66 QObject::connect(sender: geometry, signal: &QTorusGeometry::radiusChanged, context: this, slot: &QTorusGeometryView::radiusChanged);
67 QObject::connect(sender: geometry, signal: &QTorusGeometry::ringsChanged, context: this, slot: &QTorusGeometryView::ringsChanged);
68 QObject::connect(sender: geometry, signal: &QTorusGeometry::slicesChanged, context: this, slot: &QTorusGeometryView::slicesChanged);
69 QObject::connect(sender: geometry, signal: &QTorusGeometry::minorRadiusChanged, context: this, slot: &QTorusGeometryView::minorRadiusChanged);
70
71 QGeometryView::setGeometry(geometry);
72}
73
74/*! \internal */
75QTorusGeometryView::~QTorusGeometryView()
76{
77}
78
79void QTorusGeometryView::setRings(int rings)
80{
81 static_cast<QTorusGeometry *>(geometry())->setRings(rings);
82}
83
84void QTorusGeometryView::setSlices(int slices)
85{
86 static_cast<QTorusGeometry *>(geometry())->setSlices(slices);
87}
88
89void QTorusGeometryView::setRadius(float radius)
90{
91 static_cast<QTorusGeometry *>(geometry())->setRadius(radius);
92}
93
94void QTorusGeometryView::setMinorRadius(float minorRadius)
95{
96 static_cast<QTorusGeometry *>(geometry())->setMinorRadius(minorRadius);
97}
98
99/*!
100 * \property QTorusGeometryView::rings
101 *
102 * Holds the number of rings in the mesh.
103 */
104int QTorusGeometryView::rings() const
105{
106 return static_cast<QTorusGeometry *>(geometry())->rings();
107}
108
109/*!
110 * \property QTorusGeometryView::slices
111 *
112 * Holds the number of slices in the mesh.
113 */
114int QTorusGeometryView::slices() const
115{
116 return static_cast<QTorusGeometry *>(geometry())->slices();
117}
118
119/*!
120 * \property QTorusGeometryView::radius
121 *
122 * Holds the outer radius of the torus.
123 */
124float QTorusGeometryView::radius() const
125{
126 return static_cast<QTorusGeometry *>(geometry())->radius();
127}
128
129/*!
130 * \property QTorusGeometryView::minorRadius
131 *
132 * Holds the inner radius of the torus.
133 */
134float QTorusGeometryView::minorRadius() const
135{
136 return static_cast<QTorusGeometry *>(geometry())->minorRadius();
137}
138
139} // namespace Qt3DExtras
140
141QT_END_NAMESPACE
142
143#include "moc_qtorusgeometryview.cpp"
144

source code of qt3d/src/extras/geometries/qtorusgeometryview.cpp