/// @file /// @brief Task2: SVG-Root element https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg #pragma once #include "task2.Element.hpp" // task2::Element #include "task2.aliases.hpp" // task2::BBox #include // std::stringstream #include // std::endl #include // std::string namespace task2 { /// @brief Root SVG Element (combined a and a element) /// @note The group element is used to enable a common transform function for all contained elements to enable a bottom-left origin /// (the svg-default is top-left) /// open: /// /// text: empty string /// close: /// struct RootElement : Element { RootElement(BBox bbox) : bbox(bbox) {} std::string open() const override final { auto [min, max] = bbox; double xorg = min[0]; double yorg = min[1]; double w = max[0] - min[0]; double h = max[1] - min[1]; std::stringstream ss; ss << "" << std::endl; ss << ""; return ss.str(); } std::string close() const override final { std::stringstream ss; ss << "" << std::endl; ss << ""; return ss.str(); }; std::string text() const override final { return std::string(); } private: BBox bbox; }; } // namespace task2