From af85378b6361d3252d00c5eaea679d031759a2d2 Mon Sep 17 00:00:00 2001 From: Mika Salmela Date: Fri, 4 Oct 2013 11:59:36 +0300 Subject: 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 --- examples/surface/surfacegraph.h | 81 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 examples/surface/surfacegraph.h (limited to 'examples/surface/surfacegraph.h') 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 +#include +#include +#include + +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 -- cgit v1.2.3