summaryrefslogtreecommitdiffstats
path: root/src/datavisualization
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-09-10 11:42:13 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-09-10 12:04:24 +0300
commita28cdb72a4ea768a898ca07f0df0fa3c17c073a8 (patch)
tree0bafdcfa99fc783e9f5204539a8242bf6128d795 /src/datavisualization
parentf3e38983d77c72f3121c33a149a58fdf9c64158c (diff)
Module renamed
Task-number: QTRD-2224 Change-Id: Iec18b6121809300b11d85445281d3c626c434f35 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavisualization')
-rw-r--r--src/datavisualization/axis/axis.pri12
-rw-r--r--src/datavisualization/axis/q3dabstractaxis.cpp149
-rw-r--r--src/datavisualization/axis/q3dabstractaxis.h88
-rw-r--r--src/datavisualization/axis/q3dabstractaxis_p.h68
-rw-r--r--src/datavisualization/axis/q3dcategoryaxis.cpp88
-rw-r--r--src/datavisualization/axis/q3dcategoryaxis.h54
-rw-r--r--src/datavisualization/axis/q3dcategoryaxis_p.h49
-rw-r--r--src/datavisualization/axis/q3dvalueaxis.cpp332
-rw-r--r--src/datavisualization/axis/q3dvalueaxis.h77
-rw-r--r--src/datavisualization/axis/q3dvalueaxis_p.h69
-rw-r--r--src/datavisualization/common.pri8
-rw-r--r--src/datavisualization/data/abstractitemmodelhandler.cpp250
-rw-r--r--src/datavisualization/data/abstractitemmodelhandler_p.h90
-rw-r--r--src/datavisualization/data/abstractrenderitem.cpp60
-rw-r--r--src/datavisualization/data/abstractrenderitem_p.h69
-rw-r--r--src/datavisualization/data/baritemmodelhandler.cpp94
-rw-r--r--src/datavisualization/data/baritemmodelhandler_p.h52
-rw-r--r--src/datavisualization/data/barrenderitem.cpp67
-rw-r--r--src/datavisualization/data/barrenderitem_p.h89
-rw-r--r--src/datavisualization/data/data.pri58
-rw-r--r--src/datavisualization/data/labelitem.cpp64
-rw-r--r--src/datavisualization/data/labelitem_p.h59
-rw-r--r--src/datavisualization/data/qabstractdatamapping.cpp71
-rw-r--r--src/datavisualization/data/qabstractdatamapping.h53
-rw-r--r--src/datavisualization/data/qabstractdatamapping_p.h50
-rw-r--r--src/datavisualization/data/qabstractdataproxy.cpp119
-rw-r--r--src/datavisualization/data/qabstractdataproxy.h73
-rw-r--r--src/datavisualization/data/qabstractdataproxy_p.h62
-rw-r--r--src/datavisualization/data/qbardataitem.cpp116
-rw-r--r--src/datavisualization/data/qbardataitem.h54
-rw-r--r--src/datavisualization/data/qbardataitem_p.h51
-rw-r--r--src/datavisualization/data/qbardataproxy.cpp409
-rw-r--r--src/datavisualization/data/qbardataproxy.h109
-rw-r--r--src/datavisualization/data/qbardataproxy_p.h69
-rw-r--r--src/datavisualization/data/qitemmodelbardatamapping.cpp238
-rw-r--r--src/datavisualization/data/qitemmodelbardatamapping.h76
-rw-r--r--src/datavisualization/data/qitemmodelbardatamapping_p.h58
-rw-r--r--src/datavisualization/data/qitemmodelbardataproxy.cpp163
-rw-r--r--src/datavisualization/data/qitemmodelbardataproxy.h62
-rw-r--r--src/datavisualization/data/qitemmodelbardataproxy_p.h58
-rw-r--r--src/datavisualization/data/qitemmodelscatterdatamapping.cpp167
-rw-r--r--src/datavisualization/data/qitemmodelscatterdatamapping.h62
-rw-r--r--src/datavisualization/data/qitemmodelscatterdatamapping_p.h56
-rw-r--r--src/datavisualization/data/qitemmodelscatterdataproxy.cpp159
-rw-r--r--src/datavisualization/data/qitemmodelscatterdataproxy.h62
-rw-r--r--src/datavisualization/data/qitemmodelscatterdataproxy_p.h58
-rw-r--r--src/datavisualization/data/qitemmodelsurfacedatamapping.cpp223
-rw-r--r--src/datavisualization/data/qitemmodelsurfacedatamapping.h76
-rw-r--r--src/datavisualization/data/qitemmodelsurfacedatamapping_p.h58
-rw-r--r--src/datavisualization/data/qitemmodelsurfacedataproxy.cpp161
-rw-r--r--src/datavisualization/data/qitemmodelsurfacedataproxy.h62
-rw-r--r--src/datavisualization/data/qitemmodelsurfacedataproxy_p.h58
-rw-r--r--src/datavisualization/data/qscatterdataitem.cpp129
-rw-r--r--src/datavisualization/data/qscatterdataitem.h57
-rw-r--r--src/datavisualization/data/qscatterdataitem_p.h51
-rw-r--r--src/datavisualization/data/qscatterdataproxy.cpp332
-rw-r--r--src/datavisualization/data/qscatterdataproxy.h85
-rw-r--r--src/datavisualization/data/qscatterdataproxy_p.h64
-rw-r--r--src/datavisualization/data/qsurfacedataproxy.cpp106
-rw-r--r--src/datavisualization/data/qsurfacedataproxy.h63
-rw-r--r--src/datavisualization/data/qsurfacedataproxy_p.h56
-rw-r--r--src/datavisualization/data/scatteritemmodelhandler.cpp82
-rw-r--r--src/datavisualization/data/scatteritemmodelhandler_p.h52
-rw-r--r--src/datavisualization/data/scatterrenderitem.cpp40
-rw-r--r--src/datavisualization/data/scatterrenderitem_p.h72
-rw-r--r--src/datavisualization/data/surfaceitemmodelhandler.cpp94
-rw-r--r--src/datavisualization/data/surfaceitemmodelhandler_p.h52
-rw-r--r--src/datavisualization/datavisualization.pro32
-rw-r--r--src/datavisualization/doc/images/q3dbars-minimal.pngbin0 -> 8611 bytes
-rw-r--r--src/datavisualization/doc/images/q3dscatter-minimal.pngbin0 -> 7998 bytes
-rw-r--r--src/datavisualization/doc/qtdatavisualization.qdocconf33
-rw-r--r--src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp41
-rw-r--r--src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp40
-rw-r--r--src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp69
-rw-r--r--src/datavisualization/doc/snippets/doc_src_qtdatavisualization.pro21
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-index.qdoc60
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization.qdoc26
-rw-r--r--src/datavisualization/doc/src/qtdatavisualizationlicense.qdoc37
-rw-r--r--src/datavisualization/engine/abstract3dcontroller.cpp1057
-rw-r--r--src/datavisualization/engine/abstract3dcontroller_p.h341
-rw-r--r--src/datavisualization/engine/abstract3drenderer.cpp307
-rw-r--r--src/datavisualization/engine/abstract3drenderer_p.h138
-rw-r--r--src/datavisualization/engine/axisrendercache.cpp186
-rw-r--r--src/datavisualization/engine/axisrendercache_p.h101
-rw-r--r--src/datavisualization/engine/bars3dcontroller.cpp377
-rw-r--r--src/datavisualization/engine/bars3dcontroller_p.h143
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp1828
-rw-r--r--src/datavisualization/engine/bars3drenderer_p.h171
-rw-r--r--src/datavisualization/engine/drawer.cpp347
-rw-r--r--src/datavisualization/engine/drawer_p.h103
-rw-r--r--src/datavisualization/engine/engine.pri53
-rw-r--r--src/datavisualization/engine/engine.qrc61
-rw-r--r--src/datavisualization/engine/meshes/backgroudFlat.obj32
-rw-r--r--src/datavisualization/engine/meshes/backgroudNegatives.obj37
-rw-r--r--src/datavisualization/engine/meshes/backgroudSmooth.obj36
-rw-r--r--src/datavisualization/engine/meshes/barFilledFlat.obj242
-rw-r--r--src/datavisualization/engine/meshes/barFilledSmooth.obj236
-rw-r--r--src/datavisualization/engine/meshes/barFlat.obj219
-rw-r--r--src/datavisualization/engine/meshes/barSmooth.obj214
-rw-r--r--src/datavisualization/engine/meshes/coneFilledFlat.obj128
-rw-r--r--src/datavisualization/engine/meshes/coneFilledSmooth.obj128
-rw-r--r--src/datavisualization/engine/meshes/coneFlat.obj89
-rw-r--r--src/datavisualization/engine/meshes/coneSmooth.obj90
-rw-r--r--src/datavisualization/engine/meshes/cubeFilledFlat.obj54
-rw-r--r--src/datavisualization/engine/meshes/cubeFilledSmooth.obj56
-rw-r--r--src/datavisualization/engine/meshes/cubeFlat.obj47
-rw-r--r--src/datavisualization/engine/meshes/cubeSmooth.obj50
-rw-r--r--src/datavisualization/engine/meshes/cylinderFilledFlat.obj361
-rw-r--r--src/datavisualization/engine/meshes/cylinderFilledSmooth.obj391
-rw-r--r--src/datavisualization/engine/meshes/cylinderFlat.obj299
-rw-r--r--src/datavisualization/engine/meshes/cylinderSmooth.obj330
-rw-r--r--src/datavisualization/engine/meshes/plane.obj15
-rw-r--r--src/datavisualization/engine/meshes/pyramidFilledFlat.obj36
-rw-r--r--src/datavisualization/engine/meshes/pyramidFilledSmooth.obj36
-rw-r--r--src/datavisualization/engine/meshes/pyramidFlat.obj22
-rw-r--r--src/datavisualization/engine/meshes/pyramidSmooth.obj23
-rw-r--r--src/datavisualization/engine/meshes/scatterdot.obj28
-rw-r--r--src/datavisualization/engine/meshes/scatterdotFlat.obj28
-rw-r--r--src/datavisualization/engine/meshes/sphere.obj1301
-rw-r--r--src/datavisualization/engine/meshes/sphereSmooth.obj1232
-rw-r--r--src/datavisualization/engine/q3dbars.cpp600
-rw-r--r--src/datavisualization/engine/q3dbars.h137
-rw-r--r--src/datavisualization/engine/q3dbars_p.h54
-rw-r--r--src/datavisualization/engine/q3dbox.cpp480
-rw-r--r--src/datavisualization/engine/q3dbox.h184
-rw-r--r--src/datavisualization/engine/q3dcamera.cpp295
-rw-r--r--src/datavisualization/engine/q3dcamera.h87
-rw-r--r--src/datavisualization/engine/q3dcamera_p.h61
-rw-r--r--src/datavisualization/engine/q3dlight.cpp49
-rw-r--r--src/datavisualization/engine/q3dlight.h50
-rw-r--r--src/datavisualization/engine/q3dlight_p.h57
-rw-r--r--src/datavisualization/engine/q3dobject.cpp73
-rw-r--r--src/datavisualization/engine/q3dobject.h54
-rw-r--r--src/datavisualization/engine/q3dobject_p.h53
-rw-r--r--src/datavisualization/engine/q3dscatter.cpp575
-rw-r--r--src/datavisualization/engine/q3dscatter.h129
-rw-r--r--src/datavisualization/engine/q3dscatter_p.h54
-rw-r--r--src/datavisualization/engine/q3dscene.cpp199
-rw-r--r--src/datavisualization/engine/q3dscene.h83
-rw-r--r--src/datavisualization/engine/q3dscene_p.h60
-rw-r--r--src/datavisualization/engine/q3dsurface.cpp321
-rw-r--r--src/datavisualization/engine/q3dsurface.h106
-rw-r--r--src/datavisualization/engine/q3dsurface_p.h53
-rw-r--r--src/datavisualization/engine/q3dwindow.cpp164
-rw-r--r--src/datavisualization/engine/q3dwindow.h61
-rw-r--r--src/datavisualization/engine/q3dwindow_p.h57
-rw-r--r--src/datavisualization/engine/scatter3dcontroller.cpp269
-rw-r--r--src/datavisualization/engine/scatter3dcontroller_p.h106
-rw-r--r--src/datavisualization/engine/scatter3drenderer.cpp1608
-rw-r--r--src/datavisualization/engine/scatter3drenderer_p.h155
-rw-r--r--src/datavisualization/engine/selectionpointer.cpp271
-rw-r--r--src/datavisualization/engine/selectionpointer_p.h97
-rw-r--r--src/datavisualization/engine/shaders/ambient.frag32
-rw-r--r--src/datavisualization/engine/shaders/colorOnY.frag36
-rw-r--r--src/datavisualization/engine/shaders/colorOnY_ES2.frag37
-rw-r--r--src/datavisualization/engine/shaders/default.frag36
-rw-r--r--src/datavisualization/engine/shaders/default.vert28
-rw-r--r--src/datavisualization/engine/shaders/default_ES2.frag38
-rw-r--r--src/datavisualization/engine/shaders/default_ES2.vert26
-rw-r--r--src/datavisualization/engine/shaders/depth.frag3
-rw-r--r--src/datavisualization/engine/shaders/depth.vert8
-rw-r--r--src/datavisualization/engine/shaders/label.frag8
-rw-r--r--src/datavisualization/engine/shaders/label.vert11
-rw-r--r--src/datavisualization/engine/shaders/selection.frag7
-rw-r--r--src/datavisualization/engine/shaders/selection.vert7
-rw-r--r--src/datavisualization/engine/shaders/shadow.frag82
-rw-r--r--src/datavisualization/engine/shaders/shadow.vert37
-rw-r--r--src/datavisualization/engine/shaders/shadowNoTex.frag98
-rw-r--r--src/datavisualization/engine/shaders/shadowNoTexColorOnY.frag82
-rw-r--r--src/datavisualization/engine/shaders/surface.frag39
-rw-r--r--src/datavisualization/engine/shaders/surface.vert30
-rw-r--r--src/datavisualization/engine/shaders/surfaceFlat.frag38
-rw-r--r--src/datavisualization/engine/shaders/surfaceFlat.vert30
-rw-r--r--src/datavisualization/engine/shaders/surfaceGrid.frag16
-rw-r--r--src/datavisualization/engine/shaders/surfaceGrid.vert26
-rw-r--r--src/datavisualization/engine/shaders/texture.frag35
-rw-r--r--src/datavisualization/engine/shaders/texture.vert26
-rw-r--r--src/datavisualization/engine/shaders/texture_ES2.frag37
-rw-r--r--src/datavisualization/engine/surface3dcontroller.cpp161
-rw-r--r--src/datavisualization/engine/surface3dcontroller_p.h102
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp1256
-rw-r--r--src/datavisualization/engine/surface3drenderer_p.h164
-rw-r--r--src/datavisualization/engine/theme.cpp324
-rw-r--r--src/datavisualization/engine/theme_p.h81
-rw-r--r--src/datavisualization/global/datavisualizationglobal_p.h52
-rw-r--r--src/datavisualization/global/global.pri4
-rw-r--r--src/datavisualization/global/qdatavisualizationenums.h126
-rw-r--r--src/datavisualization/global/qdatavisualizationglobal.h67
-rw-r--r--src/datavisualization/global/qtdatavisualizationenums.qdoc176
-rw-r--r--src/datavisualization/input/input.pri11
-rw-r--r--src/datavisualization/input/q3dinputhandler.cpp124
-rw-r--r--src/datavisualization/input/q3dinputhandler.h60
-rw-r--r--src/datavisualization/input/q3dinputhandler_p.h51
-rw-r--r--src/datavisualization/input/qabstract3dinputhandler.cpp141
-rw-r--r--src/datavisualization/input/qabstract3dinputhandler.h82
-rw-r--r--src/datavisualization/input/qabstract3dinputhandler_p.h69
-rw-r--r--src/datavisualization/input/qtouch3dinputhandler.cpp100
-rw-r--r--src/datavisualization/input/qtouch3dinputhandler.h45
-rw-r--r--src/datavisualization/utils/abstractobjecthelper.cpp81
-rw-r--r--src/datavisualization/utils/abstractobjecthelper_p.h65
-rw-r--r--src/datavisualization/utils/camerahelper.cpp286
-rw-r--r--src/datavisualization/utils/camerahelper_p.h90
-rw-r--r--src/datavisualization/utils/meshloader.cpp125
-rw-r--r--src/datavisualization/utils/meshloader_p.h51
-rw-r--r--src/datavisualization/utils/objecthelper.cpp101
-rw-r--r--src/datavisualization/utils/objecthelper_p.h54
-rw-r--r--src/datavisualization/utils/shaderhelper.cpp229
-rw-r--r--src/datavisualization/utils/shaderhelper_p.h110
-rw-r--r--src/datavisualization/utils/surfaceobject.cpp348
-rw-r--r--src/datavisualization/utils/surfaceobject_p.h67
-rw-r--r--src/datavisualization/utils/texturehelper.cpp394
-rw-r--r--src/datavisualization/utils/texturehelper_p.h71
-rw-r--r--src/datavisualization/utils/utils.cpp303
-rw-r--r--src/datavisualization/utils/utils.pri19
-rw-r--r--src/datavisualization/utils/utils_p.h76
-rw-r--r--src/datavisualization/utils/vertexindexer.cpp153
-rw-r--r--src/datavisualization/utils/vertexindexer_p.h88
217 files changed, 31068 insertions, 0 deletions
diff --git a/src/datavisualization/axis/axis.pri b/src/datavisualization/axis/axis.pri
new file mode 100644
index 00000000..4e96618b
--- /dev/null
+++ b/src/datavisualization/axis/axis.pri
@@ -0,0 +1,12 @@
+HEADERS += \
+ $$PWD/q3dabstractaxis.h \
+ $$PWD/q3dabstractaxis_p.h \
+ $$PWD/q3dvalueaxis.h \
+ $$PWD/q3dvalueaxis_p.h \
+ $$PWD/q3dcategoryaxis.h \
+ $$PWD/q3dcategoryaxis_p.h
+
+SOURCES += \
+ $$PWD/q3dabstractaxis.cpp \
+ $$PWD/q3dvalueaxis.cpp \
+ $$PWD/q3dcategoryaxis.cpp
diff --git a/src/datavisualization/axis/q3dabstractaxis.cpp b/src/datavisualization/axis/q3dabstractaxis.cpp
new file mode 100644
index 00000000..67f4f5fc
--- /dev/null
+++ b/src/datavisualization/axis/q3dabstractaxis.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "q3dabstractaxis.h"
+#include "q3dabstractaxis_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class Q3DAbstractAxis
+ * \inmodule QtDataVisualization
+ * \brief Q3DAbstractAxis is base class for axes of a graph.
+ * \since 1.0.0
+ *
+ * You should not need to use this class directly, but one of its subclasses instead.
+ *
+ * \sa Q3DCategoryAxis, Q3DValueAxis
+ */
+
+/*!
+ * \enum Q3DAbstractAxis::AxisOrientation
+ *
+ * The orientation of the axis object.
+ *
+ * \value AxisOrientationNone
+ * \value AxisOrientationX
+ * \value AxisOrientationY
+ * \value AxisOrientationZ
+ */
+
+/*!
+ * \enum Q3DAbstractAxis::AxisType
+ *
+ * The type of the axis object.
+ *
+ * \value AxisTypeNone
+ * \value AxisTypeCategory
+ * \value AxisTypeValue
+ */
+
+/*!
+ * \internal
+ */
+Q3DAbstractAxis::Q3DAbstractAxis(Q3DAbstractAxisPrivate *d, QObject *parent) :
+ QObject(parent),
+ d_ptr(d)
+{
+}
+
+/*!
+ * Destroys Q3DAbstractAxis.
+ */
+Q3DAbstractAxis::~Q3DAbstractAxis()
+{
+}
+
+/*!
+ * \property Q3DAbstractAxis::title
+ *
+ * Defines the title for the axis.
+ */
+QString Q3DAbstractAxis::title() const
+{
+ return d_ptr->m_title;
+}
+
+/*!
+ * \property Q3DAbstractAxis::labels
+ *
+ * Defines the labels for the axis.
+ */
+QStringList Q3DAbstractAxis::labels() const
+{
+ d_ptr->updateLabels();
+ return d_ptr->m_labels;
+}
+
+/*!
+ * \property Q3DAbstractAxis::orientation
+ *
+ * Defines the orientation of the axis, one of \c Q3DAbstractAxis::AxisOrientation.
+ */
+Q3DAbstractAxis::AxisOrientation Q3DAbstractAxis::orientation() const
+{
+ return d_ptr->m_orientation;
+}
+
+/*!
+ * \property Q3DAbstractAxis::type
+ *
+ * Defines the type of the axis, one of \c Q3DAbstractAxis::AxisType.
+ */
+Q3DAbstractAxis::AxisType Q3DAbstractAxis::type() const
+{
+ return d_ptr->m_type;
+}
+
+void Q3DAbstractAxis::setTitle(QString title)
+{
+ if (d_ptr->m_title != title) {
+ d_ptr->m_title = title;
+ emit titleChanged(title);
+ }
+}
+
+// Q3DAbstractAxisPrivate
+
+Q3DAbstractAxisPrivate::Q3DAbstractAxisPrivate(Q3DAbstractAxis *q, Q3DAbstractAxis::AxisType type)
+ : QObject(0),
+ q_ptr(q),
+ m_orientation(Q3DAbstractAxis::AxisOrientationNone),
+ m_type(type),
+ m_isDefaultAxis(false)
+{
+}
+
+Q3DAbstractAxisPrivate::~Q3DAbstractAxisPrivate()
+{
+}
+
+void Q3DAbstractAxisPrivate::setOrientation(Q3DAbstractAxis::AxisOrientation orientation)
+{
+ if (m_orientation == Q3DAbstractAxis::AxisOrientationNone)
+ m_orientation = orientation;
+ else
+ Q_ASSERT("Attempted to reset axis orientation.");
+}
+
+void Q3DAbstractAxisPrivate::updateLabels()
+{
+ // Default implementation does nothing
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/axis/q3dabstractaxis.h b/src/datavisualization/axis/q3dabstractaxis.h
new file mode 100644
index 00000000..6e89723a
--- /dev/null
+++ b/src/datavisualization/axis/q3dabstractaxis.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef Q3DABSTRACTAXIS_H
+#define Q3DABSTRACTAXIS_H
+
+#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QObject>
+#include <QScopedPointer>
+#include <QVector>
+#include <QStringList>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class Q3DAbstractAxisPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT Q3DAbstractAxis : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(AxisOrientation)
+ Q_ENUMS(AxisType)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
+ Q_PROPERTY(QStringList labels READ labels NOTIFY labelsChanged)
+ Q_PROPERTY(AxisOrientation orientation READ orientation)
+ Q_PROPERTY(AxisType type READ type)
+
+public:
+ enum AxisOrientation {
+ AxisOrientationNone = 0,
+ AxisOrientationX = 1,
+ AxisOrientationY = 2,
+ AxisOrientationZ = 4
+ };
+
+ enum AxisType {
+ AxisTypeNone = 0,
+ AxisTypeCategory = 1,
+ AxisTypeValue = 2
+ //AxisTypeLogValue = 6 // inherits valueaxis (4 + 2) // TODO
+ };
+
+protected:
+ explicit Q3DAbstractAxis(Q3DAbstractAxisPrivate *d, QObject *parent = 0);
+
+public:
+ virtual ~Q3DAbstractAxis();
+
+ QString title() const;
+ QStringList labels() const;
+
+ AxisOrientation orientation() const;
+ AxisType type() const;
+
+public slots:
+ void setTitle(QString title);
+
+signals:
+ void titleChanged(QString newTitle);
+ void labelsChanged();
+
+protected:
+ QScopedPointer<Q3DAbstractAxisPrivate> d_ptr;
+
+private:
+ Q_DISABLE_COPY(Q3DAbstractAxis)
+
+ friend class Abstract3DController;
+ friend class Bars3DController;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QABSTRACTAXIS_H
diff --git a/src/datavisualization/axis/q3dabstractaxis_p.h b/src/datavisualization/axis/q3dabstractaxis_p.h
new file mode 100644
index 00000000..f961e82e
--- /dev/null
+++ b/src/datavisualization/axis/q3dabstractaxis_p.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include "datavisualizationglobal_p.h"
+#include "q3dabstractaxis.h"
+#include "abstract3dcontroller_p.h"
+
+#ifndef Q3DABSTRACTAXIS_P_H
+#define Q3DABSTRACTAXIS_P_H
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class Q3DAbstractAxisPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ Q3DAbstractAxisPrivate(Q3DAbstractAxis *q, Q3DAbstractAxis::AxisType type);
+ virtual ~Q3DAbstractAxisPrivate();
+
+ void setOrientation(Q3DAbstractAxis::AxisOrientation orientation);
+
+ inline bool isDefaultAxis() { return m_isDefaultAxis; }
+ inline void setDefaultAxis(bool isDefault) { m_isDefaultAxis = isDefault; }
+
+protected:
+ virtual void updateLabels();
+
+ Q3DAbstractAxis *q_ptr;
+
+ QString m_title;
+ QStringList m_labels;
+ Q3DAbstractAxis::AxisOrientation m_orientation;
+ Q3DAbstractAxis::AxisType m_type;
+ bool m_isDefaultAxis;
+
+ friend class Q3DAbstractAxis;
+ friend class Q3DValueAxis;
+ friend class Q3DCategoryAxis;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QABSTRACTAXIS_P_H
diff --git a/src/datavisualization/axis/q3dcategoryaxis.cpp b/src/datavisualization/axis/q3dcategoryaxis.cpp
new file mode 100644
index 00000000..55a27f52
--- /dev/null
+++ b/src/datavisualization/axis/q3dcategoryaxis.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "q3dcategoryaxis.h"
+#include "q3dcategoryaxis_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class Q3DCategoryAxis
+ * \inmodule QtDataVisualization
+ * \brief The Q3DCategoryAxis class is used for manipulating an axis of a graph.
+ * \since 1.0.0
+ *
+ * Q3DCategoryAxis provides an axis that can be given labels. The axis is divided into equal-sized
+ * categories based on \l {Q3DBars::setDataWindow()}{data window} size.
+ *
+ * Grid lines are drawn between categories, if visible. Labels are drawn to positions of categories
+ * if provided.
+ */
+
+/*!
+ * Constructs Q3DCategoryAxis with \a parent.
+ */
+Q3DCategoryAxis::Q3DCategoryAxis(QObject *parent) :
+ Q3DAbstractAxis(new Q3DCategoryAxisPrivate(this), parent)
+{
+}
+
+/*!
+ * Destroys Q3DCategoryAxis.
+ */
+Q3DCategoryAxis::~Q3DCategoryAxis()
+{
+}
+
+/*!
+ * \property Q3DCategoryAxis::categoryLabels
+ *
+ * Defines labels for axis applied to categories. If there are fewer labels than categories, the
+ * remaining ones do not have a label.
+ */
+QStringList Q3DCategoryAxis::categoryLabels() const
+{
+ return labels();
+}
+
+void Q3DCategoryAxis::setCategoryLabels(const QStringList &labels)
+{
+ if (d_ptr->m_labels != labels) {
+ d_ptr->m_labels = labels;
+ emit labelsChanged();
+ }
+}
+
+/*!
+ * \internal
+ */
+Q3DCategoryAxisPrivate *Q3DCategoryAxis::dptr()
+{
+ return static_cast<Q3DCategoryAxisPrivate *>(d_ptr.data());
+}
+
+Q3DCategoryAxisPrivate::Q3DCategoryAxisPrivate(Q3DCategoryAxis *q)
+ : Q3DAbstractAxisPrivate(q, Q3DAbstractAxis::AxisTypeCategory)
+{
+}
+
+Q3DCategoryAxisPrivate::~Q3DCategoryAxisPrivate()
+{
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/axis/q3dcategoryaxis.h b/src/datavisualization/axis/q3dcategoryaxis.h
new file mode 100644
index 00000000..8b7f966c
--- /dev/null
+++ b/src/datavisualization/axis/q3dcategoryaxis.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef Q3DCATEGORYAXIS_H
+#define Q3DCATEGORYAXIS_H
+
+#include <QtDataVisualization/q3dabstractaxis.h>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class Q3DCategoryAxisPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT Q3DCategoryAxis : public Q3DAbstractAxis
+{
+ Q_OBJECT
+ // Note: categoryLabels actually reads/writes the labels property in abstract axis,
+ // which is read only there. Since subclass cannot have property with same name,
+ // this partially duplicate property is necessary.
+ Q_PROPERTY(QStringList categoryLabels READ categoryLabels WRITE setCategoryLabels)
+
+public:
+ explicit Q3DCategoryAxis(QObject *parent = 0);
+ virtual ~Q3DCategoryAxis();
+
+ QStringList categoryLabels() const;
+
+public slots:
+ void setCategoryLabels(const QStringList &labels);
+
+protected:
+ Q3DCategoryAxisPrivate *dptr();
+
+private:
+ Q_DISABLE_COPY(Q3DCategoryAxis)
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QCATEGORYAXIS_H
diff --git a/src/datavisualization/axis/q3dcategoryaxis_p.h b/src/datavisualization/axis/q3dcategoryaxis_p.h
new file mode 100644
index 00000000..f7fa7b35
--- /dev/null
+++ b/src/datavisualization/axis/q3dcategoryaxis_p.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include "q3dcategoryaxis.h"
+#include "q3dabstractaxis_p.h"
+#include "qbardataitem.h"
+
+#ifndef QCATEGORYAXIS_P_H
+#define QCATEGORYAXIS_P_H
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class Q3DCategoryAxisPrivate : public Q3DAbstractAxisPrivate
+{
+ Q_OBJECT
+
+public:
+ Q3DCategoryAxisPrivate(Q3DCategoryAxis *q);
+ virtual ~Q3DCategoryAxisPrivate();
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QCATEGORYAXIS_P_H
diff --git a/src/datavisualization/axis/q3dvalueaxis.cpp b/src/datavisualization/axis/q3dvalueaxis.cpp
new file mode 100644
index 00000000..a17fef69
--- /dev/null
+++ b/src/datavisualization/axis/q3dvalueaxis.cpp
@@ -0,0 +1,332 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "q3dvalueaxis.h"
+#include "q3dvalueaxis_p.h"
+#include "utils_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class Q3DValueAxis
+ * \inmodule QtDataVisualization
+ * \brief The Q3DValueAxis class is used for manipulating an axis of a graph.
+ * \since 1.0.0
+ *
+ * Q3DValueAxis provides an axis that can be given a range of values and segment and subsegment
+ * counts to divide the range into.
+ *
+ * Labels are drawn between each segment. Grid lines are drawn between each segment and each
+ * subsegment. \note If visible, there will always be at least two grid lines and labels indicating
+ * the minimum and the maximum values of the range, as there is always at least one segment.
+ */
+
+/*!
+ * Constructs Q3DValueAxis with the given \a parent.
+ */
+Q3DValueAxis::Q3DValueAxis(QObject *parent) :
+ Q3DAbstractAxis(new Q3DValueAxisPrivate(this), parent)
+{
+}
+
+/*!
+ * Destroys Q3DValueAxis.
+ */
+Q3DValueAxis::~Q3DValueAxis()
+{
+}
+
+/*!
+ * Sets value range of the axis from \a min to \a max.
+ * When setting the range, the max is adjusted if necessary, to ensure that the range remains valid.
+ */
+void Q3DValueAxis::setRange(qreal min, qreal max)
+{
+ dptr()->setRange(min, max);
+ setAutoAdjustRange(false);
+}
+
+/*!
+ * \property Q3DValueAxis::min
+ *
+ * Defines the minimum value on the axis.
+ * When setting this property the max is adjusted if necessary, to ensure that the range remains
+ * valid.
+ */
+void Q3DValueAxis::setMin(qreal min)
+{
+ dptr()->setMin(min);
+ setAutoAdjustRange(false);
+}
+
+/*!
+ * \property Q3DValueAxis::max
+ *
+ * Defines the maximum value on the axis.
+ * When setting this property the min is adjusted if necessary, to ensure that the range remains
+ * valid.
+ */
+void Q3DValueAxis::setMax(qreal max)
+{
+ dptr()->setMax(max);
+ setAutoAdjustRange(false);
+}
+
+qreal Q3DValueAxis::min() const
+{
+ return dptrc()->m_min;
+}
+
+qreal Q3DValueAxis::max() const
+{
+ return dptrc()->m_max;
+}
+
+/*!
+ * \property Q3DValueAxis::segmentCount
+ *
+ * Defines the number of segments on the axis. This indicates how many labels are drawn. The number
+ * of grid lines to be drawn is calculated with formula: \c {segments * subsegments + 1}.
+ * The preset default is \c 5, and it can not be below \c 1.
+ *
+ * \sa setSubSegmentCount()
+ */
+void Q3DValueAxis::setSegmentCount(int count)
+{
+ if (count <= 0) {
+ qWarning() << "Warning: Illegal segment count automatically adjusted to a legal one:"
+ << count << "-> 1";
+ count = 1;
+ }
+ if (dptr()->m_segmentCount != count){
+ dptr()->m_segmentCount = count;
+ dptr()->emitLabelsChanged();
+ emit segmentCountChanged(count);
+ }
+}
+
+int Q3DValueAxis::segmentCount() const
+{
+ return dptrc()->m_segmentCount;
+}
+
+/*!
+ * \property Q3DValueAxis::subSegmentCount
+ *
+ * Defines the number of subsegments inside each segment on the axis. Grid lines are drawn between
+ * each subsegment, in addition to each segment.
+ * The preset default is \c 1, and it can not be below \c 1.
+ *
+ * \sa setSegmentCount()
+ **/
+void Q3DValueAxis::setSubSegmentCount(int count)
+{
+ if (count <= 0) {
+ qWarning() << "Warning: Illegal subsegment count automatically adjusted to a legal one:"
+ << count << "-> 1";
+ count = 1;
+ }
+ if (dptr()->m_subSegmentCount != count) {
+ dptr()->m_subSegmentCount = count;
+ emit subSegmentCountChanged(count);
+ }
+}
+
+int Q3DValueAxis::subSegmentCount() const
+{
+ return dptrc()->m_subSegmentCount;
+}
+
+/*!
+ * \property Q3DValueAxis::autoAdjustRange
+ *
+ * Tells the axis to automatically calculate the range instead of setting range or adjusting min or
+ * max property.
+ *
+ * \sa setRange(), setMin(), setMax()
+ */
+void Q3DValueAxis::setAutoAdjustRange(bool autoAdjust)
+{
+ if (dptr()->m_autoAdjust != autoAdjust) {
+ dptr()->m_autoAdjust = autoAdjust;
+ emit autoAdjustRangeChanged(autoAdjust);
+ }
+}
+
+bool Q3DValueAxis::isAutoAdjustRange() const
+{
+ return dptrc()->m_autoAdjust;
+}
+
+/*!
+ * \property Q3DValueAxis::labelFormat
+ *
+ * Defines the label format to be used for the labels on this axis. Supported specifiers are:
+ * \c {d, i, o, x, X, f, F, e, E, g, G, c}. See QString::sprintf() for additional details.
+ *
+ * Usage example:
+ *
+ * \c {axis->setLabelFormat("%.2f mm");}
+ */
+void Q3DValueAxis::setLabelFormat(const QString &format)
+{
+ if (dptr()->m_labelFormat != format) {
+ dptr()->m_labelFormat = format;
+ dptr()->emitLabelsChanged();
+ emit labelFormatChanged(format);
+ }
+}
+
+QString Q3DValueAxis::labelFormat() const
+{
+ return dptrc()->m_labelFormat;
+}
+
+/*!
+ * \internal
+ */
+Q3DValueAxisPrivate *Q3DValueAxis::dptr()
+{
+ return static_cast<Q3DValueAxisPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \internal
+ */
+const Q3DValueAxisPrivate *Q3DValueAxis::dptrc() const
+{
+ return static_cast<const Q3DValueAxisPrivate *>(d_ptr.data());
+}
+
+Q3DValueAxisPrivate::Q3DValueAxisPrivate(Q3DValueAxis *q)
+ : Q3DAbstractAxisPrivate(q, Q3DAbstractAxis::AxisTypeValue),
+ m_min(0.0),
+ m_max(10.0),
+ m_segmentCount(5),
+ m_subSegmentCount(1),
+ m_autoAdjust(true),
+ m_labelFormat(Utils::defaultLabelFormat()),
+ m_labelsDirty(true)
+{
+}
+
+Q3DValueAxisPrivate::~Q3DValueAxisPrivate()
+{
+}
+
+void Q3DValueAxisPrivate::setRange(qreal min, qreal max)
+{
+ // If min >= max, we adjust ranges so that
+ // m_max becomes (min + 1.0)
+ // as axes need some kind of valid range.
+ // TODO: Make "reverse" axes work (i.e. min > max)
+ bool dirty = false;
+ if (m_min != min) {
+ m_min = min;
+ dirty = true;
+ }
+ if (m_max != max) {
+ if (min >= max) {
+ m_max = min + 1.0;
+ qWarning() << "Warning: Tried to set invalid range for value axis."
+ " Range automatically adjusted to a valid one:"
+ << min << "-" << max << "-->" << m_min << "-" << m_max;
+ } else {
+ m_max = max;
+ }
+ dirty = true;
+ }
+ if (dirty) {
+ emitLabelsChanged();
+ emit qptr()->rangeChanged(min, max);
+ }
+}
+
+void Q3DValueAxisPrivate::setMin(qreal min)
+{
+ if (m_min != min) {
+ if (min >= m_max) {
+ qreal oldMax = m_max;
+ m_max = min + 1.0;
+ qWarning() << "Warning: Tried to set minimum to equal or larger than maximum for"
+ " value axis. Maximum automatically adjusted to a valid one:"
+ << oldMax << "-->" << m_max;
+ }
+ m_min = min;
+ emitLabelsChanged();
+ emit qptr()->rangeChanged(m_min, m_max);
+ }
+}
+
+void Q3DValueAxisPrivate::setMax(qreal max)
+{
+ if (m_max != max) {
+ if (max <= m_min) {
+ qreal oldMin = m_min;
+ m_min = max - 1.0;
+ qWarning() << "Warning: Tried to set maximum to equal or smaller than minimum for"
+ " value axis. Minimum automatically adjusted to a valid one:"
+ << oldMin << "-->" << m_min;
+ }
+ m_max = max;
+ emitLabelsChanged();
+ emit qptr()->rangeChanged(m_min, m_max);
+ }
+}
+
+void Q3DValueAxisPrivate::emitLabelsChanged()
+{
+ m_labelsDirty = true;
+ emit q_ptr->labelsChanged();
+}
+
+void Q3DValueAxisPrivate::updateLabels()
+{
+ if (!m_labelsDirty)
+ return;
+
+ m_labelsDirty = false;
+
+ QStringList newLabels;
+ newLabels.reserve(m_segmentCount + 1);
+
+ // First label is at axis min, which is an extra segment
+ qreal segmentStep = (m_max - m_min) / m_segmentCount;
+
+ QString formatString(m_labelFormat);
+ Utils::ParamType paramType = Utils::findFormatParamType(formatString);
+ QByteArray formatArray = formatString.toUtf8();
+
+ for (int i = 0; i < m_segmentCount; i++) {
+ qreal value = m_min + (segmentStep * i);
+ newLabels.append(Utils::formatLabel(formatArray, paramType, value));
+ }
+
+ // Ensure max label doesn't suffer from any rounding errors
+ newLabels.append(Utils::formatLabel(formatArray, paramType, m_max));
+
+ if (m_labels != newLabels)
+ m_labels = newLabels;
+}
+
+Q3DValueAxis *Q3DValueAxisPrivate::qptr()
+{
+ return static_cast<Q3DValueAxis *>(q_ptr);
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/axis/q3dvalueaxis.h b/src/datavisualization/axis/q3dvalueaxis.h
new file mode 100644
index 00000000..eb00f27f
--- /dev/null
+++ b/src/datavisualization/axis/q3dvalueaxis.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QVALUEAXIS_H
+#define QVALUEAXIS_H
+
+#include <QtDataVisualization/q3dabstractaxis.h>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class Q3DValueAxisPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT Q3DValueAxis : public Q3DAbstractAxis
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY rangeChanged)
+ Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY rangeChanged)
+ Q_PROPERTY(int segmentCount READ segmentCount WRITE setSegmentCount NOTIFY segmentCountChanged)
+ Q_PROPERTY(int subSegmentCount READ subSegmentCount WRITE setSubSegmentCount NOTIFY subSegmentCountChanged)
+ Q_PROPERTY(bool autoAdjustRange READ isAutoAdjustRange WRITE setAutoAdjustRange NOTIFY autoAdjustRangeChanged)
+ Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
+
+public:
+ explicit Q3DValueAxis(QObject *parent = 0);
+ virtual ~Q3DValueAxis();
+
+ qreal min() const;
+ qreal max() const;
+ int segmentCount() const;
+ int subSegmentCount() const;
+ bool isAutoAdjustRange() const;
+ QString labelFormat() const;
+
+public slots:
+ void setRange(qreal min, qreal max);
+ void setMin(qreal min);
+ void setMax(qreal max);
+ void setSegmentCount(int count);
+ void setSubSegmentCount(int count);
+ void setAutoAdjustRange(bool autoAdjust);
+ void setLabelFormat(const QString &format);
+
+signals:
+ void rangeChanged(qreal min, qreal max);
+ void segmentCountChanged(int count);
+ void subSegmentCountChanged(int count);
+ void autoAdjustRangeChanged(bool autoAdjust);
+ void labelFormatChanged(QString format);
+
+protected:
+ Q3DValueAxisPrivate *dptr();
+ const Q3DValueAxisPrivate *dptrc() const;
+
+private:
+ Q_DISABLE_COPY(Q3DValueAxis)
+ friend class Bars3DController;
+ friend class Scatter3DController;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QVALUEAXIS_H
diff --git a/src/datavisualization/axis/q3dvalueaxis_p.h b/src/datavisualization/axis/q3dvalueaxis_p.h
new file mode 100644
index 00000000..8fcf50da
--- /dev/null
+++ b/src/datavisualization/axis/q3dvalueaxis_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include "q3dvalueaxis.h"
+#include "q3dabstractaxis_p.h"
+
+#ifndef QVALUEAXIS_P_H
+#define QVALUEAXIS_P_H
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class Q3DValueAxisPrivate : public Q3DAbstractAxisPrivate
+{
+ Q_OBJECT
+
+public:
+ Q3DValueAxisPrivate(Q3DValueAxis *q);
+ virtual ~Q3DValueAxisPrivate();
+
+ void setRange(qreal min, qreal max);
+ void setMin(qreal min);
+ void setMax (qreal max);
+
+protected:
+ void emitLabelsChanged();
+ virtual void updateLabels();
+
+ qreal m_min;
+ qreal m_max;
+ int m_segmentCount;
+ int m_subSegmentCount;
+ bool m_autoAdjust;
+ QString m_labelFormat;
+ bool m_labelsDirty;
+
+private:
+ Q3DValueAxis *qptr();
+
+ friend class Q3DValueAxis;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QVALUEAXIS_P_H
diff --git a/src/datavisualization/common.pri b/src/datavisualization/common.pri
new file mode 100644
index 00000000..57948697
--- /dev/null
+++ b/src/datavisualization/common.pri
@@ -0,0 +1,8 @@
+# This qmake file is included by all Patternist projects and contains common Qt defines,
+# compiler warnings, and include paths.
+
+INCLUDEPATH += $$PWD/engine \
+ $$PWD/global \
+ $$PWD/utils \
+ $$PWD/axis \
+ $$PWD/data
diff --git a/src/datavisualization/data/abstractitemmodelhandler.cpp b/src/datavisualization/data/abstractitemmodelhandler.cpp
new file mode 100644
index 00000000..0ad0ac0b
--- /dev/null
+++ b/src/datavisualization/data/abstractitemmodelhandler.cpp
@@ -0,0 +1,250 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "abstractitemmodelhandler_p.h"
+#include "qabstractdatamapping.h"
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+AbstractItemModelHandler::AbstractItemModelHandler(QObject *parent)
+ : QObject(parent),
+ m_activeMapping(0),
+ resolvePending(0)
+{
+ m_resolveTimer.setSingleShot(true);
+ QObject::connect(&m_resolveTimer, &QTimer::timeout,
+ this, &AbstractItemModelHandler::handlePendingResolve);
+}
+
+AbstractItemModelHandler::~AbstractItemModelHandler()
+{
+}
+
+void AbstractItemModelHandler::setItemModel(const QAbstractItemModel *itemModel)
+{
+ if (!m_itemModel.isNull())
+ QObject::disconnect(m_itemModel, 0, this, 0);
+
+ m_itemModel = itemModel;
+
+ if (!m_itemModel.isNull()) {
+ QObject::connect(m_itemModel.data(), &QAbstractItemModel::columnsInserted,
+ this, &AbstractItemModelHandler::handleColumnsInserted);
+ QObject::connect(m_itemModel.data(), &QAbstractItemModel::columnsMoved,
+ this, &AbstractItemModelHandler::handleColumnsMoved);
+ QObject::connect(m_itemModel.data(), &QAbstractItemModel::columnsRemoved,
+ this, &AbstractItemModelHandler::handleColumnsRemoved);
+ QObject::connect(m_itemModel.data(), &QAbstractItemModel::dataChanged,
+ this, &AbstractItemModelHandler::handleDataChanged);
+ QObject::connect(m_itemModel.data(), &QAbstractItemModel::layoutChanged,
+ this, &AbstractItemModelHandler::handleLayoutChanged);
+ QObject::connect(m_itemModel.data(), &QAbstractItemModel::modelReset,
+ this, &AbstractItemModelHandler::handleModelReset);
+ QObject::connect(m_itemModel.data(), &QAbstractItemModel::rowsInserted,
+ this, &AbstractItemModelHandler::handleRowsInserted);
+ QObject::connect(m_itemModel.data(), &QAbstractItemModel::rowsMoved,
+ this, &AbstractItemModelHandler::handleRowsMoved);
+ QObject::connect(m_itemModel.data(), &QAbstractItemModel::rowsRemoved,
+ this, &AbstractItemModelHandler::handleRowsRemoved);
+ }
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0);
+}
+
+const QAbstractItemModel *AbstractItemModelHandler::itemModel() const
+{
+ return m_itemModel.data();
+}
+
+void AbstractItemModelHandler::setActiveMapping(QAbstractDataMapping *mapping)
+{
+ if (m_activeMapping)
+ QObject::disconnect(m_activeMapping, 0, this, 0);
+
+ if (mapping)
+ addMapping(mapping);
+
+ m_activeMapping = mapping;
+
+ if (m_activeMapping) {
+ QObject::connect(m_activeMapping, &QAbstractDataMapping::mappingChanged,
+ this, &AbstractItemModelHandler::handleMappingChanged);
+ }
+
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0);
+}
+
+QAbstractDataMapping *AbstractItemModelHandler::activeMapping() const
+{
+ return m_activeMapping;
+}
+
+void AbstractItemModelHandler::addMapping(QAbstractDataMapping *mapping)
+{
+ Q_ASSERT(mapping);
+ AbstractItemModelHandler *owner = qobject_cast<AbstractItemModelHandler *>(mapping->parent());
+ if (owner != this) {
+ Q_ASSERT_X(!owner, "addMapping", "Mapping already attached to a proxy.");
+ mapping->setParent(this);
+ }
+ if (!m_mappings.contains(mapping))
+ m_mappings.append(mapping);
+}
+
+void AbstractItemModelHandler::releaseMapping(QAbstractDataMapping *mapping)
+{
+ if (mapping && m_mappings.contains(mapping)) {
+ // If the mapping is in use, clear the existing mapping
+ if (m_activeMapping == mapping)
+ setActiveMapping(0);
+
+ m_mappings.removeAll(mapping);
+ mapping->setParent(0);
+ }
+}
+
+QList<QAbstractDataMapping *> AbstractItemModelHandler::mappings() const
+{
+ return m_mappings;
+}
+
+void AbstractItemModelHandler::handleColumnsInserted(const QModelIndex &parent,
+ int start, int end)
+{
+ Q_UNUSED(parent)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+
+ // Resolve new items
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+}
+
+void AbstractItemModelHandler::handleColumnsMoved(const QModelIndex &sourceParent,
+ int sourceStart,
+ int sourceEnd,
+ const QModelIndex &destinationParent,
+ int destinationColumn)
+{
+ Q_UNUSED(sourceParent)
+ Q_UNUSED(sourceStart)
+ Q_UNUSED(sourceEnd)
+ Q_UNUSED(destinationParent)
+ Q_UNUSED(destinationColumn)
+
+ // Resolve moved items
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+}
+
+void AbstractItemModelHandler::handleColumnsRemoved(const QModelIndex &parent,
+ int start, int end)
+{
+ Q_UNUSED(parent)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+
+ // Remove old items
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+}
+
+void AbstractItemModelHandler::handleDataChanged(const QModelIndex &topLeft,
+ const QModelIndex &bottomRight,
+ const QVector<int> &roles)
+{
+ Q_UNUSED(topLeft)
+ Q_UNUSED(bottomRight)
+ Q_UNUSED(roles)
+
+ // Resolve changed items
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+}
+
+void AbstractItemModelHandler::handleLayoutChanged(const QList<QPersistentModelIndex> &parents,
+ QAbstractItemModel::LayoutChangeHint hint)
+{
+ Q_UNUSED(parents)
+ Q_UNUSED(hint)
+
+ // Resolve moved items
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+}
+
+void AbstractItemModelHandler::handleModelReset()
+{
+ // Data cleared, reset array
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+}
+
+void AbstractItemModelHandler::handleRowsInserted(const QModelIndex &parent, int start, int end)
+{
+ Q_UNUSED(parent)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+
+ // Resolve new items
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+}
+
+void AbstractItemModelHandler::handleRowsMoved(const QModelIndex &sourceParent,
+ int sourceStart,
+ int sourceEnd,
+ const QModelIndex &destinationParent,
+ int destinationRow)
+{
+ Q_UNUSED(sourceParent)
+ Q_UNUSED(sourceStart)
+ Q_UNUSED(sourceEnd)
+ Q_UNUSED(destinationParent)
+ Q_UNUSED(destinationRow)
+
+ // Resolve moved items
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+}
+
+void AbstractItemModelHandler::handleRowsRemoved(const QModelIndex &parent, int start, int end)
+{
+ Q_UNUSED(parent)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+
+ // Resolve removed items
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0); // TODO Resolving entire model is inefficient
+}
+
+void AbstractItemModelHandler::handleMappingChanged()
+{
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0);
+}
+
+void AbstractItemModelHandler::handlePendingResolve()
+{
+ resolveModel();
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/abstractitemmodelhandler_p.h b/src/datavisualization/data/abstractitemmodelhandler_p.h
new file mode 100644
index 00000000..fbaaa1f9
--- /dev/null
+++ b/src/datavisualization/data/abstractitemmodelhandler_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef ABSTRACTITEMMODELHANDLER_P_H
+#define ABSTRACTITEMMODELHANDLER_P_H
+
+#include "datavisualizationglobal_p.h"
+#include <QAbstractItemModel>
+#include <QPointer>
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QAbstractDataMapping;
+
+class AbstractItemModelHandler : public QObject
+{
+ Q_OBJECT
+public:
+ AbstractItemModelHandler(QObject *parent = 0);
+ virtual ~AbstractItemModelHandler();
+
+ virtual void setItemModel(const QAbstractItemModel *itemModel);
+ virtual const QAbstractItemModel *itemModel() const;
+ virtual void setActiveMapping(QAbstractDataMapping *mapping);
+ virtual QAbstractDataMapping *activeMapping() const;
+ virtual void addMapping(QAbstractDataMapping *mapping);
+ virtual void releaseMapping(QAbstractDataMapping *mapping);
+ virtual QList<QAbstractDataMapping *> mappings() const;
+
+public slots:
+ virtual void handleColumnsInserted(const QModelIndex &parent, int start, int end);
+ virtual void handleColumnsMoved(const QModelIndex &sourceParent, int sourceStart,
+ int sourceEnd, const QModelIndex &destinationParent,
+ int destinationColumn);
+ virtual void handleColumnsRemoved(const QModelIndex &parent, int start, int end);
+ virtual void handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
+ const QVector<int> &roles = QVector<int> ());
+ virtual void handleLayoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(),
+ QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
+ virtual void handleModelReset();
+ virtual void handleRowsInserted(const QModelIndex &parent, int start, int end);
+ virtual void handleRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd,
+ const QModelIndex &destinationParent, int destinationRow);
+ virtual void handleRowsRemoved(const QModelIndex &parent, int start, int end);
+
+ virtual void handleMappingChanged();
+ virtual void handlePendingResolve();
+
+protected:
+ virtual void resolveModel() = 0;
+
+ QPointer<const QAbstractItemModel> m_itemModel; // Not owned
+ QAbstractDataMapping *m_activeMapping;
+ bool resolvePending;
+ QTimer m_resolveTimer;
+ QList<QAbstractDataMapping *> m_mappings;
+
+private:
+ Q_DISABLE_COPY(AbstractItemModelHandler)
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/abstractrenderitem.cpp b/src/datavisualization/data/abstractrenderitem.cpp
new file mode 100644
index 00000000..22a1c6de
--- /dev/null
+++ b/src/datavisualization/data/abstractrenderitem.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "abstractrenderitem_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+AbstractRenderItem::AbstractRenderItem()
+ : m_selectionLabelItem(0)
+{
+}
+
+AbstractRenderItem::AbstractRenderItem(const AbstractRenderItem &other)
+{
+ m_selectionLabel = other.m_selectionLabel;
+ m_translation = other.m_translation;
+ m_selectionLabelItem = 0;
+}
+
+AbstractRenderItem::~AbstractRenderItem()
+{
+ delete m_selectionLabelItem;
+}
+
+LabelItem &AbstractRenderItem::selectionLabelItem()
+{
+ if (!m_selectionLabelItem)
+ m_selectionLabelItem = new LabelItem;
+ return *m_selectionLabelItem;
+}
+
+void AbstractRenderItem::setSelectionLabel(const QString &label)
+{
+ if (m_selectionLabelItem)
+ m_selectionLabelItem->clear();
+ m_selectionLabel = label;
+}
+
+QString &AbstractRenderItem::selectionLabel()
+{
+ return m_selectionLabel;
+}
+
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/abstractrenderitem_p.h b/src/datavisualization/data/abstractrenderitem_p.h
new file mode 100644
index 00000000..5f623c41
--- /dev/null
+++ b/src/datavisualization/data/abstractrenderitem_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef ABSTRACTRENDERITEM_P_H
+#define ABSTRACTRENDERITEM_P_H
+
+#include "datavisualizationglobal_p.h"
+#include "labelitem_p.h"
+
+#include <QOpenGLFunctions>
+#include <QString>
+#include <QVector3D>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class AbstractRenderItem
+{
+public:
+ AbstractRenderItem();
+ AbstractRenderItem(const AbstractRenderItem &other);
+ virtual ~AbstractRenderItem();
+
+ // Position in 3D scene
+ inline void setTranslation(const QVector3D &translation) { m_translation = translation; }
+ inline const QVector3D &translation() const {return m_translation; }
+
+ // Selection label item (containing special selection texture, if mode is activated)
+ LabelItem &selectionLabelItem();
+
+ // Formatted selection label for item.
+ void setSelectionLabel(const QString &label);
+ QString &selectionLabel(); // Formats selection label if not previously formatted
+
+protected:
+ QString m_selectionLabel;
+ QVector3D m_translation;
+ LabelItem *m_selectionLabelItem;
+
+ friend class QAbstractDataItem;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/baritemmodelhandler.cpp b/src/datavisualization/data/baritemmodelhandler.cpp
new file mode 100644
index 00000000..ec922f2b
--- /dev/null
+++ b/src/datavisualization/data/baritemmodelhandler.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "baritemmodelhandler_p.h"
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+BarItemModelHandler::BarItemModelHandler(QItemModelBarDataProxy *proxy, QObject *parent)
+ : AbstractItemModelHandler(parent),
+ m_proxy(proxy)
+{
+}
+
+BarItemModelHandler::~BarItemModelHandler()
+{
+}
+
+// Resolve entire item model into QBarDataArray.
+void BarItemModelHandler::resolveModel()
+{
+ QItemModelBarDataMapping *mapping = static_cast<QItemModelBarDataMapping *>(m_activeMapping);
+ if (m_itemModel.isNull() || !mapping) {
+ m_proxy->resetArray(0);
+ return;
+ }
+
+ bool useModelRows(false);
+ if (!mapping->rowCategories().size() || !mapping->columnCategories().size()) {
+ useModelRows = true;
+ } else if (mapping->rowRole().isEmpty() || mapping->columnRole().isEmpty()) {
+ m_proxy->resetArray(0);
+ return;
+ }
+
+ QBarDataArray *newProxyArray = new QBarDataArray;
+ QHash<int, QByteArray> roleHash = m_itemModel->roleNames();
+ // Default to display role if no mapping
+ int valueRole = roleHash.key(mapping->valueRole().toLatin1(), Qt::DisplayRole);
+ int rowCount = m_itemModel->rowCount();
+ int columnCount = m_itemModel->columnCount();
+
+ if (useModelRows) {
+ for (int i = 0; i < rowCount; i++) {
+ QBarDataRow *newProxyRow = new QBarDataRow(columnCount);
+ for (int j = 0; j < columnCount; j++)
+ (*newProxyRow)[j].setValue(m_itemModel->index(i, j).data(valueRole).toReal());
+ newProxyArray->append(newProxyRow);
+ }
+ } else {
+ int rowRole = roleHash.key(mapping->rowRole().toLatin1());
+ int columnRole = roleHash.key(mapping->columnRole().toLatin1());
+ const QStringList &rowList = mapping->rowCategories();
+ const QStringList &columnList = mapping->columnCategories();
+
+ // Sort values into rows and columns
+ typedef QHash<QString, qreal> ColumnValueMap;
+ QHash <QString, ColumnValueMap> itemValueMap;
+ for (int i = 0; i < rowCount; i++) {
+ for (int j = 0; j < columnCount; j++) {
+ QModelIndex index = m_itemModel->index(i, j);
+ itemValueMap[index.data(rowRole).toString()][index.data(columnRole).toString()]
+ = index.data(valueRole).toReal();
+ }
+ }
+
+ // Create new data array from itemValueMap
+ foreach (QString rowKey, rowList) {
+ QBarDataRow *newProxyRow = new QBarDataRow(columnList.size());
+ for (int i = 0; i < columnList.size(); i++)
+ (*newProxyRow)[i].setValue(itemValueMap[rowKey][columnList.at(i)]);
+ newProxyArray->append(newProxyRow);
+ }
+ }
+
+ m_proxy->resetArray(newProxyArray);
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/baritemmodelhandler_p.h b/src/datavisualization/data/baritemmodelhandler_p.h
new file mode 100644
index 00000000..94e83b9d
--- /dev/null
+++ b/src/datavisualization/data/baritemmodelhandler_p.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef BARITEMMODELHANDLER_P_H
+#define BARITEMMODELHANDLER_P_H
+
+#include "abstractitemmodelhandler_p.h"
+#include "qitemmodelbardataproxy.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class BarItemModelHandler : public AbstractItemModelHandler
+{
+ Q_OBJECT
+public:
+ BarItemModelHandler(QItemModelBarDataProxy *proxy, QObject *parent = 0);
+ virtual ~BarItemModelHandler();
+
+protected:
+ void virtual resolveModel();
+
+ QItemModelBarDataProxy *m_proxy; // Not owned
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/barrenderitem.cpp b/src/datavisualization/data/barrenderitem.cpp
new file mode 100644
index 00000000..558e2f96
--- /dev/null
+++ b/src/datavisualization/data/barrenderitem.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "barrenderitem_p.h"
+#include "bars3drenderer_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+BarRenderItem::BarRenderItem()
+ : AbstractRenderItem(),
+ m_value(0),
+ m_height(0.0f),
+ m_sliceLabelItem(0)
+{
+}
+
+BarRenderItem::BarRenderItem(const BarRenderItem &other)
+ : AbstractRenderItem(other)
+{
+ m_value = other.m_value;
+ m_position = other.m_position;
+ m_height = other.m_height;
+ m_sliceLabel = other.m_sliceLabel;
+ m_sliceLabelItem = 0;
+}
+
+BarRenderItem::~BarRenderItem()
+{
+ delete m_sliceLabelItem;
+}
+
+LabelItem &BarRenderItem::sliceLabelItem()
+{
+ if (!m_sliceLabelItem)
+ m_sliceLabelItem = new LabelItem;
+ return *m_sliceLabelItem;
+}
+
+void BarRenderItem::setSliceLabel(const QString &label)
+{
+ if (m_sliceLabelItem)
+ m_sliceLabelItem->clear();
+ m_sliceLabel = label;
+}
+
+QString &BarRenderItem::sliceLabel()
+{
+ return m_sliceLabel;
+}
+
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/barrenderitem_p.h b/src/datavisualization/data/barrenderitem_p.h
new file mode 100644
index 00000000..6cd2b0fa
--- /dev/null
+++ b/src/datavisualization/data/barrenderitem_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef BARRENDERITEM_P_H
+#define BARRENDERITEM_P_H
+
+#include "abstractrenderitem_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class Bars3DRenderer;
+
+class BarRenderItem : public AbstractRenderItem
+{
+public:
+ BarRenderItem();
+ BarRenderItem(const BarRenderItem &other);
+ virtual ~BarRenderItem();
+
+ // Position relative to data window (for bar label generation)
+ inline void setPosition(const QPoint &pos) { m_position = pos; }
+ inline const QPoint &position() const { return m_position; }
+
+ // Actual cached data value of the bar (needed to trigger label reformats)
+ inline void setValue(qreal value);
+ inline qreal value() const { return m_value; }
+
+ // Normalized bar height
+ inline void setHeight(GLfloat height) { m_height = height; }
+ inline GLfloat height() const { return m_height; }
+
+ // Label item for formatted label
+ LabelItem &sliceLabelItem();
+
+ // Formatted label for item.
+ void setSliceLabel(const QString &label);
+ QString &sliceLabel(); // Formats label if not previously formatted
+
+protected:
+ qreal m_value;
+ QPoint m_position; // x = row, y = column
+ GLfloat m_height;
+ QString m_sliceLabel;
+ LabelItem *m_sliceLabelItem;
+
+ friend class QBarDataItem;
+};
+
+void BarRenderItem::setValue(qreal value)
+{
+ m_value = value;
+ // Force reformatting on next access by setting label string to null string
+ if (!m_sliceLabel.isNull())
+ setSliceLabel(QString());
+ if (!m_selectionLabel.isNull())
+ setSelectionLabel(QString());
+}
+
+typedef QVector<BarRenderItem> BarRenderItemRow;
+typedef QVector<BarRenderItemRow> BarRenderItemArray;
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/data.pri b/src/datavisualization/data/data.pri
new file mode 100644
index 00000000..6571aacc
--- /dev/null
+++ b/src/datavisualization/data/data.pri
@@ -0,0 +1,58 @@
+HEADERS += \
+ $$PWD/labelitem_p.h \
+ $$PWD/qabstractdataproxy.h \
+ $$PWD/qabstractdataproxy_p.h \
+ $$PWD/qbardataproxy.h \
+ $$PWD/qbardataproxy_p.h \
+ $$PWD/abstractrenderitem_p.h \
+ $$PWD/barrenderitem_p.h \
+ $$PWD/qbardataitem.h \
+ $$PWD/qbardataitem_p.h \
+ $$PWD/qitemmodelbardatamapping.h \
+ $$PWD/qitemmodelbardatamapping_p.h \
+ $$PWD/qitemmodelbardataproxy_p.h \
+ $$PWD/qitemmodelbardataproxy.h \
+ $$PWD/scatterrenderitem_p.h \
+ $$PWD/qscatterdataitem.h \
+ $$PWD/qscatterdataitem_p.h \
+ $$PWD/qscatterdataproxy.h \
+ $$PWD/qscatterdataproxy_p.h \
+ $$PWD/qitemmodelscatterdatamapping.h \
+ $$PWD/qitemmodelscatterdatamapping_p.h \
+ $$PWD/qitemmodelscatterdataproxy.h \
+ $$PWD/qitemmodelscatterdataproxy_p.h \
+ $$PWD/abstractitemmodelhandler_p.h \
+ $$PWD/baritemmodelhandler_p.h \
+ $$PWD/qabstractdatamapping.h \
+ $$PWD/qabstractdatamapping_p.h \
+ $$PWD/scatteritemmodelhandler_p.h \
+ $$PWD/qsurfacedataproxy.h \
+ $$PWD/qsurfacedataproxy_p.h \
+ $$PWD/qitemmodelsurfacedatamapping.h \
+ $$PWD/qitemmodelsurfacedatamapping_p.h \
+ $$PWD/qitemmodelsurfacedataproxy.h \
+ $$PWD/qitemmodelsurfacedataproxy_p.h \
+ $$PWD/surfaceitemmodelhandler_p.h
+
+SOURCES += \
+ $$PWD/labelitem.cpp \
+ $$PWD/qabstractdataproxy.cpp \
+ $$PWD/qbardataproxy.cpp \
+ $$PWD/abstractrenderitem.cpp \
+ $$PWD/barrenderitem.cpp \
+ $$PWD/qbardataitem.cpp \
+ $$PWD/qitemmodelbardatamapping.cpp \
+ $$PWD/qitemmodelbardataproxy.cpp \
+ $$PWD/scatterrenderitem.cpp \
+ $$PWD/qscatterdataitem.cpp \
+ $$PWD/qscatterdataproxy.cpp \
+ $$PWD/qitemmodelscatterdatamapping.cpp \
+ $$PWD/qitemmodelscatterdataproxy.cpp \
+ $$PWD/abstractitemmodelhandler.cpp \
+ $$PWD/baritemmodelhandler.cpp \
+ $$PWD/qabstractdatamapping.cpp \
+ $$PWD/scatteritemmodelhandler.cpp \
+ $$PWD/qsurfacedataproxy.cpp \
+ $$PWD/qitemmodelsurfacedatamapping.cpp \
+ $$PWD/qitemmodelsurfacedataproxy.cpp \
+ $$PWD/surfaceitemmodelhandler.cpp
diff --git a/src/datavisualization/data/labelitem.cpp b/src/datavisualization/data/labelitem.cpp
new file mode 100644
index 00000000..5e27a50e
--- /dev/null
+++ b/src/datavisualization/data/labelitem.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "labelitem_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+LabelItem::LabelItem()
+ : m_size(QSize(0, 0)),
+ m_textureId(0)
+{
+}
+
+LabelItem::~LabelItem()
+{
+ glDeleteTextures(1, &m_textureId);
+}
+
+void LabelItem::setSize(const QSize &size)
+{
+ m_size = size;
+}
+
+QSize LabelItem::size() const
+{
+ return m_size;
+}
+
+void LabelItem::setTextureId(GLuint textureId)
+{
+ glDeleteTextures(1, &m_textureId);
+ m_textureId = textureId;
+}
+
+GLuint LabelItem::textureId() const
+{
+ return m_textureId;
+}
+
+void LabelItem::clear()
+{
+ if (m_textureId) {
+ glDeleteTextures(1, &m_textureId);
+ m_textureId = 0;
+ }
+ m_size = QSize(0, 0);
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/labelitem_p.h b/src/datavisualization/data/labelitem_p.h
new file mode 100644
index 00000000..c10c1f12
--- /dev/null
+++ b/src/datavisualization/data/labelitem_p.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef LABELITEM_P_H
+#define LABELITEM_P_H
+
+#include "datavisualizationglobal_p.h"
+#include <QOpenGLFunctions>
+#include <QSize>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class LabelItem
+{
+public:
+ explicit LabelItem();
+ ~LabelItem();
+
+ void setSize(const QSize &size);
+ QSize size() const;
+ void setTextureId(GLuint textureId);
+ GLuint textureId() const;
+ void clear();
+
+private:
+ Q_DISABLE_COPY(LabelItem);
+
+ QSize m_size;
+ GLuint m_textureId;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qabstractdatamapping.cpp b/src/datavisualization/data/qabstractdatamapping.cpp
new file mode 100644
index 00000000..892d2f94
--- /dev/null
+++ b/src/datavisualization/data/qabstractdatamapping.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qabstractdatamapping_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QAbstractDataMapping
+ * \inmodule QtDataVisualization
+ * \brief Abstract base class for QtDataVisualization data mapping classes.
+ * \since 1.0.0
+ *
+ * Data mapping classes provide a way to map data from an external data source to one of
+ * QtDataVisualization data proxies.
+ * \sa QItemModelBarDataMapping, QItemModelScatterDataMapping
+ */
+
+/*!
+ * \internal
+ */
+QAbstractDataMapping::QAbstractDataMapping(QAbstractDataMappingPrivate *d, QObject *parent)
+ : QObject(parent),
+ d_ptr(d)
+{
+}
+
+/*!
+ * Destroys QAbstractDataMapping.
+ */
+QAbstractDataMapping::~QAbstractDataMapping()
+{
+}
+
+/*!
+ * \fn void QAbstractDataMapping::mappingChanged()
+ *
+ * Emitted when any mapping has changed.
+ */
+
+// QItemModelBarDataMappingPrivate
+
+QAbstractDataMappingPrivate::QAbstractDataMappingPrivate(QAbstractDataMapping *q,
+ QAbstractDataProxy::DataType type)
+ : QObject(0),
+ q_ptr(q),
+ m_type(type)
+{
+}
+
+QAbstractDataMappingPrivate::~QAbstractDataMappingPrivate()
+{
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
diff --git a/src/datavisualization/data/qabstractdatamapping.h b/src/datavisualization/data/qabstractdatamapping.h
new file mode 100644
index 00000000..eb892cb7
--- /dev/null
+++ b/src/datavisualization/data/qabstractdatamapping.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QABSTRACTDATAMAPPING_H
+#define QABSTRACTDATAMAPPING_H
+
+#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QtDataVisualization/qabstractdataproxy.h>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QAbstractDataMappingPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QAbstractDataMapping : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit QAbstractDataMapping(QAbstractDataMappingPrivate *d, QObject *parent = 0);
+ virtual ~QAbstractDataMapping();
+
+signals:
+ void mappingChanged();
+
+private:
+ QScopedPointer<QAbstractDataMappingPrivate> d_ptr;
+
+ Q_DISABLE_COPY(QAbstractDataMapping)
+
+ friend class QItemModelBarDataMapping;
+ friend class QItemModelScatterDataMapping;
+ friend class QItemModelSurfaceDataMapping;
+};
+
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qabstractdatamapping_p.h b/src/datavisualization/data/qabstractdatamapping_p.h
new file mode 100644
index 00000000..39012237
--- /dev/null
+++ b/src/datavisualization/data/qabstractdatamapping_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include "qabstractdatamapping.h"
+
+#ifndef QABSTRACTDATAMAPPING_P_H
+#define QABSTRACTDATAMAPPING_P_H
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QAbstractDataMappingPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QAbstractDataMappingPrivate(QAbstractDataMapping *q, QAbstractDataProxy::DataType type);
+ virtual ~QAbstractDataMappingPrivate();
+
+private:
+ QAbstractDataMapping *q_ptr;
+ QAbstractDataProxy::DataType m_type;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qabstractdataproxy.cpp b/src/datavisualization/data/qabstractdataproxy.cpp
new file mode 100644
index 00000000..2ef4b614
--- /dev/null
+++ b/src/datavisualization/data/qabstractdataproxy.cpp
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qabstractdataproxy.h"
+#include "qabstractdataproxy_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QAbstractDataProxy
+ * \inmodule QtDataVisualization
+ * \brief Base class for all QtDataVisualization data proxies.
+ * \since 1.0.0
+ *
+ * You use the visualization type specific inherited classes instead of the base class.
+ * \sa QBarDataProxy, QScatterDataProxy, QSurfaceDataProxy
+ */
+
+/*!
+ * \enum QAbstractDataProxy::DataType
+ *
+ * Data type of the proxy.
+ *
+ * \value DataTypeNone
+ * No data type.
+ * \value DataTypeBar
+ * Data type for Q3DBars.
+ * \value DataTypeScatter
+ * Data type for Q3DScatter.
+ * \value DataTypeSurface
+ * Data type for Q3DSurface.
+ */
+
+/*!
+ * \internal
+ */
+QAbstractDataProxy::QAbstractDataProxy(QAbstractDataProxyPrivate *d, QObject *parent) :
+ QObject(parent),
+ d_ptr(d)
+{
+}
+
+/*!
+ * Destroys QAbstractDataProxy.
+ */
+QAbstractDataProxy::~QAbstractDataProxy()
+{
+}
+
+/*!
+ * \property QAbstractDataProxy::type
+ */
+QAbstractDataProxy::DataType QAbstractDataProxy::type() const
+{
+ return d_ptr->m_type;
+}
+
+/*!
+ * Sets label \a format for data items in this proxy. This format is used for single item labels,
+ * e.g. when an item is selected. How the format is interpreted depends on proxy type. See
+ * each proxy class documentation for more information.
+ *
+ * \sa QBarDataProxy, QScatterDataProxy, QSurfaceDataProxy
+ */
+void QAbstractDataProxy::setItemLabelFormat(const QString &format)
+{
+ d_ptr->setItemLabelFormat(format);
+ emit itemLabelFormatChanged();
+}
+
+/*!
+ * \return label format for data items in this proxy.
+ */
+QString QAbstractDataProxy::itemLabelFormat() const
+{
+ return d_ptr->m_itemLabelFormat;
+}
+
+/*!
+ * \fn void QAbstractDataProxy::itemLabelFormatChanged()
+ *
+ * Emitted when label format changes.
+ */
+
+// QAbstractDataProxyPrivate
+
+QAbstractDataProxyPrivate::QAbstractDataProxyPrivate(QAbstractDataProxy *q, QAbstractDataProxy::DataType type)
+ : QObject(0),
+ q_ptr(q),
+ m_type(type),
+ m_isDefaultProxy(false)
+{
+}
+
+QAbstractDataProxyPrivate::~QAbstractDataProxyPrivate()
+{
+}
+
+void QAbstractDataProxyPrivate::setItemLabelFormat(const QString &format)
+{
+ m_itemLabelFormat = format;
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/qabstractdataproxy.h b/src/datavisualization/data/qabstractdataproxy.h
new file mode 100644
index 00000000..db0e0863
--- /dev/null
+++ b/src/datavisualization/data/qabstractdataproxy.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QABSTRACTDATAPROXY_H
+#define QABSTRACTDATAPROXY_H
+
+#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QObject>
+#include <QScopedPointer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QAbstractDataProxyPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QAbstractDataProxy : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(DataType)
+ Q_PROPERTY(DataType type READ type)
+ Q_PROPERTY(QString itemLabelFormat READ itemLabelFormat WRITE setItemLabelFormat NOTIFY itemLabelFormatChanged)
+
+public:
+ enum DataType {
+ DataTypeNone = 0,
+ DataTypeBar = 1,
+ DataTypeScatter = 2,
+ DataTypeSurface = 4
+ };
+
+protected:
+ explicit QAbstractDataProxy(QAbstractDataProxyPrivate *d, QObject *parent = 0);
+
+public:
+ virtual ~QAbstractDataProxy();
+
+ DataType type() const;
+
+ void setItemLabelFormat(const QString &format);
+ QString itemLabelFormat() const;
+
+signals:
+ void itemLabelFormatChanged();
+
+protected:
+ QScopedPointer<QAbstractDataProxyPrivate> d_ptr;
+
+private:
+ Q_DISABLE_COPY(QAbstractDataProxy)
+
+ friend class Abstract3DController;
+ friend class Bars3DController;
+ friend class Scatter3DController;
+ friend class Surface3DController;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QABSTRACTDATAPROXY_H
diff --git a/src/datavisualization/data/qabstractdataproxy_p.h b/src/datavisualization/data/qabstractdataproxy_p.h
new file mode 100644
index 00000000..4aa1b678
--- /dev/null
+++ b/src/datavisualization/data/qabstractdataproxy_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include "datavisualizationglobal_p.h"
+#include "qabstractdataproxy.h"
+#include <QString>
+
+#ifndef QABSTRACTDATAPROXY_P_H
+#define QABSTRACTDATAPROXY_P_H
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QAbstractDataProxyPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QAbstractDataProxyPrivate(QAbstractDataProxy *q, QAbstractDataProxy::DataType type);
+ virtual ~QAbstractDataProxyPrivate();
+
+ void setItemLabelFormat(const QString &format);
+
+ inline bool isDefaultProxy() { return m_isDefaultProxy; }
+ inline void setDefaultProxy(bool isDefault) { m_isDefaultProxy = isDefault; }
+
+protected:
+ QAbstractDataProxy *q_ptr;
+ QAbstractDataProxy::DataType m_type;
+ QString m_itemLabelFormat;
+ bool m_isDefaultProxy;
+
+private:
+ friend class QAbstractDataProxy;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QABSTRACTDATAPROXY_P_H
diff --git a/src/datavisualization/data/qbardataitem.cpp b/src/datavisualization/data/qbardataitem.cpp
new file mode 100644
index 00000000..e69a5a69
--- /dev/null
+++ b/src/datavisualization/data/qbardataitem.cpp
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qbardataitem_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QBarDataItem
+ * \inmodule QtDataVisualization
+ * \brief The QBarDataItem class provides a container for resolved data to be added to bar graphs.
+ * \since 1.0.0
+ *
+ * A QBarDataItem holds data for a single rendered bar in a graph.
+ * Bar data proxies parse data into QBarDataItem instances for visualizing.
+ *
+ * \sa QBarDataProxy, {Qt Data Visualization 3D C++ Classes}
+ */
+
+/*!
+ * Constructs QBarDataItem.
+ */
+QBarDataItem::QBarDataItem()
+ : d_ptr(0), // private data doesn't exist by default (optimization)
+ m_value(0.0)
+{
+}
+
+/*!
+ * Constructs QBarDataItem with \a value.
+ */
+QBarDataItem::QBarDataItem(qreal value)
+ : d_ptr(0),
+ m_value(value)
+{
+}
+
+/*!
+ * Constructs a copy of \a other.
+ */
+QBarDataItem::QBarDataItem(const QBarDataItem &other)
+{
+ operator=(other);
+}
+
+/*!
+ * Destroys QBarDataItem.
+ */
+QBarDataItem::~QBarDataItem()
+{
+ delete d_ptr;
+}
+
+/*!
+ * Assigns a copy of \a other to this object.
+ */
+QBarDataItem &QBarDataItem::operator=(const QBarDataItem &other)
+{
+ m_value = other.m_value;
+ if (other.d_ptr)
+ createExtraData();
+ else
+ d_ptr = 0;
+ // TODO set extra data
+ return *this;
+}
+
+/*!
+ * Sets \a value to this data item.
+ */
+void QBarDataItem::setValue(qreal value)
+{
+ m_value = value;
+}
+
+/*!
+ * \return value of this data item.
+ */
+qreal QBarDataItem::value() const
+{
+ return m_value;
+}
+
+/*!
+ * \internal
+ */
+void QBarDataItem::createExtraData()
+{
+ if (!d_ptr)
+ d_ptr = new QBarDataItemPrivate;
+}
+
+QBarDataItemPrivate::QBarDataItemPrivate()
+{
+}
+
+QBarDataItemPrivate::~QBarDataItemPrivate()
+{
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/qbardataitem.h b/src/datavisualization/data/qbardataitem.h
new file mode 100644
index 00000000..683120b2
--- /dev/null
+++ b/src/datavisualization/data/qbardataitem.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QBARDATAITEM_H
+#define QBARDATAITEM_H
+
+#include <QtDataVisualization/qdatavisualizationenums.h>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QBarDataItemPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QBarDataItem
+{
+public:
+ QBarDataItem();
+ QBarDataItem(qreal value);
+ QBarDataItem(const QBarDataItem &other);
+ ~QBarDataItem();
+
+ QBarDataItem &operator=(const QBarDataItem &other);
+
+ void setValue(qreal value);
+ qreal value() const;
+
+ // TODO Set color, label format, ...?
+
+protected:
+ virtual void createExtraData();
+
+ QBarDataItemPrivate *d_ptr;
+
+private:
+ qreal m_value;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qbardataitem_p.h b/src/datavisualization/data/qbardataitem_p.h
new file mode 100644
index 00000000..20b7ea69
--- /dev/null
+++ b/src/datavisualization/data/qbardataitem_p.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBARDATAITEM_P_H
+#define QBARDATAITEM_P_H
+
+#include "datavisualizationglobal_p.h"
+#include "qbardataitem.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QBarDataItemPrivate
+{
+public:
+ QBarDataItemPrivate();
+ virtual ~QBarDataItemPrivate();
+
+ // TODO stores other data for bars besides value
+
+protected:
+ friend class QBarDataItem;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qbardataproxy.cpp b/src/datavisualization/data/qbardataproxy.cpp
new file mode 100644
index 00000000..9c30e1b1
--- /dev/null
+++ b/src/datavisualization/data/qbardataproxy.cpp
@@ -0,0 +1,409 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qbardataproxy.h"
+#include "qbardataproxy_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QBarDataProxy
+ * \inmodule QtDataVisualization
+ * \brief Proxy class for Q3DBars.
+ * \since 1.0.0
+ *
+ * QBarDataProxy handles adding, inserting, changing and removing rows of data.
+ *
+ * The data array is a list of vectors (rows) of QBarDataItem instances.
+ * Each row can contain different amount of items or even be null.
+ *
+ * QBarDataProxy takes ownership of all QBarDataRows passed to it, whether directly or
+ * in a QBarDataArray container.
+ * QBarDataRow pointers should not be used to modify data further after they have been passed to
+ * the proxy, as such modifications will not trigger proper signals.
+ *
+ * QBarDataProxy supports the following format tags for QAbstractDataProxy::setItemLabelFormat():
+ * \table
+ * \row
+ * \li @rowTitle \li Title from row axis
+ * \row
+ * \li @colTitle \li Title from column axis
+ * \row
+ * \li @valueTitle \li Title from value axis
+ * \row
+ * \li @rowIdx \li Visible row index
+ * \row
+ * \li @colIdx \li Visible Column index
+ * \row
+ * \li @rowLabel \li Label from row axis
+ * \row
+ * \li @colLabel \li Label from column axis
+ * \row
+ * \li @valueLabel \li Item value formatted using the same format the value axis attached to the graph uses,
+ * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * \row
+ * \li %<format spec> \li Item value in specified format.
+ * \endtable
+ *
+ * For example:
+ * \snippet doc_src_qtdatavisualization.cpp 1
+ */
+
+/*!
+ * Constructs QBarDataProxy with the given \a parent.
+ */
+QBarDataProxy::QBarDataProxy(QObject *parent) :
+ QAbstractDataProxy(new QBarDataProxyPrivate(this), parent)
+{
+}
+
+/*!
+ * \internal
+ */
+QBarDataProxy::QBarDataProxy(QBarDataProxyPrivate *d, QObject *parent) :
+ QAbstractDataProxy(d, parent)
+{
+}
+
+/*!
+ * Destroys QBarDataProxy.
+ */
+QBarDataProxy::~QBarDataProxy()
+{
+}
+
+/*!
+ * Clears the existing array and takes ownership of the \a newArray. Do not use \a newArray pointer
+ * to further modify data after QBarDataProxy assumes ownership of it, as such modifications will
+ * not trigger proper signals.
+ * Passing null array clears all data.
+ */
+void QBarDataProxy::resetArray(QBarDataArray *newArray)
+{
+ if (dptr()->resetArray(newArray))
+ emit arrayReset();
+}
+
+/*!
+ * Changes existing rows by replacing a row at \a rowIndex with \a row.
+ */
+void QBarDataProxy::setRow(int rowIndex, QBarDataRow *row)
+{
+ dptr()->setRow(rowIndex, row);
+ emit rowsChanged(rowIndex, 1);
+}
+
+/*!
+ * Changes existing rows by replacing a rows starting at \a rowIndex with \a rows.
+ */
+void QBarDataProxy::setRows(int rowIndex, const QBarDataArray &rows)
+{
+ dptr()->setRows(rowIndex, rows);
+ emit rowsChanged(rowIndex, rows.size());
+}
+
+/*!
+ * Changes a single item at \a rowIndex, \a columnIndex with \a item.
+ */
+void QBarDataProxy::setItem(int rowIndex, int columnIndex, const QBarDataItem &item)
+{
+ dptr()->setItem(rowIndex, columnIndex, item);
+ emit itemChanged(rowIndex, columnIndex);
+}
+
+/*!
+ * Adds a new \a row to the end of array.
+ *
+ * \return index of the added row.
+ */
+int QBarDataProxy::addRow(QBarDataRow *row)
+{
+ int addIndex = dptr()->addRow(row);
+ emit rowsAdded(addIndex, 1);
+ return addIndex;
+}
+
+/*!
+ * Adds new \a rows to the end of array.
+ *
+ * \return index of the first added row.
+ */
+int QBarDataProxy::addRows(const QBarDataArray &rows)
+{
+ int addIndex = dptr()->addRows(rows);
+ emit rowsAdded(addIndex, rows.size());
+ return addIndex;
+}
+
+/*!
+ * Inserts a new \a row to \a rowIndex. If rowIndex is equal to array size, rows are added to end
+ * of the array.
+ */
+void QBarDataProxy::insertRow(int rowIndex, QBarDataRow *row)
+{
+ dptr()->insertRow(rowIndex, row);
+ emit rowsInserted(rowIndex, 1);
+}
+
+/*!
+ * Inserts new \a rows to \a rowIndex. If rowIndex is equal to array size, rows are added to end
+ * of the array.
+ */
+void QBarDataProxy::insertRows(int rowIndex, const QBarDataArray &rows)
+{
+ dptr()->insertRows(rowIndex, rows);
+ emit rowsInserted(rowIndex, rows.size());
+}
+
+/*!
+ * Removes \a removeCount rows staring at \a rowIndex. Attempting to remove rows past the end of the
+ * array does nothing.
+ */
+void QBarDataProxy::removeRows(int rowIndex, int removeCount)
+{
+ if (rowIndex < rowCount()) {
+ dptr()->removeRows(rowIndex, removeCount);
+ emit rowsRemoved(rowIndex, removeCount);
+ }
+}
+
+/*!
+ * \return row count in the array.
+ */
+int QBarDataProxy::rowCount() const
+{
+ return dptrc()->m_dataArray->size();
+}
+
+/*!
+ * \return pointer to the data array.
+ */
+const QBarDataArray *QBarDataProxy::array() const
+{
+ return dptrc()->m_dataArray;
+}
+
+/*!
+ * \return pointer to the row at \a rowIndex. It is guaranteed to be valid only until next call
+ * that modifies data.
+ */
+const QBarDataRow *QBarDataProxy::rowAt(int rowIndex) const
+{
+ const QBarDataArray &dataArray = *dptrc()->m_dataArray;
+ Q_ASSERT(rowIndex >= 0 && rowIndex < dataArray.size());
+ return dataArray[rowIndex];
+}
+
+/*!
+ * \return pointer to the item at \a rowIndex, \a columnIndex. It is guaranteed to be valid only
+ * until next call that modifies data.
+ */
+const QBarDataItem *QBarDataProxy::itemAt(int rowIndex, int columnIndex) const
+{
+ const QBarDataArray &dataArray = *dptrc()->m_dataArray;
+ Q_ASSERT(rowIndex >= 0 && rowIndex < dataArray.size());
+ const QBarDataRow &dataRow = *dataArray[rowIndex];
+ Q_ASSERT(columnIndex >= 0 && columnIndex < dataRow.size());
+ return &dataRow.at(columnIndex);
+}
+
+/*!
+ * \internal
+ */
+QBarDataProxyPrivate *QBarDataProxy::dptr()
+{
+ return static_cast<QBarDataProxyPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \internal
+ */
+const QBarDataProxyPrivate *QBarDataProxy::dptrc() const
+{
+ return static_cast<const QBarDataProxyPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \fn void QBarDataProxy::arrayReset()
+ *
+ * Emitted when data array is reset.
+ */
+
+/*!
+ * \fn void QBarDataProxy::rowsAdded(int startIndex, int count)
+ *
+ * Emitted when rows have been added. Provides \a startIndex and \a count of rows added.
+ */
+
+/*!
+ * \fn void QBarDataProxy::rowsChanged(int startIndex, int count)
+ *
+ * Emitted when rows have changed. Provides \a startIndex and \a count of changed rows.
+ */
+
+/*!
+ * \fn void QBarDataProxy::rowsRemoved(int startIndex, int count)
+ *
+ * Emitted when rows have been removed. Provides \a startIndex and \a count of rows removed.
+ * Index is the current array size if rows were removed from the end of the array.
+ */
+
+/*!
+ * \fn void QBarDataProxy::rowsInserted(int startIndex, int count)
+ *
+ * Emitted when rows have been inserted. Provides \a startIndex and \a count of inserted rows.
+ */
+
+/*!
+ * \fn void QBarDataProxy::itemChanged(int rowIndex, int columnIndex)
+ *
+ * Emitted when an item has changed. Provides \a rowIndex and \a columnIndex of changed item.
+ */
+
+// QBarDataProxyPrivate
+
+QBarDataProxyPrivate::QBarDataProxyPrivate(QBarDataProxy *q)
+ : QAbstractDataProxyPrivate(q, QAbstractDataProxy::DataTypeBar),
+ m_dataArray(new QBarDataArray)
+{
+ m_itemLabelFormat = QStringLiteral("@valueTitle: @valueLabel");
+}
+
+QBarDataProxyPrivate::~QBarDataProxyPrivate()
+{
+ clearArray();
+}
+
+bool QBarDataProxyPrivate::resetArray(QBarDataArray *newArray)
+{
+ if (!m_dataArray->size() && (!newArray || !newArray->size()))
+ return false;
+
+ clearArray();
+
+ if (newArray)
+ m_dataArray = newArray;
+ else
+ m_dataArray = new QBarDataArray;
+
+ return true;
+}
+
+void QBarDataProxyPrivate::setRow(int rowIndex, QBarDataRow *row)
+{
+ Q_ASSERT(rowIndex >= 0 && rowIndex < m_dataArray->size());
+ clearRow(rowIndex);
+ (*m_dataArray)[rowIndex] = row;
+}
+
+void QBarDataProxyPrivate::setRows(int rowIndex, const QBarDataArray &rows)
+{
+ QBarDataArray &dataArray = *m_dataArray;
+ Q_ASSERT(rowIndex >= 0 && (rowIndex + rows.size()) <= dataArray.size());
+ for (int i = 0; i < rows.size(); i++) {
+ clearRow(rowIndex);
+ dataArray[rowIndex] = rows.at(i);
+ rowIndex++;
+ }
+}
+
+void QBarDataProxyPrivate::setItem(int rowIndex, int columnIndex, const QBarDataItem &item)
+{
+ Q_ASSERT(rowIndex >= 0 && rowIndex < m_dataArray->size());
+ QBarDataRow &row = *(*m_dataArray)[rowIndex];
+ Q_ASSERT(columnIndex < row.size());
+ row[columnIndex] = item;
+}
+
+int QBarDataProxyPrivate::addRow(QBarDataRow *row)
+{
+ int currentSize = m_dataArray->size();
+ m_dataArray->append(row);
+ return currentSize;
+}
+
+int QBarDataProxyPrivate::addRows(const QBarDataArray &rows)
+{
+ int currentSize = m_dataArray->size();
+ for (int i = 0; i < rows.size(); i++)
+ m_dataArray->append(rows.at(i));
+ return currentSize;
+}
+
+void QBarDataProxyPrivate::insertRow(int rowIndex, QBarDataRow *row)
+{
+ Q_ASSERT(rowIndex >= 0 && rowIndex <= m_dataArray->size());
+ m_dataArray->insert(rowIndex, row);
+}
+
+void QBarDataProxyPrivate::insertRows(int rowIndex, const QBarDataArray &rows)
+{
+ Q_ASSERT(rowIndex >= 0 && rowIndex <= m_dataArray->size());
+ for (int i = 0; i < rows.size(); i++)
+ m_dataArray->insert(rowIndex++, rows.at(i));
+}
+
+void QBarDataProxyPrivate::removeRows(int rowIndex, int removeCount)
+{
+ Q_ASSERT(rowIndex >= 0);
+ int maxRemoveCount = m_dataArray->size() - rowIndex;
+ removeCount = qMin(removeCount, maxRemoveCount);
+ for (int i = 0; i < removeCount; i++) {
+ clearRow(rowIndex);
+ m_dataArray->removeAt(rowIndex);
+ }
+}
+
+void QBarDataProxyPrivate::clearRow(int rowIndex)
+{
+ if (m_dataArray->at(rowIndex)) {
+ delete m_dataArray->at(rowIndex);
+ (*m_dataArray)[rowIndex] = 0;
+ }
+}
+
+void QBarDataProxyPrivate::clearArray()
+{
+ for (int i = 0; i < m_dataArray->size(); i++)
+ clearRow(i);
+ m_dataArray->clear();
+ delete m_dataArray;
+}
+
+QPair<GLfloat, GLfloat> QBarDataProxyPrivate::limitValues(int startRow, int endRow, int startColumn, int endColumn)
+{
+ QPair<GLfloat, GLfloat> limits = qMakePair(0.0f, 0.0f);
+ endRow = qMin(endRow, m_dataArray->size() - 1);
+ for (int i = startRow; i <= endRow; i++) {
+ QBarDataRow *row = m_dataArray->at(i);
+ if (row) {
+ endColumn = qMin(endColumn, row->size() - 1);
+ for (int j = startColumn; j <= endColumn; j++) {
+ const QBarDataItem &item = m_dataArray->at(i)->at(j);
+ qreal itemValue = item.value();
+ if (limits.second < itemValue)
+ limits.second = itemValue;
+ if (limits.first > itemValue)
+ limits.first = itemValue;
+ }
+ }
+ }
+ return limits;
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/qbardataproxy.h b/src/datavisualization/data/qbardataproxy.h
new file mode 100644
index 00000000..8ebaf5ae
--- /dev/null
+++ b/src/datavisualization/data/qbardataproxy.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QBARDATAPROXY_H
+#define QBARDATAPROXY_H
+
+#include <QtDataVisualization/qabstractdataproxy.h>
+#include <QtDataVisualization/qbardataitem.h>
+#include <QVector>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+typedef QVector<QBarDataItem> QBarDataRow;
+typedef QList<QBarDataRow *> QBarDataArray;
+
+class QBarDataProxyPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QBarDataProxy : public QAbstractDataProxy
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int rowCount READ rowCount)
+public:
+ explicit QBarDataProxy(QObject *parent = 0);
+ virtual ~QBarDataProxy();
+
+ // TODO: Replace first part of class description in docs with this once all TODOs are done:
+ /*
+ * QBarDataProxy is optimized for adding, inserting, and removing rows of data.
+ * Adding a column essentially means modifying every row, which is comparatively very inefficient.
+ * Proxy is also optimized to use cases where the only defining characteristic of an individual
+ * bar is its value. Modifying other data that might be added in the future such as color of
+ * individual bar requires allocating additional data object for the bar.
+ */
+
+ int rowCount() const;
+ const QBarDataArray *array() const;
+ const QBarDataRow *rowAt(int rowIndex) const;
+ const QBarDataItem *itemAt(int rowIndex, int columnIndex) const;
+
+ void resetArray(QBarDataArray *newArray);
+
+ void setRow(int rowIndex, QBarDataRow *row);
+ void setRows(int rowIndex, const QBarDataArray &rows);
+
+ // Setting a column is comparatively inefficient as it changes all rows.
+ // Can resize rows that are shorter than columnIndex.
+ // TODO void setColumn(int columnIndex, const QBarDataRow &column);
+ // TODO void setColumns(int columnIndex, const QBarDataArray &columns);
+
+ void setItem(int rowIndex, int columnIndex, const QBarDataItem &item);
+ // Change block of items
+ // TODO setItems(int rowIndex, int columnIndex, QBarDataArray *items);
+
+ int addRow(QBarDataRow *row);
+ int addRows(const QBarDataArray &rows);
+ // TODO int addColumn(const QBarDataRow &column); // returns the index of the added column
+ // TODO int addColumns(const QBarDataArray &columns); // returns the index of the first added column
+
+ void insertRow(int rowIndex, QBarDataRow *row);
+ void insertRows(int rowIndex, const QBarDataArray &rows);
+ // TODO void insertColumn(int columnIndex, const QBarDataRow &column);
+ // TODO void insertColumns(int columnIndex, const QBarDataArray &columns);
+
+ void removeRows(int rowIndex, int removeCount);
+ // TODO void removeColumns(int columnIndex, int removeCount);
+
+signals:
+ void arrayReset();
+ void rowsAdded(int startIndex, int count);
+ void rowsChanged(int startIndex, int count);
+ void rowsRemoved(int startIndex, int count);
+ void rowsInserted(int startIndex, int count);
+ // TODO void columnsChanged(int startIndex, int count);
+ // TODO void columnsAdded(int startIndex, int count);
+ // TODO void columnsRemoved(int startIndex, int count);
+ // TODO void columnsInserted(int startIndex, int count);
+ void itemChanged(int rowIndex, int columnIndex); // TODO remove once itemsChanged is added?
+ // TODO void itemsChanged(int rowIndex, int columnIndex, int rowCount, int columnCount);
+
+protected:
+ explicit QBarDataProxy(QBarDataProxyPrivate *d, QObject *parent = 0);
+ QBarDataProxyPrivate *dptr();
+ const QBarDataProxyPrivate *dptrc() const;
+
+private:
+ Q_DISABLE_COPY(QBarDataProxy)
+
+ friend class Bars3DController;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QBARDATAPROXY_H
diff --git a/src/datavisualization/data/qbardataproxy_p.h b/src/datavisualization/data/qbardataproxy_p.h
new file mode 100644
index 00000000..ab64c4a1
--- /dev/null
+++ b/src/datavisualization/data/qbardataproxy_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBARDATAPROXY_P_H
+#define QBARDATAPROXY_P_H
+
+#include "qbardataproxy.h"
+#include "qabstractdataproxy_p.h"
+#include "qbardataitem.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QBarDataProxyPrivate : public QAbstractDataProxyPrivate
+{
+ Q_OBJECT
+public:
+ QBarDataProxyPrivate(QBarDataProxy *q);
+ virtual ~QBarDataProxyPrivate();
+
+ bool resetArray(QBarDataArray *newArray);
+ void setRow(int rowIndex, QBarDataRow *row);
+ void setRows(int rowIndex, const QBarDataArray &rows);
+ void setItem(int rowIndex, int columnIndex, const QBarDataItem &item);
+ int addRow(QBarDataRow *row);
+ int addRows(const QBarDataArray &rows);
+ void insertRow(int rowIndex, QBarDataRow *row);
+ void insertRows(int rowIndex, const QBarDataArray &rows);
+ void removeRows(int rowIndex, int removeCount);
+
+ QPair<GLfloat, GLfloat> limitValues(int startRow, int startColumn, int rowCount, int columnCount);
+
+private:
+ void clearRow(int rowIndex);
+ void clearArray();
+
+ QBarDataArray *m_dataArray;
+
+private:
+ friend class QBarDataProxy;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QBARDATAPROXY_P_H
diff --git a/src/datavisualization/data/qitemmodelbardatamapping.cpp b/src/datavisualization/data/qitemmodelbardatamapping.cpp
new file mode 100644
index 00000000..4577a614
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelbardatamapping.cpp
@@ -0,0 +1,238 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qitemmodelbardatamapping_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QItemModelBarDataMapping
+ * \inmodule QtDataVisualization
+ * \brief Data model mapping for Q3DBars.
+ * \since 1.0.0
+ *
+ * QItemModelBarDataMapping is used to map roles of QAbstractItemModel to rows, columns, and values
+ * of Q3DBars. There are two ways to use QItemModelBarDataMapping:
+ *
+ * 1) By default, the QItemModelBarDataMapping will map the rows and columns of QAbstractItemModel
+ * to rows and columns of Q3DBars, and uses the value returned for Qt::DisplayRole as bar value.
+ * The value role to be used can be redefined if Qt::DisplayRole is not suitable.
+ *
+ * 2) For models that do not have data already neatly sorted into rows and columns, such as
+ * QAbstractListModel based models, you can define a list of categories for both rows and columns,
+ * and define a role to map for each of row, column and value.
+ * For example, assume that you have a custom QAbstractItemModel for storing various monthly values
+ * related to a business.
+ * Each item in the model has roles "year", "month", "income", and "expenses".
+ * You could do the following to display the data in a bar chart:
+ *
+ * \snippet doc_src_qtdatavisualization.cpp 3
+ *
+ * \sa QItemModelBarDataProxy
+ */
+
+/*!
+ * Constructs QItemModelBarDataMapping with the given \a parent.
+ */
+QItemModelBarDataMapping::QItemModelBarDataMapping(QObject *parent)
+ : QAbstractDataMapping(new QItemModelBarDataMappingPrivate(this), parent)
+{
+}
+
+/*!
+ * Constructs QItemModelBarDataMapping with \a valueRole and the given \a parent.
+ */
+QItemModelBarDataMapping::QItemModelBarDataMapping(const QString &valueRole, QObject *parent)
+ : QAbstractDataMapping(new QItemModelBarDataMappingPrivate(this), parent)
+{
+ dptr()->m_valueRole = valueRole;
+}
+
+/*!
+ * Constructs QItemModelBarDataMapping with \a rowRole, \a columnRole, \a valueRole,
+ * \a rowCategories, \a columnCategories and the given \a parent.
+ */
+QItemModelBarDataMapping::QItemModelBarDataMapping(const QString &rowRole,
+ const QString &columnRole,
+ const QString &valueRole,
+ const QStringList &rowCategories,
+ const QStringList &columnCategories,
+ QObject *parent)
+ : QAbstractDataMapping(new QItemModelBarDataMappingPrivate(this), parent)
+{
+ dptr()->m_rowRole = rowRole;
+ dptr()->m_columnRole = columnRole;
+ dptr()->m_valueRole = valueRole;
+ dptr()->m_rowCategories = rowCategories;
+ dptr()->m_columnCategories = columnCategories;
+}
+
+/*!
+ * Destroys QItemModelBarDataMapping.
+ */
+QItemModelBarDataMapping::~QItemModelBarDataMapping()
+{
+}
+
+/*!
+ * \property QItemModelBarDataMapping::rowRole
+ *
+ * Defines the row role for the mapping.
+ */
+void QItemModelBarDataMapping::setRowRole(const QString &role)
+{
+ dptr()->m_rowRole = role;
+ emit mappingChanged();
+}
+
+QString QItemModelBarDataMapping::rowRole() const
+{
+ return dptrc()->m_rowRole;
+}
+
+/*!
+ * \property QItemModelBarDataMapping::columnRole
+ *
+ * Defines the column role for the mapping.
+ */
+void QItemModelBarDataMapping::setColumnRole(const QString &role)
+{
+ dptr()->m_columnRole = role;
+ emit mappingChanged();
+}
+
+QString QItemModelBarDataMapping::columnRole() const
+{
+ return dptrc()->m_columnRole;
+}
+
+/*!
+ * \property QItemModelBarDataMapping::valueRole
+ *
+ * Defines the value role for the mapping.
+ */
+void QItemModelBarDataMapping::setValueRole(const QString &role)
+{
+ dptr()->m_valueRole = role;
+ emit mappingChanged();
+}
+
+QString QItemModelBarDataMapping::valueRole() const
+{
+ return dptrc()->m_valueRole;
+}
+
+/*!
+ * \property QItemModelBarDataMapping::rowCategories
+ *
+ * Defines the row categories for the mapping.
+ */
+void QItemModelBarDataMapping::setRowCategories(const QStringList &categories)
+{
+ dptr()->m_rowCategories = categories;
+ emit mappingChanged();
+}
+
+QStringList QItemModelBarDataMapping::rowCategories() const
+{
+ return dptrc()->m_rowCategories;
+}
+
+/*!
+ * \property QItemModelBarDataMapping::columnCategories
+ *
+ * Defines the column categories for the mapping.
+ */
+void QItemModelBarDataMapping::setColumnCategories(const QStringList &categories)
+{
+ dptr()->m_columnCategories = categories;
+ emit mappingChanged();
+}
+
+QStringList QItemModelBarDataMapping::columnCategories() const
+{
+ return dptrc()->m_columnCategories;
+}
+
+/*!
+ * Changes \a rowRole, \a columnRole, \a valueRole, \a rowCategories and \a columnCategories to the
+ * mapping.
+ */
+void QItemModelBarDataMapping::remap(const QString &rowRole,
+ const QString &columnRole,
+ const QString &valueRole,
+ const QStringList &rowCategories,
+ const QStringList &columnCategories)
+{
+ dptr()->m_rowRole = rowRole;
+ dptr()->m_columnRole = columnRole;
+ dptr()->m_valueRole = valueRole;
+ dptr()->m_rowCategories = rowCategories;
+ dptr()->m_columnCategories = columnCategories;
+
+ emit mappingChanged();
+}
+
+/*!
+ * /return index of the specified \a category in row categories list.
+ * If the category is not found, -1 is returned.
+ */
+int QItemModelBarDataMapping::rowCategoryIndex(const QString &category)
+{
+ return dptr()->m_rowCategories.indexOf(category);
+}
+
+/*!
+ * /return index of the specified \a category in column categories list.
+ * If the category is not found, -1 is returned.
+ */
+int QItemModelBarDataMapping::columnCategoryIndex(const QString &category)
+{
+ return dptr()->m_columnCategories.indexOf(category);
+}
+
+/*!
+ * \internal
+ */
+QItemModelBarDataMappingPrivate *QItemModelBarDataMapping::dptr()
+{
+ return static_cast<QItemModelBarDataMappingPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \internal
+ */
+const QItemModelBarDataMappingPrivate *QItemModelBarDataMapping::dptrc() const
+{
+ return static_cast<const QItemModelBarDataMappingPrivate *>(d_ptr.data());
+}
+
+// QItemModelBarDataMappingPrivate
+
+QItemModelBarDataMappingPrivate::QItemModelBarDataMappingPrivate(QItemModelBarDataMapping *q)
+ : QAbstractDataMappingPrivate(q, QAbstractDataProxy::DataTypeBar)
+{
+}
+
+QItemModelBarDataMappingPrivate::~QItemModelBarDataMappingPrivate()
+{
+}
+
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
diff --git a/src/datavisualization/data/qitemmodelbardatamapping.h b/src/datavisualization/data/qitemmodelbardatamapping.h
new file mode 100644
index 00000000..a781f020
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelbardatamapping.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QITEMMODELBARDATAMAPPING_H
+#define QITEMMODELBARDATAMAPPING_H
+
+#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QtDataVisualization/qabstractdatamapping.h>
+#include <QStringList>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QItemModelBarDataMappingPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QItemModelBarDataMapping : public QAbstractDataMapping
+{
+ Q_OBJECT
+ Q_PROPERTY(QString rowRole READ rowRole WRITE setRowRole)
+ Q_PROPERTY(QString columnRole READ columnRole WRITE setColumnRole)
+ Q_PROPERTY(QString valueRole READ valueRole WRITE setValueRole)
+ Q_PROPERTY(QStringList rowCategories READ rowCategories WRITE setRowCategories)
+ Q_PROPERTY(QStringList columnCategories READ columnCategories WRITE setColumnCategories)
+
+public:
+ explicit QItemModelBarDataMapping(QObject *parent = 0);
+ QItemModelBarDataMapping(const QString &valueRole, QObject *parent = 0);
+ QItemModelBarDataMapping(const QString &rowRole, const QString &columnRole,
+ const QString &valueRole, const QStringList &rowCategories,
+ const QStringList &columnCategories, QObject *parent = 0);
+ virtual ~QItemModelBarDataMapping();
+
+ void setRowRole(const QString &role);
+ QString rowRole() const;
+ void setColumnRole(const QString &role);
+ QString columnRole() const;
+ void setValueRole(const QString &role);
+ QString valueRole() const;
+
+ void setRowCategories(const QStringList &categories);
+ QStringList rowCategories() const;
+ void setColumnCategories(const QStringList &categories);
+ QStringList columnCategories() const;
+
+ void remap(const QString &rowRole, const QString &columnRole,
+ const QString &valueRole, const QStringList &rowCategories,
+ const QStringList &columnCategories);
+
+ Q_INVOKABLE int rowCategoryIndex(const QString& category);
+ Q_INVOKABLE int columnCategoryIndex(const QString& category);
+
+protected:
+ QItemModelBarDataMappingPrivate *dptr();
+ const QItemModelBarDataMappingPrivate *dptrc() const;
+
+private:
+ Q_DISABLE_COPY(QItemModelBarDataMapping)
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelbardatamapping_p.h b/src/datavisualization/data/qitemmodelbardatamapping_p.h
new file mode 100644
index 00000000..b444e384
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelbardatamapping_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include "qitemmodelbardatamapping.h"
+#include "qabstractdatamapping_p.h"
+
+#ifndef QITEMMODELBARDATAMAPPING_P_H
+#define QITEMMODELBARDATAMAPPING_P_H
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QItemModelBarDataMappingPrivate : public QAbstractDataMappingPrivate
+{
+ Q_OBJECT
+public:
+ QItemModelBarDataMappingPrivate(QItemModelBarDataMapping *q);
+ virtual ~QItemModelBarDataMappingPrivate();
+
+private:
+ QString m_rowRole;
+ QString m_columnRole;
+ QString m_valueRole;
+
+ // For row/column items, sort items into these categories. Other categories are ignored.
+ QStringList m_rowCategories;
+ QStringList m_columnCategories;
+
+ friend class QItemModelBarDataMapping;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelbardataproxy.cpp b/src/datavisualization/data/qitemmodelbardataproxy.cpp
new file mode 100644
index 00000000..49905be5
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelbardataproxy.cpp
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qitemmodelbardataproxy_p.h"
+#include "baritemmodelhandler_p.h"
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QItemModelBarDataProxy
+ * \inmodule QtDataVisualization
+ * \brief Proxy class for Q3DBars data model mapping.
+ * \since 1.0.0
+ *
+ * QItemModelBarDataProxy allows you to use QAbstractItemModel derived models as a data source
+ * for Q3DBars. It uses QItemModelBarDataMapping instance to map data from the model to Q3DBars
+ * graph.
+ *
+ * \sa QItemModelBarDataMapping
+ */
+
+/*!
+ * Constructs QItemModelBarDataProxy.
+ */
+QItemModelBarDataProxy::QItemModelBarDataProxy() :
+ QBarDataProxy(new QItemModelBarDataProxyPrivate(this))
+{
+}
+
+/*!
+ * Constructs QItemModelBarDataProxy with \a itemModel and \a mapping. Proxy takes ownership of the
+ * \a mapping, but doesn't take ownership of the \a itemModel, as typically item models are owned
+ * by other controls.
+ */
+QItemModelBarDataProxy::QItemModelBarDataProxy(const QAbstractItemModel *itemModel,
+ QItemModelBarDataMapping *mapping) :
+ QBarDataProxy(new QItemModelBarDataProxyPrivate(this))
+{
+ dptr()->m_itemModelHandler->setItemModel(itemModel);
+ dptr()->m_itemModelHandler->setActiveMapping(mapping);
+}
+
+/*!
+ * Destroys QItemModelBarDataProxy.
+ */
+QItemModelBarDataProxy::~QItemModelBarDataProxy()
+{
+}
+
+/*!
+ * \property QItemModelBarDataProxy::itemModel
+ *
+ * Defines item model. Does not take ownership of the model, but does connect to it to listen for
+ * changes.
+ */
+void QItemModelBarDataProxy::setItemModel(const QAbstractItemModel *itemModel)
+{
+ dptr()->m_itemModelHandler->setItemModel(itemModel);
+}
+
+const QAbstractItemModel *QItemModelBarDataProxy::itemModel() const
+{
+ return dptrc()->m_itemModelHandler->itemModel();
+}
+
+/*!
+ * \property QItemModelBarDataProxy::activeMapping
+ *
+ * Defines data mapping. Proxy takes ownership of the \a mapping.
+ * Modifying a mapping that is set to the proxy will trigger data set re-resolving.
+ */
+void QItemModelBarDataProxy::setActiveMapping(QItemModelBarDataMapping *mapping)
+{
+ dptr()->m_itemModelHandler->setActiveMapping(mapping);
+}
+
+QItemModelBarDataMapping *QItemModelBarDataProxy::activeMapping() const
+{
+ return static_cast<QItemModelBarDataMapping *>(dptrc()->m_itemModelHandler->activeMapping());
+}
+
+/*!
+ * Transfers the ownership of the \a mapping to this proxy. The mapping is not taken to use yet.
+ * \sa setActiveMapping(), releaseMapping()
+ */
+void QItemModelBarDataProxy::addMapping(QItemModelBarDataMapping *mapping)
+{
+ dptr()->m_itemModelHandler->addMapping(mapping);
+}
+
+/*!
+ * Releases the ownership of the \a mapping back to the caller. If the mapping was the currently
+ * active one, no mapping remains active after this call.
+ */
+void QItemModelBarDataProxy::releaseMapping(QItemModelBarDataMapping *mapping)
+{
+ dptr()->m_itemModelHandler->releaseMapping(mapping);
+}
+
+/*!
+ * \return list of mappings owned by the proxy.
+ */
+QList<QItemModelBarDataMapping *> QItemModelBarDataProxy::mappings() const
+{
+ QList<QItemModelBarDataMapping *> retList;
+ QList<QAbstractDataMapping *> abstractList = dptrc()->m_itemModelHandler->mappings();
+ foreach (QAbstractDataMapping *mapping, abstractList)
+ retList.append(static_cast<QItemModelBarDataMapping *>(mapping));
+
+ return retList;
+}
+
+/*!
+ * \internal
+ */
+QItemModelBarDataProxyPrivate *QItemModelBarDataProxy::dptr()
+{
+ return static_cast<QItemModelBarDataProxyPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \internal
+ */
+const QItemModelBarDataProxyPrivate *QItemModelBarDataProxy::dptrc() const
+{
+ return static_cast<const QItemModelBarDataProxyPrivate *>(d_ptr.data());
+}
+
+// QItemModelBarDataProxyPrivate
+
+QItemModelBarDataProxyPrivate::QItemModelBarDataProxyPrivate(QItemModelBarDataProxy *q)
+ : QBarDataProxyPrivate(q),
+ m_itemModelHandler(new BarItemModelHandler(q))
+{
+}
+
+QItemModelBarDataProxyPrivate::~QItemModelBarDataProxyPrivate()
+{
+ delete m_itemModelHandler;
+}
+
+QItemModelBarDataProxy *QItemModelBarDataProxyPrivate::qptr()
+{
+ return static_cast<QItemModelBarDataProxy *>(q_ptr);
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/qitemmodelbardataproxy.h b/src/datavisualization/data/qitemmodelbardataproxy.h
new file mode 100644
index 00000000..2a96f0c8
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelbardataproxy.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QITEMMODELBARDATAPROXY_H
+#define QITEMMODELBARDATAPROXY_H
+
+#include <QtDataVisualization/qbardataproxy.h>
+#include <QtDataVisualization/qitemmodelbardatamapping.h>
+#include <QAbstractItemModel>
+#include <QStringList>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QItemModelBarDataProxyPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QItemModelBarDataProxy : public QBarDataProxy
+{
+ Q_OBJECT
+ Q_PROPERTY(const QAbstractItemModel* itemModel READ itemModel WRITE setItemModel)
+ Q_PROPERTY(QItemModelBarDataMapping* activeMapping READ activeMapping WRITE setActiveMapping)
+
+public:
+ explicit QItemModelBarDataProxy();
+ explicit QItemModelBarDataProxy(const QAbstractItemModel *itemModel,
+ QItemModelBarDataMapping *mapping);
+ virtual ~QItemModelBarDataProxy();
+
+ void setItemModel(const QAbstractItemModel *itemModel);
+ const QAbstractItemModel *itemModel() const;
+
+ void setActiveMapping(QItemModelBarDataMapping *mapping);
+ QItemModelBarDataMapping *activeMapping() const;
+ void addMapping(QItemModelBarDataMapping *mapping);
+ void releaseMapping(QItemModelBarDataMapping *mapping);
+ QList<QItemModelBarDataMapping *> mappings() const;
+
+protected:
+ QItemModelBarDataProxyPrivate *dptr();
+ const QItemModelBarDataProxyPrivate *dptrc() const;
+
+private:
+ Q_DISABLE_COPY(QItemModelBarDataProxy)
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelbardataproxy_p.h b/src/datavisualization/data/qitemmodelbardataproxy_p.h
new file mode 100644
index 00000000..fc646f0d
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelbardataproxy_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QITEMMODELBARDATAPROXY_P_H
+#define QITEMMODELBARDATAPROXY_P_H
+
+#include "qitemmodelbardataproxy.h"
+#include "qbardataproxy_p.h"
+#include <QPointer>
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class BarItemModelHandler;
+
+class QItemModelBarDataProxyPrivate : public QBarDataProxyPrivate
+{
+ Q_OBJECT
+public:
+ QItemModelBarDataProxyPrivate(QItemModelBarDataProxy *q);
+ virtual ~QItemModelBarDataProxyPrivate();
+
+private:
+ QItemModelBarDataProxy *qptr();
+
+ BarItemModelHandler *m_itemModelHandler;
+
+ friend class QItemModelBarDataProxy;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelscatterdatamapping.cpp b/src/datavisualization/data/qitemmodelscatterdatamapping.cpp
new file mode 100644
index 00000000..1243c19e
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelscatterdatamapping.cpp
@@ -0,0 +1,167 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qitemmodelscatterdatamapping_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QItemModelScatterDataMapping
+ * \inmodule QtDataVisualization
+ * \brief Data model mapping for Q3DScatter.
+ * \since 1.0.0
+ *
+ * QItemModelScatterDataMapping is used to map roles of QAbstractItemModel to the XYZ-values
+ * of Q3DScatter points.
+ *
+ * QItemModelScatterDataMapping ignores rows and columns of the QAbstractItemModel and treats
+ * all items equally. It requires the model to provide at least three roles for the data items
+ * that can be mapped to X, Y, and Z-values for the scatter points.
+ *
+ * For example, assume that you have a custom QAbstractItemModel for storing various measurements
+ * done on material samples, providing data for roles such as "density", "hardness" and
+ * "conductivity". You could visualize these properties on a scatter chart:
+ *
+ * \snippet doc_src_qtdatavisualization.cpp 4
+ *
+ * \sa QItemModelScatterDataProxy
+ */
+
+/*!
+ * Constructs QItemModelScatterDataMapping with the given \a parent.
+ */
+QItemModelScatterDataMapping::QItemModelScatterDataMapping(QObject *parent)
+ : QAbstractDataMapping(new QItemModelScatterDataMappingPrivate(this), parent)
+{
+}
+
+/*!
+ * Constructs QItemModelScatterDataMapping with \a xPosRole, \a yPosRole, \a zPosRole
+ * and the given \a parent.
+ */
+QItemModelScatterDataMapping::QItemModelScatterDataMapping(const QString &xPosRole,
+ const QString &yPosRole,
+ const QString &zPosRole,
+ QObject *parent)
+ : QAbstractDataMapping(new QItemModelScatterDataMappingPrivate(this), parent)
+{
+ dptr()->m_xPosRole = xPosRole;
+ dptr()->m_yPosRole = yPosRole;
+ dptr()->m_zPosRole = zPosRole;
+}
+
+/*!
+ * Destroys QItemModelScatterDataMapping.
+ */
+QItemModelScatterDataMapping::~QItemModelScatterDataMapping()
+{
+}
+
+/*!
+ * \property QItemModelScatterDataMapping::xPosRole
+ *
+ * Defines the X position role for the mapping.
+ */
+void QItemModelScatterDataMapping::setXPosRole(const QString &role)
+{
+ dptr()->m_xPosRole = role;
+ emit mappingChanged();
+}
+
+QString QItemModelScatterDataMapping::xPosRole() const
+{
+ return dptrc()->m_xPosRole;
+}
+
+/*!
+ * \property QItemModelScatterDataMapping::yPosRole
+ *
+ * Defines the Y position role for the mapping.
+ */
+void QItemModelScatterDataMapping::setYPosRole(const QString &role)
+{
+ dptr()->m_yPosRole = role;
+ emit mappingChanged();
+}
+
+QString QItemModelScatterDataMapping::yPosRole() const
+{
+ return dptrc()->m_yPosRole;
+}
+
+/*!
+ * \property QItemModelScatterDataMapping::zPosRole
+ *
+ * Defines the Z position role for the mapping.
+ */
+void QItemModelScatterDataMapping::setZPosRole(const QString &role)
+{
+ dptr()->m_zPosRole = role;
+ emit mappingChanged();
+}
+
+QString QItemModelScatterDataMapping::zPosRole() const
+{
+ return dptrc()->m_zPosRole;
+}
+
+/*!
+ * Changes \a xPosRole, \a yPosRole and \a zPosRole to the mapping.
+ *
+ * Emits mappingChanged() signal after remapping.
+ */
+void QItemModelScatterDataMapping::remap(const QString &xPosRole, const QString &yPosRole,
+ const QString &zPosRole)
+{
+ dptr()->m_xPosRole = xPosRole;
+ dptr()->m_yPosRole = yPosRole;
+ dptr()->m_zPosRole = zPosRole;
+
+ emit mappingChanged();
+}
+
+/*!
+ * \internal
+ */
+QItemModelScatterDataMappingPrivate *QItemModelScatterDataMapping::dptr()
+{
+ return static_cast<QItemModelScatterDataMappingPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \internal
+ */
+const QItemModelScatterDataMappingPrivate *QItemModelScatterDataMapping::dptrc() const
+{
+ return static_cast<const QItemModelScatterDataMappingPrivate *>(d_ptr.data());
+}
+
+// QItemModelScatterDataMappingPrivate
+
+QItemModelScatterDataMappingPrivate::QItemModelScatterDataMappingPrivate(
+ QItemModelScatterDataMapping *q)
+ : QAbstractDataMappingPrivate(q, QAbstractDataProxy::DataTypeScatter)
+{
+}
+
+QItemModelScatterDataMappingPrivate::~QItemModelScatterDataMappingPrivate()
+{
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
diff --git a/src/datavisualization/data/qitemmodelscatterdatamapping.h b/src/datavisualization/data/qitemmodelscatterdatamapping.h
new file mode 100644
index 00000000..62f2fefc
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelscatterdatamapping.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QITEMMODELSCATTERDATAMAPPING_H
+#define QITEMMODELSCATTERDATAMAPPING_H
+
+#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QtDataVisualization/qabstractdatamapping.h>
+#include <QObject>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QItemModelScatterDataMappingPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QItemModelScatterDataMapping : public QAbstractDataMapping
+{
+ Q_OBJECT
+ Q_PROPERTY(QString xPosRole READ xPosRole WRITE setXPosRole)
+ Q_PROPERTY(QString yPosRole READ yPosRole WRITE setYPosRole)
+ Q_PROPERTY(QString zPosRole READ zPosRole WRITE setZPosRole)
+
+public:
+ explicit QItemModelScatterDataMapping(QObject *parent = 0);
+ QItemModelScatterDataMapping(const QString &xPosRole, const QString &yPosRole,
+ const QString &zPosRole, QObject *parent = 0);
+ virtual ~QItemModelScatterDataMapping();
+
+ void setXPosRole(const QString &role);
+ QString xPosRole() const;
+ void setYPosRole(const QString &role);
+ QString yPosRole() const;
+ void setZPosRole(const QString &role);
+ QString zPosRole() const;
+
+ void remap(const QString &xPosRole, const QString &yPosRole, const QString &zPosRole);
+
+protected:
+ QItemModelScatterDataMappingPrivate *dptr();
+ const QItemModelScatterDataMappingPrivate *dptrc() const;
+
+private:
+ Q_DISABLE_COPY(QItemModelScatterDataMapping)
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelscatterdatamapping_p.h b/src/datavisualization/data/qitemmodelscatterdatamapping_p.h
new file mode 100644
index 00000000..9a8c1b6e
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelscatterdatamapping_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include "qitemmodelscatterdatamapping.h"
+#include "qabstractdatamapping_p.h"
+
+#ifndef QITEMMODELSCATTERDATAMAPPING_P_H
+#define QITEMMODELSCATTERDATAMAPPING_P_H
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QItemModelScatterDataMappingPrivate : public QAbstractDataMappingPrivate
+{
+ Q_OBJECT
+public:
+ QItemModelScatterDataMappingPrivate(QItemModelScatterDataMapping *q);
+ virtual ~QItemModelScatterDataMappingPrivate();
+
+private:
+ //QString m_labelRole;
+ QString m_xPosRole;
+ QString m_yPosRole;
+ QString m_zPosRole;
+ //QString m_valueRole;
+
+ friend class QItemModelScatterDataMapping;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelscatterdataproxy.cpp b/src/datavisualization/data/qitemmodelscatterdataproxy.cpp
new file mode 100644
index 00000000..d647e5bc
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelscatterdataproxy.cpp
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qitemmodelscatterdataproxy_p.h"
+#include "scatteritemmodelhandler_p.h"
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QItemModelScatterDataProxy
+ * \inmodule QtDataVisualization
+ * \brief Proxy class for Q3DScatter data model mapping.
+ * \since 1.0.0
+ *
+ * QItemModelScatterDataProxy allows you to use QAbstractItemModel derived models as a data source
+ * for Q3DScatter. It maps roles defined in QItemModelScatterDataMapping to roles in the model.
+ */
+
+/*!
+ * Constructs QItemModelScatterDataProxy.
+ */
+QItemModelScatterDataProxy::QItemModelScatterDataProxy() :
+ QScatterDataProxy(new QItemModelScatterDataProxyPrivate(this))
+{
+}
+
+/*!
+ * Constructs QItemModelScatterDataProxy with \a itemModel and \a mapping. Does not take ownership
+ * of the model or the mapping, but does connect to them to listen for changes.
+ */
+QItemModelScatterDataProxy::QItemModelScatterDataProxy(const QAbstractItemModel *itemModel,
+ QItemModelScatterDataMapping *mapping) :
+ QScatterDataProxy(new QItemModelScatterDataProxyPrivate(this))
+{
+ dptr()->m_itemModelHandler->setItemModel(itemModel);
+ dptr()->m_itemModelHandler->setActiveMapping(mapping);
+}
+
+/*!
+ * Destroys QItemModelScatterDataProxy.
+ */
+QItemModelScatterDataProxy::~QItemModelScatterDataProxy()
+{
+}
+
+/*!
+ * \property QItemModelScatterDataProxy::itemModel
+ *
+ * Defines item model. Does not take ownership of the model, but does connect to it to listen for
+ * changes.
+ */
+void QItemModelScatterDataProxy::setItemModel(const QAbstractItemModel *itemModel)
+{
+ dptr()->m_itemModelHandler->setItemModel(itemModel);
+}
+
+const QAbstractItemModel *QItemModelScatterDataProxy::itemModel() const
+{
+ return dptrc()->m_itemModelHandler->itemModel();
+}
+
+/*!
+ * \property QItemModelScatterDataProxy::activeMapping
+ *
+ * Defines data mapping. Proxy takes ownership of the \a mapping.
+ * Modifying a mapping that is set to the proxy will trigger data set re-resolving.
+ */
+void QItemModelScatterDataProxy::setActiveMapping(QItemModelScatterDataMapping *mapping)
+{
+ dptr()->m_itemModelHandler->setActiveMapping(mapping);
+}
+
+QItemModelScatterDataMapping *QItemModelScatterDataProxy::activeMapping() const
+{
+ return static_cast<QItemModelScatterDataMapping *>(dptrc()->m_itemModelHandler->activeMapping());
+}
+
+/*!
+ * Transfers the ownership of the \a mapping to this proxy. The mapping is not taken to use yet.
+ * \sa setActiveMapping(), releaseMapping()
+ */
+void QItemModelScatterDataProxy::addMapping(QItemModelScatterDataMapping *mapping)
+{
+ dptr()->m_itemModelHandler->addMapping(mapping);
+}
+
+/*!
+ * Releases the ownership of the \a mapping back to the caller. If the mapping was the currently
+ * active one, no mapping remains active after this call.
+ */
+void QItemModelScatterDataProxy::releaseMapping(QItemModelScatterDataMapping *mapping)
+{
+ dptr()->m_itemModelHandler->releaseMapping(mapping);
+}
+
+/*!
+ * \return list of mappings owned by the proxy.
+ */
+QList<QItemModelScatterDataMapping *> QItemModelScatterDataProxy::mappings() const
+{
+ QList<QItemModelScatterDataMapping *> retList;
+ QList<QAbstractDataMapping *> abstractList = dptrc()->m_itemModelHandler->mappings();
+ foreach (QAbstractDataMapping *mapping, abstractList)
+ retList.append(static_cast<QItemModelScatterDataMapping *>(mapping));
+
+ return retList;
+}
+
+/*!
+ * \internal
+ */
+QItemModelScatterDataProxyPrivate *QItemModelScatterDataProxy::dptr()
+{
+ return static_cast<QItemModelScatterDataProxyPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \internal
+ */
+const QItemModelScatterDataProxyPrivate *QItemModelScatterDataProxy::dptrc() const
+{
+ return static_cast<const QItemModelScatterDataProxyPrivate *>(d_ptr.data());
+}
+
+// QItemModelScatterDataProxyPrivate
+
+QItemModelScatterDataProxyPrivate::QItemModelScatterDataProxyPrivate(QItemModelScatterDataProxy *q)
+ : QScatterDataProxyPrivate(q),
+ m_itemModelHandler(new ScatterItemModelHandler(q))
+{
+}
+
+QItemModelScatterDataProxyPrivate::~QItemModelScatterDataProxyPrivate()
+{
+ delete m_itemModelHandler;
+}
+
+QItemModelScatterDataProxy *QItemModelScatterDataProxyPrivate::qptr()
+{
+ return static_cast<QItemModelScatterDataProxy *>(q_ptr);
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/qitemmodelscatterdataproxy.h b/src/datavisualization/data/qitemmodelscatterdataproxy.h
new file mode 100644
index 00000000..891950c1
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelscatterdataproxy.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QITEMMODELSCATTERDATAPROXY_H
+#define QITEMMODELSCATTERDATAPROXY_H
+
+#include <QtDataVisualization/qscatterdataproxy.h>
+#include <QtDataVisualization/qitemmodelscatterdatamapping.h>
+#include <QAbstractItemModel>
+#include <QStringList>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QItemModelScatterDataProxyPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QItemModelScatterDataProxy : public QScatterDataProxy
+{
+ Q_OBJECT
+ Q_PROPERTY(const QAbstractItemModel* itemModel READ itemModel WRITE setItemModel)
+ Q_PROPERTY(QItemModelScatterDataMapping* activeMapping READ activeMapping WRITE setActiveMapping)
+
+public:
+ explicit QItemModelScatterDataProxy();
+ explicit QItemModelScatterDataProxy(const QAbstractItemModel *itemModel,
+ QItemModelScatterDataMapping *mapping);
+ virtual ~QItemModelScatterDataProxy();
+
+ void setItemModel(const QAbstractItemModel *itemModel);
+ const QAbstractItemModel *itemModel() const;
+
+ void setActiveMapping(QItemModelScatterDataMapping *mapping);
+ QItemModelScatterDataMapping *activeMapping() const;
+ void addMapping(QItemModelScatterDataMapping *mapping);
+ void releaseMapping(QItemModelScatterDataMapping *mapping);
+ QList<QItemModelScatterDataMapping *> mappings() const;
+
+protected:
+ QItemModelScatterDataProxyPrivate *dptr();
+ const QItemModelScatterDataProxyPrivate *dptrc() const;
+
+private:
+ Q_DISABLE_COPY(QItemModelScatterDataProxy)
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelscatterdataproxy_p.h b/src/datavisualization/data/qitemmodelscatterdataproxy_p.h
new file mode 100644
index 00000000..854062a3
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelscatterdataproxy_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QITEMMODELSCATTERDATAPROXY_P_H
+#define QITEMMODELSCATTERDATAPROXY_P_H
+
+#include "qitemmodelscatterdataproxy.h"
+#include "qscatterdataproxy_p.h"
+#include <QPointer>
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class ScatterItemModelHandler;
+
+class QItemModelScatterDataProxyPrivate : public QScatterDataProxyPrivate
+{
+ Q_OBJECT
+public:
+ QItemModelScatterDataProxyPrivate(QItemModelScatterDataProxy *q);
+ virtual ~QItemModelScatterDataProxyPrivate();
+
+private:
+ QItemModelScatterDataProxy *qptr();
+
+ ScatterItemModelHandler *m_itemModelHandler;
+
+ friend class QItemModelScatterDataProxy;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelsurfacedatamapping.cpp b/src/datavisualization/data/qitemmodelsurfacedatamapping.cpp
new file mode 100644
index 00000000..4b90f320
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelsurfacedatamapping.cpp
@@ -0,0 +1,223 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qitemmodelsurfacedatamapping_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QItemModelSurfaceDataMapping
+ * \inmodule QtDataVisualization
+ * \brief Data model mapping for Q3DSurface.
+ * \since 1.0.0
+ *
+ * DOCUMENTATION GOES HERE
+ *
+ * \sa QItemModelSurfaceDataProxy
+ */
+
+/*!
+ * Constructs QItemModelSurfaceDataMapping with the given \a parent.
+ */
+QItemModelSurfaceDataMapping::QItemModelSurfaceDataMapping(QObject *parent)
+ : QAbstractDataMapping(new QItemModelSurfaceDataMappingPrivate(this), parent)
+{
+}
+
+/*!
+ * Constructs QItemModelSurfaceDataMapping with \a valueRole and the given \a parent.
+ */
+QItemModelSurfaceDataMapping::QItemModelSurfaceDataMapping(const QString &valueRole, QObject *parent)
+ : QAbstractDataMapping(new QItemModelSurfaceDataMappingPrivate(this), parent)
+{
+ dptr()->m_valueRole = valueRole;
+}
+
+/*!
+ * Constructs QItemModelSurfaceDataMapping with \a rowRole, \a columnRole, \a valueRole,
+ * \a rowCategories, \a columnCategories and the given \a parent.
+ */
+QItemModelSurfaceDataMapping::QItemModelSurfaceDataMapping(const QString &rowRole,
+ const QString &columnRole,
+ const QString &valueRole,
+ const QStringList &rowCategories,
+ const QStringList &columnCategories,
+ QObject *parent)
+ : QAbstractDataMapping(new QItemModelSurfaceDataMappingPrivate(this), parent)
+{
+ dptr()->m_rowRole = rowRole;
+ dptr()->m_columnRole = columnRole;
+ dptr()->m_valueRole = valueRole;
+ dptr()->m_rowCategories = rowCategories;
+ dptr()->m_columnCategories = columnCategories;
+}
+
+/*!
+ * Destroys QItemModelSurfaceDataMapping.
+ */
+QItemModelSurfaceDataMapping::~QItemModelSurfaceDataMapping()
+{
+}
+
+/*!
+ * \property QItemModelSurfaceDataMapping::rowRole
+ *
+ * Defines the row role for the mapping.
+ */
+void QItemModelSurfaceDataMapping::setRowRole(const QString &role)
+{
+ dptr()->m_rowRole = role;
+ emit mappingChanged();
+}
+
+QString QItemModelSurfaceDataMapping::rowRole() const
+{
+ return dptrc()->m_rowRole;
+}
+
+/*!
+ * \property QItemModelSurfaceDataMapping::columnRole
+ *
+ * Defines the column role for the mapping.
+ */
+void QItemModelSurfaceDataMapping::setColumnRole(const QString &role)
+{
+ dptr()->m_columnRole = role;
+ emit mappingChanged();
+}
+
+QString QItemModelSurfaceDataMapping::columnRole() const
+{
+ return dptrc()->m_columnRole;
+}
+
+/*!
+ * \property QItemModelSurfaceDataMapping::valueRole
+ *
+ * Defines the value role for the mapping.
+ */
+void QItemModelSurfaceDataMapping::setValueRole(const QString &role)
+{
+ dptr()->m_valueRole = role;
+ emit mappingChanged();
+}
+
+QString QItemModelSurfaceDataMapping::valueRole() const
+{
+ return dptrc()->m_valueRole;
+}
+
+/*!
+ * \property QItemModelSurfaceDataMapping::rowCategories
+ *
+ * Defines the row categories for the mapping.
+ */
+void QItemModelSurfaceDataMapping::setRowCategories(const QStringList &categories)
+{
+ dptr()->m_rowCategories = categories;
+ emit mappingChanged();
+}
+
+QStringList QItemModelSurfaceDataMapping::rowCategories() const
+{
+ return dptrc()->m_rowCategories;
+}
+
+/*!
+ * \property QItemModelSurfaceDataMapping::columnCategories
+ *
+ * Defines the column categories for the mapping.
+ */
+void QItemModelSurfaceDataMapping::setColumnCategories(const QStringList &categories)
+{
+ dptr()->m_columnCategories = categories;
+ emit mappingChanged();
+}
+
+QStringList QItemModelSurfaceDataMapping::columnCategories() const
+{
+ return dptrc()->m_columnCategories;
+}
+
+/*!
+ * Changes \a rowRole, \a columnRole, \a valueRole, \a rowCategories and \a columnCategories to the
+ * mapping.
+ */
+void QItemModelSurfaceDataMapping::remap(const QString &rowRole,
+ const QString &columnRole,
+ const QString &valueRole,
+ const QStringList &rowCategories,
+ const QStringList &columnCategories)
+{
+ dptr()->m_rowRole = rowRole;
+ dptr()->m_columnRole = columnRole;
+ dptr()->m_valueRole = valueRole;
+ dptr()->m_rowCategories = rowCategories;
+ dptr()->m_columnCategories = columnCategories;
+
+ emit mappingChanged();
+}
+
+/*!
+ * /return index of the specified \a category in row categories list.
+ * If the category is not found, -1 is returned.
+ */
+int QItemModelSurfaceDataMapping::rowCategoryIndex(const QString &category)
+{
+ return dptr()->m_rowCategories.indexOf(category);
+}
+
+/*!
+ * /return index of the specified \a category in column categories list.
+ * If the category is not found, -1 is returned.
+ */
+int QItemModelSurfaceDataMapping::columnCategoryIndex(const QString &category)
+{
+ return dptr()->m_columnCategories.indexOf(category);
+}
+
+/*!
+ * \internal
+ */
+QItemModelSurfaceDataMappingPrivate *QItemModelSurfaceDataMapping::dptr()
+{
+ return static_cast<QItemModelSurfaceDataMappingPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \internal
+ */
+const QItemModelSurfaceDataMappingPrivate *QItemModelSurfaceDataMapping::dptrc() const
+{
+ return static_cast<const QItemModelSurfaceDataMappingPrivate *>(d_ptr.data());
+}
+
+// QItemModelSurfaceDataMappingPrivate
+
+QItemModelSurfaceDataMappingPrivate::QItemModelSurfaceDataMappingPrivate(QItemModelSurfaceDataMapping *q)
+ : QAbstractDataMappingPrivate(q, QAbstractDataProxy::DataTypeSurface)
+{
+}
+
+QItemModelSurfaceDataMappingPrivate::~QItemModelSurfaceDataMappingPrivate()
+{
+}
+
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
diff --git a/src/datavisualization/data/qitemmodelsurfacedatamapping.h b/src/datavisualization/data/qitemmodelsurfacedatamapping.h
new file mode 100644
index 00000000..1d937806
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelsurfacedatamapping.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QITEMMODELSURFACEDATAMAPPING_H
+#define QITEMMODELSURFACEDATAMAPPING_H
+
+#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QtDataVisualization/qabstractdatamapping.h>
+#include <QStringList>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QItemModelSurfaceDataMappingPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QItemModelSurfaceDataMapping : public QAbstractDataMapping
+{
+ Q_OBJECT
+ Q_PROPERTY(QString rowRole READ rowRole WRITE setRowRole)
+ Q_PROPERTY(QString columnRole READ columnRole WRITE setColumnRole)
+ Q_PROPERTY(QString valueRole READ valueRole WRITE setValueRole)
+ Q_PROPERTY(QStringList rowCategories READ rowCategories WRITE setRowCategories)
+ Q_PROPERTY(QStringList columnCategories READ columnCategories WRITE setColumnCategories)
+
+public:
+ explicit QItemModelSurfaceDataMapping(QObject *parent = 0);
+ QItemModelSurfaceDataMapping(const QString &valueRole, QObject *parent = 0);
+ QItemModelSurfaceDataMapping(const QString &rowRole, const QString &columnRole,
+ const QString &valueRole, const QStringList &rowCategories,
+ const QStringList &columnCategories, QObject *parent = 0);
+ virtual ~QItemModelSurfaceDataMapping();
+
+ void setRowRole(const QString &role);
+ QString rowRole() const;
+ void setColumnRole(const QString &role);
+ QString columnRole() const;
+ void setValueRole(const QString &role);
+ QString valueRole() const;
+
+ void setRowCategories(const QStringList &categories);
+ QStringList rowCategories() const;
+ void setColumnCategories(const QStringList &categories);
+ QStringList columnCategories() const;
+
+ void remap(const QString &rowRole, const QString &columnRole,
+ const QString &valueRole, const QStringList &rowCategories,
+ const QStringList &columnCategories);
+
+ Q_INVOKABLE int rowCategoryIndex(const QString& category);
+ Q_INVOKABLE int columnCategoryIndex(const QString& category);
+
+protected:
+ QItemModelSurfaceDataMappingPrivate *dptr();
+ const QItemModelSurfaceDataMappingPrivate *dptrc() const;
+
+private:
+ Q_DISABLE_COPY(QItemModelSurfaceDataMapping)
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelsurfacedatamapping_p.h b/src/datavisualization/data/qitemmodelsurfacedatamapping_p.h
new file mode 100644
index 00000000..69470423
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelsurfacedatamapping_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include "qitemmodelsurfacedatamapping.h"
+#include "qabstractdatamapping_p.h"
+
+#ifndef QITEMMODELSURFACEDATAMAPPING_P_H
+#define QITEMMODELSURFACEDATAMAPPING_P_H
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QItemModelSurfaceDataMappingPrivate : public QAbstractDataMappingPrivate
+{
+ Q_OBJECT
+public:
+ QItemModelSurfaceDataMappingPrivate(QItemModelSurfaceDataMapping *q);
+ virtual ~QItemModelSurfaceDataMappingPrivate();
+
+private:
+ QString m_rowRole;
+ QString m_columnRole;
+ QString m_valueRole;
+
+ // For row/column items, sort items into these categories. Other categories are ignored.
+ QStringList m_rowCategories;
+ QStringList m_columnCategories;
+
+ friend class QItemModelSurfaceDataMapping;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelsurfacedataproxy.cpp b/src/datavisualization/data/qitemmodelsurfacedataproxy.cpp
new file mode 100644
index 00000000..4e85542b
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelsurfacedataproxy.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qitemmodelsurfacedataproxy_p.h"
+#include "surfaceitemmodelhandler_p.h"
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+// TODO: CHECK DOCUMENTATION!
+
+/*!
+ * \class QItemModelSurfaceDataProxy
+ * \inmodule QtDataVisualization
+ * \brief Proxy class for Q3DSurface data model mapping.
+ * \since 1.0.0
+ *
+ * QItemModelSurfaceDataProxy allows you to use QAbstractItemModel derived models as a data source
+ * for Q3DSurface. It maps roles defined in QItemModelSurfaceDataMapping to roles in the model.
+ */
+
+/*!
+ * Constructs QItemModelSurfaceDataProxy.
+ */
+QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy() :
+ QSurfaceDataProxy(new QItemModelSurfaceDataProxyPrivate(this))
+{
+}
+
+/*!
+ * Constructs QItemModelSurfaceDataProxy with \a itemModel and \a mapping. Does not take ownership
+ * of the model or the mapping, but does connect to them to listen for changes.
+ */
+QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy(const QAbstractItemModel *itemModel,
+ QItemModelSurfaceDataMapping *mapping) :
+ QSurfaceDataProxy(new QItemModelSurfaceDataProxyPrivate(this))
+{
+ dptr()->m_itemModelHandler->setItemModel(itemModel);
+ dptr()->m_itemModelHandler->setActiveMapping(mapping);
+}
+
+/*!
+ * Destroys QItemModelSurfaceDataProxy.
+ */
+QItemModelSurfaceDataProxy::~QItemModelSurfaceDataProxy()
+{
+}
+
+/*!
+ * \property QItemModelSurfaceDataProxy::itemModel
+ *
+ * Defines item model. Does not take ownership of the model, but does connect to it to listen for
+ * changes.
+ */
+void QItemModelSurfaceDataProxy::setItemModel(const QAbstractItemModel *itemModel)
+{
+ dptr()->m_itemModelHandler->setItemModel(itemModel);
+}
+
+const QAbstractItemModel *QItemModelSurfaceDataProxy::itemModel() const
+{
+ return dptrc()->m_itemModelHandler->itemModel();
+}
+
+/*!
+ * \property QItemModelSurfaceDataProxy::activeMapping
+ *
+ * Defines data mapping. Proxy takes ownership of the \a mapping.
+ * Modifying a mapping that is set to the proxy will trigger data set re-resolving.
+ */
+void QItemModelSurfaceDataProxy::setActiveMapping(QItemModelSurfaceDataMapping *mapping)
+{
+ dptr()->m_itemModelHandler->setActiveMapping(mapping);
+}
+
+QItemModelSurfaceDataMapping *QItemModelSurfaceDataProxy::activeMapping() const
+{
+ return static_cast<QItemModelSurfaceDataMapping *>(dptrc()->m_itemModelHandler->activeMapping());
+}
+
+/*!
+ * Transfers the ownership of the \a mapping to this proxy. The mapping is not taken to use yet.
+ * \sa setActiveMapping(), releaseMapping()
+ */
+void QItemModelSurfaceDataProxy::addMapping(QItemModelSurfaceDataMapping *mapping)
+{
+ dptr()->m_itemModelHandler->addMapping(mapping);
+}
+
+/*!
+ * Releases the ownership of the \a mapping back to the caller. If the mapping was the currently
+ * active one, no mapping remains active after this call.
+ */
+void QItemModelSurfaceDataProxy::releaseMapping(QItemModelSurfaceDataMapping *mapping)
+{
+ dptr()->m_itemModelHandler->releaseMapping(mapping);
+}
+
+/*!
+ * \return list of mappings owned by the proxy.
+ */
+QList<QItemModelSurfaceDataMapping *> QItemModelSurfaceDataProxy::mappings() const
+{
+ QList<QItemModelSurfaceDataMapping *> retList;
+ QList<QAbstractDataMapping *> abstractList = dptrc()->m_itemModelHandler->mappings();
+ foreach (QAbstractDataMapping *mapping, abstractList)
+ retList.append(static_cast<QItemModelSurfaceDataMapping *>(mapping));
+
+ return retList;
+}
+
+/*!
+ * \internal
+ */
+QItemModelSurfaceDataProxyPrivate *QItemModelSurfaceDataProxy::dptr()
+{
+ return static_cast<QItemModelSurfaceDataProxyPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \internal
+ */
+const QItemModelSurfaceDataProxyPrivate *QItemModelSurfaceDataProxy::dptrc() const
+{
+ return static_cast<const QItemModelSurfaceDataProxyPrivate *>(d_ptr.data());
+}
+
+// QItemModelSurfaceDataProxyPrivate
+
+QItemModelSurfaceDataProxyPrivate::QItemModelSurfaceDataProxyPrivate(QItemModelSurfaceDataProxy *q)
+ : QSurfaceDataProxyPrivate(q),
+ m_itemModelHandler(new SurfaceItemModelHandler(q))
+{
+}
+
+QItemModelSurfaceDataProxyPrivate::~QItemModelSurfaceDataProxyPrivate()
+{
+ delete m_itemModelHandler;
+}
+
+QItemModelSurfaceDataProxy *QItemModelSurfaceDataProxyPrivate::qptr()
+{
+ return static_cast<QItemModelSurfaceDataProxy *>(q_ptr);
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/qitemmodelsurfacedataproxy.h b/src/datavisualization/data/qitemmodelsurfacedataproxy.h
new file mode 100644
index 00000000..080bf54b
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelsurfacedataproxy.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QITEMMODELSURFACEDATAPROXY_H
+#define QITEMMODELSURFACEDATAPROXY_H
+
+#include <QtDataVisualization/qsurfacedataproxy.h>
+#include <QtDataVisualization/qitemmodelsurfacedatamapping.h>
+#include <QAbstractItemModel>
+#include <QStringList>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QItemModelSurfaceDataProxyPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QItemModelSurfaceDataProxy : public QSurfaceDataProxy
+{
+ Q_OBJECT
+ Q_PROPERTY(const QAbstractItemModel* itemModel READ itemModel WRITE setItemModel)
+ Q_PROPERTY(QItemModelSurfaceDataMapping* activeMapping READ activeMapping WRITE setActiveMapping)
+
+public:
+ explicit QItemModelSurfaceDataProxy();
+ explicit QItemModelSurfaceDataProxy(const QAbstractItemModel *itemModel,
+ QItemModelSurfaceDataMapping *mapping);
+ virtual ~QItemModelSurfaceDataProxy();
+
+ void setItemModel(const QAbstractItemModel *itemModel);
+ const QAbstractItemModel *itemModel() const;
+
+ void setActiveMapping(QItemModelSurfaceDataMapping *mapping);
+ QItemModelSurfaceDataMapping *activeMapping() const;
+ void addMapping(QItemModelSurfaceDataMapping *mapping);
+ void releaseMapping(QItemModelSurfaceDataMapping *mapping);
+ QList<QItemModelSurfaceDataMapping *> mappings() const;
+
+protected:
+ QItemModelSurfaceDataProxyPrivate *dptr();
+ const QItemModelSurfaceDataProxyPrivate *dptrc() const;
+
+private:
+ Q_DISABLE_COPY(QItemModelSurfaceDataProxy)
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qitemmodelsurfacedataproxy_p.h b/src/datavisualization/data/qitemmodelsurfacedataproxy_p.h
new file mode 100644
index 00000000..ff9d13de
--- /dev/null
+++ b/src/datavisualization/data/qitemmodelsurfacedataproxy_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QITEMMODELSURFACEDATAPROXY_P_H
+#define QITEMMODELSURFACEDATAPROXY_P_H
+
+#include "qitemmodelsurfacedataproxy.h"
+#include "qsurfacedataproxy_p.h"
+#include <QPointer>
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class SurfaceItemModelHandler;
+
+class QItemModelSurfaceDataProxyPrivate : public QSurfaceDataProxyPrivate
+{
+ Q_OBJECT
+public:
+ QItemModelSurfaceDataProxyPrivate(QItemModelSurfaceDataProxy *q);
+ virtual ~QItemModelSurfaceDataProxyPrivate();
+
+private:
+ QItemModelSurfaceDataProxy *qptr();
+
+ SurfaceItemModelHandler *m_itemModelHandler;
+
+ friend class QItemModelSurfaceDataProxy;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qscatterdataitem.cpp b/src/datavisualization/data/qscatterdataitem.cpp
new file mode 100644
index 00000000..63bb32ec
--- /dev/null
+++ b/src/datavisualization/data/qscatterdataitem.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qscatterdataitem_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QScatterDataItem
+ * \inmodule QtDataVisualization
+ * \brief The QScatterDataItem class provides a container for resolved data to be added to scatter
+ * graphs.
+ * \since 1.0.0
+ *
+ * A QScatterDataItem holds data for a single rendered item in a scatter graph.
+ * Scatter data proxies parse data into QScatterDataItem instances for visualizing.
+ *
+ * \sa QScatterDataProxy, {Qt Data Visualization 3D C++ Classes}
+ */
+
+/*!
+ * Constructs QScatterDataItem.
+ */
+QScatterDataItem::QScatterDataItem()
+ : d_ptr(0) // private data doesn't exist by default (optimization)
+
+{
+}
+
+/*!
+ * Constructs QScatterDataItem with \a position.
+ */
+QScatterDataItem::QScatterDataItem(const QVector3D &position)
+ : d_ptr(0),
+ m_position(position)
+{
+}
+
+/*!
+ * Constructs a copy of \a other.
+ */
+QScatterDataItem::QScatterDataItem(const QScatterDataItem &other)
+{
+ operator=(other);
+}
+
+/*!
+ * Destroys QScatterDataItem.
+ */
+QScatterDataItem::~QScatterDataItem()
+{
+}
+
+/*!
+ * Assigns a copy of \a other to this object.
+ */
+QScatterDataItem &QScatterDataItem::operator=(const QScatterDataItem &other)
+{
+ m_position = other.m_position;
+ //m_size = other.m_size;
+
+ if (other.d_ptr)
+ createExtraData();
+ else
+ d_ptr = 0;
+ // TODO set extra data
+
+ return *this;
+}
+
+/*!
+ * Sets \a position to this data item.
+ */
+void QScatterDataItem::setPosition(const QVector3D &position)
+{
+ m_position = position;
+}
+
+/*!
+ * \return position of this data item.
+ */
+QVector3D QScatterDataItem::position() const
+{
+ return m_position;
+}
+
+//void QScatterDataItem::setSize(qreal size)
+//{
+// m_size = size;
+//}
+
+//const qreal &QScatterDataItem::size() const
+//{
+// return m_size;
+//}
+
+/*!
+ * \internal
+ */
+void QScatterDataItem::createExtraData()
+{
+ if (!d_ptr)
+ d_ptr = new QScatterDataItemPrivate;
+}
+
+QScatterDataItemPrivate::QScatterDataItemPrivate()
+{
+}
+
+QScatterDataItemPrivate::~QScatterDataItemPrivate()
+{
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/qscatterdataitem.h b/src/datavisualization/data/qscatterdataitem.h
new file mode 100644
index 00000000..42a27e92
--- /dev/null
+++ b/src/datavisualization/data/qscatterdataitem.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QSCATTERDATAITEM_H
+#define QSCATTERDATAITEM_H
+
+#include <QtDataVisualization/qdatavisualizationenums.h>
+#include <QVector3D>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QScatterDataItemPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QScatterDataItem
+{
+public:
+ QScatterDataItem();
+ QScatterDataItem(const QVector3D &position);
+ QScatterDataItem(const QScatterDataItem &other);
+ ~QScatterDataItem();
+
+ QScatterDataItem &operator=(const QScatterDataItem &other);
+
+ void setPosition(const QVector3D &position);
+ QVector3D position() const;
+
+ //void setSize(qreal size);
+ //qreal size() const;
+
+protected:
+ virtual void createExtraData();
+
+ QScatterDataItemPrivate *d_ptr;
+
+private:
+ QVector3D m_position;
+ //qreal m_size;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qscatterdataitem_p.h b/src/datavisualization/data/qscatterdataitem_p.h
new file mode 100644
index 00000000..acc67347
--- /dev/null
+++ b/src/datavisualization/data/qscatterdataitem_p.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QSCATTERDATAITEM_P_H
+#define QSCATTERDATAITEM_P_H
+
+#include "datavisualizationglobal_p.h"
+#include "qscatterdataitem.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QScatterDataItemPrivate
+{
+public:
+ QScatterDataItemPrivate();
+ virtual ~QScatterDataItemPrivate();
+
+ // TODO stores other data for scatter items besides position
+
+protected:
+ friend class QScatterDataItem;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qscatterdataproxy.cpp b/src/datavisualization/data/qscatterdataproxy.cpp
new file mode 100644
index 00000000..134b8a64
--- /dev/null
+++ b/src/datavisualization/data/qscatterdataproxy.cpp
@@ -0,0 +1,332 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qscatterdataproxy.h"
+#include "qscatterdataproxy_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * \class QScatterDataProxy
+ * \inmodule QtDataVisualization
+ * \brief Proxy class for Q3DScatter.
+ * \since 1.0.0
+ *
+ * QScatterDataProxy handles adding, inserting, changing and removing data items.
+ *
+ * QScatterDataProxy takes ownership of all QScatterDataArrays and QScatterDataItems passed to it.
+ *
+ * QScatterDataProxy supports the following format tags for QAbstractDataProxy::setItemLabelFormat():
+ * \table
+ * \row
+ * \li @xTitle \li Title from X axis
+ * \row
+ * \li @yTitle \li Title from Y axis
+ * \row
+ * \li @zTitle \li Title from Z axis
+ * \row
+ * \li @xLabel \li Item value formatted using the same format the X axis attached to the graph uses,
+ * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * \row
+ * \li @yLabel \li Item value formatted using the same format the Y axis attached to the graph uses,
+ * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * \row
+ * \li @zLabel \li Item value formatted using the same format the Z axis attached to the graph uses,
+ * see \l{Q3DValueAxis::setLabelFormat()} for more information.
+ * \endtable
+ *
+ * For example:
+ * \snippet doc_src_qtdatavisualization.cpp 2
+ */
+
+/*!
+ * Constructs QScatterDataProxy with the given \a parent.
+ */
+QScatterDataProxy::QScatterDataProxy(QObject *parent) :
+ QAbstractDataProxy(new QScatterDataProxyPrivate(this), parent)
+{
+}
+
+/*!
+ * \internal
+ */
+QScatterDataProxy::QScatterDataProxy(QScatterDataProxyPrivate *d, QObject *parent) :
+ QAbstractDataProxy(d, parent)
+{
+}
+
+/*!
+ * Destroys QScatterDataProxy.
+ */
+QScatterDataProxy::~QScatterDataProxy()
+{
+}
+
+/*!
+ * Clears the existing array and takes ownership of the \a newArray. Do not use \a newArray pointer
+ * to further modify data after QScatterDataProxy assumes ownership of it, as such modifications will
+ * not trigger proper signals.
+ * Passing null array clears all data.
+ */
+void QScatterDataProxy::resetArray(QScatterDataArray *newArray)
+{
+ if (dptr()->resetArray(newArray))
+ emit arrayReset();
+}
+
+/*!
+ * Changes a single item at \a index with \a item.
+ */
+void QScatterDataProxy::setItem(int index, const QScatterDataItem &item)
+{
+ dptr()->setItem(index, item);
+ emit itemsChanged(index, 1);
+}
+
+/*!
+ * Changes items starting from \a index with \a items.
+ */
+void QScatterDataProxy::setItems(int index, const QScatterDataArray &items)
+{
+ dptr()->setItems(index, items);
+ emit itemsChanged(index, items.size());
+}
+
+/*!
+ * Adds a single \a item to the end of the array.
+ *
+ * \return index of the added item.
+ */
+int QScatterDataProxy::addItem(const QScatterDataItem &item)
+{
+ int addIndex = dptr()->addItem(item);
+ emit itemsAdded(addIndex, 1);
+ return addIndex;
+}
+
+/*!
+ * Adds \a items to the end of the array.
+ *
+ * \return index of the first added item.
+ */
+int QScatterDataProxy::addItems(const QScatterDataArray &items)
+{
+ int addIndex = dptr()->addItems(items);
+ emit itemsAdded(addIndex, items.size());
+ return addIndex;
+}
+
+/*!
+ * Inserts a single \a item to \a index. If index is equal to data array size, item is added to
+ * the array.
+ */
+void QScatterDataProxy::insertItem(int index, const QScatterDataItem &item)
+{
+ dptr()->insertItem(index, item);
+ emit itemsInserted(index, 1);
+}
+
+/*!
+ * Inserts \a items to \a index. If index is equal to data array size, items are added to the array.
+ */
+void QScatterDataProxy::insertItems(int index, const QScatterDataArray &items)
+{
+ dptr()->insertItems(index, items);
+ emit itemsInserted(index, items.size());
+}
+
+/*!
+ * Removes \a removeCount items starting from \a index. Attempting to remove items past the end of
+ * the array does nothing.
+ */
+void QScatterDataProxy::removeItems(int index, int removeCount)
+{
+ dptr()->removeItems(index, removeCount);
+ emit itemsRemoved(index, removeCount);
+}
+
+/*!
+ * \return item count in the array.
+ */
+int QScatterDataProxy::itemCount() const
+{
+ return dptrc()->m_dataArray->size();
+}
+
+/*!
+ * \return pointer to the data array.
+ */
+const QScatterDataArray *QScatterDataProxy::array() const
+{
+ return dptrc()->m_dataArray;
+}
+
+/*!
+ * \return pointer to the item at \a index. It is guaranteed to be valid only until next call
+ * that modifies data.
+ */
+const QScatterDataItem *QScatterDataProxy::itemAt(int index) const
+{
+ return &dptrc()->m_dataArray->at(index);
+}
+
+/*!
+ * \internal
+ */
+QScatterDataProxyPrivate *QScatterDataProxy::dptr()
+{
+ return static_cast<QScatterDataProxyPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \internal
+ */
+const QScatterDataProxyPrivate *QScatterDataProxy::dptrc() const
+{
+ return static_cast<const QScatterDataProxyPrivate *>(d_ptr.data());
+}
+
+/*!
+ * \fn void QScatterDataProxy::arrayReset()
+ *
+ * Emitted when data array is reset.
+ */
+
+/*!
+ * \fn void QScatterDataProxy::itemsAdded(int startIndex, int count)
+ *
+ * Emitted when items have been added. Provides \a startIndex and \a count of items added.
+ */
+
+/*!
+ * \fn void QScatterDataProxy::itemsChanged(int startIndex, int count)
+ *
+ * Emitted when items have changed. Provides \a startIndex and \a count of changed items.
+ */
+
+/*!
+ * \fn void QScatterDataProxy::itemsRemoved(int startIndex, int count)
+ *
+ * Emitted when items have been removed. Provides \a startIndex and \a count of items removed.
+ * Index may be over current array size if removed from end.
+ */
+
+/*!
+ * \fn void QScatterDataProxy::itemsInserted(int startIndex, int count)
+ *
+ * Emitted when items have been inserted. Provides \a startIndex and \a count of inserted items.
+ */
+
+// QScatterDataProxyPrivate
+
+QScatterDataProxyPrivate::QScatterDataProxyPrivate(QScatterDataProxy *q)
+ : QAbstractDataProxyPrivate(q, QAbstractDataProxy::DataTypeScatter),
+ m_dataArray(new QScatterDataArray)
+{
+ m_itemLabelFormat = QStringLiteral("(@xLabel, @yLabel, @zLabel)");
+}
+
+QScatterDataProxyPrivate::~QScatterDataProxyPrivate()
+{
+ m_dataArray->clear();
+ delete m_dataArray;
+}
+
+bool QScatterDataProxyPrivate::resetArray(QScatterDataArray *newArray)
+{
+ if (!m_dataArray->size() && (!newArray || !newArray->size()))
+ return false;
+
+ m_dataArray->clear();
+ delete m_dataArray;
+
+ if (newArray)
+ m_dataArray = newArray;
+ else
+ m_dataArray = new QScatterDataArray;
+
+ return true;
+}
+
+void QScatterDataProxyPrivate::setItem(int index, const QScatterDataItem &item)
+{
+ Q_ASSERT(index >= 0 && index < m_dataArray->size());
+ (*m_dataArray)[index] = item;
+}
+
+void QScatterDataProxyPrivate::setItems(int index, const QScatterDataArray &items)
+{
+ Q_ASSERT(index >= 0 && (index + items.size()) <= m_dataArray->size());
+ for (int i = 0; i < items.size(); i++)
+ (*m_dataArray)[index++] = items[i];
+}
+
+int QScatterDataProxyPrivate::addItem(const QScatterDataItem &item)
+{
+ int currentSize = m_dataArray->size();
+ m_dataArray->append(item);
+ return currentSize;
+}
+
+int QScatterDataProxyPrivate::addItems(const QScatterDataArray &items)
+{
+ int currentSize = m_dataArray->size();
+ (*m_dataArray) += items;
+ return currentSize;
+}
+
+void QScatterDataProxyPrivate::insertItem(int index, const QScatterDataItem &item)
+{
+ Q_ASSERT(index >= 0 && index <= m_dataArray->size());
+ m_dataArray->insert(index, item);
+}
+
+void QScatterDataProxyPrivate::insertItems(int index, const QScatterDataArray &items)
+{
+ Q_ASSERT(index >= 0 && index <= m_dataArray->size());
+ for (int i = 0; i < items.size(); i++)
+ m_dataArray->insert(index++, items.at(i));
+}
+
+void QScatterDataProxyPrivate::removeItems(int index, int removeCount)
+{
+ Q_ASSERT(index >= 0);
+ int maxRemoveCount = m_dataArray->size() - index;
+ removeCount = qMin(removeCount, maxRemoveCount);
+ m_dataArray->remove(index, removeCount);
+}
+
+QVector3D QScatterDataProxyPrivate::limitValues()
+{
+ QVector3D limits;
+ for (int i = 0; i < m_dataArray->size(); i++) {
+ const QScatterDataItem &item = m_dataArray->at(i);
+ float xValue = qAbs(item.position().x());
+ if (limits.x() < xValue)
+ limits.setX(xValue);
+ float yValue = qAbs(item.position().y());
+ if (limits.y() < yValue)
+ limits.setY(yValue);
+ float zValue = qAbs(item.position().z());
+ if (limits.z() < zValue)
+ limits.setZ(zValue);
+ }
+ return limits;
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/qscatterdataproxy.h b/src/datavisualization/data/qscatterdataproxy.h
new file mode 100644
index 00000000..a1191c16
--- /dev/null
+++ b/src/datavisualization/data/qscatterdataproxy.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QSCATTERDATAPROXY_H
+#define QSCATTERDATAPROXY_H
+
+#include <QtDataVisualization/qabstractdataproxy.h>
+#include <QtDataVisualization/qscatterdataitem.h>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+typedef QVector<QScatterDataItem> QScatterDataArray;
+
+class QScatterDataProxyPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QScatterDataProxy : public QAbstractDataProxy
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int itemCount READ itemCount)
+public:
+ explicit QScatterDataProxy(QObject *parent = 0);
+ virtual ~QScatterDataProxy();
+
+ // TODO: Replace first part of class description in docs with this once all TODOs are done:
+ /*
+ * QScatterDataProxy handles adding, inserting, changing and removing data items.
+ * QScatterDataProxy is optimized to use cases where the only defining characteristics of an
+ * individual scatter item are it's position and size. Modifying other data that might be
+ * added in the future such as color requires allocating additional data object for the bar.
+ */
+
+ int itemCount() const;
+ const QScatterDataArray *array() const;
+ const QScatterDataItem *itemAt(int index) const;
+
+ void resetArray(QScatterDataArray *newArray);
+
+ void setItem(int index, const QScatterDataItem &item);
+ void setItems(int index, const QScatterDataArray &items);
+
+ int addItem(const QScatterDataItem &item);
+ int addItems(const QScatterDataArray &items);
+
+ void insertItem(int index, const QScatterDataItem &item);
+ void insertItems(int index, const QScatterDataArray &items);
+
+ void removeItems(int index, int removeCount);
+
+signals:
+ void arrayReset();
+ void itemsAdded(int startIndex, int count);
+ void itemsChanged(int startIndex, int count);
+ void itemsRemoved(int startIndex, int count);
+ void itemsInserted(int startIndex, int count);
+
+protected:
+ explicit QScatterDataProxy(QScatterDataProxyPrivate *d, QObject *parent = 0);
+ QScatterDataProxyPrivate *dptr();
+ const QScatterDataProxyPrivate *dptrc() const;
+
+private:
+ Q_DISABLE_COPY(QScatterDataProxy)
+
+ friend class Scatter3DController;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/qscatterdataproxy_p.h b/src/datavisualization/data/qscatterdataproxy_p.h
new file mode 100644
index 00000000..fe06fcf9
--- /dev/null
+++ b/src/datavisualization/data/qscatterdataproxy_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QSCATTERDATAPROXY_P_H
+#define QSCATTERDATAPROXY_P_H
+
+#include "qscatterdataproxy.h"
+#include "qabstractdataproxy_p.h"
+#include "qscatterdataitem.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QScatterDataProxyPrivate : public QAbstractDataProxyPrivate
+{
+ Q_OBJECT
+public:
+ QScatterDataProxyPrivate(QScatterDataProxy *q);
+ virtual ~QScatterDataProxyPrivate();
+
+ bool resetArray(QScatterDataArray *newArray);
+ void setItem(int index, const QScatterDataItem &item);
+ void setItems(int index, const QScatterDataArray &items);
+ int addItem(const QScatterDataItem &item);
+ int addItems(const QScatterDataArray &items);
+ void insertItem(int index, const QScatterDataItem &item);
+ void insertItems(int index, const QScatterDataArray &items);
+ void removeItems(int index, int removeCount);
+
+ QVector3D limitValues();
+
+private:
+ QScatterDataArray *m_dataArray;
+
+ friend class QScatterDataProxy;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QBARDATAPROXY_P_H
diff --git a/src/datavisualization/data/qsurfacedataproxy.cpp b/src/datavisualization/data/qsurfacedataproxy.cpp
new file mode 100644
index 00000000..9fcc4bc8
--- /dev/null
+++ b/src/datavisualization/data/qsurfacedataproxy.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qsurfacedataproxy.h"
+#include "qsurfacedataproxy_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+/*!
+ * Constructs QSurfaceDataProxy with the given \a parent.
+ */
+QSurfaceDataProxy::QSurfaceDataProxy(QObject *parent) :
+ QAbstractDataProxy(new QSurfaceDataProxyPrivate(this), parent)
+{
+}
+
+/*!
+ * \internal
+ */
+QSurfaceDataProxy::QSurfaceDataProxy(QSurfaceDataProxyPrivate *d, QObject *parent) :
+ QAbstractDataProxy(d, parent)
+{
+}
+
+/*!
+ * Destroys QSurfaceDataProxy.
+ */
+QSurfaceDataProxy::~QSurfaceDataProxy()
+{
+}
+
+void QSurfaceDataProxy::resetArray(QSurfaceDataArray *newArray)
+{
+ if (dptr()->resetArray(newArray))
+ emit arrayReset();
+}
+
+const QSurfaceDataArray *QSurfaceDataProxy::array() const
+{
+ return dptrc()->m_dataArray;
+}
+
+const QSurfaceDataItem *QSurfaceDataProxy::itemAt(int index) const
+{
+ return &dptrc()->m_dataArray->at(index)->at(2);
+}
+
+QSurfaceDataProxyPrivate *QSurfaceDataProxy::dptr()
+{
+ return static_cast<QSurfaceDataProxyPrivate *>(d_ptr.data());
+}
+
+const QSurfaceDataProxyPrivate *QSurfaceDataProxy::dptrc() const
+{
+ return static_cast<const QSurfaceDataProxyPrivate *>(d_ptr.data());
+}
+
+//
+// QSurfaceDataProxyPrivate
+//
+
+QSurfaceDataProxyPrivate::QSurfaceDataProxyPrivate(QSurfaceDataProxy *q)
+ : QAbstractDataProxyPrivate(q, QAbstractDataProxy::DataTypeSurface),
+ m_dataArray(new QSurfaceDataArray)
+{
+ m_itemLabelFormat = QStringLiteral("(@yLabel)");
+}
+
+QSurfaceDataProxyPrivate::~QSurfaceDataProxyPrivate()
+{
+ m_dataArray->clear();
+ delete m_dataArray;
+}
+
+bool QSurfaceDataProxyPrivate::resetArray(QSurfaceDataArray *newArray)
+{
+ if (!m_dataArray->size() && (!newArray || !newArray->size()))
+ return false;
+
+ m_dataArray->clear();
+ delete m_dataArray;
+
+ if (newArray)
+ m_dataArray = newArray;
+ else
+ m_dataArray = new QSurfaceDataArray;
+
+ return true;
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/qsurfacedataproxy.h b/src/datavisualization/data/qsurfacedataproxy.h
new file mode 100644
index 00000000..8932574c
--- /dev/null
+++ b/src/datavisualization/data/qsurfacedataproxy.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#ifndef QSURFACEDATAPROXY_H
+#define QSURFACEDATAPROXY_H
+
+#include <QtDataVisualization/qdatavisualizationglobal.h>
+#include <QtDataVisualization/qabstractdataproxy.h>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+typedef qreal QSurfaceDataItem; // Let's stick to this for now, expand if needed
+typedef QVector<QSurfaceDataItem> QSurfaceDataRow;
+typedef QList<QSurfaceDataRow *> QSurfaceDataArray;
+
+class QSurfaceDataProxyPrivate;
+
+class QT_DATAVISUALIZATION_EXPORT QSurfaceDataProxy : public QAbstractDataProxy
+{
+ Q_OBJECT
+
+public:
+ explicit QSurfaceDataProxy(QObject *parent = 0);
+ virtual ~QSurfaceDataProxy();
+
+ int itemCount() const;
+ const QSurfaceDataArray *array() const;
+ const QSurfaceDataItem *itemAt(int index) const;
+
+ void resetArray(QSurfaceDataArray *newArray);
+
+signals:
+ void arrayReset();
+
+protected:
+ explicit QSurfaceDataProxy(QSurfaceDataProxyPrivate *d, QObject *parent = 0);
+ QSurfaceDataProxyPrivate *dptr();
+ const QSurfaceDataProxyPrivate *dptrc() const;
+
+private:
+ Q_DISABLE_COPY(QSurfaceDataProxy)
+
+ friend class Surface3DController;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QSURFACEDATAPROXY_H
diff --git a/src/datavisualization/data/qsurfacedataproxy_p.h b/src/datavisualization/data/qsurfacedataproxy_p.h
new file mode 100644
index 00000000..37663a87
--- /dev/null
+++ b/src/datavisualization/data/qsurfacedataproxy_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QSURFACEDATAPROXY_P_H
+#define QSURFACEDATAPROXY_P_H
+
+#include "qsurfacedataproxy.h"
+#include "qabstractdataproxy_p.h"
+
+#include <QSize>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class QSurfaceDataProxyPrivate : public QAbstractDataProxyPrivate
+{
+ Q_OBJECT
+public:
+ QSurfaceDataProxyPrivate(QSurfaceDataProxy *q);
+ virtual ~QSurfaceDataProxyPrivate();
+
+ bool resetArray(QSurfaceDataArray *newArray);
+
+private:
+ QSurfaceDataArray *m_dataArray;
+
+ friend class QSurfaceDataProxy;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // QSURFACEDATAPROXY_P_H
diff --git a/src/datavisualization/data/scatteritemmodelhandler.cpp b/src/datavisualization/data/scatteritemmodelhandler.cpp
new file mode 100644
index 00000000..a6430297
--- /dev/null
+++ b/src/datavisualization/data/scatteritemmodelhandler.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "scatteritemmodelhandler_p.h"
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+ScatterItemModelHandler::ScatterItemModelHandler(QItemModelScatterDataProxy *proxy, QObject *parent)
+ : AbstractItemModelHandler(parent),
+ m_proxy(proxy)
+{
+}
+
+ScatterItemModelHandler::~ScatterItemModelHandler()
+{
+}
+
+// Resolve entire item model into QScatterDataArray.
+void ScatterItemModelHandler::resolveModel()
+{
+ QItemModelScatterDataMapping *mapping = static_cast<QItemModelScatterDataMapping *>(m_activeMapping);
+ if (m_itemModel.isNull() || !mapping) {
+ m_proxy->resetArray(0);
+ return;
+ }
+
+ static const int noRoleIndex = -1;
+
+ QHash<int, QByteArray> roleHash = m_itemModel->roleNames();
+ //const int labelRole = roleHash.key(mapping->labelRole().toLatin1(), noRoleIndex);
+ const int xPosRole = roleHash.key(mapping->xPosRole().toLatin1(), noRoleIndex);
+ const int yPosRole = roleHash.key(mapping->yPosRole().toLatin1(), noRoleIndex);
+ const int zPosRole = roleHash.key(mapping->zPosRole().toLatin1(), noRoleIndex);
+ // Default valueRole to display role if no mapping
+ //const int valueRole = roleHash.key(mapping->valueRole().toLatin1(), Qt::DisplayRole);
+ const int columnCount = m_itemModel->columnCount();
+ const int rowCount = m_itemModel->rowCount();
+ const int totalCount = rowCount * columnCount;
+ int runningCount = 0;
+
+ // Parse data into newProxyArray
+ QScatterDataArray *newProxyArray = new QScatterDataArray(totalCount);
+ for (int i = 0; i < rowCount; i++) {
+ for (int j = 0; j < columnCount; j++) {
+ QModelIndex index = m_itemModel->index(i, j);
+ //if (labelRole != noRoleIndex)
+ // (*newProxyArray)[runningCount].setLabel(index.data(labelRole).toString());
+ float xPos(0.0f);
+ float yPos(0.0f);
+ float zPos(0.0f);
+ if (xPosRole != noRoleIndex)
+ xPos = index.data(xPosRole).toFloat();
+ if (yPosRole != noRoleIndex)
+ yPos = index.data(yPosRole).toFloat();
+ if (zPosRole != noRoleIndex)
+ zPos = index.data(zPosRole).toFloat();
+ (*newProxyArray)[runningCount].setPosition(QVector3D(xPos, yPos, zPos));
+ //(*newProxyArray)[runningCount].setValue(index.data(valueRole).toReal());
+ runningCount++;
+ }
+ }
+
+ m_proxy->resetArray(newProxyArray);
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/scatteritemmodelhandler_p.h b/src/datavisualization/data/scatteritemmodelhandler_p.h
new file mode 100644
index 00000000..c39bc57f
--- /dev/null
+++ b/src/datavisualization/data/scatteritemmodelhandler_p.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef SCATTERITEMMODELHANDLER_P_H
+#define SCATTERITEMMODELHANDLER_P_H
+
+#include "abstractitemmodelhandler_p.h"
+#include "qitemmodelscatterdataproxy.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class ScatterItemModelHandler : public AbstractItemModelHandler
+{
+ Q_OBJECT
+public:
+ ScatterItemModelHandler(QItemModelScatterDataProxy *proxy, QObject *parent = 0);
+ virtual ~ScatterItemModelHandler();
+
+protected:
+ void virtual resolveModel();
+
+ QItemModelScatterDataProxy *m_proxy; // Not owned
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/scatterrenderitem.cpp b/src/datavisualization/data/scatterrenderitem.cpp
new file mode 100644
index 00000000..1fd7ad97
--- /dev/null
+++ b/src/datavisualization/data/scatterrenderitem.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "scatterrenderitem_p.h"
+#include "scatter3drenderer_p.h"
+#include "qscatterdataproxy.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+ScatterRenderItem::ScatterRenderItem()
+ : AbstractRenderItem()
+{
+}
+
+ScatterRenderItem::ScatterRenderItem(const ScatterRenderItem &other)
+ : AbstractRenderItem(other)
+{
+ m_position = other.m_position;
+}
+
+ScatterRenderItem::~ScatterRenderItem()
+{
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/scatterrenderitem_p.h b/src/datavisualization/data/scatterrenderitem_p.h
new file mode 100644
index 00000000..09c1246e
--- /dev/null
+++ b/src/datavisualization/data/scatterrenderitem_p.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef SCATTERRENDERITEM_P_H
+#define SCATTERRENDERITEM_P_H
+
+#include "abstractrenderitem_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class Scatter3DRenderer;
+
+class ScatterRenderItem : public AbstractRenderItem
+{
+public:
+ ScatterRenderItem();
+ ScatterRenderItem(const ScatterRenderItem &other);
+ virtual ~ScatterRenderItem();
+
+ inline const QVector3D &position() const { return m_position; }
+ inline void setPosition(const QVector3D &pos);
+
+ //inline void setSize(qreal size);
+ //inline qreal size() const { return m_size; }
+
+protected:
+ QVector3D m_position;
+ //qreal m_size; // TODO in case we need a fourth variable that adjusts scatter item size
+
+ friend class QScatterDataItem;
+};
+
+void ScatterRenderItem::setPosition(const QVector3D &pos)
+{
+ if (m_position != pos) {
+ m_position = pos;
+ // Force reformatting on next access by setting label string to null string
+ if (!m_selectionLabel.isNull())
+ setSelectionLabel(QString());
+ }
+}
+
+typedef QVector<ScatterRenderItem> ScatterRenderItemArray;
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/data/surfaceitemmodelhandler.cpp b/src/datavisualization/data/surfaceitemmodelhandler.cpp
new file mode 100644
index 00000000..911e2995
--- /dev/null
+++ b/src/datavisualization/data/surfaceitemmodelhandler.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "surfaceitemmodelhandler_p.h"
+#include <QTimer>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+SurfaceItemModelHandler::SurfaceItemModelHandler(QItemModelSurfaceDataProxy *proxy, QObject *parent)
+ : AbstractItemModelHandler(parent),
+ m_proxy(proxy)
+{
+}
+
+SurfaceItemModelHandler::~SurfaceItemModelHandler()
+{
+}
+
+// Resolve entire item model into QSurfaceDataArray.
+void SurfaceItemModelHandler::resolveModel()
+{
+ QItemModelSurfaceDataMapping *mapping = static_cast<QItemModelSurfaceDataMapping *>(m_activeMapping);
+ if (m_itemModel.isNull() || !mapping) {
+ m_proxy->resetArray(0);
+ return;
+ }
+
+ bool useModelRows(false);
+ if (!mapping->rowCategories().size() || !mapping->columnCategories().size()) {
+ useModelRows = true;
+ } else if (mapping->rowRole().isEmpty() || mapping->columnRole().isEmpty()) {
+ m_proxy->resetArray(0);
+ return;
+ }
+
+ QSurfaceDataArray *newProxyArray = new QSurfaceDataArray;
+ QHash<int, QByteArray> roleHash = m_itemModel->roleNames();
+ // Default to display role if no mapping
+ int valueRole = roleHash.key(mapping->valueRole().toLatin1(), Qt::DisplayRole);
+ int rowCount = m_itemModel->rowCount();
+ int columnCount = m_itemModel->columnCount();
+
+ if (useModelRows) {
+ for (int i = 0; i < rowCount; i++) {
+ QSurfaceDataRow *newProxyRow = new QSurfaceDataRow(columnCount);
+ for (int j = 0; j < columnCount; j++)
+ (*newProxyRow)[j] = m_itemModel->index(i, j).data(valueRole).toReal();
+ newProxyArray->append(newProxyRow);
+ }
+ } else {
+ int rowRole = roleHash.key(mapping->rowRole().toLatin1());
+ int columnRole = roleHash.key(mapping->columnRole().toLatin1());
+ const QStringList &rowList = mapping->rowCategories();
+ const QStringList &columnList = mapping->columnCategories();
+
+ // Sort values into rows and columns
+ typedef QHash<QString, qreal> ColumnValueMap;
+ QHash <QString, ColumnValueMap> itemValueMap;
+ for (int i = 0; i < rowCount; i++) {
+ for (int j = 0; j < columnCount; j++) {
+ QModelIndex index = m_itemModel->index(i, j);
+ itemValueMap[index.data(rowRole).toString()][index.data(columnRole).toString()]
+ = index.data(valueRole).toReal();
+ }
+ }
+
+ // Create new data array from itemValueMap
+ foreach (QString rowKey, rowList) {
+ QSurfaceDataRow *newProxyRow = new QSurfaceDataRow(columnList.size());
+ for (int i = 0; i < columnList.size(); i++)
+ (*newProxyRow)[i] = itemValueMap[rowKey][columnList.at(i)];
+ newProxyArray->append(newProxyRow);
+ }
+ }
+
+ m_proxy->resetArray(newProxyArray);
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/data/surfaceitemmodelhandler_p.h b/src/datavisualization/data/surfaceitemmodelhandler_p.h
new file mode 100644
index 00000000..045ac379
--- /dev/null
+++ b/src/datavisualization/data/surfaceitemmodelhandler_p.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef SURFACEITEMMODELHANDLER_P_H
+#define SURFACEITEMMODELHANDLER_P_H
+
+#include "abstractitemmodelhandler_p.h"
+#include "qitemmodelsurfacedataproxy.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class SurfaceItemModelHandler : public AbstractItemModelHandler
+{
+ Q_OBJECT
+public:
+ SurfaceItemModelHandler(QItemModelSurfaceDataProxy *proxy, QObject *parent = 0);
+ virtual ~SurfaceItemModelHandler();
+
+protected:
+ void virtual resolveModel();
+
+ QItemModelSurfaceDataProxy *m_proxy; // Not owned
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/datavisualization.pro b/src/datavisualization/datavisualization.pro
new file mode 100644
index 00000000..58ec4b19
--- /dev/null
+++ b/src/datavisualization/datavisualization.pro
@@ -0,0 +1,32 @@
+TARGET = QtDataVisualization
+QT = core gui
+
+DEFINES += QT_DATAVISUALIZATION_LIBRARY
+
+QMAKE_DOCS = $$PWD/doc/qtdatavisualization.qdocconf
+
+load(qt_module)
+
+include($$PWD/common.pri)
+include($$PWD/engine/engine.pri)
+include($$PWD/global/global.pri)
+include($$PWD/utils/utils.pri)
+include($$PWD/axis/axis.pri)
+include($$PWD/data/data.pri)
+include($$PWD/input/input.pri)
+
+wince* {
+ # The Microsoft MIPS compiler crashes if /Og is specified.
+ # -O2/1 expands to /Og plus additional arguments.
+ contains(DEFINES, MIPS) {
+ QMAKE_CXXFLAGS_RELEASE ~= s/-O2/-Oi -Ot -Oy -Ob2/
+ QMAKE_CXXFLAGS_RELEASE ~= s/-O1/-Os -Oy -Ob2/
+ }
+}
+
+OTHER_FILES += doc/qtdatavisualization.qdocconf \
+ doc/src/* \
+ doc/images/* \
+ doc/snippets/* \
+ global/*.qdoc
+
diff --git a/src/datavisualization/doc/images/q3dbars-minimal.png b/src/datavisualization/doc/images/q3dbars-minimal.png
new file mode 100644
index 00000000..fff8d415
--- /dev/null
+++ b/src/datavisualization/doc/images/q3dbars-minimal.png
Binary files differ
diff --git a/src/datavisualization/doc/images/q3dscatter-minimal.png b/src/datavisualization/doc/images/q3dscatter-minimal.png
new file mode 100644
index 00000000..1c3290b3
--- /dev/null
+++ b/src/datavisualization/doc/images/q3dscatter-minimal.png
Binary files differ
diff --git a/src/datavisualization/doc/qtdatavisualization.qdocconf b/src/datavisualization/doc/qtdatavisualization.qdocconf
new file mode 100644
index 00000000..016fbe0c
--- /dev/null
+++ b/src/datavisualization/doc/qtdatavisualization.qdocconf
@@ -0,0 +1,33 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+
+project = QtDataVisualization
+description = Qt Data Visualization Reference Documentation
+version = 1.0.0
+
+exampledirs += ../../../examples \
+ snippets
+
+headerdirs += ..
+imagedirs += ../images \
+ images
+sourcedirs += ..
+
+depends += qtcore \
+ qtgui
+
+qhp.projects = qtdatavisualization
+
+qhp.qtdatavisualization.file = qtdatavisualization.qhp
+qhp.qtdatavisualization.namespace = org.qt-project.qtdatavisualization.1.0.0
+qhp.qtdatavisualization.virtualFolder = qtdatavisualization
+qhp.qtdatavisualization.indexTitle = Qt Data Visualization
+qhp.qtdatavisualization.indexRoot =
+
+qhp.qtdatavisualization.filterAttributes = qtdatavisualization 1.0.0 qtrefdoc
+qhp.qtdatavisualization.customFilters.Qt.name = QtDataVisualization 1.0.0
+qhp.qtdatavisualization.customFilters.Qt.filterAttributes = qtdatavisualization 1.0.0
+qhp.qtdatavisualization.subprojects = classes
+qhp.qtdatavisualization.subprojects.classes.title = C++ Classes
+qhp.qtdatavisualization.subprojects.classes.indexTitle = Qt Data Visualization C++ Classes
+qhp.qtdatavisualization.subprojects.classes.selectors = class fake:headerfile
+qhp.qtdatavisualization.subprojects.classes.sortPages = true
diff --git a/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp b/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp
new file mode 100644
index 00000000..85f2d7b4
--- /dev/null
+++ b/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//! [3]
+#include <QtDataVisualization>
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ //! [0]
+ Q3DBars *bars = new Q3DBars();
+ bars->setDataWindow(5, 5);
+ //! [0]
+ //! [1]
+ QBarDataRow data;
+ data << 1.0 << 3.0 << 7.5 << 5.0 << 2.2;
+ bars->dataProxy()->addRow(&data);
+ //! [1]
+ //! [2]
+ bars->show();
+ //! [2]
+
+ return app.exec();
+}
+//! [3]
diff --git a/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp b/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp
new file mode 100644
index 00000000..deac1715
--- /dev/null
+++ b/src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//! [3]
+#include <QtDataVisualization>
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ //! [0]
+ Q3DScatter *scatter = new Q3DScatter();
+ //! [0]
+ //! [1]
+ QScatterDataArray data;
+ data << QVector3D(1.0f, 0.5f, 1.0f) << QVector3D(-1.0f, -0.5f, -1.0f) << QVector3D(0.5f, 0.0f, 0.0f);
+ scatter->dataProxy()->addItems(data);
+ //! [1]
+ //! [2]
+ scatter->show();
+ //! [2]
+
+ return app.exec();
+}
+//! [3]
diff --git a/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp
new file mode 100644
index 00000000..f4df32d5
--- /dev/null
+++ b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//! [0]
+#include <QtDataVisualization>
+//! [0]
+
+//! [1]
+proxy->setItemLabelFormat(QStringLiteral("@valueTitle for (@rowLabel, @colLabel): %.1f"));
+//! [1]
+
+//! [2]
+proxy->setItemLabelFormat(QStringLiteral("@xTitle: @xValue, @yTitle: @yValue, @zTitle: @zValue"));
+//! [2]
+
+//! [3]
+// By defining row and column categories, you tell the mapping which row and column each item
+// belongs to. The categories must match the data stored in the model in the roles you define
+// for row and column mapping. In this example we expect "year" role to return four digit year
+// and "month" to return three letter designation for the month.
+//
+// An example of an item in model would be:
+// Requested role -> Returned data
+// "year" -> "2006" // Matches the first row category, so this item is added to the first row.
+// "month" -> "jan" // Matches the first column category, so this item is added as first item in the row.
+// "income" -> "12.1"
+// "expenses" -> "9.2"
+QStringList years;
+QStringList months;
+years << "2006" << "2007" << "2008" << "2009" << "2010" << "2011" << "2012";
+months << "jan" << "feb" << "mar" << "apr" << "may" << "jun" << "jul" << "aug" << "sep" << "oct" << "nov" << "dec";
+
+QItemModelBarDataMapping *mapping = new QItemModelBarDataMapping(QStringLiteral("year"), // Row role
+ QStringLiteral("month"), // Column role
+ QStringLiteral("income"), // Value role
+ years, // Row categories
+ months); // Column categories
+
+QItemModelBarDataProxy *proxy = new QItemModelBarDataProxy(customModel, mapping);
+
+//...
+
+// To display different data later, you can simply change the mapping of the current
+// mapping object, or set another mapping object.
+proxy->activeMapping()->setValueRole(QStringLiteral("expenses"));
+//! [3]
+
+//! [4]
+// Map "density" value to X-axis, "hardness" to Y-axis and "conductivity" to Z-axis.
+QItemModelScatterDataMapping *mapping = new QItemModelScatterDataMapping(QStringLiteral("density"),
+ QStringLiteral("hardness"),
+ QStringLiteral("conductivity"))
+QItemModelScatterDataProxy *proxy = new QItemModelScatterDataProxy(customModel, mapping);
+//! [4]
diff --git a/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.pro b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.pro
new file mode 100644
index 00000000..81555f88
--- /dev/null
+++ b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.pro
@@ -0,0 +1,21 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#! [0]
+QT += datavisualization
+#! [0]
diff --git a/src/datavisualization/doc/src/qtdatavisualization-index.qdoc b/src/datavisualization/doc/src/qtdatavisualization-index.qdoc
new file mode 100644
index 00000000..d3afaf3b
--- /dev/null
+++ b/src/datavisualization/doc/src/qtdatavisualization-index.qdoc
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+/*!
+ \title Qt Data Visualization
+ \page qtdatavisualization-index.html
+ \brief QtDataVisualization module provides functionality for 3D visualization.
+
+ Qt Data Visualization module provides a way to visualize data in 3D.
+ It uses OpneGL for the data rendering.
+
+ \section1 Getting Started
+
+ Qt Data Visualization provides classes for rendering 3D data. To include
+ the definitions of the module's classes, use the following directive:
+
+ \snippet doc_src_qtdatavisualization.cpp 0
+
+ To link against the module, add this line to your qmake \c
+ .pro file:
+
+ \snippet doc_src_qtdatavisualization.pro 0
+
+ \section1 Articles
+ \list
+ \li \l{Qt Data Visualization License Information}{License Information}
+ \endlist
+
+ \section1 References
+ \list
+ \li \l{Qt Data Visualization C++ Classes}
+ \endlist
+
+ Qt Data Visualization comes with the following examples:
+
+ \list
+ \li \l{Barchart Example}
+ \li \l{Qt Quick 2 Barchart Example}
+ \li \l{Qt Quick 2 Scatter Example}
+ \li \l{Rainfall Example}
+ \li \l{Scatter Chart Example}
+ \li \l{Audiolevels Example}
+ \li \l{Widget Example}
+ \endlist
+*/
diff --git a/src/datavisualization/doc/src/qtdatavisualization.qdoc b/src/datavisualization/doc/src/qtdatavisualization.qdoc
new file mode 100644
index 00000000..5ddd0720
--- /dev/null
+++ b/src/datavisualization/doc/src/qtdatavisualization.qdoc
@@ -0,0 +1,26 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+/*!
+ \module QtDataVisualization
+ \title Qt Data Visualization C++ Classes
+ \ingroup modules
+
+ \brief The QtDataVisualization module provides functionality for 3D visualization.
+*/
+
diff --git a/src/datavisualization/doc/src/qtdatavisualizationlicense.qdoc b/src/datavisualization/doc/src/qtdatavisualizationlicense.qdoc
new file mode 100644
index 00000000..16c1ed70
--- /dev/null
+++ b/src/datavisualization/doc/src/qtdatavisualizationlicense.qdoc
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+/*!
+ \page qtdatavisualizationlicense.html
+ \title Qt Data Visualization License Information
+ \ingroup licensing
+ \brief License information for Qt Data Visualization
+
+ \legalese
+ Copyright 2013 Digia.
+
+ Qt and Qt logos are trademarks of of Digia Corporation in Finland and/or other countries
+ worldwide.
+
+ All other trademarks are property of their respective owners.
+
+ Licensees holding valid Qt Enterprise licenses may use this document in accordance with the
+ Qt Enterprise License Agreement provided with the Software or, alternatively, in accordance
+ with the terms contained in a written agreement between you and Digia.
+ \endlegalese
+*/
diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp
new file mode 100644
index 00000000..2f3476dc
--- /dev/null
+++ b/src/datavisualization/engine/abstract3dcontroller.cpp
@@ -0,0 +1,1057 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "abstract3dcontroller_p.h"
+#include "camerahelper_p.h"
+#include "q3dabstractaxis_p.h"
+#include "q3dvalueaxis.h"
+#include "q3dcategoryaxis.h"
+#include "abstract3drenderer_p.h"
+#include "q3dcamera.h"
+#include "q3dlight.h"
+#include "qabstractdataproxy_p.h"
+#include "qabstract3dinputhandler.h"
+
+#if defined(Q_OS_ANDROID)
+#include "qtouch3dinputhandler.h"
+#else
+#include "q3dinputhandler.h"
+#endif
+
+#include <QThread>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+Abstract3DController::Abstract3DController(QRect boundRect, QObject *parent) :
+ QObject(parent),
+ m_boundingRect(boundRect.x(), boundRect.y(), boundRect.width(), boundRect.height()),
+ m_horizontalRotation(-45.0f),
+ m_verticalRotation(15.0f),
+ m_theme(),
+ m_font(QFont(QStringLiteral("Arial"))),
+ m_selectionMode(QDataVis::ModeItem),
+ m_shadowQuality(QDataVis::ShadowMedium),
+ m_labelTransparency(QDataVis::TransparencyNoBackground),
+ m_isBackgroundEnabled(true),
+ m_isGridEnabled(true),
+ m_scene(new Q3DScene()),
+ m_activeInputHandler(0),
+ m_axisX(0),
+ m_axisY(0),
+ m_axisZ(0),
+ m_renderer(0),
+ m_isDataDirty(true),
+ m_data(0),
+ m_renderPending(false)
+{
+ m_theme.useColorTheme(QDataVis::ThemeSystem);
+
+ // Populate the scene
+ m_scene->setCamera(new Q3DCamera());
+ m_scene->setLight(new Q3DLight());
+ m_scene->light()->setPosition(defaultLightPos);
+
+ // Create initial default input handler
+ QAbstract3DInputHandler *inputHandler;
+#if defined(Q_OS_ANDROID)
+ inputHandler = new QTouch3DInputHandler();
+#else
+ inputHandler = new Q3DInputHandler();
+#endif
+ inputHandler->d_ptr->m_isDefaultHandler = true;
+ setActiveInputHandler(inputHandler);
+}
+
+Abstract3DController::~Abstract3DController()
+{
+ // Renderer can be in another thread, don't delete it directly in that case
+ if (m_renderer && m_renderer->thread() != QThread::currentThread())
+ m_renderer->deleteLater();
+ else
+ delete m_renderer;
+ delete m_scene;
+}
+
+void Abstract3DController::setRenderer(Abstract3DRenderer *renderer)
+{
+ m_renderer = renderer;
+}
+
+void Abstract3DController::synchDataToRenderer()
+{
+ // If we don't have a renderer, don't do anything
+ if (!m_renderer)
+ return;
+
+ m_renderer->updateScene(m_scene);
+
+ if (m_changeTracker.positionChanged) {
+ m_renderer->updatePosition(m_boundingRect);
+ m_changeTracker.positionChanged = false;
+ }
+
+ if (m_changeTracker.themeChanged) {
+ m_renderer->updateTheme(m_theme);
+ m_changeTracker.themeChanged = false;
+ }
+
+ if (m_changeTracker.fontChanged) {
+ m_renderer->updateFont(m_font);
+ m_changeTracker.fontChanged = false;
+ }
+
+ if (m_changeTracker.labelTransparencyChanged) {
+ m_renderer->updateLabelTransparency(m_labelTransparency);
+ m_changeTracker.labelTransparencyChanged = false;
+ }
+
+ if (m_changeTracker.boundingRectChanged || m_changeTracker.sizeChanged) {
+ m_renderer->updateBoundingRect(m_boundingRect);
+ m_changeTracker.boundingRectChanged = false;
+ m_changeTracker.sizeChanged = false;
+ }
+
+ if (m_changeTracker.shadowQualityChanged) {
+ m_renderer->updateShadowQuality(m_shadowQuality);
+ m_changeTracker.shadowQualityChanged = false;
+ }
+
+ if (m_changeTracker.selectionModeChanged) {
+ m_renderer->updateSelectionMode(m_selectionMode);
+ m_changeTracker.selectionModeChanged = false;
+ }
+
+ if (m_changeTracker.objFileChanged) {
+ m_renderer->updateMeshFileName(m_objFile);
+ m_changeTracker.objFileChanged = false;
+ }
+
+ if (m_changeTracker.gridEnabledChanged) {
+ m_renderer->updateGridEnabled(m_isGridEnabled);
+ m_changeTracker.gridEnabledChanged = false;
+ }
+
+ if (m_changeTracker.backgroundEnabledChanged) {
+ m_renderer->updateBackgroundEnabled(m_isBackgroundEnabled);
+ m_changeTracker.backgroundEnabledChanged = false;
+ }
+
+ if (m_changeTracker.axisXTypeChanged) {
+ m_renderer->updateAxisType(Q3DAbstractAxis::AxisOrientationX, m_axisX->type());
+ m_changeTracker.axisXTypeChanged = false;
+ }
+
+ if (m_changeTracker.axisYTypeChanged) {
+ m_renderer->updateAxisType(Q3DAbstractAxis::AxisOrientationY, m_axisY->type());
+ m_changeTracker.axisYTypeChanged = false;
+ }
+
+ if (m_changeTracker.axisZTypeChanged) {
+ m_renderer->updateAxisType(Q3DAbstractAxis::AxisOrientationZ, m_axisZ->type());
+ m_changeTracker.axisZTypeChanged = false;
+ }
+
+ if (m_changeTracker.axisXTitleChanged) {
+ m_renderer->updateAxisTitle(Q3DAbstractAxis::AxisOrientationX, m_axisX->title());
+ m_changeTracker.axisXTitleChanged = false;
+ }
+
+ if (m_changeTracker.axisYTitleChanged) {
+ m_renderer->updateAxisTitle(Q3DAbstractAxis::AxisOrientationY, m_axisY->title());
+ m_changeTracker.axisYTitleChanged = false;
+ }
+
+ if (m_changeTracker.axisZTitleChanged) {
+ m_renderer->updateAxisTitle(Q3DAbstractAxis::AxisOrientationZ, m_axisZ->title());
+ m_changeTracker.axisZTitleChanged = false;
+ }
+
+ if (m_changeTracker.axisXLabelsChanged) {
+ m_renderer->updateAxisLabels(Q3DAbstractAxis::AxisOrientationX, m_axisX->labels());
+ m_changeTracker.axisXLabelsChanged = false;
+ }
+
+ if (m_changeTracker.axisYLabelsChanged) {
+ m_renderer->updateAxisLabels(Q3DAbstractAxis::AxisOrientationY, m_axisY->labels());
+ m_changeTracker.axisYLabelsChanged = false;
+ }
+ if (m_changeTracker.axisZLabelsChanged) {
+ m_renderer->updateAxisLabels(Q3DAbstractAxis::AxisOrientationZ, m_axisZ->labels());
+ m_changeTracker.axisZLabelsChanged = false;
+ }
+
+ if (m_changeTracker.axisXRangeChanged) {
+ m_changeTracker.axisXRangeChanged = false;
+ if (m_axisX->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisX = static_cast<Q3DValueAxis *>(m_axisX);
+ m_renderer->updateAxisRange(Q3DAbstractAxis::AxisOrientationX,
+ valueAxisX->min(), valueAxisX->max());
+ }
+ }
+
+ if (m_changeTracker.axisYRangeChanged) {
+ m_changeTracker.axisYRangeChanged = false;
+ if (m_axisY->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisY = static_cast<Q3DValueAxis *>(m_axisY);
+ m_renderer->updateAxisRange(Q3DAbstractAxis::AxisOrientationY,
+ valueAxisY->min(), valueAxisY->max());
+ }
+ }
+
+ if (m_changeTracker.axisZRangeChanged) {
+ m_changeTracker.axisZRangeChanged = false;
+ if (m_axisZ->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisZ = static_cast<Q3DValueAxis *>(m_axisZ);
+ m_renderer->updateAxisRange(Q3DAbstractAxis::AxisOrientationZ,
+ valueAxisZ->min(), valueAxisZ->max());
+ }
+ }
+
+ if (m_changeTracker.axisXSegmentCountChanged) {
+ m_changeTracker.axisXSegmentCountChanged = false;
+ if (m_axisX->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisX = static_cast<Q3DValueAxis *>(m_axisX);
+ m_renderer->updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientationX,
+ valueAxisX->segmentCount());
+ }
+ }
+
+ if (m_changeTracker.axisYSegmentCountChanged) {
+ m_changeTracker.axisYSegmentCountChanged = false;
+ if (m_axisY->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisY = static_cast<Q3DValueAxis *>(m_axisY);
+ m_renderer->updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientationY,
+ valueAxisY->segmentCount());
+ }
+ }
+
+ if (m_changeTracker.axisZSegmentCountChanged) {
+ m_changeTracker.axisZSegmentCountChanged = false;
+ if (m_axisZ->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisZ = static_cast<Q3DValueAxis *>(m_axisZ);
+ m_renderer->updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientationZ,
+ valueAxisZ->segmentCount());
+ }
+ }
+
+ if (m_changeTracker.axisXSubSegmentCountChanged) {
+ m_changeTracker.axisXSubSegmentCountChanged = false;
+ if (m_axisX->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisX = static_cast<Q3DValueAxis *>(m_axisX);
+ m_renderer->updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientationX,
+ valueAxisX->subSegmentCount());
+ }
+ }
+
+ if (m_changeTracker.axisYSubSegmentCountChanged) {
+ m_changeTracker.axisYSubSegmentCountChanged = false;
+ if (m_axisY->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisY = static_cast<Q3DValueAxis *>(m_axisY);
+ m_renderer->updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientationY,
+ valueAxisY->subSegmentCount());
+ }
+ }
+
+ if (m_changeTracker.axisZSubSegmentCountChanged) {
+ m_changeTracker.axisZSubSegmentCountChanged = false;
+ if (m_axisZ->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisZ = static_cast<Q3DValueAxis *>(m_axisZ);
+ m_renderer->updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientationZ,
+ valueAxisZ->subSegmentCount());
+ }
+ }
+
+ if (m_changeTracker.axisXLabelFormatChanged) {
+ m_changeTracker.axisXLabelFormatChanged = false;
+ if (m_axisX->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisX = static_cast<Q3DValueAxis *>(m_axisX);
+ m_renderer->updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientationX,
+ valueAxisX->labelFormat());
+ }
+ }
+
+ if (m_changeTracker.axisYLabelFormatChanged) {
+ m_changeTracker.axisYLabelFormatChanged = false;
+ if (m_axisY->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisY = static_cast<Q3DValueAxis *>(m_axisY);
+ m_renderer->updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientationY,
+ valueAxisY->labelFormat());
+ }
+ }
+
+ if (m_changeTracker.axisZLabelFormatChanged) {
+ m_changeTracker.axisZLabelFormatChanged = false;
+ if (m_axisZ->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxisZ = static_cast<Q3DValueAxis *>(m_axisZ);
+ m_renderer->updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientationZ,
+ valueAxisZ->labelFormat());
+ }
+ }
+}
+
+void Abstract3DController::render(const GLuint defaultFboHandle)
+{
+ m_renderPending = false;
+
+ // If not initialized, do nothing.
+ if (!m_renderer)
+ return;
+
+ m_renderer->render(defaultFboHandle);
+
+#ifdef DISPLAY_RENDER_SPEED
+ // To get meaningful framerate, don't just do render on demand.
+ emitNeedRender();
+#endif
+}
+
+void Abstract3DController::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ m_activeInputHandler->mouseDoubleClickEvent(event);
+ emitNeedRender();
+}
+
+void Abstract3DController::touchEvent(QTouchEvent *event)
+{
+ m_activeInputHandler->touchEvent(event);
+ emitNeedRender();
+}
+
+void Abstract3DController::mousePressEvent(QMouseEvent *event, const QPoint &mousePos)
+{
+ m_activeInputHandler->mousePressEvent(event, mousePos);
+ emitNeedRender();
+}
+
+void Abstract3DController::mouseReleaseEvent(QMouseEvent *event, const QPoint &mousePos)
+{
+ m_activeInputHandler->mouseReleaseEvent(event, mousePos);
+ emitNeedRender();
+}
+
+void Abstract3DController::mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos)
+{
+ m_activeInputHandler->mouseMoveEvent(event, mousePos);
+ emitNeedRender();
+}
+
+void Abstract3DController::wheelEvent(QWheelEvent *event)
+{
+ m_activeInputHandler->wheelEvent(event);
+ emitNeedRender();
+}
+
+void Abstract3DController::setSize(const int width, const int height)
+{
+ m_boundingRect.setWidth(width);
+ m_boundingRect.setHeight(height);
+ m_scene->setViewportSize(width, height);
+
+ m_changeTracker.boundingRectChanged = true;
+ emitNeedRender();
+}
+
+const QSize Abstract3DController::size()
+{
+ return m_boundingRect.size();
+}
+
+const QRect Abstract3DController::boundingRect()
+{
+ return m_boundingRect;
+}
+
+void Abstract3DController::setBoundingRect(const QRect boundingRect)
+{
+ m_boundingRect = boundingRect;
+ m_scene->setViewport(boundingRect);
+
+ m_changeTracker.boundingRectChanged = true;
+ emitNeedRender();
+}
+
+void Abstract3DController::setWidth(const int width)
+{
+ m_boundingRect.setWidth(width);
+ m_scene->setViewportSize(width, m_scene->viewport().height());
+
+ m_changeTracker.sizeChanged = true;
+ emitNeedRender();
+}
+
+int Abstract3DController::width()
+{
+ return m_boundingRect.width();
+}
+
+void Abstract3DController::setHeight(const int height)
+{
+ m_boundingRect.setHeight(height);
+ m_scene->setViewportSize(m_scene->viewport().width(), height);
+
+ m_changeTracker.sizeChanged = true;
+ emitNeedRender();
+}
+
+int Abstract3DController::height()
+{
+ return m_boundingRect.height();
+}
+
+void Abstract3DController::setX(const int x)
+{
+ m_boundingRect.setX(x);
+
+ m_changeTracker.positionChanged = true;
+ emitNeedRender();
+}
+
+int Abstract3DController::x()
+{
+ return m_boundingRect.x();
+}
+
+void Abstract3DController::setY(const int y)
+{
+ m_boundingRect.setY(y);
+
+ m_changeTracker.positionChanged = true;
+ emitNeedRender();
+}
+
+int Abstract3DController::y()
+{
+ return m_boundingRect.y();
+}
+
+QRect Abstract3DController::mainViewport() const
+{
+ return m_scene->mainViewport();
+}
+
+void Abstract3DController::setMainViewport(const QRect &mainViewport)
+{
+ m_scene->setMainViewport(mainViewport);
+}
+
+QRect Abstract3DController::sliceViewport() const
+{
+ return m_scene->sliceViewport();
+}
+
+void Abstract3DController::setSliceViewport(const QRect &sliceViewport)
+{
+ m_scene->setSliceViewport(sliceViewport);
+}
+
+void Abstract3DController::setAxisX(Q3DAbstractAxis *axis)
+{
+ setAxisHelper(Q3DAbstractAxis::AxisOrientationX, axis, &m_axisX);
+}
+
+Q3DAbstractAxis *Abstract3DController::axisX()
+{
+ return m_axisX;
+}
+
+void Abstract3DController::setAxisY(Q3DAbstractAxis *axis)
+{
+ setAxisHelper(Q3DAbstractAxis::AxisOrientationY, axis, &m_axisY);
+}
+
+Q3DAbstractAxis *Abstract3DController::axisY()
+{
+ return m_axisY;
+}
+
+void Abstract3DController::setAxisZ(Q3DAbstractAxis *axis)
+{
+ setAxisHelper(Q3DAbstractAxis::AxisOrientationZ, axis, &m_axisZ);
+}
+
+Q3DAbstractAxis *Abstract3DController::axisZ()
+{
+ return m_axisZ;
+}
+
+void Abstract3DController::addAxis(Q3DAbstractAxis *axis)
+{
+ Q_ASSERT(axis);
+ Abstract3DController *owner = qobject_cast<Abstract3DController *>(axis->parent());
+ if (owner != this) {
+ Q_ASSERT_X(!owner, "addAxis", "Axis already attached to a graph.");
+ axis->setParent(this);
+ }
+ if (!m_axes.contains(axis))
+ m_axes.append(axis);
+}
+
+void Abstract3DController::releaseAxis(Q3DAbstractAxis *axis)
+{
+ if (axis && m_axes.contains(axis)) {
+ // Clear the default status from released default axes
+ if (axis->d_ptr->isDefaultAxis())
+ axis->d_ptr->setDefaultAxis(false);
+
+ // If the axis is in use, replace it with a temporary one
+ switch (axis->orientation()) {
+ case Q3DAbstractAxis::AxisOrientationX:
+ setAxisX(0);
+ break;
+ case Q3DAbstractAxis::AxisOrientationY:
+ setAxisY(0);
+ break;
+ case Q3DAbstractAxis::AxisOrientationZ:
+ setAxisZ(0);
+ break;
+ default:
+ break;
+ }
+
+ m_axes.removeAll(axis);
+ axis->setParent(0);
+ }
+}
+
+QList<Q3DAbstractAxis *> Abstract3DController::axes() const
+{
+ return m_axes;
+}
+
+QAbstractDataProxy *Abstract3DController::activeDataProxy() const
+{
+ return m_data;
+}
+
+void Abstract3DController::addDataProxy(QAbstractDataProxy *proxy)
+{
+ Q_ASSERT(proxy);
+ Abstract3DController *owner = qobject_cast<Abstract3DController *>(proxy->parent());
+ if (owner != this) {
+ Q_ASSERT_X(!owner, "addDataProxy", "Proxy already attached to a graph.");
+ proxy->setParent(this);
+ }
+ if (!m_dataProxies.contains(proxy))
+ m_dataProxies.append(proxy);
+}
+
+void Abstract3DController::releaseDataProxy(QAbstractDataProxy *proxy)
+{
+ if (proxy && m_dataProxies.contains(proxy)) {
+ // Clear the default status from released default proxies
+ if (proxy->d_ptr->isDefaultProxy())
+ proxy->d_ptr->setDefaultProxy(false);
+
+ // If the proxy is in use, replace it with a temporary one
+ if (m_data == proxy)
+ setActiveDataProxy(0);
+
+ m_dataProxies.removeAll(proxy);
+ proxy->setParent(0);
+ }
+}
+
+QList<QAbstractDataProxy *> Abstract3DController::dataProxies() const
+{
+ return m_dataProxies;
+}
+
+void Abstract3DController::setActiveDataProxy(QAbstractDataProxy *proxy)
+{
+ // If existing proxy is the default proxy, delete it
+ if (m_data) {
+ if (m_data->d_ptr->isDefaultProxy()) {
+ m_dataProxies.removeAll(m_data);
+ delete m_data;
+ } else {
+ // Disconnect the old proxy from use
+ QObject::disconnect(m_data, 0, this, 0);
+ }
+ }
+
+ // Assume ownership and activate
+ addDataProxy(proxy);
+ m_data = proxy;
+ m_isDataDirty = true;
+ emitNeedRender();
+}
+
+void Abstract3DController::addInputHandler(QAbstract3DInputHandler *inputHandler)
+{
+ Q_ASSERT(inputHandler);
+ Abstract3DController *owner = qobject_cast<Abstract3DController *>(inputHandler->parent());
+ if (owner != this) {
+ Q_ASSERT_X(!owner, "addInputHandler", "Input handler already attached to another component.");
+ inputHandler->setParent(this);
+ }
+
+ if (!m_inputHandlers.contains(inputHandler))
+ m_inputHandlers.append(inputHandler);
+}
+
+void Abstract3DController::releaseInputHandler(QAbstract3DInputHandler *inputHandler)
+{
+ if (inputHandler && m_inputHandlers.contains(inputHandler)) {
+ // Clear the default status from released default input handler
+ if (inputHandler->d_ptr->m_isDefaultHandler)
+ inputHandler->d_ptr->m_isDefaultHandler = false;
+
+ // If the input handler is in use, remove it
+ if (m_activeInputHandler == inputHandler)
+ setActiveInputHandler(0);
+
+ m_inputHandlers.removeAll(inputHandler);
+ inputHandler->setParent(0);
+ }
+}
+
+void Abstract3DController::setActiveInputHandler(QAbstract3DInputHandler *inputHandler)
+{
+ // If existing input handler is the default input handler, delete it
+ if (m_activeInputHandler) {
+ if (m_activeInputHandler->d_ptr->m_isDefaultHandler) {
+ m_inputHandlers.removeAll(m_activeInputHandler);
+ delete m_activeInputHandler;
+ } else {
+ // Disconnect the old input handler from the scene
+ m_activeInputHandler->setScene(0);
+ }
+ }
+
+ // Assume ownership and connect to this controller's scene
+ addInputHandler(inputHandler);
+ m_activeInputHandler = inputHandler;
+ if (m_activeInputHandler)
+ m_activeInputHandler->setScene(m_scene);
+}
+
+QAbstract3DInputHandler* Abstract3DController::activeInputHandler()
+{
+ return m_activeInputHandler;
+}
+
+int Abstract3DController::zoomLevel()
+{
+ return m_scene->camera()->zoomLevel();
+}
+
+void Abstract3DController::setZoomLevel(int zoomLevel)
+{
+ m_scene->camera()->setZoomLevel(zoomLevel);
+
+ m_changeTracker.zoomLevelChanged = true;
+ emitNeedRender();
+}
+
+void Abstract3DController::setCameraPreset(QDataVis::CameraPreset preset)
+{
+ m_scene->camera()->setCameraPreset(preset);
+ emitNeedRender();
+}
+
+void Abstract3DController::setCameraPosition(GLfloat horizontal, GLfloat vertical, GLint distance)
+{
+ m_horizontalRotation = qBound(-180.0f, horizontal, 180.0f);
+ m_verticalRotation = qBound(0.0f, vertical, 90.0f);
+ m_scene->camera()->setZoomLevel(qBound(10, distance, 500));
+ m_scene->camera()->setRotations(QPointF(m_horizontalRotation,
+ m_verticalRotation));
+ //qDebug() << "camera rotation set to" << m_horizontalRotation << m_verticalRotation;
+ emitNeedRender();
+}
+
+void Abstract3DController::setObjectColor(const QColor &baseColor, const QColor &heightColor,
+ const QColor &depthColor, bool uniform)
+{
+ m_theme.m_baseColor = baseColor;
+ m_theme.m_heightColor = heightColor;
+ m_theme.m_depthColor = depthColor;
+ m_theme.m_uniformColor = uniform;
+
+ m_changeTracker.themeChanged = true;
+ emitNeedRender();
+}
+
+void Abstract3DController::setColorTheme(QDataVis::ColorTheme colorTheme)
+{
+ m_theme.useColorTheme(colorTheme);
+
+ m_changeTracker.themeChanged = true;
+ emitNeedRender();
+}
+
+Theme Abstract3DController::theme()
+{
+ return m_theme;
+}
+
+void Abstract3DController::setFont(const QFont &font)
+{
+ m_font = font;
+
+ m_changeTracker.fontChanged = true;
+ emitNeedRender();
+}
+
+QFont Abstract3DController::font()
+{
+ return m_font;
+}
+
+void Abstract3DController::setSelectionMode(QDataVis::SelectionMode mode)
+{
+ m_selectionMode = mode;
+ m_changeTracker.selectionModeChanged = true;
+ emitNeedRender();
+}
+
+QDataVis::SelectionMode Abstract3DController::selectionMode()
+{
+ return m_selectionMode;
+}
+
+void Abstract3DController::setShadowQuality(QDataVis::ShadowQuality quality)
+{
+ m_shadowQuality = quality;
+
+ m_changeTracker.shadowQualityChanged = true;
+ emit shadowQualityChanged(m_shadowQuality);
+ emitNeedRender();
+}
+
+QDataVis::ShadowQuality Abstract3DController::shadowQuality()
+{
+ return m_shadowQuality;
+}
+
+void Abstract3DController::setLabelTransparency(QDataVis::LabelTransparency transparency)
+{
+ m_labelTransparency = transparency;
+
+ m_changeTracker.labelTransparencyChanged = true;
+ emitNeedRender();
+}
+
+QDataVis::LabelTransparency Abstract3DController::labelTransparency()
+{
+ return m_labelTransparency;
+}
+
+void Abstract3DController::setBackgroundEnabled(bool enable)
+{
+ m_isBackgroundEnabled = enable;
+ m_changeTracker.backgroundEnabledChanged = true;
+ emitNeedRender();
+}
+
+bool Abstract3DController::backgroundEnabled()
+{
+ return m_isBackgroundEnabled;
+}
+
+void Abstract3DController::setGridEnabled(bool enable)
+{
+ m_isGridEnabled = enable;
+ m_changeTracker.gridEnabledChanged = true;
+ emitNeedRender();
+}
+
+bool Abstract3DController::gridEnabled()
+{
+ return m_isGridEnabled;
+}
+
+bool Abstract3DController::isSlicingActive()
+{
+ return m_scene->isSlicingActivated();
+}
+
+void Abstract3DController::setSlicingActive(bool isSlicing)
+{
+ m_scene->setSlicingActivated(isSlicing);
+ emitNeedRender();
+}
+
+QDataVis::InputState Abstract3DController::inputState()
+{
+ return m_activeInputHandler->inputState();
+}
+
+QPoint Abstract3DController::inputPosition()
+{
+ return m_activeInputHandler->inputPosition();
+}
+
+void Abstract3DController::setMeshFileName(const QString &fileName)
+{
+ m_objFile = fileName;
+ m_changeTracker.objFileChanged = true;
+ emitNeedRender();
+}
+
+QString Abstract3DController::meshFileName()
+{
+ return m_objFile;
+}
+
+Q3DScene *Abstract3DController::scene()
+{
+ return m_scene;
+}
+
+void Abstract3DController::handleAxisTitleChanged(const QString &title)
+{
+ Q_UNUSED(title)
+ handleAxisTitleChangedBySender(sender());
+}
+
+void Abstract3DController::handleAxisTitleChangedBySender(QObject *sender)
+{
+ if (sender == m_axisX)
+ m_changeTracker.axisXTitleChanged = true;
+ else if (sender == m_axisY)
+ m_changeTracker.axisYTitleChanged = true;
+ else if (sender == m_axisZ)
+ m_changeTracker.axisZTitleChanged = true;
+ else
+ qWarning() << __FUNCTION__ << "invoked for invalid axis";
+ emitNeedRender();
+}
+
+void Abstract3DController::handleAxisLabelsChanged()
+{
+ handleAxisLabelsChangedBySender(sender());
+}
+
+void Abstract3DController::handleAxisLabelsChangedBySender(QObject *sender)
+{
+ if (sender == m_axisX)
+ m_changeTracker.axisXLabelsChanged = true;
+ else if (sender == m_axisY)
+ m_changeTracker.axisYLabelsChanged = true;
+ else if (sender == m_axisZ)
+ m_changeTracker.axisZLabelsChanged = true;
+ else
+ qWarning() << __FUNCTION__ << "invoked for invalid axis";
+ emitNeedRender();
+}
+
+void Abstract3DController::handleAxisRangeChanged(qreal min, qreal max)
+{
+ Q_UNUSED(min)
+ Q_UNUSED(max)
+ handleAxisRangeChangedBySender(sender());
+}
+
+void Abstract3DController::handleAxisRangeChangedBySender(QObject *sender)
+{
+ if (sender == m_axisX) {
+ m_isDataDirty = true;
+ m_changeTracker.axisXRangeChanged = true;
+ } else if (sender == m_axisY) {
+ m_isDataDirty = true;
+ m_changeTracker.axisYRangeChanged = true;
+ } else if (sender == m_axisZ) {
+ m_isDataDirty = true;
+ m_changeTracker.axisZRangeChanged = true;
+ } else {
+ qWarning() << __FUNCTION__ << "invoked for invalid axis";
+ }
+ emitNeedRender();
+}
+
+void Abstract3DController::handleAxisSegmentCountChanged(int count)
+{
+ Q_UNUSED(count)
+ handleAxisSegmentCountChangedBySender(sender());
+}
+
+void Abstract3DController::handleAxisSegmentCountChangedBySender(QObject *sender)
+{
+ if (sender == m_axisX)
+ m_changeTracker.axisXSegmentCountChanged = true;
+ else if (sender == m_axisY)
+ m_changeTracker.axisYSegmentCountChanged = true;
+ else if (sender == m_axisZ)
+ m_changeTracker.axisZSegmentCountChanged = true;
+ else
+ qWarning() << __FUNCTION__ << "invoked for invalid axis";
+ emitNeedRender();
+}
+
+void Abstract3DController::handleAxisSubSegmentCountChanged(int count)
+{
+ Q_UNUSED(count)
+ handleAxisSubSegmentCountChangedBySender(sender());
+}
+
+void Abstract3DController::handleAxisSubSegmentCountChangedBySender(QObject *sender)
+{
+ if (sender == m_axisX)
+ m_changeTracker.axisXSubSegmentCountChanged = true;
+ else if (sender == m_axisY)
+ m_changeTracker.axisYSubSegmentCountChanged = true;
+ else if (sender == m_axisZ)
+ m_changeTracker.axisZSubSegmentCountChanged = true;
+ else
+ qWarning() << __FUNCTION__ << "invoked for invalid axis";
+ emitNeedRender();
+}
+
+void Abstract3DController::handleAxisAutoAdjustRangeChanged(bool autoAdjust)
+{
+ QObject *sender = QObject::sender();
+ if (sender != m_axisX && sender != m_axisY && sender != m_axisZ)
+ return;
+
+ Q3DAbstractAxis *axis = static_cast<Q3DAbstractAxis*>(sender);
+ handleAxisAutoAdjustRangeChangedInOrientation(axis->orientation(), autoAdjust);
+}
+
+void Abstract3DController::handleAxisLabelFormatChanged(const QString &format)
+{
+ Q_UNUSED(format)
+ handleAxisLabelFormatChangedBySender(sender());
+}
+
+void Abstract3DController::handleAxisLabelFormatChangedBySender(QObject *sender)
+{
+ // Label format changing needs to dirty the data so that labels are reset.
+ if (sender == m_axisX) {
+ m_isDataDirty = true;
+ m_changeTracker.axisXLabelFormatChanged = true;
+ } else if (sender == m_axisY) {
+ m_isDataDirty = true;
+ m_changeTracker.axisYLabelFormatChanged = true;
+ } else if (sender == m_axisZ) {
+ m_isDataDirty = true;
+ m_changeTracker.axisZLabelFormatChanged = true;
+ } else {
+ qWarning() << __FUNCTION__ << "invoked for invalid axis";
+ }
+ emitNeedRender();
+}
+
+void Abstract3DController::setAxisHelper(Q3DAbstractAxis::AxisOrientation orientation,
+ Q3DAbstractAxis *axis, Q3DAbstractAxis **axisPtr)
+{
+ // Setting null axis indicates using default axis
+ if (!axis)
+ axis = createDefaultAxis(orientation);
+
+ // If old axis is default axis, delete it
+ Q3DAbstractAxis *oldAxis = *axisPtr;
+ if (oldAxis) {
+ if (oldAxis->d_ptr->isDefaultAxis()) {
+ m_axes.removeAll(oldAxis);
+ delete oldAxis;
+ oldAxis = 0;
+ } else {
+ // Disconnect the old axis from use
+ QObject::disconnect(oldAxis, 0, this, 0);
+ oldAxis->d_ptr->setOrientation(Q3DAbstractAxis::AxisOrientationNone);
+ }
+ }
+
+ // Assume ownership
+ addAxis(axis);
+
+ // Connect the new axis
+ *axisPtr = axis;
+
+ axis->d_ptr->setOrientation(orientation);
+
+ QObject::connect(axis, &Q3DAbstractAxis::titleChanged,
+ this, &Abstract3DController::handleAxisTitleChanged);
+ QObject::connect(axis, &Q3DAbstractAxis::labelsChanged,
+ this, &Abstract3DController::handleAxisLabelsChanged);
+
+ if (orientation == Q3DAbstractAxis::AxisOrientationX)
+ m_changeTracker.axisXTypeChanged = true;
+ else if (orientation == Q3DAbstractAxis::AxisOrientationY)
+ m_changeTracker.axisYTypeChanged = true;
+ else if (orientation == Q3DAbstractAxis::AxisOrientationZ)
+ m_changeTracker.axisZTypeChanged = true;
+
+ handleAxisTitleChangedBySender(axis);
+ handleAxisLabelsChangedBySender(axis);
+
+ if (axis->type() & Q3DAbstractAxis::AxisTypeValue) {
+ Q3DValueAxis *valueAxis = static_cast<Q3DValueAxis *>(axis);
+ QObject::connect(valueAxis, &Q3DValueAxis::rangeChanged,
+ this, &Abstract3DController::handleAxisRangeChanged);
+ QObject::connect(valueAxis, &Q3DValueAxis::segmentCountChanged,
+ this, &Abstract3DController::handleAxisSegmentCountChanged);
+ QObject::connect(valueAxis, &Q3DValueAxis::subSegmentCountChanged,
+ this, &Abstract3DController::handleAxisSubSegmentCountChanged);
+ QObject::connect(valueAxis, &Q3DValueAxis::autoAdjustRangeChanged,
+ this, &Abstract3DController::handleAxisAutoAdjustRangeChanged);
+ QObject::connect(valueAxis, &Q3DValueAxis::labelFormatChanged,
+ this, &Abstract3DController::handleAxisLabelFormatChanged);
+
+ handleAxisRangeChangedBySender(valueAxis);
+ handleAxisSegmentCountChangedBySender(valueAxis);
+ handleAxisSubSegmentCountChangedBySender(valueAxis);
+ handleAxisAutoAdjustRangeChangedInOrientation(valueAxis->orientation(),
+ valueAxis->isAutoAdjustRange());
+ handleAxisLabelFormatChangedBySender(valueAxis);
+ }
+}
+
+Q3DAbstractAxis *Abstract3DController::createDefaultAxis(Q3DAbstractAxis::AxisOrientation orientation)
+{
+ Q_UNUSED(orientation)
+
+ // The default default axis is a value axis. If the chart type has a different default axis
+ // for some orientation, this function needs to be overridden.
+ Q3DAbstractAxis *defaultAxis = createDefaultValueAxis();
+ return defaultAxis;
+}
+
+Q3DValueAxis *Abstract3DController::createDefaultValueAxis()
+{
+ // Default value axis has single segment, empty label format, and auto scaling
+ // TODO: Grid should be also hidden, but that is not currently controlled by axis
+ Q3DValueAxis *defaultAxis = new Q3DValueAxis;
+ defaultAxis->setSegmentCount(1);
+ defaultAxis->setSubSegmentCount(1);
+ defaultAxis->setAutoAdjustRange(true);
+ defaultAxis->setLabelFormat(QString());
+ defaultAxis->d_ptr->setDefaultAxis(true);
+
+ return defaultAxis;
+}
+
+Q3DCategoryAxis *Abstract3DController::createDefaultCategoryAxis()
+{
+ // Default category axis has no labels
+ // TODO: Grid should be also hidden, but that is not currently controlled by axis.
+ Q3DCategoryAxis *defaultAxis = new Q3DCategoryAxis;
+ defaultAxis->d_ptr->setDefaultAxis(true);
+ return defaultAxis;
+}
+
+void Abstract3DController::emitNeedRender()
+{
+ if (!m_renderPending) {
+ emit needRender();
+ m_renderPending = true;
+ }
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/engine/abstract3dcontroller_p.h b/src/datavisualization/engine/abstract3dcontroller_p.h
new file mode 100644
index 00000000..1419c0f4
--- /dev/null
+++ b/src/datavisualization/engine/abstract3dcontroller_p.h
@@ -0,0 +1,341 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CONTROLLER3DBASE_H
+#define CONTROLLER3DBASE_H
+
+#include <QObject>
+
+#include "datavisualizationglobal_p.h"
+#include "theme_p.h"
+#include "q3dabstractaxis.h"
+#include "drawer_p.h"
+#include "qabstract3dinputhandler.h"
+#include "qabstractdataproxy.h"
+#include "q3dscene.h"
+#include "q3dbox.h"
+
+class QFont;
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class CameraHelper;
+class Abstract3DRenderer;
+
+struct Abstract3DChangeBitField {
+ bool positionChanged : 1;
+ bool zoomLevelChanged : 1;
+ bool themeChanged : 1;
+ bool fontChanged : 1;
+ bool labelTransparencyChanged : 1;
+ bool boundingRectChanged : 1;
+ bool sizeChanged : 1;
+ bool shadowQualityChanged : 1;
+ bool selectionModeChanged : 1;
+ bool objFileChanged : 1;
+ bool gridEnabledChanged : 1;
+ bool backgroundEnabledChanged : 1;
+ bool axisXTypeChanged : 1;
+ bool axisYTypeChanged : 1;
+ bool axisZTypeChanged : 1;
+ bool axisXTitleChanged : 1;
+ bool axisYTitleChanged : 1;
+ bool axisZTitleChanged : 1;
+ bool axisXLabelsChanged : 1;
+ bool axisYLabelsChanged : 1;
+ bool axisZLabelsChanged : 1;
+ bool axisXRangeChanged : 1;
+ bool axisYRangeChanged : 1;
+ bool axisZRangeChanged : 1;
+ bool axisXSegmentCountChanged : 1;
+ bool axisYSegmentCountChanged : 1;
+ bool axisZSegmentCountChanged : 1;
+ bool axisXSubSegmentCountChanged : 1;
+ bool axisYSubSegmentCountChanged : 1;
+ bool axisZSubSegmentCountChanged : 1;
+ bool axisXLabelFormatChanged : 1;
+ bool axisYLabelFormatChanged : 1;
+ bool axisZLabelFormatChanged : 1;
+
+ Abstract3DChangeBitField() :
+ positionChanged(true),
+ zoomLevelChanged(true),
+ themeChanged(true),
+ fontChanged(true),
+ labelTransparencyChanged(true),
+ boundingRectChanged(true),
+ sizeChanged(true),
+ shadowQualityChanged(true),
+ selectionModeChanged(true),
+ objFileChanged(true),
+ gridEnabledChanged(true),
+ backgroundEnabledChanged(true),
+ axisXTypeChanged(true),
+ axisYTypeChanged(true),
+ axisZTypeChanged(true),
+ axisXTitleChanged(true),
+ axisYTitleChanged(true),
+ axisZTitleChanged(true),
+ axisXLabelsChanged(true),
+ axisYLabelsChanged(true),
+ axisZLabelsChanged(true),
+ axisXRangeChanged(true),
+ axisYRangeChanged(true),
+ axisZRangeChanged(true),
+ axisXSegmentCountChanged(true),
+ axisYSegmentCountChanged(true),
+ axisZSegmentCountChanged(true),
+ axisXSubSegmentCountChanged(true),
+ axisYSubSegmentCountChanged(true),
+ axisZSubSegmentCountChanged(true),
+ axisXLabelFormatChanged(true),
+ axisYLabelFormatChanged(true),
+ axisZLabelFormatChanged(true)
+ {
+ }
+};
+
+class QT_DATAVISUALIZATION_EXPORT Abstract3DController : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum SelectionType {
+ SelectionNone = 0,
+ SelectionItem,
+ SelectionRow,
+ SelectionColumn
+ };
+
+ enum MouseState {
+ MouseNone = 0,
+ MouseOnScene,
+ MouseOnOverview,
+ MouseOnZoom,
+ MouseRotating,
+ MouseOnPinch
+ };
+
+private:
+ Abstract3DChangeBitField m_changeTracker;
+ QRect m_boundingRect;
+ GLfloat m_horizontalRotation;
+ GLfloat m_verticalRotation;
+ Theme m_theme;
+ QFont m_font;
+ QDataVis::SelectionMode m_selectionMode;
+ QDataVis::ShadowQuality m_shadowQuality;
+ QDataVis::LabelTransparency m_labelTransparency;
+ bool m_isBackgroundEnabled;
+ bool m_isGridEnabled;
+ QString m_objFile;
+
+ Q3DScene *m_scene;
+
+protected:
+ QList<QAbstract3DInputHandler *> m_inputHandlers; // List of all added input handlers
+ QAbstract3DInputHandler *m_activeInputHandler;
+ CameraHelper *m_cameraHelper;
+ // Active axes
+ Q3DAbstractAxis *m_axisX;
+ Q3DAbstractAxis *m_axisY;
+ Q3DAbstractAxis *m_axisZ;
+
+ QList<Q3DAbstractAxis *> m_axes; // List of all added axes
+ Abstract3DRenderer *m_renderer;
+ bool m_isDataDirty;
+
+ QAbstractDataProxy *m_data;
+ QList<QAbstractDataProxy *> m_dataProxies;
+
+ bool m_renderPending;
+
+ explicit Abstract3DController(QRect boundRect, QObject *parent = 0);
+ ~Abstract3DController();
+
+public:
+
+ inline bool isInitialized() { return (m_renderer != 0); }
+
+ /**
+ * @brief synchDataToRenderer Called on the render thread while main GUI thread is blocked before rendering.
+ */
+ virtual void synchDataToRenderer();
+
+ virtual void render(const GLuint defaultFboHandle = 0);
+
+ /**
+ * @brief setRenderer Sets the renderer to be used. isInitialized returns true from this point onwards.
+ * @param renderer Renderer to be used.
+ */
+ void setRenderer(Abstract3DRenderer *renderer);
+
+ // Size
+ virtual void setSize(const int width, const int height);
+ virtual const QSize size();
+ virtual const QRect boundingRect();
+ virtual void setBoundingRect(const QRect boundingRect);
+ virtual void setWidth(const int width);
+ virtual int width();
+ virtual void setHeight(const int height);
+ virtual int height();
+ virtual void setX(const int x);
+ virtual int x();
+ virtual void setY(const int y);
+ virtual int y();
+
+ virtual QRect mainViewport() const;
+ virtual void setMainViewport(const QRect &mainViewport);
+
+ virtual QRect sliceViewport() const;
+ virtual void setSliceViewport(const QRect &sliceViewport);
+
+ virtual void setAxisX(Q3DAbstractAxis *axis);
+ virtual Q3DAbstractAxis *axisX();
+ virtual void setAxisY(Q3DAbstractAxis *axis);
+ virtual Q3DAbstractAxis *axisY();
+ virtual void setAxisZ(Q3DAbstractAxis *axis);
+ virtual Q3DAbstractAxis *axisZ();
+ virtual void addAxis(Q3DAbstractAxis *axis);
+ virtual void releaseAxis(Q3DAbstractAxis *axis);
+ virtual QList<Q3DAbstractAxis *> axes() const; // Omits default axes
+
+ virtual void addInputHandler(QAbstract3DInputHandler *inputHandler);
+ virtual void releaseInputHandler(QAbstract3DInputHandler *inputHandler);
+ virtual void setActiveInputHandler(QAbstract3DInputHandler *inputHandler);
+ virtual QAbstract3DInputHandler *activeInputHandler();
+
+ virtual QAbstractDataProxy *activeDataProxy() const;
+ virtual void addDataProxy(QAbstractDataProxy *proxy);
+ virtual void releaseDataProxy(QAbstractDataProxy *proxy);
+ virtual QList<QAbstractDataProxy *> dataProxies() const;
+ virtual void setActiveDataProxy(QAbstractDataProxy *proxy);
+
+ virtual int zoomLevel();
+ virtual void setZoomLevel(int zoomLevel);
+
+ // Select preset camera placement
+ virtual void setCameraPreset(QDataVis::CameraPreset preset);
+
+ // Set camera rotation if you don't want to use the presets (in horizontal (-180...180) and
+ // vertical (0...90) (or (-90...90) if there are negative values) angles and distance in
+ // percentage (10...500))
+ virtual void setCameraPosition(GLfloat horizontal, GLfloat vertical, GLint distance = 100);
+
+ // Set color if you don't want to use themes. Set uniform to false if you want the (height)
+ // color to change from bottom to top
+ virtual void setObjectColor(const QColor &baseColor, const QColor &heightColor,
+ const QColor &depthColor, bool uniform = true);
+
+ // Set theme (bar colors, shaders, window color, background colors, light intensity and text
+ // colors are affected)
+ virtual void setColorTheme(QDataVis::ColorTheme colorTheme);
+ virtual Theme theme();
+
+ // Set font
+ virtual void setFont(const QFont &font);
+ virtual QFont font();
+
+ // Selection mode
+ virtual void setSelectionMode(QDataVis::SelectionMode mode);
+ virtual QDataVis::SelectionMode selectionMode();
+
+ // Adjust shadow quality
+ virtual void setShadowQuality(QDataVis::ShadowQuality quality);
+ virtual QDataVis::ShadowQuality shadowQuality();
+
+ // Label transparency adjustment
+ virtual void setLabelTransparency(QDataVis::LabelTransparency transparency);
+ virtual QDataVis::LabelTransparency labelTransparency();
+
+ // Enable or disable background mesh
+ virtual void setBackgroundEnabled(bool enable);
+ virtual bool backgroundEnabled();
+
+ // Enable or disable background grid
+ virtual void setGridEnabled(bool enable);
+ virtual bool gridEnabled();
+
+ // Query input state and position
+ QDataVis::InputState inputState();
+ QPoint inputPosition();
+
+ // Enable or disable slicing mode
+ bool isSlicingActive();
+ void setSlicingActive(bool isSlicing);
+
+
+ // override bar type with own mesh
+ virtual void setMeshFileName(const QString &fileName);
+ virtual QString meshFileName();
+
+ Q3DScene *scene();
+
+ virtual void mouseDoubleClickEvent(QMouseEvent *event);
+ virtual void touchEvent(QTouchEvent *event);
+ virtual void mousePressEvent(QMouseEvent *event, const QPoint &mousePos);
+ virtual void mouseReleaseEvent(QMouseEvent *event, const QPoint &mousePos);
+ virtual void mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos);
+ virtual void wheelEvent(QWheelEvent *event);
+
+ virtual void handleAxisTitleChangedBySender(QObject *sender);
+ virtual void handleAxisLabelsChangedBySender(QObject *sender);
+ virtual void handleAxisRangeChangedBySender(QObject *sender);
+ virtual void handleAxisSegmentCountChangedBySender(QObject *sender);
+ virtual void handleAxisSubSegmentCountChangedBySender(QObject *sender);
+ virtual void handleAxisAutoAdjustRangeChangedInOrientation(
+ Q3DAbstractAxis::AxisOrientation orientation, bool autoAdjust) = 0;
+ virtual void handleAxisLabelFormatChangedBySender(QObject *sender);
+
+public slots:
+ void handleAxisTitleChanged(const QString &title);
+ void handleAxisLabelsChanged();
+ void handleAxisRangeChanged(qreal min, qreal max);
+ void handleAxisSegmentCountChanged(int count);
+ void handleAxisSubSegmentCountChanged(int count);
+ void handleAxisAutoAdjustRangeChanged(bool autoAdjust);
+ void handleAxisLabelFormatChanged(const QString &format);
+
+signals:
+ void shadowQualityChanged(QDataVis::ShadowQuality quality);
+ void needRender();
+
+protected:
+ virtual Q3DAbstractAxis *createDefaultAxis(Q3DAbstractAxis::AxisOrientation orientation);
+ Q3DValueAxis *createDefaultValueAxis();
+ Q3DCategoryAxis *createDefaultCategoryAxis();
+ void emitNeedRender();
+
+private:
+ void setAxisHelper(Q3DAbstractAxis::AxisOrientation orientation, Q3DAbstractAxis *axis,
+ Q3DAbstractAxis **axisPtr);
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // CONTROLLER3DBASE_H
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp
new file mode 100644
index 00000000..7e5962cc
--- /dev/null
+++ b/src/datavisualization/engine/abstract3drenderer.cpp
@@ -0,0 +1,307 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "abstract3drenderer_p.h"
+#include "q3dvalueaxis.h"
+#include "texturehelper_p.h"
+#include "utils_p.h"
+#include "q3dscene.h"
+#include "q3dcamera.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller)
+ : QObject(0),
+ m_controller(controller),
+ m_hasNegativeValues(false),
+ m_cachedTheme(),
+ m_cachedFont(QFont(QStringLiteral("Arial"))),
+ m_cachedLabelTransparency(QDataVis::TransparencyFromTheme),
+ m_drawer(new Drawer(m_cachedTheme, m_cachedFont, m_cachedLabelTransparency)),
+ m_cachedBoundingRect(QRect(0,0,0,0)),
+ m_cachedShadowQuality(QDataVis::ShadowMedium),
+ m_autoScaleAdjustment(1.0f),
+ m_cachedSelectionMode(QDataVis::ModeNone),
+ m_cachedIsGridEnabled(false),
+ m_cachedIsBackgroundEnabled(false),
+ m_cachedScene(0)
+ #ifdef DISPLAY_RENDER_SPEED
+ , m_isFirstFrame(true),
+ m_numFrames(0)
+ #endif
+
+{
+ QObject::connect(m_drawer, &Drawer::drawerChanged, this, &Abstract3DRenderer::updateTextures);
+}
+
+Abstract3DRenderer::~Abstract3DRenderer()
+{
+ delete m_drawer;
+ delete m_textureHelper;
+ delete m_cachedScene;
+}
+
+void Abstract3DRenderer::initializeOpenGL()
+{
+ // Set OpenGL features
+ glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_LESS);
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+
+#if !defined(QT_OPENGL_ES_2)
+ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
+ glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
+ glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
+#endif
+
+ m_textureHelper = new TextureHelper();
+ m_drawer->initializeOpenGL();
+
+ axisCacheForOrientation(Q3DAbstractAxis::AxisOrientationX).setDrawer(m_drawer);
+ axisCacheForOrientation(Q3DAbstractAxis::AxisOrientationY).setDrawer(m_drawer);
+ axisCacheForOrientation(Q3DAbstractAxis::AxisOrientationZ).setDrawer(m_drawer);
+}
+
+void Abstract3DRenderer::render(const GLuint defaultFboHandle)
+{
+#ifdef DISPLAY_RENDER_SPEED
+ // For speed computation
+ if (m_isFirstFrame) {
+ m_lastFrameTime.start();
+ m_isFirstFrame = false;
+ }
+
+ // Measure speed (as milliseconds per frame)
+ m_numFrames++;
+ if (m_lastFrameTime.elapsed() >= 1000) { // print only if last measurement was more than 1s ago
+ qDebug() << qreal(m_lastFrameTime.elapsed()) / qreal(m_numFrames) << "ms/frame (=" << qreal(m_numFrames) << "fps)";
+ m_numFrames = 0;
+ m_lastFrameTime.restart();
+ }
+#endif
+
+ if (defaultFboHandle) {
+ glDepthMask(true);
+ glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_LESS);
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+ glDisable(GL_BLEND); // For QtQuick2 blending is enabled by default, but we don't want it to be
+ }
+
+ QVector3D clearColor = Utils::vectorFromColor(m_cachedTheme.m_windowColor);
+ glClearColor(clearColor.x(), clearColor.y(), clearColor.z(), 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+}
+
+QString Abstract3DRenderer::generateValueLabel(const QString &format, qreal value)
+{
+ QString valueLabelFormat = format;
+ Utils::ParamType valueParamType = Utils::findFormatParamType(valueLabelFormat);
+ QByteArray valueFormatArray = valueLabelFormat.toUtf8();
+ return Utils::formatLabel(valueFormatArray, valueParamType, value);
+}
+
+void Abstract3DRenderer::updateDataModel(QAbstractDataProxy *dataProxy)
+{
+ m_cachedItemLabelFormat = dataProxy->itemLabelFormat();
+}
+
+QString Abstract3DRenderer::itemLabelFormat() const
+{
+ return m_cachedItemLabelFormat;
+}
+
+void Abstract3DRenderer::updateBoundingRect(const QRect &boundingRect)
+{
+ m_cachedBoundingRect = boundingRect;
+ handleResize();
+}
+
+void Abstract3DRenderer::updatePosition(const QRect &boundingRect)
+{
+ m_cachedBoundingRect = boundingRect;
+}
+
+void Abstract3DRenderer::updateTheme(Theme theme)
+{
+ m_cachedTheme.setFromTheme(theme);
+
+ m_drawer->setTheme(m_cachedTheme);
+ // Re-initialize shaders
+ handleShadowQualityChange();
+}
+
+void Abstract3DRenderer::updateScene(Q3DScene *scene)
+{
+ // Make a copy of the scene to renderer's cache.
+ Q3DScene *newScene = scene->clone();
+ delete m_cachedScene;
+ m_cachedScene = newScene;
+}
+
+void Abstract3DRenderer::handleShadowQualityChange()
+{
+#if !defined(QT_OPENGL_ES_2)
+ if (m_cachedShadowQuality > QDataVis::ShadowNone) {
+ if (!m_cachedTheme.m_uniformColor) {
+ initShaders(QStringLiteral(":/shaders/vertexShadow"),
+ QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY"));
+ } else {
+ initShaders(QStringLiteral(":/shaders/vertexShadow"),
+ QStringLiteral(":/shaders/fragmentShadowNoTex"));
+ }
+ initBackgroundShaders(QStringLiteral(":/shaders/vertexShadow"),
+ QStringLiteral(":/shaders/fragmentShadowNoTex"));
+ } else {
+ if (!m_cachedTheme.m_uniformColor) {
+ initShaders(QStringLiteral(":/shaders/vertex"),
+ QStringLiteral(":/shaders/fragmentColorOnY"));
+ } else {
+ initShaders(QStringLiteral(":/shaders/vertex"),
+ QStringLiteral(":/shaders/fragment"));
+ }
+ initBackgroundShaders(QStringLiteral(":/shaders/vertex"),
+ QStringLiteral(":/shaders/fragment"));
+ }
+#else
+ if (!m_cachedTheme.m_uniformColor) {
+ initShaders(QStringLiteral(":/shaders/vertexES2"),
+ QStringLiteral(":/shaders/fragmentColorOnYES2"));
+ } else {
+ initShaders(QStringLiteral(":/shaders/vertexES2"),
+ QStringLiteral(":/shaders/fragmentES2"));
+ }
+ initBackgroundShaders(QStringLiteral(":/shaders/vertexES2"),
+ QStringLiteral(":/shaders/fragmentES2"));
+#endif
+}
+
+void Abstract3DRenderer::updateFont(const QFont &font)
+{
+ m_cachedFont = font;
+ m_drawer->setFont(font);
+}
+
+void Abstract3DRenderer::updateLabelTransparency(QDataVis::LabelTransparency transparency)
+{
+ m_cachedLabelTransparency = transparency;
+ m_drawer->setTransparency(transparency);
+}
+
+void Abstract3DRenderer::updateMeshFileName(const QString &objFileName)
+{
+ if (objFileName != m_cachedObjFile) {
+ m_cachedObjFile = objFileName;
+ loadMeshFile();
+ }
+}
+
+void Abstract3DRenderer::updateSelectionMode(QDataVis::SelectionMode mode)
+{
+ m_cachedSelectionMode = mode;
+}
+
+void Abstract3DRenderer::updateGridEnabled(bool enable)
+{
+ m_cachedIsGridEnabled = enable;
+}
+
+void Abstract3DRenderer::updateBackgroundEnabled(bool enable)
+{
+ m_cachedIsBackgroundEnabled = enable;
+}
+
+void Abstract3DRenderer::handleResize()
+{
+ if (m_cachedBoundingRect.width() == 0 || m_cachedBoundingRect.height() == 0)
+ return;
+ qDebug() << __FUNCTION__ << m_cachedBoundingRect.width() << "x" << m_cachedBoundingRect.height();
+ // Calculate zoom level based on aspect ratio
+ GLfloat div;
+ GLfloat zoomAdjustment;
+ div = qMin(m_cachedBoundingRect.width(), m_cachedBoundingRect.height());
+ zoomAdjustment = defaultRatio * ((m_cachedBoundingRect.width() / div)
+ / (m_cachedBoundingRect.height() / div));
+ //qDebug() << "zoom adjustment" << zoomAdjustment;
+ m_autoScaleAdjustment = qMin(zoomAdjustment, 1.0f); // clamp to 1.0f
+
+ // Re-init selection buffer
+ initSelectionBuffer();
+
+#if !defined(QT_OPENGL_ES_2)
+ // Re-init depth buffer
+ updateDepthBuffer();
+#endif
+}
+
+void Abstract3DRenderer::updateAxisType(Q3DAbstractAxis::AxisOrientation orientation, Q3DAbstractAxis::AxisType type)
+{
+ axisCacheForOrientation(orientation).setType(type);
+}
+
+void Abstract3DRenderer::updateAxisTitle(Q3DAbstractAxis::AxisOrientation orientation, const QString &title)
+{
+ axisCacheForOrientation(orientation).setTitle(title);
+}
+
+void Abstract3DRenderer::updateAxisLabels(Q3DAbstractAxis::AxisOrientation orientation, const QStringList &labels)
+{
+ axisCacheForOrientation(orientation).setLabels(labels);
+}
+
+void Abstract3DRenderer::updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, qreal min, qreal max)
+{
+ AxisRenderCache &cache = axisCacheForOrientation(orientation);
+ cache.setMin(min);
+ cache.setMax(max);
+}
+
+void Abstract3DRenderer::updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count)
+{
+ axisCacheForOrientation(orientation).setSegmentCount(count);
+}
+
+void Abstract3DRenderer::updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count)
+{
+ axisCacheForOrientation(orientation).setSubSegmentCount(count);
+}
+
+void Abstract3DRenderer::updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientation orientation, const QString &format)
+{
+ axisCacheForOrientation(orientation).setLabelFormat(format);
+}
+
+AxisRenderCache &Abstract3DRenderer::axisCacheForOrientation(Q3DAbstractAxis::AxisOrientation orientation)
+{
+ switch (orientation) {
+ case Q3DAbstractAxis::AxisOrientationX:
+ return m_axisCacheX;
+ case Q3DAbstractAxis::AxisOrientationY:
+ return m_axisCacheY;
+ case Q3DAbstractAxis::AxisOrientationZ:
+ return m_axisCacheZ;
+ default:
+ qFatal("Abstract3DRenderer::axisCacheForOrientation");
+ return m_axisCacheX;
+ }
+}
+
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/engine/abstract3drenderer_p.h b/src/datavisualization/engine/abstract3drenderer_p.h
new file mode 100644
index 00000000..1edca798
--- /dev/null
+++ b/src/datavisualization/engine/abstract3drenderer_p.h
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef ABSTRACT3DRENDERER_P_H
+#define ABSTRACT3DRENDERER_P_H
+
+#include <QtGui/QOpenGLFunctions>
+#include <QtGui/QFont>
+#include <QTime>
+
+#include "datavisualizationglobal_p.h"
+#include "abstract3dcontroller_p.h"
+#include "axisrendercache_p.h"
+#include "qabstractdataproxy.h"
+
+//#define DISPLAY_RENDER_SPEED
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class TextureHelper;
+class Theme;
+class Drawer;
+
+class Abstract3DRenderer : public QObject, protected QOpenGLFunctions
+{
+ Q_OBJECT
+
+private:
+ Abstract3DController *m_controller;
+
+protected:
+ bool m_hasNegativeValues;
+ Theme m_cachedTheme;
+ QFont m_cachedFont;
+ QDataVis::LabelTransparency m_cachedLabelTransparency;
+ Drawer *m_drawer;
+ QRect m_cachedBoundingRect;
+ QDataVis::ShadowQuality m_cachedShadowQuality;
+ GLfloat m_autoScaleAdjustment;
+
+ QString m_cachedItemLabelFormat;
+ QString m_cachedObjFile;
+ QDataVis::SelectionMode m_cachedSelectionMode;
+ bool m_cachedIsGridEnabled;
+ bool m_cachedIsBackgroundEnabled;
+
+ AxisRenderCache m_axisCacheX;
+ AxisRenderCache m_axisCacheY;
+ AxisRenderCache m_axisCacheZ;
+ TextureHelper *m_textureHelper;
+ Q3DBox m_boundingBox;
+
+ Q3DScene *m_cachedScene;
+
+#ifdef DISPLAY_RENDER_SPEED
+ bool m_isFirstFrame;
+ QTime m_lastFrameTime;
+ GLint m_numFrames;
+#endif
+
+ QString generateValueLabel(const QString &format, qreal value);
+
+public:
+ ~Abstract3DRenderer();
+
+ void updateDataModel(QAbstractDataProxy *dataProxy);
+
+ virtual void render(GLuint defaultFboHandle);
+
+ virtual void updateBoundingRect(const QRect &boundingRect);
+ virtual void updatePosition(const QRect &boundingRect);
+
+ virtual void updateTheme(Theme theme);
+ virtual void updateFont(const QFont &font);
+ virtual void updateLabelTransparency(QDataVis::LabelTransparency transparency);
+ virtual void updateSelectionMode(QDataVis::SelectionMode newMode);
+ virtual void updateGridEnabled(bool enable);
+ virtual void updateBackgroundEnabled(bool enable);
+ virtual void updateMeshFileName(const QString &objFileName);
+ virtual void updateScene(Q3DScene *scene);
+ virtual QString itemLabelFormat() const;
+ virtual void updateTextures() = 0;
+ virtual void initSelectionBuffer() = 0;
+
+#if !defined(QT_OPENGL_ES_2)
+ virtual void updateDepthBuffer() = 0;
+#endif
+ virtual void updateShadowQuality(QDataVis::ShadowQuality quality) = 0;
+ virtual void initShaders(const QString &vertexShader, const QString &fragmentShader) = 0;
+ virtual void initBackgroundShaders(const QString &vertexShader, const QString &fragmentShader) = 0;
+ virtual void updateAxisType(Q3DAbstractAxis::AxisOrientation orientation, Q3DAbstractAxis::AxisType type);
+ virtual void updateAxisTitle(Q3DAbstractAxis::AxisOrientation orientation, const QString &title);
+ virtual void updateAxisLabels(Q3DAbstractAxis::AxisOrientation orientation, const QStringList &labels);
+ virtual void updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, qreal min, qreal max);
+ virtual void updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count);
+ virtual void updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count);
+ virtual void updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientation orientation, const QString &format);
+
+protected:
+ Abstract3DRenderer(Abstract3DController *controller);
+
+ virtual void initializeOpenGL();
+
+ virtual void handleShadowQualityChange();
+ virtual void handleResize();
+ virtual void loadMeshFile() = 0;
+
+ AxisRenderCache &axisCacheForOrientation(Q3DAbstractAxis::AxisOrientation orientation);
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif // ABSTRACT3DRENDERER_P_H
diff --git a/src/datavisualization/engine/axisrendercache.cpp b/src/datavisualization/engine/axisrendercache.cpp
new file mode 100644
index 00000000..c525c777
--- /dev/null
+++ b/src/datavisualization/engine/axisrendercache.cpp
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "axisrendercache_p.h"
+#include "qmath.h"
+#include <QFontMetrics>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+AxisRenderCache::AxisRenderCache()
+ : m_type(Q3DAbstractAxis::AxisTypeNone),
+ m_min(0.0),
+ m_max(10.0),
+ m_segmentCount(5),
+ m_subSegmentCount(1),
+ m_font(QFont(QStringLiteral("Arial"))),
+ m_drawer(0),
+ m_segmentStep(10.0f),
+ m_subSegmentStep(10.0f)
+{
+}
+
+AxisRenderCache::~AxisRenderCache()
+{
+ foreach (LabelItem *label, m_labelItems)
+ delete label;
+}
+
+void AxisRenderCache::setDrawer(Drawer *drawer)
+{
+ m_drawer = drawer;
+ m_font = m_drawer->font();
+ if (m_drawer) {
+ QObject::connect(m_drawer, &Drawer::drawerChanged, this, &AxisRenderCache::updateTextures);
+ updateTextures();
+ }
+}
+
+void AxisRenderCache::setType(Q3DAbstractAxis::AxisType type)
+{
+ m_type = type;
+
+ // If type is set, it means completely new axis instance, so clear all old data
+ m_labels.clear();
+ m_title.clear();
+ m_min = 0.0;
+ m_max = 10.0;
+ m_segmentCount = 5;
+ m_subSegmentCount = 1;
+ m_labelFormat.clear();
+
+ m_titleItem.clear();
+ foreach (LabelItem *label, m_labelItems)
+ delete label;
+ m_labelItems.clear();
+ m_segmentStep = 10.0f;
+ m_subSegmentStep = 10.0f;
+}
+
+void AxisRenderCache::setTitle(const QString &title)
+{
+ if (m_title != title) {
+ m_title = title;
+ // Generate axis label texture
+ if (m_drawer)
+ m_drawer->generateLabelItem(m_titleItem, title);
+ }
+}
+
+void AxisRenderCache::setLabels(const QStringList &labels)
+{
+ if (m_labels != labels) {
+ int newSize(labels.size());
+ int oldSize(m_labels.size());
+
+ for (int i = newSize; i < oldSize; i++)
+ delete m_labelItems.takeLast();
+
+ m_labelItems.reserve(newSize);
+
+ int widest = maxLabelWidth(labels);
+
+ for (int i = 0; i < newSize; i++) {
+ if (i >= oldSize)
+ m_labelItems.append(new LabelItem);
+ if (m_drawer) {
+ if (labels.at(i).isEmpty())
+ m_labelItems[i]->clear();
+ else if (i >= oldSize || labels.at(i) != m_labels.at(i))
+ m_drawer->generateLabelItem(*m_labelItems[i], labels.at(i), widest);
+ }
+ }
+ m_labels = labels;
+ }
+}
+
+void AxisRenderCache::setMin(qreal min)
+{
+ m_min = min;
+ updateSegmentStep();
+}
+
+void AxisRenderCache::setMax(qreal max)
+{
+ m_max = max;
+ updateSegmentStep();
+}
+
+void AxisRenderCache::setSegmentCount(int count)
+{
+ m_segmentCount = count;
+ updateSegmentStep();
+}
+
+void AxisRenderCache::setSubSegmentCount(int count)
+{
+ m_subSegmentCount = count;
+ updateSubSegmentStep();
+}
+
+void AxisRenderCache::updateTextures()
+{
+ m_font = m_drawer->font();
+
+ if (m_title.isEmpty())
+ m_titleItem.clear();
+ else
+ m_drawer->generateLabelItem(m_titleItem, m_title);
+
+ int widest = maxLabelWidth(m_labels);
+
+ for (int i = 0; i < m_labels.size(); i++) {
+ if (m_labels.at(i).isEmpty())
+ m_labelItems[i]->clear();
+ else
+ m_drawer->generateLabelItem(*m_labelItems[i], m_labels.at(i), widest);
+ }
+}
+
+void AxisRenderCache::updateSegmentStep()
+{
+ if (m_segmentCount > 0)
+ m_segmentStep = qFabs((m_max - m_min) / m_segmentCount);
+ else
+ m_segmentStep = 0.0f; // Irrelevant
+ updateSubSegmentStep();
+}
+
+void AxisRenderCache::updateSubSegmentStep()
+{
+ if (m_subSegmentCount > 1)
+ m_subSegmentStep = m_segmentStep / m_subSegmentCount;
+ else
+ m_subSegmentStep = m_segmentStep;
+}
+
+int AxisRenderCache::maxLabelWidth(const QStringList &labels) const
+{
+ int labelWidth = 0;
+ QFont labelFont = m_font;
+ labelFont.setPointSize(50);
+ QFontMetrics labelFM(labelFont);
+ for (int i = 0; i < labels.size(); i++) {
+ int newWidth = labelFM.width(labels.at(i));
+ if (labelWidth < newWidth)
+ labelWidth = newWidth;
+ }
+ return labelWidth;
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/engine/axisrendercache_p.h b/src/datavisualization/engine/axisrendercache_p.h
new file mode 100644
index 00000000..0bb1cf92
--- /dev/null
+++ b/src/datavisualization/engine/axisrendercache_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef AXISRENDERCACHE_P_H
+#define AXISRENDERCACHE_P_H
+
+#include "datavisualizationglobal_p.h"
+#include "labelitem_p.h"
+#include "q3dabstractaxis_p.h"
+#include "drawer_p.h"
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class AxisRenderCache : public QObject
+{
+ Q_OBJECT
+public:
+ AxisRenderCache();
+ virtual ~AxisRenderCache();
+
+ void setDrawer(Drawer *drawer);
+
+ void setType(Q3DAbstractAxis::AxisType type);
+ inline Q3DAbstractAxis::AxisType type() const { return m_type; }
+ void setTitle(const QString &title);
+ inline const QString &title() { return m_title; }
+ void setLabels(const QStringList &labels);
+ inline const QStringList &labels() { return m_labels; }
+ void setMin(qreal min);
+ inline qreal min() { return m_min; }
+ void setMax(qreal max);
+ inline qreal max() { return m_max; }
+ void setSegmentCount(int count);
+ inline int segmentCount() const { return m_segmentCount; }
+ void setSubSegmentCount(int count);
+ inline int subSegmentCount() const { return m_subSegmentCount; }
+ inline void setLabelFormat(const QString &format) { m_labelFormat = format; }
+ inline const QString &labelFormat() { return m_labelFormat; }
+
+ inline LabelItem &titleItem() { return m_titleItem; }
+ inline QList<LabelItem *> &labelItems() { return m_labelItems; }
+ inline GLfloat segmentStep() const { return m_segmentStep; }
+ inline GLfloat subSegmentStep() const { return m_subSegmentStep; }
+
+public slots:
+ void updateTextures();
+
+private:
+ void updateSegmentStep();
+ void updateSubSegmentStep();
+ int maxLabelWidth(const QStringList &labels) const;
+
+ // Cached axis values
+ Q3DAbstractAxis::AxisType m_type;
+ QString m_title;
+ QStringList m_labels;
+ qreal m_min;
+ qreal m_max;
+ int m_segmentCount;
+ int m_subSegmentCount;
+ QString m_labelFormat;
+ QFont m_font;
+
+ // Renderer items
+ Drawer *m_drawer; // Not owned
+ LabelItem m_titleItem;
+ QList<LabelItem *> m_labelItems;
+ GLfloat m_segmentStep;
+ GLfloat m_subSegmentStep;
+
+ Q_DISABLE_COPY(AxisRenderCache)
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/engine/bars3dcontroller.cpp b/src/datavisualization/engine/bars3dcontroller.cpp
new file mode 100644
index 00000000..90987fc5
--- /dev/null
+++ b/src/datavisualization/engine/bars3dcontroller.cpp
@@ -0,0 +1,377 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "bars3dcontroller_p.h"
+#include "bars3drenderer_p.h"
+#include "camerahelper_p.h"
+#include "q3dabstractaxis_p.h"
+#include "q3dvalueaxis_p.h"
+#include "q3dcategoryaxis.h"
+#include "qbardataproxy_p.h"
+
+#include <QMatrix4x4>
+#include <QMouseEvent>
+#include <qmath.h>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+Bars3DController::Bars3DController(QRect boundRect)
+ : Abstract3DController(boundRect),
+ m_rowCount(10),
+ m_columnCount(10),
+ m_selectedBarPos(noSelectionPoint()),
+ m_isBarSpecRelative(true),
+ m_barThicknessRatio(1.0f),
+ m_barSpacing(QSizeF(1.0, 1.0)),
+ m_renderer(0)
+{
+ // Default bar type; specific to bars
+ setBarType(QDataVis::BevelBars, false);
+
+ setActiveDataProxy(0);
+
+ // Setting a null axis creates a new default axis according to orientation and chart type.
+ // Note: These cannot be set in Abstract3DController constructor, as they will call virtual
+ // functions implemented by subclasses.
+ setAxisX(0);
+ setAxisY(0);
+ setAxisZ(0);
+}
+
+Bars3DController::~Bars3DController()
+{
+}
+
+void Bars3DController::initializeOpenGL()
+{
+ // Initialization is called multiple times when Qt Quick components are used
+ if (isInitialized())
+ return;
+
+ m_renderer = new Bars3DRenderer(this);
+
+ setRenderer(m_renderer);
+ synchDataToRenderer();
+
+ QObject::connect(m_renderer, &Bars3DRenderer::selectedBarPosChanged, this,
+ &Bars3DController::handleSelectedBarPosChanged, Qt::QueuedConnection);
+ emitNeedRender();
+}
+
+void Bars3DController::synchDataToRenderer()
+{
+ Abstract3DController::synchDataToRenderer();
+
+ if (!isInitialized())
+ return;
+
+ // Notify changes to renderer
+ if (m_changeTracker.sampleSpaceChanged) {
+ m_renderer->updateSampleSpace(m_rowCount, m_columnCount);
+ m_changeTracker.sampleSpaceChanged = false;
+ }
+
+ if (m_changeTracker.barSpecsChanged) {
+ m_renderer->updateBarSpecs(m_barThicknessRatio, m_barSpacing, m_isBarSpecRelative);
+ m_changeTracker.barSpecsChanged = false;
+ }
+
+ if (m_changeTracker.selectedBarPosChanged) {
+ m_renderer->updateSelectedBarPos(m_selectedBarPos);
+ m_changeTracker.selectedBarPosChanged = false;
+ }
+
+ if (m_isDataDirty) {
+ m_renderer->updateDataModel(static_cast<QBarDataProxy *>(m_data));
+ m_isDataDirty = false;
+ }
+}
+
+void Bars3DController::setActiveDataProxy(QAbstractDataProxy *proxy)
+{
+ // Setting null proxy indicates default proxy
+ if (!proxy) {
+ proxy = new QBarDataProxy;
+ proxy->d_ptr->setDefaultProxy(true);
+ }
+
+ Q_ASSERT(proxy->type() == QAbstractDataProxy::DataTypeBar);
+
+ Abstract3DController::setActiveDataProxy(proxy);
+
+ QBarDataProxy *barDataProxy = static_cast<QBarDataProxy *>(m_data);
+
+ QObject::connect(barDataProxy, &QBarDataProxy::arrayReset, this,
+ &Bars3DController::handleArrayReset);
+ QObject::connect(barDataProxy, &QBarDataProxy::rowsAdded, this,
+ &Bars3DController::handleRowsAdded);
+ QObject::connect(barDataProxy, &QBarDataProxy::rowsChanged, this,
+ &Bars3DController::handleRowsChanged);
+ QObject::connect(barDataProxy, &QBarDataProxy::rowsRemoved, this,
+ &Bars3DController::handleRowsRemoved);
+ QObject::connect(barDataProxy, &QBarDataProxy::rowsInserted, this,
+ &Bars3DController::handleRowsInserted);
+ QObject::connect(barDataProxy, &QBarDataProxy::itemChanged, this,
+ &Bars3DController::handleItemChanged);
+
+ adjustValueAxisRange();
+
+ // Always clear selection on proxy change
+ setSelectedBarPos(noSelectionPoint());
+}
+
+void Bars3DController::handleArrayReset()
+{
+ scene()->setSlicingActivated(false);
+ adjustValueAxisRange();
+ m_isDataDirty = true;
+ // Clear selection unless still valid
+ setSelectedBarPos(m_selectedBarPos);
+ emitNeedRender();
+}
+
+void Bars3DController::handleRowsAdded(int startIndex, int count)
+{
+ Q_UNUSED(startIndex)
+ Q_UNUSED(count)
+ // TODO check if affects data window
+ // TODO should update slice instead of deactivating?
+ scene()->setSlicingActivated(false);
+ adjustValueAxisRange();
+ m_isDataDirty = true;
+ emitNeedRender();
+}
+
+void Bars3DController::handleRowsChanged(int startIndex, int count)
+{
+ Q_UNUSED(startIndex)
+ Q_UNUSED(count)
+ // TODO check if affects data window
+ // TODO should update slice instead of deactivating?
+ scene()->setSlicingActivated(false);
+ adjustValueAxisRange();
+ m_isDataDirty = true;
+ emitNeedRender();
+}
+
+void Bars3DController::handleRowsRemoved(int startIndex, int count)
+{
+ Q_UNUSED(startIndex)
+ Q_UNUSED(count)
+ // TODO check if affects data window
+ // TODO should update slice instead of deactivating?
+ scene()->setSlicingActivated(false);
+ adjustValueAxisRange();
+ m_isDataDirty = true;
+
+ // Clear selection unless still valid
+ setSelectedBarPos(m_selectedBarPos);
+
+ emitNeedRender();
+}
+
+void Bars3DController::handleRowsInserted(int startIndex, int count)
+{
+ Q_UNUSED(startIndex)
+ Q_UNUSED(count)
+ // TODO check if affects data window
+ // TODO should update slice instead of deactivating?
+ scene()->setSlicingActivated(false);
+ adjustValueAxisRange();
+ m_isDataDirty = true;
+ emitNeedRender();
+}
+
+void Bars3DController::handleItemChanged(int rowIndex, int columnIndex)
+{
+ Q_UNUSED(rowIndex)
+ Q_UNUSED(columnIndex)
+ // TODO check if affects data window
+ // TODO should update slice instead of deactivating?
+ scene()->setSlicingActivated(false);
+ adjustValueAxisRange();
+ m_isDataDirty = true;
+ emitNeedRender();
+}
+
+void Bars3DController::handleSelectedBarPosChanged(const QPoint &position)
+{
+ QPoint pos = position;
+ if (pos == QPoint(255, 255))
+ pos = noSelectionPoint();
+ if (pos != m_selectedBarPos) {
+ m_selectedBarPos = pos;
+ emit selectedBarPosChanged(pos);
+ emitNeedRender();
+ }
+}
+
+void Bars3DController::handleAxisAutoAdjustRangeChangedInOrientation(
+ Q3DAbstractAxis::AxisOrientation orientation, bool autoAdjust)
+{
+ Q_UNUSED(orientation)
+ Q_UNUSED(autoAdjust)
+ adjustValueAxisRange();
+}
+
+QPoint Bars3DController::noSelectionPoint()
+{
+ static QPoint noSelectionPos(-1, -1);
+ return noSelectionPos;
+}
+
+void Bars3DController::setBarSpecs(GLfloat thicknessRatio, const QSizeF &spacing, bool relative)
+{
+ m_barThicknessRatio = thicknessRatio;
+ m_barSpacing = spacing;
+ m_isBarSpecRelative = relative;
+
+ m_changeTracker.barSpecsChanged = true;
+ emitNeedRender();
+}
+
+GLfloat Bars3DController::barThickness()
+{
+ return m_barThicknessRatio;
+}
+
+QSizeF Bars3DController::barSpacing()
+{
+ return m_barSpacing;
+}
+
+bool Bars3DController::isBarSpecRelative()
+{
+ return m_isBarSpecRelative;
+}
+
+void Bars3DController::setBarType(QDataVis::MeshStyle style, bool smooth)
+{
+ QString objFile;
+ if (style == QDataVis::Bars)
+ objFile = QStringLiteral(":/defaultMeshes/bar");
+ else if (style == QDataVis::Pyramids)
+ objFile = QStringLiteral(":/defaultMeshes/pyramid");
+ else if (style == QDataVis::Cones)
+ objFile = QStringLiteral(":/defaultMeshes/cone");
+ else if (style == QDataVis::Cylinders)
+ objFile = QStringLiteral(":/defaultMeshes/cylinder");
+ else if (style == QDataVis::BevelBars)
+ objFile = QStringLiteral(":/defaultMeshes/bevelbar");
+
+ if (smooth)
+ objFile += QStringLiteral("Smooth");
+
+ Abstract3DController::setMeshFileName(objFile);
+}
+
+// TODO: This sets data window. Needs more parameters, now assumes window always starts at 0,0.
+void Bars3DController::setDataWindow(int rowCount, int columnCount)
+{
+ // Disable zoom mode if we're in it (causes crash if not, as zoom selection is deleted)
+ scene()->setSlicingActivated(false);
+
+ m_rowCount = rowCount;
+ m_columnCount = columnCount;
+
+ adjustValueAxisRange();
+
+ // Clear selection unless still valid
+ setSelectedBarPos(m_selectedBarPos);
+
+ m_changeTracker.sampleSpaceChanged = true;
+ m_isDataDirty = true; // Render item array is recreated in renderer
+ emitNeedRender();
+}
+
+void Bars3DController::setSelectionMode(QDataVis::SelectionMode mode)
+{
+ // Disable zoom if selection mode changes
+ scene()->setSlicingActivated(false);
+ Abstract3DController::setSelectionMode(mode);
+}
+
+void Bars3DController::setSelectedBarPos(const QPoint &position)
+{
+ // If the selection is outside data window or targets non-existent
+ // bar, clear selection instead.
+ // TODO this will break once data window offset is implemented
+ QPoint pos = position;
+ if (pos.x() < 0 || pos.y() < 0
+ || pos.x() >= static_cast<QBarDataProxy *>(m_data)->rowCount()
+ || pos.y() >= static_cast<QBarDataProxy *>(m_data)->rowAt(pos.x())->size()
+ || pos.x() >= m_rowCount || pos.y() >= m_columnCount) {
+ pos = noSelectionPoint();
+ }
+
+ if (pos != m_selectedBarPos) {
+ m_selectedBarPos = pos;
+ m_changeTracker.selectedBarPosChanged = true;
+ emit selectedBarPosChanged(pos);
+ emitNeedRender();
+ }
+}
+
+QPoint Bars3DController::selectedBarPos() const
+{
+ return m_selectedBarPos;
+}
+
+int Bars3DController::columnCount()
+{
+ return m_columnCount;
+}
+
+int Bars3DController::rowCount()
+{
+ return m_rowCount;
+}
+
+void Bars3DController::adjustValueAxisRange()
+{
+ Q3DValueAxis *valueAxis = static_cast<Q3DValueAxis *>(m_axisY);
+ if (valueAxis && valueAxis->isAutoAdjustRange() && m_data) {
+ QPair<GLfloat, GLfloat> limits =
+ static_cast<QBarDataProxy *>(m_data)->dptr()->limitValues(0, m_rowCount,
+ 0, m_columnCount);
+ if (limits.first < 0) {
+ // TODO: Currently we only support symmetric y-axis for bar chart if there are negative values
+ qreal maxAbs = qMax(qFabs(limits.first), qFabs(limits.second));
+ // Call private implementation to avoid unsetting auto adjust flag
+ valueAxis->dptr()->setRange(-maxAbs, maxAbs);
+ } else if (limits.second == 0.0) {
+ valueAxis->dptr()->setRange(0.0, 1.0); // Only zero value values in data set, set range to something.
+ } else {
+ valueAxis->dptr()->setRange(0.0, limits.second);
+ }
+ }
+}
+
+Q3DAbstractAxis *Bars3DController::createDefaultAxis(Q3DAbstractAxis::AxisOrientation orientation)
+{
+ Q3DAbstractAxis *defaultAxis = 0;
+
+ if (orientation == Q3DAbstractAxis::AxisOrientationY)
+ defaultAxis = createDefaultValueAxis();
+ else
+ defaultAxis = createDefaultCategoryAxis();
+
+ return defaultAxis;
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/engine/bars3dcontroller_p.h b/src/datavisualization/engine/bars3dcontroller_p.h
new file mode 100644
index 00000000..69ead98a
--- /dev/null
+++ b/src/datavisualization/engine/bars3dcontroller_p.h
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Q3DBARSCONTROLLER_p_H
+#define Q3DBARSCONTROLLER_p_H
+
+#include "datavisualizationglobal_p.h"
+#include "abstract3dcontroller_p.h"
+
+//#define DISPLAY_RENDER_SPEED
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class Bars3DRenderer;
+class QBarDataProxy;
+
+struct Bars3DChangeBitField {
+ bool slicingActiveChanged : 1;
+ bool sampleSpaceChanged : 1;
+ bool barSpecsChanged : 1;
+ bool selectedBarPosChanged : 1;
+
+ Bars3DChangeBitField() :
+ slicingActiveChanged(true),
+ sampleSpaceChanged(true),
+ barSpecsChanged(true),
+ selectedBarPosChanged(true)
+ {
+ }
+};
+
+class QT_DATAVISUALIZATION_EXPORT Bars3DController : public Abstract3DController
+{
+ Q_OBJECT
+
+private:
+ Bars3DChangeBitField m_changeTracker;
+
+ // Data
+ int m_rowCount;
+ int m_columnCount;
+
+ // Interaction
+ QPoint m_selectedBarPos; // Points to row & column in data window.
+
+ // Look'n'feel
+ bool m_isBarSpecRelative;
+ GLfloat m_barThicknessRatio;
+ QSizeF m_barSpacing;
+
+ // Rendering
+ Bars3DRenderer *m_renderer;
+
+public:
+ explicit Bars3DController(QRect rect);
+ ~Bars3DController();
+
+ void initializeOpenGL();
+ virtual void synchDataToRenderer();
+
+ int columnCount();
+ int rowCount();
+
+ // bar thickness, spacing between bars, and is spacing relative to thickness or absolute
+ // y -component sets the thickness/spacing of z -direction
+ // With relative 0.0f means side-to-side, 1.0f = one thickness in between
+ void setBarSpecs(GLfloat thicknessRatio = 1.0f,
+ const QSizeF &spacing = QSizeF(1.0, 1.0),
+ bool relative = true);
+ GLfloat barThickness();
+ QSizeF barSpacing();
+ bool isBarSpecRelative();
+
+ // bar type; bars (=cubes), pyramids, cones, cylinders, etc.
+ void setBarType(QDataVis::MeshStyle style, bool smooth = false);
+
+ // how many samples per row and column, and names for axes
+ void setDataWindow(int samplesRow, int samplesColumn);
+
+ // Change selection mode; single bar, bar and row, bar and column, or all
+ void setSelectionMode(QDataVis::SelectionMode mode);
+
+ void setSelectedBarPos(const QPoint &position);
+ QPoint selectedBarPos() const;
+
+ virtual void setActiveDataProxy(QAbstractDataProxy *proxy);
+
+ virtual void handleAxisAutoAdjustRangeChangedInOrientation(Q3DAbstractAxis::AxisOrientation orientation, bool autoAdjust);
+
+ static QPoint noSelectionPoint();
+
+public slots:
+ void handleArrayReset();
+ void handleRowsAdded(int startIndex, int count);
+ void handleRowsChanged(int startIndex, int count);
+ void handleRowsRemoved(int startIndex, int count);
+ void handleRowsInserted(int startIndex, int count);
+ void handleItemChanged(int rowIndex, int columnIndex);
+
+ void handleSelectedBarPosChanged(const QPoint &position);
+
+signals:
+ void selectedBarPosChanged(QPoint position);
+
+protected:
+ virtual Q3DAbstractAxis *createDefaultAxis(Q3DAbstractAxis::AxisOrientation orientation);
+
+private:
+ void adjustValueAxisRange();
+
+ Q_DISABLE_COPY(Bars3DController)
+
+};
+
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
new file mode 100644
index 00000000..6331ee8e
--- /dev/null
+++ b/src/datavisualization/engine/bars3drenderer.cpp
@@ -0,0 +1,1828 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "bars3drenderer_p.h"
+#include "bars3dcontroller_p.h"
+#include "q3dcamera.h"
+#include "shaderhelper_p.h"
+#include "objecthelper_p.h"
+#include "texturehelper_p.h"
+#include "theme_p.h"
+#include "utils_p.h"
+#include "drawer_p.h"
+#include "qbardataitem.h"
+#include "q3dlight.h"
+
+#include <QMatrix4x4>
+#include <QMouseEvent>
+#include <QThread>
+#include <qmath.h>
+#include <QDebug>
+
+// Commenting this draws the shadow map with perspective projection. Otherwise it's drawn in
+// orthographic projection.
+//#define USE_WIDER_SHADOWS
+
+// You can verify that depth buffer drawing works correctly by uncommenting this.
+// You should see the scene from where the light is
+//#define SHOW_DEPTH_TEXTURE_SCENE
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+const GLfloat labelMargin = 0.05f;
+const GLfloat gridLineWidth = 0.005f;
+static QVector3D selectionSkipColor = QVector3D(255, 255, 255); // Selection texture's background color
+
+Bars3DRenderer::Bars3DRenderer(Bars3DController *controller)
+ : Abstract3DRenderer(controller),
+ m_controller(controller),
+ m_cachedIsSlicingActivated(false),
+ m_selectedBar(0),
+ m_sliceSelection(0),
+ m_sliceCache(0),
+ m_sliceTitleItem(0),
+ m_xFlipped(false),
+ m_zFlipped(false),
+ m_yFlipped(false),
+ m_updateLabels(false),
+ m_barShader(0),
+ m_depthShader(0),
+ m_selectionShader(0),
+ m_backgroundShader(0),
+ m_labelShader(0),
+ m_barObj(0),
+ m_backgroundObj(0),
+ m_gridLineObj(0),
+ m_labelObj(0),
+ m_bgrTexture(0),
+ m_depthTexture(0),
+ m_selectionTexture(0),
+ m_depthFrameBuffer(0),
+ m_selectionFrameBuffer(0),
+ m_selectionDepthBuffer(0),
+ m_shadowQualityToShader(100.0f),
+ m_shadowQualityMultiplier(3),
+ m_heightNormalizer(1.0f),
+ m_yAdjustment(0.0f),
+ m_rowWidth(0),
+ m_columnDepth(0),
+ m_maxDimension(0),
+ m_scaleX(0),
+ m_scaleZ(0),
+ m_scaleFactor(0),
+ m_maxSceneSize(40.0),
+ m_selection(selectionSkipColor),
+ m_previousSelection(selectionSkipColor),
+ m_hasHeightAdjustmentChanged(true)
+{
+ initializeOpenGLFunctions();
+ initializeOpenGL();
+}
+
+Bars3DRenderer::~Bars3DRenderer()
+{
+ m_textureHelper->glDeleteFramebuffers(1, &m_selectionFrameBuffer);
+ m_textureHelper->glDeleteRenderbuffers(1, &m_selectionDepthBuffer);
+ m_textureHelper->deleteTexture(&m_selectionTexture);
+ m_textureHelper->glDeleteFramebuffers(1, &m_depthFrameBuffer);
+ m_textureHelper->deleteTexture(&m_bgrTexture);
+ if (m_sliceSelection) {
+ m_sliceSelection->clear(); // Slice doesn't own its items
+ delete m_sliceSelection;
+ }
+ delete m_barShader;
+ delete m_depthShader;
+ delete m_selectionShader;
+ delete m_backgroundShader;
+ delete m_barObj;
+ delete m_backgroundObj;
+ delete m_gridLineObj;
+ delete m_labelObj;
+ delete m_labelShader;
+}
+
+void Bars3DRenderer::initializeOpenGL()
+{
+ Abstract3DRenderer::initializeOpenGL();
+
+ // Initialize shaders
+ handleShadowQualityChange();
+
+ initLabelShaders(QStringLiteral(":/shaders/vertexLabel"),
+ QStringLiteral(":/shaders/fragmentLabel"));
+
+#if !defined(QT_OPENGL_ES_2)
+ // Init depth shader (for shadows). Init in any case, easier to handle shadow activation if done via api.
+ initDepthShader();
+#endif
+
+ // Init selection shader
+ initSelectionShader();
+
+ // Load grid line mesh
+ loadGridLineMesh();
+
+ // Load label mesh
+ loadLabelMesh();
+
+ // Set view port
+ glViewport(m_sliceViewPort.x(), m_sliceViewPort.y(),
+ m_sliceViewPort.width(), m_sliceViewPort.height());
+
+ // Load background mesh (we need to be initialized first)
+ loadBackgroundMesh();
+}
+
+void Bars3DRenderer::updateDataModel(QBarDataProxy *dataProxy)
+{
+ // Update cached data window
+ int dataRowCount = dataProxy->rowCount();
+ for (int i = 0; i < m_renderItemArray.size(); i++) {
+ int j = 0;
+ if (i < dataRowCount) {
+ const QBarDataRow *dataRow = dataProxy->rowAt(i);
+ int updateSize = qMin(dataRow->size(), m_renderItemArray[i].size());
+ if (dataRow) {
+ for (; j < updateSize ; j++) {
+ qreal value = dataRow->at(j).value();
+ m_renderItemArray[i][j].setValue(value);
+ m_renderItemArray[i][j].setHeight(value / m_heightNormalizer);
+ }
+ }
+ }
+ for (; j < m_renderItemArray[i].size(); j++) {
+ m_renderItemArray[i][j].setValue(0.0);
+ m_renderItemArray[i][j].setHeight(0.0f);
+ }
+ }
+
+ Abstract3DRenderer::updateDataModel(dataProxy);
+}
+
+void Bars3DRenderer::updateScene(Q3DScene *scene)
+{
+ // TODO: Move these to more suitable place e.g. controller should be controlling the viewports.
+ scene->setSliceViewport(m_sliceViewPort);
+ scene->setMainViewport(m_mainViewPort);
+ scene->setUnderSideCameraEnabled(m_hasNegativeValues);
+ if (m_hasHeightAdjustmentChanged) {
+ // Set initial camera position. Also update if height adjustment has changed.
+ scene->camera()->setDefaultOrientation(QVector3D(0.0f, 0.0f, 6.0f + zComp),
+ QVector3D(0.0f, -m_yAdjustment, zComp),
+ QVector3D(0.0f, 1.0f, 0.0f));
+ m_hasHeightAdjustmentChanged = false;
+ }
+
+ scene->camera()->updateViewMatrix(m_autoScaleAdjustment);
+ // Set light position (rotate light with camera, a bit above it (as set in defaultLightPos))
+ scene->setLightPositionRelativeToCamera(defaultLightPos);
+
+ Abstract3DRenderer::updateScene(scene);
+}
+
+void Bars3DRenderer::render(GLuint defaultFboHandle)
+{
+ updateSlicingActive(m_cachedScene->isSlicingActivated());
+
+ // Handle GL state setup for FBO buffers and clearing of the render surface
+ Abstract3DRenderer::render(defaultFboHandle);
+
+ // If slice selection is on, draw the sliced scene
+ if (m_cachedIsSlicingActivated)
+ drawSlicedScene(m_axisCacheX.titleItem(), m_axisCacheY.titleItem(), m_axisCacheZ.titleItem());
+
+ // Draw bars scene
+ drawScene(defaultFboHandle);
+}
+
+void Bars3DRenderer::drawSlicedScene(const LabelItem &xLabel,
+ const LabelItem &yLabel,
+ const LabelItem &zLabel)
+{
+ GLfloat barPosX = 0;
+ GLint startBar = 0;
+ GLint stopBar = m_sliceSelection->size();
+ GLint stepBar = 1;
+ QVector3D lightPos;
+
+ // Specify viewport
+ glViewport(m_sliceViewPort.x(), m_sliceViewPort.y(),
+ m_sliceViewPort.width(), m_sliceViewPort.height());
+
+ // Set up projection matrix
+ QMatrix4x4 projectionMatrix;
+ projectionMatrix.perspective(45.0f, (GLfloat)m_sliceViewPort.width()
+ / (GLfloat)m_sliceViewPort.height(), 0.1f, 100.0f);
+
+#ifdef ROTATE_ZOOM_SELECTION
+ // Get light position (rotate light with camera, a bit above it (as set in defaultLightPos))
+ lightPos = m_cachedScene->light()->position();
+
+ if (viewMatrix.row(0).z() <= 0) {
+ startBar = m_sliceSelection->size() - 1;
+ stopBar = -1;
+ stepBar = -1;
+ }
+#else
+ // Set view matrix
+ QMatrix4x4 viewMatrix;
+
+ // Adjust scaling (zoom rate based on aspect ratio)
+ GLfloat camZPosSliced = 5.0f / m_autoScaleAdjustment + zComp;
+
+ viewMatrix.lookAt(QVector3D(0.0f, 0.0f, camZPosSliced),
+ QVector3D(0.0f, 0.0f, zComp),
+ QVector3D(0.0f, 1.0f, 0.0f));
+
+ // Set light position
+ lightPos = QVector3D(0.0f, -m_yAdjustment, zComp);
+#endif
+
+ // Bind bar shader
+ m_barShader->bind();
+
+ // Draw bars
+ // Draw the selected row / column
+ for (int bar = startBar; bar != stopBar; bar += stepBar) {
+ BarRenderItem *item = m_sliceSelection->at(bar);
+ if (!item)
+ continue;
+
+ if (item->height() < 0)
+ glCullFace(GL_FRONT);
+ else
+ glCullFace(GL_BACK);
+
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 MVPMatrix;
+ QMatrix4x4 itModelMatrix;
+
+ GLfloat barPosY = item->translation().y() - m_yAdjustment / 2.0f + 0.2f; // we need some room for labels underneath; add +0.2f
+ if (QDataVis::ModeSliceRow == m_cachedSelectionMode)
+ barPosX = item->translation().x();
+ else
+ barPosX = -(item->translation().z() - zComp); // flip z; frontmost bar to the left
+ modelMatrix.translate(barPosX, barPosY, zComp);
+ modelMatrix.scale(QVector3D(m_scaleX, item->height(), m_scaleZ));
+ itModelMatrix.scale(QVector3D(m_scaleX, item->height(), m_scaleZ));
+
+ MVPMatrix = projectionMatrix * viewMatrix * modelMatrix;
+
+#if 0
+ QVector3D baseColor = Utils::vectorFromColor(m_cachedTheme.m_baseColor);
+ QVector3D heightColor = Utils::vectorFromColor(m_cachedTheme.m_heightColor) * item->height();
+
+ QVector3D barColor = baseColor + heightColor;
+#else
+ QVector3D barColor = Utils::vectorFromColor(m_cachedTheme.m_baseColor);
+#endif
+
+ if (item->height() != 0) {
+ // Set shader bindings
+ m_barShader->setUniformValue(m_barShader->lightP(), lightPos);
+ m_barShader->setUniformValue(m_barShader->view(), viewMatrix);
+ m_barShader->setUniformValue(m_barShader->model(), modelMatrix);
+ m_barShader->setUniformValue(m_barShader->nModel(),
+ itModelMatrix.inverted().transposed());
+ m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix);
+ m_barShader->setUniformValue(m_barShader->color(), barColor);
+ m_barShader->setUniformValue(m_barShader->lightS(), 0.25f);
+ m_barShader->setUniformValue(m_barShader->ambientS(),
+ m_cachedTheme.m_ambientStrength * 1.5f);
+
+ // Draw the object
+ m_drawer->drawObject(m_barShader, m_barObj);
+ }
+ }
+
+ // Release bar shader
+ m_barShader->release();
+
+ // Draw labels
+ m_labelShader->bind();
+ glDisable(GL_DEPTH_TEST);
+ glEnable(GL_TEXTURE_2D);
+ glCullFace(GL_BACK);
+ if (m_cachedLabelTransparency > QDataVis::TransparencyNone) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
+
+ // Draw labels for axes
+ BarRenderItem *dummyItem(0);
+ const LabelItem &sliceSelectionLabel = *m_sliceTitleItem;
+ if (QDataVis::ModeSliceRow == m_cachedSelectionMode) {
+ if (m_sliceTitleItem) {
+ m_drawer->drawLabel(*dummyItem, sliceSelectionLabel, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(0.0f, 0.0f, 0.0f), 0,
+ m_cachedSelectionMode, m_labelShader,
+ m_labelObj, m_cachedScene->camera(), false, false, Drawer::LabelTop);
+ }
+ m_drawer->drawLabel(*dummyItem, zLabel, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(0.0f, 0.0f, 0.0f), 0,
+ m_cachedSelectionMode, m_labelShader,
+ m_labelObj, m_cachedScene->camera(), false, false, Drawer::LabelBottom);
+ } else {
+ m_drawer->drawLabel(*dummyItem, xLabel, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(0.0f, 0.0f, 0.0f), 0,
+ m_cachedSelectionMode, m_labelShader,
+ m_labelObj, m_cachedScene->camera(), false, false, Drawer::LabelBottom);
+ if (m_sliceTitleItem) {
+ m_drawer->drawLabel(*dummyItem, sliceSelectionLabel, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(0.0f, 0.0f, 0.0f), 0,
+ m_cachedSelectionMode, m_labelShader,
+ m_labelObj, m_cachedScene->camera(), false, false, Drawer::LabelTop);
+ }
+ }
+ m_drawer->drawLabel(*dummyItem, yLabel, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(0.0f, 0.0f, 90.0f), 0,
+ m_cachedSelectionMode, m_labelShader,
+ m_labelObj, m_cachedScene->camera(), false, false, Drawer::LabelLeft);
+
+ // Draw labels for bars
+ for (int col = 0; col < m_sliceSelection->size(); col++) {
+ BarRenderItem *item = m_sliceSelection->at(col);
+ // Draw values
+ m_drawer->drawLabel(*item, item->sliceLabelItem(), viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(0.0f, 0.0f, 0.0f), item->height(),
+ m_cachedSelectionMode, m_labelShader,
+ m_labelObj, m_cachedScene->camera());
+
+ // Draw labels
+ if (m_sliceCache->labelItems().size() > col) {
+ const LabelItem *labelItem(0);
+ // If draw order of bars is flipped, label draw order should be too
+ if (m_xFlipped) {
+ labelItem = m_sliceCache->labelItems().at(
+ m_sliceCache->labelItems().size() - col - 1);
+ } else {
+ labelItem = m_sliceCache->labelItems().at(col);
+ }
+ m_drawer->drawLabel(*item, *labelItem, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(0.0f, 0.0f, -45.0f), item->height(),
+ m_cachedSelectionMode, m_labelShader,
+ m_labelObj, m_cachedScene->camera(), false, false, Drawer::LabelBelow);
+ }
+ }
+
+ glDisable(GL_TEXTURE_2D);
+ if (m_cachedLabelTransparency > QDataVis::TransparencyNone)
+ glDisable(GL_BLEND);
+ glEnable(GL_DEPTH_TEST);
+
+ // Release label shader
+ m_labelShader->release();
+}
+
+void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
+{
+ GLint startBar = 0;
+ GLint stopBar = 0;
+ GLint stepBar = 0;
+
+ GLint startRow = 0;
+ GLint stopRow = 0;
+ GLint stepRow = 0;
+
+ GLfloat backgroundRotation = 0;
+
+ GLfloat colPos = 0;
+ GLfloat rowPos = 0;
+
+ //m_selection = selectionSkipColor;
+
+ // Specify viewport
+ glViewport(m_mainViewPort.x(), m_mainViewPort.y(),
+ m_mainViewPort.width(), m_mainViewPort.height());
+
+ // Set up projection matrix
+ QMatrix4x4 projectionMatrix;
+ projectionMatrix.perspective(45.0f, (GLfloat)m_mainViewPort.width()
+ / (GLfloat)m_mainViewPort.height(), 0.1f, 100.0f);
+
+ // Get the view matrix
+ QMatrix4x4 viewMatrix = m_cachedScene->camera()->viewMatrix();
+
+ // Calculate drawing order
+ // Draw order is reversed to optimize amount of drawing (ie. draw front objects first, depth test handles not needing to draw objects behind them)
+ if (viewMatrix.row(0).x() > 0) {
+ startRow = 0;
+ stopRow = m_cachedRowCount;
+ stepRow = 1;
+ m_zFlipped = false;
+ } else {
+ startRow = m_cachedRowCount - 1;
+ stopRow = -1;
+ stepRow = -1;
+ m_zFlipped = true;
+ }
+ if (viewMatrix.row(0).z() <= 0) {
+ startBar = 0;
+ stopBar = m_cachedColumnCount;
+ stepBar = 1;
+ m_xFlipped = false;
+ } else {
+ startBar = m_cachedColumnCount - 1;
+ stopBar = -1;
+ stepBar = -1;
+ m_xFlipped = true;
+ }
+
+ // Check if we're viewing the scene from below
+ if (viewMatrix.row(2).y() < 0)
+ m_yFlipped = true;
+ else
+ m_yFlipped = false;
+
+ // calculate background rotation based on view matrix rotation
+ if (viewMatrix.row(0).x() > 0 && viewMatrix.row(0).z() <= 0)
+ backgroundRotation = 270.0f;
+ else if (viewMatrix.row(0).x() > 0 && viewMatrix.row(0).z() > 0)
+ backgroundRotation = 180.0f;
+ else if (viewMatrix.row(0).x() <= 0 && viewMatrix.row(0).z() > 0)
+ backgroundRotation = 90.0f;
+ else if (viewMatrix.row(0).x() <= 0 && viewMatrix.row(0).z() <= 0)
+ backgroundRotation = 0.0f;
+
+ // Get light position from the scene
+ QVector3D lightPos = m_cachedScene->light()->position();
+
+ // Skip depth rendering if we're in slice mode
+ // TODO: Fix this, causes problems if depth rendering is off in slice mode
+ // Introduce regardless of shadow quality to simplify logic
+ QMatrix4x4 depthViewMatrix;
+ QMatrix4x4 depthProjectionMatrix;
+
+#if !defined(QT_OPENGL_ES_2)
+ if (m_cachedShadowQuality > QDataVis::ShadowNone/*!m_cachedIsSlicingActivated*/) {
+ // Render scene into a depth texture for using with shadow mapping
+ // Enable drawing to depth framebuffer
+ glBindFramebuffer(GL_FRAMEBUFFER, m_depthFrameBuffer);
+ glClear(GL_DEPTH_BUFFER_BIT);
+
+ // Bind depth shader
+ m_depthShader->bind();
+
+ // Set viewport for depth map rendering. Must match texture size. Larger values give smoother shadows.
+ glViewport(m_mainViewPort.x(), m_mainViewPort.y(),
+ m_mainViewPort.width() * m_shadowQualityMultiplier,
+ m_mainViewPort.height() * m_shadowQualityMultiplier);
+
+ // Get the depth view matrix
+ // It may be possible to hack lightPos here if we want to make some tweaks to shadow
+ QVector3D depthLightPos = m_cachedScene->camera()->calculatePositionRelativeToCamera(
+ QVector3D(0.0f, 0.0f, zComp), 0.0f, 1.5f / m_autoScaleAdjustment);
+ depthViewMatrix.lookAt(depthLightPos, QVector3D(0.0f, -m_yAdjustment, zComp),
+ QVector3D(0.0f, 1.0f, 0.0f));
+
+ // TODO: Why does depthViewMatrix.column(3).y() goes to zero when we're directly above?
+ // That causes the scene to be not drawn from above -> must be fixed
+ // qDebug() << lightPos << depthViewMatrix << depthViewMatrix.column(3);
+ // Set the depth projection matrix
+#ifndef USE_WIDER_SHADOWS
+ // Use this for perspective shadows
+ depthProjectionMatrix.perspective(15.0f, (GLfloat)m_mainViewPort.width()
+ / (GLfloat)m_mainViewPort.height(), 3.0f, 100.0f);
+#else
+ // Use these for orthographic shadows
+ //GLfloat testAspectRatio = (GLfloat)m_mainViewPort.width() / (GLfloat)m_mainViewPort.height();
+ //qDebug() << m_autoScaleAdjustment << m_yAdjustment;
+ depthProjectionMatrix.ortho(-2.0f * 2.0f, 2.0f * 2.0f,
+ -2.0f, 2.0f,
+ 0.0f, 100.0f);
+#endif
+ // Draw bars to depth buffer
+ for (int row = startRow; row != stopRow; row += stepRow) {
+ for (int bar = startBar; bar != stopBar; bar += stepBar) {
+ const BarRenderItem &item = m_renderItemArray.at(row).at(bar);
+ if (!item.value())
+ continue;
+
+ // Set front face culling for positive valued bars and back face culling for
+ // negative valued bars to reduce self-shadowing issues
+ if (item.height() < 0)
+ glCullFace(GL_BACK);
+ else
+ glCullFace(GL_FRONT);
+
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 MVPMatrix;
+
+ colPos = (bar + 0.5f) * (m_cachedBarSpacing.width());
+ rowPos = (row + 0.5f) * (m_cachedBarSpacing.height());
+
+ modelMatrix.translate((colPos - m_rowWidth) / m_scaleFactor,
+ item.height() - m_yAdjustment,
+ (m_columnDepth - rowPos) / m_scaleFactor + zComp);
+ modelMatrix.scale(QVector3D(m_scaleX, item.height(), m_scaleZ));
+
+ MVPMatrix = depthProjectionMatrix * depthViewMatrix * modelMatrix;
+
+ m_depthShader->setUniformValue(m_depthShader->MVP(), MVPMatrix);
+
+ // 1st attribute buffer : vertices
+ glEnableVertexAttribArray(m_depthShader->posAtt());
+ glBindBuffer(GL_ARRAY_BUFFER, m_barObj->vertexBuf());
+ glVertexAttribPointer(m_depthShader->posAtt(), 3, GL_FLOAT, GL_FALSE, 0,
+ (void *)0);
+
+ // Index buffer
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_barObj->elementBuf());
+
+ // Draw the triangles
+ glDrawElements(GL_TRIANGLES, m_barObj->indexCount(), GL_UNSIGNED_SHORT,
+ (void *)0);
+
+ // Free buffers
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ glDisableVertexAttribArray(m_depthShader->posAtt());
+ }
+ }
+
+ // Disable drawing to depth framebuffer (= enable drawing to screen)
+ glBindFramebuffer(GL_FRAMEBUFFER, defaultFboHandle);
+
+ // Release depth shader
+ m_depthShader->release();
+
+#if 0 // Use this if you want to see what is being drawn to the framebuffer
+ // You'll also have to comment out GL_COMPARE_R_TO_TEXTURE -line in texturehelper (if using it)
+ m_labelShader->bind();
+ glCullFace(GL_BACK);
+ glEnable(GL_TEXTURE_2D);
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 viewmatrix;
+ viewmatrix.lookAt(QVector3D(0.0f, 0.0f, 2.5f + zComp),
+ QVector3D(0.0f, 0.0f, zComp),
+ QVector3D(0.0f, 1.0f, 0.0f));
+ modelMatrix.translate(0.0, 0.0, zComp);
+ QMatrix4x4 MVPMatrix = projectionMatrix * viewmatrix * modelMatrix;
+ m_labelShader->setUniformValue(m_labelShader->MVP(), MVPMatrix);
+ m_drawer->drawObject(m_labelShader, m_labelObj,
+ m_depthTexture);
+ glDisable(GL_TEXTURE_2D);
+ m_labelShader->release();
+#endif
+ // Reset culling to normal
+ glCullFace(GL_BACK);
+
+ // Revert to original viewport
+ glViewport(m_mainViewPort.x(), m_mainViewPort.y(),
+ m_mainViewPort.width(), m_mainViewPort.height());
+ }
+#endif
+
+ // Skip selection mode drawing if we're slicing or have no selection mode
+ if (!m_cachedIsSlicingActivated && m_cachedSelectionMode > QDataVis::ModeNone) {
+ // Bind selection shader
+ m_selectionShader->bind();
+
+ // Draw bars to selection buffer
+ glBindFramebuffer(GL_FRAMEBUFFER, m_selectionFrameBuffer);
+ glEnable(GL_DEPTH_TEST); // Needed, otherwise the depth render buffer is not used
+ glClearColor(selectionSkipColor.x() / 255, selectionSkipColor.y() / 255,
+ selectionSkipColor.z() / 255, 1.0f); // Set clear color to white (= selectionSkipColor)
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Needed for clearing the frame buffer
+ glDisable(GL_DITHER); // disable dithering, it may affect colors if enabled
+ for (int row = startRow; row != stopRow; row += stepRow) {
+ for (int bar = startBar; bar != stopBar; bar += stepBar) {
+ const BarRenderItem &item = m_renderItemArray.at(row).at(bar);
+ if (!item.value())
+ continue;
+
+ if (item.height() < 0)
+ glCullFace(GL_FRONT);
+ else
+ glCullFace(GL_BACK);
+
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 MVPMatrix;
+
+ colPos = (bar + 0.5f) * (m_cachedBarSpacing.width());
+ rowPos = (row + 0.5f) * (m_cachedBarSpacing.height());
+
+ modelMatrix.translate((colPos - m_rowWidth) / m_scaleFactor,
+ item.height() - m_yAdjustment,
+ (m_columnDepth - rowPos) / m_scaleFactor + zComp);
+ modelMatrix.scale(QVector3D(m_scaleX, item.height(), m_scaleZ));
+
+ MVPMatrix = projectionMatrix * viewMatrix * modelMatrix;
+
+ // TODO: Save position to qdataitem, so that we don't need to calculate it each time?
+
+ //#if !defined(QT_OPENGL_ES_2)
+ // QVector3D barColor = QVector3D((GLdouble)row / 32767.0,
+ // (GLdouble)bar / 32767.0,
+ // 0.0);
+ //#else
+ QVector3D barColor = QVector3D((GLdouble)row / 255.0,
+ (GLdouble)bar / 255.0,
+ 0.0);
+ //#endif
+
+ m_selectionShader->setUniformValue(m_selectionShader->MVP(), MVPMatrix);
+ m_selectionShader->setUniformValue(m_selectionShader->color(), barColor);
+
+ // 1st attribute buffer : vertices
+ glEnableVertexAttribArray(m_selectionShader->posAtt());
+ glBindBuffer(GL_ARRAY_BUFFER, m_barObj->vertexBuf());
+ glVertexAttribPointer(m_selectionShader->posAtt(), 3, GL_FLOAT, GL_FALSE, 0,
+ (void *)0);
+
+ // Index buffer
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_barObj->elementBuf());
+
+ // Draw the triangles
+ glDrawElements(GL_TRIANGLES, m_barObj->indexCount(), GL_UNSIGNED_SHORT, (void *)0);
+
+ // Free buffers
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ glDisableVertexAttribArray(m_selectionShader->posAtt());
+ }
+ }
+ glEnable(GL_DITHER);
+
+ // Read color under cursor
+ if (QDataVis::InputOnScene == m_controller->inputState()) {
+ m_selection = Utils::getSelection(m_controller->inputPosition(),
+ m_cachedBoundingRect.height());
+ }
+
+ glBindFramebuffer(GL_FRAMEBUFFER, defaultFboHandle);
+
+ // Release selection shader
+ m_selectionShader->release();
+
+#if 0 // Use this if you want to see what is being drawn to the framebuffer
+ glCullFace(GL_BACK);
+ m_labelShader->bind();
+ glDisable(GL_DEPTH_TEST);
+ glEnable(GL_TEXTURE_2D);
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 viewmatrix;
+ viewmatrix.lookAt(QVector3D(0.0f, 0.0f, 2.0f + zComp),
+ QVector3D(0.0f, 0.0f, zComp),
+ QVector3D(0.0f, 1.0f, 0.0f));
+ modelMatrix.translate(0.0, 0.0, zComp);
+ QMatrix4x4 MVPMatrix = projectionMatrix * viewmatrix * modelMatrix;
+ m_labelShader->setUniformValue(m_labelShader->MVP(), MVPMatrix);
+ m_drawer->drawObject(m_labelShader, m_labelObj, m_selectionTexture);
+ glDisable(GL_TEXTURE_2D);
+ m_labelShader->release();
+#endif
+ }
+
+ // Enable texturing
+ glEnable(GL_TEXTURE_2D);
+
+ // Bind bar shader
+ m_barShader->bind();
+
+ bool selectionDirty = (m_selection != m_previousSelection
+ || (m_selection != selectionSkipColor
+ && QDataVis::InputOnScene == m_controller->inputState()
+ && !m_cachedIsSlicingActivated));
+ if (selectionDirty) {
+ m_previousSelection = m_selection;
+ if (m_sliceSelection) {
+ if (!m_cachedIsSlicingActivated) {
+ m_sliceCache = 0;
+ m_sliceTitleItem = 0;
+ }
+ if (m_sliceSelection->size()) {
+ // Slice doesn't own its items, no need to delete them - just clear
+ m_sliceSelection->clear();
+ }
+ }
+ }
+
+ // Draw bars
+ bool barSelectionFound = false;
+ BarRenderItem *selectedBar(0);
+ for (int row = startRow; row != stopRow; row += stepRow) {
+ for (int bar = startBar; bar != stopBar; bar += stepBar) {
+ BarRenderItem &item = m_renderItemArray[row][bar];
+
+ if (item.height() < 0)
+ glCullFace(GL_FRONT);
+ else
+ glCullFace(GL_BACK);
+
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 itModelMatrix;
+ QMatrix4x4 MVPMatrix;
+ QMatrix4x4 depthMVPMatrix;
+
+ colPos = (bar + 0.5f) * (m_cachedBarSpacing.width());
+ rowPos = (row + 0.5f) * (m_cachedBarSpacing.height());
+
+ modelMatrix.translate((colPos - m_rowWidth) / m_scaleFactor,
+ item.height() - m_yAdjustment,
+ (m_columnDepth - rowPos) / m_scaleFactor + zComp);
+ modelMatrix.scale(QVector3D(m_scaleX, item.height(), m_scaleZ));
+ itModelMatrix.scale(QVector3D(m_scaleX, item.height(), m_scaleZ));
+#ifdef SHOW_DEPTH_TEXTURE_SCENE
+ MVPMatrix = depthProjectionMatrix * depthViewMatrix * modelMatrix;
+#else
+ MVPMatrix = projectionMatrix * viewMatrix * modelMatrix;
+#endif
+ depthMVPMatrix = depthProjectionMatrix * depthViewMatrix * modelMatrix;
+
+#if 0
+ QVector3D baseColor = Utils::vectorFromColor(m_cachedTheme.m_baseColor);
+ QVector3D heightColor = Utils::vectorFromColor(m_cachedTheme.m_heightColor) * item.height();
+ QVector3D depthColor = Utils::vectorFromColor(m_cachedTheme.m_depthColor)
+ * (float(row) / GLfloat(m_cachedRowCount));
+
+ QVector3D barColor = baseColor + heightColor + depthColor;
+#else
+ QVector3D barColor = Utils::vectorFromColor(m_cachedTheme.m_baseColor);
+#endif
+
+ GLfloat lightStrength = m_cachedTheme.m_lightStrength;
+
+ if (m_cachedSelectionMode > QDataVis::ModeNone) {
+ Bars3DController::SelectionType selectionType = isSelected(row, bar);
+
+ switch (selectionType) {
+ case Bars3DController::SelectionItem: {
+ barColor = Utils::vectorFromColor(m_cachedTheme.m_highlightBarColor);
+ lightStrength = m_cachedTheme.m_highlightLightStrength;
+ // Insert position data into render item. We have no ownership, don't delete the previous one
+ if (!m_cachedIsSlicingActivated) {
+ selectedBar = &item;
+ selectedBar->setPosition(QPoint(row, bar));
+ item.setTranslation(modelMatrix.column(3).toVector3D());
+ barSelectionFound = true;
+ }
+ if (selectionDirty && m_cachedSelectionMode >= QDataVis::ModeSliceRow) {
+ item.setTranslation(modelMatrix.column(3).toVector3D());
+ m_sliceSelection->append(&item);
+ barSelectionFound = true;
+ if (m_cachedSelectionMode == QDataVis::ModeSliceRow) {
+ if (m_axisCacheX.labelItems().size() > row)
+ m_sliceTitleItem = m_axisCacheX.labelItems().at(row);
+ if (!m_sliceCache) {
+ // m_sliceCache is the axis for labels, while title comes from different axis.
+ m_sliceCache = &m_axisCacheZ;
+ }
+ } else if (m_cachedSelectionMode == QDataVis::ModeSliceColumn) {
+ if (m_axisCacheZ.labelItems().size() > bar)
+ m_sliceTitleItem = m_axisCacheZ.labelItems().at(bar);
+ if (!m_sliceCache) {
+ // m_sliceCache is the axis for labels, while title comes from different axis.
+ m_sliceCache = &m_axisCacheX;
+ }
+ }
+ }
+ break;
+ }
+ case Bars3DController::SelectionRow: {
+ // Current bar is on the same row as the selected bar
+ barColor = Utils::vectorFromColor(m_cachedTheme.m_highlightRowColor);
+ lightStrength = m_cachedTheme.m_highlightLightStrength;
+ if (QDataVis::ModeSliceRow == m_cachedSelectionMode) {
+ item.setTranslation(modelMatrix.column(3).toVector3D());
+ if (selectionDirty)
+ m_sliceSelection->append(&item);
+ }
+ break;
+ }
+ case Bars3DController::SelectionColumn: {
+ // Current bar is on the same column as the selected bar
+ barColor = Utils::vectorFromColor(m_cachedTheme.m_highlightColumnColor);
+ lightStrength = m_cachedTheme.m_highlightLightStrength;
+ if (QDataVis::ModeSliceColumn == m_cachedSelectionMode) {
+ item.setTranslation(modelMatrix.column(3).toVector3D());
+ if (selectionDirty)
+ m_sliceSelection->append(&item);
+ }
+ break;
+ }
+ case Bars3DController::SelectionNone: {
+ // Current bar is not selected, nor on a row or column
+ // do nothing
+ break;
+ }
+ }
+ }
+
+ // Skip drawing of 0 -height bars
+ if (item.height() != 0) {
+ // Set shader bindings
+ m_barShader->setUniformValue(m_barShader->lightP(), lightPos);
+ m_barShader->setUniformValue(m_barShader->view(), viewMatrix);
+ m_barShader->setUniformValue(m_barShader->model(), modelMatrix);
+ m_barShader->setUniformValue(m_barShader->nModel(),
+ itModelMatrix.transposed().inverted());
+ m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix);
+ m_barShader->setUniformValue(m_barShader->color(), barColor);
+ m_barShader->setUniformValue(m_barShader->ambientS(), m_cachedTheme.m_ambientStrength);
+
+#if !defined(QT_OPENGL_ES_2)
+ if (m_cachedShadowQuality > QDataVis::ShadowNone) {
+ // Set shadow shader bindings
+ m_barShader->setUniformValue(m_barShader->shadowQ(), m_shadowQualityToShader);
+ m_barShader->setUniformValue(m_barShader->depth(), depthMVPMatrix);
+ m_barShader->setUniformValue(m_barShader->lightS(), lightStrength / 10.0f);
+
+ // Draw the object
+ m_drawer->drawObject(m_barShader, m_barObj, 0, m_depthTexture);
+ } else
+#endif
+ {
+ // Set shadowless shader bindings
+ m_barShader->setUniformValue(m_barShader->lightS(), lightStrength);
+
+ // Draw the object
+ m_drawer->drawObject(m_barShader, m_barObj);
+ }
+ }
+ }
+ }
+
+ if (selectionDirty)
+ emit selectedBarPosChanged(QPoint(int(m_selection.x()), int(m_selection.y())));
+
+ // Release bar shader
+ m_barShader->release();
+
+ // Bind background shader
+ m_backgroundShader->bind();
+
+ if (m_hasNegativeValues)
+ glDisable(GL_CULL_FACE);
+ else
+ glCullFace(GL_BACK);
+
+ // Draw background
+ if (m_cachedIsBackgroundEnabled && m_backgroundObj) {
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 MVPMatrix;
+ QMatrix4x4 depthMVPMatrix;
+ QMatrix4x4 itModelMatrix;
+
+ modelMatrix.translate(0.0f, 1.0f - m_yAdjustment, zComp);
+ modelMatrix.scale(QVector3D(m_rowWidth / m_scaleFactor,
+ 1.0f,
+ m_columnDepth / m_scaleFactor));
+ modelMatrix.rotate(backgroundRotation, 0.0f, 1.0f, 0.0f);
+ itModelMatrix.scale(QVector3D(m_rowWidth / m_scaleFactor,
+ 1.0f,
+ m_columnDepth / m_scaleFactor));
+
+#ifdef SHOW_DEPTH_TEXTURE_SCENE
+ MVPMatrix = depthProjectionMatrix * depthViewMatrix * modelMatrix;
+#else
+ MVPMatrix = projectionMatrix * viewMatrix * modelMatrix;
+#endif
+ depthMVPMatrix = depthProjectionMatrix * depthViewMatrix * modelMatrix;
+
+ QVector3D backgroundColor = Utils::vectorFromColor(m_cachedTheme.m_backgroundColor);
+
+ // Set shader bindings
+ m_backgroundShader->setUniformValue(m_backgroundShader->lightP(), lightPos);
+ m_backgroundShader->setUniformValue(m_backgroundShader->view(), viewMatrix);
+ m_backgroundShader->setUniformValue(m_backgroundShader->model(), modelMatrix);
+ m_backgroundShader->setUniformValue(m_backgroundShader->nModel(),
+ itModelMatrix.inverted().transposed());
+ m_backgroundShader->setUniformValue(m_backgroundShader->MVP(), MVPMatrix);
+ m_backgroundShader->setUniformValue(m_backgroundShader->color(), backgroundColor);
+ m_backgroundShader->setUniformValue(m_backgroundShader->ambientS(),
+ m_cachedTheme.m_ambientStrength * 4.0f);
+
+#if !defined(QT_OPENGL_ES_2)
+ if (m_cachedShadowQuality > QDataVis::ShadowNone) {
+ // Set shadow shader bindings
+ m_backgroundShader->setUniformValue(m_backgroundShader->shadowQ(),
+ m_shadowQualityToShader);
+ m_backgroundShader->setUniformValue(m_backgroundShader->depth(), depthMVPMatrix);
+ m_backgroundShader->setUniformValue(m_backgroundShader->lightS(),
+ m_cachedTheme.m_lightStrength / 10.0f);
+
+ // Draw the object
+ m_drawer->drawObject(m_backgroundShader, m_backgroundObj, 0, m_depthTexture);
+ } else
+#endif
+ {
+ // Set shadowless shader bindings
+ m_backgroundShader->setUniformValue(m_backgroundShader->lightS(),
+ m_cachedTheme.m_lightStrength);
+
+ // Draw the object
+ m_drawer->drawObject(m_backgroundShader, m_backgroundObj);
+ }
+ }
+
+ // Release background shader
+ m_backgroundShader->release();
+
+ // Disable textures
+ glDisable(GL_TEXTURE_2D);
+
+ // Reset culling
+ if (m_hasNegativeValues) {
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+ }
+
+ // Draw grid lines
+ if (m_cachedIsGridEnabled && m_heightNormalizer) {
+ ShaderHelper *lineShader = m_backgroundShader;
+ // Bind bar shader
+ lineShader->bind();
+
+ // Set unchanging shader bindings
+ QVector3D barColor = Utils::vectorFromColor(m_cachedTheme.m_gridLine);
+ lineShader->setUniformValue(lineShader->lightP(), lightPos);
+ lineShader->setUniformValue(lineShader->view(), viewMatrix);
+ lineShader->setUniformValue(lineShader->color(), barColor);
+ lineShader->setUniformValue(lineShader->ambientS(), m_cachedTheme.m_ambientStrength);
+
+ // Floor lines: rows
+ for (GLfloat row = 0.0f; row <= m_cachedRowCount; row++) {
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 MVPMatrix;
+ QMatrix4x4 depthMVPMatrix;
+ QMatrix4x4 itModelMatrix;
+
+ rowPos = row * m_cachedBarSpacing.height();
+ modelMatrix.translate(0.0f, -m_yAdjustment,
+ (m_columnDepth - rowPos) / m_scaleFactor + zComp);
+ modelMatrix.scale(QVector3D(m_rowWidth / m_scaleFactor, gridLineWidth,
+ gridLineWidth));
+ itModelMatrix.scale(QVector3D(m_rowWidth / m_scaleFactor, gridLineWidth,
+ gridLineWidth));
+ // If we're viewing from below, grid line object must be flipped
+ if (m_yFlipped)
+ modelMatrix.rotate(180.0f, 1.0, 0.0, 0.0);
+
+ MVPMatrix = projectionMatrix * viewMatrix * modelMatrix;
+ depthMVPMatrix = depthProjectionMatrix * depthViewMatrix * modelMatrix;
+
+ // Set the rest of the shader bindings
+ lineShader->setUniformValue(lineShader->model(), modelMatrix);
+ lineShader->setUniformValue(lineShader->nModel(),
+ itModelMatrix.inverted().transposed());
+ lineShader->setUniformValue(lineShader->MVP(), MVPMatrix);
+
+#if !defined(QT_OPENGL_ES_2)
+ if (m_cachedShadowQuality > QDataVis::ShadowNone) {
+ // Set shadow shader bindings
+ lineShader->setUniformValue(lineShader->shadowQ(), m_shadowQualityToShader);
+ lineShader->setUniformValue(lineShader->depth(), depthMVPMatrix);
+ lineShader->setUniformValue(lineShader->lightS(),
+ m_cachedTheme.m_lightStrength / 10.0f);
+
+ // Draw the object
+ m_drawer->drawObject(lineShader, m_gridLineObj, 0, m_depthTexture);
+ } else
+#endif
+ {
+ // Set shadowless shader bindings
+ lineShader->setUniformValue(lineShader->lightS(), m_cachedTheme.m_lightStrength);
+
+ // Draw the object
+ m_drawer->drawObject(lineShader, m_gridLineObj);
+ }
+ }
+
+ // Floor lines: columns
+ for (GLfloat bar = 0.0f; bar <= m_cachedColumnCount; bar++) {
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 MVPMatrix;
+ QMatrix4x4 depthMVPMatrix;
+ QMatrix4x4 itModelMatrix;
+
+ colPos = bar * m_cachedBarSpacing.width();
+ modelMatrix.translate((m_rowWidth - colPos) / m_scaleFactor,
+ -m_yAdjustment, zComp);
+ modelMatrix.scale(QVector3D(gridLineWidth, gridLineWidth,
+ m_columnDepth / m_scaleFactor));
+ itModelMatrix.scale(QVector3D(gridLineWidth, gridLineWidth,
+ m_columnDepth / m_scaleFactor));
+
+ // If we're viewing from below, grid line object must be flipped
+ if (m_yFlipped)
+ modelMatrix.rotate(180.0f, 1.0, 0.0, 0.0);
+
+ MVPMatrix = projectionMatrix * viewMatrix * modelMatrix;
+ depthMVPMatrix = depthProjectionMatrix * depthViewMatrix * modelMatrix;
+
+ // Set the rest of the shader bindings
+ lineShader->setUniformValue(lineShader->model(), modelMatrix);
+ lineShader->setUniformValue(lineShader->nModel(),
+ itModelMatrix.inverted().transposed());
+ lineShader->setUniformValue(lineShader->MVP(), MVPMatrix);
+
+#if !defined(QT_OPENGL_ES_2)
+ if (m_cachedShadowQuality > QDataVis::ShadowNone) {
+ // Set shadow shader bindings
+ lineShader->setUniformValue(lineShader->shadowQ(), m_shadowQualityToShader);
+ lineShader->setUniformValue(lineShader->depth(), depthMVPMatrix);
+ lineShader->setUniformValue(lineShader->lightS(),
+ m_cachedTheme.m_lightStrength / 10.0f);
+
+ // Draw the object
+ m_drawer->drawObject(lineShader, m_gridLineObj, 0, m_depthTexture);
+ } else
+#endif
+ {
+ // Set shadowless shader bindings
+ lineShader->setUniformValue(lineShader->lightS(), m_cachedTheme.m_lightStrength);
+
+ // Draw the object
+ m_drawer->drawObject(lineShader, m_gridLineObj);
+ }
+ }
+
+ if (m_axisCacheY.segmentCount() > 0) {
+ // Wall lines: back wall
+ GLfloat heightStep = m_axisCacheY.subSegmentStep();
+ GLfloat startLine = 0.0f;
+
+ if (m_hasNegativeValues)
+ startLine = -m_heightNormalizer;
+
+ for (GLfloat lineHeight = startLine; lineHeight <= m_heightNormalizer;
+ lineHeight += heightStep) {
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 MVPMatrix;
+ QMatrix4x4 depthMVPMatrix;
+ QMatrix4x4 itModelMatrix;
+
+ if (m_zFlipped) {
+ modelMatrix.translate(0.0f,
+ 2.0f * lineHeight / m_heightNormalizer - m_yAdjustment,
+ m_columnDepth / m_scaleFactor + zComp);
+ } else {
+ modelMatrix.translate(0.0f,
+ 2.0f * lineHeight / m_heightNormalizer - m_yAdjustment,
+ -m_columnDepth / m_scaleFactor + zComp);
+ }
+ modelMatrix.scale(QVector3D(m_rowWidth / m_scaleFactor, gridLineWidth,
+ gridLineWidth));
+ itModelMatrix.scale(QVector3D(m_rowWidth / m_scaleFactor, gridLineWidth,
+ gridLineWidth));
+
+ MVPMatrix = projectionMatrix * viewMatrix * modelMatrix;
+ depthMVPMatrix = depthProjectionMatrix * depthViewMatrix * modelMatrix;
+
+ // Set the rest of the shader bindings
+ lineShader->setUniformValue(lineShader->model(), modelMatrix);
+ lineShader->setUniformValue(lineShader->nModel(),
+ itModelMatrix.inverted().transposed());
+ lineShader->setUniformValue(lineShader->MVP(), MVPMatrix);
+
+#if !defined(QT_OPENGL_ES_2)
+ if (m_cachedShadowQuality > QDataVis::ShadowNone) {
+ // Set shadow shader bindings
+ lineShader->setUniformValue(lineShader->shadowQ(), m_shadowQualityToShader);
+ lineShader->setUniformValue(lineShader->depth(), depthMVPMatrix);
+ lineShader->setUniformValue(lineShader->lightS(),
+ m_cachedTheme.m_lightStrength / 10.0f);
+
+ // Draw the object
+ m_drawer->drawObject(lineShader, m_gridLineObj, 0, m_depthTexture);
+ } else
+#endif
+ {
+ // Set shadowless shader bindings
+ lineShader->setUniformValue(lineShader->lightS(), m_cachedTheme.m_lightStrength);
+
+ // Draw the object
+ m_drawer->drawObject(lineShader, m_gridLineObj);
+ }
+ }
+
+ // Wall lines: side wall
+ for (GLfloat lineHeight = startLine; lineHeight <= m_heightNormalizer;
+ lineHeight += heightStep) {
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 MVPMatrix;
+ QMatrix4x4 depthMVPMatrix;
+ QMatrix4x4 itModelMatrix;
+
+ if (m_xFlipped) {
+ modelMatrix.translate(m_rowWidth / m_scaleFactor,
+ 2.0f * lineHeight / m_heightNormalizer - m_yAdjustment,
+ zComp);
+ } else {
+ modelMatrix.translate(-m_rowWidth / m_scaleFactor,
+ 2.0f * lineHeight / m_heightNormalizer - m_yAdjustment,
+ zComp);
+ }
+ modelMatrix.scale(QVector3D(gridLineWidth, gridLineWidth,
+ m_columnDepth / m_scaleFactor));
+ itModelMatrix.scale(QVector3D(gridLineWidth, gridLineWidth,
+ m_columnDepth / m_scaleFactor));
+
+ MVPMatrix = projectionMatrix * viewMatrix * modelMatrix;
+ depthMVPMatrix = depthProjectionMatrix * depthViewMatrix * modelMatrix;
+
+ // Set the rest of the shader bindings
+ lineShader->setUniformValue(lineShader->model(), modelMatrix);
+ lineShader->setUniformValue(lineShader->nModel(),
+ itModelMatrix.inverted().transposed());
+ lineShader->setUniformValue(lineShader->MVP(), MVPMatrix);
+
+#if !defined(QT_OPENGL_ES_2)
+ if (m_cachedShadowQuality > QDataVis::ShadowNone) {
+ // Set shadow shader bindings
+ lineShader->setUniformValue(lineShader->shadowQ(), m_shadowQualityToShader);
+ lineShader->setUniformValue(lineShader->depth(), depthMVPMatrix);
+ lineShader->setUniformValue(lineShader->lightS(),
+ m_cachedTheme.m_lightStrength / 10.0f);
+
+ // Draw the object
+ m_drawer->drawObject(lineShader, m_gridLineObj, 0, m_depthTexture);
+ } else
+#endif
+ {
+ // Set shadowless shader bindings
+ lineShader->setUniformValue(lineShader->lightS(), m_cachedTheme.m_lightStrength);
+
+ // Draw the object
+ m_drawer->drawObject(lineShader, m_gridLineObj);
+ }
+ }
+ }
+ // Release bar shader
+ lineShader->release();
+ }
+
+ // TODO: Calculations done temporarily here. When optimizing, move to after data set addition? Keep drawing of the labels here.
+ // Bind label shader
+ m_labelShader->bind();
+
+ glEnable(GL_TEXTURE_2D);
+ if (m_cachedLabelTransparency > QDataVis::TransparencyNone) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
+
+ // Calculate the positions for row and column labels and store them
+ for (int row = 0; row != m_cachedRowCount; row++) {
+ if (m_axisCacheX.labelItems().size() > row) {
+ // Go through all rows and get position of max+1 or min-1 column, depending on x flip
+ // We need only positions for them, labels have already been generated at QDataSetPrivate. Just add LabelItems
+ rowPos = (row + 0.5f) * m_cachedBarSpacing.height();
+ colPos = (m_rowWidth / m_scaleFactor) + labelMargin;
+ GLfloat rotLabelX = -90.0f;
+ GLfloat rotLabelY = 0.0f;
+ GLfloat rotLabelZ = 0.0f;
+ Qt::AlignmentFlag alignment = Qt::AlignRight;
+ if (m_zFlipped)
+ rotLabelY = 180.0f;
+ if (m_xFlipped) {
+ colPos = -(m_rowWidth / m_scaleFactor) - labelMargin;
+ alignment = Qt::AlignLeft;
+ }
+ if (m_yFlipped) {
+ if (m_zFlipped)
+ rotLabelY = 0.0f;
+ else
+ rotLabelY = 180.0f;
+ rotLabelZ = 180.0f;
+ }
+ QVector3D labelPos = QVector3D(colPos,
+ -m_yAdjustment + 0.005f, // raise a bit over background to avoid depth "glimmering"
+ (m_columnDepth - rowPos) / m_scaleFactor + zComp);
+
+ m_dummyBarRenderItem.setTranslation(labelPos);
+ const LabelItem &axisLabelItem = *m_axisCacheX.labelItems().at(row);
+ //qDebug() << "labelPos, row" << row + 1 << ":" << labelPos << m_axisCacheX.labels().at(row);
+
+ m_drawer->drawLabel(m_dummyBarRenderItem, axisLabelItem, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(rotLabelX, rotLabelY, rotLabelZ),
+ 0, m_cachedSelectionMode,
+ m_labelShader, m_labelObj, m_cachedScene->camera(), true, true, Drawer::LabelMid,
+ alignment);
+ }
+ }
+ for (int column = 0; column != m_cachedColumnCount; column += 1) {
+ if (m_axisCacheZ.labelItems().size() > column) {
+ // Go through all columns and get position of max+1 or min-1 row, depending on z flip
+ // We need only positions for them, labels have already been generated at QDataSetPrivate. Just add LabelItems
+ colPos = (column + 0.5f) * m_cachedBarSpacing.width();
+ rowPos = (m_columnDepth / m_scaleFactor) + labelMargin;
+ GLfloat rotLabelX = -90.0f;
+ GLfloat rotLabelY = 90.0f;
+ GLfloat rotLabelZ = 0.0f;
+ Qt::AlignmentFlag alignment = Qt::AlignLeft;
+ if (m_xFlipped)
+ rotLabelY = -90.0f;
+ if (m_zFlipped) {
+ rowPos = -(m_columnDepth / m_scaleFactor) - labelMargin;
+ alignment = Qt::AlignRight;
+ }
+ if (m_yFlipped) {
+ if (m_xFlipped)
+ rotLabelY = -90.0f;
+ else
+ rotLabelY = 90.0f;
+ rotLabelZ = 180.0f;
+ }
+ QVector3D labelPos = QVector3D((colPos - m_rowWidth) / m_scaleFactor,
+ -m_yAdjustment + 0.005f, // raise a bit over background to avoid depth "glimmering"
+ rowPos + zComp);
+
+ m_dummyBarRenderItem.setTranslation(labelPos);
+ const LabelItem &axisLabelItem = *m_axisCacheZ.labelItems().at(column);
+
+ m_drawer->drawLabel(m_dummyBarRenderItem, axisLabelItem, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(rotLabelX, rotLabelY, rotLabelZ),
+ 0, m_cachedSelectionMode,
+ m_labelShader, m_labelObj, m_cachedScene->camera(), true, true, Drawer::LabelMid,
+ alignment);
+ }
+ }
+
+ // Y Labels
+ int labelNbr = 0;
+ GLfloat heightStep = m_axisCacheY.segmentStep();
+ GLfloat startLine = 0.0f;
+ int labelCount = m_axisCacheY.labels().size();
+ if (m_hasNegativeValues)
+ startLine = -m_heightNormalizer;
+ GLfloat labelPos = startLine;
+
+ for (int i = 0; i < labelCount; i++) {
+ if (m_axisCacheY.labelItems().size() > labelNbr) {
+ GLfloat labelMarginXTrans = labelMargin;
+ GLfloat labelMarginZTrans = labelMargin;
+ GLfloat labelXTrans = m_rowWidth / m_scaleFactor;
+ GLfloat labelZTrans = m_columnDepth / m_scaleFactor;
+ GLfloat labelYTrans = 2.0f * labelPos / m_heightNormalizer - m_yAdjustment;
+ GLfloat rotLabelX = 0.0f;
+ GLfloat rotLabelY = -90.0f;
+ GLfloat rotLabelZ = 0.0f;
+ Qt::AlignmentFlag alignment = Qt::AlignLeft;
+ if (!m_xFlipped) {
+ labelXTrans = -labelXTrans;
+ labelMarginXTrans = -labelMargin;
+ rotLabelY = 90.0f;
+ }
+ if (m_zFlipped) {
+ labelZTrans = -labelZTrans;
+ labelMarginZTrans = -labelMargin;
+ alignment = Qt::AlignRight;
+ }
+
+ const LabelItem &axisLabelItem = *m_axisCacheY.labelItems().at(labelNbr);
+
+ // Back wall
+ QVector3D labelTrans = QVector3D(labelXTrans, labelYTrans,
+ labelZTrans + labelMarginZTrans + zComp);
+
+ //qDebug() << "labelPos, value:" << labelTrans;
+
+ m_dummyBarRenderItem.setTranslation(labelTrans);
+ m_drawer->drawLabel(m_dummyBarRenderItem, axisLabelItem, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(rotLabelX, rotLabelY, rotLabelZ),
+ 0, m_cachedSelectionMode,
+ m_labelShader, m_labelObj, m_cachedScene->camera(), true, true, Drawer::LabelMid,
+ alignment);
+
+ // Side wall
+ if (m_xFlipped)
+ alignment = Qt::AlignLeft;
+ else
+ alignment = Qt::AlignRight;
+ if (m_zFlipped)
+ rotLabelY = 180.0f;
+ else
+ rotLabelY = 0.0f;
+
+ labelTrans = QVector3D(-labelXTrans - labelMarginXTrans, labelYTrans,
+ -labelZTrans + zComp);
+
+ m_dummyBarRenderItem.setTranslation(labelTrans);
+ m_drawer->drawLabel(m_dummyBarRenderItem, axisLabelItem, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(rotLabelX, rotLabelY, rotLabelZ),
+ 0, m_cachedSelectionMode,
+ m_labelShader, m_labelObj, m_cachedScene->camera(), true, true, Drawer::LabelMid,
+ alignment);
+ }
+ labelNbr++;
+ labelPos += heightStep;
+ }
+
+ // Handle slice activation and selection label drawing
+ if (!barSelectionFound) {
+ // We have no ownership, don't delete. Just NULL the pointer.
+ m_selectedBar = NULL;
+ if (m_cachedIsSlicingActivated
+ && (m_selection == selectionSkipColor
+ || QDataVis::InputOnOverview == m_controller->inputState()))
+ m_cachedScene->setSlicingActivated(false);
+ } else if (m_cachedSelectionMode >= QDataVis::ModeSliceRow && selectionDirty) {
+ // Activate slice mode
+ m_cachedScene->setSlicingActivated(true);
+
+ // Create label textures
+ for (int col = 0; col < m_sliceSelection->size(); col++) {
+ BarRenderItem *item = m_sliceSelection->at(col);
+ if (item->sliceLabel().isNull())
+ item->setSliceLabel(generateValueLabel(m_axisCacheY.labelFormat(), item->value()));
+ m_drawer->generateLabelItem(item->sliceLabelItem(), item->sliceLabel());
+ }
+ } else {
+ // Print value of selected bar
+ glDisable(GL_DEPTH_TEST);
+ // Draw the selection label
+ LabelItem &labelItem = selectedBar->selectionLabelItem();
+ if (m_selectedBar != selectedBar || m_updateLabels || !labelItem.textureId()) {
+ QString labelText = selectedBar->selectionLabel();
+ if (labelText.isNull()) {
+ static const QString rowIndexTag(QStringLiteral("@rowIdx"));
+ static const QString rowLabelTag(QStringLiteral("@rowLabel"));
+ static const QString rowTitleTag(QStringLiteral("@rowTitle"));
+ static const QString colIndexTag(QStringLiteral("@colIdx"));
+ static const QString colLabelTag(QStringLiteral("@colLabel"));
+ static const QString colTitleTag(QStringLiteral("@colTitle"));
+ static const QString valueTitleTag(QStringLiteral("@valueTitle"));
+ static const QString valueLabelTag(QStringLiteral("@valueLabel"));
+
+ // Custom format expects printf format specifier. There is no tag for it.
+ labelText = generateValueLabel(itemLabelFormat(), selectedBar->value());
+
+ int selBarPosX = selectedBar->position().x();
+ int selBarPosY = selectedBar->position().y();
+ labelText.replace(rowIndexTag, QString::number(selBarPosX));
+ if (m_axisCacheX.labels().size() > selBarPosX)
+ labelText.replace(rowLabelTag, m_axisCacheX.labels().at(selBarPosX));
+ else
+ labelText.replace(rowLabelTag, QString());
+ labelText.replace(rowTitleTag, m_axisCacheX.title());
+ labelText.replace(colIndexTag, QString::number(selBarPosY));
+ if (m_axisCacheZ.labels().size() > selBarPosY)
+ labelText.replace(colLabelTag, m_axisCacheZ.labels().at(selBarPosY));
+ else
+ labelText.replace(colLabelTag, QString());
+ labelText.replace(colTitleTag, m_axisCacheZ.title());
+ labelText.replace(valueTitleTag, m_axisCacheY.title());
+
+ if (labelText.contains(valueLabelTag)) {
+ QString labelFormat = m_axisCacheY.labelFormat();
+ if (labelFormat.isEmpty())
+ labelFormat = Utils::defaultLabelFormat();
+ QString valueLabelText = generateValueLabel(labelFormat, selectedBar->value());
+ labelText.replace(valueLabelTag, valueLabelText);
+ }
+
+ selectedBar->setSelectionLabel(labelText);
+ }
+ m_drawer->generateLabelItem(labelItem, labelText);
+ m_selectedBar = selectedBar;
+ }
+
+ m_drawer->drawLabel(*selectedBar, labelItem, viewMatrix, projectionMatrix,
+ QVector3D(0.0f, m_yAdjustment, zComp),
+ QVector3D(0.0f, 0.0f, 0.0f), selectedBar->height(),
+ m_cachedSelectionMode, m_labelShader,
+ m_labelObj, m_cachedScene->camera(), true, false);
+
+ // Reset label update flag; they should have been updated when we get here
+ m_updateLabels = false;
+
+ glEnable(GL_DEPTH_TEST);
+ }
+
+ glDisable(GL_TEXTURE_2D);
+ if (m_cachedLabelTransparency > QDataVis::TransparencyNone)
+ glDisable(GL_BLEND);
+
+ // Release label shader
+ m_labelShader->release();
+}
+
+void Bars3DRenderer::handleResize()
+{
+ if (m_cachedBoundingRect.width() == 0 || m_cachedBoundingRect.height() == 0)
+ return;
+
+ // Set view port
+ if (m_cachedIsSlicingActivated) {
+ m_mainViewPort = QRect(0,
+ m_cachedBoundingRect.height() - m_cachedBoundingRect.height() / 5,
+ m_cachedBoundingRect.width() / 5,
+ m_cachedBoundingRect.height() / 5);
+ } else {
+ m_mainViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height());
+ }
+ m_sliceViewPort = QRect(0, 0, m_cachedBoundingRect.width(), m_cachedBoundingRect.height());
+
+ Abstract3DRenderer::handleResize();
+}
+
+void Bars3DRenderer::updateBarSpecs(GLfloat thicknessRatio, const QSizeF &spacing, bool relative)
+{
+ // Convert ratio to QSizeF, as we need it in that format for autoscaling calculations
+ m_cachedBarThickness.setWidth(1.0f);
+ m_cachedBarThickness.setHeight(1.0f / thicknessRatio);
+
+ if (relative) {
+ m_cachedBarSpacing.setWidth((m_cachedBarThickness.width() * 2) * (spacing.width() + 1.0f));
+ m_cachedBarSpacing.setHeight((m_cachedBarThickness.height() * 2) * (spacing.height() + 1.0f));
+ } else {
+ m_cachedBarSpacing = m_cachedBarThickness * 2 + spacing * 2;
+ }
+
+ // Calculate here and at setting sample space
+ calculateSceneScalingFactors();
+}
+
+void Bars3DRenderer::updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, qreal min, qreal max)
+{
+ Abstract3DRenderer::updateAxisRange(orientation, min, max);
+ calculateHeightAdjustment();
+ // Check if we have negative values
+ if (min < 0 && !m_hasNegativeValues) {
+ m_hasNegativeValues = true;
+ // Reload background
+ loadBackgroundMesh();
+
+ } else if (min >= 0 && m_hasNegativeValues) {
+ m_hasNegativeValues = false;
+ // Reload background
+ loadBackgroundMesh();
+ }
+
+ // TODO Currently barchart only supports zero centered or zero minimum ranges
+ if (min > 0.0 || (min != 0.0 && (qFabs(min) != qFabs(max))))
+ qWarning() << __FUNCTION__ << "Bar chart currently properly supports only zero-centered and zero minimum ranges for Y-axis.";
+}
+
+void Bars3DRenderer::updateSampleSpace(int rowCount, int columnCount)
+{
+ // Destroy old render items and reallocate new array
+ // TODO is there a way to allocate the whole array with one allocation?
+ m_renderItemArray.clear();
+ m_renderItemArray.resize(rowCount);
+ for (int i = 0; i < rowCount; i++)
+ m_renderItemArray[i].resize(columnCount);
+
+ // Force update for selection related items
+ m_sliceCache = 0;
+ m_sliceTitleItem = 0;
+ if (m_sliceSelection)
+ m_sliceSelection->clear();
+
+ m_cachedColumnCount = columnCount;
+ m_cachedRowCount = rowCount;
+ // TODO: Invent "idiotproof" max scene size formula..
+ // This seems to work ok if spacing is not negative (and row/column or column/row ratio is not too high)
+ m_maxSceneSize = 2 * qSqrt(columnCount * rowCount);
+ //qDebug() << "maxSceneSize" << m_maxSceneSize;
+ // Calculate here and at setting bar specs
+ calculateSceneScalingFactors();
+}
+
+void Bars3DRenderer::updateSelectionMode(QDataVis::SelectionMode mode)
+{
+ Abstract3DRenderer::updateSelectionMode(mode);
+
+ // Create zoom selection if there isn't one
+ if (mode >= QDataVis::ModeSliceRow && !m_sliceSelection) {
+ m_sliceSelection = new QList<BarRenderItem *>;
+ if (mode == QDataVis::ModeSliceRow)
+ m_sliceSelection->reserve(m_cachedRowCount);
+ else
+ m_sliceSelection->reserve(m_cachedColumnCount);
+ }
+}
+
+void Bars3DRenderer::updateBackgroundEnabled(bool enable)
+{
+ if (enable != m_cachedIsBackgroundEnabled) {
+ Abstract3DRenderer::updateBackgroundEnabled(enable);
+ loadMeshFile(); // Load changed bar type
+ }
+}
+
+void Bars3DRenderer::updateSelectedBarPos(const QPoint &position)
+{
+ if (position == Bars3DController::noSelectionPoint())
+ m_selection = selectionSkipColor;
+ else
+ m_selection = QVector3D(position.x(), position.y(), 0);
+}
+
+void Bars3DRenderer::updateShadowQuality(QDataVis::ShadowQuality quality)
+{
+ m_cachedShadowQuality = quality;
+ switch (quality) {
+ case QDataVis::ShadowLow:
+ m_shadowQualityToShader = 33.3f;
+ m_shadowQualityMultiplier = 1;
+ break;
+ case QDataVis::ShadowMedium:
+ m_shadowQualityToShader = 100.0f;
+ m_shadowQualityMultiplier = 3;
+ break;
+ case QDataVis::ShadowHigh:
+ m_shadowQualityToShader = 200.0f;
+ m_shadowQualityMultiplier = 5;
+ break;
+ case QDataVis::ShadowSoftLow:
+ m_shadowQualityToShader = 5.0f;
+ m_shadowQualityMultiplier = 1;
+ break;
+ case QDataVis::ShadowSoftMedium:
+ m_shadowQualityToShader = 10.0f;
+ m_shadowQualityMultiplier = 3;
+ break;
+ case QDataVis::ShadowSoftHigh:
+ m_shadowQualityToShader = 15.0f;
+ m_shadowQualityMultiplier = 4;
+ break;
+ default:
+ m_shadowQualityToShader = 0.0f;
+ m_shadowQualityMultiplier = 1;
+ break;
+ }
+
+ handleShadowQualityChange();
+
+#if !defined(QT_OPENGL_ES_2)
+ // Re-init depth buffer
+ updateDepthBuffer();
+#endif
+}
+
+void Bars3DRenderer::loadMeshFile()
+{
+ QString objectFileName = m_cachedObjFile;
+ if (m_barObj)
+ delete m_barObj;
+ // If background is disabled, load full version of bar mesh
+ if (!m_cachedIsBackgroundEnabled)
+ objectFileName.append(QStringLiteral("Full"));
+ m_barObj = new ObjectHelper(objectFileName);
+ m_barObj->load();
+}
+
+void Bars3DRenderer::loadBackgroundMesh()
+{
+ if (m_backgroundObj)
+ delete m_backgroundObj;
+ if (m_hasNegativeValues)
+ m_backgroundObj = new ObjectHelper(QStringLiteral(":/defaultMeshes/negativeBackground"));
+ else
+ m_backgroundObj = new ObjectHelper(QStringLiteral(":/defaultMeshes/background"));
+ m_backgroundObj->load();
+}
+
+void Bars3DRenderer::loadGridLineMesh()
+{
+ if (m_gridLineObj)
+ delete m_gridLineObj;
+ m_gridLineObj = new ObjectHelper(QStringLiteral(":/defaultMeshes/bar"));
+ m_gridLineObj->load();
+}
+
+void Bars3DRenderer::loadLabelMesh()
+{
+ if (m_labelObj)
+ delete m_labelObj;
+ m_labelObj = new ObjectHelper(QStringLiteral(":/defaultMeshes/label"));
+ m_labelObj->load();
+}
+
+void Bars3DRenderer::updateTextures()
+{
+ // Drawer has changed; this flag needs to be checked when checking if we need to update labels
+ m_updateLabels = true;
+}
+
+void Bars3DRenderer::calculateSceneScalingFactors()
+{
+ // Calculate scene scaling and translation factors
+ m_rowWidth = (m_cachedColumnCount * m_cachedBarSpacing.width()) / 2.0f;
+ m_columnDepth = (m_cachedRowCount * m_cachedBarSpacing.height()) / 2.0f;
+ m_maxDimension = qMax(m_rowWidth, m_columnDepth);
+ m_scaleFactor = qMin((m_cachedColumnCount * (m_maxDimension / m_maxSceneSize)),
+ (m_cachedRowCount * (m_maxDimension / m_maxSceneSize)));
+ m_scaleX = m_cachedBarThickness.width() / m_scaleFactor;
+ m_scaleZ = m_cachedBarThickness.height() / m_scaleFactor;
+ //qDebug() << "m_scaleX" << m_scaleX << "m_scaleFactor" << m_scaleFactor;
+ //qDebug() << "m_scaleZ" << m_scaleZ << "m_scaleFactor" << m_scaleFactor;
+ //qDebug() << "m_rowWidth:" << m_rowWidth << "m_columnDepth:" << m_columnDepth << "m_maxDimension:" << m_maxDimension;
+}
+
+void Bars3DRenderer::calculateHeightAdjustment()
+{
+ m_heightNormalizer = (GLfloat)qMax(qFabs(m_axisCacheY.min()), qFabs(m_axisCacheY.max()));
+
+ // 2.0f = max difference between minimum and maximum value after scaling with m_heightNormalizer
+ GLfloat newAdjustment = 2.0f - ((m_heightNormalizer - m_axisCacheY.min()) / m_heightNormalizer);
+ if (newAdjustment != m_yAdjustment) {
+ m_hasHeightAdjustmentChanged = true;
+ m_yAdjustment = newAdjustment;
+ }
+ //qDebug() << m_yAdjustment;
+}
+
+Bars3DController::SelectionType Bars3DRenderer::isSelected(GLint row, GLint bar)
+{
+ //static QVector3D prevSel = m_selection; // TODO: For debugging
+ Bars3DController::SelectionType isSelectedType = Bars3DController::SelectionNone;
+ if (m_selection == selectionSkipColor)
+ return isSelectedType; // skip window
+
+ //#if !defined(QT_OPENGL_ES_2)
+ // QVector3D current = QVector3D((GLuint)row, (GLuint)bar, 0);
+ //#else
+ QVector3D current = QVector3D((GLubyte)row, (GLubyte)bar, 0);
+ //#endif
+
+ // TODO: For debugging
+ //if (selection != prevSel) {
+ // qDebug() << "current" << current.x() << current .y() << current.z();
+ // qDebug() << "selection" << selection.x() << selection .y() << selection.z();
+ // prevSel = selection;
+ //}
+ if (current == m_selection) {
+ isSelectedType = Bars3DController::SelectionItem;
+ }
+ else if (current.y() == m_selection.y() && (m_cachedSelectionMode == QDataVis::ModeItemAndColumn
+ || m_cachedSelectionMode == QDataVis::ModeItemRowAndColumn
+ || m_cachedSelectionMode == QDataVis::ModeSliceColumn)) {
+ isSelectedType = Bars3DController::SelectionColumn;
+ }
+ else if (current.x() == m_selection.x() && (m_cachedSelectionMode == QDataVis::ModeItemAndRow
+ || m_cachedSelectionMode == QDataVis::ModeItemRowAndColumn
+ || m_cachedSelectionMode == QDataVis::ModeSliceRow)) {
+ isSelectedType = Bars3DController::SelectionRow;
+ }
+ return isSelectedType;
+}
+
+void Bars3DRenderer::updateSlicingActive(bool isSlicing)
+{
+ if (isSlicing == m_cachedIsSlicingActivated)
+ return;
+
+ m_cachedIsSlicingActivated = isSlicing;
+ if (isSlicing) {
+ m_mainViewPort = QRect(0, m_cachedBoundingRect.height() - m_cachedBoundingRect.height() / 5,
+ m_cachedBoundingRect.width() / 5, m_cachedBoundingRect.height() / 5);
+ } else {
+ m_mainViewPort = QRect(0, 0, this->m_cachedBoundingRect.width(),
+ this->m_cachedBoundingRect.height());
+ initSelectionBuffer(); // We need to re-init selection buffer in case there has been a resize
+#if !defined(QT_OPENGL_ES_2)
+ updateDepthBuffer(); // Re-init depth buffer as well
+#endif
+ }
+}
+
+QRect Bars3DRenderer::mainViewPort()
+{
+ return m_mainViewPort;
+}
+
+void Bars3DRenderer::initShaders(const QString &vertexShader, const QString &fragmentShader)
+{
+ if (m_barShader)
+ delete m_barShader;
+ m_barShader = new ShaderHelper(this, vertexShader, fragmentShader);
+ m_barShader->initialize();
+}
+
+void Bars3DRenderer::initSelectionShader()
+{
+ if (m_selectionShader)
+ delete m_selectionShader;
+ m_selectionShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexSelection"),
+ QStringLiteral(":/shaders/fragmentSelection"));
+ m_selectionShader->initialize();
+}
+
+void Bars3DRenderer::initSelectionBuffer()
+{
+ if (m_cachedIsSlicingActivated)
+ return;
+
+ if (m_selectionTexture)
+ m_textureHelper->deleteTexture(&m_selectionTexture);
+
+ m_selectionTexture = m_textureHelper->createSelectionTexture(m_mainViewPort.size(),
+ m_selectionFrameBuffer,
+ m_selectionDepthBuffer);
+}
+
+#if !defined(QT_OPENGL_ES_2)
+void Bars3DRenderer::initDepthShader()
+{
+ if (m_depthShader)
+ delete m_depthShader;
+ m_depthShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexDepth"),
+ QStringLiteral(":/shaders/fragmentDepth"));
+ m_depthShader->initialize();
+}
+
+void Bars3DRenderer::updateDepthBuffer()
+{
+ if (m_cachedIsSlicingActivated)
+ return;
+
+ if (m_depthTexture) {
+ m_textureHelper->deleteTexture(&m_depthTexture);
+ m_depthTexture = 0;
+ }
+
+ if (m_cachedShadowQuality > QDataVis::ShadowNone) {
+ m_depthTexture = m_textureHelper->createDepthTexture(m_mainViewPort.size(),
+ m_depthFrameBuffer,
+ m_shadowQualityMultiplier);
+ if (!m_depthTexture) {
+ switch (m_cachedShadowQuality) {
+ case QDataVis::ShadowHigh:
+ qWarning("Creating high quality shadows failed. Changing to medium quality.");
+ (void)m_controller->setShadowQuality(QDataVis::ShadowMedium);
+ updateShadowQuality(QDataVis::ShadowMedium);
+ break;
+ case QDataVis::ShadowMedium:
+ qWarning("Creating medium quality shadows failed. Changing to low quality.");
+ (void)m_controller->setShadowQuality(QDataVis::ShadowLow);
+ updateShadowQuality(QDataVis::ShadowLow);
+ break;
+ case QDataVis::ShadowLow:
+ qWarning("Creating low quality shadows failed. Switching shadows off.");
+ (void)m_controller->setShadowQuality(QDataVis::ShadowNone);
+ updateShadowQuality(QDataVis::ShadowNone);
+ break;
+ case QDataVis::ShadowSoftHigh:
+ qWarning("Creating soft high quality shadows failed. Changing to soft medium quality.");
+ (void)m_controller->setShadowQuality(QDataVis::ShadowSoftMedium);
+ updateShadowQuality(QDataVis::ShadowSoftMedium);
+ break;
+ case QDataVis::ShadowSoftMedium:
+ qWarning("Creating soft medium quality shadows failed. Changing to soft low quality.");
+ (void)m_controller->setShadowQuality(QDataVis::ShadowSoftLow);
+ updateShadowQuality(QDataVis::ShadowSoftLow);
+ break;
+ case QDataVis::ShadowSoftLow:
+ qWarning("Creating soft low quality shadows failed. Switching shadows off.");
+ (void)m_controller->setShadowQuality(QDataVis::ShadowNone);
+ updateShadowQuality(QDataVis::ShadowNone);
+ break;
+ default:
+ // You'll never get here
+ break;
+ }
+ }
+ }
+}
+#endif
+
+void Bars3DRenderer::initBackgroundShaders(const QString &vertexShader,
+ const QString &fragmentShader)
+{
+ if (m_backgroundShader)
+ delete m_backgroundShader;
+ m_backgroundShader = new ShaderHelper(this, vertexShader, fragmentShader);
+ m_backgroundShader->initialize();
+}
+
+void Bars3DRenderer::initLabelShaders(const QString &vertexShader, const QString &fragmentShader)
+{
+ if (m_labelShader)
+ delete m_labelShader;
+ m_labelShader = new ShaderHelper(this, vertexShader, fragmentShader);
+ m_labelShader->initialize();
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/engine/bars3drenderer_p.h b/src/datavisualization/engine/bars3drenderer_p.h
new file mode 100644
index 00000000..3be0ebf9
--- /dev/null
+++ b/src/datavisualization/engine/bars3drenderer_p.h
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef Q3DBARSRENDERER_p_H
+#define Q3DBARSRENDERER_p_H
+
+#include "datavisualizationglobal_p.h"
+#include "bars3dcontroller_p.h"
+#include "abstract3drenderer_p.h"
+#include "qbardataproxy.h"
+#include "barrenderitem_p.h"
+
+class QPoint;
+class QSizeF;
+class QOpenGLShaderProgram;
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class ShaderHelper;
+class ObjectHelper;
+class LabelItem;
+class Q3DScene;
+
+class QT_DATAVISUALIZATION_EXPORT Bars3DRenderer : public Abstract3DRenderer
+{
+ Q_OBJECT
+
+private:
+ // TODO: Filter to the set of attributes to be moved to the model object.
+ Bars3DController *m_controller;
+
+ // Cached state based on emitted signals from the controller
+ QSizeF m_cachedBarThickness;
+ QSizeF m_cachedBarSpacing;
+ bool m_cachedIsSlicingActivated;
+ int m_cachedRowCount;
+ int m_cachedColumnCount;
+
+ // Internal state
+ BarRenderItem *m_selectedBar; // points to renderitem array
+ QList<BarRenderItem *> *m_sliceSelection;
+ AxisRenderCache *m_sliceCache; // not owned
+ const LabelItem *m_sliceTitleItem; // not owned
+ bool m_xFlipped;
+ bool m_zFlipped;
+ bool m_yFlipped;
+ QRect m_mainViewPort;
+ QRect m_sliceViewPort;
+ bool m_updateLabels;
+ ShaderHelper *m_barShader;
+ ShaderHelper *m_depthShader;
+ ShaderHelper *m_selectionShader;
+ ShaderHelper *m_backgroundShader;
+ ShaderHelper *m_labelShader;
+ ObjectHelper *m_barObj;
+ ObjectHelper *m_backgroundObj;
+ ObjectHelper *m_gridLineObj;
+ ObjectHelper *m_labelObj;
+ GLuint m_bgrTexture;
+ GLuint m_depthTexture;
+ GLuint m_selectionTexture;
+ GLuint m_depthFrameBuffer;
+ GLuint m_selectionFrameBuffer;
+ GLuint m_selectionDepthBuffer;
+ GLfloat m_shadowQualityToShader;
+ GLint m_shadowQualityMultiplier;
+ GLfloat m_heightNormalizer;
+ GLfloat m_yAdjustment;
+ GLfloat m_rowWidth;
+ GLfloat m_columnDepth;
+ GLfloat m_maxDimension;
+ GLfloat m_scaleX;
+ GLfloat m_scaleZ;
+ GLfloat m_scaleFactor;
+ GLfloat m_maxSceneSize;
+ QVector3D m_selection;
+ QVector3D m_previousSelection;
+
+ bool m_hasHeightAdjustmentChanged;
+ BarRenderItem m_dummyBarRenderItem;
+
+ BarRenderItemArray m_renderItemArray;
+
+public:
+ explicit Bars3DRenderer(Bars3DController *controller);
+ ~Bars3DRenderer();
+
+ void updateDataModel(QBarDataProxy *dataProxy);
+ void updateScene(Q3DScene *scene);
+ void render(GLuint defaultFboHandle = 0);
+
+ QRect mainViewPort();
+
+protected:
+ virtual void initializeOpenGL();
+ virtual void loadMeshFile();
+
+public slots:
+ void updateBarSpecs(GLfloat thicknessRatio = 1.0f,
+ const QSizeF &spacing = QSizeF(1.0, 1.0),
+ bool relative = true);
+ void updateSelectionMode(QDataVis::SelectionMode newMode);
+ void updateSlicingActive(bool isSlicing);
+ void updateSampleSpace(int rowCount, int columnCount);
+ void updateBackgroundEnabled(bool enable);
+ void updateSelectedBarPos(const QPoint &position);
+
+ // Overloaded from abstract renderer
+ virtual void updateAxisRange(Q3DAbstractAxis::AxisOrientation orientation, qreal min, qreal max);
+
+signals:
+ void selectedBarPosChanged(QPoint position);
+
+private:
+ virtual void initShaders(const QString &vertexShader, const QString &fragmentShader);
+ virtual void updateShadowQuality(QDataVis::ShadowQuality quality);
+ virtual void updateTextures();
+
+ void drawSlicedScene(const LabelItem &xLabel, const LabelItem &yLabel, const LabelItem &zLabel);
+ void drawScene(GLuint defaultFboHandle);
+ void handleResize();
+
+ void loadBackgroundMesh();
+ void loadGridLineMesh();
+ void loadLabelMesh();
+ void initSelectionShader();
+ void initBackgroundShaders(const QString &vertexShader, const QString &fragmentShader);
+ void initLabelShaders(const QString &vertexShader, const QString &fragmentShader);
+ void initSelectionBuffer();
+#if !defined(QT_OPENGL_ES_2)
+ void initDepthShader();
+ void updateDepthBuffer();
+#endif
+ void calculateSceneScalingFactors();
+ void calculateHeightAdjustment();
+ Abstract3DController::SelectionType isSelected(GLint row, GLint bar);
+
+ Q_DISABLE_COPY(Bars3DRenderer)
+
+ friend class BarRenderItem;
+};
+
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp
new file mode 100644
index 00000000..284d57c5
--- /dev/null
+++ b/src/datavisualization/engine/drawer.cpp
@@ -0,0 +1,347 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#include "qdatavisualizationenums.h"
+#include "drawer_p.h"
+#include "shaderhelper_p.h"
+#include "objecthelper_p.h"
+#include "abstractobjecthelper_p.h"
+#include "surfaceobject_p.h"
+#include "q3dcamera.h"
+#include "utils_p.h"
+#include "texturehelper_p.h"
+#include <QMatrix4x4>
+#include <qmath.h>
+
+// Resources need to be explicitly initialized when building as static library
+class StaticLibInitializer
+{
+public:
+ StaticLibInitializer()
+ {
+ Q_INIT_RESOURCE(engine);
+ }
+};
+StaticLibInitializer staticLibInitializer;
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+Drawer::Drawer(const Theme &theme, const QFont &font, QDataVis::LabelTransparency transparency)
+ : m_theme(theme),
+ m_font(font),
+ m_transparency(transparency),
+ m_textureHelper(0)
+{
+}
+
+Drawer::~Drawer()
+{
+ delete m_textureHelper;
+}
+
+void Drawer::initializeOpenGL()
+{
+ if (!m_textureHelper) {
+ initializeOpenGLFunctions();
+ m_textureHelper = new TextureHelper();
+ }
+}
+
+void Drawer::setTheme(const Theme &theme)
+{
+ m_theme = theme;
+ emit drawerChanged();
+}
+
+void Drawer::setFont(const QFont &font)
+{
+ m_font = font;
+ emit drawerChanged();
+}
+
+QFont Drawer::font() const
+{
+ return m_font;
+}
+
+void Drawer::setTransparency(QDataVis::LabelTransparency transparency)
+{
+ m_transparency = transparency;
+ emit drawerChanged();
+}
+
+void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLuint textureId,
+ GLuint depthTextureId)
+{
+ // Store the GL state before changing
+ GLint oldActiveTex[1];
+ glGetIntegerv(GL_ACTIVE_TEXTURE, oldActiveTex);
+ GLint oldTexId[1];
+ glGetIntegerv(GL_TEXTURE_BINDING_2D, oldTexId);
+
+ if (textureId) {
+ // Activate texture
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ shader->setUniformValue(shader->texture(), 0);
+ }
+
+ if (depthTextureId) {
+ // Activate depth texture
+ glActiveTexture(GL_TEXTURE1);
+ glBindTexture(GL_TEXTURE_2D, depthTextureId);
+ shader->setUniformValue(shader->shadow(), 1);
+ }
+
+ // 1st attribute buffer : vertices
+ glEnableVertexAttribArray(shader->posAtt());
+ glBindBuffer(GL_ARRAY_BUFFER, object->vertexBuf());
+ glVertexAttribPointer(shader->posAtt(), 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
+
+ // 2nd attribute buffer : normals
+ glEnableVertexAttribArray(shader->normalAtt());
+ glBindBuffer(GL_ARRAY_BUFFER, object->normalBuf());
+ glVertexAttribPointer(shader->normalAtt(), 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
+
+ if (textureId || depthTextureId) {
+ // 3rd attribute buffer : UVs
+ glEnableVertexAttribArray(shader->uvAtt());
+ glBindBuffer(GL_ARRAY_BUFFER, object->uvBuf());
+ glVertexAttribPointer(shader->uvAtt(), 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
+ }
+
+ // Index buffer
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, object->elementBuf());
+
+ // Draw the triangles
+ glDrawElements(GL_TRIANGLES, object->indexCount(), object->indicesType(), (void*)0);
+
+ // Free buffers
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+
+ if (textureId || depthTextureId)
+ glDisableVertexAttribArray(shader->uvAtt());
+
+ glDisableVertexAttribArray(shader->normalAtt());
+ glDisableVertexAttribArray(shader->posAtt());
+
+ // Restore the GL state
+ glActiveTexture(*oldActiveTex);
+ glBindTexture(GL_TEXTURE_2D, *oldTexId);
+}
+
+void Drawer::drawSurfaceGrid(ShaderHelper *shader, SurfaceObject *object)
+{
+ // Store the GL state before changing
+ GLint oldActiveTex[1];
+ glGetIntegerv(GL_ACTIVE_TEXTURE, oldActiveTex);
+ GLint oldTexId[1];
+ glGetIntegerv(GL_TEXTURE_BINDING_2D, oldTexId);
+
+ // 1st attribute buffer : vertices
+ glEnableVertexAttribArray(shader->posAtt());
+ glBindBuffer(GL_ARRAY_BUFFER, object->vertexBuf());
+ glVertexAttribPointer(shader->posAtt(), 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
+
+ // Index buffer
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, object->gridElementBuf());
+
+ // Draw the lines
+ glDrawElements(GL_LINES, object->gridIndexCount(), object->indicesType(), (void*)0);
+
+ // Free buffers
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+
+ glDisableVertexAttribArray(shader->posAtt());
+
+ // Restore the GL state
+ glActiveTexture(*oldActiveTex);
+ glBindTexture(GL_TEXTURE_2D, *oldTexId);
+}
+
+void Drawer::drawLabel(const AbstractRenderItem &item, const LabelItem &labelItem,
+ const QMatrix4x4 &viewmatrix, const QMatrix4x4 &projectionmatrix,
+ const QVector3D &positionComp, const QVector3D &rotation,
+ GLfloat itemHeight, QDataVis::SelectionMode mode,
+ ShaderHelper *shader, ObjectHelper *object,
+ const Q3DCamera *camera,
+ bool useDepth, bool rotateAlong,
+ LabelPosition position, Qt::AlignmentFlag alignment)
+{
+ // Draw label
+ if (!labelItem.textureId())
+ return; // No texture, skip
+
+ QSize textureSize = labelItem.size();
+ QMatrix4x4 modelMatrix;
+ QMatrix4x4 MVPMatrix;
+ GLfloat xPosition = 0.0f;
+ GLfloat yPosition = 0.0f;
+ GLfloat zPosition = positionComp.z();
+
+ switch (position) {
+ case LabelBelow: {
+ yPosition = -1.6f; // minus maximum negative height (+ some extra for label)
+ break;
+ }
+ case LabelLow: {
+ yPosition = -positionComp.y();
+ break;
+ }
+ case LabelMid: {
+ // Use this for positioning with absolute item y position value
+ yPosition = item.translation().y();
+ break;
+ }
+ case LabelHigh: {
+ // TODO: Fix this. Can't seem to get it right (if ok with positive-only bars, doesn't look good on +- and vice versa)
+ yPosition = item.translation().y() + itemHeight / 2.0f;
+ break;
+ }
+ case LabelOver: {
+ float mod = 0.1f;
+ if (itemHeight < 0)
+ mod = -0.1f;
+ yPosition = item.translation().y() - (positionComp.y() / 2.0f - 0.2f)
+ + itemHeight + mod;
+ break;
+ }
+ case LabelBottom: {
+ yPosition = -1.95f; // TODO: Calculate from scene
+ xPosition = 0.0f;
+ break;
+ }
+ case LabelTop: {
+ yPosition = 1.95f; // TODO: Calculate from scene
+ xPosition = 0.0f;
+ break;
+ }
+ case LabelLeft: {
+ yPosition = 0.0f;
+ xPosition = -2.5f; // TODO: Calculate from scene
+ break;
+ }
+ case LabelRight: {
+ yPosition = 0.0f;
+ xPosition = 2.5f; // TODO: Calculate from scene
+ break;
+ }
+ }
+
+ // Calculate scale factor to get uniform font size
+ GLfloat scaledFontSize = 0.05f + m_font.pointSizeF() / 500.0f;
+ GLfloat scaleFactor = scaledFontSize / (GLfloat)textureSize.height();
+
+ // Apply alignment
+ GLfloat xAlignment = 0.0f;
+ GLfloat zAlignment = 0.0f;
+ switch (alignment) {
+ case Qt::AlignLeft: {
+ xAlignment = (-(GLfloat)textureSize.width() * scaleFactor)
+ * qFabs(qCos(qDegreesToRadians(rotation.y())));
+ zAlignment = ((GLfloat)textureSize.width() * scaleFactor)
+ * qFabs(qSin(qDegreesToRadians(rotation.y())));
+ break;
+ }
+ case Qt::AlignRight: {
+ xAlignment = ((GLfloat)textureSize.width() * scaleFactor)
+ * qFabs(qCos(qDegreesToRadians(rotation.y())));
+ zAlignment = (-(GLfloat)textureSize.width() * scaleFactor)
+ * qFabs(qSin(qDegreesToRadians(rotation.y())));
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+
+ if (position < LabelBottom) {
+ xPosition = item.translation().x();
+ if (useDepth)
+ zPosition = item.translation().z();
+ else if (QDataVis::ModeSliceColumn == mode)
+ xPosition = -(item.translation().z()) + positionComp.z(); // flip first to left
+ }
+
+ // Position label
+ modelMatrix.translate(xPosition + xAlignment, yPosition, zPosition + zAlignment);
+
+ // Rotate
+ // TODO: We should convert rotations to use quaternions to avoid rotation order problems
+ //QQuaternion rotQuatX = QQuaternion::fromAxisAndAngle(1.0f, 0.0f, 0.0f, rotation.x());
+ //QQuaternion rotQuatY = QQuaternion::fromAxisAndAngle(0.0f, 1.0f, 0.0f, rotation.y());
+ //QQuaternion rotQuatZ = QQuaternion::fromAxisAndAngle(0.0f, 0.0f, 1.0f, rotation.z());
+ //QQuaternion rotQuaternion = rotQuatX + rotQuatY + rotQuatZ;
+ //modelMatrix.rotate(rotQuaternion);
+ modelMatrix.rotate(rotation.y(), 0.0f, 1.0f, 0.0f);
+ modelMatrix.rotate(rotation.z(), 0.0f, 0.0f, 1.0f);
+ modelMatrix.rotate(rotation.x(), 1.0f, 0.0f, 0.0f);
+
+ if (useDepth && !rotateAlong) {
+ // Apply negative camera rotations to keep labels facing camera
+ QPointF camRotations = camera->rotations();
+ modelMatrix.rotate(-camRotations.x(), 0.0f, 1.0f, 0.0f);
+ modelMatrix.rotate(-camRotations.y(), 1.0f, 0.0f, 0.0f);
+ }
+
+ // Scale label based on text size
+ modelMatrix.scale(QVector3D((GLfloat)textureSize.width() * scaleFactor,
+ scaledFontSize,
+ 0.0f));
+
+ MVPMatrix = projectionmatrix * viewmatrix * modelMatrix;
+
+ // Set shader bindings
+ shader->setUniformValue(shader->MVP(), MVPMatrix);
+
+ // Draw the object
+ drawObject(shader, object, labelItem.textureId());
+}
+
+void Drawer::generateSelectionLabelTexture(AbstractRenderItem *item)
+{
+ LabelItem &labelItem = item->selectionLabelItem();
+ generateLabelItem(labelItem, item->selectionLabel());
+}
+
+void Drawer::generateLabelItem(LabelItem &item, const QString &text, int widestLabel)
+{
+ initializeOpenGL();
+
+ item.clear();
+
+ if (!text.isEmpty()) {
+ // Create labels
+ // Print label into a QImage using QPainter
+ QImage label = Utils::printTextToImage(m_font,
+ text,
+ m_theme.m_textBackgroundColor,
+ m_theme.m_textColor,
+ m_transparency,
+ widestLabel);
+
+ // Set label size
+ item.setSize(label.size());
+ // Insert text texture into label (also deletes the old texture)
+ item.setTextureId(m_textureHelper->create2DTexture(label, true, true));
+ }
+}
+
+QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/engine/drawer_p.h b/src/datavisualization/engine/drawer_p.h
new file mode 100644
index 00000000..3b3e7a1c
--- /dev/null
+++ b/src/datavisualization/engine/drawer_p.h
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtDataVisualization API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef DRAWER_P_H
+#define DRAWER_P_H
+
+#include "datavisualizationglobal_p.h"
+#include "q3dbars.h"
+#include "theme_p.h"
+#include "labelitem_p.h"
+#include "abstractrenderitem_p.h"
+#include <QFont>
+
+QT_DATAVISUALIZATION_BEGIN_NAMESPACE
+
+class ShaderHelper;
+class ObjectHelper;
+class AbstractObjectHelper;
+class SurfaceObject;
+class TextureHelper;
+class Q3DCamera;
+
+class Drawer : public QObject, public QOpenGLFunctions
+{
+ Q_OBJECT
+
+public:
+ enum LabelPosition {
+ LabelBelow = 0,
+ LabelLow,
+ LabelMid,
+ LabelHigh,
+ LabelOver,
+ LabelBottom, // Absolute positions from here onward, used for axes (QDataItem is ignored)
+ LabelTop,
+ LabelLeft,
+ LabelRight
+ };
+
+public:
+ explicit Drawer(const Theme &theme, const QFont &font, QDataVis::LabelTransparency transparency);
+ ~Drawer();
+
+ void initializeOpenGL();
+
+ void setTheme(const Theme &theme);
+ void setFont(const QFont &font);
+ QFont font() const;
+ void setTransparency(QDataVis::LabelTransparency transparency);
+
+ void drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLuint textureId = 0,
+ GLuint depthTextureId = 0);
+ void drawSurfaceGrid(ShaderHelper *shader, SurfaceObject *object);
+ void drawLabel(const AbstractRenderItem &item, const LabelItem &labelItem,
+ const QMatrix4x4 &viewmatrix, const QMatrix4x4 &projectionmatrix,
+ const QVector3D &positionComp, const QVector3D &rotation, GLfloat itemHeight,
+ QDataVis::SelectionMode mode, ShaderHelper *shader, ObjectHelper *object,
+ const Q3DCamera *camera,
+ bool useDepth = false, bool rotateAlong = false,
+ LabelPosition position = LabelOver,
+ Qt::AlignmentFlag alignment = Qt::AlignCenter);
+
+ void generateSelectionLabelTexture(AbstractRenderItem *item);
+ void generateLabelItem(LabelItem &item, const QString &text, int widestLabel = 0);
+
+Q_SIGNALS:
+ void drawerChanged();
+
+private:
+ Theme m_theme;
+ QFont m_font;
+ QDataVis::LabelTransparency m_transparency;
+ TextureHelper *m_textureHelper;
+};
+
+QT_DATAVISUALIZATION_END_NAMESPACE
+
+#endif
diff --git a/src/datavisualization/engine/engine.pri b/src/datavisualization/engine/engine.pri
new file mode 100644
index 00000000..4c905fe9
--- /dev/null
+++ b/src/datavisualization/engine/engine.pri
@@ -0,0 +1,53 @@
+HEADERS += $$PWD/q3dwindow_p.h \
+ $$PWD/q3dwindow.h \
+ $$PWD/q3dbars.h \
+ $$PWD/q3dbars_p.h \
+ $$PWD/theme_p.h \
+ $$PWD/drawer_p.h \
+ $$PWD/bars3dcontroller_p.h \
+ $$PWD/bars3drenderer_p.h \
+ $$PWD/q3dsurface.h \
+ $$PWD/q3dsurface_p.h \
+ $$PWD/surface3dcontroller_p.h \
+ $$PWD/surface3drenderer_p.h \
+ $$PWD/abstract3dcontroller_p.h \
+ $$PWD/q3dscatter.h \
+ $$PWD/q3dscatter_p.h \
+ $$PWD/scatter3dcontroller_p.h \
+ $$PWD/scatter3drenderer_p.h \
+ $$PWD/axisrendercache_p.h \
+ $$PWD/abstract3drenderer_p.h \
+ $$PWD/selectionpointer_p.h \
+ $$PWD/q3dcamera.h \
+ $$PWD/q3dcamera_p.h \
+ $$PWD/q3dscene.h \
+ $$PWD/q3dlight.h \
+ $$PWD/q3dlight_p.h \
+ $$PWD/q3dbox.h \
+ $$PWD/q3dobject.h \
+ $$PWD/q3dobject_p.h \
+ $$PWD/q3dscene_p.h
+
+SOURCES += $$PWD/q3dwindow.cpp \
+ $$PWD/q3dbars.cpp \
+ $$PWD/theme.cpp \
+ $$PWD/drawer.cpp \
+ $$PWD/bars3dcontroller.cpp \
+ $$PWD/bars3drenderer.cpp \
+ $$PWD/q3dsurface.cpp \
+ $$PWD/surface3drenderer.cpp \
+ $$PWD/surface3dcontroller.cpp \
+ $$PWD/abstract3dcontroller.cpp \
+ $$PWD/q3dscatter.cpp \
+ $$PWD/scatter3dcontroller.cpp \
+ $$PWD/scatter3drenderer.cpp \
+ $$PWD/axisrendercache.cpp \
+ $$PWD/abstract3drenderer.cpp \
+ $$PWD/selectionpointer.cpp \
+ $$PWD/q3dcamera.cpp \
+ $$PWD/q3dlight.cpp \
+ $$PWD/q3dbox.cpp \
+ $$PWD/q3dobject.cpp \
+ $$PWD/q3dscene.cpp
+
+RESOURCES += engine/engine.qrc
diff --git a/src/datavisualization/engine/engine.qrc b/src/datavisualization/engine/engine.qrc
new file mode 100644
index 00000000..af6e899d
--- /dev/null
+++ b/src/datavisualization/engine/engine.qrc
@@ -0,0 +1,61 @@
+<RCC>
+ <qresource prefix="/defaultMeshes">
+ <file alias="cone">meshes/coneFlat.obj</file>
+ <file alias="coneSmooth">meshes/coneSmooth.obj</file>
+ <file alias="pyramid">meshes/pyramidFlat.obj</file>
+ <file alias="pyramidSmooth">meshes/pyramidSmooth.obj</file>
+ <file alias="bar">meshes/cubeFlat.obj</file>
+ <file alias="barSmooth">meshes/cubeSmooth.obj</file>
+ <file alias="cylinder">meshes/cylinderFlat.obj</file>
+ <file alias="cylinderSmooth">meshes/cylinderSmooth.obj</file>
+ <file alias="background">meshes/backgroudFlat.obj</file>
+ <file alias="backgroundSmooth">meshes/backgroudSmooth.obj</file>
+ <file alias="label">meshes/plane.obj</file>
+ <file alias="sphere">meshes/sphere.obj</file>
+ <file alias="sphereSmooth">meshes/sphereSmooth.obj</file>
+ <file alias="bevelbar">meshes/barFlat.obj</file>
+ <file alias="bevelbarSmooth">meshes/barSmooth.obj</file>
+ <file alias="negativeBackground">meshes/backgroudNegatives.obj</file>
+ <file alias="coneFull">meshes/coneFilledFlat.obj</file>
+ <file alias="coneSmoothFull">meshes/coneFilledSmooth.obj</file>
+ <file alias="cylinderFull">meshes/cylinderFilledFlat.obj</file>
+ <file alias="cylinderSmoothFull">meshes/cylinderFilledSmooth.obj</file>
+ <file alias="pyramidFull">meshes/pyramidFilledFlat.obj</file>
+ <file alias="pyramidSmoothFull">meshes/pyramidFilledSmooth.obj</file>
+ <file alias="bevelbarFull">meshes/barFilledFlat.obj</file>
+ <file alias="bevelbarSmoothFull">meshes/barFilledSmooth.obj</file>
+ <file alias="barFull">meshes/cubeFilledFlat.obj</file>
+ <file alias="barSmoothFull">meshes/cubeFilledSmooth.obj</file>
+ <file alias="dotSmooth">meshes/scatterdot.obj</file>
+ <file alias="dot">meshes/scatterdotFlat.obj</file>
+ </qresource>
+ <qresource prefix="/shaders">
+ <file alias="fragment">shaders/default.frag</file>
+ <file alias="vertex">shaders/default.vert</file>
+ <file alias="fragmentAmbient">shaders/ambient.frag</file>
+ <file alias="fragmentColorOnY">shaders/colorOnY.frag</file>
+ <file alias="fragmentSelection">shaders/selection.frag</file>
+ <file alias="vertexSelection">shaders/selection.vert</file>
+ <file alias="fragmentTexture">shaders/texture.frag</file>
+ <file alias="vertexTexture">shaders/texture.vert</file>
+ <file alias="fragmentLabel">shaders/label.frag</file>
+ <file alias="vertexLabel">shaders/label.vert</file>
+ <file alias="fragmentDepth">shaders/depth.frag</file>
+ <file alias="vertexDepth">shaders/depth.vert</file>
+ <file alias="fragmentShadow">shaders/shadow.frag</file>
+ <file alias="vertexShadow">shaders/shadow.vert</file>
+ <file alias="fragmentShadowNoTex">shaders/shadowNoTex.frag</file>
+ <file alias="fragmentShadowNoTexColorOnY">shaders/shadowNoTexColorOnY.frag</file>
+ <file alias="fragmentColorOnYES2">shaders/colorOnY_ES2.frag</file>
+ <file alias="fragmentES2">shaders/default_ES2.frag</file>
+ <file alias="vertexES2">shaders/default_ES2.vert</file>
+ <file alias="fragmentTextureES2">shaders/texture_ES2.frag</file>
+ <file alias="fragmentSurface">shaders/surface.frag</file>
+ <file alias="vertexSurface">shaders/surface.vert</file>
+ <file alias="fragmentSurfaceGrid">shaders/surfaceGrid.frag</file>
+ <file alias="vertexSurfaceGrid">shaders/surfaceGrid.vert</file>
+ <file alias="vertexSurfaceFlat">shaders/surfaceFlat.vert</file>
+ <file alias="fragmentSurfaceFlat">shaders/surfaceFlat.frag</file>
+ </qresource>
+ <qresource prefix="/textures"/>
+</RCC>
diff --git a/src/datavisualization/engine/meshes/backgroudFlat.obj b/src/datavisualization/engine/meshes/backgroudFlat.obj
new file mode 100644
index 00000000..cf4d10a5
--- /dev/null
+++ b/src/datavisualization/engine/meshes/backgroudFlat.obj
@@ -0,0 +1,32 @@
+# Blender v2.66 (sub 0) OBJ File: 'backgroud.blend'
+# www.blender.org
+o Cube
+v 1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 -1.000000
+v 0.999999 1.000000 1.000001
+v -1.000000 1.000000 1.000000
+v -1.000000 1.000000 -1.000000
+vt 0.000000 0.501529
+vt 0.001529 1.000000
+vt 0.500000 0.998471
+vt 0.501529 0.500000
+vt 1.000000 0.498471
+vt 0.998471 0.000000
+vt 0.500000 0.498471
+vt 0.498471 0.000000
+vt 0.000000 0.001529
+vt 0.498471 0.500000
+vt 0.500000 0.001529
+vt 0.001529 0.500000
+vn -0.000000 1.000000 0.000000
+vn 0.000000 -0.000000 -1.000000
+vn 1.000000 0.000000 0.000000
+s off
+f 1/1/1 4/2/1 3/3/1
+f 2/4/2 3/5/2 6/6/2
+f 3/7/3 4/8/3 7/9/3
+f 2/10/1 1/1/1 3/3/1
+f 5/11/2 2/4/2 6/6/2
+f 6/12/3 3/7/3 7/9/3
diff --git a/src/datavisualization/engine/meshes/backgroudNegatives.obj b/src/datavisualization/engine/meshes/backgroudNegatives.obj
new file mode 100644
index 00000000..dd4d3f05
--- /dev/null
+++ b/src/datavisualization/engine/meshes/backgroudNegatives.obj
@@ -0,0 +1,37 @@
+# Blender v2.66 (sub 0) OBJ File: 'backgroudNegatives.blend'
+# www.blender.org
+o Cube
+v 1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 -1.000000
+v 0.999999 1.000000 1.000001
+v -1.000000 1.000000 1.000000
+v -1.000000 1.000000 -1.000000
+v 1.000000 -3.000000 1.000000
+v -1.000000 -3.000000 1.000000
+v -1.000000 -3.000000 -1.000000
+vt 0.000100 0.666700
+vt 0.333300 0.666700
+vt 0.333300 0.999900
+vt 0.000100 0.000100
+vt 0.333300 0.000100
+vt 0.333300 0.666500
+vt 0.666500 0.000100
+vt 0.666500 0.666500
+vt 0.000100 0.999900
+vt 0.000100 0.666500
+vn 0.000000 0.999969 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.707083 0.000000 -0.707083
+vn 1.000000 0.000000 0.000000
+vn 0.999969 0.000000 0.000000
+vn 0.000000 0.000000 -0.999969
+s 1
+f 1/1/1 4/2/2 3/3/2
+f 8/4/3 9/5/4 6/6/4
+f 9/5/4 10/7/5 7/8/6
+f 2/9/2 1/1/1 3/3/2
+f 5/10/7 8/4/3 6/6/4
+f 6/6/4 9/5/4 7/8/6
diff --git a/src/datavisualization/engine/meshes/backgroudSmooth.obj b/src/datavisualization/engine/meshes/backgroudSmooth.obj
new file mode 100644
index 00000000..ad16d904
--- /dev/null
+++ b/src/datavisualization/engine/meshes/backgroudSmooth.obj
@@ -0,0 +1,36 @@
+# Blender v2.66 (sub 0) OBJ File: 'backgroud.blend'
+# www.blender.org
+o Cube
+v 1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 -1.000000
+v 0.999999 1.000000 1.000001
+v -1.000000 1.000000 1.000000
+v -1.000000 1.000000 -1.000000
+vt 0.000000 0.501529
+vt 0.001529 1.000000
+vt 0.500000 0.998471
+vt 0.501529 0.500000
+vt 1.000000 0.498471
+vt 0.998471 0.000000
+vt 0.500000 0.498471
+vt 0.498471 0.000000
+vt 0.000000 0.001529
+vt 0.498471 0.500000
+vt 0.500000 0.001529
+vt 0.001529 0.500000
+vn 0.000000 0.999969 0.000000
+vn 0.707083 0.707083 0.000000
+vn 0.577349 0.577349 -0.577349
+vn 0.000000 0.707083 -0.707083
+vn 0.707083 0.000000 -0.707083
+vn 0.999969 0.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+s 1
+f 1/1/1 4/2/2 3/3/3
+f 2/4/4 3/5/3 6/6/5
+f 3/7/3 4/8/2 7/9/6
+f 2/10/4 1/1/1 3/3/3
+f 5/11/7 2/4/4 6/6/5
+f 6/12/5 3/7/3 7/9/6
diff --git a/src/datavisualization/engine/meshes/barFilledFlat.obj b/src/datavisualization/engine/meshes/barFilledFlat.obj
new file mode 100644
index 00000000..5f627091
--- /dev/null
+++ b/src/datavisualization/engine/meshes/barFilledFlat.obj
@@ -0,0 +1,242 @@
+# Blender v2.66 (sub 0) OBJ File: 'smoothcube_filled.blend'
+# www.blender.org
+o Cube
+v -0.980000 -1.000000 1.000000
+v -1.000000 -1.000000 0.980000
+v -0.994142 -1.000000 0.994142
+v -1.000000 -1.000000 -0.980000
+v -0.980000 -1.000000 -1.000000
+v -0.994142 -1.000000 -0.994142
+v 0.980000 -1.000000 -1.000000
+v 1.000000 -1.000000 -0.980000
+v 0.994142 -1.000000 -0.994142
+v 1.000000 -1.000000 0.980000
+v 0.980000 -1.000000 1.000000
+v 0.994142 -1.000000 0.994142
+v -0.980000 0.980000 1.000000
+v -0.980000 1.000000 0.980000
+v -1.000000 0.980000 0.980000
+v -0.980000 0.994142 0.994142
+v -0.994142 0.994142 0.980000
+v -0.994142 0.980000 0.994142
+v -0.992998 0.992998 0.992998
+v -1.000000 0.980000 -0.980000
+v -0.980000 1.000000 -0.980000
+v -0.980000 0.980000 -1.000000
+v -0.994142 0.994142 -0.980000
+v -0.980000 0.994142 -0.994142
+v -0.994142 0.980000 -0.994142
+v -0.992998 0.992998 -0.992998
+v 0.980000 0.980000 -1.000000
+v 0.980000 1.000000 -0.980000
+v 1.000000 0.980000 -0.980000
+v 0.980000 0.994142 -0.994142
+v 0.994142 0.994142 -0.980000
+v 0.994142 0.980000 -0.994142
+v 0.992998 0.992998 -0.992998
+v 1.000000 0.980000 0.980000
+v 0.980000 1.000000 0.980000
+v 0.980000 0.980000 1.000000
+v 0.994142 0.994142 0.980000
+v 0.980000 0.994142 0.994142
+v 0.994142 0.980000 0.994142
+v 0.992998 0.992998 0.992998
+vt 0.339018 0.659342
+vt 0.338105 0.335826
+vt 0.664825 0.343846
+vt 0.669233 0.664931
+vt 0.668227 0.337019
+vt 0.995472 0.336015
+vt 0.337976 0.003372
+vt 0.665888 0.002366
+vt 0.666894 0.330278
+vt 0.672755 0.331283
+vt 0.671749 0.003372
+vt 1.000000 0.330280
+vt 0.335610 0.335927
+vt 0.337937 0.333650
+vt 0.338982 0.331284
+vt 0.338989 0.333650
+vt 0.336616 0.331291
+vt 0.326720 0.346123
+vt 0.326875 0.343630
+vt 0.329215 0.346022
+vt 0.327633 0.669639
+vt 0.330128 0.669538
+vt 0.327801 0.671815
+vt 0.669260 0.330271
+vt 0.666901 0.332644
+vt 0.672610 0.333650
+vt 0.670266 0.331291
+vt 0.669260 0.003379
+vt 0.669412 0.001204
+vt 0.665880 0.000000
+vt 0.668056 0.000185
+vt 0.669089 0.667298
+vt 0.666910 0.667113
+vt 0.665738 0.337027
+vt 0.665891 0.334852
+vt 0.335610 0.003379
+vt 0.335795 0.001204
+vt 0.338863 0.661835
+vt 0.336686 0.661624
+vt 0.001081 0.663795
+vt 0.664657 0.341670
+vt 0.000155 0.335610
+vt 0.000000 0.338102
+vt 0.996478 0.663927
+vt 0.996334 0.666294
+vt 0.671590 0.001006
+vt 0.998835 0.000002
+vt 0.998994 0.002368
+vt 0.337969 0.001006
+vt 0.666744 0.664939
+vt 0.665738 0.667363
+vt 0.665583 0.669855
+vt 0.668068 0.334654
+vt 0.995313 0.333650
+vt 0.336523 0.659443
+vt 0.001006 0.332274
+vt 0.000000 0.004362
+vt 0.001993 0.334637
+vt 0.335761 0.333817
+vt 0.336814 0.333465
+vt 0.329052 0.343841
+vt 0.329977 0.671648
+vt 0.669075 0.332446
+vt 0.670432 0.333465
+vt 0.668254 0.002359
+vt 0.999855 0.332646
+vt 0.000913 0.661618
+vt 0.000973 0.001993
+vt 0.003336 0.001006
+vt 0.331248 0.000000
+vt 0.333617 0.000973
+vt 0.334604 0.003336
+vt 0.335610 0.331248
+vt 0.334637 0.333617
+vt 0.332274 0.334604
+vt 0.004362 0.335610
+vn 0.000000 0.000000 1.000000
+vn 1.000000 -0.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.357407 0.357407 0.862856
+vn -0.357409 0.862855 0.357407
+vn -0.862855 0.357409 0.357407
+vn -0.862855 0.357407 -0.357409
+vn -0.357407 0.862855 -0.357409
+vn -0.357408 0.357408 -0.862855
+vn 0.114222 0.380181 -0.917832
+vn 0.380181 0.917832 -0.114222
+vn 0.917832 0.114222 -0.380181
+vn 0.917832 0.380181 0.114222
+vn 0.114222 0.917832 0.380181
+vn 0.380181 0.114222 0.917832
+vn -0.382685 0.923879 0.000000
+vn -0.923879 0.382685 0.000000
+vn -0.382685 0.000000 -0.923879
+vn -0.923879 0.000000 -0.382685
+vn -0.382685 0.000000 0.923879
+vn -0.923879 0.000000 0.382685
+vn 0.000000 0.923879 -0.382685
+vn 0.000000 0.382685 -0.923879
+vn 0.923879 0.000000 -0.382685
+vn 0.382685 0.000000 -0.923879
+vn 0.382685 0.923879 0.000000
+vn 0.923879 0.382685 0.000000
+vn 0.382685 -0.000000 0.923879
+vn 0.923879 -0.000000 0.382685
+vn -0.000000 0.923879 0.382685
+vn -0.000000 0.382685 0.923879
+vn -1.000000 0.000000 0.000000
+vn -0.000000 -1.000000 -0.000000
+vn -0.095602 0.095602 0.990818
+vn -0.095602 0.990818 0.095602
+vn -0.990818 0.095602 0.095602
+vn -0.990818 0.095602 -0.095602
+vn -0.095602 0.990818 -0.095602
+vn -0.095602 0.095602 -0.990818
+vn 0.380181 0.114222 -0.917832
+vn 0.114222 0.917832 -0.380181
+vn 0.917832 0.380181 -0.114222
+vn 0.917832 0.114222 0.380181
+vn 0.380181 0.917832 0.114222
+vn 0.114222 0.380181 0.917832
+s off
+f 36/1/1 13/2/1 1/3/1
+f 29/4/2 34/5/2 10/6/2
+f 35/7/3 28/8/3 21/9/3
+f 22/10/4 27/11/4 5/12/4
+f 13/2/5 16/13/5 18/14/5
+f 14/15/6 17/16/6 16/17/6
+f 15/18/7 18/19/7 17/20/7
+f 20/21/8 23/22/8 25/23/8
+f 21/9/9 24/24/9 23/25/9
+f 22/10/10 25/26/10 24/27/10
+f 27/11/11 30/28/11 33/29/11
+f 28/8/12 31/30/12 33/31/12
+f 29/4/13 32/32/13 33/33/13
+f 34/5/14 37/34/14 40/35/14
+f 35/7/15 38/36/15 40/37/15
+f 36/1/16 39/38/16 40/39/16
+f 14/15/17 21/9/17 17/16/17
+f 17/20/18 23/22/18 15/18/18
+f 22/10/19 5/12/19 25/26/19
+f 25/23/20 6/40/20 20/21/20
+f 1/3/21 13/2/21 3/41/21
+f 3/42/22 18/19/22 2/43/22
+f 21/9/23 28/8/23 24/24/23
+f 24/27/24 30/28/24 22/10/24
+f 29/4/25 8/44/25 9/45/25
+f 32/46/26 9/47/26 7/48/26
+f 28/8/27 35/7/27 37/49/27
+f 31/50/28 37/34/28 34/5/28
+f 36/1/29 11/51/29 12/52/29
+f 39/53/30 12/54/30 10/6/30
+f 35/7/31 14/15/31 16/17/31
+f 38/55/32 16/13/32 13/2/32
+f 15/18/33 20/21/33 2/43/33
+f 5/56/34 7/57/34 6/58/34
+f 11/51/1 36/1/1 1/3/1
+f 8/44/2 29/4/2 10/6/2
+f 14/15/3 35/7/3 21/9/3
+f 27/11/4 7/48/4 5/12/4
+f 16/13/35 19/59/35 18/14/35
+f 17/16/36 19/60/36 16/17/36
+f 18/19/37 19/61/37 17/20/37
+f 23/22/38 26/62/38 25/23/38
+f 24/24/39 26/63/39 23/25/39
+f 25/26/40 26/64/40 24/27/40
+f 32/46/41 27/11/41 33/29/41
+f 30/65/42 28/8/42 33/31/42
+f 31/50/43 29/4/43 33/33/43
+f 39/53/44 34/5/44 40/35/44
+f 37/49/45 35/7/45 40/37/45
+f 38/55/46 36/1/46 40/39/46
+f 21/9/17 23/25/17 17/16/17
+f 23/22/18 20/21/18 15/18/18
+f 5/12/19 6/66/19 25/26/19
+f 6/40/20 4/67/20 20/21/20
+f 13/2/21 18/14/21 3/41/21
+f 18/19/22 15/18/22 2/43/22
+f 28/8/23 30/65/23 24/24/23
+f 30/28/24 27/11/24 22/10/24
+f 32/32/25 29/4/25 9/45/25
+f 27/11/26 32/46/26 7/48/26
+f 31/30/27 28/8/27 37/49/27
+f 29/4/28 31/50/28 34/5/28
+f 39/38/29 36/1/29 12/52/29
+f 34/5/30 39/53/30 10/6/30
+f 38/36/31 35/7/31 16/17/31
+f 36/1/32 38/55/32 13/2/32
+f 20/21/33 4/67/33 2/43/33
+f 7/57/34 9/68/34 6/58/34
+f 9/68/34 8/69/34 6/58/34
+f 8/69/34 10/70/34 6/58/34
+f 10/70/34 12/71/34 6/58/34
+f 12/71/34 11/72/34 6/58/34
+f 11/72/34 1/73/34 6/58/34
+f 1/73/34 3/74/34 6/58/34
+f 3/74/34 2/75/34 4/76/34
+f 6/58/34 3/74/34 4/76/34
diff --git a/src/datavisualization/engine/meshes/barFilledSmooth.obj b/src/datavisualization/engine/meshes/barFilledSmooth.obj
new file mode 100644
index 00000000..efc4317a
--- /dev/null
+++ b/src/datavisualization/engine/meshes/barFilledSmooth.obj
@@ -0,0 +1,236 @@
+# Blender v2.66 (sub 0) OBJ File: 'smoothcube_filled.blend'
+# www.blender.org
+o Cube
+v -0.980000 -1.000000 1.000000
+v -1.000000 -1.000000 0.980000
+v -0.994142 -1.000000 0.994142
+v -1.000000 -1.000000 -0.980000
+v -0.980000 -1.000000 -1.000000
+v -0.994142 -1.000000 -0.994142
+v 0.980000 -1.000000 -1.000000
+v 1.000000 -1.000000 -0.980000
+v 0.994142 -1.000000 -0.994142
+v 1.000000 -1.000000 0.980000
+v 0.980000 -1.000000 1.000000
+v 0.994142 -1.000000 0.994142
+v -0.980000 0.980000 1.000000
+v -0.980000 1.000000 0.980000
+v -1.000000 0.980000 0.980000
+v -0.980000 0.994142 0.994142
+v -0.994142 0.994142 0.980000
+v -0.994142 0.980000 0.994142
+v -0.992998 0.992998 0.992998
+v -1.000000 0.980000 -0.980000
+v -0.980000 1.000000 -0.980000
+v -0.980000 0.980000 -1.000000
+v -0.994142 0.994142 -0.980000
+v -0.980000 0.994142 -0.994142
+v -0.994142 0.980000 -0.994142
+v -0.992998 0.992998 -0.992998
+v 0.980000 0.980000 -1.000000
+v 0.980000 1.000000 -0.980000
+v 1.000000 0.980000 -0.980000
+v 0.980000 0.994142 -0.994142
+v 0.994142 0.994142 -0.980000
+v 0.994142 0.980000 -0.994142
+v 0.992998 0.992998 -0.992998
+v 1.000000 0.980000 0.980000
+v 0.980000 1.000000 0.980000
+v 0.980000 0.980000 1.000000
+v 0.994142 0.994142 0.980000
+v 0.980000 0.994142 0.994142
+v 0.994142 0.980000 0.994142
+v 0.992998 0.992998 0.992998
+vt 0.339018 0.659342
+vt 0.338105 0.335826
+vt 0.664825 0.343846
+vt 0.669233 0.664931
+vt 0.668227 0.337019
+vt 0.995472 0.336015
+vt 0.337976 0.003372
+vt 0.665888 0.002366
+vt 0.666894 0.330278
+vt 0.672755 0.331283
+vt 0.671749 0.003372
+vt 0.998994 0.002368
+vt 0.335610 0.335927
+vt 0.335761 0.333817
+vt 0.338982 0.331284
+vt 0.338989 0.333650
+vt 0.336814 0.333465
+vt 0.326720 0.346123
+vt 0.326875 0.343630
+vt 0.329052 0.343841
+vt 0.327633 0.669639
+vt 0.330128 0.669538
+vt 0.329977 0.671648
+vt 0.669260 0.330271
+vt 0.669075 0.332446
+vt 0.672610 0.333650
+vt 0.670432 0.333465
+vt 0.669260 0.003379
+vt 0.669412 0.001204
+vt 0.665880 0.000000
+vt 0.668056 0.000185
+vt 0.669089 0.667298
+vt 0.666910 0.667113
+vt 0.665738 0.337027
+vt 0.665891 0.334852
+vt 0.335610 0.003379
+vt 0.335795 0.001204
+vt 0.338863 0.661835
+vt 0.336686 0.661624
+vt 0.666901 0.332644
+vt 0.329215 0.346022
+vt 1.000000 0.330280
+vt 0.999855 0.332646
+vt 0.327801 0.671815
+vt 0.001081 0.663795
+vt 0.000913 0.661618
+vt 0.337937 0.333650
+vt 0.000155 0.335610
+vt 0.668254 0.002359
+vt 0.670266 0.331291
+vt 0.996478 0.663927
+vt 0.996334 0.666294
+vt 0.671590 0.001006
+vt 0.998835 0.000002
+vt 0.337969 0.001006
+vt 0.666744 0.664939
+vt 0.665738 0.667363
+vt 0.665583 0.669855
+vt 0.668068 0.334654
+vt 0.995313 0.333650
+vt 0.336616 0.331291
+vt 0.336523 0.659443
+vt 0.000000 0.004362
+vt 0.000973 0.001993
+vt 0.003336 0.001006
+vt 0.664657 0.341670
+vt 0.000000 0.338102
+vt 0.334604 0.003336
+vt 0.331248 0.000000
+vt 0.333617 0.000973
+vt 0.332274 0.334604
+vt 0.335610 0.331248
+vt 0.334637 0.333617
+vt 0.001993 0.334637
+vt 0.001006 0.332274
+vt 0.004362 0.335610
+vn 0.161046 0.161046 0.973693
+vn -0.161046 0.161046 0.973693
+vn -0.145573 -0.665700 0.731864
+vn 0.973693 0.161046 -0.161046
+vn 0.973693 0.161046 0.161046
+vn 0.731864 -0.665700 0.145573
+vn 0.161046 0.973693 0.161046
+vn 0.161046 0.973693 -0.161046
+vn -0.161046 0.973693 -0.161046
+vn -0.161046 0.161046 -0.973693
+vn 0.161046 0.161046 -0.973693
+vn 0.145573 -0.665700 -0.731864
+vn -0.060945 0.705771 0.705771
+vn -0.577349 0.577349 0.577349
+vn -0.161046 0.973693 0.161046
+vn -0.705771 0.705771 0.060945
+vn -0.973693 0.161046 0.161046
+vn -0.705771 0.060945 0.705771
+vn -0.973693 0.161046 -0.161046
+vn -0.705771 0.705771 -0.060945
+vn -0.577349 0.577349 -0.577349
+vn -0.060945 0.705771 -0.705771
+vn -0.705771 0.060945 -0.705771
+vn 0.060945 0.705771 -0.705771
+vn 0.577349 0.577349 -0.577349
+vn 0.705771 0.705771 -0.060945
+vn 0.705771 0.060945 -0.705771
+vn 0.705771 0.705771 0.060945
+vn 0.577349 0.577349 0.577349
+vn 0.060945 0.705771 0.705771
+vn 0.705771 0.060945 0.705771
+vn -0.145573 -0.665700 -0.731864
+vn -0.548967 -0.630238 -0.548967
+vn -0.731864 -0.665700 -0.145573
+vn -0.548967 -0.630238 0.548967
+vn 0.731864 -0.665700 -0.145573
+vn 0.548967 -0.630238 -0.548967
+vn 0.145573 -0.665700 0.731864
+vn 0.548967 -0.630238 0.548967
+vn -0.731864 -0.665700 0.145573
+s 1
+f 36/1/1 13/2/2 1/3/3
+f 29/4/4 34/5/5 10/6/6
+f 35/7/7 28/8/8 21/9/9
+f 22/10/10 27/11/11 7/12/12
+f 13/2/2 16/13/13 19/14/14
+f 14/15/15 17/16/16 19/17/14
+f 15/18/17 18/19/18 19/20/14
+f 20/21/19 23/22/20 26/23/21
+f 21/9/9 24/24/22 26/25/21
+f 22/10/10 25/26/23 26/27/21
+f 27/11/11 30/28/24 33/29/25
+f 28/8/8 31/30/26 33/31/25
+f 29/4/4 32/32/27 33/33/25
+f 34/5/5 37/34/28 40/35/29
+f 35/7/7 38/36/30 40/37/29
+f 36/1/1 39/38/31 40/39/29
+f 14/15/15 21/9/9 23/40/20
+f 17/41/16 23/22/20 20/21/19
+f 22/10/10 5/42/32 6/43/33
+f 25/44/23 6/45/33 4/46/34
+f 1/3/3 13/2/2 18/47/18
+f 3/48/35 18/19/18 15/18/17
+f 21/9/9 28/8/8 30/49/24
+f 24/50/22 30/28/24 27/11/11
+f 29/4/4 8/51/36 9/52/37
+f 32/53/27 9/54/37 7/12/12
+f 28/8/8 35/7/7 37/55/28
+f 31/56/26 37/34/28 34/5/5
+f 36/1/1 11/57/38 12/58/39
+f 39/59/31 12/60/39 10/6/6
+f 35/7/7 14/15/15 16/61/13
+f 38/62/30 16/13/13 13/2/2
+f 15/18/17 20/21/19 4/46/34
+f 7/63/12 9/64/37 8/65/36
+f 11/57/38 36/1/1 1/3/3
+f 8/51/36 29/4/4 10/6/6
+f 14/15/15 35/7/7 21/9/9
+f 5/42/32 22/10/10 7/12/12
+f 18/47/18 13/2/2 19/14/14
+f 16/61/13 14/15/15 19/17/14
+f 17/41/16 15/18/17 19/20/14
+f 25/44/23 20/21/19 26/23/21
+f 23/40/20 21/9/9 26/25/21
+f 24/50/22 22/10/10 26/27/21
+f 32/53/27 27/11/11 33/29/25
+f 30/49/24 28/8/8 33/31/25
+f 31/56/26 29/4/4 33/33/25
+f 39/59/31 34/5/5 40/35/29
+f 37/55/28 35/7/7 40/37/29
+f 38/62/30 36/1/1 40/39/29
+f 17/16/16 14/15/15 23/40/20
+f 15/18/17 17/41/16 20/21/19
+f 25/26/23 22/10/10 6/43/33
+f 20/21/19 25/44/23 4/46/34
+f 3/66/35 1/3/3 18/47/18
+f 2/67/40 3/48/35 15/18/17
+f 24/24/22 21/9/9 30/49/24
+f 22/10/10 24/50/22 27/11/11
+f 32/32/27 29/4/4 9/52/37
+f 27/11/11 32/53/27 7/12/12
+f 31/30/26 28/8/8 37/55/28
+f 29/4/4 31/56/26 34/5/5
+f 39/38/31 36/1/1 12/58/39
+f 34/5/5 39/59/31 10/6/6
+f 38/36/30 35/7/7 16/61/13
+f 36/1/1 38/62/30 13/2/2
+f 2/67/40 15/18/17 4/46/34
+f 11/68/38 10/69/6 12/70/39
+f 2/71/40 1/72/3 3/73/35
+f 6/74/33 5/75/32 4/76/34
+f 5/75/32 7/63/12 4/76/34
+f 2/71/40 4/76/34 8/65/36
+f 8/65/36 10/69/6 2/71/40
+f 10/69/6 11/68/38 1/72/3
+f 2/71/40 10/69/6 1/72/3
+f 4/76/34 7/63/12 8/65/36
diff --git a/src/datavisualization/engine/meshes/barFlat.obj b/src/datavisualization/engine/meshes/barFlat.obj
new file mode 100644
index 00000000..b802feab
--- /dev/null
+++ b/src/datavisualization/engine/meshes/barFlat.obj
@@ -0,0 +1,219 @@
+# Blender v2.66 (sub 0) OBJ File: 'smoothcube.blend'
+# www.blender.org
+o Cube
+v -0.980000 -1.000000 1.000000
+v -1.000000 -1.000000 0.980000
+v -0.994142 -1.000000 0.994142
+v -1.000000 -1.000000 -0.980000
+v -0.980000 -1.000000 -1.000000
+v -0.994142 -1.000000 -0.994142
+v 0.980000 -1.000000 -1.000000
+v 1.000000 -1.000000 -0.980000
+v 0.994142 -1.000000 -0.994142
+v 1.000000 -1.000000 0.980000
+v 0.980000 -1.000000 1.000000
+v 0.994142 -1.000000 0.994142
+v -0.980000 0.980000 1.000000
+v -0.980000 1.000000 0.980000
+v -1.000000 0.980000 0.980000
+v -0.980000 0.994142 0.994142
+v -0.994142 0.994142 0.980000
+v -0.994142 0.980000 0.994142
+v -0.992998 0.992998 0.992998
+v -1.000000 0.980000 -0.980000
+v -0.980000 1.000000 -0.980000
+v -0.980000 0.980000 -1.000000
+v -0.994142 0.994142 -0.980000
+v -0.980000 0.994142 -0.994142
+v -0.994142 0.980000 -0.994142
+v -0.992998 0.992998 -0.992998
+v 0.980000 0.980000 -1.000000
+v 0.980000 1.000000 -0.980000
+v 1.000000 0.980000 -0.980000
+v 0.980000 0.994142 -0.994142
+v 0.994142 0.994142 -0.980000
+v 0.994142 0.980000 -0.994142
+v 0.992998 0.992998 -0.992998
+v 1.000000 0.980000 0.980000
+v 0.980000 1.000000 0.980000
+v 0.980000 0.980000 1.000000
+v 0.994142 0.994142 0.980000
+v 0.980000 0.994142 0.994142
+v 0.994142 0.980000 0.994142
+v 0.992998 0.992998 0.992998
+vt 0.338795 0.668183
+vt 0.337784 0.338666
+vt 0.666630 0.337658
+vt 0.003512 0.668185
+vt 0.002502 0.338668
+vt 0.331348 0.337660
+vt 0.002378 0.003388
+vt 0.331894 0.002378
+vt 0.332905 0.331894
+vt 0.671154 0.332902
+vt 0.670143 0.003386
+vt 1.000000 0.331893
+vt 0.335282 0.338674
+vt 0.337624 0.336289
+vt 0.003388 0.332905
+vt 0.003396 0.335282
+vt 0.001011 0.332912
+vt 0.338795 0.332902
+vt 0.338649 0.335280
+vt 0.336293 0.332910
+vt 0.337784 0.003386
+vt 0.335282 0.003394
+vt 0.337624 0.001009
+vt 0.335282 0.331887
+vt 0.332912 0.334272
+vt 0.671008 0.335280
+vt 0.668652 0.332910
+vt 0.667641 0.003394
+vt 0.667795 0.001208
+vt 0.331887 0.000000
+vt 0.334073 0.000186
+vt 0.003367 0.670563
+vt 0.001178 0.670377
+vt 0.000000 0.338676
+vt 0.000153 0.336490
+vt 0.000000 0.003396
+vt 0.000186 0.001210
+vt 0.338649 0.670561
+vt 0.336460 0.670375
+vt 0.666470 0.000000
+vt 0.666470 0.335280
+vt 0.667496 0.334272
+vt 0.667641 0.331894
+vt 0.332359 0.667176
+vt 0.332213 0.669554
+vt 0.669983 0.001009
+vt 0.998829 0.000000
+vt 0.998989 0.002377
+vt 0.002370 0.001011
+vt 0.001011 0.668192
+vt 0.667641 0.667174
+vt 0.667496 0.669552
+vt 0.002341 0.336291
+vt 0.331188 0.335282
+vt 0.336293 0.668191
+vt 0.335436 0.336488
+vt 0.001210 0.335097
+vt 0.336460 0.335095
+vt 0.335436 0.001208
+vt 0.335097 0.334073
+vt 0.668819 0.335095
+vt 0.334272 0.002370
+vt 0.999855 0.334272
+vt 0.666630 0.002377
+vn 0.000000 0.000000 1.000000
+vn 1.000000 -0.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.357407 0.357407 0.862856
+vn -0.357409 0.862855 0.357407
+vn -0.862855 0.357409 0.357407
+vn -0.862855 0.357407 -0.357409
+vn -0.357407 0.862855 -0.357409
+vn -0.357408 0.357408 -0.862855
+vn 0.114222 0.380181 -0.917832
+vn 0.380181 0.917832 -0.114222
+vn 0.917832 0.114222 -0.380181
+vn 0.917832 0.380181 0.114222
+vn 0.114222 0.917832 0.380181
+vn 0.380181 0.114222 0.917832
+vn -0.382685 0.923879 0.000000
+vn -0.923879 0.382685 0.000000
+vn -0.382685 0.000000 -0.923879
+vn -0.923879 0.000000 -0.382685
+vn -0.382685 0.000000 0.923879
+vn -0.923879 0.000000 0.382685
+vn 0.000000 0.923879 -0.382685
+vn 0.000000 0.382685 -0.923879
+vn 0.923879 0.000000 -0.382685
+vn 0.382685 0.000000 -0.923879
+vn 0.382685 0.923879 0.000000
+vn 0.923879 0.382685 0.000000
+vn 0.382685 -0.000000 0.923879
+vn 0.923879 -0.000000 0.382685
+vn -0.000000 0.923879 0.382685
+vn -0.000000 0.382685 0.923879
+vn -1.000000 0.000000 0.000000
+vn -0.095602 0.095602 0.990818
+vn -0.095602 0.990818 0.095602
+vn -0.990818 0.095602 0.095602
+vn -0.990818 0.095602 -0.095602
+vn -0.095602 0.990818 -0.095602
+vn -0.095602 0.095602 -0.990818
+vn 0.380181 0.114222 -0.917832
+vn 0.114222 0.917832 -0.380181
+vn 0.917832 0.380181 -0.114222
+vn 0.917832 0.114222 0.380181
+vn 0.380181 0.917832 0.114222
+vn 0.114222 0.380181 0.917832
+s off
+f 36/1/1 13/2/1 1/3/1
+f 29/4/2 34/5/2 10/6/2
+f 35/7/3 28/8/3 21/9/3
+f 22/10/4 27/11/4 5/12/4
+f 13/2/5 16/13/5 18/14/5
+f 14/15/6 17/16/6 16/17/6
+f 15/18/7 18/19/7 17/20/7
+f 20/21/8 23/22/8 25/23/8
+f 21/9/9 24/24/9 23/25/9
+f 22/10/10 25/26/10 24/27/10
+f 27/11/11 30/28/11 33/29/11
+f 28/8/12 31/30/12 33/31/12
+f 29/4/13 32/32/13 33/33/13
+f 34/5/14 37/34/14 40/35/14
+f 35/7/15 38/36/15 40/37/15
+f 36/1/16 39/38/16 40/39/16
+f 14/15/17 21/9/17 17/16/17
+f 17/20/18 23/22/18 15/18/18
+f 22/10/19 5/12/19 25/26/19
+f 25/23/20 6/40/20 20/21/20
+f 1/3/21 13/2/21 3/41/21
+f 3/42/22 18/19/22 2/43/22
+f 21/9/23 28/8/23 24/24/23
+f 24/27/24 30/28/24 22/10/24
+f 29/4/25 8/44/25 9/45/25
+f 32/46/26 9/47/26 7/48/26
+f 28/8/27 35/7/27 37/49/27
+f 31/50/28 37/34/28 34/5/28
+f 36/1/29 11/51/29 12/52/29
+f 39/53/30 12/54/30 10/6/30
+f 35/7/31 14/15/31 16/17/31
+f 38/55/32 16/13/32 13/2/32
+f 15/18/33 20/21/33 2/43/33
+f 11/51/1 36/1/1 1/3/1
+f 8/44/2 29/4/2 10/6/2
+f 14/15/3 35/7/3 21/9/3
+f 27/11/4 7/48/4 5/12/4
+f 16/13/34 19/56/34 18/14/34
+f 17/16/35 19/57/35 16/17/35
+f 18/19/36 19/58/36 17/20/36
+f 23/22/37 26/59/37 25/23/37
+f 24/24/38 26/60/38 23/25/38
+f 25/26/39 26/61/39 24/27/39
+f 32/46/40 27/11/40 33/29/40
+f 30/62/41 28/8/41 33/31/41
+f 31/50/42 29/4/42 33/33/42
+f 39/53/43 34/5/43 40/35/43
+f 37/49/44 35/7/44 40/37/44
+f 38/55/45 36/1/45 40/39/45
+f 21/9/17 23/25/17 17/16/17
+f 23/22/18 20/21/18 15/18/18
+f 5/12/19 6/63/19 25/26/19
+f 6/40/20 4/64/20 20/21/20
+f 13/2/21 18/14/21 3/41/21
+f 18/19/22 15/18/22 2/43/22
+f 28/8/23 30/62/23 24/24/23
+f 30/28/24 27/11/24 22/10/24
+f 32/32/25 29/4/25 9/45/25
+f 27/11/26 32/46/26 7/48/26
+f 31/30/27 28/8/27 37/49/27
+f 29/4/28 31/50/28 34/5/28
+f 39/38/29 36/1/29 12/52/29
+f 34/5/30 39/53/30 10/6/30
+f 38/36/31 35/7/31 16/17/31
+f 36/1/32 38/55/32 13/2/32
+f 20/21/33 4/64/33 2/43/33
diff --git a/src/datavisualization/engine/meshes/barSmooth.obj b/src/datavisualization/engine/meshes/barSmooth.obj
new file mode 100644
index 00000000..aa4fdd92
--- /dev/null
+++ b/src/datavisualization/engine/meshes/barSmooth.obj
@@ -0,0 +1,214 @@
+# Blender v2.66 (sub 0) OBJ File: 'smoothcube.blend'
+# www.blender.org
+o Cube
+v -0.980000 -1.000000 1.000000
+v -1.000000 -1.000000 0.980000
+v -0.994142 -1.000000 0.994142
+v -1.000000 -1.000000 -0.980000
+v -0.980000 -1.000000 -1.000000
+v -0.994142 -1.000000 -0.994142
+v 0.980000 -1.000000 -1.000000
+v 1.000000 -1.000000 -0.980000
+v 0.994142 -1.000000 -0.994142
+v 1.000000 -1.000000 0.980000
+v 0.980000 -1.000000 1.000000
+v 0.994142 -1.000000 0.994142
+v -0.980000 0.980000 1.000000
+v -0.980000 1.000000 0.980000
+v -1.000000 0.980000 0.980000
+v -0.980000 0.994142 0.994142
+v -0.994142 0.994142 0.980000
+v -0.994142 0.980000 0.994142
+v -0.992998 0.992998 0.992998
+v -1.000000 0.980000 -0.980000
+v -0.980000 1.000000 -0.980000
+v -0.980000 0.980000 -1.000000
+v -0.994142 0.994142 -0.980000
+v -0.980000 0.994142 -0.994142
+v -0.994142 0.980000 -0.994142
+v -0.992998 0.992998 -0.992998
+v 0.980000 0.980000 -1.000000
+v 0.980000 1.000000 -0.980000
+v 1.000000 0.980000 -0.980000
+v 0.980000 0.994142 -0.994142
+v 0.994142 0.994142 -0.980000
+v 0.994142 0.980000 -0.994142
+v 0.992998 0.992998 -0.992998
+v 1.000000 0.980000 0.980000
+v 0.980000 1.000000 0.980000
+v 0.980000 0.980000 1.000000
+v 0.994142 0.994142 0.980000
+v 0.980000 0.994142 0.994142
+v 0.994142 0.980000 0.994142
+v 0.992998 0.992998 0.992998
+vt 0.338795 0.668183
+vt 0.337784 0.338666
+vt 0.666630 0.337658
+vt 0.003512 0.668185
+vt 0.002502 0.338668
+vt 0.331348 0.337660
+vt 0.002378 0.003388
+vt 0.331894 0.002378
+vt 0.332905 0.331894
+vt 0.671154 0.332902
+vt 0.670143 0.003386
+vt 1.000000 0.331893
+vt 0.335282 0.338674
+vt 0.337624 0.336289
+vt 0.003388 0.332905
+vt 0.003396 0.335282
+vt 0.001011 0.332912
+vt 0.338795 0.332902
+vt 0.338649 0.335280
+vt 0.336293 0.332910
+vt 0.337784 0.003386
+vt 0.335282 0.003394
+vt 0.337624 0.001009
+vt 0.335282 0.331887
+vt 0.332912 0.334272
+vt 0.671008 0.335280
+vt 0.668652 0.332910
+vt 0.667641 0.003394
+vt 0.667795 0.001208
+vt 0.331887 0.000000
+vt 0.334073 0.000186
+vt 0.003367 0.670563
+vt 0.001178 0.670377
+vt 0.000000 0.338676
+vt 0.000153 0.336490
+vt 0.000000 0.003396
+vt 0.000186 0.001210
+vt 0.338649 0.670561
+vt 0.336460 0.670375
+vt 0.666470 0.000000
+vt 0.666470 0.335280
+vt 0.667496 0.334272
+vt 0.667641 0.331894
+vt 0.332359 0.667176
+vt 0.332213 0.669554
+vt 0.669983 0.001009
+vt 0.998829 0.000000
+vt 0.998989 0.002377
+vt 0.002370 0.001011
+vt 0.001011 0.668192
+vt 0.667641 0.667174
+vt 0.667496 0.669552
+vt 0.002341 0.336291
+vt 0.331188 0.335282
+vt 0.336293 0.668191
+vt 0.335436 0.336488
+vt 0.001210 0.335097
+vt 0.336460 0.335095
+vt 0.335436 0.001208
+vt 0.335097 0.334073
+vt 0.668819 0.335095
+vt 0.334272 0.002370
+vt 0.999855 0.334272
+vt 0.666630 0.002377
+vn 0.161046 0.161046 0.973693
+vn -0.187689 0.187689 0.964110
+vn -0.195074 0.000000 0.980773
+vn 0.973693 0.161046 -0.161046
+vn 0.973693 0.161046 0.161046
+vn 0.980773 0.000000 0.195074
+vn 0.161046 0.973693 0.161046
+vn 0.161046 0.973693 -0.161046
+vn -0.187689 0.964110 -0.187689
+vn -0.187689 0.187689 -0.964110
+vn 0.161046 0.161046 -0.973693
+vn -0.195074 0.000000 -0.980773
+vn -0.135655 0.700552 0.700552
+vn -0.700552 0.135655 0.700552
+vn -0.187689 0.964110 0.187689
+vn -0.700552 0.700552 0.135655
+vn -0.964110 0.187689 0.187689
+vn -0.964110 0.187689 -0.187689
+vn -0.700552 0.700552 -0.135655
+vn -0.700552 0.135655 -0.700552
+vn -0.135655 0.700552 -0.700552
+vn 0.060945 0.705771 -0.705771
+vn 0.577349 0.577349 -0.577349
+vn 0.705771 0.705771 -0.060945
+vn 0.705771 0.060945 -0.705771
+vn 0.705771 0.705771 0.060945
+vn 0.577349 0.577349 0.577349
+vn 0.060945 0.705771 0.705771
+vn 0.705771 0.060945 0.705771
+vn -0.707083 0.000000 -0.707083
+vn -0.707083 0.000000 0.707083
+vn -0.980773 0.000000 0.195074
+vn 0.980773 0.000000 -0.195074
+vn 0.707083 0.000000 -0.707083
+vn 0.195074 0.000000 -0.980773
+vn 0.195074 0.000000 0.980773
+vn 0.707083 0.000000 0.707083
+vn -0.577349 0.577349 0.577349
+vn -0.577349 0.577349 -0.577349
+vn -0.980773 0.000000 -0.195074
+s 1
+f 36/1/1 13/2/2 1/3/3
+f 29/4/4 34/5/5 10/6/6
+f 35/7/7 28/8/8 21/9/9
+f 22/10/10 27/11/11 5/12/12
+f 13/2/2 16/13/13 18/14/14
+f 14/15/15 17/16/16 16/17/13
+f 15/18/17 18/19/14 17/20/16
+f 20/21/18 23/22/19 25/23/20
+f 21/9/9 24/24/21 23/25/19
+f 22/10/10 25/26/20 24/27/21
+f 27/11/11 30/28/22 33/29/23
+f 28/8/8 31/30/24 33/31/23
+f 29/4/4 32/32/25 33/33/23
+f 34/5/5 37/34/26 40/35/27
+f 35/7/7 38/36/28 40/37/27
+f 36/1/1 39/38/29 40/39/27
+f 14/15/15 21/9/9 17/16/16
+f 17/20/16 23/22/19 15/18/17
+f 22/10/10 5/12/12 25/26/20
+f 25/23/20 6/40/30 20/21/18
+f 1/3/3 13/2/2 3/41/31
+f 3/42/31 18/19/14 2/43/32
+f 21/9/9 28/8/8 24/24/21
+f 24/27/21 30/28/22 22/10/10
+f 29/4/4 8/44/33 9/45/34
+f 32/46/25 9/47/34 7/48/35
+f 28/8/8 35/7/7 37/49/26
+f 31/50/24 37/34/26 34/5/5
+f 36/1/1 11/51/36 12/52/37
+f 39/53/29 12/54/37 10/6/6
+f 35/7/7 14/15/15 16/17/13
+f 38/55/28 16/13/13 13/2/2
+f 15/18/17 20/21/18 2/43/32
+f 11/51/36 36/1/1 1/3/3
+f 8/44/33 29/4/4 10/6/6
+f 14/15/15 35/7/7 21/9/9
+f 27/11/11 7/48/35 5/12/12
+f 16/13/13 19/56/38 18/14/14
+f 17/16/16 19/57/38 16/17/13
+f 18/19/14 19/58/38 17/20/16
+f 23/22/19 26/59/39 25/23/20
+f 24/24/21 26/60/39 23/25/19
+f 25/26/20 26/61/39 24/27/21
+f 32/46/25 27/11/11 33/29/23
+f 30/62/22 28/8/8 33/31/23
+f 31/50/24 29/4/4 33/33/23
+f 39/53/29 34/5/5 40/35/27
+f 37/49/26 35/7/7 40/37/27
+f 38/55/28 36/1/1 40/39/27
+f 21/9/9 23/25/19 17/16/16
+f 23/22/19 20/21/18 15/18/17
+f 5/12/12 6/63/30 25/26/20
+f 6/40/30 4/64/40 20/21/18
+f 13/2/2 18/14/14 3/41/31
+f 18/19/14 15/18/17 2/43/32
+f 28/8/8 30/62/22 24/24/21
+f 30/28/22 27/11/11 22/10/10
+f 32/32/25 29/4/4 9/45/34
+f 27/11/11 32/46/25 7/48/35
+f 31/30/24 28/8/8 37/49/26
+f 29/4/4 31/50/24 34/5/5
+f 39/38/29 36/1/1 12/52/37
+f 34/5/5 39/53/29 10/6/6
+f 38/36/28 35/7/7 16/17/13
+f 36/1/1 38/55/28 13/2/2
+f 20/21/18 4/64/40 2/43/32
diff --git a/src/datavisualization/engine/meshes/coneFilledFlat.obj b/src/datavisualization/engine/meshes/coneFilledFlat.obj
new file mode 100644
index 00000000..cbbffaff
--- /dev/null
+++ b/src/datavisualization/engine/meshes/coneFilledFlat.obj
@@ -0,0 +1,128 @@
+# Blender v2.66 (sub 0) OBJ File: 'cone_filled.blend'
+# www.blender.org
+o Cone_Cone.001
+v 0.000000 -1.000000 -1.000000
+v 0.309017 -1.000000 -0.951057
+v 0.587785 -1.000000 -0.809017
+v 0.809017 -1.000000 -0.587785
+v 0.951057 -1.000000 -0.309017
+v 1.000000 -1.000000 0.000000
+v 0.951056 -1.000000 0.309017
+v 0.809017 -1.000000 0.587785
+v 0.000000 1.000000 0.000000
+v 0.587785 -1.000000 0.809017
+v 0.309017 -1.000000 0.951057
+v -0.000000 -1.000000 1.000000
+v -0.309017 -1.000000 0.951056
+v -0.587786 -1.000000 0.809017
+v -0.809017 -1.000000 0.587785
+v -0.951057 -1.000000 0.309016
+v -1.000000 -1.000000 -0.000001
+v -0.951056 -1.000000 -0.309018
+v -0.809016 -1.000000 -0.587786
+v -0.587784 -1.000000 -0.809018
+v -0.309016 -1.000000 -0.951057
+vt 0.636534 0.537407
+vt 0.609784 0.926283
+vt 0.571680 0.562142
+vt 0.911640 0.504376
+vt 0.571680 0.368442
+vt 0.953118 0.448721
+vt 0.853526 0.537297
+vt 0.973901 0.375780
+vt 0.712378 0.537297
+vt 0.791787 0.561822
+vt 0.866987 0.608581
+vt 0.930618 0.672998
+vt 0.976451 0.748767
+vt 1.000000 0.828470
+vt 0.998959 0.904307
+vt 0.973430 0.968853
+vt 0.629860 0.006965
+vt 0.571746 0.039886
+vt 0.698921 0.000000
+vt 0.772169 0.019673
+vt 0.842434 0.064059
+vt 0.902837 0.128812
+vt 0.947467 0.207594
+vt 0.971954 0.292693
+vt 0.154453 0.543699
+vt 0.081201 0.490478
+vt 0.240567 0.571679
+vt 0.027980 0.417226
+vt 0.000000 0.331112
+vt 0.000000 0.240567
+vt 0.027980 0.154454
+vt 0.081201 0.081201
+vt 0.154454 0.027980
+vt 0.240567 0.000000
+vt 0.331112 0.000000
+vt 0.417226 0.027980
+vt 0.490479 0.081201
+vt 0.543700 0.154454
+vt 0.571680 0.240567
+vt 0.571680 0.331113
+vt 0.543699 0.417226
+vt 0.490478 0.490479
+vt 0.417226 0.543700
+vt 0.331112 0.571680
+vn -0.407058 0.442793 -0.798898
+vn 0.140263 0.442793 -0.885585
+vn -0.140262 0.442793 -0.885585
+vn 0.407059 0.442793 -0.798898
+vn -0.634008 0.442793 -0.634010
+vn -0.798897 0.442793 -0.407060
+vn -0.885585 0.442793 -0.140264
+vn -0.885585 0.442793 0.140262
+vn -0.798898 0.442793 0.407058
+vn -0.634009 0.442793 0.634009
+vn -0.407059 0.442793 0.798898
+vn -0.140263 0.442793 0.885585
+vn 0.140263 0.442793 0.885585
+vn 0.407059 0.442793 0.798898
+vn 0.634009 0.442793 0.634009
+vn 0.798898 0.442793 0.407059
+vn 0.885585 0.442793 0.140263
+vn 0.885585 0.442793 -0.140263
+vn 0.798898 0.442793 -0.407059
+vn 0.634009 0.442793 -0.634009
+vn -0.000000 -1.000000 -0.000000
+s off
+f 20/1/1 9/2/1 21/3/1
+f 1/4/2 9/5/2 2/6/2
+f 21/7/3 9/5/3 1/4/3
+f 2/6/4 9/5/4 3/8/4
+f 19/9/5 9/2/5 20/1/5
+f 18/10/6 9/2/6 19/9/6
+f 17/11/7 9/2/7 18/10/7
+f 16/12/8 9/2/8 17/11/8
+f 15/13/9 9/2/9 16/12/9
+f 14/14/10 9/2/10 15/13/10
+f 13/15/11 9/2/11 14/14/11
+f 12/16/12 9/2/12 13/15/12
+f 11/17/13 9/5/13 12/18/13
+f 10/19/14 9/5/14 11/17/14
+f 8/20/15 9/5/15 10/19/15
+f 7/21/16 9/5/16 8/20/16
+f 6/22/17 9/5/17 7/21/17
+f 5/23/18 9/5/18 6/22/18
+f 4/24/19 9/5/19 5/23/19
+f 3/8/20 9/5/20 4/24/20
+f 21/25/21 1/26/21 20/27/21
+f 1/26/21 2/28/21 20/27/21
+f 2/28/21 3/29/21 20/27/21
+f 3/29/21 4/30/21 20/27/21
+f 4/30/21 5/31/21 20/27/21
+f 5/31/21 6/32/21 20/27/21
+f 6/32/21 7/33/21 20/27/21
+f 7/33/21 8/34/21 20/27/21
+f 8/34/21 10/35/21 20/27/21
+f 10/35/21 11/36/21 20/27/21
+f 11/36/21 12/37/21 20/27/21
+f 12/37/21 13/38/21 20/27/21
+f 13/38/21 14/39/21 20/27/21
+f 14/39/21 15/40/21 20/27/21
+f 15/40/21 16/41/21 20/27/21
+f 16/41/21 17/42/21 20/27/21
+f 17/42/21 18/43/21 19/44/21
+f 20/27/21 17/42/21 19/44/21
diff --git a/src/datavisualization/engine/meshes/coneFilledSmooth.obj b/src/datavisualization/engine/meshes/coneFilledSmooth.obj
new file mode 100644
index 00000000..ea3a8702
--- /dev/null
+++ b/src/datavisualization/engine/meshes/coneFilledSmooth.obj
@@ -0,0 +1,128 @@
+# Blender v2.66 (sub 0) OBJ File: 'cone_filled.blend'
+# www.blender.org
+o Cone_Cone.001
+v 0.000000 -1.000000 -1.000000
+v 0.309017 -1.000000 -0.951057
+v 0.587785 -1.000000 -0.809017
+v 0.809017 -1.000000 -0.587785
+v 0.951057 -1.000000 -0.309017
+v 1.000000 -1.000000 0.000000
+v 0.951056 -1.000000 0.309017
+v 0.809017 -1.000000 0.587785
+v 0.000000 1.000000 0.000000
+v 0.587785 -1.000000 0.809017
+v 0.309017 -1.000000 0.951057
+v -0.000000 -1.000000 1.000000
+v -0.309017 -1.000000 0.951056
+v -0.587786 -1.000000 0.809017
+v -0.809017 -1.000000 0.587785
+v -0.951057 -1.000000 0.309016
+v -1.000000 -1.000000 -0.000001
+v -0.951056 -1.000000 -0.309018
+v -0.809016 -1.000000 -0.587786
+v -0.587784 -1.000000 -0.809018
+v -0.309016 -1.000000 -0.951057
+vt 0.636534 0.537407
+vt 0.609784 0.926283
+vt 0.571680 0.562142
+vt 0.911640 0.504376
+vt 0.571680 0.368442
+vt 0.953118 0.448721
+vt 0.853526 0.537297
+vt 0.973901 0.375780
+vt 0.712378 0.537297
+vt 0.791787 0.561822
+vt 0.866987 0.608581
+vt 0.930618 0.672998
+vt 0.976451 0.748767
+vt 1.000000 0.828470
+vt 0.998959 0.904307
+vt 0.973430 0.968853
+vt 0.629860 0.006965
+vt 0.571746 0.039886
+vt 0.698921 0.000000
+vt 0.772169 0.019673
+vt 0.842434 0.064059
+vt 0.902837 0.128812
+vt 0.947467 0.207594
+vt 0.971954 0.292693
+vt 0.154453 0.543699
+vt 0.081201 0.490478
+vt 0.240567 0.571679
+vt 0.027980 0.417226
+vt 0.000000 0.331112
+vt 0.000000 0.240567
+vt 0.027980 0.154454
+vt 0.081201 0.081201
+vt 0.154454 0.027980
+vt 0.240567 0.000000
+vt 0.331112 0.000000
+vt 0.417226 0.027980
+vt 0.490479 0.081201
+vt 0.543700 0.154454
+vt 0.571680 0.240567
+vt 0.571680 0.331113
+vt 0.543699 0.417226
+vt 0.490478 0.490479
+vt 0.417226 0.543700
+vt 0.331112 0.571680
+vn -0.512009 -0.491043 -0.704733
+vn 0.000000 1.000000 0.000000
+vn -0.269173 -0.491043 -0.828486
+vn 0.000000 -0.491043 -0.871120
+vn 0.269173 -0.491043 -0.828486
+vn 0.512009 -0.491043 -0.704733
+vn -0.704733 -0.491043 -0.512040
+vn -0.828486 -0.491043 -0.269173
+vn -0.871120 -0.491043 0.000000
+vn -0.828486 -0.491043 0.269173
+vn -0.704733 -0.491043 0.512009
+vn -0.512009 -0.491043 0.704733
+vn -0.269173 -0.491043 0.828486
+vn 0.000000 -0.491043 0.871120
+vn 0.269173 -0.491043 0.828486
+vn 0.512009 -0.491043 0.704733
+vn 0.704733 -0.491043 0.512009
+vn 0.828486 -0.491043 0.269173
+vn 0.871120 -0.491043 0.000000
+vn 0.828486 -0.491043 -0.269173
+vn 0.704733 -0.491043 -0.512009
+s 1
+f 20/1/1 9/2/2 21/3/3
+f 1/4/4 9/5/2 2/6/5
+f 21/7/3 9/5/2 1/4/4
+f 2/6/5 9/5/2 3/8/6
+f 19/9/7 9/2/2 20/1/1
+f 18/10/8 9/2/2 19/9/7
+f 17/11/9 9/2/2 18/10/8
+f 16/12/10 9/2/2 17/11/9
+f 15/13/11 9/2/2 16/12/10
+f 14/14/12 9/2/2 15/13/11
+f 13/15/13 9/2/2 14/14/12
+f 12/16/14 9/2/2 13/15/13
+f 11/17/15 9/5/2 12/18/14
+f 10/19/16 9/5/2 11/17/15
+f 8/20/17 9/5/2 10/19/16
+f 7/21/18 9/5/2 8/20/17
+f 6/22/19 9/5/2 7/21/18
+f 5/23/20 9/5/2 6/22/19
+f 4/24/21 9/5/2 5/23/20
+f 3/8/6 9/5/2 4/24/21
+f 21/25/3 1/26/4 20/27/1
+f 1/26/4 2/28/5 20/27/1
+f 2/28/5 3/29/6 20/27/1
+f 3/29/6 4/30/21 20/27/1
+f 4/30/21 5/31/20 20/27/1
+f 5/31/20 6/32/19 20/27/1
+f 6/32/19 7/33/18 20/27/1
+f 7/33/18 8/34/17 20/27/1
+f 8/34/17 10/35/16 20/27/1
+f 10/35/16 11/36/15 20/27/1
+f 11/36/15 12/37/14 20/27/1
+f 12/37/14 13/38/13 20/27/1
+f 13/38/13 14/39/12 20/27/1
+f 14/39/12 15/40/11 20/27/1
+f 15/40/11 16/41/10 20/27/1
+f 16/41/10 17/42/9 20/27/1
+f 17/42/9 18/43/8 19/44/7
+f 20/27/1 17/42/9 19/44/7
diff --git a/src/datavisualization/engine/meshes/coneFlat.obj b/src/datavisualization/engine/meshes/coneFlat.obj
new file mode 100644
index 00000000..51c3821e
--- /dev/null
+++ b/src/datavisualization/engine/meshes/coneFlat.obj
@@ -0,0 +1,89 @@
+# Blender v2.66 (sub 0) OBJ File: 'cone.blend'
+# www.blender.org
+o Cone_Cone.001
+v 0.000000 -1.000000 -1.000000
+v 0.309017 -1.000000 -0.951057
+v 0.587785 -1.000000 -0.809017
+v 0.809017 -1.000000 -0.587785
+v 0.951057 -1.000000 -0.309017
+v 1.000000 -1.000000 0.000000
+v 0.951056 -1.000000 0.309017
+v 0.809017 -1.000000 0.587785
+v 0.000000 1.000000 0.000000
+v 0.587785 -1.000000 0.809017
+v 0.309017 -1.000000 0.951057
+v -0.000000 -1.000000 1.000000
+v -0.309017 -1.000000 0.951056
+v -0.587786 -1.000000 0.809017
+v -0.809017 -1.000000 0.587785
+v -0.951057 -1.000000 0.309016
+v -1.000000 -1.000000 -0.000001
+v -0.951056 -1.000000 -0.309018
+v -0.809016 -1.000000 -0.587786
+v -0.587784 -1.000000 -0.809018
+v -0.309016 -1.000000 -0.951057
+vt 0.018984 0.308330
+vt 0.500000 0.482045
+vt 0.000000 0.410924
+vt 0.011213 0.505476
+vt 0.051524 0.582730
+vt 0.116989 0.635124
+vt 0.066306 0.207736
+vt 0.137334 0.118990
+vt 0.225115 0.050777
+vt 0.321057 0.009776
+vt 0.415768 0.000000
+vt 0.499978 0.022406
+vt 0.551525 0.582730
+vt 1.000000 0.482045
+vt 0.616989 0.635125
+vt 0.511213 0.505476
+vt 0.500000 0.410924
+vt 0.518984 0.308330
+vt 0.566306 0.207736
+vt 0.637334 0.118990
+vt 0.725115 0.050777
+vt 0.821057 0.009776
+vt 0.915768 0.000000
+vt 0.999978 0.022406
+vn -0.407058 0.442793 -0.798898
+vn 0.140263 0.442793 -0.885585
+vn -0.140262 0.442793 -0.885585
+vn 0.407059 0.442793 -0.798898
+vn -0.634008 0.442793 -0.634010
+vn -0.798897 0.442793 -0.407060
+vn -0.885585 0.442793 -0.140264
+vn -0.885585 0.442793 0.140262
+vn -0.798898 0.442793 0.407058
+vn -0.634009 0.442793 0.634009
+vn -0.407059 0.442793 0.798898
+vn -0.140263 0.442793 0.885585
+vn 0.140263 0.442793 0.885585
+vn 0.407059 0.442793 0.798898
+vn 0.634009 0.442793 0.634009
+vn 0.798898 0.442793 0.407059
+vn 0.885585 0.442793 0.140263
+vn 0.885585 0.442793 -0.140263
+vn 0.798898 0.442793 -0.407059
+vn 0.634009 0.442793 -0.634009
+s off
+f 20/1/1 9/2/1 21/3/1
+f 1/4/2 9/2/2 2/5/2
+f 21/3/3 9/2/3 1/4/3
+f 2/5/4 9/2/4 3/6/4
+f 19/7/5 9/2/5 20/1/5
+f 18/8/6 9/2/6 19/7/6
+f 17/9/7 9/2/7 18/8/7
+f 16/10/8 9/2/8 17/9/8
+f 15/11/9 9/2/9 16/10/9
+f 14/12/10 9/2/10 15/11/10
+f 13/13/11 9/14/11 14/15/11
+f 12/16/12 9/14/12 13/13/12
+f 11/17/13 9/14/13 12/16/13
+f 10/18/14 9/14/14 11/17/14
+f 8/19/15 9/14/15 10/18/15
+f 7/20/16 9/14/16 8/19/16
+f 6/21/17 9/14/17 7/20/17
+f 5/22/18 9/14/18 6/21/18
+f 4/23/19 9/14/19 5/22/19
+f 3/24/20 9/14/20 4/23/20
diff --git a/src/datavisualization/engine/meshes/coneSmooth.obj b/src/datavisualization/engine/meshes/coneSmooth.obj
new file mode 100644
index 00000000..48c48ba8
--- /dev/null
+++ b/src/datavisualization/engine/meshes/coneSmooth.obj
@@ -0,0 +1,90 @@
+# Blender v2.66 (sub 0) OBJ File: 'cone.blend'
+# www.blender.org
+o Cone_Cone.001
+v 0.000000 -1.000000 -1.000000
+v 0.309017 -1.000000 -0.951057
+v 0.587785 -1.000000 -0.809017
+v 0.809017 -1.000000 -0.587785
+v 0.951057 -1.000000 -0.309017
+v 1.000000 -1.000000 0.000000
+v 0.951056 -1.000000 0.309017
+v 0.809017 -1.000000 0.587785
+v 0.000000 1.000000 0.000000
+v 0.587785 -1.000000 0.809017
+v 0.309017 -1.000000 0.951057
+v -0.000000 -1.000000 1.000000
+v -0.309017 -1.000000 0.951056
+v -0.587786 -1.000000 0.809017
+v -0.809017 -1.000000 0.587785
+v -0.951057 -1.000000 0.309016
+v -1.000000 -1.000000 -0.000001
+v -0.951056 -1.000000 -0.309018
+v -0.809016 -1.000000 -0.587786
+v -0.587784 -1.000000 -0.809018
+v -0.309016 -1.000000 -0.951057
+vt 0.018984 0.308330
+vt 0.500000 0.482045
+vt 0.000000 0.410924
+vt 0.011213 0.505476
+vt 0.051524 0.582730
+vt 0.116989 0.635124
+vt 0.066306 0.207736
+vt 0.137334 0.118990
+vt 0.225115 0.050777
+vt 0.321057 0.009776
+vt 0.415768 0.000000
+vt 0.499978 0.022406
+vt 0.551525 0.582730
+vt 1.000000 0.482045
+vt 0.616989 0.635125
+vt 0.511213 0.505476
+vt 0.500000 0.410924
+vt 0.518984 0.308330
+vt 0.566306 0.207736
+vt 0.637334 0.118990
+vt 0.725115 0.050777
+vt 0.821057 0.009776
+vt 0.915768 0.000000
+vt 0.999978 0.022406
+vn -0.525712 0.447188 -0.723594
+vn 0.000000 1.000000 0.000000
+vn -0.276376 0.447188 -0.850642
+vn 0.000000 0.447188 -0.894406
+vn 0.276376 0.447188 -0.850642
+vn 0.525712 0.447188 -0.723594
+vn -0.723594 0.447188 -0.525712
+vn -0.850642 0.447188 -0.276376
+vn -0.894406 0.447188 0.000000
+vn -0.850642 0.447188 0.276376
+vn -0.723594 0.447188 0.525712
+vn -0.525712 0.447188 0.723594
+vn -0.276376 0.447188 0.850642
+vn 0.000000 0.447188 0.894406
+vn 0.276376 0.447188 0.850642
+vn 0.525712 0.447188 0.723594
+vn 0.723594 0.447188 0.525712
+vn 0.850642 0.447188 0.276376
+vn 0.894406 0.447188 0.000000
+vn 0.850642 0.447188 -0.276376
+vn 0.723594 0.447188 -0.525712
+s 1
+f 20/1/1 9/2/2 21/3/3
+f 1/4/4 9/2/2 2/5/5
+f 21/3/3 9/2/2 1/4/4
+f 2/5/5 9/2/2 3/6/6
+f 19/7/7 9/2/2 20/1/1
+f 18/8/8 9/2/2 19/7/7
+f 17/9/9 9/2/2 18/8/8
+f 16/10/10 9/2/2 17/9/9
+f 15/11/11 9/2/2 16/10/10
+f 14/12/12 9/2/2 15/11/11
+f 13/13/13 9/14/2 14/15/12
+f 12/16/14 9/14/2 13/13/13
+f 11/17/15 9/14/2 12/16/14
+f 10/18/16 9/14/2 11/17/15
+f 8/19/17 9/14/2 10/18/16
+f 7/20/18 9/14/2 8/19/17
+f 6/21/19 9/14/2 7/20/18
+f 5/22/20 9/14/2 6/21/19
+f 4/23/21 9/14/2 5/22/20
+f 3/24/6 9/14/2 4/23/21
diff --git a/src/datavisualization/engine/meshes/cubeFilledFlat.obj b/src/datavisualization/engine/meshes/cubeFilledFlat.obj
new file mode 100644
index 00000000..108cf7ac
--- /dev/null
+++ b/src/datavisualization/engine/meshes/cubeFilledFlat.obj
@@ -0,0 +1,54 @@
+# Blender v2.66 (sub 0) OBJ File: 'cube_filled.blend'
+# www.blender.org
+o Cube
+v -1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 1.000000
+v -1.000000 1.000000 1.000000
+v -1.000000 1.000000 -1.000000
+v 1.000000 1.000000 -1.000000
+v 1.000000 1.000000 1.000000
+vt 0.666667 0.332314
+vt 0.334353 0.333333
+vt 0.665647 0.000000
+vt 0.001020 0.333333
+vt 0.000000 0.001020
+vt 0.333333 0.332314
+vt 0.333333 0.665647
+vt 0.001019 0.666667
+vt 0.000000 0.334353
+vt 0.334353 0.666667
+vt 0.333333 0.334353
+vt 0.665647 0.333333
+vt 0.333333 0.667686
+vt 0.665647 0.666667
+vt 0.666667 0.998980
+vt 0.667686 0.333333
+vt 0.666667 0.001019
+vt 0.998980 0.000000
+vt 0.333333 0.001019
+vt 0.332314 0.000000
+vt 0.332314 0.333333
+vt 0.666667 0.665647
+vt 0.334353 1.000000
+vt 1.000000 0.332314
+vn -1.000000 0.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn 1.000000 -0.000000 0.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 1.000000 0.000000
+vn -0.000000 -1.000000 -0.000000
+s off
+f 5/1/1 6/2/1 1/3/1
+f 6/4/2 7/5/2 2/6/2
+f 7/7/3 8/8/3 4/9/3
+f 8/10/4 5/11/4 1/12/4
+f 8/13/5 7/14/5 6/15/5
+f 2/16/6 3/17/6 4/18/6
+f 6/2/1 2/19/1 1/3/1
+f 7/5/2 3/20/2 2/6/2
+f 3/21/3 7/7/3 4/9/3
+f 4/22/4 8/10/4 1/12/4
+f 5/23/5 8/13/5 6/15/5
+f 1/24/6 2/16/6 4/18/6
diff --git a/src/datavisualization/engine/meshes/cubeFilledSmooth.obj b/src/datavisualization/engine/meshes/cubeFilledSmooth.obj
new file mode 100644
index 00000000..07350f03
--- /dev/null
+++ b/src/datavisualization/engine/meshes/cubeFilledSmooth.obj
@@ -0,0 +1,56 @@
+# Blender v2.66 (sub 0) OBJ File: 'cube_filled.blend'
+# www.blender.org
+o Cube
+v -1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 1.000000
+v -1.000000 1.000000 1.000000
+v -1.000000 1.000000 -1.000000
+v 1.000000 1.000000 -1.000000
+v 1.000000 1.000000 1.000000
+vt 0.666667 0.332314
+vt 0.334353 0.333333
+vt 0.665647 0.000000
+vt 0.001020 0.333333
+vt 0.000000 0.001020
+vt 0.333333 0.332314
+vt 0.333333 0.665647
+vt 0.001019 0.666667
+vt 0.000000 0.334353
+vt 0.334353 0.666667
+vt 0.333333 0.334353
+vt 0.665647 0.333333
+vt 0.333333 0.667686
+vt 0.665647 0.666667
+vt 0.666667 0.998980
+vt 0.667686 0.333333
+vt 0.666667 0.001019
+vt 0.998980 0.000000
+vt 0.333333 0.001019
+vt 0.332314 0.000000
+vt 0.332314 0.333333
+vt 0.666667 0.665647
+vt 0.334353 1.000000
+vt 1.000000 0.332314
+vn -0.577349 0.577349 0.577349
+vn -0.577349 0.577349 -0.577349
+vn -0.577349 -0.577349 0.577349
+vn 0.577349 0.577349 -0.577349
+vn -0.577349 -0.577349 -0.577349
+vn 0.577349 0.577349 0.577349
+vn 0.577349 -0.577349 0.577349
+vn 0.577349 -0.577349 -0.577349
+s 1
+f 5/1/1 6/2/2 1/3/3
+f 6/4/2 7/5/4 2/6/5
+f 7/7/4 8/8/6 4/9/7
+f 8/10/6 5/11/1 1/12/3
+f 8/13/6 7/14/4 6/15/2
+f 2/16/5 3/17/8 4/18/7
+f 6/2/2 2/19/5 1/3/3
+f 7/5/4 3/20/8 2/6/5
+f 3/21/8 7/7/4 4/9/7
+f 4/22/7 8/10/6 1/12/3
+f 5/23/1 8/13/6 6/15/2
+f 1/24/3 2/16/5 4/18/7
diff --git a/src/datavisualization/engine/meshes/cubeFlat.obj b/src/datavisualization/engine/meshes/cubeFlat.obj
new file mode 100644
index 00000000..3c8d6d0a
--- /dev/null
+++ b/src/datavisualization/engine/meshes/cubeFlat.obj
@@ -0,0 +1,47 @@
+# Blender v2.66 (sub 0) OBJ File: 'cube.blend'
+# www.blender.org
+o Cube
+v -1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 1.000000
+v -1.000000 1.000000 1.000000
+v -1.000000 1.000000 -1.000000
+v 1.000000 1.000000 -1.000000
+v 1.000000 1.000000 1.000000
+vt 0.998999 0.334334
+vt 0.667668 0.334334
+vt 0.998999 0.665666
+vt 0.332332 0.001001
+vt 0.001001 0.001001
+vt 0.332332 0.332332
+vt 0.332332 0.334334
+vt 0.001001 0.334334
+vt 0.001001 0.665666
+vt 0.665666 0.001001
+vt 0.334334 0.001001
+vt 0.334334 0.332332
+vt 0.665666 0.334334
+vt 0.334334 0.334334
+vt 0.334334 0.665666
+vt 0.667668 0.665666
+vt 0.001001 0.332332
+vt 0.332332 0.665666
+vt 0.665666 0.332332
+vt 0.665666 0.665666
+vn -1.000000 0.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn 1.000000 -0.000000 0.000000
+vn 0.000000 0.000000 1.000000
+vn 0.000000 1.000000 0.000000
+s off
+f 5/1/1 6/2/1 1/3/1
+f 6/4/2 7/5/2 2/6/2
+f 7/7/3 8/8/3 4/9/3
+f 8/10/4 5/11/4 1/12/4
+f 8/13/5 7/14/5 6/15/5
+f 6/2/1 2/16/1 1/3/1
+f 7/5/2 3/17/2 2/6/2
+f 3/18/3 7/7/3 4/9/3
+f 4/19/4 8/10/4 1/12/4
+f 5/20/5 8/13/5 6/15/5
diff --git a/src/datavisualization/engine/meshes/cubeSmooth.obj b/src/datavisualization/engine/meshes/cubeSmooth.obj
new file mode 100644
index 00000000..9d147bfd
--- /dev/null
+++ b/src/datavisualization/engine/meshes/cubeSmooth.obj
@@ -0,0 +1,50 @@
+# Blender v2.66 (sub 0) OBJ File: 'cube.blend'
+# www.blender.org
+o Cube
+v -1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 1.000000
+v -1.000000 1.000000 1.000000
+v -1.000000 1.000000 -1.000000
+v 1.000000 1.000000 -1.000000
+v 1.000000 1.000000 1.000000
+vt 0.998999 0.334334
+vt 0.667668 0.334334
+vt 0.998999 0.665666
+vt 0.332332 0.001001
+vt 0.001001 0.001001
+vt 0.332332 0.332332
+vt 0.332332 0.334334
+vt 0.001001 0.334334
+vt 0.001001 0.665666
+vt 0.665666 0.001001
+vt 0.334334 0.001001
+vt 0.334334 0.332332
+vt 0.665666 0.334334
+vt 0.334334 0.334334
+vt 0.334334 0.665666
+vt 0.667668 0.665666
+vt 0.001001 0.332332
+vt 0.332332 0.665666
+vt 0.665666 0.332332
+vt 0.665666 0.665666
+vn -0.577349 0.577349 0.577349
+vn -0.577349 0.577349 -0.577349
+vn -0.707083 0.000000 0.707083
+vn 0.577349 0.577349 -0.577349
+vn -0.707083 0.000000 -0.707083
+vn 0.577349 0.577349 0.577349
+vn 0.707083 0.000000 0.707083
+vn 0.707083 0.000000 -0.707083
+s 1
+f 5/1/1 6/2/2 1/3/3
+f 6/4/2 7/5/4 2/6/5
+f 7/7/4 8/8/6 4/9/7
+f 8/10/6 5/11/1 1/12/3
+f 8/13/6 7/14/4 6/15/2
+f 6/2/2 2/16/5 1/3/3
+f 7/5/4 3/17/8 2/6/5
+f 3/18/8 7/7/4 4/9/7
+f 4/19/7 8/10/6 1/12/3
+f 5/20/1 8/13/6 6/15/2
diff --git a/src/datavisualization/engine/meshes/cylinderFilledFlat.obj b/src/datavisualization/engine/meshes/cylinderFilledFlat.obj
new file mode 100644
index 00000000..16c2ef36
--- /dev/null
+++ b/src/datavisualization/engine/meshes/cylinderFilledFlat.obj
@@ -0,0 +1,361 @@
+# Blender v2.66 (sub 0) OBJ File: 'cylinder_filled.blend'
+# www.blender.org
+o Cylinder
+v 0.000000 -1.000000 -1.000000
+v 0.000000 1.000000 -1.000000
+v 0.195090 -1.000000 -0.980785
+v 0.195090 1.000000 -0.980785
+v 0.382683 -1.000000 -0.923880
+v 0.382683 1.000000 -0.923880
+v 0.555570 -1.000000 -0.831470
+v 0.555570 1.000000 -0.831470
+v 0.707107 -1.000000 -0.707107
+v 0.707107 1.000000 -0.707107
+v 0.831470 -1.000000 -0.555570
+v 0.831470 1.000000 -0.555570
+v 0.923880 -1.000000 -0.382683
+v 0.923880 1.000000 -0.382683
+v 0.980785 -1.000000 -0.195090
+v 0.980785 1.000000 -0.195090
+v 1.000000 -1.000000 -0.000000
+v 1.000000 1.000000 -0.000000
+v 0.980785 -1.000000 0.195090
+v 0.980785 1.000000 0.195090
+v 0.923880 -1.000000 0.382683
+v 0.923880 1.000000 0.382683
+v 0.831470 -1.000000 0.555570
+v 0.831470 1.000000 0.555570
+v 0.707107 -1.000000 0.707107
+v 0.707107 1.000000 0.707107
+v 0.555570 -1.000000 0.831470
+v 0.555570 1.000000 0.831470
+v 0.382683 -1.000000 0.923880
+v 0.382683 1.000000 0.923880
+v 0.195090 -1.000000 0.980785
+v 0.195090 1.000000 0.980785
+v -0.000000 -1.000000 1.000000
+v -0.000000 1.000000 1.000000
+v -0.195091 -1.000000 0.980785
+v -0.195091 1.000000 0.980785
+v -0.382684 -1.000000 0.923879
+v -0.382684 1.000000 0.923879
+v -0.555571 -1.000000 0.831469
+v -0.555571 1.000000 0.831469
+v -0.707107 -1.000000 0.707106
+v -0.707107 1.000000 0.707106
+v -0.831470 -1.000000 0.555570
+v -0.831470 1.000000 0.555570
+v -0.923880 -1.000000 0.382683
+v -0.923880 1.000000 0.382683
+v -0.980785 -1.000000 0.195089
+v -0.980785 1.000000 0.195089
+v -1.000000 -1.000000 -0.000001
+v -1.000000 1.000000 -0.000001
+v -0.980785 -1.000000 -0.195091
+v -0.980785 1.000000 -0.195091
+v -0.923879 -1.000000 -0.382684
+v -0.923879 1.000000 -0.382684
+v -0.831469 -1.000000 -0.555571
+v -0.831469 1.000000 -0.555571
+v -0.707106 -1.000000 -0.707108
+v -0.707106 1.000000 -0.707108
+v -0.555569 -1.000000 -0.831470
+v -0.555569 1.000000 -0.831470
+v -0.382682 -1.000000 -0.923880
+v -0.382682 1.000000 -0.923880
+v -0.195089 -1.000000 -0.980786
+v -0.195089 1.000000 -0.980786
+vt 0.059001 0.355439
+vt 0.057906 0.712417
+vt 0.027048 0.712322
+vt 0.028143 0.355344
+vt 0.000000 0.712239
+vt 0.998905 0.355261
+vt 1.000000 0.712239
+vt 0.972952 0.712322
+vt 0.971857 0.355344
+vt 0.942094 0.712417
+vt 0.940999 0.355439
+vt 0.908611 0.712520
+vt 0.907515 0.355541
+vt 0.873789 0.712627
+vt 0.872694 0.355648
+vt 0.838968 0.712733
+vt 0.837872 0.355755
+vt 0.805484 0.712836
+vt 0.777341 0.713350
+vt 0.776246 1.070328
+vt 0.742763 1.070225
+vt 0.743858 0.713247
+vt 0.707941 1.070119
+vt 0.709036 0.713140
+vt 0.673120 1.070012
+vt 0.674215 0.713033
+vt 0.639636 1.069909
+vt 0.640732 0.712931
+vt 0.608778 1.069814
+vt 0.609873 0.712836
+vt 0.608778 0.355858
+vt 0.642261 0.355755
+vt 0.643357 0.712733
+vt 0.677083 0.355648
+vt 0.678178 0.712627
+vt 0.711904 0.355541
+vt 0.713000 0.712520
+vt 0.746483 0.712417
+vt 0.745388 0.355439
+vt 0.777341 0.712322
+vt 0.776246 0.355344
+vt 0.804389 0.712239
+vt 0.607683 0.355261
+vt 0.608778 0.712239
+vt 0.580635 0.355344
+vt 0.581730 0.712322
+vt 0.549777 0.355439
+vt 0.550872 0.712417
+vt 0.516293 0.355541
+vt 0.517389 0.712520
+vt 0.481472 0.355648
+vt 0.482567 0.712627
+vt 0.446650 0.355755
+vt 0.447746 0.712733
+vt 0.413167 0.355858
+vt 0.414262 0.712836
+vt 0.382309 0.355952
+vt 0.383404 0.712931
+vt 0.355261 0.356035
+vt 0.226469 0.355952
+vt 0.225374 0.712931
+vt 0.195611 0.355858
+vt 0.194516 0.712836
+vt 0.162127 0.355755
+vt 0.161032 0.712733
+vt 0.127306 0.355648
+vt 0.000000 0.160135
+vt 0.006826 0.125818
+vt 0.000000 0.195126
+vt 0.092484 0.355541
+vt 0.091389 0.712520
+vt 0.126211 0.712627
+vt 0.394917 0.290863
+vt 0.375477 0.261770
+vt 0.419658 0.315605
+vt 0.001095 0.355261
+vt 0.804389 0.355858
+vt 0.803294 0.355261
+vt 0.356356 0.713014
+vt 0.020216 0.093491
+vt 0.039656 0.064398
+vt 0.064397 0.039656
+vt 0.093491 0.020217
+vt 0.125817 0.006826
+vt 0.160135 0.000000
+vt 0.195125 0.000000
+vt 0.229443 0.006826
+vt 0.261770 0.020216
+vt 0.290863 0.039656
+vt 0.315605 0.064398
+vt 0.335045 0.093491
+vt 0.348435 0.125818
+vt 0.355261 0.160135
+vt 0.355261 0.195126
+vt 0.348435 0.229443
+vt 0.335045 0.261770
+vt 0.315605 0.290863
+vt 0.290863 0.315605
+vt 0.261770 0.335045
+vt 0.229443 0.348435
+vt 0.195126 0.355261
+vt 0.160135 0.355261
+vt 0.125818 0.348435
+vt 0.093491 0.335045
+vt 0.064398 0.315605
+vt 0.039656 0.290863
+vt 0.020216 0.261770
+vt 0.006826 0.229443
+vt 0.362087 0.229443
+vt 0.362087 0.125818
+vt 0.375477 0.093491
+vt 0.394917 0.064398
+vt 0.419659 0.039656
+vt 0.448752 0.020216
+vt 0.481079 0.006826
+vt 0.515396 0.000000
+vt 0.550387 0.000000
+vt 0.584704 0.006826
+vt 0.617031 0.020216
+vt 0.646124 0.039656
+vt 0.670866 0.064398
+vt 0.690306 0.093491
+vt 0.703696 0.125818
+vt 0.710522 0.160136
+vt 0.710522 0.195126
+vt 0.703696 0.229444
+vt 0.690306 0.261770
+vt 0.670866 0.290864
+vt 0.646124 0.315605
+vt 0.617031 0.335045
+vt 0.584704 0.348435
+vt 0.550386 0.355261
+vt 0.515396 0.355261
+vt 0.481078 0.348435
+vt 0.448752 0.335045
+vn 0.098017 0.000000 -0.995185
+vn 0.290285 0.000000 -0.956940
+vn 0.471397 0.000000 -0.881921
+vn 0.634393 0.000000 -0.773010
+vn 0.773010 0.000000 -0.634393
+vn 0.881921 0.000000 -0.471397
+vn 0.956940 0.000000 -0.290285
+vn 0.995185 0.000000 -0.098017
+vn 0.995185 0.000000 0.098017
+vn 0.956940 0.000000 0.290285
+vn 0.881921 0.000000 0.471396
+vn 0.773010 0.000000 0.634393
+vn 0.634393 0.000000 0.773010
+vn 0.471397 0.000000 0.881921
+vn 0.290284 0.000000 0.956940
+vn 0.098017 0.000000 0.995185
+vn -0.098018 0.000000 0.995185
+vn -0.290285 0.000000 0.956940
+vn -0.471397 0.000000 0.881921
+vn -0.634394 0.000000 0.773010
+vn -0.773011 0.000000 0.634393
+vn -0.881922 0.000000 0.471396
+vn -0.956941 0.000000 0.290284
+vn -0.995185 0.000000 0.098016
+vn -0.995185 -0.000000 -0.098018
+vn -0.956940 -0.000000 -0.290286
+vn -0.881921 -0.000000 -0.471398
+vn -0.773010 -0.000000 -0.634394
+vn -0.634392 -0.000000 -0.773011
+vn -0.471395 -0.000000 -0.881922
+vn -0.000000 1.000000 0.000000
+vn -0.098017 -0.000000 -0.995185
+vn -0.290283 -0.000000 -0.956941
+vn -0.000000 -1.000000 -0.000000
+s off
+f 1/1/1 2/2/1 4/3/1
+f 3/4/2 4/3/2 6/5/2
+f 5/6/3 6/7/3 8/8/3
+f 7/9/4 8/8/4 10/10/4
+f 9/11/5 10/10/5 12/12/5
+f 11/13/6 12/12/6 14/14/6
+f 13/15/7 14/14/7 16/16/7
+f 15/17/8 16/16/8 18/18/8
+f 17/19/9 18/20/9 20/21/9
+f 19/22/10 20/21/10 22/23/10
+f 21/24/11 22/23/11 24/25/11
+f 23/26/12 24/25/12 26/27/12
+f 25/28/13 26/27/13 28/29/13
+f 27/30/14 28/31/14 30/32/14
+f 29/33/15 30/32/15 32/34/15
+f 31/35/16 32/34/16 34/36/16
+f 33/37/17 34/36/17 35/38/17
+f 35/38/18 36/39/18 37/40/18
+f 37/40/19 38/41/19 39/42/19
+f 39/43/20 40/44/20 41/45/20
+f 41/45/21 42/46/21 43/47/21
+f 43/47/22 44/48/22 45/49/22
+f 45/49/23 46/50/23 47/51/23
+f 47/51/24 48/52/24 49/53/24
+f 49/53/25 50/54/25 51/55/25
+f 51/55/26 52/56/26 53/57/26
+f 53/57/27 54/58/27 55/59/27
+f 55/60/28 56/61/28 57/62/28
+f 57/62/29 58/63/29 59/64/29
+f 59/64/30 60/65/30 61/66/30
+f 4/67/31 2/68/31 6/69/31
+f 63/70/32 64/71/32 1/1/32
+f 61/66/33 62/72/33 63/70/33
+f 63/73/34 1/74/34 61/75/34
+f 3/4/1 1/1/1 4/3/1
+f 5/76/2 3/4/2 6/5/2
+f 7/9/3 5/6/3 8/8/3
+f 9/11/4 7/9/4 10/10/4
+f 11/13/5 9/11/5 12/12/5
+f 13/15/6 11/13/6 14/14/6
+f 15/17/7 13/15/7 16/16/7
+f 17/77/8 15/17/8 18/18/8
+f 19/22/9 17/19/9 20/21/9
+f 21/24/10 19/22/10 22/23/10
+f 23/26/11 21/24/11 24/25/11
+f 25/28/12 23/26/12 26/27/12
+f 27/30/13 25/28/13 28/29/13
+f 29/33/14 27/30/14 30/32/14
+f 31/35/15 29/33/15 32/34/15
+f 33/37/16 31/35/16 34/36/16
+f 34/36/17 36/39/17 35/38/17
+f 36/39/18 38/41/18 37/40/18
+f 38/41/19 40/78/19 39/42/19
+f 40/44/20 42/46/20 41/45/20
+f 42/46/21 44/48/21 43/47/21
+f 44/48/22 46/50/22 45/49/22
+f 46/50/23 48/52/23 47/51/23
+f 48/52/24 50/54/24 49/53/24
+f 50/54/25 52/56/25 51/55/25
+f 52/56/26 54/58/26 53/57/26
+f 54/58/27 56/79/27 55/59/27
+f 56/61/28 58/63/28 57/62/28
+f 58/63/29 60/65/29 59/64/29
+f 60/65/30 62/72/30 61/66/30
+f 2/68/31 64/80/31 6/69/31
+f 64/80/31 62/81/31 6/69/31
+f 62/81/31 60/82/31 6/69/31
+f 60/82/31 58/83/31 6/69/31
+f 58/83/31 56/84/31 6/69/31
+f 56/84/31 54/85/31 6/69/31
+f 54/85/31 52/86/31 6/69/31
+f 52/86/31 50/87/31 6/69/31
+f 50/87/31 48/88/31 6/69/31
+f 48/88/31 46/89/31 6/69/31
+f 46/89/31 44/90/31 6/69/31
+f 44/90/31 42/91/31 6/69/31
+f 42/91/31 40/92/31 6/69/31
+f 40/92/31 38/93/31 6/69/31
+f 38/93/31 36/94/31 6/69/31
+f 36/94/31 34/95/31 6/69/31
+f 34/95/31 32/96/31 6/69/31
+f 32/96/31 30/97/31 6/69/31
+f 30/97/31 28/98/31 6/69/31
+f 28/98/31 26/99/31 6/69/31
+f 26/99/31 24/100/31 6/69/31
+f 24/100/31 22/101/31 6/69/31
+f 22/101/31 20/102/31 6/69/31
+f 20/102/31 18/103/31 6/69/31
+f 18/103/31 16/104/31 6/69/31
+f 16/104/31 14/105/31 6/69/31
+f 14/105/31 12/106/31 6/69/31
+f 12/106/31 10/107/31 8/108/31
+f 6/69/31 12/106/31 8/108/31
+f 64/71/32 2/2/32 1/1/32
+f 62/72/33 64/71/33 63/70/33
+f 1/74/34 3/109/34 61/75/34
+f 3/109/34 5/94/34 61/75/34
+f 5/94/34 7/93/34 61/75/34
+f 7/93/34 9/110/34 61/75/34
+f 9/110/34 11/111/34 61/75/34
+f 11/111/34 13/112/34 61/75/34
+f 13/112/34 15/113/34 61/75/34
+f 15/113/34 17/114/34 61/75/34
+f 17/114/34 19/115/34 61/75/34
+f 19/115/34 21/116/34 61/75/34
+f 21/116/34 23/117/34 61/75/34
+f 23/117/34 25/118/34 61/75/34
+f 25/118/34 27/119/34 61/75/34
+f 27/119/34 29/120/34 61/75/34
+f 29/120/34 31/121/34 61/75/34
+f 31/121/34 33/122/34 61/75/34
+f 33/122/34 35/123/34 61/75/34
+f 35/123/34 37/124/34 61/75/34
+f 37/124/34 39/125/34 61/75/34
+f 39/125/34 41/126/34 61/75/34
+f 41/126/34 43/127/34 61/75/34
+f 43/127/34 45/128/34 61/75/34
+f 45/128/34 47/129/34 61/75/34
+f 47/129/34 49/130/34 61/75/34
+f 49/130/34 51/131/34 61/75/34
+f 51/131/34 53/132/34 61/75/34
+f 53/132/34 55/133/34 61/75/34
+f 55/133/34 57/134/34 59/135/34
+f 61/75/34 55/133/34 59/135/34
diff --git a/src/datavisualization/engine/meshes/cylinderFilledSmooth.obj b/src/datavisualization/engine/meshes/cylinderFilledSmooth.obj
new file mode 100644
index 00000000..90db7d63
--- /dev/null
+++ b/src/datavisualization/engine/meshes/cylinderFilledSmooth.obj
@@ -0,0 +1,391 @@
+# Blender v2.66 (sub 0) OBJ File: 'cylinder_filled.blend'
+# www.blender.org
+o Cylinder
+v 0.000000 -1.000000 -1.000000
+v 0.000000 1.000000 -1.000000
+v 0.195090 -1.000000 -0.980785
+v 0.195090 1.000000 -0.980785
+v 0.382683 -1.000000 -0.923880
+v 0.382683 1.000000 -0.923880
+v 0.555570 -1.000000 -0.831470
+v 0.555570 1.000000 -0.831470
+v 0.707107 -1.000000 -0.707107
+v 0.707107 1.000000 -0.707107
+v 0.831470 -1.000000 -0.555570
+v 0.831470 1.000000 -0.555570
+v 0.923880 -1.000000 -0.382683
+v 0.923880 1.000000 -0.382683
+v 0.980785 -1.000000 -0.195090
+v 0.980785 1.000000 -0.195090
+v 1.000000 -1.000000 -0.000000
+v 1.000000 1.000000 -0.000000
+v 0.980785 -1.000000 0.195090
+v 0.980785 1.000000 0.195090
+v 0.923880 -1.000000 0.382683
+v 0.923880 1.000000 0.382683
+v 0.831470 -1.000000 0.555570
+v 0.831470 1.000000 0.555570
+v 0.707107 -1.000000 0.707107
+v 0.707107 1.000000 0.707107
+v 0.555570 -1.000000 0.831470
+v 0.555570 1.000000 0.831470
+v 0.382683 -1.000000 0.923880
+v 0.382683 1.000000 0.923880
+v 0.195090 -1.000000 0.980785
+v 0.195090 1.000000 0.980785
+v -0.000000 -1.000000 1.000000
+v -0.000000 1.000000 1.000000
+v -0.195091 -1.000000 0.980785
+v -0.195091 1.000000 0.980785
+v -0.382684 -1.000000 0.923879
+v -0.382684 1.000000 0.923879
+v -0.555571 -1.000000 0.831469
+v -0.555571 1.000000 0.831469
+v -0.707107 -1.000000 0.707106
+v -0.707107 1.000000 0.707106
+v -0.831470 -1.000000 0.555570
+v -0.831470 1.000000 0.555570
+v -0.923880 -1.000000 0.382683
+v -0.923880 1.000000 0.382683
+v -0.980785 -1.000000 0.195089
+v -0.980785 1.000000 0.195089
+v -1.000000 -1.000000 -0.000001
+v -1.000000 1.000000 -0.000001
+v -0.980785 -1.000000 -0.195091
+v -0.980785 1.000000 -0.195091
+v -0.923879 -1.000000 -0.382684
+v -0.923879 1.000000 -0.382684
+v -0.831469 -1.000000 -0.555571
+v -0.831469 1.000000 -0.555571
+v -0.707106 -1.000000 -0.707108
+v -0.707106 1.000000 -0.707108
+v -0.555569 -1.000000 -0.831470
+v -0.555569 1.000000 -0.831470
+v -0.382682 -1.000000 -0.923880
+v -0.382682 1.000000 -0.923880
+v -0.195089 -1.000000 -0.980786
+v -0.195089 1.000000 -0.980786
+vt 0.059001 0.355439
+vt 0.057906 0.712417
+vt 0.027048 0.712322
+vt 0.028143 0.355344
+vt 0.000000 0.712239
+vt 0.998905 0.355261
+vt 1.000000 0.712239
+vt 0.972952 0.712322
+vt 0.971857 0.355344
+vt 0.942094 0.712417
+vt 0.940999 0.355439
+vt 0.908611 0.712520
+vt 0.907515 0.355541
+vt 0.873789 0.712627
+vt 0.872694 0.355648
+vt 0.838968 0.712733
+vt 0.837872 0.355755
+vt 0.805484 0.712836
+vt 0.777341 0.713350
+vt 0.776246 1.070328
+vt 0.742763 1.070225
+vt 0.743858 0.713247
+vt 0.707941 1.070119
+vt 0.709036 0.713140
+vt 0.673120 1.070012
+vt 0.674215 0.713033
+vt 0.639636 1.069909
+vt 0.640732 0.712931
+vt 0.608778 1.069814
+vt 0.609873 0.712836
+vt 0.608778 0.355858
+vt 0.642261 0.355755
+vt 0.643357 0.712733
+vt 0.677083 0.355648
+vt 0.678178 0.712627
+vt 0.711904 0.355541
+vt 0.713000 0.712520
+vt 0.746483 0.712417
+vt 0.745388 0.355439
+vt 0.777341 0.712322
+vt 0.776246 0.355344
+vt 0.804389 0.712239
+vt 0.607683 0.355261
+vt 0.608778 0.712239
+vt 0.580635 0.355344
+vt 0.581730 0.712322
+vt 0.549777 0.355439
+vt 0.550872 0.712417
+vt 0.516293 0.355541
+vt 0.517389 0.712520
+vt 0.481472 0.355648
+vt 0.482567 0.712627
+vt 0.446650 0.355755
+vt 0.447746 0.712733
+vt 0.413167 0.355858
+vt 0.414262 0.712836
+vt 0.382309 0.355952
+vt 0.383404 0.712931
+vt 0.355261 0.356035
+vt 0.226469 0.355952
+vt 0.225374 0.712931
+vt 0.195611 0.355858
+vt 0.194516 0.712836
+vt 0.162127 0.355755
+vt 0.161032 0.712733
+vt 0.127306 0.355648
+vt 0.000000 0.160135
+vt 0.006826 0.125818
+vt 0.000000 0.195126
+vt 0.092484 0.355541
+vt 0.091389 0.712520
+vt 0.126211 0.712627
+vt 0.394917 0.290863
+vt 0.375477 0.261770
+vt 0.419658 0.315605
+vt 0.001095 0.355261
+vt 0.804389 0.355858
+vt 0.803294 0.355261
+vt 0.356356 0.713014
+vt 0.020216 0.093491
+vt 0.039656 0.064398
+vt 0.064397 0.039656
+vt 0.093491 0.020217
+vt 0.125817 0.006826
+vt 0.160135 0.000000
+vt 0.195125 0.000000
+vt 0.229443 0.006826
+vt 0.261770 0.020216
+vt 0.290863 0.039656
+vt 0.315605 0.064398
+vt 0.335045 0.093491
+vt 0.348435 0.125818
+vt 0.355261 0.160135
+vt 0.355261 0.195126
+vt 0.348435 0.229443
+vt 0.335045 0.261770
+vt 0.315605 0.290863
+vt 0.290863 0.315605
+vt 0.261770 0.335045
+vt 0.229443 0.348435
+vt 0.195126 0.355261
+vt 0.160135 0.355261
+vt 0.125818 0.348435
+vt 0.093491 0.335045
+vt 0.064398 0.315605
+vt 0.039656 0.290863
+vt 0.020216 0.261770
+vt 0.006826 0.229443
+vt 0.362087 0.229443
+vt 0.362087 0.125818
+vt 0.375477 0.093491
+vt 0.394917 0.064398
+vt 0.419659 0.039656
+vt 0.448752 0.020216
+vt 0.481079 0.006826
+vt 0.515396 0.000000
+vt 0.550387 0.000000
+vt 0.584704 0.006826
+vt 0.617031 0.020216
+vt 0.646124 0.039656
+vt 0.670866 0.064398
+vt 0.690306 0.093491
+vt 0.703696 0.125818
+vt 0.710522 0.160136
+vt 0.710522 0.195126
+vt 0.703696 0.229444
+vt 0.690306 0.261770
+vt 0.670866 0.290864
+vt 0.646124 0.315605
+vt 0.617031 0.335045
+vt 0.584704 0.348435
+vt 0.550386 0.355261
+vt 0.515396 0.355261
+vt 0.481078 0.348435
+vt 0.448752 0.335045
+vn 0.000000 -0.685690 -0.727866
+vn 0.000000 0.685690 -0.727866
+vn 0.142003 0.685690 -0.713889
+vn 0.142003 -0.685690 -0.713889
+vn 0.278542 0.685690 -0.672475
+vn 0.278542 -0.685690 -0.672475
+vn 0.404370 0.685690 -0.605213
+vn 0.404370 -0.685690 -0.605213
+vn 0.514664 0.685690 -0.514664
+vn 0.514664 -0.685690 -0.514664
+vn 0.605213 0.685690 -0.404370
+vn 0.605213 -0.685690 -0.404370
+vn 0.672475 0.685690 -0.278542
+vn 0.672475 -0.685690 -0.278542
+vn 0.713889 0.685690 -0.142003
+vn 0.713889 -0.685690 -0.142003
+vn 0.727866 0.685690 0.000000
+vn 0.727866 -0.685690 0.000000
+vn 0.713889 0.685690 0.142003
+vn 0.713889 -0.685690 0.142003
+vn 0.672475 0.685690 0.278542
+vn 0.672475 -0.685690 0.278542
+vn 0.605213 0.685690 0.404370
+vn 0.605213 -0.685690 0.404370
+vn 0.514664 0.685690 0.514664
+vn 0.514664 -0.685690 0.514664
+vn 0.404370 0.685690 0.605213
+vn 0.404370 -0.685690 0.605213
+vn 0.278542 0.685690 0.672475
+vn 0.278542 -0.685690 0.672475
+vn 0.142003 0.685690 0.713889
+vn 0.142003 -0.685690 0.713889
+vn 0.000000 0.685690 0.727866
+vn 0.000000 -0.685690 0.727866
+vn -0.142003 -0.685690 0.713889
+vn -0.142003 0.685690 0.713889
+vn -0.278542 -0.685690 0.672475
+vn -0.278542 0.685690 0.672475
+vn -0.404370 -0.685690 0.605213
+vn -0.404370 0.685690 0.605213
+vn -0.514695 -0.685690 0.514664
+vn -0.514664 0.685690 0.514664
+vn -0.605213 -0.685690 0.404370
+vn -0.605213 0.685690 0.404370
+vn -0.672475 -0.685690 0.278542
+vn -0.672475 0.685690 0.278542
+vn -0.713889 -0.685690 0.142003
+vn -0.713889 0.685690 0.142003
+vn -0.727866 -0.685690 0.000000
+vn -0.727866 0.685690 0.000000
+vn -0.713889 -0.685690 -0.142003
+vn -0.713889 0.685690 -0.142003
+vn -0.672475 -0.685690 -0.278542
+vn -0.672475 0.685690 -0.278542
+vn -0.605213 -0.685690 -0.404370
+vn -0.605213 0.685690 -0.404370
+vn -0.514664 -0.685690 -0.514695
+vn -0.514664 0.685690 -0.514695
+vn -0.404370 -0.685690 -0.605213
+vn -0.404370 0.685690 -0.605213
+vn -0.278542 -0.685690 -0.672475
+vn -0.142003 -0.685690 -0.713889
+vn -0.142003 0.685690 -0.713889
+vn -0.278542 0.685690 -0.672475
+s 1
+f 1/1/1 2/2/2 4/3/3
+f 3/4/4 4/3/3 6/5/5
+f 5/6/6 6/7/5 8/8/7
+f 7/9/8 8/8/7 10/10/9
+f 9/11/10 10/10/9 12/12/11
+f 11/13/12 12/12/11 14/14/13
+f 13/15/14 14/14/13 16/16/15
+f 15/17/16 16/16/15 18/18/17
+f 17/19/18 18/20/17 20/21/19
+f 19/22/20 20/21/19 22/23/21
+f 21/24/22 22/23/21 24/25/23
+f 23/26/24 24/25/23 26/27/25
+f 25/28/26 26/27/25 28/29/27
+f 27/30/28 28/31/27 30/32/29
+f 29/33/30 30/32/29 32/34/31
+f 31/35/32 32/34/31 34/36/33
+f 33/37/34 34/36/33 35/38/35
+f 35/38/35 36/39/36 37/40/37
+f 37/40/37 38/41/38 39/42/39
+f 39/43/39 40/44/40 41/45/41
+f 41/45/41 42/46/42 43/47/43
+f 43/47/43 44/48/44 45/49/45
+f 45/49/45 46/50/46 47/51/47
+f 47/51/47 48/52/48 49/53/49
+f 49/53/49 50/54/50 51/55/51
+f 51/55/51 52/56/52 53/57/53
+f 53/57/53 54/58/54 55/59/55
+f 55/60/55 56/61/56 57/62/57
+f 57/62/57 58/63/58 59/64/59
+f 59/64/59 60/65/60 61/66/61
+f 4/67/3 2/68/2 6/69/5
+f 63/70/62 64/71/63 1/1/1
+f 61/66/61 62/72/64 63/70/62
+f 63/73/62 1/74/1 61/75/61
+f 3/4/4 1/1/1 4/3/3
+f 5/76/6 3/4/4 6/5/5
+f 7/9/8 5/6/6 8/8/7
+f 9/11/10 7/9/8 10/10/9
+f 11/13/12 9/11/10 12/12/11
+f 13/15/14 11/13/12 14/14/13
+f 15/17/16 13/15/14 16/16/15
+f 17/77/18 15/17/16 18/18/17
+f 19/22/20 17/19/18 20/21/19
+f 21/24/22 19/22/20 22/23/21
+f 23/26/24 21/24/22 24/25/23
+f 25/28/26 23/26/24 26/27/25
+f 27/30/28 25/28/26 28/29/27
+f 29/33/30 27/30/28 30/32/29
+f 31/35/32 29/33/30 32/34/31
+f 33/37/34 31/35/32 34/36/33
+f 34/36/33 36/39/36 35/38/35
+f 36/39/36 38/41/38 37/40/37
+f 38/41/38 40/78/40 39/42/39
+f 40/44/40 42/46/42 41/45/41
+f 42/46/42 44/48/44 43/47/43
+f 44/48/44 46/50/46 45/49/45
+f 46/50/46 48/52/48 47/51/47
+f 48/52/48 50/54/50 49/53/49
+f 50/54/50 52/56/52 51/55/51
+f 52/56/52 54/58/54 53/57/53
+f 54/58/54 56/79/56 55/59/55
+f 56/61/56 58/63/58 57/62/57
+f 58/63/58 60/65/60 59/64/59
+f 60/65/60 62/72/64 61/66/61
+f 2/68/2 64/80/63 6/69/5
+f 64/80/63 62/81/64 6/69/5
+f 62/81/64 60/82/60 6/69/5
+f 60/82/60 58/83/58 6/69/5
+f 58/83/58 56/84/56 6/69/5
+f 56/84/56 54/85/54 6/69/5
+f 54/85/54 52/86/52 6/69/5
+f 52/86/52 50/87/50 6/69/5
+f 50/87/50 48/88/48 6/69/5
+f 48/88/48 46/89/46 6/69/5
+f 46/89/46 44/90/44 6/69/5
+f 44/90/44 42/91/42 6/69/5
+f 42/91/42 40/92/40 6/69/5
+f 40/92/40 38/93/38 6/69/5
+f 38/93/38 36/94/36 6/69/5
+f 36/94/36 34/95/33 6/69/5
+f 34/95/33 32/96/31 6/69/5
+f 32/96/31 30/97/29 6/69/5
+f 30/97/29 28/98/27 6/69/5
+f 28/98/27 26/99/25 6/69/5
+f 26/99/25 24/100/23 6/69/5
+f 24/100/23 22/101/21 6/69/5
+f 22/101/21 20/102/19 6/69/5
+f 20/102/19 18/103/17 6/69/5
+f 18/103/17 16/104/15 6/69/5
+f 16/104/15 14/105/13 6/69/5
+f 14/105/13 12/106/11 6/69/5
+f 12/106/11 10/107/9 8/108/7
+f 6/69/5 12/106/11 8/108/7
+f 64/71/63 2/2/2 1/1/1
+f 62/72/64 64/71/63 63/70/62
+f 1/74/1 3/109/4 61/75/61
+f 3/109/4 5/94/6 61/75/61
+f 5/94/6 7/93/8 61/75/61
+f 7/93/8 9/110/10 61/75/61
+f 9/110/10 11/111/12 61/75/61
+f 11/111/12 13/112/14 61/75/61
+f 13/112/14 15/113/16 61/75/61
+f 15/113/16 17/114/18 61/75/61
+f 17/114/18 19/115/20 61/75/61
+f 19/115/20 21/116/22 61/75/61
+f 21/116/22 23/117/24 61/75/61
+f 23/117/24 25/118/26 61/75/61
+f 25/118/26 27/119/28 61/75/61
+f 27/119/28 29/120/30 61/75/61
+f 29/120/30 31/121/32 61/75/61
+f 31/121/32 33/122/34 61/75/61
+f 33/122/34 35/123/35 61/75/61
+f 35/123/35 37/124/37 61/75/61
+f 37/124/37 39/125/39 61/75/61
+f 39/125/39 41/126/41 61/75/61
+f 41/126/41 43/127/43 61/75/61
+f 43/127/43 45/128/45 61/75/61
+f 45/128/45 47/129/47 61/75/61
+f 47/129/47 49/130/49 61/75/61
+f 49/130/49 51/131/51 61/75/61
+f 51/131/51 53/132/53 61/75/61
+f 53/132/53 55/133/55 61/75/61
+f 55/133/55 57/134/57 59/135/59
+f 61/75/61 55/133/55 59/135/59
diff --git a/src/datavisualization/engine/meshes/cylinderFlat.obj b/src/datavisualization/engine/meshes/cylinderFlat.obj
new file mode 100644
index 00000000..2b7e3e5e
--- /dev/null
+++ b/src/datavisualization/engine/meshes/cylinderFlat.obj
@@ -0,0 +1,299 @@
+# Blender v2.66 (sub 0) OBJ File: 'cylinder.blend'
+# www.blender.org
+o Cylinder
+v 0.000000 -1.000000 -1.000000
+v 0.000000 1.000000 -1.000000
+v 0.195090 -1.000000 -0.980785
+v 0.195090 1.000000 -0.980785
+v 0.382683 -1.000000 -0.923880
+v 0.382683 1.000000 -0.923880
+v 0.555570 -1.000000 -0.831470
+v 0.555570 1.000000 -0.831470
+v 0.707107 -1.000000 -0.707107
+v 0.707107 1.000000 -0.707107
+v 0.831470 -1.000000 -0.555570
+v 0.831470 1.000000 -0.555570
+v 0.923880 -1.000000 -0.382683
+v 0.923880 1.000000 -0.382683
+v 0.980785 -1.000000 -0.195090
+v 0.980785 1.000000 -0.195090
+v 1.000000 -1.000000 -0.000000
+v 1.000000 1.000000 -0.000000
+v 0.980785 -1.000000 0.195090
+v 0.980785 1.000000 0.195090
+v 0.923880 -1.000000 0.382683
+v 0.923880 1.000000 0.382683
+v 0.831470 -1.000000 0.555570
+v 0.831470 1.000000 0.555570
+v 0.707107 -1.000000 0.707107
+v 0.707107 1.000000 0.707107
+v 0.555570 -1.000000 0.831470
+v 0.555570 1.000000 0.831470
+v 0.382683 -1.000000 0.923880
+v 0.382683 1.000000 0.923880
+v 0.195090 -1.000000 0.980785
+v 0.195090 1.000000 0.980785
+v -0.000000 -1.000000 1.000000
+v -0.000000 1.000000 1.000000
+v -0.195091 -1.000000 0.980785
+v -0.195091 1.000000 0.980785
+v -0.382684 -1.000000 0.923879
+v -0.382684 1.000000 0.923879
+v -0.555571 -1.000000 0.831469
+v -0.555571 1.000000 0.831469
+v -0.707107 -1.000000 0.707106
+v -0.707107 1.000000 0.707106
+v -0.831470 -1.000000 0.555570
+v -0.831470 1.000000 0.555570
+v -0.923880 -1.000000 0.382683
+v -0.923880 1.000000 0.382683
+v -0.980785 -1.000000 0.195089
+v -0.980785 1.000000 0.195089
+v -1.000000 -1.000000 -0.000001
+v -1.000000 1.000000 -0.000001
+v -0.980785 -1.000000 -0.195091
+v -0.980785 1.000000 -0.195091
+v -0.923879 -1.000000 -0.382684
+v -0.923879 1.000000 -0.382684
+v -0.831469 -1.000000 -0.555571
+v -0.831469 1.000000 -0.555571
+v -0.707106 -1.000000 -0.707108
+v -0.707106 1.000000 -0.707108
+v -0.555569 -1.000000 -0.831470
+v -0.555569 1.000000 -0.831470
+v -0.382682 -1.000000 -0.923880
+v -0.382682 1.000000 -0.923880
+v -0.195089 -1.000000 -0.980786
+v -0.195089 1.000000 -0.980786
+vt 0.289718 0.879351
+vt 0.288367 0.438844
+vt 0.330714 0.438714
+vt 0.332066 0.879221
+vt 0.370605 0.438592
+vt 0.371956 0.879099
+vt 0.406505 0.438482
+vt 0.407857 0.878988
+vt 0.437036 0.438388
+vt 0.778904 0.000000
+vt 0.780256 0.440507
+vt 0.749725 0.440601
+vt 0.748373 0.000094
+vt 0.713824 0.440711
+vt 0.712473 0.000204
+vt 0.673934 0.440833
+vt 0.672582 0.000326
+vt 0.631586 0.440963
+vt 0.630235 0.000456
+vt 0.588409 0.441095
+vt 0.587057 0.000588
+vt 0.546061 0.441225
+vt 0.544710 0.000718
+vt 0.506171 0.441348
+vt 0.504819 0.000841
+vt 0.470270 0.441458
+vt 0.468919 0.000951
+vt 0.439739 0.441552
+vt 0.720545 0.882916
+vt 0.719194 0.442409
+vt 0.755094 0.442299
+vt 0.756446 0.882806
+vt 0.794985 0.442176
+vt 0.796336 0.882683
+vt 0.837333 0.442046
+vt 0.838684 0.882553
+vt 0.881861 0.882421
+vt 0.880510 0.441914
+vt 0.924209 0.882291
+vt 0.922857 0.441784
+vt 0.964099 0.882168
+vt 0.962748 0.441662
+vt 1.000000 0.882058
+vt 0.717842 0.441552
+vt 0.719194 0.882058
+vt 0.681942 0.441662
+vt 0.683293 0.882169
+vt 0.642051 0.441784
+vt 0.643403 0.882291
+vt 0.599704 0.441914
+vt 0.601055 0.882421
+vt 0.556526 0.442046
+vt 0.557878 0.882553
+vt 0.514179 0.442176
+vt 0.515530 0.882683
+vt 0.474288 0.442299
+vt 0.475640 0.882806
+vt 0.438388 0.442409
+vt 0.097872 0.879939
+vt 0.096520 0.439433
+vt 0.128403 0.879846
+vt 0.127051 0.439339
+vt 0.164303 0.879735
+vt 0.162952 0.439229
+vt 0.204194 0.879613
+vt 0.000000 0.197605
+vt 0.008423 0.155257
+vt 0.000000 0.240783
+vt 0.246541 0.879483
+vt 0.245190 0.438976
+vt 0.202842 0.439106
+vt 0.438388 0.878895
+vt 0.438388 0.001045
+vt 0.998649 0.441552
+vt 0.439739 0.882916
+vt 0.024947 0.115367
+vt 0.048935 0.079466
+vt 0.079466 0.048935
+vt 0.115366 0.024947
+vt 0.155257 0.008424
+vt 0.197605 0.000000
+vt 0.240782 0.000000
+vt 0.283130 0.008423
+vt 0.323021 0.024947
+vt 0.358922 0.048935
+vt 0.389453 0.079466
+vt 0.413441 0.115367
+vt 0.429964 0.155257
+vt 0.438388 0.197605
+vt 0.438388 0.240783
+vt 0.429964 0.283130
+vt 0.413441 0.323021
+vt 0.389453 0.358922
+vt 0.358922 0.389453
+vt 0.323021 0.413441
+vt 0.283130 0.429964
+vt 0.240783 0.438388
+vt 0.197605 0.438388
+vt 0.155257 0.429964
+vt 0.115367 0.413441
+vt 0.079466 0.389453
+vt 0.048935 0.358922
+vt 0.024947 0.323021
+vt 0.008423 0.283130
+vn 0.098017 0.000000 -0.995185
+vn 0.290285 0.000000 -0.956940
+vn 0.471397 0.000000 -0.881921
+vn 0.634393 0.000000 -0.773010
+vn 0.773010 0.000000 -0.634393
+vn 0.881921 0.000000 -0.471397
+vn 0.956940 0.000000 -0.290285
+vn 0.995185 0.000000 -0.098017
+vn 0.995185 0.000000 0.098017
+vn 0.956940 0.000000 0.290285
+vn 0.881921 0.000000 0.471396
+vn 0.773010 0.000000 0.634393
+vn 0.634393 0.000000 0.773010
+vn 0.471397 0.000000 0.881921
+vn 0.290284 0.000000 0.956940
+vn 0.098017 0.000000 0.995185
+vn -0.098018 0.000000 0.995185
+vn -0.290285 0.000000 0.956940
+vn -0.471397 0.000000 0.881921
+vn -0.634394 0.000000 0.773010
+vn -0.773011 0.000000 0.634393
+vn -0.881922 0.000000 0.471396
+vn -0.956941 0.000000 0.290284
+vn -0.995185 0.000000 0.098016
+vn -0.995185 -0.000000 -0.098018
+vn -0.956940 -0.000000 -0.290286
+vn -0.881921 -0.000000 -0.471398
+vn -0.773010 -0.000000 -0.634394
+vn -0.634392 -0.000000 -0.773011
+vn -0.471395 -0.000000 -0.881922
+vn -0.000000 1.000000 0.000000
+vn -0.098017 -0.000000 -0.995185
+vn -0.290283 -0.000000 -0.956941
+s off
+f 1/1/1 2/2/1 4/3/1
+f 3/4/2 4/3/2 6/5/2
+f 5/6/3 6/5/3 8/7/3
+f 7/8/4 8/7/4 10/9/4
+f 9/10/5 10/11/5 12/12/5
+f 11/13/6 12/12/6 14/14/6
+f 13/15/7 14/14/7 16/16/7
+f 15/17/8 16/16/8 18/18/8
+f 17/19/9 18/18/9 20/20/9
+f 19/21/10 20/20/10 22/22/10
+f 21/23/11 22/22/11 24/24/11
+f 23/25/12 24/24/12 26/26/12
+f 25/27/13 26/26/13 28/28/13
+f 27/29/14 28/30/14 30/31/14
+f 29/32/15 30/31/15 32/33/15
+f 31/34/16 32/33/16 34/35/16
+f 33/36/17 34/35/17 35/37/17
+f 35/37/18 36/38/18 37/39/18
+f 37/39/19 38/40/19 39/41/19
+f 39/41/20 40/42/20 41/43/20
+f 41/44/21 42/45/21 43/46/21
+f 43/46/22 44/47/22 45/48/22
+f 45/48/23 46/49/23 47/50/23
+f 47/50/24 48/51/24 49/52/24
+f 49/52/25 50/53/25 51/54/25
+f 51/54/26 52/55/26 53/56/26
+f 53/56/27 54/57/27 55/58/27
+f 55/59/28 56/60/28 57/61/28
+f 57/61/29 58/62/29 59/63/29
+f 59/63/30 60/64/30 61/65/30
+f 4/66/31 2/67/31 6/68/31
+f 63/69/32 64/70/32 1/1/32
+f 61/65/33 62/71/33 63/69/33
+f 3/4/1 1/1/1 4/3/1
+f 5/6/2 3/4/2 6/5/2
+f 7/8/3 5/6/3 8/7/3
+f 9/72/4 7/8/4 10/9/4
+f 11/13/5 9/10/5 12/12/5
+f 13/15/6 11/13/6 14/14/6
+f 15/17/7 13/15/7 16/16/7
+f 17/19/8 15/17/8 18/18/8
+f 19/21/9 17/19/9 20/20/9
+f 21/23/10 19/21/10 22/22/10
+f 23/25/11 21/23/11 24/24/11
+f 25/27/12 23/25/12 26/26/12
+f 27/73/13 25/27/13 28/28/13
+f 29/32/14 27/29/14 30/31/14
+f 31/34/15 29/32/15 32/33/15
+f 33/36/16 31/34/16 34/35/16
+f 34/35/17 36/38/17 35/37/17
+f 36/38/18 38/40/18 37/39/18
+f 38/40/19 40/42/19 39/41/19
+f 40/42/20 42/74/20 41/43/20
+f 42/45/21 44/47/21 43/46/21
+f 44/47/22 46/49/22 45/48/22
+f 46/49/23 48/51/23 47/50/23
+f 48/51/24 50/53/24 49/52/24
+f 50/53/25 52/55/25 51/54/25
+f 52/55/26 54/57/26 53/56/26
+f 54/57/27 56/75/27 55/58/27
+f 56/60/28 58/62/28 57/61/28
+f 58/62/29 60/64/29 59/63/29
+f 60/64/30 62/71/30 61/65/30
+f 2/67/31 64/76/31 6/68/31
+f 64/76/31 62/77/31 6/68/31
+f 62/77/31 60/78/31 6/68/31
+f 60/78/31 58/79/31 6/68/31
+f 58/79/31 56/80/31 6/68/31
+f 56/80/31 54/81/31 6/68/31
+f 54/81/31 52/82/31 6/68/31
+f 52/82/31 50/83/31 6/68/31
+f 50/83/31 48/84/31 6/68/31
+f 48/84/31 46/85/31 6/68/31
+f 46/85/31 44/86/31 6/68/31
+f 44/86/31 42/87/31 6/68/31
+f 42/87/31 40/88/31 6/68/31
+f 40/88/31 38/89/31 6/68/31
+f 38/89/31 36/90/31 6/68/31
+f 36/90/31 34/91/31 6/68/31
+f 34/91/31 32/92/31 6/68/31
+f 32/92/31 30/93/31 6/68/31
+f 30/93/31 28/94/31 6/68/31
+f 28/94/31 26/95/31 6/68/31
+f 26/95/31 24/96/31 6/68/31
+f 24/96/31 22/97/31 6/68/31
+f 22/97/31 20/98/31 6/68/31
+f 20/98/31 18/99/31 6/68/31
+f 18/99/31 16/100/31 6/68/31
+f 16/100/31 14/101/31 6/68/31
+f 14/101/31 12/102/31 6/68/31
+f 12/102/31 10/103/31 8/104/31
+f 6/68/31 12/102/31 8/104/31
+f 64/70/32 2/2/32 1/1/32
+f 62/71/33 64/70/33 63/69/33
diff --git a/src/datavisualization/engine/meshes/cylinderSmooth.obj b/src/datavisualization/engine/meshes/cylinderSmooth.obj
new file mode 100644
index 00000000..6ccbb286
--- /dev/null
+++ b/src/datavisualization/engine/meshes/cylinderSmooth.obj
@@ -0,0 +1,330 @@
+# Blender v2.66 (sub 0) OBJ File: 'cylinder.blend'
+# www.blender.org
+o Cylinder
+v 0.000000 -1.000000 -1.000000
+v 0.000000 1.000000 -1.000000
+v 0.195090 -1.000000 -0.980785
+v 0.195090 1.000000 -0.980785
+v 0.382683 -1.000000 -0.923880
+v 0.382683 1.000000 -0.923880
+v 0.555570 -1.000000 -0.831470
+v 0.555570 1.000000 -0.831470
+v 0.707107 -1.000000 -0.707107
+v 0.707107 1.000000 -0.707107
+v 0.831470 -1.000000 -0.555570
+v 0.831470 1.000000 -0.555570
+v 0.923880 -1.000000 -0.382683
+v 0.923880 1.000000 -0.382683
+v 0.980785 -1.000000 -0.195090
+v 0.980785 1.000000 -0.195090
+v 1.000000 -1.000000 -0.000000
+v 1.000000 1.000000 -0.000000
+v 0.980785 -1.000000 0.195090
+v 0.980785 1.000000 0.195090
+v 0.923880 -1.000000 0.382683
+v 0.923880 1.000000 0.382683
+v 0.831470 -1.000000 0.555570
+v 0.831470 1.000000 0.555570
+v 0.707107 -1.000000 0.707107
+v 0.707107 1.000000 0.707107
+v 0.555570 -1.000000 0.831470
+v 0.555570 1.000000 0.831470
+v 0.382683 -1.000000 0.923880
+v 0.382683 1.000000 0.923880
+v 0.195090 -1.000000 0.980785
+v 0.195090 1.000000 0.980785
+v -0.000000 -1.000000 1.000000
+v -0.000000 1.000000 1.000000
+v -0.195091 -1.000000 0.980785
+v -0.195091 1.000000 0.980785
+v -0.382684 -1.000000 0.923879
+v -0.382684 1.000000 0.923879
+v -0.555571 -1.000000 0.831469
+v -0.555571 1.000000 0.831469
+v -0.707107 -1.000000 0.707106
+v -0.707107 1.000000 0.707106
+v -0.831470 -1.000000 0.555570
+v -0.831470 1.000000 0.555570
+v -0.923880 -1.000000 0.382683
+v -0.923880 1.000000 0.382683
+v -0.980785 -1.000000 0.195089
+v -0.980785 1.000000 0.195089
+v -1.000000 -1.000000 -0.000001
+v -1.000000 1.000000 -0.000001
+v -0.980785 -1.000000 -0.195091
+v -0.980785 1.000000 -0.195091
+v -0.923879 -1.000000 -0.382684
+v -0.923879 1.000000 -0.382684
+v -0.831469 -1.000000 -0.555571
+v -0.831469 1.000000 -0.555571
+v -0.707106 -1.000000 -0.707108
+v -0.707106 1.000000 -0.707108
+v -0.555569 -1.000000 -0.831470
+v -0.555569 1.000000 -0.831470
+v -0.382682 -1.000000 -0.923880
+v -0.382682 1.000000 -0.923880
+v -0.195089 -1.000000 -0.980786
+v -0.195089 1.000000 -0.980786
+vt 0.289718 0.879351
+vt 0.288367 0.438844
+vt 0.330714 0.438714
+vt 0.332066 0.879221
+vt 0.370605 0.438592
+vt 0.371956 0.879099
+vt 0.406505 0.438482
+vt 0.407857 0.878988
+vt 0.437036 0.438388
+vt 0.778904 0.000000
+vt 0.780256 0.440507
+vt 0.749725 0.440601
+vt 0.748373 0.000094
+vt 0.713824 0.440711
+vt 0.712473 0.000204
+vt 0.673934 0.440833
+vt 0.672582 0.000326
+vt 0.631586 0.440963
+vt 0.630235 0.000456
+vt 0.588409 0.441095
+vt 0.587057 0.000588
+vt 0.546061 0.441225
+vt 0.544710 0.000718
+vt 0.506171 0.441348
+vt 0.504819 0.000841
+vt 0.470270 0.441458
+vt 0.468919 0.000951
+vt 0.439739 0.441552
+vt 0.720545 0.882916
+vt 0.719194 0.442409
+vt 0.755094 0.442299
+vt 0.756446 0.882806
+vt 0.794985 0.442176
+vt 0.796336 0.882683
+vt 0.837333 0.442046
+vt 0.838684 0.882553
+vt 0.881861 0.882421
+vt 0.880510 0.441914
+vt 0.924209 0.882291
+vt 0.922857 0.441784
+vt 0.964099 0.882168
+vt 0.962748 0.441662
+vt 1.000000 0.882058
+vt 0.717842 0.441552
+vt 0.719194 0.882058
+vt 0.681942 0.441662
+vt 0.683293 0.882169
+vt 0.642051 0.441784
+vt 0.643403 0.882291
+vt 0.599704 0.441914
+vt 0.601055 0.882421
+vt 0.556526 0.442046
+vt 0.557878 0.882553
+vt 0.514179 0.442176
+vt 0.515530 0.882683
+vt 0.474288 0.442299
+vt 0.475640 0.882806
+vt 0.438388 0.442409
+vt 0.097872 0.879939
+vt 0.096520 0.439433
+vt 0.128403 0.879846
+vt 0.127051 0.439339
+vt 0.164303 0.879735
+vt 0.162952 0.439229
+vt 0.204194 0.879613
+vt 0.000000 0.197605
+vt 0.008423 0.155257
+vt 0.000000 0.240783
+vt 0.246541 0.879483
+vt 0.245190 0.438976
+vt 0.202842 0.439106
+vt 0.438388 0.878895
+vt 0.438388 0.001045
+vt 0.998649 0.441552
+vt 0.439739 0.882916
+vt 0.024947 0.115367
+vt 0.048935 0.079466
+vt 0.079466 0.048935
+vt 0.115366 0.024947
+vt 0.155257 0.008424
+vt 0.197605 0.000000
+vt 0.240782 0.000000
+vt 0.283130 0.008423
+vt 0.323021 0.024947
+vt 0.358922 0.048935
+vt 0.389453 0.079466
+vt 0.413441 0.115367
+vt 0.429964 0.155257
+vt 0.438388 0.197605
+vt 0.438388 0.240783
+vt 0.429964 0.283130
+vt 0.413441 0.323021
+vt 0.389453 0.358922
+vt 0.358922 0.389453
+vt 0.323021 0.413441
+vt 0.283130 0.429964
+vt 0.240783 0.438388
+vt 0.197605 0.438388
+vt 0.155257 0.429964
+vt 0.115367 0.413441
+vt 0.079466 0.389453
+vt 0.048935 0.358922
+vt 0.024947 0.323021
+vt 0.008423 0.283130
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 0.685690 -0.727866
+vn 0.142003 0.685690 -0.713889
+vn 0.195074 0.000000 -0.980773
+vn 0.278542 0.685690 -0.672475
+vn 0.382672 0.000000 -0.923856
+vn 0.404370 0.685690 -0.605213
+vn 0.555559 0.000000 -0.831446
+vn 0.514664 0.685690 -0.514664
+vn 0.707083 0.000000 -0.707083
+vn 0.605213 0.685690 -0.404370
+vn 0.831446 0.000000 -0.555559
+vn 0.672475 0.685690 -0.278542
+vn 0.923856 0.000000 -0.382672
+vn 0.713889 0.685690 -0.142003
+vn 0.980773 0.000000 -0.195074
+vn 0.727866 0.685690 0.000000
+vn 1.000000 0.000000 0.000000
+vn 0.713889 0.685690 0.142003
+vn 0.980773 0.000000 0.195074
+vn 0.672475 0.685690 0.278542
+vn 0.923856 0.000000 0.382672
+vn 0.605213 0.685690 0.404370
+vn 0.831446 0.000000 0.555559
+vn 0.514664 0.685690 0.514664
+vn 0.707083 0.000000 0.707083
+vn 0.404370 0.685690 0.605213
+vn 0.555559 0.000000 0.831446
+vn 0.278542 0.685690 0.672475
+vn 0.382672 0.000000 0.923856
+vn 0.142003 0.685690 0.713889
+vn 0.195074 0.000000 0.980773
+vn 0.000000 0.685690 0.727866
+vn 0.000000 0.000000 0.999969
+vn -0.195074 0.000000 0.980773
+vn -0.142003 0.685690 0.713889
+vn -0.382672 0.000000 0.923856
+vn -0.278542 0.685690 0.672475
+vn -0.555559 0.000000 0.831446
+vn -0.404370 0.685690 0.605213
+vn -0.707083 0.000000 0.707083
+vn -0.514664 0.685690 0.514664
+vn -0.831446 0.000000 0.555559
+vn -0.605213 0.685690 0.404370
+vn -0.923856 0.000000 0.382672
+vn -0.672475 0.685690 0.278542
+vn -0.980773 0.000000 0.195074
+vn -0.713889 0.685690 0.142003
+vn -1.000000 0.000000 0.000000
+vn -0.727866 0.685690 0.000000
+vn -0.980773 0.000000 -0.195074
+vn -0.713889 0.685690 -0.142003
+vn -0.923856 0.000000 -0.382672
+vn -0.672475 0.685690 -0.278542
+vn -0.831446 0.000000 -0.555559
+vn -0.605213 0.685690 -0.404370
+vn -0.707083 0.000000 -0.707083
+vn -0.514664 0.685690 -0.514695
+vn -0.555559 0.000000 -0.831446
+vn -0.404370 0.685690 -0.605213
+vn -0.382672 0.000000 -0.923856
+vn -0.195074 0.000000 -0.980773
+vn -0.142003 0.685690 -0.713889
+vn -0.278542 0.685690 -0.672475
+s 1
+f 1/1/1 2/2/2 4/3/3
+f 3/4/4 4/3/3 6/5/5
+f 5/6/6 6/5/5 8/7/7
+f 7/8/8 8/7/7 10/9/9
+f 9/10/10 10/11/9 12/12/11
+f 11/13/12 12/12/11 14/14/13
+f 13/15/14 14/14/13 16/16/15
+f 15/17/16 16/16/15 18/18/17
+f 17/19/18 18/18/17 20/20/19
+f 19/21/20 20/20/19 22/22/21
+f 21/23/22 22/22/21 24/24/23
+f 23/25/24 24/24/23 26/26/25
+f 25/27/26 26/26/25 28/28/27
+f 27/29/28 28/30/27 30/31/29
+f 29/32/30 30/31/29 32/33/31
+f 31/34/32 32/33/31 34/35/33
+f 33/36/34 34/35/33 35/37/35
+f 35/37/35 36/38/36 37/39/37
+f 37/39/37 38/40/38 39/41/39
+f 39/41/39 40/42/40 41/43/41
+f 41/44/41 42/45/42 43/46/43
+f 43/46/43 44/47/44 45/48/45
+f 45/48/45 46/49/46 47/50/47
+f 47/50/47 48/51/48 49/52/49
+f 49/52/49 50/53/50 51/54/51
+f 51/54/51 52/55/52 53/56/53
+f 53/56/53 54/57/54 55/58/55
+f 55/59/55 56/60/56 57/61/57
+f 57/61/57 58/62/58 59/63/59
+f 59/63/59 60/64/60 61/65/61
+f 4/66/3 2/67/2 6/68/5
+f 63/69/62 64/70/63 1/1/1
+f 61/65/61 62/71/64 63/69/62
+f 3/4/4 1/1/1 4/3/3
+f 5/6/6 3/4/4 6/5/5
+f 7/8/8 5/6/6 8/7/7
+f 9/72/10 7/8/8 10/9/9
+f 11/13/12 9/10/10 12/12/11
+f 13/15/14 11/13/12 14/14/13
+f 15/17/16 13/15/14 16/16/15
+f 17/19/18 15/17/16 18/18/17
+f 19/21/20 17/19/18 20/20/19
+f 21/23/22 19/21/20 22/22/21
+f 23/25/24 21/23/22 24/24/23
+f 25/27/26 23/25/24 26/26/25
+f 27/73/28 25/27/26 28/28/27
+f 29/32/30 27/29/28 30/31/29
+f 31/34/32 29/32/30 32/33/31
+f 33/36/34 31/34/32 34/35/33
+f 34/35/33 36/38/36 35/37/35
+f 36/38/36 38/40/38 37/39/37
+f 38/40/38 40/42/40 39/41/39
+f 40/42/40 42/74/42 41/43/41
+f 42/45/42 44/47/44 43/46/43
+f 44/47/44 46/49/46 45/48/45
+f 46/49/46 48/51/48 47/50/47
+f 48/51/48 50/53/50 49/52/49
+f 50/53/50 52/55/52 51/54/51
+f 52/55/52 54/57/54 53/56/53
+f 54/57/54 56/75/56 55/58/55
+f 56/60/56 58/62/58 57/61/57
+f 58/62/58 60/64/60 59/63/59
+f 60/64/60 62/71/64 61/65/61
+f 2/67/2 64/76/63 6/68/5
+f 64/76/63 62/77/64 6/68/5
+f 62/77/64 60/78/60 6/68/5
+f 60/78/60 58/79/58 6/68/5
+f 58/79/58 56/80/56 6/68/5
+f 56/80/56 54/81/54 6/68/5
+f 54/81/54 52/82/52 6/68/5
+f 52/82/52 50/83/50 6/68/5
+f 50/83/50 48/84/48 6/68/5
+f 48/84/48 46/85/46 6/68/5
+f 46/85/46 44/86/44 6/68/5
+f 44/86/44 42/87/42 6/68/5
+f 42/87/42 40/88/40 6/68/5
+f 40/88/40 38/89/38 6/68/5
+f 38/89/38 36/90/36 6/68/5
+f 36/90/36 34/91/33 6/68/5
+f 34/91/33 32/92/31 6/68/5
+f 32/92/31 30/93/29 6/68/5
+f 30/93/29 28/94/27 6/68/5
+f 28/94/27 26/95/25 6/68/5
+f 26/95/25 24/96/23 6/68/5
+f 24/96/23 22/97/21 6/68/5
+f 22/97/21 20/98/19 6/68/5
+f 20/98/19 18/99/17 6/68/5
+f 18/99/17 16/100/15 6/68/5
+f 16/100/15 14/101/13 6/68/5
+f 14/101/13 12/102/11 6/68/5
+f 12/102/11 10/103/9 8/104/7
+f 6/68/5 12/102/11 8/104/7
+f 64/70/63 2/2/2 1/1/1
+f 62/71/64 64/70/63 63/69/62
diff --git a/src/datavisualization/engine/meshes/plane.obj b/src/datavisualization/engine/meshes/plane.obj
new file mode 100644
index 00000000..96ac0dd7
--- /dev/null
+++ b/src/datavisualization/engine/meshes/plane.obj
@@ -0,0 +1,15 @@
+# Blender v2.66 (sub 0) OBJ File: 'plane.blend'
+# www.blender.org
+o Plane
+v -1.000000 -1.000000 -0.000001
+v -1.000000 1.000000 -0.000000
+v 1.000000 -1.000000 0.000000
+v 1.000000 1.000000 0.000001
+vt 0.003058 1.000000
+vt 0.000000 0.003058
+vt 1.000000 0.996942
+vt 0.996942 0.000000
+vn -0.000001 -0.000001 1.000000
+s off
+f 2/1/1 1/2/1 4/3/1
+f 1/2/1 3/4/1 4/3/1
diff --git a/src/datavisualization/engine/meshes/pyramidFilledFlat.obj b/src/datavisualization/engine/meshes/pyramidFilledFlat.obj
new file mode 100644
index 00000000..0cf73bbe
--- /dev/null
+++ b/src/datavisualization/engine/meshes/pyramidFilledFlat.obj
@@ -0,0 +1,36 @@
+# Blender v2.66 (sub 0) OBJ File: 'pyramid_filled.blend'
+# www.blender.org
+o Cone_Cone.001
+v 1.000000 -1.000000 -0.999999
+v 0.999999 -1.000000 1.000000
+v -1.000000 -1.000000 0.999999
+v 0.000000 1.000000 0.000000
+v -0.999999 -1.000000 -1.000000
+vt 0.323067 0.577790
+vt 0.000097 0.866793
+vt 0.000000 0.433396
+vt 0.646133 0.144393
+vt 0.323164 0.433396
+vt 0.323067 0.000000
+vt 0.646133 0.577790
+vt 0.323163 0.866793
+vt 0.323067 0.433396
+vt 0.323067 0.144393
+vt 0.000097 0.433396
+vt 0.000000 0.000000
+vt 0.646133 0.787263
+vt 0.646133 0.433396
+vt 1.000000 0.433396
+vt 1.000000 0.787263
+vn -0.894427 0.447214 -0.000000
+vn 0.894427 0.447213 0.000000
+vn 0.000000 0.447214 -0.894427
+vn -0.000000 0.447214 0.894427
+vn 0.000000 -1.000000 -0.000000
+s off
+f 3/1/1 4/2/1 5/3/1
+f 1/4/2 4/5/2 2/6/2
+f 5/7/3 4/8/3 1/9/3
+f 2/10/4 4/11/4 3/12/4
+f 5/13/5 1/14/5 2/15/5
+f 3/16/5 5/13/5 2/15/5
diff --git a/src/datavisualization/engine/meshes/pyramidFilledSmooth.obj b/src/datavisualization/engine/meshes/pyramidFilledSmooth.obj
new file mode 100644
index 00000000..306bda58
--- /dev/null
+++ b/src/datavisualization/engine/meshes/pyramidFilledSmooth.obj
@@ -0,0 +1,36 @@
+# Blender v2.66 (sub 0) OBJ File: 'pyramid_filled.blend'
+# www.blender.org
+o Cone_Cone.001
+v 1.000000 -1.000000 -0.999999
+v 0.999999 -1.000000 1.000000
+v -1.000000 -1.000000 0.999999
+v 0.000000 1.000000 0.000000
+v -0.999999 -1.000000 -1.000000
+vt 0.323067 0.577790
+vt 0.000097 0.866793
+vt 0.000000 0.433396
+vt 0.646133 0.144393
+vt 0.323164 0.433396
+vt 0.323067 0.000000
+vt 0.646133 0.577790
+vt 0.323163 0.866793
+vt 0.323067 0.433396
+vt 0.323067 0.144393
+vt 0.000097 0.433396
+vt 0.000000 0.000000
+vt 0.646133 0.787263
+vt 0.646133 0.433396
+vt 1.000000 0.433396
+vt 1.000000 0.787263
+vn -0.662618 -0.349040 0.662618
+vn 0.000000 1.000000 0.000000
+vn -0.662618 -0.349040 -0.662618
+vn 0.662618 -0.349040 -0.662618
+vn 0.662618 -0.349040 0.662618
+s 1
+f 3/1/1 4/2/2 5/3/3
+f 1/4/4 4/5/2 2/6/5
+f 5/7/3 4/8/2 1/9/4
+f 2/10/5 4/11/2 3/12/1
+f 5/13/3 1/14/4 2/15/5
+f 3/16/1 5/13/3 2/15/5
diff --git a/src/datavisualization/engine/meshes/pyramidFlat.obj b/src/datavisualization/engine/meshes/pyramidFlat.obj
new file mode 100644
index 00000000..35edb477
--- /dev/null
+++ b/src/datavisualization/engine/meshes/pyramidFlat.obj
@@ -0,0 +1,22 @@
+# Blender v2.66 (sub 0) OBJ File: 'pyramid.blend'
+# www.blender.org
+o Cone_Cone.001
+v 1.000000 -1.000000 -0.999999
+v 0.999999 -1.000000 1.000000
+v -1.000000 -1.000000 0.999999
+v 0.000000 1.000000 0.000000
+v -0.999999 -1.000000 -1.000000
+vt 0.999900 0.000100
+vt 0.500000 0.500000
+vt 0.000100 0.000100
+vt 0.000100 0.999900
+vt 0.999900 0.999900
+vn -0.894427 0.447214 -0.000000
+vn 0.894427 0.447213 0.000000
+vn 0.000000 0.447214 -0.894427
+vn -0.000000 0.447214 0.894427
+s off
+f 3/1/1 4/2/1 5/3/1
+f 1/4/2 4/2/2 2/5/2
+f 5/3/3 4/2/3 1/4/3
+f 2/5/4 4/2/4 3/1/4
diff --git a/src/datavisualization/engine/meshes/pyramidSmooth.obj b/src/datavisualization/engine/meshes/pyramidSmooth.obj
new file mode 100644
index 00000000..b11c8750
--- /dev/null
+++ b/src/datavisualization/engine/meshes/pyramidSmooth.obj
@@ -0,0 +1,23 @@
+# Blender v2.66 (sub 0) OBJ File: 'pyramid.blend'
+# www.blender.org
+o Cone_Cone.001
+v 1.000000 -1.000000 -0.999999
+v 0.999999 -1.000000 1.000000
+v -1.000000 -1.000000 0.999999
+v 0.000000 1.000000 0.000000
+v -0.999999 -1.000000 -1.000000
+vt 0.999900 0.000100
+vt 0.500000 0.500000
+vt 0.000100 0.000100
+vt 0.000100 0.999900
+vt 0.999900 0.999900
+vn -0.577349 0.577349 0.577349
+vn 0.000000 1.000000 0.000000
+vn -0.577349 0.577349 -0.577349
+vn 0.577349 0.577349 -0.577349
+vn 0.577349 0.577349 0.577349
+s 1
+f 3/1/1 4/2/2 5/3/3
+f 1/4/4 4/2/2 2/5/5
+f 5/3/3 4/2/2 1/4/4
+f 2/5/5 4/2/2 3/1/1
diff --git a/src/datavisualization/engine/meshes/scatterdot.obj b/src/datavisualization/engine/meshes/scatterdot.obj
new file mode 100644
index 00000000..d994a80f
--- /dev/null
+++ b/src/datavisualization/engine/meshes/scatterdot.obj
@@ -0,0 +1,28 @@
+# Blender v2.66 (sub 0) OBJ File: 'scatterdot.blend'
+# www.blender.org
+o Cone
+v 0.000000 -0.500000 -1.000000
+v 0.866025 -0.500000 0.500000
+v 0.000000 0.500000 0.000000
+v -0.866025 -0.500000 0.500000
+vt 0.999727 0.000000
+vt 1.000000 0.492691
+vt 0.522886 0.369782
+vt 0.477114 0.973202
+vt 0.000000 1.096111
+vt 0.000273 0.603420
+vt 0.523159 0.985382
+vt 0.522886 0.492691
+vt 1.000000 0.615600
+vt 0.000000 0.603420
+vt 0.000617 0.000000
+vt 0.522886 0.302245
+vn -0.833033 -0.273293 0.480941
+vn 0.000000 0.999969 0.000000
+vn 0.000000 -0.273293 -0.961913
+vn 0.833033 -0.273293 0.480941
+s 1
+f 4/1/1 3/2/2 1/3/3
+f 1/4/3 3/5/2 2/6/4
+f 2/7/4 3/8/2 4/9/1
+f 1/10/3 2/11/4 4/12/1
diff --git a/src/datavisualization/engine/meshes/scatterdotFlat.obj b/src/datavisualization/engine/meshes/scatterdotFlat.obj
new file mode 100644
index 00000000..4052738d
--- /dev/null
+++ b/src/datavisualization/engine/meshes/scatterdotFlat.obj
@@ -0,0 +1,28 @@
+# Blender v2.66 (sub 0) OBJ File: 'scatterdot.blend'
+# www.blender.org
+o Cone
+v 0.000000 -0.500000 -1.000000
+v 0.866025 -0.500000 0.500000
+v 0.000000 0.500000 0.000000
+v -0.866025 -0.500000 0.500000
+vt 0.999727 0.000000
+vt 1.000000 0.492691
+vt 0.522886 0.369782
+vt 0.477114 0.973202
+vt 0.000000 1.096111
+vt 0.000273 0.603420
+vt 0.523159 0.985382
+vt 0.522886 0.492691
+vt 1.000000 0.615600
+vt 0.000000 0.603420
+vt 0.000617 0.000000
+vt 0.522886 0.302245
+vn -0.774597 0.447214 -0.447214
+vn 0.774597 0.447214 -0.447214
+vn -0.000000 0.447214 0.894427
+vn 0.000000 -1.000000 -0.000000
+s off
+f 4/1/1 3/2/1 1/3/1
+f 1/4/2 3/5/2 2/6/2
+f 2/7/3 3/8/3 4/9/3
+f 1/10/4 2/11/4 4/12/4
diff --git a/src/datavisualization/engine/meshes/sphere.obj b/src/datavisualization/engine/meshes/sphere.obj
new file mode 100644
index 00000000..671a7bcc
--- /dev/null
+++ b/src/datavisualization/engine/meshes/sphere.obj
@@ -0,0 +1,1301 @@
+# Blender v2.66 (sub 0) OBJ File: 'sphere.blend'
+# www.blender.org
+o Sphere
+v -0.195090 0.980785 0.000000
+v -0.382683 0.923880 0.000000
+v -0.555570 0.831470 0.000000
+v -0.707107 0.707107 0.000000
+v -0.831470 0.555570 0.000000
+v -0.923880 0.382683 0.000000
+v -0.980785 0.195090 0.000000
+v -1.000000 0.000000 0.000000
+v -0.980785 -0.195090 0.000000
+v -0.923880 -0.382683 0.000000
+v -0.831470 -0.555570 0.000000
+v -0.707107 -0.707107 0.000000
+v -0.555570 -0.831470 0.000000
+v -0.382683 -0.923880 0.000000
+v -0.195090 -0.980785 0.000000
+v -0.180240 0.980785 -0.074658
+v -0.353553 0.923880 -0.146447
+v -0.513280 0.831470 -0.212608
+v -0.653281 0.707107 -0.270598
+v -0.768178 0.555570 -0.318190
+v -0.853553 0.382683 -0.353553
+v -0.906127 0.195090 -0.375330
+v -0.923880 0.000000 -0.382684
+v -0.906127 -0.195090 -0.375330
+v -0.853553 -0.382683 -0.353554
+v -0.768178 -0.555570 -0.318190
+v -0.653281 -0.707107 -0.270598
+v -0.513280 -0.831470 -0.212608
+v -0.353553 -0.923880 -0.146447
+v -0.180240 -0.980785 -0.074658
+v 0.000000 -1.000000 0.000000
+v -0.137950 0.980785 -0.137950
+v -0.270598 0.923880 -0.270598
+v -0.392847 0.831470 -0.392848
+v -0.500000 0.707107 -0.500000
+v -0.587938 0.555570 -0.587938
+v -0.653281 0.382683 -0.653282
+v -0.693520 0.195090 -0.693520
+v -0.707107 0.000000 -0.707107
+v -0.693520 -0.195090 -0.693520
+v -0.653281 -0.382683 -0.653282
+v -0.587938 -0.555570 -0.587938
+v -0.500000 -0.707107 -0.500000
+v -0.392847 -0.831470 -0.392848
+v -0.270598 -0.923880 -0.270598
+v -0.137949 -0.980785 -0.137950
+v -0.074658 0.980785 -0.180240
+v -0.146446 0.923880 -0.353554
+v -0.212607 0.831470 -0.513280
+v -0.270598 0.707107 -0.653282
+v -0.318189 0.555570 -0.768178
+v -0.353553 0.382683 -0.853554
+v -0.375330 0.195090 -0.906128
+v -0.382683 0.000000 -0.923880
+v -0.375330 -0.195090 -0.906128
+v -0.353553 -0.382683 -0.853554
+v -0.318189 -0.555570 -0.768178
+v -0.270598 -0.707107 -0.653282
+v -0.212607 -0.831470 -0.513280
+v -0.146446 -0.923880 -0.353554
+v -0.074658 -0.980785 -0.180240
+v 0.000000 0.980785 -0.195091
+v 0.000000 0.923880 -0.382684
+v 0.000000 0.831470 -0.555570
+v 0.000000 0.707107 -0.707107
+v 0.000000 0.555570 -0.831470
+v 0.000000 0.382683 -0.923880
+v 0.000000 0.195090 -0.980785
+v 0.000000 0.000000 -1.000000
+v 0.000000 -0.195090 -0.980785
+v 0.000000 -0.382683 -0.923880
+v 0.000000 -0.555570 -0.831470
+v 0.000000 -0.707107 -0.707107
+v 0.000000 -0.831470 -0.555570
+v 0.000000 -0.923880 -0.382684
+v 0.000000 -0.980785 -0.195090
+v 0.074658 0.980785 -0.180240
+v 0.146447 0.923880 -0.353554
+v 0.212608 0.831470 -0.513280
+v 0.270598 0.707107 -0.653282
+v 0.318190 0.555570 -0.768178
+v 0.353554 0.382683 -0.853553
+v 0.375331 0.195090 -0.906128
+v 0.382684 0.000000 -0.923880
+v 0.375331 -0.195090 -0.906128
+v 0.353554 -0.382683 -0.853553
+v 0.318190 -0.555570 -0.768178
+v 0.270598 -0.707107 -0.653282
+v 0.212608 -0.831470 -0.513280
+v 0.146447 -0.923880 -0.353554
+v 0.074658 -0.980785 -0.180240
+v 0.137950 0.980785 -0.137950
+v 0.270599 0.923880 -0.270598
+v 0.392848 0.831470 -0.392848
+v 0.500000 0.707107 -0.500000
+v 0.587938 0.555570 -0.587938
+v 0.653282 0.382683 -0.653282
+v 0.693520 0.195090 -0.693520
+v 0.707107 0.000000 -0.707107
+v 0.693520 -0.195090 -0.693520
+v 0.653282 -0.382683 -0.653281
+v 0.587938 -0.555570 -0.587938
+v 0.500000 -0.707107 -0.500000
+v 0.392848 -0.831470 -0.392848
+v 0.270599 -0.923880 -0.270598
+v 0.137950 -0.980785 -0.137950
+v 0.180241 0.980785 -0.074658
+v 0.353554 0.923880 -0.146447
+v 0.513280 0.831470 -0.212608
+v 0.653282 0.707107 -0.270598
+v 0.768178 0.555570 -0.318190
+v 0.853554 0.382683 -0.353553
+v 0.906128 0.195090 -0.375330
+v 0.923880 0.000000 -0.382683
+v 0.906128 -0.195090 -0.375330
+v 0.853554 -0.382683 -0.353553
+v 0.768178 -0.555570 -0.318190
+v 0.653282 -0.707107 -0.270598
+v 0.513280 -0.831470 -0.212608
+v 0.353554 -0.923880 -0.146447
+v 0.180240 -0.980785 -0.074658
+v 0.195091 0.980785 0.000000
+v 0.382684 0.923880 0.000000
+v 0.555571 0.831470 0.000000
+v 0.707107 0.707107 0.000000
+v 0.831470 0.555570 0.000000
+v 0.923880 0.382683 0.000000
+v 0.980786 0.195090 0.000000
+v 1.000000 0.000000 0.000000
+v 0.980786 -0.195090 0.000000
+v 0.923880 -0.382683 0.000000
+v 0.831470 -0.555570 0.000000
+v 0.707107 -0.707107 0.000000
+v 0.555571 -0.831470 0.000000
+v 0.382684 -0.923880 0.000000
+v 0.195091 -0.980785 0.000000
+v 0.180241 0.980785 0.074658
+v 0.353554 0.923880 0.146447
+v 0.513280 0.831470 0.212608
+v 0.653282 0.707107 0.270598
+v 0.768178 0.555570 0.318190
+v 0.853554 0.382683 0.353553
+v 0.906128 0.195090 0.375330
+v 0.923880 0.000000 0.382684
+v 0.906128 -0.195090 0.375330
+v 0.853554 -0.382683 0.353553
+v 0.768178 -0.555570 0.318190
+v 0.653282 -0.707107 0.270598
+v 0.513280 -0.831470 0.212608
+v 0.353554 -0.923880 0.146447
+v 0.180240 -0.980785 0.074658
+v 0.137950 0.980785 0.137950
+v 0.270599 0.923880 0.270598
+v 0.392848 0.831470 0.392848
+v 0.500000 0.707107 0.500000
+v 0.587938 0.555570 0.587938
+v 0.653282 0.382683 0.653282
+v 0.693520 0.195090 0.693520
+v 0.707107 0.000000 0.707107
+v 0.693520 -0.195090 0.693520
+v 0.653282 -0.382683 0.653282
+v 0.587938 -0.555570 0.587938
+v 0.500000 -0.707107 0.500000
+v 0.392848 -0.831470 0.392848
+v 0.270599 -0.923880 0.270598
+v 0.137950 -0.980785 0.137950
+v 0.074658 0.980785 0.180240
+v 0.146447 0.923880 0.353554
+v 0.212608 0.831470 0.513280
+v 0.270598 0.707107 0.653282
+v 0.318190 0.555570 0.768178
+v 0.353554 0.382683 0.853553
+v 0.375331 0.195090 0.906128
+v 0.382684 0.000000 0.923880
+v 0.375331 -0.195090 0.906128
+v 0.353554 -0.382683 0.853553
+v 0.318190 -0.555570 0.768178
+v 0.270598 -0.707107 0.653282
+v 0.212608 -0.831470 0.513280
+v 0.146447 -0.923880 0.353554
+v 0.074658 -0.980785 0.180240
+v 0.000000 0.980785 0.195091
+v 0.000000 0.923880 0.382684
+v 0.000000 0.831470 0.555570
+v 0.000000 0.707107 0.707107
+v 0.000000 0.555570 0.831470
+v 0.000000 0.382683 0.923880
+v 0.000000 0.195090 0.980785
+v 0.000000 0.000000 1.000000
+v 0.000000 -0.195090 0.980785
+v 0.000000 -0.382683 0.923879
+v 0.000000 -0.555570 0.831470
+v 0.000000 -0.707107 0.707107
+v 0.000000 -0.831470 0.555570
+v 0.000000 -0.923880 0.382684
+v 0.000000 -0.980785 0.195090
+v -0.074658 0.980785 0.180240
+v -0.146446 0.923880 0.353554
+v -0.212607 0.831470 0.513280
+v -0.270598 0.707107 0.653282
+v -0.318189 0.555570 0.768178
+v -0.353553 0.382683 0.853553
+v -0.375330 0.195090 0.906128
+v -0.382683 0.000000 0.923880
+v -0.375330 -0.195090 0.906128
+v -0.353553 -0.382683 0.853553
+v -0.318189 -0.555570 0.768178
+v -0.270598 -0.707107 0.653282
+v -0.212607 -0.831470 0.513280
+v -0.146446 -0.923880 0.353554
+v -0.074658 -0.980785 0.180240
+v 0.000000 1.000000 0.000000
+v -0.137950 0.980785 0.137950
+v -0.270598 0.923880 0.270598
+v -0.392847 0.831470 0.392848
+v -0.500000 0.707107 0.500000
+v -0.587938 0.555570 0.587938
+v -0.653281 0.382683 0.653281
+v -0.693520 0.195090 0.693520
+v -0.707107 0.000000 0.707107
+v -0.693520 -0.195090 0.693520
+v -0.653281 -0.382683 0.653281
+v -0.587938 -0.555570 0.587938
+v -0.500000 -0.707107 0.500000
+v -0.392847 -0.831470 0.392848
+v -0.270598 -0.923880 0.270598
+v -0.137949 -0.980785 0.137950
+v -0.180240 0.980785 0.074658
+v -0.353553 0.923880 0.146447
+v -0.513280 0.831470 0.212608
+v -0.653281 0.707107 0.270598
+v -0.768177 0.555570 0.318190
+v -0.853553 0.382683 0.353553
+v -0.906127 0.195090 0.375330
+v -0.923879 0.000000 0.382683
+v -0.906127 -0.195090 0.375330
+v -0.853553 -0.382683 0.353553
+v -0.768177 -0.555570 0.318190
+v -0.653281 -0.707107 0.270598
+v -0.513280 -0.831470 0.212608
+v -0.353553 -0.923880 0.146447
+v -0.180240 -0.980785 0.074658
+vt 0.040867 0.325557
+vt 0.048386 0.386583
+vt 0.001015 0.334499
+vt 0.081872 0.692529
+vt 0.092315 0.752973
+vt 0.006404 0.709363
+vt 1.031336 0.264931
+vt 1.040867 0.325557
+vt 0.999822 0.272029
+vt 0.073887 0.631595
+vt 0.005301 0.646891
+vt 0.333915 0.937286
+vt 0.448527 0.905466
+vt 0.447682 0.976645
+vt 1.017784 0.205113
+vt 0.998129 0.209571
+vt 0.067156 0.570413
+vt 0.004397 0.584414
+vt 0.196016 0.918498
+vt 0.034176 0.958662
+vt 0.060989 0.509119
+vt 0.003585 0.521934
+vt 0.135028 0.869370
+vt 0.015221 0.896641
+vt 0.054891 0.447811
+vt 0.002796 0.459454
+vt 0.107782 0.812401
+vt 0.010297 0.834265
+vt 0.001965 0.396975
+vt 0.007907 0.771825
+vt 0.978319 0.207096
+vt 1.004397 0.584414
+vt 1.005301 0.646891
+vt 0.941200 0.576589
+vt 1.034176 0.958662
+vt 0.823807 0.933258
+vt 1.003585 0.521934
+vt 0.945911 0.514786
+vt 1.015221 0.896641
+vt 0.885287 0.880701
+vt 1.002796 0.459454
+vt 0.950535 0.452971
+vt 1.010297 0.834265
+vt 0.908873 0.821779
+vt 1.001965 0.396975
+vt 0.955439 0.391196
+vt 1.007907 0.771825
+vt 0.921503 0.761167
+vt 1.001015 0.334499
+vt 0.961079 0.329532
+vt 1.006404 0.709363
+vt 0.929787 0.699898
+vt 0.968202 0.268089
+vt 0.936013 0.638321
+vt 0.488610 0.915189
+vt 0.647808 0.950687
+vt 0.921611 0.311033
+vt 0.859136 0.666985
+vt 0.937209 0.253354
+vt 0.870446 0.607941
+vt 0.532175 0.909643
+vt 0.657607 0.903302
+vt 0.959449 0.197860
+vt 0.880347 0.548455
+vt 0.745300 0.879338
+vt 0.889690 0.488794
+vt 0.796385 0.834663
+vt 0.899158 0.429173
+vt 0.825891 0.781668
+vt 0.909472 0.369816
+vt 0.845097 0.725165
+vt 0.848920 0.390841
+vt 0.761226 0.728711
+vt 0.864196 0.334814
+vt 0.780693 0.674598
+vt 0.882867 0.280332
+vt 0.796418 0.618773
+vt 0.907539 0.228698
+vt 0.810089 0.562031
+vt 0.558962 0.891763
+vt 0.641452 0.857179
+vt 0.942759 0.182515
+vt 0.822818 0.504873
+vt 0.697492 0.824480
+vt 0.835477 0.447684
+vt 0.735147 0.779653
+vt 0.879896 0.195479
+vt 0.753309 0.508011
+vt 0.618082 0.815427
+vt 0.767315 0.452094
+vt 0.657173 0.773912
+vt 0.782092 0.396562
+vt 0.685241 0.725518
+vt 0.798714 0.341964
+vt 0.706593 0.673391
+vt 0.818709 0.289116
+vt 0.723996 0.619193
+vt 0.844487 0.239416
+vt 0.739178 0.563865
+vt 0.567268 0.868303
+vt 0.563300 0.844314
+vt 0.770454 0.236269
+vt 0.670392 0.566231
+vt 0.805029 0.190637
+vt 0.683774 0.509644
+vt 0.551952 0.822879
+vt 0.929896 0.162212
+vt 0.855308 0.155368
+vt 0.697011 0.452991
+vt 0.591182 0.780044
+vt 0.710973 0.396675
+vt 0.618699 0.730484
+vt 0.726705 0.341193
+vt 0.639317 0.677374
+vt 0.745717 0.287291
+vt 0.655961 0.622327
+vt 0.665037 0.288362
+vt 0.594131 0.638967
+vt 0.684737 0.232805
+vt 0.605914 0.580518
+vt 0.713639 0.180821
+vt 0.616615 0.521685
+vt 0.760428 0.136665
+vt 0.627046 0.462757
+vt 0.536166 0.805967
+vt 0.923407 0.138703
+vt 0.836350 0.110271
+vt 0.637946 0.403995
+vt 0.562017 0.752770
+vt 0.650183 0.345708
+vt 0.580132 0.696622
+vt 0.517784 0.794886
+vt 0.927547 0.114679
+vt 0.833915 0.062714
+vt 0.573887 0.368405
+vt 0.531336 0.735069
+vt 0.581872 0.307471
+vt 0.540867 0.674443
+vt 0.592315 0.247027
+vt 0.548386 0.613417
+vt 0.607782 0.187599
+vt 0.554891 0.552189
+vt 0.635028 0.130630
+vt 0.560989 0.490881
+vt 0.696016 0.081502
+vt 0.567156 0.429587
+vt 0.502796 0.540546
+vt 0.515221 0.103359
+vt 0.503585 0.478066
+vt 0.534176 0.041338
+vt 0.504397 0.415586
+vt 0.498129 0.790428
+vt 0.948527 0.094534
+vt 0.947682 0.023355
+vt 0.505301 0.353109
+vt 0.499822 0.727971
+vt 0.506404 0.290637
+vt 0.501015 0.665501
+vt 0.507907 0.228175
+vt 0.501965 0.603025
+vt 0.510297 0.165735
+vt 0.429787 0.300102
+vt 0.461079 0.670468
+vt 0.421503 0.238833
+vt 0.455439 0.608804
+vt 0.408873 0.178221
+vt 0.445911 0.485214
+vt 0.385287 0.119299
+vt 1.323807 0.066742
+vt 0.441200 0.423411
+vt 0.478319 0.792904
+vt 0.988610 0.084811
+vt 1.147808 0.049313
+vt 0.436013 0.361679
+vt 0.468202 0.731911
+vt 0.147808 0.049313
+vt 0.323807 0.066742
+vt 0.245300 0.120661
+vt 0.380347 0.451545
+vt 0.459449 0.802140
+vt 0.032175 0.090357
+vt 0.157607 0.096698
+vt 0.370446 0.392059
+vt 0.437209 0.746646
+vt 0.359136 0.333015
+vt 0.421611 0.688967
+vt 0.345097 0.274835
+vt 0.450536 0.547029
+vt 0.409472 0.630184
+vt 0.325892 0.218332
+vt 0.399158 0.570827
+vt 0.296385 0.165337
+vt 0.389690 0.511206
+vt 0.261226 0.271289
+vt 0.348920 0.609159
+vt 0.235147 0.220347
+vt 0.335478 0.552316
+vt 0.197492 0.175520
+vt 0.322818 0.495127
+vt 0.442759 0.817485
+vt 0.058962 0.108237
+vt 0.141452 0.142821
+vt 0.310089 0.437969
+vt 0.407539 0.771302
+vt 0.296418 0.381227
+vt 0.382867 0.719668
+vt 0.280693 0.325402
+vt 0.364196 0.665186
+vt 0.223996 0.380807
+vt 0.318709 0.710884
+vt 0.206593 0.326609
+vt 0.298714 0.658036
+vt 0.185241 0.274482
+vt 0.282092 0.603438
+vt 0.157173 0.226088
+vt 0.267315 0.547906
+vt 0.118082 0.184573
+vt 0.253309 0.491989
+vt 0.379896 0.804521
+vt 0.067268 0.131697
+vt 0.063300 0.155685
+vt 0.239178 0.436135
+vt 0.344487 0.760584
+vt 0.091182 0.219955
+vt 0.197011 0.547009
+vt 0.429896 0.837788
+vt 0.355308 0.844632
+vt 0.051952 0.177121
+vt 0.183774 0.490356
+vt 0.305029 0.809363
+vt 0.170392 0.433769
+vt 0.270454 0.763731
+vt 0.155961 0.377673
+vt 0.245717 0.712709
+vt 0.226706 0.658807
+vt 0.118699 0.269516
+vt 0.210973 0.603325
+vt 0.139317 0.322626
+vt 0.094131 0.361033
+vt 0.165037 0.711638
+vt 0.080132 0.303378
+vt 0.150183 0.654292
+vt 0.062017 0.247229
+vt 0.137946 0.596005
+vt 0.423407 0.861296
+vt 0.336350 0.889729
+vt 0.036166 0.194032
+vt 0.127046 0.537243
+vt 0.260428 0.863335
+vt 0.116615 0.478315
+vt 0.213639 0.819179
+vt 0.105914 0.419482
+vt 0.184737 0.767195
+vt 0.495265 0.852856
+vt 0.995265 0.147143
+vt 1.032175 0.090357
+vt 1.058962 0.108237
+vt 1.067268 0.131697
+vt 1.063300 0.155685
+vt 1.051952 0.177121
+vt 0.427547 0.885321
+vt 1.036166 0.194032
+vt 0.031336 0.264931
+vt 0.017784 0.205113
+vn -0.629402 -0.766928 -0.125196
+vn -0.940062 0.285165 -0.186990
+vn -0.469338 -0.878070 -0.093357
+vn -0.976241 0.096152 -0.194186
+vn -0.289802 0.955349 -0.057645
+vn -0.289802 -0.955349 -0.057645
+vn -0.976241 -0.096151 -0.194186
+vn -0.469338 0.878070 -0.093357
+vn -0.940062 -0.285165 -0.186990
+vn -0.629402 0.766928 -0.125196
+vn -0.868657 -0.464306 -0.172787
+vn -0.764031 0.627024 -0.151975
+vn -0.764031 -0.627024 -0.151975
+vn -0.868657 0.464306 -0.172787
+vn -0.245682 -0.955349 -0.164159
+vn -0.827617 -0.096152 -0.552996
+vn -0.397886 0.878069 -0.265859
+vn -0.796946 -0.285165 -0.532502
+vn -0.533581 0.766929 -0.356527
+vn -0.736412 -0.464306 -0.492055
+vn -0.647715 0.627024 -0.432789
+vn -0.647714 -0.627024 -0.432789
+vn -0.736412 0.464306 -0.492055
+vn -0.533581 -0.766928 -0.356528
+vn -0.796946 0.285165 -0.532502
+vn -0.397886 -0.878070 -0.265859
+vn -0.827617 0.096152 -0.552996
+vn -0.245682 0.955349 -0.164160
+vn -0.356527 -0.766928 -0.533581
+vn -0.532502 0.285165 -0.796946
+vn -0.265859 -0.878070 -0.397886
+vn -0.552996 0.096152 -0.827617
+vn -0.164160 0.955349 -0.245682
+vn -0.164159 -0.955349 -0.245682
+vn -0.552996 -0.096152 -0.827617
+vn -0.265859 0.878069 -0.397886
+vn -0.532502 -0.285165 -0.796946
+vn -0.356527 0.766929 -0.533581
+vn -0.492054 -0.464306 -0.736412
+vn -0.432789 0.627024 -0.647715
+vn -0.432789 -0.627024 -0.647715
+vn -0.492054 0.464306 -0.736412
+vn -0.172786 -0.464306 -0.868657
+vn -0.151975 0.627024 -0.764032
+vn -0.151975 -0.627024 -0.764032
+vn -0.172786 0.464306 -0.868657
+vn -0.125196 -0.766928 -0.629402
+vn -0.186990 0.285165 -0.940062
+vn -0.093357 -0.878070 -0.469338
+vn -0.194186 0.096152 -0.976241
+vn -0.057645 0.955349 -0.289802
+vn -0.057645 -0.955349 -0.289801
+vn -0.194186 -0.096152 -0.976241
+vn -0.093357 0.878069 -0.469338
+vn -0.186990 -0.285165 -0.940062
+vn -0.125196 0.766929 -0.629402
+vn 0.057645 -0.955349 -0.289801
+vn 0.194186 -0.096152 -0.976241
+vn 0.093357 0.878069 -0.469338
+vn 0.186990 -0.285165 -0.940062
+vn 0.125196 0.766929 -0.629402
+vn 0.172787 -0.464306 -0.868657
+vn 0.151975 0.627024 -0.764031
+vn 0.151975 -0.627024 -0.764031
+vn 0.172787 0.464306 -0.868657
+vn 0.125196 -0.766928 -0.629402
+vn 0.186990 0.285165 -0.940062
+vn 0.093357 -0.878070 -0.469338
+vn 0.194186 0.096152 -0.976241
+vn 0.057645 0.955349 -0.289802
+vn 0.356528 -0.766928 -0.533581
+vn 0.532502 0.285165 -0.796946
+vn 0.265859 -0.878070 -0.397886
+vn 0.552996 0.096152 -0.827617
+vn 0.164160 0.955349 -0.245682
+vn 0.164159 -0.955349 -0.245682
+vn 0.552996 -0.096152 -0.827617
+vn 0.265859 0.878069 -0.397886
+vn 0.532502 -0.285165 -0.796946
+vn 0.356527 0.766929 -0.533581
+vn 0.492055 -0.464306 -0.736412
+vn 0.432789 0.627024 -0.647715
+vn 0.432789 -0.627024 -0.647714
+vn 0.492055 0.464306 -0.736412
+vn 0.736412 -0.464306 -0.492055
+vn 0.647715 0.627024 -0.432789
+vn 0.647715 -0.627024 -0.432789
+vn 0.736412 0.464306 -0.492054
+vn 0.533581 -0.766928 -0.356528
+vn 0.796946 0.285165 -0.532502
+vn 0.397886 -0.878070 -0.265859
+vn 0.827617 0.096152 -0.552996
+vn 0.245682 0.955349 -0.164160
+vn 0.245682 -0.955349 -0.164159
+vn 0.827617 -0.096152 -0.552996
+vn 0.397886 0.878069 -0.265859
+vn 0.796946 -0.285165 -0.532502
+vn 0.533581 0.766929 -0.356527
+vn 0.289802 0.955349 -0.057645
+vn 0.289801 -0.955349 -0.057645
+vn 0.976241 -0.096152 -0.194186
+vn 0.469338 0.878069 -0.093357
+vn 0.940062 -0.285165 -0.186990
+vn 0.629402 0.766929 -0.125196
+vn 0.868657 -0.464306 -0.172786
+vn 0.764032 0.627024 -0.151975
+vn 0.764032 -0.627024 -0.151975
+vn 0.868657 0.464307 -0.172786
+vn 0.629402 -0.766928 -0.125196
+vn 0.940062 0.285165 -0.186990
+vn 0.469338 -0.878069 -0.093357
+vn 0.976241 0.096152 -0.194186
+vn 0.868657 0.464306 0.172787
+vn 0.629402 -0.766928 0.125196
+vn 0.940062 0.285165 0.186990
+vn 0.469338 -0.878069 0.093357
+vn 0.976241 0.096152 0.194186
+vn 0.289802 0.955349 0.057645
+vn 0.289801 -0.955349 0.057645
+vn 0.976241 -0.096152 0.194187
+vn 0.469338 0.878069 0.093357
+vn 0.940061 -0.285165 0.186990
+vn 0.629402 0.766929 0.125196
+vn 0.868657 -0.464306 0.172787
+vn 0.764032 0.627024 0.151975
+vn 0.764032 -0.627024 0.151976
+vn 0.796946 -0.285165 0.532502
+vn 0.533581 0.766929 0.356527
+vn 0.736412 -0.464306 0.492055
+vn 0.647715 0.627024 0.432789
+vn 0.647715 -0.627024 0.432789
+vn 0.736411 0.464307 0.492054
+vn 0.533581 -0.766928 0.356528
+vn 0.796946 0.285165 0.532502
+vn 0.397886 -0.878070 0.265859
+vn 0.827617 0.096151 0.552996
+vn 0.245682 0.955349 0.164160
+vn 0.245682 -0.955349 0.164159
+vn 0.827617 -0.096151 0.552996
+vn 0.397886 0.878070 0.265859
+vn 0.265859 -0.878070 0.397886
+vn 0.552996 0.096151 0.827617
+vn 0.164160 0.955349 0.245682
+vn 0.164159 -0.955349 0.245682
+vn 0.552996 -0.096151 0.827617
+vn 0.265859 0.878070 0.397886
+vn 0.532502 -0.285165 0.796946
+vn 0.356527 0.766929 0.533581
+vn 0.492054 -0.464306 0.736412
+vn 0.432789 0.627024 0.647715
+vn 0.432789 -0.627024 0.647715
+vn 0.492054 0.464307 0.736412
+vn 0.356528 -0.766928 0.533581
+vn 0.532502 0.285165 0.796946
+vn 0.151975 -0.627024 0.764032
+vn 0.172786 0.464307 0.868656
+vn 0.125196 -0.766928 0.629402
+vn 0.186990 0.285165 0.940062
+vn 0.093357 -0.878070 0.469338
+vn 0.194186 0.096151 0.976241
+vn 0.057645 0.955349 0.289802
+vn 0.057645 -0.955349 0.289801
+vn 0.194186 -0.096151 0.976241
+vn 0.093357 0.878070 0.469338
+vn 0.186990 -0.285166 0.940061
+vn 0.125196 0.766929 0.629402
+vn 0.172786 -0.464306 0.868657
+vn 0.151975 0.627023 0.764032
+vn -0.186990 -0.285166 0.940061
+vn -0.125196 0.766929 0.629402
+vn -0.172787 -0.464306 0.868657
+vn -0.151976 0.627023 0.764032
+vn -0.151975 -0.627024 0.764032
+vn -0.172787 0.464307 0.868656
+vn -0.125196 -0.766928 0.629402
+vn -0.186990 0.285165 0.940062
+vn -0.093357 -0.878069 0.469338
+vn -0.194186 0.096151 0.976241
+vn -0.057645 0.955349 0.289802
+vn -0.057645 -0.955349 0.289801
+vn -0.194186 -0.096151 0.976241
+vn -0.093357 0.878069 0.469338
+vn -0.265859 -0.878070 0.397886
+vn -0.552996 0.096151 0.827617
+vn -0.164160 0.955349 0.245682
+vn -0.164159 -0.955349 0.245682
+vn -0.552996 -0.096151 0.827617
+vn -0.265859 0.878070 0.397886
+vn -0.532502 -0.285166 0.796945
+vn -0.356527 0.766929 0.533581
+vn -0.492054 -0.464306 0.736412
+vn -0.432790 0.627023 0.647715
+vn -0.432789 -0.627024 0.647715
+vn -0.492054 0.464307 0.736411
+vn -0.356528 -0.766928 0.533581
+vn -0.532502 0.285165 0.796946
+vn -0.647715 -0.627024 0.432789
+vn -0.736411 0.464307 0.492054
+vn -0.533581 -0.766928 0.356528
+vn -0.796946 0.285165 0.532502
+vn -0.397886 -0.878070 0.265859
+vn -0.827617 0.096151 0.552996
+vn -0.245682 0.955349 0.164160
+vn -0.245682 -0.955349 0.164159
+vn -0.827617 -0.096151 0.552996
+vn -0.397886 0.878070 0.265859
+vn -0.796946 -0.285166 0.532502
+vn -0.533581 0.766929 0.356527
+vn -0.736412 -0.464306 0.492054
+vn -0.647715 0.627023 0.432789
+vn -0.097999 0.994996 -0.019493
+vn -0.097998 -0.994996 -0.019493
+vn -0.083079 -0.994996 -0.055512
+vn -0.083079 0.994996 -0.055512
+vn -0.055512 0.994996 -0.083079
+vn -0.055512 -0.994996 -0.083079
+vn -0.019493 0.994996 -0.097998
+vn -0.019493 -0.994996 -0.097998
+vn 0.019493 -0.994996 -0.097998
+vn 0.019493 0.994996 -0.097998
+vn 0.055512 0.994996 -0.083079
+vn 0.055512 -0.994996 -0.083079
+vn 0.083079 0.994996 -0.055512
+vn 0.083079 -0.994996 -0.055512
+vn 0.097998 -0.994996 -0.019493
+vn 0.097998 0.994996 -0.019493
+vn 0.097998 0.994996 0.019493
+vn 0.097998 -0.994996 0.019493
+vn 0.083079 0.994996 0.055512
+vn 0.083079 -0.994996 0.055512
+vn 0.055512 -0.994996 0.083079
+vn 0.055512 0.994996 0.083079
+vn 0.019493 0.994996 0.097999
+vn 0.019493 -0.994996 0.097998
+vn -0.019493 -0.994996 0.097998
+vn -0.019493 0.994996 0.097999
+vn -0.055512 -0.994996 0.083079
+vn -0.055512 0.994996 0.083079
+vn -0.083079 0.994996 0.055512
+vn -0.083079 -0.994996 0.055512
+vn -0.097998 -0.994996 0.019493
+vn -0.940061 -0.285166 0.186991
+vn -0.629402 0.766929 0.125196
+vn -0.868656 -0.464306 0.172788
+vn -0.764032 0.627023 0.151977
+vn -0.764032 -0.627024 0.151976
+vn -0.868656 0.464307 0.172787
+vn -0.629402 -0.766928 0.125196
+vn -0.940061 0.285165 0.186990
+vn -0.097999 0.994996 0.019493
+vn -0.469338 -0.878070 0.093357
+vn -0.976241 0.096151 0.194187
+vn -0.289802 0.955349 0.057646
+vn -0.289801 -0.955349 0.057645
+vn -0.976241 -0.096151 0.194187
+vn -0.469338 0.878070 0.093358
+vn -0.976241 -0.096152 -0.194186
+vn -0.469338 0.878069 -0.093357
+vn -0.629401 0.766929 -0.125196
+vn -0.764032 0.627024 -0.151975
+vn -0.736411 -0.464306 -0.492055
+vn -0.736411 0.464306 -0.492055
+vn -0.356528 -0.766928 -0.533581
+vn -0.151975 -0.627024 -0.764031
+vn -0.194186 -0.096151 -0.976241
+vn 0.186990 -0.285165 -0.940061
+vn 0.151975 0.627024 -0.764032
+vn 0.432789 -0.627024 -0.647715
+vn 0.492055 0.464306 -0.736411
+vn 0.736412 -0.464306 -0.492054
+vn 0.736411 0.464307 -0.492054
+vn 0.976241 -0.096151 -0.194186
+vn 0.940062 -0.285166 -0.186990
+vn 0.868657 -0.464306 -0.172787
+vn 0.868657 0.464306 -0.172786
+vn 0.940061 0.285165 -0.186990
+vn 0.868656 0.464307 0.172787
+vn 0.976241 0.096151 0.194187
+vn 0.976241 -0.096151 0.194186
+vn 0.469338 0.878070 0.093357
+vn 0.940061 -0.285166 0.186990
+vn 0.764032 0.627024 0.151976
+vn 0.764032 -0.627024 0.151975
+vn 0.796945 -0.285166 0.532502
+vn 0.647715 0.627023 0.432790
+vn 0.736411 0.464307 0.492055
+vn 0.532502 -0.285166 0.796946
+vn 0.432789 0.627023 0.647715
+vn 0.492054 0.464307 0.736411
+vn 0.151975 -0.627023 0.764032
+vn 0.186990 0.285165 0.940061
+vn 0.093357 0.878069 0.469338
+vn -0.151975 0.627023 0.764032
+vn -0.151976 -0.627023 0.764032
+vn -0.186990 0.285165 0.940061
+vn -0.093357 -0.878070 0.469338
+vn -0.093357 0.878070 0.469338
+vn -0.532502 -0.285166 0.796946
+vn -0.492055 -0.464306 0.736412
+vn -0.432789 -0.627023 0.647715
+vn -0.647715 -0.627023 0.432789
+vn -0.796945 -0.285166 0.532502
+vn -0.647715 0.627023 0.432790
+vn -0.940062 -0.285165 0.186990
+vn -0.629402 0.766928 0.125196
+vn -0.764031 0.627024 0.151975
+vn -0.764031 -0.627024 0.151976
+vn -0.868657 0.464306 0.172788
+vn -0.940062 0.285165 0.186991
+vn -0.976241 0.096152 0.194187
+vn -0.289802 -0.955349 0.057645
+s off
+f 13/1/1 12/2/1 28/3/1
+f 7/4/2 6/5/2 22/6/2
+f 14/7/3 13/8/3 29/9/3
+f 8/10/4 7/4/4 23/11/4
+f 2/12/5 1/13/5 17/14/5
+f 15/15/6 14/7/6 30/16/6
+f 9/17/7 8/10/7 24/18/7
+f 3/19/8 2/12/8 18/20/8
+f 10/21/9 9/17/9 25/22/9
+f 4/23/10 3/19/10 19/24/10
+f 11/25/11 10/21/11 26/26/11
+f 5/27/12 4/23/12 20/28/12
+f 12/2/13 11/25/13 27/29/13
+f 6/5/14 5/27/14 21/30/14
+f 30/16/15 29/9/15 46/31/15
+f 24/32/16 23/33/16 40/34/16
+f 18/35/17 17/14/17 34/36/17
+f 25/37/18 24/32/18 41/38/18
+f 19/39/19 18/35/19 35/40/19
+f 26/41/20 25/37/20 42/42/20
+f 20/43/21 19/39/21 36/44/21
+f 27/45/22 26/41/22 43/46/22
+f 21/47/23 20/43/23 37/48/23
+f 28/49/24 27/45/24 44/50/24
+f 22/51/25 21/47/25 38/52/25
+f 29/9/26 28/49/26 45/53/26
+f 23/33/27 22/51/27 39/54/27
+f 17/14/28 16/55/28 33/56/28
+f 44/50/29 43/46/29 59/57/29
+f 38/52/30 37/48/30 53/58/30
+f 45/53/31 44/50/31 60/59/31
+f 39/54/32 38/52/32 54/60/32
+f 33/56/33 32/61/33 48/62/33
+f 46/31/34 45/53/34 61/63/34
+f 40/34/35 39/54/35 55/64/35
+f 34/36/36 33/56/36 49/65/36
+f 41/38/37 40/34/37 56/66/37
+f 35/40/38 34/36/38 50/67/38
+f 42/42/39 41/38/39 57/68/39
+f 36/44/40 35/40/40 51/69/40
+f 43/46/41 42/42/41 58/70/41
+f 37/48/42 36/44/42 52/71/42
+f 57/68/43 56/66/43 72/72/43
+f 51/69/44 50/67/44 66/73/44
+f 58/70/45 57/68/45 73/74/45
+f 52/71/46 51/69/46 67/75/46
+f 59/57/47 58/70/47 74/76/47
+f 53/58/48 52/71/48 68/77/48
+f 60/59/49 59/57/49 75/78/49
+f 54/60/50 53/58/50 69/79/50
+f 48/62/51 47/80/51 63/81/51
+f 61/63/52 60/59/52 76/82/52
+f 55/64/53 54/60/53 70/83/53
+f 49/65/54 48/62/54 64/84/54
+f 56/66/55 55/64/55 71/85/55
+f 50/67/56 49/65/56 65/86/56
+f 76/82/57 75/78/57 90/87/57
+f 70/83/58 69/79/58 84/88/58
+f 64/84/59 63/81/59 78/89/59
+f 71/85/60 70/83/60 85/90/60
+f 65/86/61 64/84/61 79/91/61
+f 72/72/62 71/85/62 86/92/62
+f 66/73/63 65/86/63 80/93/63
+f 73/74/64 72/72/64 87/94/64
+f 67/75/65 66/73/65 81/95/65
+f 74/76/66 73/74/66 88/96/66
+f 68/77/67 67/75/67 82/97/67
+f 75/78/68 74/76/68 89/98/68
+f 69/79/69 68/77/69 83/99/69
+f 63/81/70 62/100/70 77/101/70
+f 89/98/71 88/96/71 103/102/71
+f 83/99/72 82/97/72 97/103/72
+f 90/87/73 89/98/73 104/104/73
+f 84/88/74 83/99/74 98/105/74
+f 78/89/75 77/101/75 92/106/75
+f 91/107/76 90/87/76 105/108/76
+f 85/90/77 84/88/77 99/109/77
+f 79/91/78 78/89/78 93/110/78
+f 86/92/79 85/90/79 100/111/79
+f 80/93/80 79/91/80 94/112/80
+f 87/94/81 86/92/81 101/113/81
+f 81/95/82 80/93/82 95/114/82
+f 88/96/83 87/94/83 102/115/83
+f 82/97/84 81/95/84 96/116/84
+f 102/115/85 101/113/85 116/117/85
+f 96/116/86 95/114/86 110/118/86
+f 103/102/87 102/115/87 117/119/87
+f 97/103/88 96/116/88 111/120/88
+f 104/104/89 103/102/89 118/121/89
+f 98/105/90 97/103/90 112/122/90
+f 105/108/91 104/104/91 119/123/91
+f 99/109/92 98/105/92 113/124/92
+f 93/110/93 92/106/93 107/125/93
+f 106/126/94 105/108/94 120/127/94
+f 100/111/95 99/109/95 114/128/95
+f 94/112/96 93/110/96 108/129/96
+f 101/113/97 100/111/97 115/130/97
+f 95/114/98 94/112/98 109/131/98
+f 108/129/99 107/125/99 122/132/99
+f 121/133/100 120/127/100 135/134/100
+f 115/130/101 114/128/101 129/135/101
+f 109/131/102 108/129/102 123/136/102
+f 116/117/103 115/130/103 130/137/103
+f 110/118/104 109/131/104 124/138/104
+f 117/119/105 116/117/105 131/139/105
+f 111/120/106 110/118/106 125/140/106
+f 118/121/107 117/119/107 132/141/107
+f 112/122/108 111/120/108 126/142/108
+f 119/123/109 118/121/109 133/143/109
+f 113/124/110 112/122/110 127/144/110
+f 120/127/111 119/123/111 134/145/111
+f 114/128/112 113/124/112 128/146/112
+f 127/144/113 126/142/113 141/147/113
+f 134/145/114 133/143/114 148/148/114
+f 128/146/115 127/144/115 142/149/115
+f 135/134/116 134/145/116 149/150/116
+f 129/135/117 128/146/117 143/151/117
+f 123/136/118 122/132/118 137/152/118
+f 136/153/119 135/134/119 150/154/119
+f 130/137/120 129/135/120 144/155/120
+f 124/138/121 123/136/121 138/156/121
+f 131/139/122 130/137/122 145/157/122
+f 125/140/123 124/138/123 139/158/123
+f 132/141/124 131/139/124 146/159/124
+f 126/142/125 125/140/125 140/160/125
+f 133/143/126 132/141/126 147/161/126
+f 146/159/127 145/157/127 160/162/127
+f 140/160/128 139/158/128 154/163/128
+f 147/161/129 146/159/129 161/164/129
+f 141/147/130 140/160/130 155/165/130
+f 148/148/131 147/161/131 162/166/131
+f 142/149/132 141/147/132 157/167/132
+f 149/150/133 148/148/133 163/168/133
+f 143/151/134 142/149/134 157/167/134
+f 150/154/135 149/150/135 164/169/135
+f 144/155/136 143/151/136 158/170/136
+f 138/156/137 137/152/137 152/171/137
+f 151/172/138 150/154/138 165/173/138
+f 145/157/139 144/155/139 159/174/139
+f 139/158/140 138/156/140 153/175/140
+f 165/176/141 164/177/141 179/178/141
+f 159/174/142 158/170/142 173/179/142
+f 153/175/143 152/171/143 167/180/143
+f 166/181/144 165/176/144 180/182/144
+f 160/162/145 159/174/145 174/183/145
+f 154/163/146 153/175/146 168/184/146
+f 161/164/147 160/162/147 175/185/147
+f 155/165/148 154/163/148 169/186/148
+f 162/166/149 161/164/149 176/187/149
+f 156/188/150 155/165/150 170/189/150
+f 163/168/151 162/166/151 177/190/151
+f 157/167/152 156/188/152 171/191/152
+f 164/177/153 163/168/153 178/192/153
+f 158/170/154 157/167/154 172/193/154
+f 178/192/155 177/190/155 192/194/155
+f 172/193/156 171/191/156 186/195/156
+f 179/178/157 178/192/157 193/196/157
+f 173/179/158 172/193/158 187/197/158
+f 180/182/159 179/178/159 194/198/159
+f 174/183/160 173/179/160 188/199/160
+f 168/184/161 167/180/161 182/200/161
+f 181/201/162 180/182/162 195/202/162
+f 175/185/163 174/183/163 189/203/163
+f 169/186/164 168/184/164 183/204/164
+f 176/187/165 175/185/165 190/205/165
+f 170/189/166 169/186/166 184/206/166
+f 177/190/167 176/187/167 191/207/167
+f 171/191/168 170/189/168 185/208/168
+f 191/207/169 190/205/169 206/209/169
+f 185/208/170 184/206/170 200/210/170
+f 192/194/171 191/207/171 207/211/171
+f 186/195/172 185/208/172 201/212/172
+f 193/196/173 192/194/173 208/213/173
+f 187/197/174 186/195/174 202/214/174
+f 194/198/175 193/196/175 209/215/175
+f 188/199/176 187/197/176 203/216/176
+f 195/202/177 194/198/177 210/217/177
+f 189/203/178 188/199/178 204/218/178
+f 183/204/179 182/200/179 198/219/179
+f 196/220/180 195/202/180 211/221/180
+f 190/205/181 189/203/181 205/222/181
+f 184/206/182 183/204/182 199/223/182
+f 210/217/183 209/215/183 226/224/183
+f 204/218/184 203/216/184 220/225/184
+f 198/219/185 197/226/185 214/227/185
+f 211/221/186 210/217/186 227/228/186
+f 205/222/187 204/218/187 221/229/187
+f 199/223/188 198/219/188 215/230/188
+f 206/209/189 205/222/189 222/231/189
+f 200/210/190 199/223/190 216/232/190
+f 207/211/191 206/209/191 223/233/191
+f 201/212/192 200/210/192 217/234/192
+f 208/213/193 207/211/193 223/233/193
+f 202/214/194 201/212/194 218/235/194
+f 209/215/195 208/213/195 225/236/195
+f 203/216/196 202/214/196 219/237/196
+f 224/238/197 223/233/197 239/239/197
+f 218/235/198 217/234/198 233/240/198
+f 225/236/199 224/238/199 240/241/199
+f 219/237/200 218/235/200 234/242/200
+f 226/224/201 225/236/201 241/243/201
+f 220/225/202 219/237/202 235/244/202
+f 214/227/203 213/245/203 229/246/203
+f 227/228/204 226/224/204 242/247/204
+f 221/229/205 220/225/205 236/248/205
+f 215/230/206 214/227/206 230/249/206
+f 222/231/207 221/229/207 237/250/207
+f 216/232/208 215/230/208 231/251/208
+f 223/233/209 222/231/209 238/252/209
+f 217/234/210 216/232/210 232/253/210
+f 1/13/211 212/254/211 16/55/211
+f 31/255/212 15/15/212 30/16/212
+f 31/255/213 30/16/213 46/31/213
+f 16/55/214 212/254/214 32/61/214
+f 32/61/215 212/254/215 47/80/215
+f 31/255/216 46/31/216 61/63/216
+f 47/80/217 212/254/217 62/100/217
+f 31/255/218 61/63/218 76/82/218
+f 31/255/219 76/82/219 91/107/219
+f 62/100/220 212/254/220 77/101/220
+f 77/101/221 212/254/221 92/106/221
+f 31/255/222 91/107/222 106/126/222
+f 92/106/223 212/254/223 107/125/223
+f 31/255/224 106/126/224 121/133/224
+f 31/255/225 121/133/225 136/153/225
+f 107/125/226 212/254/226 122/132/226
+f 122/132/227 212/254/227 137/152/227
+f 31/255/228 136/153/228 151/172/228
+f 137/152/229 212/254/229 152/171/229
+f 31/255/230 151/172/230 166/256/230
+f 31/255/231 166/256/231 181/257/231
+f 152/171/232 212/254/232 167/180/232
+f 167/180/233 212/254/233 182/200/233
+f 31/255/234 181/257/234 196/258/234
+f 31/255/235 196/258/235 211/259/235
+f 182/200/236 212/254/236 197/226/236
+f 31/255/237 211/259/237 227/260/237
+f 197/226/238 212/254/238 213/245/238
+f 213/245/239 212/254/239 228/261/239
+f 31/255/240 227/260/240 242/262/240
+f 31/255/241 242/262/241 15/15/241
+f 237/250/242 236/248/242 10/21/242
+f 231/251/243 230/249/243 4/23/243
+f 238/252/244 237/250/244 10/21/244
+f 232/253/245 231/251/245 5/27/245
+f 239/239/246 238/252/246 11/25/246
+f 233/240/247 232/253/247 6/5/247
+f 240/241/248 239/239/248 13/1/248
+f 234/242/249 233/240/249 7/4/249
+f 228/261/250 212/254/250 1/13/250
+f 241/243/251 240/241/251 14/263/251
+f 235/244/252 234/242/252 8/10/252
+f 229/246/253 228/261/253 2/12/253
+f 242/247/254 241/243/254 15/264/254
+f 236/248/255 235/244/255 9/17/255
+f 230/249/256 229/246/256 3/19/256
+f 12/2/1 27/29/1 28/3/1
+f 6/5/2 21/30/2 22/6/2
+f 13/8/3 28/49/3 29/9/3
+f 7/4/4 22/6/4 23/11/4
+f 1/13/5 16/55/5 17/14/5
+f 14/7/6 29/9/6 30/16/6
+f 8/10/257 23/11/257 24/18/257
+f 2/12/258 17/14/258 18/20/258
+f 9/17/9 24/18/9 25/22/9
+f 3/19/259 18/20/259 19/24/259
+f 10/21/11 25/22/11 26/26/11
+f 4/23/260 19/24/260 20/28/260
+f 11/25/13 26/26/13 27/29/13
+f 5/27/14 20/28/14 21/30/14
+f 29/9/15 45/53/15 46/31/15
+f 23/33/16 39/54/16 40/34/16
+f 17/14/17 33/56/17 34/36/17
+f 24/32/18 40/34/18 41/38/18
+f 18/35/19 34/36/19 35/40/19
+f 25/37/261 41/38/261 42/42/261
+f 19/39/21 3