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 Q3DSCENE_H
31#define Q3DSCENE_H
32
33#include <QtDataVisualization/qdatavisualizationglobal.h>
34#include <QtDataVisualization/q3dcamera.h>
35#include <QtDataVisualization/q3dlight.h>
36#include <QtCore/QObject>
37#include <QtCore/QRect>
38
39QT_BEGIN_NAMESPACE_DATAVISUALIZATION
40
41class Q3DScenePrivate;
42
43class QT_DATAVISUALIZATION_EXPORT Q3DScene : public QObject
44{
45 Q_OBJECT
46 Q_PROPERTY(QRect viewport READ viewport NOTIFY viewportChanged)
47 Q_PROPERTY(QRect primarySubViewport READ primarySubViewport WRITE setPrimarySubViewport NOTIFY primarySubViewportChanged)
48 Q_PROPERTY(QRect secondarySubViewport READ secondarySubViewport WRITE setSecondarySubViewport NOTIFY secondarySubViewportChanged)
49 Q_PROPERTY(QPoint selectionQueryPosition READ selectionQueryPosition WRITE setSelectionQueryPosition NOTIFY selectionQueryPositionChanged)
50 Q_PROPERTY(bool secondarySubviewOnTop READ isSecondarySubviewOnTop WRITE setSecondarySubviewOnTop NOTIFY secondarySubviewOnTopChanged)
51 Q_PROPERTY(bool slicingActive READ isSlicingActive WRITE setSlicingActive NOTIFY slicingActiveChanged)
52 Q_PROPERTY(Q3DCamera* activeCamera READ activeCamera WRITE setActiveCamera NOTIFY activeCameraChanged)
53 Q_PROPERTY(Q3DLight* activeLight READ activeLight WRITE setActiveLight NOTIFY activeLightChanged)
54 Q_PROPERTY(float devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged)
55 Q_PROPERTY(QPoint graphPositionQuery READ graphPositionQuery WRITE setGraphPositionQuery NOTIFY graphPositionQueryChanged REVISION 1)
56
57public:
58 explicit Q3DScene(QObject *parent = nullptr);
59 virtual ~Q3DScene();
60
61 QRect viewport() const;
62
63 QRect primarySubViewport() const;
64 void setPrimarySubViewport(const QRect &primarySubViewport);
65 bool isPointInPrimarySubView(const QPoint &point);
66
67 QRect secondarySubViewport() const;
68 void setSecondarySubViewport(const QRect &secondarySubViewport);
69 bool isPointInSecondarySubView(const QPoint &point);
70
71 void setSelectionQueryPosition(const QPoint &point);
72 QPoint selectionQueryPosition() const;
73 static QPoint invalidSelectionPoint();
74
75 void setGraphPositionQuery(const QPoint &point);
76 QPoint graphPositionQuery() const;
77
78 void setSlicingActive(bool isSlicing);
79 bool isSlicingActive() const;
80
81 void setSecondarySubviewOnTop(bool isSecondaryOnTop);
82 bool isSecondarySubviewOnTop() const;
83
84 Q3DCamera *activeCamera() const;
85 void setActiveCamera(Q3DCamera *camera);
86
87 Q3DLight *activeLight() const;
88 void setActiveLight(Q3DLight *light);
89
90 float devicePixelRatio() const;
91 void setDevicePixelRatio(float pixelRatio);
92
93Q_SIGNALS:
94 void viewportChanged(const QRect &viewport);
95 void primarySubViewportChanged(const QRect &subViewport);
96 void secondarySubViewportChanged(const QRect &subViewport);
97 void secondarySubviewOnTopChanged(bool isSecondaryOnTop);
98 void slicingActiveChanged(bool isSlicingActive);
99 void activeCameraChanged(Q3DCamera *camera);
100 void activeLightChanged(Q3DLight *light);
101 void devicePixelRatioChanged(float pixelRatio);
102 void selectionQueryPositionChanged(const QPoint &position);
103 Q_REVISION(1) void graphPositionQueryChanged(const QPoint &position);
104
105private:
106 QScopedPointer<Q3DScenePrivate> d_ptr;
107
108 Q_DISABLE_COPY(Q3DScene)
109
110 friend class AbstractDeclarative;
111 friend class QAbstract3DGraph;
112 friend class QAbstract3DGraphPrivate;
113 friend class Abstract3DController;
114 friend class Bars3DController;
115 friend class Q3DScenePrivate;
116 friend class Abstract3DRenderer;
117 friend class Bars3DRenderer;
118 friend class Surface3DRenderer;
119 friend class Scatter3DRenderer;
120 friend class Q3DCameraPrivate;
121 friend class Q3DObject;
122};
123
124QT_END_NAMESPACE_DATAVISUALIZATION
125
126#endif
127

source code of qtdatavis3d/src/datavisualization/engine/q3dscene.h