diff options
Diffstat (limited to 'src/datavis3d/global')
-rw-r--r-- | src/datavis3d/global/datavis3dglobal_p.h | 52 | ||||
-rw-r--r-- | src/datavis3d/global/global.pri | 7 | ||||
-rw-r--r-- | src/datavis3d/global/qdatavis3denums.h | 115 | ||||
-rw-r--r-- | src/datavis3d/global/qdatavis3dglobal.h | 81 | ||||
-rw-r--r-- | src/datavis3d/global/qdatavis3namespace.h | 147 | ||||
-rw-r--r-- | src/datavis3d/global/qtdatavis3dnamespace.qdoc | 163 |
6 files changed, 362 insertions, 203 deletions
diff --git a/src/datavis3d/global/datavis3dglobal_p.h b/src/datavis3d/global/datavis3dglobal_p.h new file mode 100644 index 00000000..d556c5e1 --- /dev/null +++ b/src/datavis3d/global/datavis3dglobal_p.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the QtDataVis3D API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef DATAVIS3DGLOBAL_P_H +#define DATAVIS3DGLOBAL_P_H + +#include "qdatavis3dglobal.h" +#include "qdatavis3denums.h" +#include <QOpenGLFunctions> +#include <QVector3D> +#include <QDebug> + +//#define ROTATE_ZOOM_SELECTION + +QT_DATAVIS3D_BEGIN_NAMESPACE + +// Constants used in several files +// Compensation for z position; move all objects to positive z, as shader can't handle negative values correctly +const GLfloat zComp = 10.0f; +// Default light position. To have shadows working correctly, light should be as far as camera, or a bit further +// y position is added to the minimum height (or can be thought to be that much above or below the camera) +const QVector3D defaultLightPos = QVector3D(0.0f, 0.5f, zComp); +const GLfloat defaultRatio = 1.0f / 1.6f; // default aspect ratio 16:10 + +QT_DATAVIS3D_END_NAMESPACE + +#endif // DATAVIS3DGLOBAL_P_H diff --git a/src/datavis3d/global/global.pri b/src/datavis3d/global/global.pri index 56cb9f8f..7292bbd6 100644 --- a/src/datavis3d/global/global.pri +++ b/src/datavis3d/global/global.pri @@ -1,5 +1,4 @@ -INCLUDEPATH += $$PWD -VPATH += $$PWD HEADERS += \ - global/qdatavis3dglobal.h \ - global/qdatavis3namespace.h + $$PWD/qdatavis3dglobal.h \ + $$PWD/qdatavis3denums.h \ + $$PWD/datavis3dglobal_p.h diff --git a/src/datavis3d/global/qdatavis3denums.h b/src/datavis3d/global/qdatavis3denums.h new file mode 100644 index 00000000..a6384508 --- /dev/null +++ b/src/datavis3d/global/qdatavis3denums.h @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef QDATAVIS3DENUMS_H +#define QDATAVIS3DENUMS_H + +#include <QtDataVis3D/qdatavis3dglobal.h> +#include <QObject> + +QT_DATAVIS3D_BEGIN_NAMESPACE + +class QT_DATAVIS3D_EXPORT QDataVis : public QObject +{ + Q_OBJECT + Q_ENUMS(MeshStyle) + Q_ENUMS(CameraPreset) + Q_ENUMS(ColorTheme) + Q_ENUMS(SelectionMode) + Q_ENUMS(ShadowQuality) + Q_ENUMS(LabelTransparency) + +public: + + enum MeshStyle { + Bars = 0, + Pyramids, + Cones, + Cylinders, + BevelBars, + Spheres, + Dots + }; + + enum CameraPreset { + NoPreset = -1, + PresetFrontLow = 0, + PresetFront, + PresetFrontHigh, + PresetLeftLow, + PresetLeft, + PresetLeftHigh, + PresetRightLow, + PresetRight, + PresetRightHigh, + PresetBehindLow, + PresetBehind, + PresetBehindHigh, + PresetIsometricLeft, + PresetIsometricLeftHigh, + PresetIsometricRight, + PresetIsometricRightHigh, + PresetDirectlyAbove, + PresetDirectlyAboveCW45, + PresetDirectlyAboveCCW45, + PresetFrontBelow, // These work only for graphs including negative values. + PresetLeftBelow, // They act as Preset...Low for positive-only values. + PresetRightBelow, + PresetBehindBelow, + PresetDirectlyBelow + }; + + enum ColorTheme { + ThemeDefault = -1, + ThemeSystem = 0, + ThemeBlueCerulean, + ThemeBlueIcy, + ThemeBlueNcs, + ThemeBrownSand, + ThemeDark, + ThemeHighContrast, + ThemeLight + }; + + enum SelectionMode { + ModeNone = 0, + ModeItem, + ModeItemAndRow, // From here onwards used for Q3DBars only + ModeItemAndColumn, + ModeItemRowAndColumn, + ModeZoomRow, + ModeZoomColumn + }; + + enum ShadowQuality { + ShadowNone = 0, + ShadowLow = 1, + ShadowMedium = 3, + ShadowHigh = 5 + }; + + enum LabelTransparency { + TransparencyNone = 0, // Full solid, using colors from theme + TransparencyFromTheme, // Use colors and transparencies from theme + TransparencyNoBackground // Draw just text on transparent background + }; +}; + +QT_DATAVIS3D_END_NAMESPACE + +#endif diff --git a/src/datavis3d/global/qdatavis3dglobal.h b/src/datavis3d/global/qdatavis3dglobal.h index 7dad9374..5e2e88b1 100644 --- a/src/datavis3d/global/qdatavis3dglobal.h +++ b/src/datavis3d/global/qdatavis3dglobal.h @@ -4,17 +4,15 @@ ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of QtDataVis3D. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. ** ** If you have questions regarding the use of this file, please use ** contact form at http://qt.digia.com -** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -23,68 +21,47 @@ #include <qglobal.h> -//#define ROTATE_ZOOM_SELECTION - -#define QTENTERPRISE_DATAVIS3D_VERSION_STR "0.0.1" +#define QT_DATAVIS3D_VERSION_STR "0.0.1" /* - QTENTERPRISE_DATAVIS3D_VERSION is (major << 16) + (minor << 8) + patch. + QT_DATAVIS3D_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QTENTERPRISE_DATAVIS3D_VERSION 0x000001 +#define QT_DATAVIS3D_VERSION 0x000001 /* - can be used like #if (QTENTERPRISE_DATAVIS3D_VERSION >= QTENTERPRISE_DATAVIS3D_VERSION_CHECK(1, 1, 0)) + can be used like #if (QT_DATAVIS3D_VERSION >= QT_DATAVIS3D_VERSION_CHECK(1, 1, 0)) */ -#define QTENTERPRISE_DATAVIS3D_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) +#define QT_DATAVIS3D_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) -#if defined(QTENTERPRISE_DATAVIS3D_LIBRARY) -# define QTENTERPRISE_DATAVIS3D_EXPORT Q_DECL_EXPORT +#if defined(QT_DATAVIS3D_LIBRARY) +# define QT_DATAVIS3D_EXPORT Q_DECL_EXPORT #else -# define QTENTERPRISE_DATAVIS3D_EXPORT Q_DECL_IMPORT +# define QT_DATAVIS3D_EXPORT Q_DECL_IMPORT #endif -#if defined(BUILD_PRIVATE_UNIT_TESTS) && defined(QTENTERPRISE_DATAVIS3D_LIBRARY) -# define QTENTERPRISE_DATAVIS3D_AUTOTEST_EXPORT Q_DECL_EXPORT -#elif defined(BUILD_PRIVATE_UNIT_TESTS) && !defined(QTENTERPRISE_DATAVIS3D_LIBRARY) -# define QTENTERPRISE_DATAVIS3D_AUTOTEST_EXPORT Q_DECL_IMPORT +#if defined(BUILD_PRIVATE_UNIT_TESTS) && defined(QT_DATAVIS3D_LIBRARY) +# define QT_DATAVIS3D_AUTOTEST_EXPORT Q_DECL_EXPORT +#elif defined(BUILD_PRIVATE_UNIT_TESTS) && !defined(QT_DATAVIS3D_LIBRARY) +# define QT_DATAVIS3D_AUTOTEST_EXPORT Q_DECL_IMPORT #else -# define QTENTERPRISE_DATAVIS3D_AUTOTEST_EXPORT +# define QT_DATAVIS3D_AUTOTEST_EXPORT #endif -#ifdef QTENTERPRISE_DATAVIS3D_STATICLIB -# undef QTENTERPRISE_DATAVIS3D_EXPORT -# undef QTENTERPRISE_DATAVIS3D_AUTOTEST_EXPORT -# define QTENTERPRISE_DATAVIS3D_EXPORT -# define QTENTERPRISE_DATAVIS3D_AUTOTEST_EXPORT +#ifdef QT_DATAVIS3D_STATICLIB +# undef QT_DATAVIS3D_EXPORT +# undef QT_DATAVIS3D_AUTOTEST_EXPORT +# define QT_DATAVIS3D_EXPORT +# define QT_DATAVIS3D_AUTOTEST_EXPORT #endif -#define QTENTERPRISE_DATAVIS3D_NAMESPACE QtDataVis3D +#define QT_DATAVIS3D_NAMESPACE QtDataVis3D -#ifdef QTENTERPRISE_DATAVIS3D_NAMESPACE -# define QTENTERPRISE_DATAVIS3D_BEGIN_NAMESPACE namespace QTENTERPRISE_DATAVIS3D_NAMESPACE { -# define QTENTERPRISE_DATAVIS3D_END_NAMESPACE } -# define QTENTERPRISE_DATAVIS3D_USE_NAMESPACE using namespace QTENTERPRISE_DATAVIS3D_NAMESPACE; +#ifdef QT_DATAVIS3D_NAMESPACE +# define QT_DATAVIS3D_BEGIN_NAMESPACE namespace QT_DATAVIS3D_NAMESPACE { +# define QT_DATAVIS3D_END_NAMESPACE } +# define QT_DATAVIS3D_USE_NAMESPACE using namespace QT_DATAVIS3D_NAMESPACE; #else -# define QTENTERPRISE_DATAVIS3D_BEGIN_NAMESPACE -# define QTENTERPRISE_DATAVIS3D_END_NAMESPACE -# define QTENTERPRISE_DATAVIS3D_USE_NAMESPACE -#endif - -#if defined(DEVELOPMENT_BUILD) && !defined(QT_NO_DEBUG) -#include <stdarg.h> -#include <QDebug> - -#define CHART_DEBUG chartDebug(3,__LINE__,__FILE__,__FUNCTION__) - -static inline QDebug chartDebug(int numargs,...) -{ - va_list valist; - va_start(valist, numargs); - //for( int i = 0 ; i < numargs; i++ ) - int line = va_arg(valist, int); - char *file = va_arg(valist, char *); - char *function = va_arg(valist, char *); - va_end(valist); - return qDebug() << QString().append(function).append("(").append(file).append(":%1)").arg(line); -} +# define QT_DATAVIS3D_BEGIN_NAMESPACE +# define QT_DATAVIS3D_END_NAMESPACE +# define QT_DATAVIS3D_USE_NAMESPACE #endif #endif // QVIS3DGLOBAL_H diff --git a/src/datavis3d/global/qdatavis3namespace.h b/src/datavis3d/global/qdatavis3namespace.h deleted file mode 100644 index e36cc02a..00000000 --- a/src/datavis3d/global/qdatavis3namespace.h +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of 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$ -** -****************************************************************************/ - -#ifndef QVIS3DNAMESPACE_H -#define QVIS3DNAMESPACE_H - -#include "qdatavis3dglobal.h" -#include <QOpenGLFunctions> -#include <QVector3D> - -QTENTERPRISE_DATAVIS3D_BEGIN_NAMESPACE - -// Constants used in several files -const GLfloat m_pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679f; -// Compensation for z position; move all objects to positive z, as shader can't handle negative values correctly -const GLfloat zComp = 10.0f; -// Default light position. To have shadows working correctly, light should be as far as camera, or a bit further -// y position is added to the minimum height (or can be thought to be that much above or below the camera) -const QVector3D defaultLightPos = QVector3D(0.0f, 0.5f, zComp); -const GLfloat defaultRatio = 1.0f / 1.6f; // default aspect ratio 16:10 - -// Enums used in several files -enum BarStyle { - Bars = 0, - Pyramids, - Cones, - Cylinders, - BevelBars, - Spheres -}; - -enum CameraPreset { - PresetFrontLow = 0, - PresetFront, - PresetFrontHigh, - PresetLeftLow, - PresetLeft, - PresetLeftHigh, - PresetRightLow, - PresetRight, - PresetRightHigh, - PresetBehindLow, - PresetBehind, - PresetBehindHigh, - PresetIsometricLeft, - PresetIsometricLeftHigh, - PresetIsometricRight, - PresetIsometricRightHigh, - PresetDirectlyAbove, - PresetDirectlyAboveCW45, - PresetDirectlyAboveCCW45, - PresetFrontBelow, // These work only for graphs including negative values. - PresetLeftBelow, // They act as Preset...Low for positive-only values. - PresetRightBelow, - PresetBehindBelow, - PresetDirectlyBelow -}; - -enum ColorTheme { - ThemeSystem = 0, - ThemeBlueCerulean, - ThemeBlueIcy, - ThemeBlueNcs, - ThemeBrownSand, - ThemeDark, - ThemeHighContrast, - ThemeLight -}; - -// TODO: Should this be moved to Q3DBarsPrivate? Not for use via API directly? -enum LabelPosition { - LabelBelow = 0, - LabelLow, - LabelMid, - LabelHigh, - LabelOver, - LabelBottom, // Absolute positions from here onward, used for axes (QDataItem is ignored) - LabelTop, - LabelLeft, - LabelRight -}; - -// TODO: Will these be used from other vis types than Q3DBars? -enum SelectionMode { - ModeNone = 0, - ModeBar, - ModeBarAndRow, - ModeBarAndColumn, - ModeBarRowAndColumn, - ModeZoomRow, - ModeZoomColumn -}; - -enum ShadowQuality { - ShadowNone = 0, - ShadowLow = 1, - ShadowMedium = 3, - ShadowHigh = 5 -}; - -enum LabelTransparency { - TransparencyNone = 0, // Full solid, using colors from theme - TransparencyFromTheme, // Use colors and transparencies from theme - TransparencyNoBackground // Draw just text on transparent background -}; - -QTENTERPRISE_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/global/qtdatavis3dnamespace.qdoc b/src/datavis3d/global/qtdatavis3dnamespace.qdoc new file mode 100644 index 00000000..2a1f6fae --- /dev/null +++ b/src/datavis3d/global/qtdatavis3dnamespace.qdoc @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +/*! + \namespace QtDataVis3D + \inmodule QtDataVis3D + \target QtDataVis3D Namespace + + \brief The QtDataVis3D namespace contains miscellaneous identifiers + used throughout the QtDataVis3D library. +*/ + +/*! + \enum QtDataVis3D::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 QtDataVis3D::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 QtDataVis3D::ColorTheme + + Predefined color themes. + + \value ThemeSystem + \value ThemeBlueCerulean + \value ThemeBlueIcy + \value ThemeBlueNcs + \value ThemeBrownSand + \value ThemeDark + \value ThemeHighContrast + \value ThemeLight +*/ + +/*! + \enum QtDataVis3D::LabelPosition + + Predefined positions for labels. + + \value LabelBelow + \value LabelLow + \value LabelMid + \value LabelHigh + \value LabelOver + \value LabelBottom + \value LabelTop + \value LabelLeft + \value LabelRight +*/ + +/*! + \enum QtDataVis3D::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 QtDataVis3D::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 QtDataVis3D::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. +*/ |