diff options
author | jaseg <git@jaseg.de> | 2021-04-25 14:03:16 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-04-25 14:03:16 +0200 |
commit | f2c891533f5179bf3d8a1625b1fe490a0cd06a42 (patch) | |
tree | d64bc014aa247d425c5f1f6c64e70144956b8317 /svg-flatten/include/gerbolyze.hpp | |
parent | 1180ebdc1f18044a74f22f17b4d500ce7d6543fa (diff) | |
download | gerbolyze-f2c891533f5179bf3d8a1625b1fe490a0cd06a42.tar.gz gerbolyze-f2c891533f5179bf3d8a1625b1fe490a0cd06a42.tar.bz2 gerbolyze-f2c891533f5179bf3d8a1625b1fe490a0cd06a42.zip |
svg-flatten: Add outline/edge layer mode
Diffstat (limited to 'svg-flatten/include/gerbolyze.hpp')
-rw-r--r-- | svg-flatten/include/gerbolyze.hpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/svg-flatten/include/gerbolyze.hpp b/svg-flatten/include/gerbolyze.hpp index d1d5f85..0b4f03e 100644 --- a/svg-flatten/include/gerbolyze.hpp +++ b/svg-flatten/include/gerbolyze.hpp @@ -49,6 +49,21 @@ namespace gerbolyze { virtual ~PolygonSink() {} virtual void header(d2p origin, d2p size) {(void) origin; (void) size;} virtual PolygonSink &operator<<(const Polygon &poly) = 0; + virtual PolygonSink &operator<<(const ClipperLib::Paths paths) { + for (const auto &poly : paths) { + *this << poly; + } + return *this; + }; + virtual PolygonSink &operator<<(const ClipperLib::Path poly) { + vector<array<double, 2>> out; + for (const auto &p : poly) { + out.push_back(std::array<double, 2>{ + ((double)p.X) / clipper_scale, ((double)p.Y) / clipper_scale + }); + } + return *this << out; + }; virtual PolygonSink &operator<<(const LayerNameToken &) { return *this; }; virtual PolygonSink &operator<<(GerberPolarityToken pol) = 0; virtual void footer() {} @@ -143,6 +158,7 @@ namespace gerbolyze { double m_minimum_feature_size_mm = 0.1; double curve_tolerance_mm; VectorizerSelectorizer &m_vec_sel; + bool outline_mode = false; }; class SVGDocument { @@ -209,7 +225,7 @@ namespace gerbolyze { class SimpleGerberOutput : public StreamPolygonSink { public: - SimpleGerberOutput(std::ostream &out, bool only_polys=false, int digits_int=4, int digits_frac=6, double scale=1.0, d2p offset={0,0}, bool flip_polarity=false); + SimpleGerberOutput(std::ostream &out, bool only_polys=false, int digits_int=4, int digits_frac=6, double scale=1.0, d2p offset={0,0}, bool flip_polarity=false, bool outline_mode=false); virtual ~SimpleGerberOutput() {} virtual SimpleGerberOutput &operator<<(const Polygon &poly); virtual SimpleGerberOutput &operator<<(GerberPolarityToken pol); @@ -225,6 +241,7 @@ namespace gerbolyze { d2p m_offset; double m_scale; bool m_flip_pol; + bool m_outline_mode; }; class SimpleSVGOutput : public StreamPolygonSink { |