/* QAD - Qt ADvanced Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef SCATTER3D_H #define SCATTER3D_H #include "qad_graphic3d_export.h" #include #include #if QT_VERSION_MAJOR == 5 namespace QtDataVisualization { #endif class Q3DScatter; class QScatterDataProxy; class QScatter3DSeries; class QScatterDataItem; #if QT_VERSION_MAJOR == 5 } // namespace QtDataVisualization #endif class QAD_GRAPHIC3D_EXPORT Scatter3D: public QWidget { Q_OBJECT #if QT_VERSION_MAJOR == 6 using Mesh = QAbstract3DSeries::Mesh; using DataArray = QVector; #else using Mesh = QtDataVisualization::QAbstract3DSeries::Mesh; using DataArray = QVector; #endif Q_PROPERTY(int currentGraphic READ currentGraphic WRITE setCurrentGraphic) Q_PROPERTY(int graphicsCount READ graphicsCount WRITE setGraphicsCount) Q_PROPERTY(QColor graphicColor READ graphicColor WRITE setGraphicColor) Q_PROPERTY(float graphicPointSize READ graphicPointSize WRITE setGraphicPointSize) Q_PROPERTY(Mesh graphicMesh READ graphicMesh WRITE setGraphicMesh) Q_PROPERTY(bool labelAutoRotation READ labelAutoRotation WRITE setLabelAutoRotation) Q_PROPERTY(bool graphicMeshSmooth READ graphicMeshSmooth WRITE setGraphicMeshSmooth) public: explicit Scatter3D(QWidget * parent = nullptr); ~Scatter3D(); int currentGraphic() const { return curGraphic; } int graphicsCount() const { return graphics.size(); } QColor graphicColor() const { return graphicColor(curGraphic); } QColor graphicColor(int index) const; float graphicPointSize() const { return graphicPointSize(curGraphic); } float graphicPointSize(int index) const; Mesh graphicMesh() const { return graphicMesh(curGraphic); } Mesh graphicMesh(int index) const; bool graphicMeshSmooth() const { return graphicMeshSmooth(curGraphic); } bool graphicMeshSmooth(int index) const; bool labelAutoRotation() const; public slots: void setCurrentGraphic(int arg); void setGraphicsCount(int count); void setGraphicColor(const QColor & color, int index); void setGraphicColor(const QColor & color) { setGraphicColor(color, curGraphic); } void setGraphicPointSize(float sz, int index); void setGraphicPointSize(float sz) { setGraphicPointSize(sz, curGraphic); } void setGraphicMesh(Mesh mesh, int index); void setGraphicMesh(Mesh mesh) { setGraphicMesh(mesh, curGraphic); } void setGraphicMeshSmooth(bool smooth, int index); void setGraphicMeshSmooth(bool smooth) { setGraphicMeshSmooth(smooth, curGraphic); } void addGraphic(const QColor & color = Qt::darkBlue, float pointSize = 1.f, Mesh mesh = Mesh::MeshSphere, bool meshSmooth = true); void removeGraphic(int index); void clear(); void setLabelAutoRotation(bool on); void setGraphicData(const QVector & points, int index); void setGraphicData(const QVector & points) { setGraphicData(points, curGraphic); } void setGraphicData(DataArray * newArray, int index); void setGraphicData(DataArray * newArray) { setGraphicData(newArray, curGraphic); } void addPoint(const QVector3D & point, int index); void addPoint(const QVector3D & point) { addPoint(point, curGraphic); } private: struct Scatter3DGraphic { #if QT_VERSION_MAJOR == 5 QtDataVisualization::QScatter3DSeries * series; QtDataVisualization::QScatterDataProxy * data; #else QScatter3DSeries * series; QScatterDataProxy * data; #endif }; QWidget * container; #if QT_VERSION_MAJOR == 5 QtDataVisualization::Q3DScatter * canvas; #else Q3DScatter * canvas; #endif QVector graphics; int curGraphic; }; #endif // SCATTER3D_H