diff --git a/xs/src/SVG.cpp b/xs/src/SVG.cpp index a8337283a..db5ec7293 100644 --- a/xs/src/SVG.cpp +++ b/xs/src/SVG.cpp @@ -13,15 +13,31 @@ SVG::SVG(const char* filename) " \n" " \n" ); + this->arrows = true; +} + +float +SVG::coordinate(long c) +{ + return (float)unscale(c)*10; } void SVG::AddLine(const Line &line) { fprintf(this->f, - " \n", - (float)unscale(line.a.x)*10, (float)unscale(line.a.y)*10, (float)unscale(line.b.x)*10, (float)unscale(line.b.y)*10 + " coordinate(line.a.x), this->coordinate(line.a.y), this->coordinate(line.b.x), this->coordinate(line.b.y) ); + if (this->arrows) + fprintf(this->f, " marker-end=\"url(#endArrow)\""); + fprintf(this->f, "/>\n"); +} + +void +SVG::AddLine(const IntersectionLine &line) +{ + this->AddLine(Line(line.a, line.b)); } void @@ -29,6 +45,7 @@ SVG::Close() { fprintf(this->f, "\n"); fclose(this->f); + printf("SVG file written.\n"); } } diff --git a/xs/src/SVG.hpp b/xs/src/SVG.hpp index 2a22ed97e..5d4cfd56e 100644 --- a/xs/src/SVG.hpp +++ b/xs/src/SVG.hpp @@ -3,6 +3,7 @@ #include #include "Line.hpp" +#include "TriangleMesh.hpp" namespace Slic3r { @@ -10,9 +11,12 @@ class SVG { private: FILE* f; + float coordinate(long c); public: + bool arrows; SVG(const char* filename); void AddLine(const Line &line); + void AddLine(const IntersectionLine &line); void Close(); };