| 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 <QtGraphs/qgraphs3dnamespace.h> |
| 18 | #include "qabstract3daxis.h" |
| 19 | #include "qabstract3dseries.h" |
| 20 | #include "qcategory3daxis.h" |
| 21 | #include "qvalue3daxis.h" |
| 22 | |
| 23 | #include <QtQuick3D/private/qquick3dviewport_p.h> |
| 24 | Q_MOC_INCLUDE(<QtGraphs / q3dscene.h>) |
| 25 | |
| 26 | QT_BEGIN_NAMESPACE |
| 27 | class Q3DScene; |
| 28 | |
| 29 | class QAbstract3DAxis; |
| 30 | class QAbstract3DSeries; |
| 31 | class QCustom3DItem; |
| 32 | class QCustom3DVolume; |
| 33 | class QCustom3DLabel; |
| 34 | class QGraphsInputHandler; |
| 35 | class QGraphsTheme; |
| 36 | class QQuick3DCustomMaterial; |
| 37 | class QQuick3DDirectionalLight; |
| 38 | class QQuick3DPrincipledMaterial; |
| 39 | class QQuick3DRepeater; |
| 40 | class QQuick3DPerspectiveCamera; |
| 41 | class QQuick3DOrthographicCamera; |
| 42 | |
| 43 | struct Abstract3DChangeBitField |
| 44 | { |
| 45 | bool themeChanged : 1; |
| 46 | bool shadowQualityChanged : 1; |
| 47 | bool selectionModeChanged : 1; |
| 48 | bool optimizationHintChanged : 1; |
| 49 | bool axisXTypeChanged : 1; |
| 50 | bool axisYTypeChanged : 1; |
| 51 | bool axisZTypeChanged : 1; |
| 52 | bool axisXTitleChanged : 1; |
| 53 | bool axisYTitleChanged : 1; |
| 54 | bool axisZTitleChanged : 1; |
| 55 | bool axisXLabelsChanged : 1; |
| 56 | bool axisYLabelsChanged : 1; |
| 57 | bool axisZLabelsChanged : 1; |
| 58 | bool axisXRangeChanged : 1; |
| 59 | bool axisYRangeChanged : 1; |
| 60 | bool axisZRangeChanged : 1; |
| 61 | bool axisXSegmentCountChanged : 1; |
| 62 | bool axisYSegmentCountChanged : 1; |
| 63 | bool axisZSegmentCountChanged : 1; |
| 64 | bool axisXSubSegmentCountChanged : 1; |
| 65 | bool axisYSubSegmentCountChanged : 1; |
| 66 | bool axisZSubSegmentCountChanged : 1; |
| 67 | bool axisXLabelFormatChanged : 1; |
| 68 | bool axisYLabelFormatChanged : 1; |
| 69 | bool axisZLabelFormatChanged : 1; |
| 70 | bool axisXReversedChanged : 1; |
| 71 | bool axisYReversedChanged : 1; |
| 72 | bool axisZReversedChanged : 1; |
| 73 | bool axisXFormatterChanged : 1; |
| 74 | bool axisYFormatterChanged : 1; |
| 75 | bool axisZFormatterChanged : 1; |
| 76 | bool projectionChanged : 1; |
| 77 | bool axisXLabelAutoRotationChanged : 1; |
| 78 | bool axisYLabelAutoRotationChanged : 1; |
| 79 | bool axisZLabelAutoRotationChanged : 1; |
| 80 | bool aspectRatioChanged : 1; |
| 81 | bool horizontalAspectRatioChanged : 1; |
| 82 | bool axisXTitleVisibilityChanged : 1; |
| 83 | bool axisYTitleVisibilityChanged : 1; |
| 84 | bool axisZTitleVisibilityChanged : 1; |
| 85 | bool axisXLabelVisibilityChanged : 1; |
| 86 | bool axisYLabelVisibilityChanged : 1; |
| 87 | bool axisZLabelVisibilityChanged : 1; |
| 88 | bool axisXTitleFixedChanged : 1; |
| 89 | bool axisYTitleFixedChanged : 1; |
| 90 | bool axisZTitleFixedChanged : 1; |
| 91 | bool axisXTitleOffsetChanged : 1; |
| 92 | bool axisYTitleOffsetChanged : 1; |
| 93 | bool axisZTitleOffsetChanged : 1; |
| 94 | bool polarChanged : 1; |
| 95 | bool labelMarginChanged : 1; |
| 96 | bool radialLabelOffsetChanged : 1; |
| 97 | bool marginChanged : 1; |
| 98 | |
| 99 | Abstract3DChangeBitField() |
| 100 | : themeChanged(true) |
| 101 | , shadowQualityChanged(true) |
| 102 | , selectionModeChanged(true) |
| 103 | , optimizationHintChanged(true) |
| 104 | , axisXTypeChanged(true) |
| 105 | , axisYTypeChanged(true) |
| 106 | , axisZTypeChanged(true) |
| 107 | , axisXTitleChanged(true) |
| 108 | , axisYTitleChanged(true) |
| 109 | , axisZTitleChanged(true) |
| 110 | , axisXLabelsChanged(true) |
| 111 | , axisYLabelsChanged(true) |
| 112 | , axisZLabelsChanged(true) |
| 113 | , axisXRangeChanged(true) |
| 114 | , axisYRangeChanged(true) |
| 115 | , axisZRangeChanged(true) |
| 116 | , axisXSegmentCountChanged(true) |
| 117 | , axisYSegmentCountChanged(true) |
| 118 | , axisZSegmentCountChanged(true) |
| 119 | , axisXSubSegmentCountChanged(true) |
| 120 | , axisYSubSegmentCountChanged(true) |
| 121 | , axisZSubSegmentCountChanged(true) |
| 122 | , axisXLabelFormatChanged(true) |
| 123 | , axisYLabelFormatChanged(true) |
| 124 | , axisZLabelFormatChanged(true) |
| 125 | , axisXReversedChanged(true) |
| 126 | , axisYReversedChanged(true) |
| 127 | , axisZReversedChanged(true) |
| 128 | , axisXFormatterChanged(true) |
| 129 | , axisYFormatterChanged(true) |
| 130 | , axisZFormatterChanged(true) |
| 131 | , projectionChanged(true) |
| 132 | , axisXLabelAutoRotationChanged(true) |
| 133 | , axisYLabelAutoRotationChanged(true) |
| 134 | , axisZLabelAutoRotationChanged(true) |
| 135 | , aspectRatioChanged(true) |
| 136 | , horizontalAspectRatioChanged(true) |
| 137 | , axisXTitleVisibilityChanged(true) |
| 138 | , axisYTitleVisibilityChanged(true) |
| 139 | , axisZTitleVisibilityChanged(true) |
| 140 | , axisXLabelVisibilityChanged(true) |
| 141 | , axisYLabelVisibilityChanged(true) |
| 142 | , axisZLabelVisibilityChanged(true) |
| 143 | , axisXTitleFixedChanged(true) |
| 144 | , axisYTitleFixedChanged(true) |
| 145 | , axisZTitleFixedChanged(true) |
| 146 | , axisXTitleOffsetChanged(true) |
| 147 | , axisYTitleOffsetChanged(true) |
| 148 | , axisZTitleOffsetChanged(true) |
| 149 | , polarChanged(true) |
| 150 | , labelMarginChanged(true) |
| 151 | , radialLabelOffsetChanged(true) |
| 152 | , marginChanged(true) |
| 153 | {} |
| 154 | }; |
| 155 | |
| 156 | class Q_GRAPHS_EXPORT QQuickGraphsItem : public QQuick3DViewport |
| 157 | { |
| 158 | Q_OBJECT |
| 159 | Q_PROPERTY(QtGraphs3D::SelectionFlags selectionMode READ selectionMode WRITE setSelectionMode |
| 160 | NOTIFY selectionModeChanged) |
| 161 | Q_PROPERTY(QtGraphs3D::ShadowQuality shadowQuality READ shadowQuality WRITE setShadowQuality |
| 162 | NOTIFY shadowQualityChanged) |
| 163 | Q_PROPERTY(int msaaSamples READ msaaSamples WRITE setMsaaSamples NOTIFY msaaSamplesChanged) |
| 164 | Q_PROPERTY(Q3DScene *scene READ scene NOTIFY sceneChanged) |
| 165 | Q_PROPERTY(QGraphsTheme *theme READ theme WRITE setTheme NOTIFY themeChanged) |
| 166 | Q_PROPERTY(QtGraphs3D::RenderingMode renderingMode READ renderingMode WRITE setRenderingMode |
| 167 | NOTIFY renderingModeChanged) |
| 168 | Q_PROPERTY(bool measureFps READ measureFps WRITE setMeasureFps NOTIFY measureFpsChanged) |
| 169 | Q_PROPERTY(int currentFps READ currentFps NOTIFY currentFpsChanged) |
| 170 | Q_PROPERTY(QQmlListProperty<QCustom3DItem> customItemList READ customItemList CONSTANT) |
| 171 | Q_PROPERTY(bool orthoProjection READ isOrthoProjection WRITE setOrthoProjection NOTIFY |
| 172 | orthoProjectionChanged) |
| 173 | Q_PROPERTY( |
| 174 | QtGraphs3D::ElementType selectedElement READ selectedElement NOTIFY selectedElementChanged) |
| 175 | Q_PROPERTY(qreal aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged) |
| 176 | Q_PROPERTY(QtGraphs3D::OptimizationHint optimizationHint READ optimizationHint WRITE |
| 177 | setOptimizationHint NOTIFY optimizationHintChanged) |
| 178 | Q_PROPERTY(bool polar READ isPolar WRITE setPolar NOTIFY polarChanged) |
| 179 | Q_PROPERTY(float labelMargin READ labelMargin WRITE setLabelMargin NOTIFY labelMarginChanged) |
| 180 | Q_PROPERTY(float radialLabelOffset READ radialLabelOffset WRITE setRadialLabelOffset NOTIFY |
| 181 | radialLabelOffsetChanged) |
| 182 | Q_PROPERTY(qreal horizontalAspectRatio READ horizontalAspectRatio WRITE setHorizontalAspectRatio |
| 183 | NOTIFY horizontalAspectRatioChanged) |
| 184 | Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged) |
| 185 | Q_PROPERTY( |
| 186 | QVector3D queriedGraphPosition READ queriedGraphPosition NOTIFY queriedGraphPositionChanged) |
| 187 | Q_PROPERTY(qreal margin READ margin WRITE setMargin NOTIFY marginChanged) |
| 188 | Q_PROPERTY(float cameraXRotation READ cameraXRotation WRITE setCameraXRotation NOTIFY |
| 189 | cameraXRotationChanged) |
| 190 | Q_PROPERTY(float cameraYRotation READ cameraYRotation WRITE setCameraYRotation NOTIFY |
| 191 | cameraYRotationChanged) |
| 192 | Q_PROPERTY(float cameraZoomLevel READ cameraZoomLevel WRITE setCameraZoomLevel NOTIFY |
| 193 | cameraZoomLevelChanged) |
| 194 | Q_PROPERTY(QtGraphs3D::CameraPreset cameraPreset READ cameraPreset WRITE setCameraPreset NOTIFY |
| 195 | cameraPresetChanged) |
| 196 | Q_PROPERTY(QVector3D cameraTargetPosition READ cameraTargetPosition WRITE |
| 197 | setCameraTargetPosition NOTIFY cameraTargetPositionChanged) |
| 198 | Q_PROPERTY(float minCameraZoomLevel READ minCameraZoomLevel WRITE setMinCameraZoomLevel NOTIFY |
| 199 | minCameraZoomLevelChanged) |
| 200 | Q_PROPERTY(float maxCameraZoomLevel READ maxCameraZoomLevel WRITE setMaxCameraZoomLevel NOTIFY |
| 201 | maxCameraZoomLevelChanged) |
| 202 | Q_PROPERTY(bool wrapCameraXRotation READ wrapCameraXRotation WRITE setWrapCameraXRotation NOTIFY |
| 203 | wrapCameraXRotationChanged) |
| 204 | Q_PROPERTY(bool wrapCameraYRotation READ wrapCameraYRotation WRITE setWrapCameraYRotation NOTIFY |
| 205 | wrapCameraYRotationChanged) |
| 206 | Q_PROPERTY(bool rotationEnabled READ rotationEnabled WRITE setRotationEnabled NOTIFY |
| 207 | rotationEnabledChanged) |
| 208 | Q_PROPERTY(bool zoomAtTargetEnabled READ zoomAtTargetEnabled WRITE setZoomAtTargetEnabled NOTIFY |
| 209 | zoomAtTargetEnabledChanged) |
| 210 | Q_PROPERTY(bool selectionEnabled READ selectionEnabled WRITE setSelectionEnabled NOTIFY |
| 211 | selectionEnabledChanged) |
| 212 | Q_PROPERTY(bool zoomEnabled READ zoomEnabled WRITE setZoomEnabled NOTIFY zoomEnabledChanged) |
| 213 | |
| 214 | Q_PROPERTY(QColor lightColor READ lightColor WRITE setLightColor NOTIFY lightColorChanged) |
| 215 | Q_PROPERTY(float ambientLightStrength READ ambientLightStrength WRITE setAmbientLightStrength |
| 216 | NOTIFY ambientLightStrengthChanged) |
| 217 | Q_PROPERTY( |
| 218 | float lightStrength READ lightStrength WRITE setLightStrength NOTIFY lightStrengthChanged) |
| 219 | Q_PROPERTY(float shadowStrength READ shadowStrength WRITE setShadowStrength NOTIFY |
| 220 | shadowStrengthChanged) |
| 221 | Q_PROPERTY(QtGraphs3D::GridLineType gridLineType READ gridLineType WRITE setGridLineType NOTIFY |
| 222 | gridLineTypeChanged FINAL) |
| 223 | |
| 224 | QML_NAMED_ELEMENT(GraphsItem3D) |
| 225 | QML_UNCREATABLE("" ) |
| 226 | |
| 227 | public: |
| 228 | explicit QQuickGraphsItem(QQuickItem *parent = 0); |
| 229 | ~QQuickGraphsItem() override; |
| 230 | |
| 231 | void markDataDirty(); |
| 232 | void markSeriesVisualsDirty(); |
| 233 | void markSeriesItemLabelsDirty(); |
| 234 | void emitNeedRender(); |
| 235 | |
| 236 | void setQueriedGraphPosition(QVector3D position) { m_queriedGraphPosition = position; } |
| 237 | |
| 238 | virtual void handleAxisTitleChangedBySender(QObject *sender); |
| 239 | virtual void handleAxisLabelsChangedBySender(QObject *sender); |
| 240 | virtual void handleAxisRangeChangedBySender(QObject *sender); |
| 241 | virtual void handleAxisSegmentCountChangedBySender(QObject *sender); |
| 242 | virtual void handleAxisSubSegmentCountChangedBySender(QObject *sender); |
| 243 | virtual void handleAxisAutoAdjustRangeChangedInOrientation( |
| 244 | QAbstract3DAxis::AxisOrientation orientation, bool autoAdjust) |
| 245 | = 0; |
| 246 | virtual void handleAxisLabelFormatChangedBySender(QObject *sender); |
| 247 | virtual void handleAxisReversedChangedBySender(QObject *sender); |
| 248 | virtual void handleAxisFormatterDirtyBySender(QObject *sender); |
| 249 | virtual void handleAxisLabelAutoRotationChangedBySender(QObject *sender); |
| 250 | virtual void handleAxisTitleVisibilityChangedBySender(QObject *sender); |
| 251 | virtual void handleAxisLabelVisibilityChangedBySender(QObject *sender); |
| 252 | virtual void handleAxisTitleFixedChangedBySender(QObject *sender); |
| 253 | virtual void handleAxisTitleOffsetChangedBySender(QObject *sender); |
| 254 | virtual void handleSeriesVisibilityChangedBySender(QObject *sender); |
| 255 | virtual void adjustAxisRanges() = 0; |
| 256 | |
| 257 | bool graphPositionQueryPending() const { return m_graphPositionQueryPending; } |
| 258 | void setGraphPositionQueryPending(const bool &pending) |
| 259 | { |
| 260 | m_graphPositionQueryPending = pending; |
| 261 | } |
| 262 | |
| 263 | enum SelectionType { |
| 264 | SelectionNone = 0, |
| 265 | SelectionItem, |
| 266 | SelectionRow, |
| 267 | SelectionColumn, |
| 268 | }; |
| 269 | |
| 270 | virtual void addSeriesInternal(QAbstract3DSeries *series); |
| 271 | void insertSeries(qsizetype index, QAbstract3DSeries *series); |
| 272 | virtual void removeSeriesInternal(QAbstract3DSeries *series); |
| 273 | QList<QAbstract3DSeries *> seriesList(); |
| 274 | |
| 275 | void setAxisX(QAbstract3DAxis *axis); |
| 276 | QAbstract3DAxis *axisX() const; |
| 277 | void setAxisY(QAbstract3DAxis *axis); |
| 278 | QAbstract3DAxis *axisY() const; |
| 279 | void setAxisZ(QAbstract3DAxis *axis); |
| 280 | QAbstract3DAxis *axisZ() const; |
| 281 | virtual void addAxis(QAbstract3DAxis *axis); |
| 282 | virtual void releaseAxis(QAbstract3DAxis *axis); |
| 283 | virtual QList<QAbstract3DAxis *> axes() const; // Omits default axes |
| 284 | |
| 285 | virtual void setRenderingMode(QtGraphs3D::RenderingMode mode); |
| 286 | virtual QtGraphs3D::RenderingMode renderingMode() const; |
| 287 | |
| 288 | virtual void setSelectionMode(QtGraphs3D::SelectionFlags mode); |
| 289 | virtual QtGraphs3D::SelectionFlags selectionMode() const; |
| 290 | |
| 291 | void doSetShadowQuality(QtGraphs3D::ShadowQuality quality); |
| 292 | virtual void setShadowQuality(QtGraphs3D::ShadowQuality quality); |
| 293 | virtual QtGraphs3D::ShadowQuality shadowQuality() const; |
| 294 | |
| 295 | virtual QtGraphs3D::ElementType selectedElement() const; |
| 296 | |
| 297 | virtual void setMsaaSamples(int samples); |
| 298 | virtual int msaaSamples() const; |
| 299 | |
| 300 | void addTheme(QGraphsTheme *theme); |
| 301 | void releaseTheme(QGraphsTheme *theme); |
| 302 | void setTheme(QGraphsTheme *theme); |
| 303 | QGraphsTheme *theme() const; |
| 304 | QList<QGraphsTheme *> themes() const; |
| 305 | |
| 306 | bool isSlicingActive() const; |
| 307 | void setSlicingActive(bool isSlicing); |
| 308 | |
| 309 | bool isCustomDataDirty() const { return m_isCustomDataDirty; } |
| 310 | void setCustomDataDirty(bool dirty) { m_isCustomDataDirty = dirty; } |
| 311 | bool isCustomItemDirty() const { return m_isCustomItemDirty; } |
| 312 | void setCustomItemDirty(bool dirty) { m_isCustomItemDirty = dirty; } |
| 313 | bool isCustomLabelItem(QCustom3DItem *item) const; |
| 314 | bool isCustomVolumeItem(QCustom3DItem *item) const; |
| 315 | QImage customTextureImage(QCustom3DItem *item); |
| 316 | Q3DScene *scene(); |
| 317 | |
| 318 | Q_INVOKABLE virtual bool hasSeries(QAbstract3DSeries *series); |
| 319 | Q_INVOKABLE virtual void clearSelection() = 0; |
| 320 | |
| 321 | void deleteCustomItems(); |
| 322 | void deleteCustomItem(QCustom3DItem *item); |
| 323 | void deleteCustomItem(QVector3D position); |
| 324 | QList<QCustom3DItem *> customItems() const; |
| 325 | |
| 326 | Q_INVOKABLE virtual qsizetype addCustomItem(QCustom3DItem *item); |
| 327 | Q_INVOKABLE virtual void removeCustomItems(); |
| 328 | Q_INVOKABLE virtual void removeCustomItem(QCustom3DItem *item); |
| 329 | Q_INVOKABLE virtual void removeCustomItemAt(QVector3D position); |
| 330 | Q_INVOKABLE virtual void releaseCustomItem(QCustom3DItem *item); |
| 331 | |
| 332 | Q_INVOKABLE virtual int selectedLabelIndex() const; |
| 333 | Q_INVOKABLE virtual QAbstract3DAxis *selectedAxis() const; |
| 334 | |
| 335 | Q_INVOKABLE virtual qsizetype selectedCustomItemIndex() const; |
| 336 | Q_INVOKABLE virtual QCustom3DItem *selectedCustomItem() const; |
| 337 | |
| 338 | QQmlListProperty<QCustom3DItem> customItemList(); |
| 339 | static void appendCustomItemFunc(QQmlListProperty<QCustom3DItem> *list, QCustom3DItem *item); |
| 340 | static qsizetype countCustomItemFunc(QQmlListProperty<QCustom3DItem> *list); |
| 341 | static QCustom3DItem *atCustomItemFunc(QQmlListProperty<QCustom3DItem> *list, qsizetype index); |
| 342 | static void clearCustomItemFunc(QQmlListProperty<QCustom3DItem> *list); |
| 343 | |
| 344 | void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; |
| 345 | |
| 346 | void resizeViewports(QSizeF viewportSize); |
| 347 | |
| 348 | void checkWindowList(QQuickWindow *window); |
| 349 | |
| 350 | void setMeasureFps(bool enable); |
| 351 | bool measureFps() const; |
| 352 | int currentFps() const; |
| 353 | |
| 354 | void setOrthoProjection(bool enable); |
| 355 | bool isOrthoProjection() const; |
| 356 | |
| 357 | void setAspectRatio(qreal ratio); |
| 358 | qreal aspectRatio() const; |
| 359 | |
| 360 | void setOptimizationHint(QtGraphs3D::OptimizationHint hint); |
| 361 | QtGraphs3D::OptimizationHint optimizationHint() const; |
| 362 | |
| 363 | void setPolar(bool enable); |
| 364 | bool isPolar() const; |
| 365 | |
| 366 | void setLabelMargin(float offset); |
| 367 | float labelMargin() const; |
| 368 | |
| 369 | void setRadialLabelOffset(float offset); |
| 370 | float radialLabelOffset() const; |
| 371 | |
| 372 | void setHorizontalAspectRatio(qreal ratio); |
| 373 | qreal horizontalAspectRatio() const; |
| 374 | |
| 375 | void setLocale(const QLocale &locale); |
| 376 | QLocale locale() const; |
| 377 | |
| 378 | QVector3D queriedGraphPosition() const; |
| 379 | |
| 380 | void setMargin(qreal margin); |
| 381 | qreal margin() const; |
| 382 | |
| 383 | QMutex *mutex() { return &m_mutex; } |
| 384 | |
| 385 | bool isReady() { return isComponentComplete(); } |
| 386 | QQuick3DNode *rootNode() const; |
| 387 | |
| 388 | QQuick3DNode *cameraTarget() { return m_cameraTarget; } |
| 389 | void setCameraTarget(QQuick3DNode *target) { m_cameraTarget = target; } |
| 390 | |
| 391 | QQuick3DModel *background() const { return m_background; } |
| 392 | void setBackground(QQuick3DModel *newBackground) { m_background = newBackground; } |
| 393 | QQuick3DModel *backgroundBB() const { return m_backgroundBB; } |
| 394 | |
| 395 | QQuick3DDirectionalLight *light() const; |
| 396 | QQuick3DCustomMaterial *createQmlCustomMaterial(const QString &fileName); |
| 397 | QQuick3DPrincipledMaterial *createPrincipledMaterial(); |
| 398 | |
| 399 | QQuickItem *itemLabel() { return m_itemLabel; } |
| 400 | QQuick3DNode *sliceItemLabel() { return m_sliceItemLabel; } |
| 401 | |
| 402 | QQuick3DModel *m_targetVisualizer; |
| 403 | |
| 404 | QQuick3DRepeater *repeaterX() const { return m_repeaterX; } |
| 405 | QQuick3DRepeater *repeaterY() const { return m_repeaterY; } |
| 406 | QQuick3DRepeater *repeaterZ() const { return m_repeaterZ; } |
| 407 | |
| 408 | QQuick3DNode *titleLabelX() const { return m_titleLabelX; } |
| 409 | QQuick3DNode *titleLabelY() const { return m_titleLabelY; } |
| 410 | QQuick3DNode *titleLabelZ() const { return m_titleLabelZ; } |
| 411 | |
| 412 | bool isXFlipped() const { return m_xFlipped; } |
| 413 | void setXFlipped(bool xFlipped) { m_xFlipped = xFlipped; } |
| 414 | bool isYFlipped() const { return m_yFlipped; } |
| 415 | void setYFlipped(bool yFlipped) { m_yFlipped = yFlipped; } |
| 416 | bool isZFlipped() const { return m_zFlipped; } |
| 417 | void setZFlipped(bool zFlipped) { m_zFlipped = zFlipped; } |
| 418 | QVector3D scaleWithBackground() const { return m_scaleWithBackground; } |
| 419 | QVector3D backgroundScaleMargin() const { return m_backgroundScaleMargin; } |
| 420 | void setScaleWithBackground(QVector3D scale) { m_scaleWithBackground = scale; } |
| 421 | void setBackgroundScaleMargin(QVector3D margin) { m_backgroundScaleMargin = margin; } |
| 422 | QVector3D rotation() const { return m_rot; } |
| 423 | void setRotation(QVector3D rotation) { m_rot = rotation; } |
| 424 | QVector3D scale() const { return m_scale; } |
| 425 | void setScale(QVector3D scale) { m_scale = scale; } |
| 426 | QVector3D translate() const { return m_translate; } |
| 427 | void setTranslate(QVector3D translate) { m_translate = translate; } |
| 428 | |
| 429 | float lineLengthScaleFactor() const { return m_lineLengthScaleFactor; } |
| 430 | void setLineLengthScaleFactor(float scaleFactor) { m_lineLengthScaleFactor = scaleFactor; } |
| 431 | float lineWidthScaleFactor() const { return m_lineWidthScaleFactor; } |
| 432 | void setLineWidthScaleFactor(float scaleFactor) { m_lineWidthScaleFactor = scaleFactor; } |
| 433 | float gridOffset() const { return m_gridOffset; } |
| 434 | |
| 435 | QtGraphs3D::CameraPreset cameraPreset() const; |
| 436 | void setCameraPreset(QtGraphs3D::CameraPreset preset); |
| 437 | |
| 438 | float cameraXRotation() const { return m_xRotation; } |
| 439 | void setCameraXRotation(float rotation); |
| 440 | float cameraYRotation() const { return m_yRotation; } |
| 441 | void setCameraYRotation(float rotation); |
| 442 | |
| 443 | float minCameraXRotation() const { return m_minXRotation; } |
| 444 | void setMinCameraXRotation(float rotation); |
| 445 | float maxCameraXRotation() const { return m_maxXRotation; } |
| 446 | void setMaxCameraXRotation(float rotation); |
| 447 | |
| 448 | float minCameraYRotation() const { return m_minYRotation; } |
| 449 | void setMinCameraYRotation(float rotation); |
| 450 | float maxCameraYRotation() const { return m_maxYRotation; } |
| 451 | void setMaxCameraYRotation(float rotation); |
| 452 | |
| 453 | void setZoomAtTargetEnabled(bool enable); |
| 454 | bool zoomAtTargetEnabled(); |
| 455 | void setZoomEnabled(bool enable); |
| 456 | bool zoomEnabled(); |
| 457 | void setSelectionEnabled(bool enable); |
| 458 | bool selectionEnabled(); |
| 459 | void setRotationEnabled(bool enable); |
| 460 | bool rotationEnabled(); |
| 461 | |
| 462 | Q_INVOKABLE void setDefaultInputHandler(); |
| 463 | Q_INVOKABLE void unsetDefaultInputHandler(); |
| 464 | Q_INVOKABLE void unsetDefaultTapHandler(); |
| 465 | Q_INVOKABLE void unsetDefaultDragHandler(); |
| 466 | Q_INVOKABLE void unsetDefaultWheelHandler(); |
| 467 | Q_INVOKABLE void unsetDefaultPinchHandler(); |
| 468 | Q_INVOKABLE void setDragButton(Qt::MouseButtons button); |
| 469 | |
| 470 | float cameraZoomLevel() const { return m_zoomLevel; } |
| 471 | void setCameraZoomLevel(float level); |
| 472 | |
| 473 | float minCameraZoomLevel() const { return m_minZoomLevel; } |
| 474 | void setMinCameraZoomLevel(float level); |
| 475 | |
| 476 | float maxCameraZoomLevel() const { return m_maxZoomLevel; } |
| 477 | void setMaxCameraZoomLevel(float level); |
| 478 | |
| 479 | void setCameraTargetPosition(QVector3D target); |
| 480 | QVector3D cameraTargetPosition() const { return m_requestedTarget; } |
| 481 | |
| 482 | bool wrapCameraXRotation() const { return m_wrapXRotation; } |
| 483 | void setWrapCameraXRotation(bool wrap); |
| 484 | |
| 485 | bool wrapCameraYRotation() const { return m_wrapYRotation; } |
| 486 | void setWrapCameraYRotation(bool wrap); |
| 487 | |
| 488 | QVector3D graphPositionAt(QPoint point); |
| 489 | void setCameraPosition(float horizontal, float vertical, float zoom = 100.0f); |
| 490 | |
| 491 | void changeLabelBackgroundColor(QQuick3DRepeater *repeater, QColor color); |
| 492 | void changeLabelBackgroundVisible(QQuick3DRepeater *repeater, const bool &visible); |
| 493 | void changeLabelBorderVisible(QQuick3DRepeater *repeater, const bool &visible); |
| 494 | void changeLabelTextColor(QQuick3DRepeater *repeater, QColor color); |
| 495 | void changeLabelFont(QQuick3DRepeater *repeater, const QFont &font); |
| 496 | void changeLabelsVisible(QQuick3DRepeater *repeater, const bool &visible); |
| 497 | void changeGridLineColor(QQuick3DRepeater *repeater, QColor color); |
| 498 | void updateTitleLabels(); |
| 499 | virtual void updateSelectionMode(QtGraphs3D::SelectionFlags newMode); |
| 500 | |
| 501 | void setSliceActivatedChanged(bool changed) { m_sliceActivatedChanged = changed; } |
| 502 | |
| 503 | Q_INVOKABLE virtual bool doPicking(QPointF point); |
| 504 | |
| 505 | void minimizeMainGraph(); |
| 506 | |
| 507 | int horizontalFlipFactor() const; |
| 508 | void setHorizontalFlipFactor(int newHorizontalFlipFactor); |
| 509 | |
| 510 | float ambientLightStrength() const; |
| 511 | void setAmbientLightStrength(float newAmbientLightStrength); |
| 512 | float lightStrength() const; |
| 513 | void setLightStrength(float newLightStrength); |
| 514 | float shadowStrength() const; |
| 515 | void setShadowStrength(float newShadowStrength); |
| 516 | QColor lightColor() const; |
| 517 | void setLightColor(QColor newLightColor); |
| 518 | QtGraphs3D::GridLineType gridLineType() const; |
| 519 | void setGridLineType(const QtGraphs3D::GridLineType &gridLineType); |
| 520 | |
| 521 | public Q_SLOTS: |
| 522 | virtual void handleAxisXChanged(QAbstract3DAxis *axis) = 0; |
| 523 | virtual void handleAxisYChanged(QAbstract3DAxis *axis) = 0; |
| 524 | virtual void handleAxisZChanged(QAbstract3DAxis *axis) = 0; |
| 525 | void handleFpsChanged(); |
| 526 | void windowDestroyed(QObject *obj); |
| 527 | |
| 528 | void handleAxisTitleChanged(const QString &title); |
| 529 | void handleAxisLabelsChanged(); |
| 530 | void handleAxisRangeChanged(float min, float max); |
| 531 | void handleAxisSegmentCountChanged(qsizetype count); |
| 532 | void handleAxisSubSegmentCountChanged(qsizetype count); |
| 533 | void handleAxisAutoAdjustRangeChanged(bool autoAdjust); |
| 534 | void handleAxisLabelFormatChanged(const QString &format); |
| 535 | void handleAxisReversedChanged(bool enable); |
| 536 | void handleAxisFormatterDirty(); |
| 537 | void handleAxisLabelAutoRotationChanged(float angle); |
| 538 | void handleAxisTitleVisibilityChanged(bool visible); |
| 539 | void handleAxisLabelVisibilityChanged(bool visible); |
| 540 | void handleAxisTitleFixedChanged(bool fixed); |
| 541 | void handleAxisTitleOffsetChanged(float offset); |
| 542 | void handleInputPositionChanged(QPoint position); |
| 543 | void handleSeriesVisibilityChanged(bool visible); |
| 544 | |
| 545 | void handleThemeColorStyleChanged(QGraphsTheme::ColorStyle style); |
| 546 | void handleThemeBaseColorsChanged(const QList<QColor> &color); |
| 547 | void handleThemeBaseGradientsChanged(const QList<QLinearGradient> &gradient); |
| 548 | void handleThemeSingleHighlightColorChanged(QColor color); |
| 549 | void handleThemeSingleHighlightGradientChanged(const QLinearGradient &gradient); |
| 550 | void handleThemeMultiHighlightColorChanged(QColor color); |
| 551 | void handleThemeMultiHighlightGradientChanged(const QLinearGradient &gradient); |
| 552 | void handleThemeTypeChanged(QGraphsTheme::Theme theme); |
| 553 | |
| 554 | void handleRequestShadowQuality(QtGraphs3D::ShadowQuality quality); |
| 555 | |
| 556 | void updateCustomItem(); |
| 557 | |
| 558 | Q_SIGNALS: |
| 559 | void selectionModeChanged(QtGraphs3D::SelectionFlags mode); |
| 560 | void shadowQualityChanged(QtGraphs3D::ShadowQuality quality); |
| 561 | void shadowsSupportedChanged(bool supported); |
| 562 | void msaaSamplesChanged(int samples); |
| 563 | void themeChanged(QGraphsTheme *theme); |
| 564 | void renderingModeChanged(QtGraphs3D::RenderingMode mode); |
| 565 | void measureFpsChanged(bool enabled); |
| 566 | void currentFpsChanged(int fps); |
| 567 | void selectedElementChanged(QtGraphs3D::ElementType type); |
| 568 | void orthoProjectionChanged(bool enabled); |
| 569 | void aspectRatioChanged(qreal ratio); |
| 570 | void optimizationHintChanged(QtGraphs3D::OptimizationHint hint); |
| 571 | void polarChanged(bool enabled); |
| 572 | void labelMarginChanged(float margin); |
| 573 | void radialLabelOffsetChanged(float offset); |
| 574 | void horizontalAspectRatioChanged(qreal ratio); |
| 575 | void localeChanged(const QLocale &locale); |
| 576 | void queriedGraphPositionChanged(QVector3D data); |
| 577 | void marginChanged(qreal margin); |
| 578 | void cameraPresetChanged(QtGraphs3D::CameraPreset preset); |
| 579 | void cameraXRotationChanged(float rotation); |
| 580 | void cameraYRotationChanged(float rotation); |
| 581 | void cameraZoomLevelChanged(float zoomLevel); |
| 582 | void cameraTargetPositionChanged(QVector3D target); |
| 583 | void minCameraZoomLevelChanged(float zoomLevel); |
| 584 | void maxCameraZoomLevelChanged(float zoomLevel); |
| 585 | void minCameraXRotationChanged(float rotation); |
| 586 | void minCameraYRotationChanged(float rotation); |
| 587 | void maxCameraXRotationChanged(float rotation); |
| 588 | void maxCameraYRotationChanged(float rotation); |
| 589 | void wrapCameraXRotationChanged(bool wrap); |
| 590 | void wrapCameraYRotationChanged(bool wrap); |
| 591 | void needRender(); |
| 592 | void themeTypeChanged(); |
| 593 | void axisXChanged(QAbstract3DAxis *axis); |
| 594 | void axisYChanged(QAbstract3DAxis *axis); |
| 595 | void axisZChanged(QAbstract3DAxis *axis); |
| 596 | void activeThemeChanged(QGraphsTheme *activeTheme); |
| 597 | |
| 598 | void tapped(QEventPoint eventPoint, Qt::MouseButton button); |
| 599 | void doubleTapped(QEventPoint eventPoint, Qt::MouseButton button); |
| 600 | void longPressed(); |
| 601 | void dragged(QVector2D delta); |
| 602 | void wheel(QQuickWheelEvent *event); |
| 603 | void pinch(qreal delta); |
| 604 | void mouseMove(QPoint mousePos); |
| 605 | |
| 606 | void zoomEnabledChanged(bool enable); |
| 607 | void zoomAtTargetEnabledChanged(bool enable); |
| 608 | void rotationEnabledChanged(bool enable); |
| 609 | void selectionEnabledChanged(bool enable); |
| 610 | |
| 611 | void ambientLightStrengthChanged(); |
| 612 | void lightStrengthChanged(); |
| 613 | void shadowStrengthChanged(); |
| 614 | void lightColorChanged(); |
| 615 | void gridLineTypeChanged(); |
| 616 | |
| 617 | protected: |
| 618 | bool event(QEvent *event) override; |
| 619 | |
| 620 | virtual void handleWindowChanged(/*QQuickWindow *win*/); |
| 621 | void itemChange(ItemChange change, const ItemChangeData &value) override; |
| 622 | virtual void updateWindowParameters(); |
| 623 | virtual void handleSelectionModeChange(QtGraphs3D::SelectionFlags mode); |
| 624 | virtual void handleShadowQualityChange(QtGraphs3D::ShadowQuality quality); |
| 625 | virtual void handleSelectedElementChange(QtGraphs3D::ElementType type); |
| 626 | virtual void handleOptimizationHintChange(QtGraphs3D::OptimizationHint hint); |
| 627 | void keyPressEvent(QKeyEvent *ev) override; |
| 628 | virtual void handleThemeTypeChange(); |
| 629 | virtual void handleParentWidthChange(); |
| 630 | virtual void handleParentHeightChange(); |
| 631 | void componentComplete() override; |
| 632 | void checkSliceEnabled(); |
| 633 | |
| 634 | virtual void createSliceView(); |
| 635 | |
| 636 | void handleQueryPositionChanged(QPoint position); |
| 637 | |
| 638 | void handlePrimarySubViewportChanged(const QRect rect); |
| 639 | void handleSecondarySubViewportChanged(const QRect rect); |
| 640 | |
| 641 | QQuick3DNode *graphNode() { return m_graphNode; } |
| 642 | QQuick3DViewport *sliceView() { return m_sliceView; } |
| 643 | |
| 644 | QQmlComponent *createRepeaterDelegateComponent(const QString &fileName); |
| 645 | QQuick3DRepeater *createRepeater(QQuick3DNode *parent = nullptr); |
| 646 | QQuick3DNode *createTitleLabel(QQuick3DNode *parent = nullptr); |
| 647 | void createItemLabel(); |
| 648 | QAbstract3DSeries::SeriesType m_graphType = QAbstract3DSeries::SeriesType::None; |
| 649 | |
| 650 | void updateXTitle(QVector3D labelRotation, |
| 651 | QVector3D labelTrans, |
| 652 | const QQuaternion &totalRotation, |
| 653 | float labelsMaxWidth, |
| 654 | QVector3D scale); |
| 655 | void updateYTitle(QVector3D sideLabelRotation, |
| 656 | QVector3D backLabelRotation, |
| 657 | QVector3D sideLabelTrans, |
| 658 | QVector3D backLabelTrans, |
| 659 | const QQuaternion &totalSideRotation, |
| 660 | const QQuaternion &totalBackRotation, |
| 661 | float labelsMaxWidth, |
| 662 | QVector3D scale); |
| 663 | void updateZTitle(QVector3D labelRotation, |
| 664 | QVector3D labelTrans, |
| 665 | const QQuaternion &totalRotation, |
| 666 | float labelsMaxWidth, |
| 667 | QVector3D scale); |
| 668 | |
| 669 | virtual void calculateSceneScalingFactors() = 0; |
| 670 | void positionAndScaleLine(QQuick3DNode *lineNode, QVector3D scale, QVector3D position); |
| 671 | int findLabelsMaxWidth(const QStringList &labels); |
| 672 | virtual QVector3D calculateCategoryLabelPosition(QAbstract3DAxis *axis, |
| 673 | QVector3D labelPosition, |
| 674 | int index); |
| 675 | virtual float calculateCategoryGridLinePosition(QAbstract3DAxis *axis, int index); |
| 676 | float calculatePolarBackgroundMargin(); |
| 677 | void setFloorGridInRange(bool inRange) { m_isFloorGridInRange = inRange; } |
| 678 | void setVerticalSegmentLine(bool hasVerticalLine) |
| 679 | { |
| 680 | m_hasVerticalSegmentLine = hasVerticalLine; |
| 681 | } |
| 682 | void updateGrid(); |
| 683 | void updateGridLineType(); |
| 684 | void updateLabels(); |
| 685 | void updateSliceGrid(); |
| 686 | void updateSliceLabels(); |
| 687 | void updateBackgroundColor(); |
| 688 | void setItemSelected(bool selected); |
| 689 | virtual void updateShadowQuality(QtGraphs3D::ShadowQuality quality); |
| 690 | void updateItemLabel(QVector3D position); |
| 691 | virtual void updateSliceItemLabel(const QString &label, QVector3D position); |
| 692 | |
| 693 | struct Volume |
| 694 | { |
| 695 | QQuick3DModel *model = nullptr; |
| 696 | QQuick3DTexture *texture = nullptr; |
| 697 | QQuick3DTextureData *textureData = nullptr; |
| 698 | QQuick3DTexture *colorTexture = nullptr; |
| 699 | QQuick3DTextureData *colorTextureData = nullptr; |
| 700 | bool updateTextureData = false; |
| 701 | bool updateColorTextureData = false; |
| 702 | bool useHighDefShader = false; |
| 703 | bool drawSlices = false; |
| 704 | bool drawSliceFrames = false; |
| 705 | QQuick3DModel *sliceFrameX = nullptr; |
| 706 | QQuick3DModel *sliceFrameY = nullptr; |
| 707 | QQuick3DModel *sliceFrameZ = nullptr; |
| 708 | QQuick3DTexture *sliceFrameTexture = nullptr; |
| 709 | }; |
| 710 | |
| 711 | virtual void synchData(); |
| 712 | virtual void updateGraph() {} |
| 713 | |
| 714 | bool isSliceEnabled() const { return m_sliceEnabled; } |
| 715 | void setSliceEnabled(bool enabled) { m_sliceEnabled = enabled; } |
| 716 | bool isSliceActivatedChanged() const { return m_sliceActivatedChanged; } |
| 717 | virtual void toggleSliceGraph(); |
| 718 | void createSliceCamera(); |
| 719 | bool isSliceOrthoProjection() const { return m_sliceUseOrthoProjection; } |
| 720 | void setSliceOrthoProjection(bool enable) { m_sliceUseOrthoProjection = enable; } |
| 721 | |
| 722 | virtual void updateAxisRange(float min, float max); |
| 723 | virtual void updateAxisReversed(bool enable); |
| 724 | virtual void updateSingleHighlightColor() {} |
| 725 | virtual void updateLightStrength() {} |
| 726 | |
| 727 | virtual void handleLabelCountChanged(QQuick3DRepeater *repeater, QColor axisLabelColor); |
| 728 | |
| 729 | bool isGridUpdated() { return m_gridUpdated; } |
| 730 | void setGridUpdated(bool updated) { m_gridUpdated = updated; } |
| 731 | |
| 732 | QGraphsInputHandler *graphsInputHandler() const { return m_inputHandler; } |
| 733 | |
| 734 | virtual QAbstract3DAxis *createDefaultAxis(QAbstract3DAxis::AxisOrientation orientation); |
| 735 | QValue3DAxis *createDefaultValueAxis(); |
| 736 | QCategory3DAxis *createDefaultCategoryAxis(); |
| 737 | void setAxisHelper(QAbstract3DAxis::AxisOrientation orientation, |
| 738 | QAbstract3DAxis *axis, |
| 739 | QAbstract3DAxis **axisPtr); |
| 740 | virtual void startRecordingRemovesAndInserts(); |
| 741 | |
| 742 | QSharedPointer<QMutex> m_nodeMutex; |
| 743 | |
| 744 | QMap<QCustom3DVolume *, Volume> m_customVolumes; |
| 745 | |
| 746 | Q3DScene *m_scene = nullptr; |
| 747 | // Active axes |
| 748 | QAbstract3DAxis *m_axisX = nullptr; |
| 749 | QAbstract3DAxis *m_axisY = nullptr; |
| 750 | QAbstract3DAxis *m_axisZ = nullptr; |
| 751 | |
| 752 | QList<QAbstract3DAxis *> m_axes; // List of all added axes |
| 753 | bool m_isDataDirty = true; |
| 754 | bool m_isCustomDataDirty = true; |
| 755 | bool m_isCustomItemDirty = true; |
| 756 | bool m_isSeriesVisualsDirty = true; |
| 757 | bool m_renderPending = false; |
| 758 | bool m_isPolar = false; |
| 759 | float m_radialLabelOffset = 1.0f; |
| 760 | float m_polarRadius = 2.0f; |
| 761 | |
| 762 | QList<QAbstract3DSeries *> m_seriesList; |
| 763 | |
| 764 | QList<QAbstract3DSeries *> m_changedSeriesList; |
| 765 | |
| 766 | QList<QCustom3DItem *> m_customItems; |
| 767 | |
| 768 | QtGraphs3D::ElementType m_clickedType = QtGraphs3D::ElementType::None; |
| 769 | int m_selectedLabelIndex = -1; |
| 770 | qsizetype m_selectedCustomItemIndex = -1; |
| 771 | qreal m_margin = -1.0; |
| 772 | |
| 773 | QMutex m_renderMutex; |
| 774 | QQuickGraphsItem *m_qml = nullptr; |
| 775 | |
| 776 | private: |
| 777 | // This is the same as the minimum bound of GridLine model. |
| 778 | const float angularLineOffset = -49.98f; |
| 779 | const float rotationOffset = 90.0f; |
| 780 | |
| 781 | QQuick3DModel *m_gridGeometryModel = nullptr; |
| 782 | QQuick3DModel *m_subgridGeometryModel = nullptr; |
| 783 | QQuick3DModel *m_sliceGridGeometryModel = nullptr; |
| 784 | Abstract3DChangeBitField m_changeTracker; |
| 785 | QtGraphs3D::SelectionFlags m_selectionMode = QtGraphs3D::SelectionFlag::Item; |
| 786 | QtGraphs3D::ShadowQuality m_shadowQuality = QtGraphs3D::ShadowQuality::Medium; |
| 787 | bool m_useOrthoProjection = false; |
| 788 | qreal m_aspectRatio = 2.0; |
| 789 | qreal m_horizontalAspectRatio = 0.0; |
| 790 | QtGraphs3D::OptimizationHint m_optimizationHint = QtGraphs3D::OptimizationHint::Default; |
| 791 | QLocale m_locale; |
| 792 | QVector3D m_queriedGraphPosition; |
| 793 | bool m_graphPositionQueryPending = false; |
| 794 | |
| 795 | QQuick3DNode *m_graphNode = nullptr; |
| 796 | QQuick3DModel *m_background = nullptr; |
| 797 | QQuick3DModel *m_backgroundBB = nullptr; |
| 798 | QQuick3DNode *m_backgroundScale = nullptr; |
| 799 | QQuick3DNode *m_backgroundRotation = nullptr; |
| 800 | |
| 801 | QQuick3DRepeater *m_repeaterX = nullptr; |
| 802 | QQuick3DRepeater *m_repeaterY = nullptr; |
| 803 | QQuick3DRepeater *m_repeaterZ = nullptr; |
| 804 | std::unique_ptr<QQmlComponent> m_delegateModelX; |
| 805 | std::unique_ptr<QQmlComponent> m_delegateModelY; |
| 806 | std::unique_ptr<QQmlComponent> m_delegateModelZ; |
| 807 | |
| 808 | QQuick3DNode *m_titleLabelX = nullptr; |
| 809 | QQuick3DNode *m_titleLabelY = nullptr; |
| 810 | QQuick3DNode *m_titleLabelZ = nullptr; |
| 811 | |
| 812 | QQuickItem *m_itemLabel = nullptr; |
| 813 | QQuick3DNode *m_sliceItemLabel = nullptr; |
| 814 | |
| 815 | QQuick3DViewport *m_sliceView = nullptr; |
| 816 | |
| 817 | QQuick3DRepeater *m_sliceHorizontalLabelRepeater = nullptr; |
| 818 | QQuick3DRepeater *m_sliceVerticalLabelRepeater = nullptr; |
| 819 | std::unique_ptr<QQmlComponent> m_labelDelegate; |
| 820 | |
| 821 | QQuick3DNode *m_sliceHorizontalTitleLabel = nullptr; |
| 822 | QQuick3DNode *m_sliceVerticalTitleLabel = nullptr; |
| 823 | |
| 824 | QQuick3DNode *m_cameraTarget = nullptr; |
| 825 | QQuick3DDirectionalLight *m_light = nullptr; |
| 826 | QQuick3DPerspectiveCamera *m_pCamera = nullptr; |
| 827 | QQuick3DOrthographicCamera *m_oCamera = nullptr; |
| 828 | QRectF m_cachedGeometry; |
| 829 | QtGraphs3D::RenderingMode m_renderMode = QtGraphs3D::RenderingMode::DirectToBackground; |
| 830 | int m_samples = 0; |
| 831 | int m_windowSamples = 0; |
| 832 | QSize m_initialisedSize = QSize(0, 0); |
| 833 | bool m_runningInDesigner; |
| 834 | QMutex m_mutex; |
| 835 | |
| 836 | bool m_xFlipped = false; |
| 837 | bool m_yFlipped = false; |
| 838 | bool m_zFlipped = false; |
| 839 | |
| 840 | bool m_flipScales; |
| 841 | int m_horizontalFlipFactor = 1; |
| 842 | |
| 843 | bool m_isFloorGridInRange = false; |
| 844 | bool m_hasVerticalSegmentLine = true; |
| 845 | |
| 846 | QVector3D m_scaleWithBackground = QVector3D(1.0f, 1.0f, 1.0f); |
| 847 | QVector3D m_backgroundScaleMargin = QVector3D(0.0f, 0.0f, 0.0f); |
| 848 | |
| 849 | QVector3D m_rot = QVector3D(1.0f, 1.0f, 1.0f); |
| 850 | |
| 851 | QVector3D m_scale = QVector3D(1.0f, 1.0f, 1.0f); |
| 852 | |
| 853 | QVector3D m_translate = QVector3D(1.0f, 1.0f, 1.0f); |
| 854 | |
| 855 | QVector3D m_labelScale = QVector3D(0.01f, 0.01f, 0.0f); |
| 856 | |
| 857 | float m_gridOffset = 0.002f; |
| 858 | float m_lineWidthScaleFactor = 0.0001f; |
| 859 | float m_lineLengthScaleFactor = 0.02f; |
| 860 | |
| 861 | float m_labelMargin = .1f; |
| 862 | |
| 863 | bool m_itemSelected = false; |
| 864 | bool m_sliceEnabled = false; |
| 865 | bool m_sliceActivatedChanged = false; |
| 866 | QRect m_primarySubView; |
| 867 | QRect m_secondarySubView; |
| 868 | |
| 869 | bool m_gridUpdated = false; |
| 870 | |
| 871 | QtGraphs3D::GridLineType m_gridLineType = QtGraphs3D::GridLineType::Geometry; |
| 872 | bool m_gridLineTypeDirty = false; |
| 873 | |
| 874 | bool m_validVolumeSlice = false; |
| 875 | |
| 876 | QVector3D m_labelPosition = QVector3D(); |
| 877 | QVector3D m_fontScaled = QVector3D(); |
| 878 | bool m_labelsNeedupdate = false; |
| 879 | |
| 880 | float m_initialZoomLevel = -1.0f; |
| 881 | void setUpCamera(); |
| 882 | void setUpLight(); |
| 883 | void updateCamera(); |
| 884 | void updateRadialLabelOffset(); |
| 885 | QVector3D calculateLabelRotation(float labelAutoAngle); |
| 886 | void updateCustomData(); |
| 887 | void updateCustomLabelsRotation(); |
| 888 | float fontScaleFactor(float pointSize); |
| 889 | float labelAdjustment(float width); |
| 890 | void gridLineCountHelper(QAbstract3DAxis *axis, qsizetype &lineCount, qsizetype &sublineCount); |
| 891 | QVector3D graphPosToAbsolute(QVector3D position); |
| 892 | |
| 893 | void createVolumeMaterial(QCustom3DVolume *volume, Volume &volumeItem); |
| 894 | QQuick3DModel *createSliceFrame(Volume &volumeItem); |
| 895 | void updateSliceFrameMaterials(QCustom3DVolume *volume, Volume &volumeItem); |
| 896 | void updateSubViews(); |
| 897 | void updateCustomVolumes(); |
| 898 | |
| 899 | bool m_sliceUseOrthoProjection = false; |
| 900 | |
| 901 | QHash<QQuickGraphsItem *, QQuickWindow *> m_graphWindowList = {}; |
| 902 | QHash<QCustom3DLabel *, QQuick3DNode *> m_customLabelList = {}; |
| 903 | QHash<QCustom3DItem *, QQuick3DModel *> m_customItemList = {}; |
| 904 | QList<QCustom3DItem *> m_pendingCustomItemList = {}; |
| 905 | |
| 906 | int m_currentFps = -1; |
| 907 | bool m_measureFps = false; |
| 908 | |
| 909 | QtGraphs3D::CameraPreset m_activePreset = QtGraphs3D::CameraPreset::NoPreset; |
| 910 | float m_xRotation = 0.0f; |
| 911 | float m_yRotation = 0.0f; |
| 912 | float m_minXRotation = -180.0f; |
| 913 | float m_maxXRotation = 180.0f; |
| 914 | float m_minYRotation = 0.0f; |
| 915 | float m_maxYRotation = 90.0f; |
| 916 | bool m_wrapXRotation = true; |
| 917 | bool m_wrapYRotation = false; |
| 918 | |
| 919 | float m_zoomLevel = 100.0f; |
| 920 | float m_minZoomLevel = 10.0f; |
| 921 | float m_maxZoomLevel = 500.0f; |
| 922 | |
| 923 | QColor m_lightColor = QColor(Qt::white); |
| 924 | float m_ambientLightStrength = 0.25f; |
| 925 | float m_lightStrength = 5.0f; |
| 926 | float m_shadowStrength = 25.0f; |
| 927 | bool m_lightColorDirty = false; |
| 928 | bool m_ambientLightStrengthDirty = false; |
| 929 | bool m_lightStrengthDirty = false; |
| 930 | bool m_shadowStrengthDirty = false; |
| 931 | |
| 932 | bool m_gridUpdate = false; |
| 933 | |
| 934 | QVector3D m_requestedTarget = QVector3D(); |
| 935 | |
| 936 | QGraphsInputHandler *m_inputHandler = nullptr; |
| 937 | |
| 938 | QList<QGraphsTheme *> m_themes; |
| 939 | QGraphsTheme *m_activeTheme = nullptr; |
| 940 | |
| 941 | friend class Q3DGraphsWidgetItem; |
| 942 | }; |
| 943 | |
| 944 | QT_END_NAMESPACE |
| 945 | |
| 946 | #endif |
| 947 | |