add Scatter3D graphicMeshSmooth

This commit is contained in:
2023-10-23 20:03:43 +03:00
parent 31fd00a97a
commit fa720d4d3d
2 changed files with 12 additions and 3 deletions

View File

@@ -84,14 +84,20 @@ void Scatter3D::setGraphicMesh(Mesh mesh, int index) {
} }
void Scatter3D::addGraphic(const QColor & color, float pointSize, Mesh mesh) { void Scatter3D::setGraphicMeshSmooth(bool smooth, int index) {
graphics[index].series->setMeshSmooth(smooth);
container->update();
}
void Scatter3D::addGraphic(const QColor & color, float pointSize, Mesh mesh, bool meshSmooth) {
Scatter3DGraphic sg; Scatter3DGraphic sg;
sg.data = new QtDataVisualization::QScatterDataProxy(); sg.data = new QtDataVisualization::QScatterDataProxy();
sg.series = new QtDataVisualization::QScatter3DSeries(sg.data); sg.series = new QtDataVisualization::QScatter3DSeries(sg.data);
sg.series->setItemSize(pointSize); sg.series->setItemSize(pointSize);
sg.series->setBaseColor(color); sg.series->setBaseColor(color);
sg.series->setMesh(mesh); sg.series->setMesh(mesh);
sg.series->setMeshSmooth(true); sg.series->setMeshSmooth(meshSmooth);
graphics.append(sg); graphics.append(sg);
canvas->addSeries(sg.series); canvas->addSeries(sg.series);
container->update(); container->update();

View File

@@ -44,6 +44,7 @@ class QAD_GRAPHIC3D_EXPORT Scatter3D: public QWidget {
Q_PROPERTY(float graphicPointSize READ graphicPointSize WRITE setGraphicPointSize) Q_PROPERTY(float graphicPointSize READ graphicPointSize WRITE setGraphicPointSize)
Q_PROPERTY(Mesh graphicMesh READ graphicMesh WRITE setGraphicMesh) Q_PROPERTY(Mesh graphicMesh READ graphicMesh WRITE setGraphicMesh)
Q_PROPERTY(bool labelAutoRotation READ labelAutoRotation WRITE setLabelAutoRotation) Q_PROPERTY(bool labelAutoRotation READ labelAutoRotation WRITE setLabelAutoRotation)
Q_PROPERTY(bool graphicMeshSmooth READ graphicMeshSmooth WRITE setGraphicMeshSmooth)
public: public:
explicit Scatter3D(QWidget * parent = nullptr); explicit Scatter3D(QWidget * parent = nullptr);
@@ -68,7 +69,9 @@ public slots:
void setGraphicPointSize(float sz) { setGraphicPointSize(sz, curGraphic); } void setGraphicPointSize(float sz) { setGraphicPointSize(sz, curGraphic); }
void setGraphicMesh(Mesh mesh, int index); void setGraphicMesh(Mesh mesh, int index);
void setGraphicMesh(Mesh mesh) { setGraphicMesh(mesh, curGraphic); } void setGraphicMesh(Mesh mesh) { setGraphicMesh(mesh, curGraphic); }
void addGraphic(const QColor & color = Qt::darkBlue, float pointSize = 1.f, Mesh mesh = Mesh::MeshSphere); 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 clear() { setGraphicsCount(0); } void clear() { setGraphicsCount(0); }
void setLabelAutoRotation(bool on); void setLabelAutoRotation(bool on);
void setGraphicData(const QVector<QVector3D> & points, int index); void setGraphicData(const QVector<QVector3D> & points, int index);