1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef SHAPEMANAGER_H |
5 | #define SHAPEMANAGER_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt 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 | |
18 | #include <QtCore/qobject.h> |
19 | #include <QtCore/qlist.h> |
20 | #include <QtGui/qimage.h> |
21 | #include <QtGui/qvector3d.h> |
22 | |
23 | class ShapeManager : public QObject |
24 | { |
25 | Q_OBJECT |
26 | public: |
27 | explicit ShapeManager(QObject *parent = nullptr); |
28 | |
29 | enum class SortingMode : quint8 |
30 | { |
31 | Random, |
32 | DistanceClosestFirst, |
33 | DistanceClosestLast |
34 | }; |
35 | |
36 | void setImage(const QString &filename); |
37 | void setDepth(float depth); |
38 | void setAmount(int amount); |
39 | void setScale(float scale); |
40 | void setSortingMode(SortingMode mode); |
41 | void setSortingPosition(const QVector3D &position); |
42 | |
43 | bool loadImage(); |
44 | bool generateData(); |
45 | bool saveShapeData(const QString &filename); |
46 | void dumpOutput(); |
47 | |
48 | private: |
49 | QString m_imageFilename; |
50 | QImage m_image; |
51 | float m_depth = 0.0f; |
52 | int m_amount = -1; |
53 | QString m_cborFilename; |
54 | QList<QVector3D> m_data; |
55 | QList<QVector3D> m_outputData; |
56 | float m_scale = 1.0f; |
57 | SortingMode m_sortingMode = SortingMode::Random; |
58 | QVector3D m_sortingPosition; |
59 | }; |
60 | |
61 | #endif // SHAPEMANAGER_H |
62 | |