From 5285b6dce8f0df37282b744ce625d4976b0f2541 Mon Sep 17 00:00:00 2001 From: jaseg Date: Wed, 27 Jan 2021 00:49:31 +0100 Subject: Add group id include/exclude matching --- include/gerbolyze.hpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'include/gerbolyze.hpp') diff --git a/include/gerbolyze.hpp b/include/gerbolyze.hpp index 6895f09..b2634f0 100644 --- a/include/gerbolyze.hpp +++ b/include/gerbolyze.hpp @@ -76,6 +76,14 @@ namespace gerbolyze { bool m_only_polys = false; std::ostream &m_out; }; + + class ElementSelector { + public: + bool match(const pugi::xml_node &node, bool included) const; + + std::vector include; + std::vector exclude; + }; class SVGDocument { public: @@ -95,8 +103,8 @@ namespace gerbolyze { double width() const { return page_w_mm; } double height() const { return page_h_mm; } - void render(PolygonSink &sink); - void render_to_list(std::vector> &out); + void render(PolygonSink &sink, const ElementSelector *sel=nullptr); + void render_to_list(std::vector> &out, const ElementSelector *sel=nullptr); private: friend class Pattern; @@ -105,7 +113,7 @@ namespace gerbolyze { const ClipperLib::Paths *lookup_clip_path(const pugi::xml_node &node); Pattern *lookup_pattern(const std::string id); - void export_svg_group(const pugi::xml_node &group, ClipperLib::Paths &parent_clip_path); + void export_svg_group(const pugi::xml_node &group, ClipperLib::Paths &parent_clip_path, const ElementSelector *sel=nullptr, bool included=true); void export_svg_path(const pugi::xml_node &node, ClipperLib::Paths &clip_path); void setup_debug_output(std::string filename=""); void setup_viewport_clip(); -- cgit