aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/include/gerbolyze.hpp
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-06-20 16:19:53 +0200
committerjaseg <git@jaseg.de>2022-06-20 16:19:53 +0200
commit9e9cc2bc019f0e67720ad5da16315e7cd6781e78 (patch)
treedd0531eef230fa8042143019db669e2841170f8a /svg-flatten/include/gerbolyze.hpp
parent0e1c8507bbda04f131ae0733e38b5f18996531b1 (diff)
downloadgerbolyze-9e9cc2bc019f0e67720ad5da16315e7cd6781e78.tar.gz
gerbolyze-9e9cc2bc019f0e67720ad5da16315e7cd6781e78.tar.bz2
gerbolyze-9e9cc2bc019f0e67720ad5da16315e7cd6781e78.zip
svg-flatten: add export of patterns via aperture macros
Diffstat (limited to 'svg-flatten/include/gerbolyze.hpp')
-rw-r--r--svg-flatten/include/gerbolyze.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/svg-flatten/include/gerbolyze.hpp b/svg-flatten/include/gerbolyze.hpp
index 9de5572..d62cbcc 100644
--- a/svg-flatten/include/gerbolyze.hpp
+++ b/svg-flatten/include/gerbolyze.hpp
@@ -56,6 +56,18 @@ namespace gerbolyze {
d2p m_center;
};
+ class PatternToken {
+ public:
+ PatternToken(vector<pair<Polygon, GerberPolarityToken>> &polys) : m_polys(polys) {}
+ vector<pair<Polygon, GerberPolarityToken>> &m_polys;
+ };
+
+ class FlashToken {
+ public:
+ FlashToken(d2p offset) : m_offset(offset) {}
+ d2p m_offset;
+ };
+
class PolygonSink {
public:
virtual ~PolygonSink() {}
@@ -80,6 +92,11 @@ namespace gerbolyze {
virtual PolygonSink &operator<<(GerberPolarityToken pol) = 0;
virtual PolygonSink &operator<<(const ApertureToken &) { return *this; };
virtual PolygonSink &operator<<(const DrillToken &) { return *this; };
+ virtual PolygonSink &operator<<(const FlashToken &) { return *this; };
+ virtual PolygonSink &operator<<(const PatternToken &) {
+ cerr << "Error: pattern to aperture mapping is not supporte for this output." << endl;
+ return *this;
+ };
virtual void footer() {}
};
@@ -129,6 +146,8 @@ namespace gerbolyze {
virtual PolygonScaler &operator<<(GerberPolarityToken pol);
virtual PolygonScaler &operator<<(const ApertureToken &tok);
virtual PolygonScaler &operator<<(const DrillToken &tok);
+ virtual PolygonScaler &operator<<(const FlashToken &tok);
+ virtual PolygonScaler &operator<<(const PatternToken &tok);
virtual void footer();
private:
@@ -194,10 +213,13 @@ namespace gerbolyze {
double m_minimum_feature_size_mm = 0.1;
double curve_tolerance_mm;
double drill_test_polsby_popper_tolerance = 0.01;
+ double aperture_circle_test_tolerance = 0.01;
+ double aperture_rect_test_tolerance = 0.01;
VectorizerSelectorizer &m_vec_sel;
bool outline_mode = false;
bool flip_color_interpretation = false;
bool pattern_complete_tiles_only = false;
+ bool use_apertures_for_patterns = false;
};
class RenderContext {
@@ -212,6 +234,9 @@ namespace gerbolyze {
xform2d transform,
ClipperLib::Paths &clip,
bool included);
+ RenderContext(RenderContext &parent,
+ PolygonSink &sink,
+ ClipperLib::Paths &clip);
PolygonSink &sink() { return m_sink; }
const ElementSelector &sel() { return m_sel; }
@@ -305,6 +330,8 @@ namespace gerbolyze {
virtual SimpleGerberOutput &operator<<(GerberPolarityToken pol);
virtual SimpleGerberOutput &operator<<(const DrillToken &tok);
virtual SimpleGerberOutput &operator<<(const ApertureToken &ap);
+ virtual SimpleGerberOutput &operator<<(const FlashToken &tok);
+ virtual SimpleGerberOutput &operator<<(const PatternToken &tok);
virtual void header_impl(d2p origin, d2p size);
virtual void footer_impl();
@@ -319,6 +346,7 @@ namespace gerbolyze {
bool m_flip_pol;
bool m_outline_mode;
double m_current_aperture;
+ bool m_macro_aperture;
unsigned int m_aperture_num;
};