1// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qcuboidgeometryview.h"
5
6#include <Qt3DExtras/qcuboidgeometry.h>
7
8QT_BEGIN_NAMESPACE
9
10namespace Qt3DExtras {
11
12/*!
13 * \qmltype CuboidGeometryView
14 * \instantiates Qt3DExtras::QCuboidGeometryView
15 * \inqmlmodule Qt3D.Extras
16 * \brief A cuboid mesh.
17 */
18
19/*!
20 * \qmlproperty real CuboidGeometryView::xExtent
21 *
22 * Holds the x extent of the mesh.
23 */
24
25/*!
26 * \qmlproperty real CuboidGeometryView::yExtent
27 *
28 * Holds the y extent of the mesh.
29 */
30
31/*!
32 * \qmlproperty real CuboidGeometryView::zExtent
33 *
34 * Holds the z extent of the mesh.
35 */
36
37/*!
38 * \qmlproperty size CuboidGeometryView::yzMeshResolution
39 *
40 * Holds the y-z resolution of the mesh.
41 * The width and height values of this property specify the number of vertices generated for
42 * the y-z faces of the mesh.
43 */
44
45/*!
46 * \qmlproperty size CuboidGeometryView::xzMeshResolution
47 *
48 * Holds the x-z resolution of the mesh.
49 * The width and height values of this property specify the number of vertices generated for
50 * the x-z faces of the mesh.
51 */
52
53/*!
54 * \qmlproperty size CuboidGeometryView::xyMeshResolution
55 *
56 * Holds the x-y resolution of the mesh.
57 * The width and height values of this property specify the number of vertices generated for
58 * the x-y faces of the mesh.
59 */
60
61/*!
62 * \class Qt3DExtras::QCuboidGeometryView
63 \ingroup qt3d-extras-geometries
64 * \inheaderfile Qt3DExtras/QCuboidGeometryView
65 * \inmodule Qt3DExtras
66 *
67 * \inherits Qt3DCore::QGeometryView
68 *
69 * \brief A cuboid mesh.
70 */
71
72/*!
73 * Constructs a new QCuboidGeometryView with \a parent.
74 */
75QCuboidGeometryView::QCuboidGeometryView(QNode *parent)
76 : Qt3DCore::QGeometryView(parent)
77{
78 QCuboidGeometry *geometry = new QCuboidGeometry(this);
79 QObject::connect(sender: geometry, signal: &QCuboidGeometry::xExtentChanged, context: this, slot: &QCuboidGeometryView::xExtentChanged);
80 QObject::connect(sender: geometry, signal: &QCuboidGeometry::yExtentChanged, context: this, slot: &QCuboidGeometryView::yExtentChanged);
81 QObject::connect(sender: geometry, signal: &QCuboidGeometry::zExtentChanged, context: this, slot: &QCuboidGeometryView::zExtentChanged);
82 QObject::connect(sender: geometry, signal: &QCuboidGeometry::xyMeshResolutionChanged, context: this, slot: &QCuboidGeometryView::xyMeshResolutionChanged);
83 QObject::connect(sender: geometry, signal: &QCuboidGeometry::xzMeshResolutionChanged, context: this, slot: &QCuboidGeometryView::xzMeshResolutionChanged);
84 QObject::connect(sender: geometry, signal: &QCuboidGeometry::yzMeshResolutionChanged, context: this, slot: &QCuboidGeometryView::yzMeshResolutionChanged);
85 QGeometryView::setGeometry(geometry);
86}
87
88/*! \internal */
89QCuboidGeometryView::~QCuboidGeometryView()
90{
91}
92
93void QCuboidGeometryView::setXExtent(float xExtent)
94{
95 static_cast<QCuboidGeometry *>(geometry())->setXExtent(xExtent);
96}
97
98/*!
99 * \property QCuboidGeometryView::xExtent
100 *
101 * Holds the x extent of the mesh.
102 */
103float QCuboidGeometryView::xExtent() const
104{
105 return static_cast<QCuboidGeometry *>(geometry())->xExtent();
106}
107
108void QCuboidGeometryView::setYExtent(float yExtent)
109{
110 static_cast<QCuboidGeometry *>(geometry())->setYExtent(yExtent);
111}
112
113/*!
114 * \property QCuboidGeometryView::yExtent
115 *
116 * Holds the y extent of the mesh.
117 */
118float QCuboidGeometryView::yExtent() const
119{
120 return static_cast<QCuboidGeometry *>(geometry())->yExtent();
121}
122
123void QCuboidGeometryView::setZExtent(float zExtent)
124{
125 static_cast<QCuboidGeometry *>(geometry())->setZExtent(zExtent);
126}
127
128/*!
129 * \property QCuboidGeometryView::zExtent
130 *
131 * Holds the z extent of the mesh.
132 */
133float QCuboidGeometryView::zExtent() const
134{
135 return static_cast<QCuboidGeometry *>(geometry())->zExtent();
136}
137
138void QCuboidGeometryView::setYZMeshResolution(const QSize &resolution)
139{
140 static_cast<QCuboidGeometry *>(geometry())->setYZMeshResolution(resolution);
141}
142
143/*!
144 * \property QCuboidGeometryView::yzMeshResolution
145 *
146 * Holds the y-z resolution of the mesh.
147 * The width and height values of this property specify the number of vertices generated for
148 * the y-z faces of the mesh.
149 */
150QSize QCuboidGeometryView::yzMeshResolution() const
151{
152 return static_cast<QCuboidGeometry *>(geometry())->yzMeshResolution();
153}
154
155void QCuboidGeometryView::setXZMeshResolution(const QSize &resolution)
156{
157 static_cast<QCuboidGeometry *>(geometry())->setXZMeshResolution(resolution);
158}
159
160/*!
161 * \property QCuboidGeometryView::xzMeshResolution
162 *
163 * Holds the x-z resolution of the mesh.
164 * The width and height values of this property specify the number of vertices generated for
165 * the x-z faces of the mesh.
166 */
167QSize QCuboidGeometryView::xzMeshResolution() const
168{
169 return static_cast<QCuboidGeometry *>(geometry())->xzMeshResolution();
170}
171
172void QCuboidGeometryView::setXYMeshResolution(const QSize &resolution)
173{
174 static_cast<QCuboidGeometry *>(geometry())->setXYMeshResolution(resolution);
175}
176
177/*!
178 * \property QCuboidGeometryView::xyMeshResolution
179 *
180 * Holds the x-y resolution of the mesh.
181 * The width and height values of this property specify the number of vertices generated for
182 * the x-y faces of the mesh.
183 */
184QSize QCuboidGeometryView::xyMeshResolution() const
185{
186 return static_cast<QCuboidGeometry *>(geometry())->xyMeshResolution();
187}
188
189} // namespace Qt3DExtras
190
191QT_END_NAMESPACE
192
193#include "moc_qcuboidgeometryview.cpp"
194

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