summaryrefslogtreecommitdiffstats
path: root/examples/surface/surfacegraph.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/surface/surfacegraph.h')
-rw-r--r--examples/surface/surfacegraph.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/examples/surface/surfacegraph.h b/examples/surface/surfacegraph.h
new file mode 100644
index 00000000..ac297bf6
--- /dev/null
+++ b/examples/surface/surfacegraph.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** 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 SURFACEGRAPH_H
+#define SURFACEGRAPH_H
+
+#include <QtDataVisualization/Q3DSurface>
+#include <QtDataVisualization/QSurfaceDataProxy>
+#include <QtDataVisualization/QHeightMapSurfaceDataProxy>
+#include <QtWidgets/QSlider>
+
+using namespace QtDataVisualization;
+
+class SurfaceGraph : public QObject
+{
+ Q_OBJECT
+public:
+ explicit SurfaceGraph(Q3DSurface *surface);
+ ~SurfaceGraph();
+
+ void enableHeightMapModel();
+ void enableSqrtSinModel();
+
+ //! [0]
+ void toggleModeNone() { m_graph->setSelectionMode(QDataVis::SelectionModeNone); }
+ void toggleModeItem() { m_graph->setSelectionMode(QDataVis::SelectionModeItem); }
+ void toggleModeSliceRow() { m_graph->setSelectionMode(QDataVis::SelectionModeSliceRow); }
+ void toggleModeSliceColumn() { m_graph->setSelectionMode(QDataVis::SelectionModeSliceColumn); }
+ //! [0]
+
+ void setBlackToYellowGradient();
+ void setGreenToRedGradient();
+
+ void setAxisMinSliderX(QSlider *slider) { m_axisMinSliderX = slider; }
+ void setAxisMaxSliderX(QSlider *slider) { m_axisMaxSliderX = slider; }
+ void setAxisMinSliderZ(QSlider *slider) { m_axisMinSliderZ = slider; }
+ void setAxisMaxSliderZ(QSlider *slider) { m_axisMaxSliderZ = slider; }
+
+ void adjustXMin(int min);
+ void adjustXMax(int max);
+ void adjustZMin(int min);
+ void adjustZMax(int max);
+
+public slots:
+ void changeTheme(int theme);
+
+private:
+ Q3DSurface *m_graph;
+ QHeightMapSurfaceDataProxy *m_heightMapProxy;
+ QSurfaceDataProxy *sqrtSinProxy;
+
+ QSlider *m_axisMinSliderX;
+ QSlider *m_axisMaxSliderX;
+ QSlider *m_axisMinSliderZ;
+ QSlider *m_axisMaxSliderZ;
+ qreal m_rangeMinX;
+ qreal m_rangeMinZ;
+ qreal m_stepX;
+ qreal m_stepZ;
+ int m_heightMapWidth;
+ int m_heightMapHeight;
+
+ void setAxisXRange(qreal min, qreal max);
+ void setAxisZRange(qreal min, qreal max);
+ void fillSqrtSinProxy();
+};
+
+#endif // SURFACEGRAPH_H