diff options
39 files changed, 1389 insertions, 240 deletions
diff --git a/examples/barchart/doc/images/barchart-example.png b/examples/barchart/doc/images/barchart-example.png Binary files differnew file mode 100644 index 00000000..0f321c95 --- /dev/null +++ b/examples/barchart/doc/images/barchart-example.png diff --git a/examples/barchart/doc/src/barchart.qdoc b/examples/barchart/doc/src/barchart.qdoc new file mode 100644 index 00000000..498388bb --- /dev/null +++ b/examples/barchart/doc/src/barchart.qdoc @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the QtDataVis3D module. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example barchart + \title Barchart Example + + The barchart example shows how to make a simple 3D bar chart using Q3DBars. + + \image barchart-example.png + + TODO +*/ diff --git a/examples/barchart/main.cpp b/examples/barchart/main.cpp index f2862bfd..6887bb0b 100644 --- a/examples/barchart/main.cpp +++ b/examples/barchart/main.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the documentation of the QtDataVis3D module. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: diff --git a/examples/mapdata/doc/images/mapdata-example.png b/examples/mapdata/doc/images/mapdata-example.png Binary files differnew file mode 100644 index 00000000..8bd8fc18 --- /dev/null +++ b/examples/mapdata/doc/images/mapdata-example.png diff --git a/examples/mapdata/doc/src/mapdata.qdoc b/examples/mapdata/doc/src/mapdata.qdoc new file mode 100644 index 00000000..be424509 --- /dev/null +++ b/examples/mapdata/doc/src/mapdata.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the QtDataVis3D module. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example mapdata + \title Mapdata Example + + The mapdata example shows how to make a simple 3D maps visualization using Q3DMaps and + combining the use of widgets for adjusting several adjustable qualities. + + \image mapdata-example.png + + TODO +*/ diff --git a/examples/qmlbarchart/doc/src/qmlbarchart.qdoc b/examples/qmlbarchart/doc/src/qmlbarchart.qdoc new file mode 100644 index 00000000..42bb05aa --- /dev/null +++ b/examples/qmlbarchart/doc/src/qmlbarchart.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the QtDataVis3D module. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example qmlbarchart + \title Qt Quick 2 Barchart Example + + The Qt Quick 2 barchart example shows how to make a simple 3D bar chart using Q3DBars using Qt + Quick 2. + + \image qmlbarchart-example.png + + TODO +*/ diff --git a/examples/rainfall/doc/images/rainfall-example.png b/examples/rainfall/doc/images/rainfall-example.png Binary files differnew file mode 100644 index 00000000..f4087927 --- /dev/null +++ b/examples/rainfall/doc/images/rainfall-example.png diff --git a/examples/rainfall/doc/src/rainfall.qdoc b/examples/rainfall/doc/src/rainfall.qdoc new file mode 100644 index 00000000..b1a4d8e0 --- /dev/null +++ b/examples/rainfall/doc/src/rainfall.qdoc @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the QtDataVis3D module. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example rainfall + \title Rainfall Example + + The barchart example shows how to make a simple 3D bar chart using Q3DBars. + + \image rainfall-example.png + + TODO +*/ diff --git a/examples/spectrum/doc/images/spectrum-example.png b/examples/spectrum/doc/images/spectrum-example.png Binary files differnew file mode 100644 index 00000000..2a703948 --- /dev/null +++ b/examples/spectrum/doc/images/spectrum-example.png diff --git a/examples/spectrum/doc/src/spectrum.qdoc b/examples/spectrum/doc/src/spectrum.qdoc new file mode 100644 index 00000000..87028e9c --- /dev/null +++ b/examples/spectrum/doc/src/spectrum.qdoc @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the QtDataVis3D module. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example spectrum + \title Spectrum Example + + The spectrum example shows how feed dynamic data to a graph using Q3DBars. + + \image spectrum-example.png + + TODO +*/ diff --git a/examples/widget/doc/images/widget-example.png b/examples/widget/doc/images/widget-example.png Binary files differnew file mode 100644 index 00000000..4fb43b42 --- /dev/null +++ b/examples/widget/doc/images/widget-example.png diff --git a/examples/widget/doc/src/widget.qdoc b/examples/widget/doc/src/widget.qdoc new file mode 100644 index 00000000..d8790a60 --- /dev/null +++ b/examples/widget/doc/src/widget.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the QtDataVis3D module. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example widget + \title Widget Example + + The widget example shows how to make a 3D bar chart using Q3DBars and combining the use of + widgets for adjusting several adjustable qualities. + + \image widget-example.png + + TODO +*/ diff --git a/src/datavis3d/doc/images/q3dbars-minimal.png b/src/datavis3d/doc/images/q3dbars-minimal.png Binary files differnew file mode 100644 index 00000000..63b77998 --- /dev/null +++ b/src/datavis3d/doc/images/q3dbars-minimal.png diff --git a/src/datavis3d/doc/qtdatavis3d.qdocconf b/src/datavis3d/doc/qtdatavis3d.qdocconf index c2c084b3..c3fd9826 100644 --- a/src/datavis3d/doc/qtdatavis3d.qdocconf +++ b/src/datavis3d/doc/qtdatavis3d.qdocconf @@ -1,47 +1,33 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) -# Name of the project which must match the outputdir. Determines the .index file -project = qtdatavis3d +project = QtDataVis3D +description = Qt Data Visualization 3D Reference Documentation +version = 1.0.0 -# Directories in which to search for files to document and images. -# By default set to the root directory of the project for sources -# and headers and qdoc will therefore generate output for each file. -# Images should be placed in <rootdir>/dic/images and examples in -# <rootdir>/examples. -# Paths are relative to the location of this file. exampledirs += ../../../examples \ snippets headerdirs += .. -imagedirs += images +imagedirs += ../images \ + images sourcedirs += .. -depends += qtcore qtgui - -# The following parameters are for creating a qhp file, the qhelpgenerator -# program can convert the qhp file into a qch file which can be opened in -# Qt Assistant and/or Qt Creator. - -# Defines the name of the project. You cannot use operators (+, =, -) in -# the name. Properties for this project are set using a qhp.<projectname>.property -# format. -qhp.projects = qtdatavis3d - -# Sets the name of the output qhp file. -qhp.qtdatavis3d.file = qtdatavis3d.qhp - -# Namespace for the output file. This namespace is used to distinguish between -# different documentation files in Creator/Assistant. -qhp.qtdatavis3d.namespace = org.qt-project.qtdatavis3d.501 - -# Title for the package, will be the main title for the package in -# Assistant/Creator. -qhp.qtdatavis3d.indexTitle = Qt Data Visualization 3D - -# Only update the name of the project for the next variables. -qhp.qtdatavis3d.virtualFolder = qtdatavis3d -qhp.qtdatavis3d.subprojects = classes -qhp.qtdatavis3d.subprojects.classes.title = C++ Classes -qhp.qtdatavis3d.subprojects.classes.indexTitle = Qt Data Visualization 3D C++ Classes -qhp.qtdatavis3d.subprojects.classes.selectors = class fake:headerfile -qhp.qtdatavis3d.subprojects.classes.sortPages = true +depends += qtcore \ + qtgui + +qhp.projects = QtDataVis3D + +qhp.qtdatavis3d.file = qtdatavis3d.qhp +qhp.qtdatavis3d.namespace = org.qt-project.qtdatavis3d.1.0.0 +qhp.qtdatavis3d.virtualFolder = qtdatavis3d +qhp.qtdatavis3d.indexTitle = Qt Data Visualization 3D +qhp.qtdatavis3d.indexRoot = + +qhp.qtdatavis3d.filterAttributes = qtdatavis3d 1.0.0 qtrefdoc +qhp.qtdatavis3d.customFilters.Qt.name = QtDataVis3D 1.0.0 +qhp.qtdatavis3d.customFilters.Qt.filterAttributes = qtdatavis3d 1.0.0 +qhp.qtdatavis3d.subprojects = classes +qhp.qtdatavis3d.subprojects.classes.title = C++ Classes +qhp.qtdatavis3d.subprojects.classes.indexTitle = Qt Data Visualization 3D C++ Classes +qhp.qtdatavis3d.subprojects.classes.selectors = class fake:headerfile +qhp.qtdatavis3d.subprojects.classes.sortPages = true diff --git a/src/datavis3d/doc/snippets/doc_src_q3dbars_construction.cpp b/src/datavis3d/doc/snippets/doc_src_q3dbars_construction.cpp new file mode 100644 index 00000000..0d94e0eb --- /dev/null +++ b/src/datavis3d/doc/snippets/doc_src_q3dbars_construction.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the QtDataVis3D module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [3] +#include <QtDataVis3D> + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + + //! [0] + Q3DBars bars; + bars.setupSampleSpace(5, 5); + //! [0] + //! [1] + QVector<float> data; + data << 1.0f << 3.0f << 7.5f << 5.0f << 2.2f; + bars.addDataRow(data); + //! [1] + //! [2] + bars.show(); + //! [2] + + return app.exec(); +} +//! [3] diff --git a/src/datavis3d/doc/snippets/doc_src_qtdatavis3d.cpp b/src/datavis3d/doc/snippets/doc_src_qtdatavis3d.cpp new file mode 100644 index 00000000..ac2f7f40 --- /dev/null +++ b/src/datavis3d/doc/snippets/doc_src_qtdatavis3d.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDataVis3D module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +#include <QtDataVis3D> +//! [0] diff --git a/src/datavis3d/doc/snippets/doc_src_qtdatavis3d.pro b/src/datavis3d/doc/snippets/doc_src_qtdatavis3d.pro new file mode 100644 index 00000000..4b670157 --- /dev/null +++ b/src/datavis3d/doc/snippets/doc_src_qtdatavis3d.pro @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtDataVis3D module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#! [0] +QT += datavis3d +#! [0] diff --git a/src/datavis3d/doc/src/qtdatavis3d-index.qdoc b/src/datavis3d/doc/src/qtdatavis3d-index.qdoc new file mode 100644 index 00000000..0c9cf8cc --- /dev/null +++ b/src/datavis3d/doc/src/qtdatavis3d-index.qdoc @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the QtDataVis3D module. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Data Visualization 3D + \page qtdatavis3d-index.html + \brief QtDataVis3D module provides functionality for 3D visualization. + + Qt Data Visualization module provides a way to visualize data in 3D. + It uses OpneGL for the data rendering. + + \section1 Getting Started + + Qt Data Visualization provides classes for rendering 3D data. To include + the definitions of the module's classes, use the following directive: + + \snippet doc_src_qtdatavis3d.cpp 0 + + To link against the module, add this line to your \l qmake \c + .pro file: + + \snippet doc_src_qtdatavis3d.pro 0 + + \section1 Articles + \list + \li \l{Qt Data Visualization 3D License Information}{License Information} + \endlist + + \section1 References + \list + \li \l{Qt Data Visualization 3D C++ Classes} + \endlist + + Qt Data Visualization 3D comes with the following examples: + + \list + \li \l{Barchart Example} + \li \l{Mapdata Example} + \li \l{Qt Quick 2 Barchart Example} + \li \l{Rainfall Example} + \li \l{Spectrum Example} + \li \l{Widget Example} + \endlist +*/ diff --git a/src/datavis3d/doc/src/qtdatavis3d.qdoc b/src/datavis3d/doc/src/qtdatavis3d.qdoc new file mode 100644 index 00000000..37e53161 --- /dev/null +++ b/src/datavis3d/doc/src/qtdatavis3d.qdoc @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the QtDataVis3D module. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \module QtDataVis3D + \title Qt Data Visualization 3D C++ Classes + \ingroup modules + + \brief The QtDataVis3D module provides functionality for 3D visualization. +*/ + diff --git a/src/datavis3d/doc/src/qtdatavis3dlicense.qdoc b/src/datavis3d/doc/src/qtdatavis3dlicense.qdoc new file mode 100644 index 00000000..9821b26f --- /dev/null +++ b/src/datavis3d/doc/src/qtdatavis3dlicense.qdoc @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt SVG module. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtdatavis3dlicense.html + \title Qt Data Visualization 3D License Information + \ingroup licensing + \brief License information for Qt Data Visualization 3D + + TODO + + \legalese + TODO + \endlegalese + +*/ diff --git a/src/datavis3d/engine/bars3dshared.cpp b/src/datavis3d/engine/bars3dshared.cpp index 95af0056..55efb7cc 100644 --- a/src/datavis3d/engine/bars3dshared.cpp +++ b/src/datavis3d/engine/bars3dshared.cpp @@ -215,48 +215,53 @@ void Bars3dShared::initializeOpenGL() if (m_isInitialized) return; + initializeOpenGLFunctions(); + m_textureHelper = new TextureHelper(); m_drawer->initializeOpenGL(); + // Resize in case we've missed resize events + resizeNotify(); + // Initialize shaders #if !defined(QT_OPENGL_ES_2) if (m_shadowQuality > ShadowNone) { if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertexShadow"), - QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY")); + QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY")); } else { initShaders(QStringLiteral(":/shaders/vertexShadow"), - QStringLiteral(":/shaders/fragmentShadowNoTex")); + QStringLiteral(":/shaders/fragmentShadowNoTex")); } initBackgroundShaders(QStringLiteral(":/shaders/vertexShadow"), - QStringLiteral(":/shaders/fragmentShadowNoTex")); + QStringLiteral(":/shaders/fragmentShadowNoTex")); // Init the depth buffer (for shadows) initDepthBuffer(); } else { if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertex"), - QStringLiteral(":/shaders/fragmentColorOnY")); + QStringLiteral(":/shaders/fragmentColorOnY")); } else { initShaders(QStringLiteral(":/shaders/vertex"), - QStringLiteral(":/shaders/fragment")); + QStringLiteral(":/shaders/fragment")); } initBackgroundShaders(QStringLiteral(":/shaders/vertex"), - QStringLiteral(":/shaders/fragment")); + QStringLiteral(":/shaders/fragment")); } #else if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentColorOnYES2")); + QStringLiteral(":/shaders/fragmentColorOnYES2")); } else { initShaders(QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentES2")); + QStringLiteral(":/shaders/fragmentES2")); } initBackgroundShaders(QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentES2")); + QStringLiteral(":/shaders/fragmentES2")); #endif initLabelShaders(QStringLiteral(":/shaders/vertexLabel"), - QStringLiteral(":/shaders/fragmentLabel")); + QStringLiteral(":/shaders/fragmentLabel")); #if !defined(QT_OPENGL_ES_2) // Init depth shader (for shadows). Init in any case, easier to handle shadow activation if done via api. @@ -419,12 +424,12 @@ void Bars3dShared::drawZoomScene() m_barShader->setUniformValue(m_barShader->view(), viewMatrix); m_barShader->setUniformValue(m_barShader->model(), modelMatrix); m_barShader->setUniformValue(m_barShader->nModel(), - itModelMatrix.inverted().transposed()); + itModelMatrix.inverted().transposed()); m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix); m_barShader->setUniformValue(m_barShader->color(), barColor); m_barShader->setUniformValue(m_barShader->lightS(), lightStrength); m_barShader->setUniformValue(m_barShader->ambientS(), - m_theme->m_ambientStrength); + m_theme->m_ambientStrength); // Draw the object m_drawer->drawObject(m_barShader, m_barObj); @@ -453,42 +458,42 @@ void Bars3dShared::drawZoomScene() LabelItem zoomSelectionLabel = m_zoomSelection->d_ptr->labelItem(); if (ModeZoomRow == m_selectionMode) { m_drawer->drawLabel(*dummyItem, zoomSelectionLabel, viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, - m_selectionMode, m_labelShader, - m_labelObj, false, false, LabelTop); + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, + m_selectionMode, m_labelShader, + m_labelObj, false, false, LabelTop); m_drawer->drawLabel(*dummyItem, z, viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, - m_selectionMode, m_labelShader, - m_labelObj, false, false, LabelBottom); + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, + m_selectionMode, m_labelShader, + m_labelObj, false, false, LabelBottom); } else { m_drawer->drawLabel(*dummyItem, x, viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, - m_selectionMode, m_labelShader, - m_labelObj, false, false, LabelBottom); + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, + m_selectionMode, m_labelShader, + m_labelObj, false, false, LabelBottom); m_drawer->drawLabel(*dummyItem, zoomSelectionLabel, viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, - m_selectionMode, m_labelShader, - m_labelObj, false, false, LabelTop); + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, + m_selectionMode, m_labelShader, + m_labelObj, false, false, LabelTop); } m_drawer->drawLabel(*dummyItem, y, viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(0.0f, 0.0f, 90.0f), m_heightNormalizer, - m_selectionMode, m_labelShader, - m_labelObj, false, false, LabelLeft); + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(0.0f, 0.0f, 90.0f), m_heightNormalizer, + m_selectionMode, m_labelShader, + m_labelObj, false, false, LabelLeft); // Draw labels for bars for (int col = 0; col < m_zoomSelection->d_ptr->row().size(); col++) { QDataItem *item = m_zoomSelection->d_ptr->getItem(col); // Draw values m_drawer->drawLabel(*item, item->d_ptr->label(), viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, - m_selectionMode, m_labelShader, - m_labelObj); + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, + m_selectionMode, m_labelShader, + m_labelObj); // Draw labels LabelItem labelItem; if (ModeZoomRow == m_selectionMode) { @@ -513,10 +518,10 @@ void Bars3dShared::drawZoomScene() } } m_drawer->drawLabel(*item, labelItem, viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(0.0f, 0.0f, -45.0f), m_heightNormalizer, - m_selectionMode, m_labelShader, - m_labelObj, false, false, LabelBelow); + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(0.0f, 0.0f, -45.0f), m_heightNormalizer, + m_selectionMode, m_labelShader, + m_labelObj, false, false, LabelBelow); } glDisable(GL_TEXTURE_2D); @@ -722,7 +727,7 @@ void Bars3dShared::drawScene() QMatrix4x4 MVPMatrix = projectionMatrix * viewmatrix * modelMatrix; m_labelShader->setUniformValue(m_labelShader->MVP(), MVPMatrix); m_drawer->drawObject(m_labelShader, m_labelObj, - m_depthTexture); + m_depthTexture); glDisable(GL_TEXTURE_2D); m_labelShader->release(); #endif @@ -779,20 +784,20 @@ void Bars3dShared::drawScene() // TODO: Save position to qdataitem, so that we don't need to calculate it each time? -//#if !defined(QT_OPENGL_ES_2) -// QVector3D barColor = QVector3D((GLdouble)row / 32767.0, -// (GLdouble)bar / 32767.0, -// 0.0); -//#else + //#if !defined(QT_OPENGL_ES_2) + // QVector3D barColor = QVector3D((GLdouble)row / 32767.0, + // (GLdouble)bar / 32767.0, + // 0.0); + //#else QVector3D barColor = QVector3D((GLdouble)row / 255.0, (GLdouble)bar / 255.0, 0.0); -//#endif + //#endif m_selectionShader->setUniformValue(m_selectionShader->MVP(), - MVPMatrix); + MVPMatrix); m_selectionShader->setUniformValue(m_selectionShader->color(), - barColor); + barColor); #ifdef USE_HAX0R_SELECTION // 1st attribute buffer : vertices @@ -862,7 +867,7 @@ void Bars3dShared::drawScene() QMatrix4x4 MVPMatrix = projectionMatrix * viewmatrix * modelMatrix; m_labelShader->setUniformValue(m_labelShader->MVP(), MVPMatrix); m_drawer->drawObject(m_labelShader, m_labelObj, - m_selectionTexture); + m_selectionTexture); glDisable(GL_TEXTURE_2D); m_labelShader->release(); #endif @@ -931,7 +936,7 @@ void Bars3dShared::drawScene() GLfloat lightStrength = m_theme->m_lightStrength; if (m_selectionMode > ModeNone) { Bars3dShared::SelectionType selectionType = isSelected(row, bar, - selection); + selection); switch (selectionType) { case Bars3dShared::SelectionBar: { barColor = Utils::vectorFromColor(m_theme->m_highlightBarColor); @@ -1002,31 +1007,31 @@ void Bars3dShared::drawScene() m_barShader->setUniformValue(m_barShader->view(), viewMatrix); m_barShader->setUniformValue(m_barShader->model(), modelMatrix); m_barShader->setUniformValue(m_barShader->nModel(), - itModelMatrix.transposed().inverted()); + itModelMatrix.transposed().inverted()); m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix); m_barShader->setUniformValue(m_barShader->color(), barColor); m_barShader->setUniformValue(m_barShader->ambientS(), - m_theme->m_ambientStrength); + m_theme->m_ambientStrength); #if !defined(QT_OPENGL_ES_2) if (m_shadowQuality > ShadowNone) { // Set shadow shader bindings m_barShader->setUniformValue(m_barShader->shadowQ(), - m_shadowQualityToShader); + m_shadowQualityToShader); m_barShader->setUniformValue(m_barShader->depth(), - depthMVPMatrix); + depthMVPMatrix); m_barShader->setUniformValue(m_barShader->lightS(), - lightStrength / 10.0f); + lightStrength / 10.0f); // Draw the object m_drawer->drawObject(m_barShader, m_barObj, - 0, m_depthTexture); + 0, m_depthTexture); } else #endif { // Set shadowless shader bindings m_barShader->setUniformValue(m_barShader->lightS(), - lightStrength); + lightStrength); // Draw the object m_drawer->drawObject(m_barShader, m_barObj); @@ -1073,39 +1078,39 @@ void Bars3dShared::drawScene() // Set shader bindings m_backgroundShader->setUniformValue(m_backgroundShader->lightP(), - lightPos); + lightPos); m_backgroundShader->setUniformValue(m_backgroundShader->view(), - viewMatrix); + viewMatrix); m_backgroundShader->setUniformValue(m_backgroundShader->model(), - modelMatrix); + modelMatrix); m_backgroundShader->setUniformValue(m_backgroundShader->nModel(), - itModelMatrix.inverted().transposed()); + itModelMatrix.inverted().transposed()); m_backgroundShader->setUniformValue(m_backgroundShader->MVP(), - MVPMatrix); + MVPMatrix); m_backgroundShader->setUniformValue(m_backgroundShader->color(), - backgroundColor); + backgroundColor); m_backgroundShader->setUniformValue(m_backgroundShader->ambientS(), - m_theme->m_ambientStrength * 2.0f); + m_theme->m_ambientStrength * 2.0f); #if !defined(QT_OPENGL_ES_2) if (m_shadowQuality > ShadowNone) { // Set shadow shader bindings m_backgroundShader->setUniformValue(m_backgroundShader->shadowQ(), - m_shadowQualityToShader); + m_shadowQualityToShader); m_backgroundShader->setUniformValue(m_backgroundShader->depth(), - depthMVPMatrix); + depthMVPMatrix); m_backgroundShader->setUniformValue(m_backgroundShader->lightS(), - m_theme->m_lightStrength / 10.0f); + m_theme->m_lightStrength / 10.0f); // Draw the object m_drawer->drawObject(m_backgroundShader, m_backgroundObj, - 0, m_depthTexture); + 0, m_depthTexture); } else #endif { // Set shadowless shader bindings m_backgroundShader->setUniformValue(m_backgroundShader->lightS(), - m_theme->m_lightStrength); + m_theme->m_lightStrength); // Draw the object m_drawer->drawObject(m_backgroundShader, m_backgroundObj); @@ -1135,7 +1140,7 @@ void Bars3dShared::drawScene() m_barShader->setUniformValue(m_barShader->view(), viewMatrix); m_barShader->setUniformValue(m_barShader->color(), barColor); m_barShader->setUniformValue(m_barShader->ambientS(), - m_theme->m_ambientStrength); + m_theme->m_ambientStrength); // Floor lines: rows for (GLfloat row = 0.0f; row <= m_sampleCount.second; row++) { @@ -1161,28 +1166,28 @@ void Bars3dShared::drawScene() // Set the rest of the shader bindings m_barShader->setUniformValue(m_barShader->model(), modelMatrix); m_barShader->setUniformValue(m_barShader->nModel(), - itModelMatrix.inverted().transposed()); + itModelMatrix.inverted().transposed()); m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix); #if !defined(QT_OPENGL_ES_2) if (m_shadowQuality > ShadowNone) { // Set shadow shader bindings m_barShader->setUniformValue(m_barShader->shadowQ(), - m_shadowQualityToShader); + m_shadowQualityToShader); m_barShader->setUniformValue(m_barShader->depth(), - depthMVPMatrix); + depthMVPMatrix); m_barShader->setUniformValue(m_barShader->lightS(), - m_theme->m_lightStrength / 10.0f); + m_theme->m_lightStrength / 10.0f); // Draw the object m_drawer->drawObject(m_barShader, m_gridLineObj, - 0, m_depthTexture); + 0, m_depthTexture); } else #endif { // Set shadowless shader bindings m_barShader->setUniformValue(m_barShader->lightS(), - m_theme->m_lightStrength); + m_theme->m_lightStrength); // Draw the object m_drawer->drawObject(m_barShader, m_gridLineObj); @@ -1214,28 +1219,28 @@ void Bars3dShared::drawScene() // Set the rest of the shader bindings m_barShader->setUniformValue(m_barShader->model(), modelMatrix); m_barShader->setUniformValue(m_barShader->nModel(), - itModelMatrix.inverted().transposed()); + itModelMatrix.inverted().transposed()); m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix); #if !defined(QT_OPENGL_ES_2) if (m_shadowQuality > ShadowNone) { // Set shadow shader bindings m_barShader->setUniformValue(m_barShader->shadowQ(), - m_shadowQualityToShader); + m_shadowQualityToShader); m_barShader->setUniformValue(m_barShader->depth(), - depthMVPMatrix); + depthMVPMatrix); m_barShader->setUniformValue(m_barShader->lightS(), - m_theme->m_lightStrength / 10.0f); + m_theme->m_lightStrength / 10.0f); // Draw the object m_drawer->drawObject(m_barShader, m_gridLineObj, - 0, m_depthTexture); + 0, m_depthTexture); } else #endif { // Set shadowless shader bindings m_barShader->setUniformValue(m_barShader->lightS(), - m_theme->m_lightStrength); + m_theme->m_lightStrength); // Draw the object m_drawer->drawObject(m_barShader, m_gridLineObj); @@ -1283,28 +1288,28 @@ void Bars3dShared::drawScene() // Set the rest of the shader bindings m_barShader->setUniformValue(m_barShader->model(), modelMatrix); m_barShader->setUniformValue(m_barShader->nModel(), - itModelMatrix.inverted().transposed()); + itModelMatrix.inverted().transposed()); m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix); #if !defined(QT_OPENGL_ES_2) if (m_shadowQuality > ShadowNone) { // Set shadow shader bindings m_barShader->setUniformValue(m_barShader->shadowQ(), - m_shadowQualityToShader); + m_shadowQualityToShader); m_barShader->setUniformValue(m_barShader->depth(), - depthMVPMatrix); + depthMVPMatrix); m_barShader->setUniformValue(m_barShader->lightS(), - m_theme->m_lightStrength / 10.0f); + m_theme->m_lightStrength / 10.0f); // Draw the object m_drawer->drawObject(m_barShader, m_gridLineObj, - 0, m_depthTexture); + 0, m_depthTexture); } else #endif { // Set shadowless shader bindings m_barShader->setUniformValue(m_barShader->lightS(), - m_theme->m_lightStrength); + m_theme->m_lightStrength); // Draw the object m_drawer->drawObject(m_barShader, m_gridLineObj); @@ -1341,28 +1346,28 @@ void Bars3dShared::drawScene() // Set the rest of the shader bindings m_barShader->setUniformValue(m_barShader->model(), modelMatrix); m_barShader->setUniformValue(m_barShader->nModel(), - itModelMatrix.inverted().transposed()); + itModelMatrix.inverted().transposed()); m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix); #if !defined(QT_OPENGL_ES_2) if (m_shadowQuality > ShadowNone) { // Set shadow shader bindings m_barShader->setUniformValue(m_barShader->shadowQ(), - m_shadowQualityToShader); + m_shadowQualityToShader); m_barShader->setUniformValue(m_barShader->depth(), - depthMVPMatrix); + depthMVPMatrix); m_barShader->setUniformValue(m_barShader->lightS(), - m_theme->m_lightStrength / 10.0f); + m_theme->m_lightStrength / 10.0f); // Draw the object m_drawer->drawObject(m_barShader, m_gridLineObj, - 0, m_depthTexture); + 0, m_depthTexture); } else #endif { // Set shadowless shader bindings m_barShader->setUniformValue(m_barShader->lightS(), - m_theme->m_lightStrength); + m_theme->m_lightStrength); // Draw the object m_drawer->drawObject(m_barShader, m_gridLineObj); @@ -1421,11 +1426,11 @@ void Bars3dShared::drawScene() } m_drawer->drawLabel(*m_selectedBar, m_selectedBar->label(), - viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, - m_selectionMode, m_labelShader, - m_labelObj, true); + viewMatrix, projectionMatrix, + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, + m_selectionMode, m_labelShader, + m_labelObj, true); #else static bool firstSelection = true; // Draw the value string followed by row label and column label @@ -1452,10 +1457,10 @@ void Bars3dShared::drawScene() } m_drawer->drawLabel(*m_selectedBar, labelItem, viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, - m_selectionMode, m_labelShader, - m_labelObj, true, false); + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(0.0f, 0.0f, 0.0f), m_heightNormalizer, + m_selectionMode, m_labelShader, + m_labelObj, true, false); #endif glDisable(GL_TEXTURE_2D); if (m_labelTransparency > TransparencyNone) @@ -1520,11 +1525,11 @@ void Bars3dShared::drawScene() //qDebug() << "labelPos, row" << row + 1 << ":" << labelPos << m_dataSet->d_ptr->rowLabels().at(row); m_drawer->drawLabel(*label, label->d_ptr->label(), viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(rotLabelX, rotLabelY, rotLabelZ), - m_heightNormalizer, m_selectionMode, - m_labelShader, m_labelObj, true, true, LabelMid, - alignment); + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(rotLabelX, rotLabelY, rotLabelZ), + m_heightNormalizer, m_selectionMode, + m_labelShader, m_labelObj, true, true, LabelMid, + alignment); delete label; } @@ -1569,11 +1574,11 @@ void Bars3dShared::drawScene() //qDebug() << "labelPos, col" << bar + 1 << ":" << labelPos << m_dataSet->d_ptr->columnLabels().at(bar); m_drawer->drawLabel(*label, label->d_ptr->label(), viewMatrix, projectionMatrix, - QVector3D(0.0f, m_yAdjustment, zComp), - QVector3D(rotLabelX, rotLabelY, rotLabelZ), - m_heightNormalizer, m_selectionMode, - m_labelShader, m_labelObj, true, true, LabelMid, - alignment); + QVector3D(0.0f, m_yAdjustment, zComp), + QVector3D(rotLabelX, rotLabelY, rotLabelZ), + m_heightNormalizer, m_selectionMode, + m_labelShader, m_labelObj, true, true, LabelMid, + alignment); delete label; } @@ -1694,6 +1699,7 @@ void Bars3dShared::wheelEvent(QWheelEvent *event) void Bars3dShared::resizeNotify() { qDebug() << "Bars3dShared::resizeEvent " << width() << "x" <<height(); + // Set view port if (m_zoomActivated) m_sceneViewPort = QRect(0, height() - height() / 5, width() / 5, height() / 5); @@ -1771,7 +1777,7 @@ void Bars3dShared::setMeshFileName(const QString &objFileName) } void Bars3dShared::setupSampleSpace(int samplesRow, int samplesColumn, const QString &labelRow, - const QString &labelColumn, const QString &labelHeight) + const QString &labelColumn, const QString &labelHeight) { // Disable zoom mode if we're in it (causes crash if not, as zoom selection is deleted) closeZoomMode(); @@ -1815,32 +1821,33 @@ void Bars3dShared::setTheme(ColorTheme theme) if (m_shadowQuality > ShadowNone) { if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertexShadow"), - QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY")); + QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY")); } else { initShaders(QStringLiteral(":/shaders/vertexShadow"), - QStringLiteral(":/shaders/fragmentShadowNoTex")); + QStringLiteral(":/shaders/fragmentShadowNoTex")); } } else { if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertex"), - QStringLiteral(":/shaders/fragmentColorOnY")); + QStringLiteral(":/shaders/fragmentColorOnY")); } else { initShaders(QStringLiteral(":/shaders/vertex"), - QStringLiteral(":/shaders/fragment")); + QStringLiteral(":/shaders/fragment")); } } #else if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentColorOnYES2")); + QStringLiteral(":/shaders/fragmentColorOnYES2")); } else { initShaders(QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentES2")); + QStringLiteral(":/shaders/fragmentES2")); } #endif } -void Bars3dShared::setBarColor(QColor baseColor, QColor heightColor, QColor depthColor, bool uniform) +void Bars3dShared::setBarColor(QColor baseColor, QColor heightColor, QColor depthColor, + bool uniform) { m_theme->m_baseColor = baseColor; m_theme->m_heightColor = heightColor; @@ -1851,27 +1858,27 @@ void Bars3dShared::setBarColor(QColor baseColor, QColor heightColor, QColor dept if (m_shadowQuality > ShadowNone) { if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertexShadow"), - QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY")); + QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY")); } else { initShaders(QStringLiteral(":/shaders/vertexShadow"), - QStringLiteral(":/shaders/fragmentShadowNoTex")); + QStringLiteral(":/shaders/fragmentShadowNoTex")); } } else { if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertex"), - QStringLiteral(":/shaders/fragmentColorOnY")); + QStringLiteral(":/shaders/fragmentColorOnY")); } else { initShaders(QStringLiteral(":/shaders/vertex"), - QStringLiteral(":/shaders/fragment")); + QStringLiteral(":/shaders/fragment")); } } #else if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentColorOnYES2")); + QStringLiteral(":/shaders/fragmentColorOnYES2")); } else { initShaders(QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentES2")); + QStringLiteral(":/shaders/fragmentES2")); } #endif } @@ -1975,35 +1982,35 @@ void Bars3dShared::setShadowQuality(ShadowQuality quality) // Re-init shaders if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertexShadow"), - QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY")); + QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY")); } else { initShaders(QStringLiteral(":/shaders/vertexShadow"), - QStringLiteral(":/shaders/fragmentShadowNoTex")); + QStringLiteral(":/shaders/fragmentShadowNoTex")); } initBackgroundShaders(QStringLiteral(":/shaders/vertexShadow"), - QStringLiteral(":/shaders/fragmentShadowNoTex")); + QStringLiteral(":/shaders/fragmentShadowNoTex")); } else { // Re-init shaders if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertex"), - QStringLiteral(":/shaders/fragmentColorOnY")); + QStringLiteral(":/shaders/fragmentColorOnY")); } else { initShaders(QStringLiteral(":/shaders/vertex"), - QStringLiteral(":/shaders/fragment")); + QStringLiteral(":/shaders/fragment")); } initBackgroundShaders(QStringLiteral(":/shaders/vertex"), - QStringLiteral(":/shaders/fragment")); + QStringLiteral(":/shaders/fragment")); } #else if (!m_theme->m_uniformColor) { initShaders(QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentColorOnYES2")); + QStringLiteral(":/shaders/fragmentColorOnYES2")); } else { initShaders(QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentES2")); + QStringLiteral(":/shaders/fragmentES2")); } initBackgroundShaders(QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentES2")); + QStringLiteral(":/shaders/fragmentES2")); #endif } } @@ -2024,7 +2031,7 @@ void Bars3dShared::setTickCount(GLint tickCount, GLfloat step, GLfloat minimum) } void Bars3dShared::addDataRow(const QVector<float> &dataRow, const QString &labelRow, - const QVector<QString> &labelsColumn) + const QVector<QString> &labelsColumn) { // Convert to QDataRow and add to QDataSet QDataRow *row = new QDataRow(labelRow); @@ -2034,12 +2041,12 @@ void Bars3dShared::addDataRow(const QVector<float> &dataRow, const QString &labe m_dataSet->addRow(row); handleLimitChange(); m_dataSet->setLabels(m_axisLabelX, m_axisLabelZ, m_axisLabelY, - QVector<QString>(), labelsColumn); + QVector<QString>(), labelsColumn); m_dataSet->d_ptr->verifySize(m_sampleCount.second); } void Bars3dShared::addDataRow(const QVector<QDataItem*> &dataRow, const QString &labelRow, - const QVector<QString> &labelsColumn) + const QVector<QString> &labelsColumn) { // Convert to QDataRow and add to QDataSet QDataRow *row = new QDataRow(labelRow); @@ -2049,7 +2056,7 @@ void Bars3dShared::addDataRow(const QVector<QDataItem*> &dataRow, const QString m_dataSet->addRow(row); handleLimitChange(); m_dataSet->setLabels(m_axisLabelX, m_axisLabelZ, m_axisLabelY, - QVector<QString>(), labelsColumn); + QVector<QString>(), labelsColumn); m_dataSet->d_ptr->verifySize(m_sampleCount.second); } @@ -2066,8 +2073,9 @@ void Bars3dShared::addDataRow(QDataRow *dataRow) handleLimitChange(); } -void Bars3dShared::addDataSet(const QVector< QVector<float> > &data, const QVector<QString> &labelsRow, - const QVector<QString> &labelsColumn) +void Bars3dShared::addDataSet(const QVector< QVector<float> > &data, + const QVector<QString> &labelsRow, + const QVector<QString> &labelsColumn) { // Copy axis labels QString xAxis; @@ -2100,8 +2108,8 @@ void Bars3dShared::addDataSet(const QVector< QVector<float> > &data, const QVect } void Bars3dShared::addDataSet(const QVector< QVector<QDataItem*> > &data, - const QVector<QString> &labelsRow, - const QVector<QString> &labelsColumn) + const QVector<QString> &labelsRow, + const QVector<QString> &labelsColumn) { // Copy axis labels QString xAxis; @@ -2165,7 +2173,7 @@ void Bars3dShared::setBoundingRect(const QRect boundingRect) void Bars3dShared::setWidth(const int width) { - m_boundingRect.setWidth( width ); + m_boundingRect.setWidth(width); } int Bars3dShared::width() @@ -2175,7 +2183,7 @@ int Bars3dShared::width() void Bars3dShared::setHeight(const int height) { - m_boundingRect.setHeight( height ); + m_boundingRect.setHeight(height); } int Bars3dShared::height() @@ -2298,7 +2306,7 @@ void Bars3dShared::initDepthBuffer() #endif void Bars3dShared::initBackgroundShaders(const QString &vertexShader, - const QString &fragmentShader) + const QString &fragmentShader) { if (m_backgroundShader) delete m_backgroundShader; @@ -2343,7 +2351,7 @@ void Bars3dShared::calculateHeightAdjustment(const QPair<GLfloat, GLfloat> &limi } Bars3dShared::SelectionType Bars3dShared::isSelected(GLint row, GLint bar, - const QVector3D &selection) + const QVector3D &selection) { //static QVector3D prevSel = selection; // TODO: For debugging SelectionType isSelectedType = SelectionNone; @@ -2354,11 +2362,11 @@ Bars3dShared::SelectionType Bars3dShared::isSelected(GLint row, GLint bar, #endif return isSelectedType; // skip window -//#if !defined(QT_OPENGL_ES_2) -// QVector3D current = QVector3D((GLuint)row, (GLuint)bar, 0); -//#else + //#if !defined(QT_OPENGL_ES_2) + // QVector3D current = QVector3D((GLuint)row, (GLuint)bar, 0); + //#else QVector3D current = QVector3D((GLubyte)row, (GLubyte)bar, 0); -//#endif + //#endif // TODO: For debugging //if (selection != prevSel) { diff --git a/src/datavis3d/engine/bars3dshared_p.h b/src/datavis3d/engine/bars3dshared_p.h index 703d3d89..2250b7c4 100644 --- a/src/datavis3d/engine/bars3dshared_p.h +++ b/src/datavis3d/engine/bars3dshared_p.h @@ -80,7 +80,7 @@ class Drawer; class LabelItem; class Bars3dSharedPrivate; -class QTENTERPRISE_DATAVIS3D_EXPORT Bars3dShared : public QObject +class QTENTERPRISE_DATAVIS3D_EXPORT Bars3dShared : public QObject, public QOpenGLFunctions { Q_OBJECT diff --git a/src/datavis3d/engine/drawer.cpp b/src/datavis3d/engine/drawer.cpp index 7db12c16..3c4d30cf 100644 --- a/src/datavis3d/engine/drawer.cpp +++ b/src/datavis3d/engine/drawer.cpp @@ -74,12 +74,14 @@ Drawer::Drawer(const Theme &theme, const QFont &font, LabelTransparency transpar Drawer::~Drawer() { - } void Drawer::initializeOpenGL() { - m_textureHelper = new TextureHelper(); + if (!m_textureHelper) { + initializeOpenGLFunctions(); + m_textureHelper = new TextureHelper(); + } } void Drawer::setTheme(const Theme &theme) @@ -293,6 +295,8 @@ void Drawer::generateLabelTexture(QDataItem *item) void Drawer::generateLabelItem(LabelItem *item, const QString &text) { + initializeOpenGL(); + // Delete previous texture, if there is one GLuint labelTexture = item->textureId(); if (labelTexture) diff --git a/src/datavis3d/engine/drawer_p.h b/src/datavis3d/engine/drawer_p.h index 35338cc3..e31ab0cb 100644 --- a/src/datavis3d/engine/drawer_p.h +++ b/src/datavis3d/engine/drawer_p.h @@ -66,7 +66,7 @@ class ShaderHelper; class ObjectHelper; class TextureHelper; -class Drawer : public QObject +class Drawer : public QObject, public QOpenGLFunctions { Q_OBJECT diff --git a/src/datavis3d/engine/q3dbars.cpp b/src/datavis3d/engine/q3dbars.cpp index dfbfab84..39750b38 100644 --- a/src/datavis3d/engine/q3dbars.cpp +++ b/src/datavis3d/engine/q3dbars.cpp @@ -54,68 +54,278 @@ QTENTERPRISE_DATAVIS3D_BEGIN_NAMESPACE +/*! + * \class Q3DBars + * \inmodule QtDataVis3D + * \brief The Q3DBars class provides methods for rendering 3D bar graphs. + * \since 1.0.0 + * + * This class enables developers to render bar graphs in 3D and to view them by rotating the scene + * freely. Rotation is done by holding down the right mouse button and moving the mouse. Zooming + * is done by mouse wheel. Selection, if enabled, is done by left mouse button. The scene can be + * reset to default camera view by clicking mouse wheel. In touch devices rotation is done + * by tap-and-move, selection by tap-and-hold and zoom by pinch. + * + * Methods are provided for changing bar types, themes, bar selection modes and so on. See the + * methods for more detailed descriptions. + * + * \section1 How to construct a minimal Q3DBars chart + * + * After constructing Q3DBars, you need to set up sample space using setupSampleSpace(). Let's + * set the sample space to 5 rows and 5 columns: + * + * \snippet doc_src_q3dbars_construction.cpp 0 + * + * Now Q3DBars is ready to receive data to be rendered. Add one row of 5 floats into the data + * set: + * + * \snippet doc_src_q3dbars_construction.cpp 1 + * + * \note We set the sample space to 5 x 5, but we are inserting only one row of data. This is ok, + * the rest of the rows will just be blank. + * + * Finally you will need to set it visible: + * + * \snippet doc_src_q3dbars_construction.cpp 2 + * + * The complete code needed to create and display this chart is: + * + * \snippet doc_src_q3dbars_construction.cpp 3 + * + * And this is what those few lines of code produce: + * + * \image q3dbars-minimal.png + * + * The scene can be rotated and zoomed into, but no other interaction is included in this minimal + * code example. You can learn more by familiarizing yourself with the examples provided, like + * the \l{Rainfall Example} or the \l{Widget Example}. + * + * \sa Q3DMaps, {Qt Data Visualization 3D C++ Classes} + */ + +/*! + \enum BarStyle + + Predefined bar types. + + \value Bars + Basic cubic bar. + \value Pyramids + Four -sided pyramid. + \value Cones + Basic cone. + \value Cylinders + Basic cylinder. + \value BevelBars + Slilghtly beveled (rounded) cubic bar. + \value Spheres + Sphere. Not usable in Q3DBars. +*/ + +/*! + \enum CameraPreset + + Predefined positions for camera. + + \value PresetFrontLow + \value PresetFront + \value PresetFrontHigh + \value PresetLeftLow + \value PresetLeft + \value PresetLeftHigh + \value PresetRightLow + \value PresetRight + \value PresetRightHigh + \value PresetBehindLow + \value PresetBehind + \value PresetBehindHigh + \value PresetIsometricLeft + \value PresetIsometricLeftHigh + \value PresetIsometricRight + \value PresetIsometricRightHigh + \value PresetDirectlyAbove + \value PresetDirectlyAboveCW45 + \value PresetDirectlyAboveCCW45 + \value PresetFrontBelow + From PresetFrontBelow onward these only work for graphs including negative values. + They act as Preset...Low for positive-only values. + \value PresetLeftBelow + \value PresetRightBelow + \value PresetBehindBelow + \value PresetDirectlyBelow + Acts as PresetFrontLow for positive -only bars. +*/ + +/*! + \enum ColorTheme + + Predefined color themes. + + \value ThemeSystem + \value ThemeBlueCerulean + \value ThemeBlueIcy + \value ThemeBlueNcs + \value ThemeBrownSand + \value ThemeDark + \value ThemeHighContrast + \value ThemeLight +*/ + +/*! + \enum SelectionMode + + Bar selection modes. + + \value ModeNone + Selection mode disabled. + \value ModeBar + Selection selects a single bar. + \value ModeBarAndRow + Selection selects a single bar and highlights the row it is on. + \value ModeBarAndColumn + Selection selects a single bar and highlights the column it is on. + \value ModeBarRowAndColumn + Selection selects a single bar and highlights the row and the column it is on. + \value ModeZoomRow + Selection selects a single bar and displays the row it is on in a separate view. The + original view is shrunk into upper left corner. Original view is restored by clicking + on it. + \value ModeZoomColumn + Selection selects a single bar and displays the column it is on in a separate view. The + original view is shrunk into upper left corner. Original view is restored by clicking + on it. +*/ + +/*! + \enum ShadowQuality + + Quality of shadows. + + \value ShadowNone + Shadows are disabled. + \value ShadowLow + Shadows are rendered in low quality. + \value ShadowMedium + Shadows are rendered in medium quality. + \value ShadowHigh + Shadows are rendered in high quality. +*/ + +/*! + \enum LabelTransparency + + Label transparencies. + + \value TransparencyNone + Full solid, using colors from theme. + \value TransparencyFromTheme + Use colors and transparencies from theme. + \value TransparencyNoBackground + Draw just text on transparent background. +*/ + +/*! + * \a fbohandle Handle to QML2 scene graph's framebuffer object. Developers should not need to + * ever use this directly. Not used when using C++ API. + * + * \a windowsize QML2 window size Developers should not need to ever use this directly. Not + * used when using C++ API. + * + * Constructs a new 3D bar window. Parameters are not used unless instantiating from Qt Quick 2. + */ Q3DBars::Q3DBars(GLuint fbohandle, const QSize &windowsize) : d_ptr(new Q3DBarsPrivate(this, geometry(), fbohandle)) { } +/*! + * Destroys the 3d bar window. + */ Q3DBars::~Q3DBars() { } +/*! + * \internal + */ void Q3DBars::initialize() { - qDebug() << "Q3DBars::initialize()"; d_ptr->m_shared->setWidth(width()); d_ptr->m_shared->setHeight(height()); d_ptr->m_shared->initializeOpenGL(); } +/*! + * \internal + */ void Q3DBars::render() { d_ptr->m_shared->render(); } #if defined(Q_OS_ANDROID) +/*! + * \internal + */ void Q3DBars::mouseDoubleClickEvent(QMouseEvent *event) { d_ptr->m_shared->mouseDoubleClickEvent(event); } +/*! + * \internal + */ void Q3DBars::touchEvent(QTouchEvent *event) { d_ptr->m_shared->touchEvent(event); } #endif +/*! + * \internal + */ void Q3DBars::mousePressEvent(QMouseEvent *event) { d_ptr->m_shared->mousePressEvent(event); } +/*! + * \internal + */ void Q3DBars::mouseReleaseEvent(QMouseEvent *event) { d_ptr->m_shared->mouseReleaseEvent(event); } +/*! + * \internal + */ void Q3DBars::mouseMoveEvent(QMouseEvent *event) { d_ptr->m_shared->mouseMoveEvent(event); } +/*! + * \internal + */ void Q3DBars::wheelEvent(QWheelEvent *event) { d_ptr->m_shared->wheelEvent(event); } +/*! + * \internal + */ void Q3DBars::resizeEvent(QResizeEvent *event) { Q_UNUSED(event); d_ptr->m_shared->setWidth(width()); d_ptr->m_shared->setHeight(height()); - d_ptr->m_shared->resizeNotify(); + if (d_ptr->m_shared->m_isInitialized) + d_ptr->m_shared->resizeNotify(); } +// TODO: Document // Size void Q3DBars::setWidth(const int width) { @@ -129,53 +339,144 @@ void Q3DBars::setHeight(const int height) QWindow::setHeight(height); } +/*! + * \a thickness Thickness of a bar in x and z axes. + * + * \a spacing Spacing between bars in x and z axes. If relative -flag is true, value of 0.0f + * means the bars are side-to-side and for example 1.0f means there is one thickness in between the + * bars. + * + * \a relative A flag to indicate if spacing is meant to be absolute or relative. \c true by + * default. + * + * Sets bar specifications. Bar thickness is relative, as scene is automatically scaled to fit into + * the view. + */ void Q3DBars::setBarSpecs(QSizeF thickness, QSizeF spacing, bool relative) { d_ptr->m_shared->setBarSpecs(thickness, spacing, relative); } +/*! + * \a style One of the values in \c BarStyle. \c Bars by default. + * + * \a smooth A flag to set shading to smooth. \c false by default. + * + * Sets the bar type to one of the supplied ones. + * + * \sa setMeshFileName() + */ void Q3DBars::setBarType(BarStyle style, bool smooth) { d_ptr->m_shared->setBarType(style, smooth); } +/*! + * \a samplesRow How many rows of data there will be. + * + * \a samplesColumn How many items there are per row. + * + * \a labelRow QString label for the rows, ie. x -axis label. + * + * \a labelColumn QString label for the columns, ie. z -axis label. + * + * \a labelHeight QString label for height, ie. y -axis label. + * + * Set up sample space. This must be called to initialize the sample space before adding data to the + * Q3DBars. + * + * \sa addDataRow(), addDataSet() + */ void Q3DBars::setupSampleSpace(int samplesRow, int samplesColumn, const QString &labelRow, const QString &labelColumn, const QString &labelHeight) { - d_ptr->m_shared->setupSampleSpace(samplesRow, samplesColumn, labelRow, labelColumn, labelHeight); + d_ptr->m_shared->setupSampleSpace(samplesRow, samplesColumn, labelRow, labelColumn, + labelHeight); } - +/*! + * \a preset Move camera to a predefined position from \c CameraPreset. + * + * Moves camera to a predefined position. + */ void Q3DBars::setCameraPreset(CameraPreset preset) { d_ptr->m_shared->setCameraPreset(preset); } +/*! + * \a horizontal Horizontal angle for camera. + * + * \a vertical Vertical angle for camera. + * + * \a distance Distance from the center. \c 100 by default. + * + * Move camera to a wanted position based on horizontal and veritcal angles. Angles are limited + * to -180...180 in horizontal direction and either -90...90 or 0...90 in vertical, depending + * on data values. Negative vertical angles are allowed only if there are negative bar values. + * Distance is adjustable between 10 and 500. + */ void Q3DBars::setCameraPosition(GLfloat horizontal, GLfloat vertical, GLint distance) { d_ptr->m_shared->setCameraPosition(horizontal, vertical, distance); } +/*! + * \a theme Apply a predefined theme from \c ColorTheme. + * + * Sets a predefined theme. Theme affects bar colors, label colors, text color, background color, + * window color and grid color. Lighting is also adjusted by themes. + */ void Q3DBars::setTheme(ColorTheme theme) { d_ptr->m_shared->setTheme(theme); } +/*! + * \a baseColor The base color of a bar. If all other colors are black, this sets the final color of + * the bar. + * + * \a heightColor This color is added to the bar based on its height. The higher the bar, the more + * prominent this color becomes. Setting this black keeps the color unchanged regardless of height. + * + * \a depthColor This color becomes more prominent the further away from the first row the bar is. + * Setting this black keeps bars the same color regardless of "depth" in the set. + * + * \a uniform A flag to define if color needs to be uniform throughout bar's length, or will the + * colors be applied by height. \c true by default. + * + * Set bar color using your own colors. This overrides colors from theme. + */ void Q3DBars::setBarColor(QColor baseColor, QColor heightColor, QColor depthColor, bool uniform) { d_ptr->m_shared->setBarColor(baseColor, heightColor, depthColor, uniform); } +/*! + * \a mode Set bar selection mode from \c SelectionMode. \c ModeBar by default. + * + * Sets bar selection mode to be used. + */ void Q3DBars::setSelectionMode(SelectionMode mode) { d_ptr->m_shared->setSelectionMode(mode); } +/*! + * \return \c SelectionMode. + */ SelectionMode Q3DBars::selectionMode() { return d_ptr->m_shared->selectionMode(); } +/*! + * \property Q3DBars::windowTitle + * + * \a title QString label to be used as window title. + * + * Sets the window title. The default is application executable name. + */ void Q3DBars::setWindowTitle(const QString &title) { setTitle(title); @@ -186,11 +487,24 @@ QString Q3DBars::windowTitle() return title(); } +/*! + * \a objFileName File name of a mesh object. Object needs to be in Wavefront obj format + * and include vertices, normals and UVs. It also needs to be in triangles. + * + * Override bar type with an object mesh. \sa setBarType() + */ void Q3DBars::setMeshFileName(const QString &objFileName) { d_ptr->m_shared->setMeshFileName(objFileName); } +/*! + * \property Q3DBars::fontSize + * + * \a fontsize Size of the font. + * + * Sets font size. + */ void Q3DBars::setFontSize(float fontsize) { d_ptr->m_shared->setFontSize(fontsize); @@ -201,6 +515,13 @@ float Q3DBars::fontSize() return d_ptr->m_shared->fontSize(); } +/*! + * \property Q3DBars::font + * + * \a font QFont to be used for labels. \c Arial by default. + * + * Sets the font for labels. + */ void Q3DBars::setFont(const QFont &font) { d_ptr->m_shared->setFont(font); @@ -211,16 +532,32 @@ QFont Q3DBars::font() return d_ptr->m_shared->font(); } +/*! + * \a transparency Transparency level of labels from \c LabelTransparency. + * \c TransparencyFromTheme by default. + * + * Sets label transparency. + */ void Q3DBars::setLabelTransparency(LabelTransparency transparency) { d_ptr->m_shared->setLabelTransparency(transparency); } +/*! + * \return \c LabelTransparency. + */ LabelTransparency Q3DBars::labelTransparency() { return d_ptr->m_shared->labelTransparency(); } +/*! + * \property Q3DBars::grid + * + * \a enable Flag to enable or disable grid. \c true by default. + * + * Sets grid drawing on or off. + */ void Q3DBars::setGridEnabled(bool enable) { d_ptr->m_shared->setGridEnabled(enable); @@ -231,6 +568,13 @@ bool Q3DBars::gridEnabled() return d_ptr->m_shared->gridEnabled(); } +/*! + * \property Q3DBars::background + * + * \a enable Flag to enable or disable background. \c true by default. + * + * Sets backround rendering on or off. + */ void Q3DBars::setBackgroundEnabled(bool enable) { d_ptr->m_shared->setBackgroundEnabled(enable); @@ -241,44 +585,112 @@ bool Q3DBars::backgroundEnabled() return d_ptr->m_shared->backgroundEnabled(); } +/*! + * \a quality Shadow quality from \c ShadowQuality. \c ShadowLow by default. + */ void Q3DBars::setShadowQuality(ShadowQuality quality) { d_ptr->m_shared->setShadowQuality(quality); } +/*! + * \return \c ShadowQuality. + */ ShadowQuality Q3DBars::shadowQuality() { return d_ptr->m_shared->shadowQuality(); } +/*! + * \a tickCount How many ticks will be drawn. \c 5 by default. + * + * \a step How large a step each tick is. + * + * \a minimum Minimum value a bar in data set can have. Setting this correctly is especially + * important if values can be negative, or autoscaling won't work correctly. + * + * Sets tick count and step. Note; tickCount * step should be the maximum possible value of data + * set. + */ void Q3DBars::setTickCount(GLint tickCount, GLfloat step, GLfloat minimum) { d_ptr->m_shared->setTickCount(tickCount, step, minimum); } +/*! + * \a dataRow A vector of floats representing a single row of data. Sample space must be large + * enough to hold the row. + * + * \a labelRow A QString label for the row. + * + * \a labelsColumn A vector of strings, one for each item in the row. + * + * Add a row of data. Each new row is added to the front of the sample space, moving previous + * rows back (if sample space is more than one row deep). + */ void Q3DBars::addDataRow(const QVector<float> &dataRow, const QString &labelRow, const QVector<QString> &labelsColumn) { d_ptr->m_shared->addDataRow(dataRow, labelRow, labelsColumn); } +/*! + * \a dataRow A vector of QDataItems representing a single row of data. Sample space must be + * large enough to hold the row. Ownership of QDataItems is transferred to Q3DBars. + * + * \a labelRow A QString label for the row. + * + * \a labelsColumn A vector of strings, one for each item in the row. + * + * Add a row of data. Each new row is added to the front of the sample space, moving previous + * rows back (if sample space is more than one row deep). + */ void Q3DBars::addDataRow(const QVector<QDataItem*> &dataRow, const QString &labelRow, const QVector<QString> &labelsColumn) { d_ptr->m_shared->addDataRow(dataRow, labelRow, labelsColumn); } +/*! + * \a dataRow A QDataRow instance representing a single row of data. Sample space must be + * large enough to hold the row. Ownership of QDataRow is transferred to Q3DBars. + * + * Add a row of data. Each new row is added to the front of the sample space, moving previous + * rows back (if sample space is more than one row deep). + */ void Q3DBars::addDataRow(QDataRow *dataRow) { d_ptr->m_shared->addDataRow(dataRow); } +/*! + * \a data A vector of vector of floats representing the whole data set. Sample space must be + * large enough to hold the set. + * + * \a labelsRow A vector of strings, one for each column in the row. + * + * \a labelsColumn A vector of strings, one for each row in the column. + * + * Adds a whole data set at once. If an old data set exists, it is deleted and replaced with the + * new one. + */ void Q3DBars::addDataSet(const QVector< QVector<float> > &data, const QVector<QString> &labelsRow, const QVector<QString> &labelsColumn) { - d_ptr->m_shared->addDataSet(data, labelsRow,labelsColumn); + d_ptr->m_shared->addDataSet(data, labelsRow, labelsColumn); } +/*! + * \a data A vector of vector of QDataItems representing the whole data set. Sample space must + * be large enough to hold the set. Ownership of QDataItems is transferred to Q3DBars. + * + * \a labelsRow A vector of strings, one for each column in the row. + * + * \a labelsColumn A vector of strings, one for each row in the column. + * + * Adds a whole data set at once. If an old data set exists, it is deleted and replaced with the + * new one. + */ void Q3DBars::addDataSet(const QVector< QVector<QDataItem*> > &data, const QVector<QString> &labelsRow, const QVector<QString> &labelsColumn) @@ -286,7 +698,14 @@ void Q3DBars::addDataSet(const QVector< QVector<QDataItem*> > &data, d_ptr->m_shared->addDataSet(data, labelsRow, labelsColumn); } -void Q3DBars::addDataSet(QDataSet* dataSet) +/*! + * \a dataSet A QDataSet instance holding the whole data set. Sample space must + * be large enough to hold the set. Ownership of QDataSet is transferred to Q3DBars. + * + * Adds a whole data set at once. If an old data set exists, it is deleted and replaced with the + * new one. + */ +void Q3DBars::addDataSet(QDataSet *dataSet) { d_ptr->m_shared->addDataSet(dataSet); } diff --git a/src/datavis3d/engine/q3dbars.h b/src/datavis3d/engine/q3dbars.h index 9c7f6a54..03635e4d 100644 --- a/src/datavis3d/engine/q3dbars.h +++ b/src/datavis3d/engine/q3dbars.h @@ -60,24 +60,18 @@ class QTENTERPRISE_DATAVIS3D_EXPORT Q3DBars : public Q3DWindow { Q_OBJECT Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) - Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(float fontSize READ fontSize WRITE setFontSize) Q_PROPERTY(bool grid READ gridEnabled WRITE setGridEnabled) Q_PROPERTY(bool background READ backgroundEnabled WRITE setBackgroundEnabled) -protected: - - void initialize(); - void render(); - public: explicit Q3DBars(GLuint fbohandle = 0, const QSize &windowsize = QSize()); ~Q3DBars(); // Add a row of data. Each new row is added to the front of the sample space, moving previous // rows back (if sample space is more than one row deep) - Q_INVOKABLE void addDataRow(const QVector<GLfloat> &dataRow, + Q_INVOKABLE void addDataRow(const QVector<float> &dataRow, const QString &labelRow = QString(), const QVector<QString> &labelsColumn = QVector<QString>()); // ownership of dataItems is transferred @@ -88,7 +82,7 @@ public: Q_INVOKABLE void addDataRow(QDataRow *dataRow); // Add complete data set at a time, as a vector of data rows - Q_INVOKABLE void addDataSet(const QVector< QVector<GLfloat> > &data, + Q_INVOKABLE void addDataSet(const QVector< QVector<float> > &data, const QVector<QString> &labelsRow = QVector<QString>(), const QVector<QString> &labelsColumn = QVector<QString>()); @@ -165,6 +159,7 @@ public: void setGridEnabled(bool enable); bool gridEnabled(); + // TODO: Do these need to be public? Where are they called from? // Size void setWidth(const int width); void setHeight(const int height); @@ -178,6 +173,9 @@ public: ShadowQuality shadowQuality(); protected: + void initialize(); + void render(); + #if defined(Q_OS_ANDROID) void mouseDoubleClickEvent(QMouseEvent *event); void touchEvent(QTouchEvent *event); diff --git a/src/datavis3d/engine/q3dmaps.cpp b/src/datavis3d/engine/q3dmaps.cpp index c0f8a8c7..0a1ca7ff 100644 --- a/src/datavis3d/engine/q3dmaps.cpp +++ b/src/datavis3d/engine/q3dmaps.cpp @@ -85,15 +85,39 @@ const GLfloat gridLineWidth = 0.005f; GLfloat distanceMod = 0.0f; static QVector3D skipColor = QVector3D(255, 255, 255); // Selection texture's background color +/*! + * \class Q3DMaps + * \inmodule QtDataVis3D + * \brief The Q3DMaps class provides methods for rendering 3D bars on maps or other planes. + * \since 1.0.0 + * + * This class enables developers to render bars or objects on maps or other planes in 3D and to + * view them by rotating the scene freely. Methods are provided for changing object types, themes + * and so on. + * + * See methods themselves for more complete description. + * + * \sa Q3DBars, {Qt Data Visualization 3D C++ Classes} + */ + +/*! + * Constructs Q3DMaps. + */ Q3DMaps::Q3DMaps() : d_ptr(new Q3DMapsPrivate(this)) { } +/*! + * Destructs Q3DMaps. + */ Q3DMaps::~Q3DMaps() { } +/*! + * \internal + */ void Q3DMaps::initialize() { // Initialize shaders @@ -185,12 +209,17 @@ void Q3DMaps::initialize() // Set initialized -flag d_ptr->m_isInitialized = true; + d_ptr->m_drawer->initializeOpenGL(); + // Update default light position #ifndef USE_WIDER_SHADOWS distanceMod = 1.0f; #endif } +/*! + * \internal + */ void Q3DMaps::render() { if (!d_ptr->m_isInitialized) @@ -219,6 +248,9 @@ void Q3DMaps::render() drawScene(); } +/*! + * \internal + */ void Q3DMaps::drawScene() { // Set clear color @@ -923,6 +955,9 @@ void Q3DMaps::drawScene() } #if defined(Q_OS_ANDROID) +/*! + * \internal + */ void Q3DMaps::mouseDoubleClickEvent(QMouseEvent *event) { if (!d_ptr->m_zoomActivated) { @@ -932,6 +967,9 @@ void Q3DMaps::mouseDoubleClickEvent(QMouseEvent *event) } } +/*! + * \internal + */ void Q3DMaps::touchEvent(QTouchEvent *event) { static int prevDistance = 0; @@ -961,6 +999,9 @@ void Q3DMaps::touchEvent(QTouchEvent *event) } #endif +/*! + * \internal + */ void Q3DMaps::mousePressEvent(QMouseEvent *event) { if (Qt::LeftButton == event->button()) { @@ -999,6 +1040,9 @@ void Q3DMaps::mousePressEvent(QMouseEvent *event) CameraHelper::updateMousePos(d_ptr->m_mousePos); } +/*! + * \internal + */ void Q3DMaps::mouseReleaseEvent(QMouseEvent *event) { //qDebug() << "mouse button released" << event->button(); @@ -1010,6 +1054,9 @@ void Q3DMaps::mouseReleaseEvent(QMouseEvent *event) d_ptr->m_mousePressed = Q3DMapsPrivate::MouseNone; } +/*! + * \internal + */ void Q3DMaps::mouseMoveEvent(QMouseEvent *event) { if (Q3DMapsPrivate::MouseRotating == d_ptr->m_mousePressed) { @@ -1033,6 +1080,9 @@ void Q3DMaps::mouseMoveEvent(QMouseEvent *event) #endif } +/*! + * \internal + */ void Q3DMaps::wheelEvent(QWheelEvent *event) { if (d_ptr->m_zoomLevel > 100) @@ -1047,6 +1097,9 @@ void Q3DMaps::wheelEvent(QWheelEvent *event) d_ptr->m_zoomLevel = 10; } +/*! + * \internal + */ void Q3DMaps::resizeEvent(QResizeEvent *event) { Q_UNUSED(event); @@ -1513,9 +1566,9 @@ Q3DMapsPrivate::Q3DMapsPrivate(Q3DMaps *q) Q3DMapsPrivate::~Q3DMapsPrivate() { - glDeleteFramebuffers(1, &m_depthFrameBuffer); - glDeleteFramebuffers(1, &m_selectionFrameBuffer); - glDeleteRenderbuffers(1, &m_selectionDepthBuffer); + m_textureHelper->glDeleteFramebuffers(1, &m_depthFrameBuffer); + m_textureHelper->glDeleteFramebuffers(1, &m_selectionFrameBuffer); + m_textureHelper->glDeleteRenderbuffers(1, &m_selectionDepthBuffer); m_textureHelper->deleteTexture(&m_selectionTexture); m_textureHelper->deleteTexture(&m_bgrTexture); delete m_data; @@ -1582,8 +1635,8 @@ void Q3DMapsPrivate::initSelectionBuffer() { if (m_selectionTexture) { - glDeleteFramebuffers(1, &m_selectionFrameBuffer); - glDeleteRenderbuffers(1, &m_selectionDepthBuffer); + m_textureHelper->glDeleteFramebuffers(1, &m_selectionFrameBuffer); + m_textureHelper->glDeleteRenderbuffers(1, &m_selectionDepthBuffer); m_textureHelper->deleteTexture(&m_selectionTexture); } m_selectionTexture = m_textureHelper->createSelectionTexture(q_ptr->size(), @@ -1604,7 +1657,7 @@ void Q3DMapsPrivate::initDepthShader() void Q3DMapsPrivate::initDepthBuffer() { if (m_depthTexture) { - glDeleteFramebuffers(1, &m_depthFrameBuffer); + m_textureHelper->glDeleteFramebuffers(1, &m_depthFrameBuffer); m_textureHelper->deleteTexture(&m_depthTexture); } m_depthTexture = m_textureHelper->createDepthTexture(q_ptr->size(), m_depthFrameBuffer, diff --git a/src/datavis3d/engine/q3dmaps.h b/src/datavis3d/engine/q3dmaps.h index d9880d3a..67c8860b 100644 --- a/src/datavis3d/engine/q3dmaps.h +++ b/src/datavis3d/engine/q3dmaps.h @@ -80,10 +80,6 @@ public: explicit Q3DMaps(); ~Q3DMaps(); - void initialize(); - void render(); - void render(QPainter *painter); - // Add data item. New data item is appended to old data. // ownership of data is transferred Q_INVOKABLE bool addDataItem(QDataItem *dataItem); @@ -159,6 +155,9 @@ public: ShadowQuality shadowQuality(); protected: + void initialize(); + void render(); + #if defined(Q_OS_ANDROID) void mouseDoubleClickEvent(QMouseEvent *event); void touchEvent(QTouchEvent *event); diff --git a/src/datavis3d/engine/q3dwindow.cpp b/src/datavis3d/engine/q3dwindow.cpp index 8e3af68a..af975cb1 100644 --- a/src/datavis3d/engine/q3dwindow.cpp +++ b/src/datavis3d/engine/q3dwindow.cpp @@ -52,6 +52,24 @@ QTENTERPRISE_DATAVIS3D_BEGIN_NAMESPACE +/*! + * \class Q3DWindow + * \inmodule QtDataVis3D + * \brief The Q3DWindow class provides a window and render loop. + * \since 1.0.0 + * + * This class creates a QWindow and provides render loop for visualization types inheriting it. + * \warning This class is not intended to be used directly by developers. + * + * \sa Q3DBars, Q3DMaps, {Qt Data Visualization 3D C++ Classes} + */ + +/*! + * \a parent A QWindow parent. + * + * Constructs Q3DWindow. It creates a QWindow and an OpenGL context. It also sets surface + * format and initializes OpenGL functions for use. + */ Q3DWindow::Q3DWindow(QWindow *parent) : QWindow(parent), d_ptr(new Q3DWindowPrivate(this)) @@ -80,13 +98,19 @@ Q3DWindow::Q3DWindow(QWindow *parent) initialize(); } +/*! + * Destroys Q3DWindow. + */ Q3DWindow::~Q3DWindow() { } +/*! + * \internal + */ void Q3DWindow::initialize() { - const GLubyte* version = glGetString(GL_VERSION); + const GLubyte *version = glGetString(GL_VERSION); qDebug() << "OpenGL version:" << (const char *)version; version = glGetString(GL_SHADING_LANGUAGE_VERSION); qDebug() << "GLSL version:" << (const char *)version; @@ -99,10 +123,16 @@ void Q3DWindow::initialize() setAnimating(true); } +/*! + * \internal + */ void Q3DWindow::render() { } +/*! + * \internal + */ void Q3DWindow::renderLater() { if (!d_ptr->m_updatePending) { @@ -111,6 +141,9 @@ void Q3DWindow::renderLater() } } +/*! + * \internal + */ bool Q3DWindow::event(QEvent *event) { switch (event->type()) { @@ -122,6 +155,9 @@ bool Q3DWindow::event(QEvent *event) } } +/*! + * \internal + */ void Q3DWindow::exposeEvent(QExposeEvent *event) { Q_UNUSED(event); @@ -130,6 +166,9 @@ void Q3DWindow::exposeEvent(QExposeEvent *event) renderNow(); } +/*! + * \internal + */ void Q3DWindow::renderNow() { if (!isExposed()) @@ -154,6 +193,9 @@ void Q3DWindow::renderNow() renderLater(); } +/*! + * \internal + */ void Q3DWindow::setAnimating(bool animating) { d_ptr->m_animating = animating; diff --git a/src/datavis3d/engine/q3dwindow.h b/src/datavis3d/engine/q3dwindow.h index edabcf76..bf7d8f74 100644 --- a/src/datavis3d/engine/q3dwindow.h +++ b/src/datavis3d/engine/q3dwindow.h @@ -56,21 +56,20 @@ class Q3DWindowPrivate; class QTENTERPRISE_DATAVIS3D_EXPORT Q3DWindow : public QWindow, protected QOpenGLFunctions { Q_OBJECT + public: explicit Q3DWindow(QWindow *parent = 0); ~Q3DWindow(); - virtual void render(); - - virtual void initialize(); - - void setAnimating(bool animating); - -public slots: +private slots: void renderLater(); void renderNow(); protected: + virtual void render(); + virtual void initialize(); + + void setAnimating(bool animating); bool event(QEvent *event); void exposeEvent(QExposeEvent *event); diff --git a/src/datavis3d/engine/qdataitem.cpp b/src/datavis3d/engine/qdataitem.cpp index 8134fcb5..883c190c 100644 --- a/src/datavis3d/engine/qdataitem.cpp +++ b/src/datavis3d/engine/qdataitem.cpp @@ -47,15 +47,46 @@ QTENTERPRISE_DATAVIS3D_BEGIN_NAMESPACE +/*! + * \class QDataItem + * \inmodule QtDataVis3D + * \brief The QDataItem class provides a container for data to be added to graphs. + * \since 1.0.0 + * + * A QDataItem holds data for a single bar in a Q3DMaps or Q3DBars graph. + * + * \sa QDataRow, QDataSet, {Qt Data Visualization 3D C++ Classes} + */ + +/*! + * \a value A float value of the data item. + * + * \a label A QString label for the item. + * + * Constructs QDataItem. + */ QDataItem::QDataItem(float value, const QString &label) : d_ptr(new QDataItemPrivate(this, value, label)) { } +/*! + * Destroys QDataItem. + */ QDataItem::~QDataItem() { } +/*! + * \property QDataItem::label + * + * \a label A QString label for the data item. Unit, for example. + * + * \a prepend A flag to indicate if the label is to be prepended or appended to the value. + * \c false by default. + * + * Sets label for the data item. + */ void QDataItem::setLabel(const QString &label, bool prepend) { d_ptr->m_labelString = label; @@ -67,11 +98,25 @@ QString QDataItem::label() return d_ptr->m_labelString; } +/*! + * \property QDataItem::value + * + * \a value A float value for the data item. + * + * Sets value for the data item. + */ void QDataItem::setValue(float value) { d_ptr->m_value = value; } +/*! + * \overload QDataItem::value + * + * \a value An int value for the data item. + * + * Sets value for the data item. + */ void QDataItem::setValue(int value) { d_ptr->m_value = (float)value; @@ -82,11 +127,25 @@ float QDataItem::value() return d_ptr->m_value; } +/*! + * \property QDataItem::position + * + * \a position A QPointF position for the data item. + * + * Sets position for the data item. Has no effect in Q3DBars. + */ void QDataItem::setPosition(const QPointF &position) { d_ptr->m_position = position; } +/*! + * \overload QDataItem::position + * + * \a position A QPoint position for the data item. + * + * Sets position for the data item. Has no effect in Q3DBars. + */ void QDataItem::setPosition(const QPoint &position) { d_ptr->m_position = (QPointF)position; diff --git a/src/datavis3d/engine/qdataitem.h b/src/datavis3d/engine/qdataitem.h index 8a2797ae..7c8302f4 100644 --- a/src/datavis3d/engine/qdataitem.h +++ b/src/datavis3d/engine/qdataitem.h @@ -60,13 +60,13 @@ class QTENTERPRISE_DATAVIS3D_EXPORT QDataItem : public QObject Q_PROPERTY(QString label READ label WRITE setLabel) Q_PROPERTY(float value READ value WRITE setValue) Q_PROPERTY(int value READ value WRITE setValue) - Q_PROPERTY(int value READ value WRITE setValue) Q_PROPERTY(QPointF position READ position WRITE setPosition) public: explicit QDataItem(float value = 0.0f, const QString &label = QString()); ~QDataItem(); + // TODO: Provide a Q_INVOKABLE version of this, or move prepend to it's own property. void setLabel(const QString &label, bool prepend = false); // label for value, unit for example QString label(); void setValue(float value); @@ -80,7 +80,6 @@ public: private: QScopedPointer<QDataItemPrivate> d_ptr; friend class Bars3dShared; - friend class Bars3dSharedPrivate; friend class Q3DMaps; friend class Q3DMapsPrivate; friend class QDataRowPrivate; diff --git a/src/datavis3d/engine/qdatarow.cpp b/src/datavis3d/engine/qdatarow.cpp index 79bc48e1..6bdd6d14 100644 --- a/src/datavis3d/engine/qdatarow.cpp +++ b/src/datavis3d/engine/qdatarow.cpp @@ -48,15 +48,44 @@ QTENTERPRISE_DATAVIS3D_BEGIN_NAMESPACE +/*! + * \class QDataRow + * \inmodule QtDataVis3D + * \brief The QDataRow class provides a container for data items to be added to graphs. + * \since 1.0.0 + * + * A QDataRow is a container for all data to be added to a Q3DMaps instance, or a single row to + * be added to a QDataSet. It holds instances of QDataItem and has no knowledge of possible + * sample space sizes set for a Q3DBars instance. The ownership of QDataItem added is transferred + * to QDataRow. + * + * \sa QDataItem, QDataSet, {Qt Data Visualization 3D C++ Classes} + */ + +/*! + * \a label A QString label for the row. + * + * Constructs QDataRow. + */ QDataRow::QDataRow(const QString &label) : d_ptr(new QDataRowPrivate(this, label)) { } +/*! + * Destroys QDataRow and all instances of QDataItem it may hold. + */ QDataRow::~QDataRow() { } +/*! + * \property QDataRow::label + * + * \a label A QString label for the row. + * + * Sets a label for the row. + */ void QDataRow::setLabel(const QString &label) { d_ptr->m_label = label; @@ -67,6 +96,11 @@ QString QDataRow::label() return d_ptr->m_label; } +/*! + * \a item A QDataItem instance. + * + * Adds a QDataItem to the QDataRow. Ownership of QDataItem is transferred to QDataRow. + */ void QDataRow::addItem(QDataItem *item) { d_ptr->m_row.prepend(item); diff --git a/src/datavis3d/engine/qdatarow.h b/src/datavis3d/engine/qdatarow.h index b4ee1d6b..72fa5f55 100644 --- a/src/datavis3d/engine/qdatarow.h +++ b/src/datavis3d/engine/qdatarow.h @@ -68,7 +68,6 @@ public: private: QScopedPointer<QDataRowPrivate> d_ptr; friend class Bars3dShared; - friend class Bars3dSharedPrivate; friend class Q3DMaps; friend class Q3DMapsPrivate; friend class QDataSetPrivate; diff --git a/src/datavis3d/engine/qdataset.cpp b/src/datavis3d/engine/qdataset.cpp index ab892127..6fd59baf 100644 --- a/src/datavis3d/engine/qdataset.cpp +++ b/src/datavis3d/engine/qdataset.cpp @@ -53,17 +53,47 @@ QTENTERPRISE_DATAVIS3D_BEGIN_NAMESPACE const QString empty; +/*! + * \class QDataSet + * \inmodule QtDataVis3D + * \brief The QDataSet class provides a container for data rows to be added to graphs. + * \since 1.0.0 + * + * A QDataSet is a container for data to be added into a Q3DBars instance. It holds instances of + * QDataRow and has no knowledge of sample space size set for Q3DBars. The ownership of QDataRow + * added is transferred to QDataSet. + * + * \sa QDataItem, QDataRow, {Qt Data Visualization 3D C++ Classes} + */ + +/*! + * Constructs QDataSet. + */ QDataSet::QDataSet() : d_ptr(new QDataSetPrivate(this)) { - //qDebug("QDataSet"); } +/*! + * Destroys QDataSet, including all QDataRow instances it may hold. + */ QDataSet::~QDataSet() { - //qDebug("~QDataSet"); } +/*! + * \a xAxis A QString label for x axis. + * + * \a zAxis A QString label for z axis. + * + * \a yAxis A QString label for y axis. + * + * \a labelsRow A QVector of QStrings, one for each row. + * + * \a labelsColumn A QVector of QStrings, one for each column. + * + * Sets labels for the QDataSet. + */ void QDataSet::setLabels(const QString &xAxis, const QString &zAxis, const QString &yAxis, @@ -106,6 +136,12 @@ void QDataSet::setLabels(const QString &xAxis, } } +/*! + * \a row A QDataRow instance. + * + * Adds a QDataRow instance to QDataSet. Ownership of the QDataRow instance is transferred to + * QDataSet. + */ void QDataSet::addRow(QDataRow *row) { d_ptr->m_set.prepend(row); diff --git a/src/datavis3d/engine/qdataset.h b/src/datavis3d/engine/qdataset.h index a7a509a5..e645bc16 100644 --- a/src/datavis3d/engine/qdataset.h +++ b/src/datavis3d/engine/qdataset.h @@ -72,7 +72,6 @@ public: private: QScopedPointer<QDataSetPrivate> d_ptr; friend class Bars3dShared; - friend class Bars3dSharedPrivate; friend class Q3DMaps; friend class Q3DMapsPrivate; }; diff --git a/src/datavis3d/engine/theme_p.h b/src/datavis3d/engine/theme_p.h index 29a020e9..234d4709 100644 --- a/src/datavis3d/engine/theme_p.h +++ b/src/datavis3d/engine/theme_p.h @@ -70,7 +70,6 @@ public: private: friend class Bars3dShared; - friend class Bars3dSharedPrivate; friend class Q3DMaps; friend class Q3DMapsPrivate; friend class Drawer; diff --git a/src/datavis3d/global/qdatavis3dglobal.h b/src/datavis3d/global/qdatavis3dglobal.h index 7e135937..7dad9374 100644 --- a/src/datavis3d/global/qdatavis3dglobal.h +++ b/src/datavis3d/global/qdatavis3dglobal.h @@ -18,8 +18,8 @@ ** ****************************************************************************/ -#ifndef QVIS3DGLOBAL_H -#define QVIS3DGLOBAL_H +#ifndef QDATAVIS3DGLOBAL_H +#define QDATAVIS3DGLOBAL_H #include <qglobal.h> diff --git a/src/datavis3dqml2/declarativebars.h b/src/datavis3dqml2/declarativebars.h index b730ba6d..8194cd7d 100644 --- a/src/datavis3dqml2/declarativebars.h +++ b/src/datavis3dqml2/declarativebars.h @@ -45,7 +45,6 @@ #include "bars3dshared_p.h" #include "qdatavis3dglobal.h" #include "qdatavis3namespace.h" -#include "q3dbarsshared.h" #include "declarativebars_p.h" #include <qsgsimpletexturenode.h> @@ -58,8 +57,6 @@ class QQuickWindow; QTENTERPRISE_DATAVIS3D_BEGIN_NAMESPACE - - class DeclarativeBars : public QQuickItem { Q_OBJECT |