diff --git a/src/widgets/3dview/linemesh.cpp b/src/widgets/3dview/linemesh.cpp index e36e63c..beac9a4 100644 --- a/src/widgets/3dview/linemesh.cpp +++ b/src/widgets/3dview/linemesh.cpp @@ -1,69 +1,65 @@ /* Atelier KDE Printer Host for 3D Printing Copyright (C) <2017-2018> Author: Patrick José Pereira - patrickjp@kde.org Kevin Ottens - ervin@kde.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include #include "gcodeto4d.h" #include "linemesh.h" #include "linemeshgeometry.h" LineMesh::LineMesh(Qt3DCore::QNode *parent) : Qt3DRender::QGeometryRenderer(parent) , _lineMeshGeo(nullptr) { setInstanceCount(1); setIndexOffset(0); setFirstInstance(0); setPrimitiveType(Qt3DRender::QGeometryRenderer::LineStrip); qRegisterMetaType>("QVector"); connect(&_gcode, &GcodeTo4D::posFinished, this, &LineMesh::posUpdate); } -LineMesh::~LineMesh() -{ -} - void LineMesh::readAndRun(const QString &path) { _gcode.read(path); } void LineMesh::read(const QString &path) { emit run(path); } void LineMesh::posUpdate(const QVector &pos) { QVector vertices; vertices.reserve(pos.size()); std::transform(pos.cbegin(), pos.cend(), std::back_inserter(vertices), [](const QVector4D & x) { return x.toVector3D(); }); _lineMeshGeo = new LineMeshGeometry(vertices, this); setVertexCount(_lineMeshGeo->vertexCount()); setGeometry(_lineMeshGeo); emit finished(); } diff --git a/src/widgets/3dview/linemesh.h b/src/widgets/3dview/linemesh.h index 05cf7a7..3296d03 100644 --- a/src/widgets/3dview/linemesh.h +++ b/src/widgets/3dview/linemesh.h @@ -1,52 +1,52 @@ /* Atelier KDE Printer Host for 3D Printing Copyright (C) <2017-2018> Author: Patrick José Pereira - patrickjp@kde.org Kevin Ottens - ervin@kde.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #pragma once #include #include #include #include #include "gcodeto4d.h" class LineMeshGeometry; class QString; class LineMesh : public Qt3DRender::QGeometryRenderer { Q_OBJECT public: explicit LineMesh(Qt3DCore::QNode *parent = Q_NULLPTR); - ~LineMesh(); + ~LineMesh() = default; void read(const QString &path); Q_INVOKABLE void readAndRun(const QString &path); void posUpdate(const QVector &pos); signals: void finished(); void run(const QString &path); private: GcodeTo4D _gcode; LineMeshGeometry *_lineMeshGeo; };