| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | 
| 4 | ** Contact: https://www.qt.io/licensing/ | 
| 5 | ** | 
| 6 | ** This file is part of the Qt Data Visualization module of the Qt Toolkit. | 
| 7 | ** | 
| 8 | ** $QT_BEGIN_LICENSE:GPL$ | 
| 9 | ** Commercial License Usage | 
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | 
| 11 | ** accordance with the commercial license agreement provided with the | 
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | 
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | 
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | 
| 16 | ** | 
| 17 | ** GNU General Public License Usage | 
| 18 | ** Alternatively, this file may be used under the terms of the GNU | 
| 19 | ** General Public License version 3 or (at your option) any later version | 
| 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by | 
| 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 | 
| 22 | ** included in the packaging of this file. Please review the following | 
| 23 | ** information to ensure the GNU General Public License requirements will | 
| 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. | 
| 25 | ** | 
| 26 | ** $QT_END_LICENSE$ | 
| 27 | ** | 
| 28 | ****************************************************************************/ | 
| 29 |  | 
| 30 | #ifndef Q3DCAMERA_H | 
| 31 | #define Q3DCAMERA_H | 
| 32 |  | 
| 33 | #include <QtDataVisualization/q3dobject.h> | 
| 34 |  | 
| 35 | QT_BEGIN_NAMESPACE_DATAVISUALIZATION | 
| 36 |  | 
| 37 | class Q3DCameraPrivate; | 
| 38 |  | 
| 39 | class QT_DATAVISUALIZATION_EXPORT Q3DCamera : public Q3DObject | 
| 40 | { | 
| 41 |     Q_OBJECT | 
| 42 |     Q_ENUMS(CameraPreset) | 
| 43 |     Q_PROPERTY(float xRotation READ xRotation WRITE setXRotation NOTIFY xRotationChanged) | 
| 44 |     Q_PROPERTY(float yRotation READ yRotation WRITE setYRotation NOTIFY yRotationChanged) | 
| 45 |     Q_PROPERTY(float zoomLevel READ zoomLevel WRITE setZoomLevel NOTIFY zoomLevelChanged) | 
| 46 |     Q_PROPERTY(CameraPreset cameraPreset READ cameraPreset WRITE setCameraPreset NOTIFY cameraPresetChanged) | 
| 47 |     Q_PROPERTY(bool wrapXRotation READ wrapXRotation WRITE setWrapXRotation NOTIFY wrapXRotationChanged) | 
| 48 |     Q_PROPERTY(bool wrapYRotation READ wrapYRotation WRITE setWrapYRotation NOTIFY wrapYRotationChanged) | 
| 49 |     Q_PROPERTY(QVector3D target READ target WRITE setTarget NOTIFY targetChanged REVISION 1) | 
| 50 |     Q_PROPERTY(float minZoomLevel READ minZoomLevel WRITE setMinZoomLevel NOTIFY minZoomLevelChanged REVISION 1) | 
| 51 |     Q_PROPERTY(float maxZoomLevel READ maxZoomLevel WRITE setMaxZoomLevel NOTIFY maxZoomLevelChanged REVISION 1) | 
| 52 |  | 
| 53 | public: | 
| 54 |     enum CameraPreset { | 
| 55 |         CameraPresetNone = -1, | 
| 56 |         CameraPresetFrontLow = 0, | 
| 57 |         CameraPresetFront, | 
| 58 |         CameraPresetFrontHigh, | 
| 59 |         CameraPresetLeftLow, | 
| 60 |         CameraPresetLeft, | 
| 61 |         CameraPresetLeftHigh, | 
| 62 |         CameraPresetRightLow, | 
| 63 |         CameraPresetRight, | 
| 64 |         CameraPresetRightHigh, | 
| 65 |         CameraPresetBehindLow, | 
| 66 |         CameraPresetBehind, | 
| 67 |         CameraPresetBehindHigh, | 
| 68 |         CameraPresetIsometricLeft, | 
| 69 |         CameraPresetIsometricLeftHigh, | 
| 70 |         CameraPresetIsometricRight, | 
| 71 |         CameraPresetIsometricRightHigh, | 
| 72 |         CameraPresetDirectlyAbove, | 
| 73 |         CameraPresetDirectlyAboveCW45, | 
| 74 |         CameraPresetDirectlyAboveCCW45, | 
| 75 |         CameraPresetFrontBelow, | 
| 76 |         CameraPresetLeftBelow, | 
| 77 |         CameraPresetRightBelow, | 
| 78 |         CameraPresetBehindBelow, | 
| 79 |         CameraPresetDirectlyBelow | 
| 80 |     }; | 
| 81 |  | 
| 82 |     explicit Q3DCamera(QObject *parent = nullptr); | 
| 83 |     virtual ~Q3DCamera(); | 
| 84 |  | 
| 85 |     float xRotation() const; | 
| 86 |     void setXRotation(float rotation); | 
| 87 |     float yRotation() const; | 
| 88 |     void setYRotation(float rotation); | 
| 89 |  | 
| 90 |     bool wrapXRotation() const; | 
| 91 |     void setWrapXRotation(bool isEnabled); | 
| 92 |  | 
| 93 |     bool wrapYRotation() const; | 
| 94 |     void setWrapYRotation(bool isEnabled); | 
| 95 |  | 
| 96 |     virtual void copyValuesFrom(const Q3DObject &source); | 
| 97 |  | 
| 98 |     CameraPreset cameraPreset() const; | 
| 99 |     void setCameraPreset(CameraPreset preset); | 
| 100 |  | 
| 101 |     float zoomLevel() const; | 
| 102 |     void setZoomLevel(float zoomLevel); | 
| 103 |     float minZoomLevel() const; | 
| 104 |     void setMinZoomLevel(float zoomLevel); | 
| 105 |     float maxZoomLevel() const; | 
| 106 |     void setMaxZoomLevel(float zoomLevel); | 
| 107 |  | 
| 108 |     void setCameraPosition(float horizontal, float vertical, float zoom = 100.0f); | 
| 109 |  | 
| 110 |     QVector3D target() const; | 
| 111 |     void setTarget(const QVector3D &target); | 
| 112 |  | 
| 113 | Q_SIGNALS: | 
| 114 |     void xRotationChanged(float rotation); | 
| 115 |     void yRotationChanged(float rotation); | 
| 116 |     void zoomLevelChanged(float zoomLevel); | 
| 117 |     void cameraPresetChanged(Q3DCamera::CameraPreset preset); | 
| 118 |     void wrapXRotationChanged(bool isEnabled); | 
| 119 |     void wrapYRotationChanged(bool isEnabled); | 
| 120 |     Q_REVISION(1) void targetChanged(const QVector3D &target); | 
| 121 |     Q_REVISION(1) void minZoomLevelChanged(float zoomLevel); | 
| 122 |     Q_REVISION(1) void maxZoomLevelChanged(float zoomLevel); | 
| 123 |  | 
| 124 | private: | 
| 125 |     QScopedPointer<Q3DCameraPrivate> d_ptr; | 
| 126 |  | 
| 127 |     Q_DISABLE_COPY(Q3DCamera) | 
| 128 |  | 
| 129 |     friend class Q3DCameraPrivate; | 
| 130 |     friend class Q3DScenePrivate; | 
| 131 |     friend class Abstract3DRenderer; | 
| 132 |     friend class Bars3DRenderer; | 
| 133 |     friend class Surface3DRenderer; | 
| 134 |     friend class Scatter3DRenderer; | 
| 135 |     friend class SelectionPointer; | 
| 136 |     friend class Q3DInputHandler; | 
| 137 |     friend class QTouch3DInputHandlerPrivate; | 
| 138 | }; | 
| 139 |  | 
| 140 | QT_END_NAMESPACE_DATAVISUALIZATION | 
| 141 |  | 
| 142 | #endif | 
| 143 |  |