1 | // Copyright (C) 2023 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QQUICKGRAPHSITEM_H |
5 | #define QQUICKGRAPHSITEM_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the QtGraphs API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | |
17 | #include "qabstract3dgraph.h" |
18 | |
19 | #include <QtQuick3D/private/qquick3dviewport_p.h> |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | class Abstract3DController; |
24 | class Declarative3DScene; |
25 | class Q3DTheme; |
26 | class QAbstract3DAxis; |
27 | class QAbstract3DInputHandler; |
28 | class QAbstract3DSeries; |
29 | class QCustom3DItem; |
30 | class QCustom3DVolume; |
31 | class QCustom3DLabel; |
32 | class QQuick3DCustomMaterial; |
33 | class QQuick3DDirectionalLight; |
34 | class QQuick3DPrincipledMaterial; |
35 | class QQuick3DRepeater; |
36 | class QQuick3DPerspectiveCamera; |
37 | class QQuick3DOrthographicCamera; |
38 | |
39 | class QQuickGraphsItem : public QQuick3DViewport |
40 | { |
41 | Q_OBJECT |
42 | Q_PROPERTY(QAbstract3DGraph::SelectionFlags selectionMode READ selectionMode WRITE setSelectionMode NOTIFY selectionModeChanged) |
43 | Q_PROPERTY(QAbstract3DGraph::ShadowQuality shadowQuality READ shadowQuality WRITE setShadowQuality NOTIFY shadowQualityChanged) |
44 | Q_PROPERTY(int msaaSamples READ msaaSamples WRITE setMsaaSamples NOTIFY msaaSamplesChanged) |
45 | Q_PROPERTY(Declarative3DScene *scene READ scene NOTIFY sceneChanged) |
46 | Q_PROPERTY(QAbstract3DInputHandler *inputHandler READ inputHandler WRITE setInputHandler NOTIFY inputHandlerChanged) |
47 | Q_PROPERTY(Q3DTheme *theme READ theme WRITE setTheme NOTIFY themeChanged) |
48 | Q_PROPERTY(QAbstract3DGraph::RenderingMode renderingMode READ renderingMode WRITE setRenderingMode NOTIFY renderingModeChanged) |
49 | Q_PROPERTY(bool measureFps READ measureFps WRITE setMeasureFps NOTIFY measureFpsChanged) |
50 | Q_PROPERTY(int currentFps READ currentFps NOTIFY currentFpsChanged) |
51 | Q_PROPERTY(QQmlListProperty<QCustom3DItem> customItemList READ customItemList CONSTANT) |
52 | Q_PROPERTY(bool orthoProjection READ isOrthoProjection WRITE setOrthoProjection NOTIFY orthoProjectionChanged) |
53 | Q_PROPERTY(QAbstract3DGraph::ElementType selectedElement READ selectedElement NOTIFY selectedElementChanged) |
54 | Q_PROPERTY(qreal aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged) |
55 | Q_PROPERTY(QAbstract3DGraph::OptimizationHints optimizationHints READ optimizationHints WRITE setOptimizationHints NOTIFY optimizationHintsChanged) |
56 | Q_PROPERTY(bool polar READ isPolar WRITE setPolar NOTIFY polarChanged) |
57 | Q_PROPERTY(float radialLabelOffset READ radialLabelOffset WRITE setRadialLabelOffset NOTIFY radialLabelOffsetChanged) |
58 | Q_PROPERTY(qreal horizontalAspectRatio READ horizontalAspectRatio WRITE setHorizontalAspectRatio NOTIFY horizontalAspectRatioChanged) |
59 | Q_PROPERTY(bool reflection READ isReflection WRITE setReflection NOTIFY reflectionChanged) |
60 | Q_PROPERTY(qreal reflectivity READ reflectivity WRITE setReflectivity NOTIFY reflectivityChanged) |
61 | Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged) |
62 | Q_PROPERTY(QVector3D queriedGraphPosition READ queriedGraphPosition NOTIFY queriedGraphPositionChanged) |
63 | Q_PROPERTY(qreal margin READ margin WRITE setMargin NOTIFY marginChanged) |
64 | |
65 | QML_NAMED_ELEMENT(GraphsItem3D) |
66 | QML_UNCREATABLE("Trying to create uncreatable: GraphsItem3D." ) |
67 | |
68 | public: |
69 | explicit QQuickGraphsItem(QQuickItem *parent = 0); |
70 | virtual ~QQuickGraphsItem(); |
71 | |
72 | virtual void setRenderingMode(QAbstract3DGraph::RenderingMode mode); |
73 | virtual QAbstract3DGraph::RenderingMode renderingMode() const; |
74 | |
75 | virtual void setSelectionMode(QAbstract3DGraph::SelectionFlags mode); |
76 | virtual QAbstract3DGraph::SelectionFlags selectionMode() const; |
77 | |
78 | virtual void setShadowQuality(QAbstract3DGraph::ShadowQuality quality); |
79 | virtual QAbstract3DGraph::ShadowQuality shadowQuality() const; |
80 | |
81 | virtual QAbstract3DGraph::ElementType selectedElement() const; |
82 | |
83 | virtual void setMsaaSamples(int samples); |
84 | virtual int msaaSamples() const; |
85 | |
86 | virtual Declarative3DScene *scene() const; |
87 | |
88 | virtual QAbstract3DInputHandler *inputHandler() const; |
89 | virtual void setInputHandler(QAbstract3DInputHandler *inputHandler); |
90 | |
91 | virtual void addTheme(Q3DTheme *theme); |
92 | virtual void releaseTheme(Q3DTheme *theme); |
93 | virtual void setTheme(Q3DTheme *theme); |
94 | virtual Q3DTheme *theme() const; |
95 | virtual QList<Q3DTheme *> themes() const; |
96 | |
97 | Q_INVOKABLE virtual void clearSelection(); |
98 | |
99 | Q_INVOKABLE virtual bool hasSeries(QAbstract3DSeries *series); |
100 | |
101 | Q_INVOKABLE virtual int addCustomItem(QCustom3DItem *item); |
102 | Q_INVOKABLE virtual void removeCustomItems(); |
103 | Q_INVOKABLE virtual void removeCustomItem(QCustom3DItem *item); |
104 | Q_INVOKABLE virtual void removeCustomItemAt(const QVector3D &position); |
105 | Q_INVOKABLE virtual void releaseCustomItem(QCustom3DItem *item); |
106 | |
107 | Q_INVOKABLE virtual int selectedLabelIndex() const; |
108 | Q_INVOKABLE virtual QAbstract3DAxis *selectedAxis() const; |
109 | |
110 | Q_INVOKABLE virtual int selectedCustomItemIndex() const; |
111 | Q_INVOKABLE virtual QCustom3DItem *selectedCustomItem() const; |
112 | |
113 | QQmlListProperty<QCustom3DItem> customItemList(); |
114 | static void appendCustomItemFunc(QQmlListProperty<QCustom3DItem> *list, |
115 | QCustom3DItem *item); |
116 | static qsizetype countCustomItemFunc(QQmlListProperty<QCustom3DItem> *list); |
117 | static QCustom3DItem *atCustomItemFunc(QQmlListProperty<QCustom3DItem> *list, qsizetype index); |
118 | static void clearCustomItemFunc(QQmlListProperty<QCustom3DItem> *list); |
119 | |
120 | void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; |
121 | |
122 | void setSharedController(Abstract3DController *controller); |
123 | |
124 | void checkWindowList(QQuickWindow *window); |
125 | |
126 | void setMeasureFps(bool enable); |
127 | bool measureFps() const; |
128 | int currentFps() const; |
129 | |
130 | void setOrthoProjection(bool enable); |
131 | bool isOrthoProjection() const; |
132 | |
133 | void setAspectRatio(qreal ratio); |
134 | qreal aspectRatio() const; |
135 | |
136 | void setOptimizationHints(QAbstract3DGraph::OptimizationHints hints); |
137 | QAbstract3DGraph::OptimizationHints optimizationHints() const; |
138 | |
139 | void setPolar(bool enable); |
140 | bool isPolar() const; |
141 | |
142 | void setRadialLabelOffset(float offset); |
143 | float radialLabelOffset() const; |
144 | |
145 | void setHorizontalAspectRatio(qreal ratio); |
146 | qreal horizontalAspectRatio() const; |
147 | |
148 | void setReflection(bool enable); |
149 | bool isReflection() const; |
150 | |
151 | void setReflectivity(qreal reflectivity); |
152 | qreal reflectivity() const; |
153 | |
154 | void setLocale(const QLocale &locale); |
155 | QLocale locale() const; |
156 | |
157 | QVector3D queriedGraphPosition() const; |
158 | |
159 | void setMargin(qreal margin); |
160 | qreal margin() const; |
161 | |
162 | QMutex *mutex() { return &m_mutex; } |
163 | |
164 | bool isReady() { return isComponentComplete(); } |
165 | QQuick3DNode *rootNode() const; |
166 | |
167 | QQuick3DNode *cameraTarget() { return m_cameraTarget; } |
168 | void setCameraTarget(QQuick3DNode *target) { m_cameraTarget = target; } |
169 | |
170 | QQuick3DModel *background() const { return m_background; } |
171 | void setBackground(QQuick3DModel *newBackground) { m_background = newBackground; } |
172 | inline QQuick3DModel *backgroundBB() const { return m_backgroundBB; } |
173 | |
174 | QQuick3DDirectionalLight *light() const; |
175 | QQuick3DCustomMaterial *createQmlCustomMaterial(const QString &fileName); |
176 | QQuick3DPrincipledMaterial *createPrincipledMaterial(); |
177 | |
178 | QQuickItem *itemLabel() { return m_itemLabel; } |
179 | QQuick3DNode *sliceItemLabel() { return m_sliceItemLabel; } |
180 | |
181 | QQuick3DModel *m_targetVisualizer; |
182 | |
183 | QQuick3DRepeater *repeaterX() const { return m_repeaterX; } |
184 | QQuick3DRepeater *repeaterY() const { return m_repeaterY; } |
185 | QQuick3DRepeater *repeaterZ() const { return m_repeaterZ; } |
186 | |
187 | QQuick3DNode *titleLabelX() const { return m_titleLabelX; } |
188 | QQuick3DNode *titleLabelY() const { return m_titleLabelY; } |
189 | QQuick3DNode *titleLabelZ() const { return m_titleLabelZ; } |
190 | |
191 | QQuick3DRepeater *segmentLineRepeaterX() const { return m_segmentLineRepeaterX; } |
192 | QQuick3DRepeater *segmentLineRepeaterY() const { return m_segmentLineRepeaterY; } |
193 | QQuick3DRepeater *segmentLineRepeaterZ() const { return m_segmentLineRepeaterZ; } |
194 | |
195 | QQuick3DRepeater *subsegmentLineRepeaterX() const { return m_subsegmentLineRepeaterX; } |
196 | QQuick3DRepeater *subsegmentLineRepeaterY() const { return m_subsegmentLineRepeaterY; } |
197 | QQuick3DRepeater *subsegmentLineRepeaterZ() const { return m_subsegmentLineRepeaterZ; } |
198 | |
199 | bool isXFlipped() const { return m_xFlipped; } |
200 | void setXFlipped(bool xFlipped) { m_xFlipped = xFlipped; } |
201 | bool isYFlipped() const { return m_yFlipped; } |
202 | void setYFlipped(bool yFlipped) { m_yFlipped = yFlipped; } |
203 | bool isZFlipped() const { return m_zFlipped; } |
204 | void setZFlipped(bool zFlipped) { m_zFlipped = zFlipped; } |
205 | QVector3D scaleWithBackground() const { return m_scaleWithBackground; } |
206 | void setScaleWithBackground(const QVector3D &scale) { m_scaleWithBackground = scale; } |
207 | void setBackgroundScaleMargin(const QVector3D &margin) { m_backgroundScaleMargin = margin; } |
208 | QVector3D rotation() const { return m_rot; } |
209 | void setRotation(const QVector3D &rotation) { m_rot = rotation; } |
210 | QVector3D scale() const { return m_scale; } |
211 | void setScale(const QVector3D &scale) { m_scale = scale; } |
212 | QVector3D translate() const { return m_translate; } |
213 | void setTranslate(const QVector3D &translate) { m_translate = translate;} |
214 | |
215 | float lineLengthScaleFactor() const { return m_lineLengthScaleFactor; } |
216 | void setLineLengthScaleFactor(float scaleFactor) { m_lineLengthScaleFactor = scaleFactor; } |
217 | float lineWidthScaleFactor() const { return m_lineWidthScaleFactor; } |
218 | void setLineWidthScaleFactor(float scaleFactor) { m_lineWidthScaleFactor = scaleFactor; } |
219 | float gridOffset() const { return m_gridOffset; } |
220 | void setLabelMargin(float margin) { m_labelMargin = margin; } |
221 | float labelMargin() const { return m_labelMargin; } |
222 | |
223 | void changeLabelBackgroundColor(QQuick3DRepeater *repeater, const QColor &color); |
224 | void changeLabelBackgroundEnabled(QQuick3DRepeater *repeater, const bool &enabled); |
225 | void changeLabelBorderEnabled(QQuick3DRepeater *repeater, const bool &enabled); |
226 | void changeLabelTextColor(QQuick3DRepeater *repeater, const QColor &color); |
227 | void changeLabelFont(QQuick3DRepeater *repeater, const QFont &font); |
228 | void changeLabelsEnabled(QQuick3DRepeater *repeater, const bool &enabled); |
229 | void changeGridLineColor(QQuick3DRepeater *repeater, const QColor &color); |
230 | void updateTitleLabels(); |
231 | virtual void updateSelectionMode(QAbstract3DGraph::SelectionFlags newMode); |
232 | |
233 | virtual bool doPicking(const QPointF &point); |
234 | |
235 | void minimizeMainGraph(); |
236 | |
237 | public Q_SLOTS: |
238 | virtual void handleAxisXChanged(QAbstract3DAxis *axis) = 0; |
239 | virtual void handleAxisYChanged(QAbstract3DAxis *axis) = 0; |
240 | virtual void handleAxisZChanged(QAbstract3DAxis *axis) = 0; |
241 | void handleFpsChanged(); |
242 | void windowDestroyed(QObject *obj); |
243 | |
244 | Q_SIGNALS: |
245 | void selectionModeChanged(QAbstract3DGraph::SelectionFlags mode); |
246 | void shadowQualityChanged(QAbstract3DGraph::ShadowQuality quality); |
247 | void shadowsSupportedChanged(bool supported); |
248 | void msaaSamplesChanged(int samples); |
249 | void inputHandlerChanged(QAbstract3DInputHandler *inputHandler); |
250 | void themeChanged(Q3DTheme *theme); |
251 | void renderingModeChanged(QAbstract3DGraph::RenderingMode mode); |
252 | void measureFpsChanged(bool enabled); |
253 | void currentFpsChanged(int fps); |
254 | void selectedElementChanged(QAbstract3DGraph::ElementType type); |
255 | void orthoProjectionChanged(bool enabled); |
256 | void aspectRatioChanged(qreal ratio); |
257 | void optimizationHintsChanged(QAbstract3DGraph::OptimizationHints hints); |
258 | void polarChanged(bool enabled); |
259 | void radialLabelOffsetChanged(float offset); |
260 | void horizontalAspectRatioChanged(qreal ratio); |
261 | void reflectionChanged(bool enabled); |
262 | void reflectivityChanged(qreal reflectivity); |
263 | void localeChanged(const QLocale &locale); |
264 | void queriedGraphPositionChanged(const QVector3D &data); |
265 | void marginChanged(qreal margin); |
266 | |
267 | protected: |
268 | bool event(QEvent *event) override; |
269 | void mouseDoubleClickEvent(QMouseEvent *event) override; |
270 | void touchEvent(QTouchEvent *event) override; |
271 | void mousePressEvent(QMouseEvent *event) override; |
272 | void mouseReleaseEvent(QMouseEvent *event) override; |
273 | void mouseMoveEvent(QMouseEvent *event) override; |
274 | #if QT_CONFIG(wheelevent) |
275 | void wheelEvent(QWheelEvent *event) override; |
276 | #endif |
277 | virtual void handleWindowChanged(/*QQuickWindow *win*/); |
278 | void itemChange(ItemChange change, const ItemChangeData &value) override; |
279 | virtual void updateWindowParameters(); |
280 | virtual void handleSelectionModeChange(QAbstract3DGraph::SelectionFlags mode); |
281 | virtual void handleShadowQualityChange(QAbstract3DGraph::ShadowQuality quality); |
282 | virtual void handleSelectedElementChange(QAbstract3DGraph::ElementType type); |
283 | virtual void handleOptimizationHintChange(QAbstract3DGraph::OptimizationHints hints); |
284 | virtual void keyPressEvent(QKeyEvent *ev) override; |
285 | virtual bool handleMousePressedEvent(QMouseEvent *event); |
286 | virtual bool handleTouchEvent(QTouchEvent *event); |
287 | virtual void handleThemeTypeChange(); |
288 | virtual void handleParentWidthChange(); |
289 | virtual void handleParentHeightChange(); |
290 | void componentComplete() override; |
291 | void checkSliceEnabled(); |
292 | |
293 | virtual void createSliceView(); |
294 | |
295 | QQuick3DNode *graphNode() { return m_graphNode; } |
296 | QQuick3DViewport *sliceView() { return m_sliceView; } |
297 | |
298 | QQmlComponent *createRepeaterDelegateComponent(const QString &fileName); |
299 | QQuick3DRepeater *createRepeater(QQuick3DNode *parent = nullptr); |
300 | QQuick3DNode *createTitleLabel(QQuick3DNode *parent = nullptr); |
301 | void createItemLabel(); |
302 | |
303 | void updateXTitle(const QVector3D &labelRotation, const QVector3D &labelTrans, |
304 | const QQuaternion &totalRotation, float labelsMaxWidth, |
305 | const QVector3D &scale); |
306 | void updateYTitle(const QVector3D &sideLabelRotation, const QVector3D &backLabelRotation, |
307 | const QVector3D &sideLabelTrans, const QVector3D &backLabelTrans, |
308 | const QQuaternion &totalSideRotation, const QQuaternion &totalBackRotation, |
309 | float labelsMaxWidth, const QVector3D &scale); |
310 | void updateZTitle(const QVector3D &labelRotation, const QVector3D &labelTrans, |
311 | const QQuaternion &totalRotation, float labelsMaxWidth, |
312 | const QVector3D &scale); |
313 | |
314 | virtual void calculateSceneScalingFactors(); |
315 | void positionAndScaleLine(QQuick3DNode *lineNode, QVector3D scale, QVector3D position); |
316 | int findLabelsMaxWidth(const QStringList &labels); |
317 | virtual QVector3D calculateCategoryLabelPosition(QAbstract3DAxis *axis, QVector3D labelPosition, int index); |
318 | virtual float calculateCategoryGridLinePosition(QAbstract3DAxis *axis, int index); |
319 | void setFloorGridInRange(bool inRange) { m_isFloorGridInRange = inRange; } |
320 | void setVerticalSegmentLine(bool hasVerticalLine) { m_hasVerticalSegmentLine = hasVerticalLine; } |
321 | void updateGrid(); |
322 | void updateLabels(); |
323 | void updateSliceGrid(); |
324 | void updateSliceLabels(); |
325 | virtual void updateShadowQuality(QAbstract3DGraph::ShadowQuality quality); |
326 | void updateItemLabel(const QVector3D &position); |
327 | |
328 | struct Volume { |
329 | QQuick3DModel *model = nullptr; |
330 | QQuick3DTexture *texture = nullptr; |
331 | QQuick3DTextureData *textureData = nullptr; |
332 | QQuick3DTexture *colorTexture = nullptr; |
333 | QQuick3DTextureData *colorTextureData = nullptr; |
334 | bool updateTextureData = false; |
335 | bool updateColorTextureData = false; |
336 | bool useHighDefShader = false; |
337 | bool drawSlices = false; |
338 | bool drawSliceFrames = false; |
339 | QQuick3DModel *sliceFrameX = nullptr; |
340 | QQuick3DModel *sliceFrameY = nullptr; |
341 | QQuick3DModel *sliceFrameZ = nullptr; |
342 | QQuick3DTexture *sliceFrameTexture = nullptr; |
343 | }; |
344 | |
345 | virtual void synchData(); |
346 | virtual void updateGraph() {} |
347 | |
348 | bool isSliceEnabled() const { return m_sliceEnabled; } |
349 | void setSliceEnabled(bool enabled) { m_sliceEnabled = enabled; } |
350 | bool isSliceActivatedChanged() const { return m_sliceActivatedChanged; } |
351 | void setSliceActivatedChanged(bool changed) { m_sliceActivatedChanged = changed; } |
352 | virtual void updateSliceGraph(); |
353 | |
354 | virtual void updateAxisRange(float min, float max); |
355 | virtual void updateAxisReversed(bool enable); |
356 | virtual void updateSingleHighlightColor() {} |
357 | virtual void updateLightStrength() {} |
358 | |
359 | virtual void handleLabelCountChanged(QQuick3DRepeater *repeater); |
360 | |
361 | bool isGridUpdated() { return m_gridUpdated; } |
362 | void setGridUpdated(bool updated) { m_gridUpdated = updated; } |
363 | |
364 | void addInputHandler(QAbstract3DInputHandler *inputHandler); |
365 | void releaseInputHandler(QAbstract3DInputHandler *inputHandler); |
366 | void setActiveInputHandler(QAbstract3DInputHandler *inputHandler); |
367 | QAbstract3DInputHandler *activeInputHandler() const { return m_activeInputHandler; }; |
368 | QList<QAbstract3DInputHandler *> inputHandlers() const { return m_inputHandlers; }; |
369 | |
370 | QSharedPointer<QMutex> m_nodeMutex; |
371 | |
372 | QMap<QCustom3DVolume *, Volume> m_customVolumes; |
373 | |
374 | private: |
375 | QQuick3DNode *m_graphNode = nullptr; |
376 | QQuick3DModel *m_background = nullptr; |
377 | QQuick3DModel *m_backgroundBB = nullptr; |
378 | QQuick3DNode *m_backgroundScale = nullptr; |
379 | QQuick3DNode *m_backgroundRotation = nullptr; |
380 | |
381 | QQuick3DRepeater *m_repeaterX = nullptr; |
382 | QQuick3DRepeater *m_repeaterY = nullptr; |
383 | QQuick3DRepeater *m_repeaterZ = nullptr; |
384 | |
385 | QQuick3DNode *m_titleLabelX = nullptr; |
386 | QQuick3DNode *m_titleLabelY = nullptr; |
387 | QQuick3DNode *m_titleLabelZ = nullptr; |
388 | |
389 | QQuickItem *m_itemLabel = nullptr; |
390 | QQuick3DNode *m_sliceItemLabel = nullptr; |
391 | |
392 | QQuick3DRepeater *m_segmentLineRepeaterX = nullptr; |
393 | QQuick3DRepeater *m_subsegmentLineRepeaterX = nullptr; |
394 | QQuick3DRepeater *m_segmentLineRepeaterY = nullptr; |
395 | QQuick3DRepeater *m_subsegmentLineRepeaterY = nullptr; |
396 | QQuick3DRepeater *m_segmentLineRepeaterZ = nullptr; |
397 | QQuick3DRepeater *m_subsegmentLineRepeaterZ = nullptr; |
398 | |
399 | QQuick3DViewport *m_sliceView = nullptr; |
400 | QQuick3DRepeater *m_sliceHorizontalGridRepeater = nullptr; |
401 | QQuick3DRepeater *m_sliceVerticalGridRepeater = nullptr; |
402 | QQuick3DRepeater *m_sliceHorizontalLabelRepeater = nullptr; |
403 | QQuick3DRepeater *m_sliceVerticalLabelRepeater = nullptr; |
404 | |
405 | QQuick3DNode *m_sliceHorizontalTitleLabel = nullptr; |
406 | QQuick3DNode *m_sliceVerticalTitleLabel = nullptr; |
407 | |
408 | QPointer<Abstract3DController> m_controller; |
409 | QQuick3DNode *m_cameraTarget = nullptr; |
410 | QQuick3DDirectionalLight *m_light = nullptr; |
411 | QQuick3DPerspectiveCamera *m_pCamera = nullptr; |
412 | QQuick3DOrthographicCamera *m_oCamera = nullptr; |
413 | QRectF m_cachedGeometry; |
414 | QAbstract3DGraph::RenderingMode m_renderMode = QAbstract3DGraph::RenderDirectToBackground; |
415 | int m_samples = 0; |
416 | int m_windowSamples = 0; |
417 | QSize m_initialisedSize = QSize(0, 0); |
418 | bool m_runningInDesigner; |
419 | QMutex m_mutex; |
420 | |
421 | bool m_xFlipped = false; |
422 | bool m_yFlipped = false; |
423 | bool m_zFlipped = false; |
424 | |
425 | bool m_flipScales; |
426 | |
427 | bool m_isFloorGridInRange = false; |
428 | bool m_hasVerticalSegmentLine = true; |
429 | |
430 | QVector3D m_scaleWithBackground = QVector3D(1.0f, 1.0f, 1.0f); |
431 | QVector3D m_backgroundScaleMargin = QVector3D(0.0f, 0.0f, 0.0f); |
432 | |
433 | QVector3D m_rot = QVector3D(1.0f, 1.0f, 1.0f); |
434 | |
435 | QVector3D m_scale = QVector3D(1.0f, 1.0f, 1.0f); |
436 | |
437 | QVector3D m_translate = QVector3D(1.0f, 1.0f, 1.0f); |
438 | |
439 | QVector3D m_labelScale = QVector3D(0.01f, 0.01f, 0.0f); |
440 | |
441 | float m_gridOffset = 0.002f; |
442 | float m_lineWidthScaleFactor = 0.0001f; |
443 | float m_lineLengthScaleFactor = 0.02f; |
444 | |
445 | float m_fontScaleFactorA = -1.130435e-06f; |
446 | float m_fontScaleFactorB = 0.000115652f; |
447 | |
448 | float m_labelMargin = .1f; |
449 | |
450 | bool m_sliceEnabled = false; |
451 | bool m_sliceActivatedChanged = false; |
452 | |
453 | bool m_gridUpdated = false; |
454 | |
455 | QVector3D m_labelPosition = QVector3D(); |
456 | |
457 | float m_initialZoomLevel = -1.0f; |
458 | void setUpCamera(); |
459 | void setUpLight(); |
460 | void graphPositionAt(const QPoint& point); |
461 | void updateCamera(); |
462 | void updateRadialLabelOffset(); |
463 | void handleSegmentLineCountChanged(QAbstract3DAxis *axis, QQuick3DRepeater *repeater); |
464 | void handleSubSegmentLineCountChanged(QAbstract3DAxis *axis, QQuick3DRepeater *repeater); |
465 | QVector3D calculateLabelRotation(float labelAutoAngle); |
466 | void updateCustomData(); |
467 | void updateCustomLabelsRotation(); |
468 | float fontScaleFactor(float pointSize); |
469 | float labelAdjustment(float width); |
470 | |
471 | void createVolumeMaterial(QCustom3DVolume *volume, Volume &volumeItem); |
472 | QQuick3DModel *createSliceFrame(Volume &volumeItem); |
473 | void updateSliceFrameMaterials(QCustom3DVolume *volume, Volume &volumeItem); |
474 | void updateCustomVolumes(); |
475 | |
476 | QHash<QQuickGraphsItem *, QQuickWindow *> m_graphWindowList = {}; |
477 | QHash<QCustom3DLabel *, QQuick3DNode *> m_customLabelList = {}; |
478 | QHash<QCustom3DItem *, QQuick3DModel *> m_customItemList = {}; |
479 | QList<QCustom3DItem *> m_pendingCustomItemList = {}; |
480 | |
481 | int m_currentFps = -1; |
482 | bool m_measureFps = false; |
483 | |
484 | QAbstract3DInputHandler *m_activeInputHandler = nullptr; |
485 | QList<QAbstract3DInputHandler *> m_inputHandlers = {}; |
486 | |
487 | friend class QAbstract3DGraph; |
488 | }; |
489 | |
490 | QT_END_NAMESPACE |
491 | |
492 | #endif |
493 | |