diff options
author | Mika Salmela <mika.salmela@digia.com> | 2013-10-04 11:59:36 +0300 |
---|---|---|
committer | Mika Salmela <mika.salmela@digia.com> | 2013-10-04 12:30:00 +0300 |
commit | af85378b6361d3252d00c5eaea679d031759a2d2 (patch) | |
tree | e4983117c34b0548dcfee622e3efe96e1af821d0 /examples/surface/surfacegraph.h | |
parent | ad44f9774e8da73a5d3df80b3691adae9376abce (diff) |
Basic example of surface
Changes in latest patch:
- Sqrt&Sin model on top and default
- Digia style default
Task-number: QTRD-2347
Change-Id: Id405867f0f1ba243b0032dda670f609810f5837c
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'examples/surface/surfacegraph.h')
-rw-r--r-- | examples/surface/surfacegraph.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/examples/surface/surfacegraph.h b/examples/surface/surfacegraph.h new file mode 100644 index 00000000..8da84e38 --- /dev/null +++ b/examples/surface/surfacegraph.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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(); + + 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); } + + 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 |