summaryrefslogtreecommitdiffstats
path: root/src/datavis3d/engine/q3dbars.h
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-03-07 12:28:15 +0200
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-03-07 12:28:15 +0200
commitfe21dc562504ccb87f8a1b01ea96cc7865064b72 (patch)
treec4e444662a03ee0b3383eeeb09ccbdc313b4f753 /src/datavis3d/engine/q3dbars.h
parenta1c579f4e9eb94488550b329a9e1c27a461bfd2e (diff)
Initial version of QtDataVis3D
Includes: - initial version of q3dbars - an example using it
Diffstat (limited to 'src/datavis3d/engine/q3dbars.h')
-rw-r--r--src/datavis3d/engine/q3dbars.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/datavis3d/engine/q3dbars.h b/src/datavis3d/engine/q3dbars.h
new file mode 100644
index 00000000..c67d0ee9
--- /dev/null
+++ b/src/datavis3d/engine/q3dbars.h
@@ -0,0 +1,60 @@
+#ifndef Q3DBARS_H
+#define Q3DBARS_H
+
+#include "qdatavis3dglobal.h"
+#include "q3dwindow.h"
+
+class QOpenGLShaderProgram;
+
+QTCOMMERCIALDATAVIS3D_BEGIN_NAMESPACE
+
+class Q3DBarsPrivate;
+
+class QTCOMMERCIALDATAVIS3D_EXPORT Q3DBars : public Q3DWindow
+{
+ Q_OBJECT
+public:
+ enum BarStyle {
+ Bars = 0,
+ Pyramids,
+ Cones,
+ Cylinders,
+ Apes // TODO: remove; inserted now just for fun
+ };
+
+public:
+ explicit Q3DBars();
+ ~Q3DBars();
+
+ void initialize();
+ void render();
+
+ void addDataSet(QVector<float> data);
+ // 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(QPointF thickness = QPointF(1.0f, 1.0f)
+ , QPointF spacing = QPointF(1.0f, 1.0f)
+ , bool relative = true);
+ // bar type; bars (=cubes), pyramids, cones, cylinders, etc.
+ void setBarType(BarStyle style, bool smooth = false);
+ // override bar type with own mesh
+ void setMeshFileName(const QString &objFileName);
+ // how many samples per row and column
+ void setupSampleSpace(QPoint sampleCount);
+
+protected:
+ void mousePressEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+ void wheelEvent(QWheelEvent *event);
+ void resizeEvent(QResizeEvent *event);
+
+private:
+ QScopedPointer<Q3DBarsPrivate> d_ptr;
+ Q_DISABLE_COPY(Q3DBars)
+};
+
+QTCOMMERCIALDATAVIS3D_END_NAMESPACE
+
+#endif