current_element().attributes.class_ = class_;
}
+void SVGAnalyzer::set_cx(double cx) { current_element().attributes.cx = cx; }
+
+void SVGAnalyzer::set_cy(double cy) { current_element().attributes.cy = cy; }
+
void SVGAnalyzer::set_fill(std::string_view fill) {
current_element().attributes.fill = fill;
}
void on_enter_element_text() override;
void on_enter_element_title() override;
void on_exit_element() override;
+ void set_cx(double cx) override;
+ void set_cy(double cy) override;
void set_fill(std::string_view fill) override;
void set_height(double height) override;
void set_id(std::string_view id) override;
virtual void on_enter_element_title() = 0;
virtual void on_exit_element() = 0;
virtual void set_class(std::string_view) = 0;
+ virtual void set_cx(double cx) = 0;
+ virtual void set_cy(double cy) = 0;
virtual void set_fill(std::string_view fill) = 0;
virtual void set_height(double height) = 0;
virtual void set_id(std::string_view id) = 0;
case SVG::SVGElementType::Ellipse:
append_attribute(attributes_str, fill_attribute_to_string());
append_attribute(attributes_str, stroke_attribute_to_string());
+ attributes_str +=
+ fmt::format(R"( cx="{}" cy="{}")", attributes.cx, attributes.cy);
break;
case SVG::SVGElementType::Group:
attributes_str += fmt::format(R"( class="{}")", attributes.class_);
struct SVGAttributes {
std::string class_;
+ double cx;
+ double cy;
std::string fill;
double height;
std::string id;
void SvgppContext::path_exit() {}
-void SvgppContext::set(svgpp::tag::attribute::cy a, const double v) {
- (void)a;
- (void)v;
+void SvgppContext::set(svgpp::tag::attribute::cy, const double v) {
+ m_svgAnalyzer->set_cy(v);
}
-void SvgppContext::set(svgpp::tag::attribute::cx a, const double v) {
- (void)a;
- (void)v;
+void SvgppContext::set(svgpp::tag::attribute::cx, const double v) {
+ m_svgAnalyzer->set_cx(v);
}
void SvgppContext::set(svgpp::tag::attribute::fill, svgpp::tag::value::none) {
using processed_attributes_t =
boost::mpl::set<svgpp::traits::shapes_attributes_by_element,
svgpp::tag::attribute::class_, //
+ svgpp::tag::attribute::cx, //
+ svgpp::tag::attribute::cy, //
svgpp::tag::attribute::fill, //
svgpp::tag::attribute::height, //
svgpp::tag::attribute::id, //
// do some sanity checks of the parts of the recreated SVG that we cannot
// yet compare with the original SVG
+ if (contains_ellipse_shape(shape)) {
+ CHECK(recreated_svg.find(" cx=\"") != std::string::npos);
+ CHECK(recreated_svg.find(" cy=\"") != std::string::npos);
+ }
CHECK(recreated_svg.find("<title>g1</title>") != std::string::npos);
CHECK(recreated_svg.find("<title>a</title>") != std::string::npos);
CHECK(recreated_svg.find("<title>b</title>") != std::string::npos);