diff options
Diffstat (limited to 'examples/datavisualization/qmlsurfacelayers')
-rw-r--r-- | examples/datavisualization/qmlsurfacelayers/CMakeLists.txt | 64 | ||||
-rw-r--r-- | examples/datavisualization/qmlsurfacelayers/doc/images/qmlsurfacelayers-example.png | bin | 91579 -> 0 bytes | |||
-rw-r--r-- | examples/datavisualization/qmlsurfacelayers/doc/src/qmlsurfacelayers.qdoc | 91 | ||||
-rw-r--r-- | examples/datavisualization/qmlsurfacelayers/layer_1.png | bin | 34540 -> 0 bytes | |||
-rw-r--r-- | examples/datavisualization/qmlsurfacelayers/layer_2.png | bin | 10563 -> 0 bytes | |||
-rw-r--r-- | examples/datavisualization/qmlsurfacelayers/layer_3.png | bin | 13022 -> 0 bytes | |||
-rw-r--r-- | examples/datavisualization/qmlsurfacelayers/main.cpp | 64 | ||||
-rw-r--r-- | examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml | 309 | ||||
-rw-r--r-- | examples/datavisualization/qmlsurfacelayers/qmlsurfacelayers.pro | 12 | ||||
-rw-r--r-- | examples/datavisualization/qmlsurfacelayers/qmlsurfacelayers.qrc | 10 |
10 files changed, 0 insertions, 550 deletions
diff --git a/examples/datavisualization/qmlsurfacelayers/CMakeLists.txt b/examples/datavisualization/qmlsurfacelayers/CMakeLists.txt deleted file mode 100644 index d011aa03..00000000 --- a/examples/datavisualization/qmlsurfacelayers/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(qmlsurfacelayers LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Qml) -find_package(Qt6 COMPONENTS Quick) -find_package(Qt6 COMPONENTS DataVisualization) - -qt_add_executable(qmlsurfacelayers - main.cpp -) -set_target_properties(qmlsurfacelayers PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) -target_link_libraries(qmlsurfacelayers PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick - Qt::DataVisualization -) - -set(qmlsurfacelayers_resource_files - "qml/qmlsurfacelayers/main.qml" -) - -qt6_add_resources(qmlsurfacelayers "qmlsurfacelayers" - PREFIX - "/" - FILES - ${qmlsurfacelayers_resource_files} -) -set(qmlsurfacelayers1_resource_files - "layer_1.png" - "layer_2.png" - "layer_3.png" -) - -qt6_add_resources(qmlsurfacelayers "qmlsurfacelayers1" - PREFIX - "/heightmaps" - FILES - ${qmlsurfacelayers1_resource_files} -) - -install(TARGETS qmlsurfacelayers - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/datavisualization/qmlsurfacelayers/doc/images/qmlsurfacelayers-example.png b/examples/datavisualization/qmlsurfacelayers/doc/images/qmlsurfacelayers-example.png Binary files differdeleted file mode 100644 index c5a48fcb..00000000 --- a/examples/datavisualization/qmlsurfacelayers/doc/images/qmlsurfacelayers-example.png +++ /dev/null diff --git a/examples/datavisualization/qmlsurfacelayers/doc/src/qmlsurfacelayers.qdoc b/examples/datavisualization/qmlsurfacelayers/doc/src/qmlsurfacelayers.qdoc deleted file mode 100644 index f2cbd2c9..00000000 --- a/examples/datavisualization/qmlsurfacelayers/doc/src/qmlsurfacelayers.qdoc +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example qmlsurfacelayers - \title Qt Quick 2 Surface Multiseries Example - \ingroup qtdatavisualization_examples - \brief Using multiple series with Surface3D in a QML application. - - The Qt Quick 2 surface example shows how to make a 3D surface plot displaying 3 layers using - Surface3D with Qt Quick 2. - - \image qmlsurfacelayers-example.png - - The focus in this example is on generating a multiseries surface plot from 3 different height - map images, so in this section we skip explaining the application creation. For a more detailed - QML example documentation, see \l{Qt Quick 2 Scatter Example}. - - \include examples-run.qdocinc - - \section1 Adding Data to the Graph - - This example shows how to add several surface series to one graph using using - HeightMapSurfaceDataProxies and how to control their visibilities individually. - - Let's start by creating a specific gradient for each layer: - - \snippet qmlsurfacelayers/qml/qmlsurfacelayers/main.qml 0 - - Then we'll create the series themselves. It happens simply by adding 3 separate Surface3DSeries - to the Surface3D graph as children: - - \dots 0 - \snippet qmlsurfacelayers/qml/qmlsurfacelayers/main.qml 1 - \dots 0 - - You'll notice we added the created gradients to the \c baseGradient properties of the series. - We could have added them to the \c baseGradients property of the Theme3D in Surface3D instead, - but doing it this way ensures each gradient is applied to a correct series: - - \snippet qmlsurfacelayers/qml/qmlsurfacelayers/main.qml 2 - \dots - - \section1 Controlling the Graph - - Let's add some checkboxes to control the visibility of layers: - - \snippet qmlsurfacelayers/qml/qmlsurfacelayers/main.qml 3 - - We don't need to do anything on the \c onCheckedChanged as we bound the \c checked state to - the \c visible property of the series directly: - - \dots 0 - \snippet qmlsurfacelayers/qml/qmlsurfacelayers/main.qml 4 - \dots 0 - - Let's add some more checkboxes to control how the layers are displayed, when visible: - - \snippet qmlsurfacelayers/qml/qmlsurfacelayers/main.qml 5 - - In addition to these we have three buttons, one of which is of special interest to us. It is - used to control whether we want to slice into only one layer, or all of them: - - \snippet qmlsurfacelayers/qml/qmlsurfacelayers/main.qml 6 - - \section1 Example Contents -*/ diff --git a/examples/datavisualization/qmlsurfacelayers/layer_1.png b/examples/datavisualization/qmlsurfacelayers/layer_1.png Binary files differdeleted file mode 100644 index 9138c710..00000000 --- a/examples/datavisualization/qmlsurfacelayers/layer_1.png +++ /dev/null diff --git a/examples/datavisualization/qmlsurfacelayers/layer_2.png b/examples/datavisualization/qmlsurfacelayers/layer_2.png Binary files differdeleted file mode 100644 index 3af154e2..00000000 --- a/examples/datavisualization/qmlsurfacelayers/layer_2.png +++ /dev/null diff --git a/examples/datavisualization/qmlsurfacelayers/layer_3.png b/examples/datavisualization/qmlsurfacelayers/layer_3.png Binary files differdeleted file mode 100644 index 796df64d..00000000 --- a/examples/datavisualization/qmlsurfacelayers/layer_3.png +++ /dev/null diff --git a/examples/datavisualization/qmlsurfacelayers/main.cpp b/examples/datavisualization/qmlsurfacelayers/main.cpp deleted file mode 100644 index 383e68ef..00000000 --- a/examples/datavisualization/qmlsurfacelayers/main.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtDataVisualization/qutils.h> - -#include <QtGui/QGuiApplication> -#include <QtCore/QDir> -#include <QtQuick/QQuickView> -#include <QtQml/QQmlEngine> - -int main(int argc, char *argv[]) -{ - qputenv("QSG_RHI_BACKEND", "opengl"); - QGuiApplication app(argc, argv); - - QQuickView viewer; - - // Enable antialiasing in direct rendering mode - viewer.setFormat(qDefaultSurfaceFormat(true)); - - // The following are needed to make examples run without having to install the module - // in desktop environments. -#ifdef Q_OS_WIN - QString extraImportPath(QStringLiteral("%1/../../../../%2")); -#else - QString extraImportPath(QStringLiteral("%1/../../../%2")); -#endif - viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), - QString::fromLatin1("qml"))); - - viewer.setSource(QUrl("qrc:/qml/qmlsurfacelayers/main.qml")); - - viewer.setTitle(QStringLiteral("3-layered Terrain")); - viewer.setResizeMode(QQuickView::SizeRootObjectToView); - viewer.show(); - - return app.exec(); -} diff --git a/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml b/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml deleted file mode 100644 index b6595bf6..00000000 --- a/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml +++ /dev/null @@ -1,309 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick -import QtQuick.Layouts -import QtQuick.Controls -import QtDataVisualization 1.2 -import "." - -Item { - id: mainview - width: 1280 - height: 720 - - property real fontSize: 12 - - Item { - id: surfaceView - width: mainview.width - buttonLayout.width - height: mainview.height - anchors.right: mainview.right; - - //! [0] - ColorGradient { - id: layerOneGradient - ColorGradientStop { position: 0.0; color: "black" } - ColorGradientStop { position: 0.31; color: "tan" } - ColorGradientStop { position: 0.32; color: "green" } - ColorGradientStop { position: 0.40; color: "darkslategray" } - ColorGradientStop { position: 1.0; color: "white" } - } - - ColorGradient { - id: layerTwoGradient - ColorGradientStop { position: 0.315; color: "blue" } - ColorGradientStop { position: 0.33; color: "white" } - } - - ColorGradient { - id: layerThreeGradient - ColorGradientStop { position: 0.0; color: "red" } - ColorGradientStop { position: 0.15; color: "black" } - } - //! [0] - - Surface3D { - id: surfaceLayers - width: surfaceView.width - height: surfaceView.height - theme: Theme3D { - type: Theme3D.ThemeEbony - font.pointSize: 35 - colorStyle: Theme3D.ColorStyleRangeGradient - } - shadowQuality: AbstractGraph3D.ShadowQualityNone - selectionMode: AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice - scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeft - axisY.min: 20 - axisY.max: 200 - axisX.segmentCount: 5 - axisX.subSegmentCount: 2 - axisX.labelFormat: "%i" - axisZ.segmentCount: 5 - axisZ.subSegmentCount: 2 - axisZ.labelFormat: "%i" - axisY.segmentCount: 5 - axisY.subSegmentCount: 2 - axisY.labelFormat: "%i" - - //! [1] - //! [2] - Surface3DSeries { - id: layerOneSeries - baseGradient: layerOneGradient - //! [2] - HeightMapSurfaceDataProxy { - heightMapFile: ":/heightmaps/layer_1.png" - } - flatShadingEnabled: false - drawMode: Surface3DSeries.DrawSurface - //! [4] - visible: layerOneToggle.checked // bind to checkbox state - //! [4] - } - - Surface3DSeries { - id: layerTwoSeries - baseGradient: layerTwoGradient - HeightMapSurfaceDataProxy { - heightMapFile: ":/heightmaps/layer_2.png" - } - flatShadingEnabled: false - drawMode: Surface3DSeries.DrawSurface - visible: layerTwoToggle.checked // bind to checkbox state - } - - Surface3DSeries { - id: layerThreeSeries - baseGradient: layerThreeGradient - HeightMapSurfaceDataProxy { - heightMapFile: ":/heightmaps/layer_3.png" - } - flatShadingEnabled: false - drawMode: Surface3DSeries.DrawSurface - visible: layerThreeToggle.checked // bind to checkbox state - } - //! [1] - } - } - - ColumnLayout { - id: buttonLayout - anchors.top: parent.top - anchors.left: parent.left - spacing: 0 - - //! [3] - GroupBox { - Layout.fillWidth: true - Column { - spacing: 10 - - Label { - font.pointSize: fontSize - font.bold: true - text: "Layer Selection" - } - - CheckBox { - id: layerOneToggle - checked: true - text: "Show Ground Layer" - } - - CheckBox { - id: layerTwoToggle - checked: true - text: "Show Sea Layer" - } - - CheckBox { - id: layerThreeToggle - checked: true - text: "Show Tectonic Layer" - } - } - } - //! [3] - - //! [5] - GroupBox { - Layout.fillWidth: true - Column { - spacing: 10 - - Label { - font.pointSize: fontSize - font.bold: true - text: "Layer Style" - } - - CheckBox { - id: layerOneGrid - text: "Show Ground as Grid" - onCheckedChanged: { - if (checked) - layerOneSeries.drawMode = Surface3DSeries.DrawWireframe - else - layerOneSeries.drawMode = Surface3DSeries.DrawSurface - } - } - - CheckBox { - id: layerTwoGrid - text: "Show Sea as Grid" - - onCheckedChanged: { - if (checked) - layerTwoSeries.drawMode = Surface3DSeries.DrawWireframe - else - layerTwoSeries.drawMode = Surface3DSeries.DrawSurface - } - } - - CheckBox { - id: layerThreeGrid - text: "Show Tectonic as Grid" - onCheckedChanged: { - if (checked) - layerThreeSeries.drawMode = Surface3DSeries.DrawWireframe - else - layerThreeSeries.drawMode = Surface3DSeries.DrawSurface - } - } - } - } - //! [5] - - //! [6] - Button { - id: sliceButton - text: "Slice All Layers" - Layout.fillWidth: true - Layout.minimumHeight: 40 - onClicked: { - if (surfaceLayers.selectionMode & AbstractGraph3D.SelectionMultiSeries) { - surfaceLayers.selectionMode = AbstractGraph3D.SelectionRow - | AbstractGraph3D.SelectionSlice - text = "Slice All Layers" - } else { - surfaceLayers.selectionMode = AbstractGraph3D.SelectionRow - | AbstractGraph3D.SelectionSlice - | AbstractGraph3D.SelectionMultiSeries - text = "Slice One Layer" - } - } - } - //! [6] - - Button { - id: shadowButton - Layout.fillWidth: true - Layout.minimumHeight: 40 - text: surfaceLayers.shadowsSupported ? "Show Shadows" : "Shadows not supported" - enabled: surfaceLayers.shadowsSupported - onClicked: { - if (surfaceLayers.shadowQuality === AbstractGraph3D.ShadowQualityNone) { - surfaceLayers.shadowQuality = AbstractGraph3D.ShadowQualityLow - text = "Hide Shadows" - } else { - surfaceLayers.shadowQuality = AbstractGraph3D.ShadowQualityNone - text = "Show Shadows" - } - } - } - - Button { - id: renderModeButton - text: "Switch Render Mode" - Layout.fillWidth: true - Layout.minimumHeight: 40 - onClicked: { - var modeText = "Indirect " - var aaText - if (surfaceLayers.renderingMode === AbstractGraph3D.RenderIndirect && - surfaceLayers.msaaSamples === 0) { - surfaceLayers.renderingMode = AbstractGraph3D.RenderDirectToBackground - modeText = "BackGround " - } else if (surfaceLayers.renderingMode === AbstractGraph3D.RenderIndirect && - surfaceLayers.msaaSamples === 4) { - surfaceLayers.renderingMode = AbstractGraph3D.RenderIndirect - surfaceLayers.msaaSamples = 0 - } else if (surfaceLayers.renderingMode === AbstractGraph3D.RenderIndirect && - surfaceLayers.msaaSamples === 8) { - surfaceLayers.renderingMode = AbstractGraph3D.RenderIndirect - surfaceLayers.msaaSamples = 4 - } else { - surfaceLayers.renderingMode = AbstractGraph3D.RenderIndirect - surfaceLayers.msaaSamples = 8 - } - - if (surfaceLayers.msaaSamples <= 0) { - aaText = "No AA" - } else { - aaText = surfaceLayers.msaaSamples + "xMSAA" - } - - renderLabel.text = modeText + aaText - } - } - - TextField { - id: renderLabel - font.pointSize: fontSize - Layout.fillWidth: true - Layout.minimumHeight: 40 - color: "gray" - enabled: false - horizontalAlignment: TextInput.AlignHCenter - text: "Indirect, " + surfaceLayers.msaaSamples + "xMSAA" - } - } -} diff --git a/examples/datavisualization/qmlsurfacelayers/qmlsurfacelayers.pro b/examples/datavisualization/qmlsurfacelayers/qmlsurfacelayers.pro deleted file mode 100644 index 2bfa904d..00000000 --- a/examples/datavisualization/qmlsurfacelayers/qmlsurfacelayers.pro +++ /dev/null @@ -1,12 +0,0 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} - -# The .cpp file which was generated for your project. Feel free to hack it. -SOURCES += main.cpp - -RESOURCES += qmlsurfacelayers.qrc - -OTHER_FILES += doc/src/* \ - doc/images/* \ - qml/qmlsurfacelayers/* diff --git a/examples/datavisualization/qmlsurfacelayers/qmlsurfacelayers.qrc b/examples/datavisualization/qmlsurfacelayers/qmlsurfacelayers.qrc deleted file mode 100644 index 71c2ea33..00000000 --- a/examples/datavisualization/qmlsurfacelayers/qmlsurfacelayers.qrc +++ /dev/null @@ -1,10 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>qml/qmlsurfacelayers/main.qml</file> - </qresource> - <qresource prefix="/heightmaps"> - <file>layer_1.png</file> - <file>layer_2.png</file> - <file>layer_3.png</file> - </qresource> -</RCC> |