1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef Q3DSCENE_H
5#define Q3DSCENE_H
6
7#include <QtDataVisualization/qdatavisualizationglobal.h>
8#include <QtDataVisualization/q3dcamera.h>
9#include <QtDataVisualization/q3dlight.h>
10#include <QtCore/QObject>
11#include <QtCore/QRect>
12
13QT_BEGIN_NAMESPACE
14
15class Q3DScenePrivate;
16
17class Q_DATAVISUALIZATION_EXPORT Q3DScene : public QObject
18{
19 Q_OBJECT
20 Q_PROPERTY(QRect viewport READ viewport NOTIFY viewportChanged)
21 Q_PROPERTY(QRect primarySubViewport READ primarySubViewport WRITE setPrimarySubViewport NOTIFY primarySubViewportChanged)
22 Q_PROPERTY(QRect secondarySubViewport READ secondarySubViewport WRITE setSecondarySubViewport NOTIFY secondarySubViewportChanged)
23 Q_PROPERTY(QPoint selectionQueryPosition READ selectionQueryPosition WRITE setSelectionQueryPosition NOTIFY selectionQueryPositionChanged)
24 Q_PROPERTY(bool secondarySubviewOnTop READ isSecondarySubviewOnTop WRITE setSecondarySubviewOnTop NOTIFY secondarySubviewOnTopChanged)
25 Q_PROPERTY(bool slicingActive READ isSlicingActive WRITE setSlicingActive NOTIFY slicingActiveChanged)
26 Q_PROPERTY(Q3DCamera* activeCamera READ activeCamera WRITE setActiveCamera NOTIFY activeCameraChanged)
27 Q_PROPERTY(Q3DLight* activeLight READ activeLight WRITE setActiveLight NOTIFY activeLightChanged)
28 Q_PROPERTY(float devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged)
29 Q_PROPERTY(QPoint graphPositionQuery READ graphPositionQuery WRITE setGraphPositionQuery NOTIFY graphPositionQueryChanged REVISION(1, 2))
30
31public:
32 explicit Q3DScene(QObject *parent = nullptr);
33 virtual ~Q3DScene();
34
35 QRect viewport() const;
36
37 QRect primarySubViewport() const;
38 void setPrimarySubViewport(const QRect &primarySubViewport);
39 bool isPointInPrimarySubView(const QPoint &point);
40
41 QRect secondarySubViewport() const;
42 void setSecondarySubViewport(const QRect &secondarySubViewport);
43 bool isPointInSecondarySubView(const QPoint &point);
44
45 void setSelectionQueryPosition(const QPoint &point);
46 QPoint selectionQueryPosition() const;
47 static QPoint invalidSelectionPoint();
48
49 void setGraphPositionQuery(const QPoint &point);
50 QPoint graphPositionQuery() const;
51
52 void setSlicingActive(bool isSlicing);
53 bool isSlicingActive() const;
54
55 void setSecondarySubviewOnTop(bool isSecondaryOnTop);
56 bool isSecondarySubviewOnTop() const;
57
58 Q3DCamera *activeCamera() const;
59 void setActiveCamera(Q3DCamera *camera);
60
61 Q3DLight *activeLight() const;
62 void setActiveLight(Q3DLight *light);
63
64 float devicePixelRatio() const;
65 void setDevicePixelRatio(float pixelRatio);
66
67Q_SIGNALS:
68 void viewportChanged(const QRect &viewport);
69 void primarySubViewportChanged(const QRect &subViewport);
70 void secondarySubViewportChanged(const QRect &subViewport);
71 void secondarySubviewOnTopChanged(bool isSecondaryOnTop);
72 void slicingActiveChanged(bool isSlicingActive);
73 void activeCameraChanged(Q3DCamera *camera);
74 void activeLightChanged(Q3DLight *light);
75 void devicePixelRatioChanged(float pixelRatio);
76 void selectionQueryPositionChanged(const QPoint &position);
77 Q_REVISION(1, 2) void graphPositionQueryChanged(const QPoint &position);
78
79private:
80 QScopedPointer<Q3DScenePrivate> d_ptr;
81
82 Q_DISABLE_COPY(Q3DScene)
83
84 friend class AbstractDeclarative;
85 friend class QAbstract3DGraph;
86 friend class QAbstract3DGraphPrivate;
87 friend class Abstract3DController;
88 friend class Bars3DController;
89 friend class Q3DScenePrivate;
90 friend class Abstract3DRenderer;
91 friend class Bars3DRenderer;
92 friend class Surface3DRenderer;
93 friend class Scatter3DRenderer;
94 friend class Q3DCameraPrivate;
95 friend class Q3DObject;
96};
97
98QT_END_NAMESPACE
99
100#endif
101

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