diff -r 3dbdc243f053 -r d355d4c52d51 src/tools/pathtool.cpp --- a/src/tools/pathtool.cpp Wed May 25 13:49:45 2022 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -#include "pathtool.h" -#include "modeleditor.h" -#include "linetypes/edge.h" -#include "document.h" - -PathTool::PathTool(Document *document) : - AbstractDrawTool{document} -{ -} - -QString PathTool::name() const -{ - return tr("Draw path"); -} - -QString PathTool::toolTip() const -{ - return tr("Draw paths"); -} - -void PathTool::overpaint(Canvas* canvas, QPainter* painter) const -{ - painter->setPen(QPen{Qt::black, 2, Qt::DashLine, Qt::RoundCap, Qt::MiterJoin}); - if (this->previewPolygon.size() >= 2) - { - canvas->drawWorldPolyline(painter, this->previewPolygon); - } - for (const glm::vec3& point : this->polygon) - { - canvas->drawWorldPoint(painter, point); - } - canvas->drawWorldPoint(painter, this->previewPoint); -} - -QString PathTool::iconName() const -{ - return ":/icons/polyline.png"; -} - -void PathTool::closeShape() -{ - std::unique_ptr modelEditor = this->document->editModel(); - for (std::size_t i = 0; i < this->polygon.size() - 1; i += 1) - { - modelEditor->append(std::array{this->polygon[i], this->polygon[i + 1]}, ldraw::EDGE_COLOR); - } - this->clearPoints(); -}