summaryrefslogtreecommitdiffstats
path: root/examples/datavisualization/texturesurface/doc/src/texturesurface.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/datavisualization/texturesurface/doc/src/texturesurface.qdoc')
-rw-r--r--examples/datavisualization/texturesurface/doc/src/texturesurface.qdoc53
1 files changed, 37 insertions, 16 deletions
diff --git a/examples/datavisualization/texturesurface/doc/src/texturesurface.qdoc b/examples/datavisualization/texturesurface/doc/src/texturesurface.qdoc
index a4aa219e..483b8110 100644
--- a/examples/datavisualization/texturesurface/doc/src/texturesurface.qdoc
+++ b/examples/datavisualization/texturesurface/doc/src/texturesurface.qdoc
@@ -21,14 +21,15 @@
\title Textured Surface Example
\ingroup qtdatavisualization_examples
\brief Using texture with Q3DSurface.
+ \since QtDataVisualization 1.2
The textured surface example shows how to add an image as a texture for a surface. The example
shows also how to:
\list
\li Create a surface series from an image
- \li Highlight an area of the surface
\li Use custom input handler to enable zooming and panning
+ \li Highlight an area of the surface
\endlist
\image texturesurface-example.png
@@ -64,6 +65,28 @@
And then the actual decoding.
\snippet texturesurface/topographicseries.cpp 1
+ \section1 Use custom input handler to enable zooming and panning
+
+ For the panning the implementation is similar to the \l{Axis Range Dragging With Labels Example}.
+ The difference is that in this example we follow only dragging of X and Z axis and we don't
+ allow dragging the surface outside the graph. The control for this is very simple and done as
+ on the following example for the X axis.
+
+ \snippet texturesurface/custominputhandler.cpp 0
+
+ For the zooming we catch the \c wheelEvent and adjust the X and Y axis ranges according to delta
+ value on QWheelEvent. The Y axis is also adjusted so that the aspect ratio between Y axis and
+ XZ plane stays the same, and we don't get silly looking graph with height exaggerated too much.
+
+ \snippet texturesurface/custominputhandler.cpp 1
+
+ In this case we want to control the zoom level so that it won't get too near to or far from the
+ surface. For instance, if the value for the X axis gets below the allowed, i.e. zooming gets too
+ far, the value is set to the minimum allowed value. If the range is going to below the range
+ minimum, both ends of the axis are adjusted so that the range stays at the limit.
+
+ \snippet texturesurface/custominputhandler.cpp 2
+
\section1 Highlight an area of the surface
The main idea on creating a highlight on the surface is to create a copy of the series and add
@@ -81,25 +104,23 @@
\snippet texturesurface/highlightseries.cpp 1
- \section1 Use custom input handler to enable zooming and panning
+ \section1 A gradient to the highlight series
- For the panning the implementation is similar to the \l{Axis Range Dragging With Labels Example}.
- The difference is that in this example we follow only dragging of X and Z axis and we don't
- allow dragging the surface outside the graph. The control for this is very simple and done as
- on the following example for the X axis.
+ Since the \c HighlightSeries is QSurface3DSeries, we can use all the decoration methods series can
+ have. In this example we added a gradient to emphasize the elevation. Because the suitable gradient
+ style depends on the range of the Y axis and we change the range when zooming, we need to adjust
+ the gradient color positions as the range change.
- \snippet texturesurface/custominputhandler.cpp 0
+ For the gradient color positions we define proportional values.
- For the zooming we catch the \c wheelEvent and adjust the X and Y axis ranges according to delta
- value on QWheelEvent. The Y axis is also adjusted so that the aspect ratio between Y axis and
- XZ plane stays the same, and we don't get silly looking graph with height exaggerated too much.
+ \snippet texturesurface/highlightseries.cpp 2
- \snippet texturesurface/custominputhandler.cpp 1
+ The gradient modification is done on \c handleGradientChange method and we connect it to react to
+ changes on Y axis.
- In this case we want to control the zoom level so that it won't get too near to or far from the
- surface. For instance, if the value for the X axis gets below the allowed, i.e. zooming gets too
- far, the value is set to the minimum allowed value. If the range is going to below the range
- minimum, both ends of the axis are adjusted so that the range stays at the limit.
+ \snippet texturesurface/surfacegraph.cpp 1
- \snippet texturesurface/custominputhandler.cpp 2
+ When a change on Y axis max value happens, we calculate the gradient color positions.
+
+ \snippet texturesurface/highlightseries.cpp 3
*/