current_element().attributes.id = id;
}
+void SVGAnalyzer::set_rx(double rx) { current_element().attributes.rx = rx; }
+
+void SVGAnalyzer::set_ry(double ry) { current_element().attributes.ry = ry; }
+
void SVGAnalyzer::set_point(std::pair<double, double> point) {
current_element().attributes.points.emplace_back(point.first, point.second);
}
void set_fill(std::string_view fill) override;
void set_height(double height) override;
void set_id(std::string_view id) override;
+ void set_rx(double rx) override;
+ void set_ry(double ry) override;
void set_class(std::string_view) override;
void set_stroke(std::string_view stroke) override;
void set_point(std::pair<double, double> point) override;
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;
+ virtual void set_rx(double rx) = 0;
+ virtual void set_ry(double ry) = 0;
virtual void set_point(std::pair<double, double> point) = 0;
virtual void set_stroke(std::string_view stroke) = 0;
virtual void set_text(std::string_view text) = 0;
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);
+ fmt::format(R"( cx="{}" cy="{}" rx="{}" ry="{}")", attributes.cx,
+ attributes.cy, attributes.rx, attributes.ry);
break;
case SVG::SVGElementType::Group:
attributes_str += fmt::format(R"( class="{}")", attributes.class_);
double height;
std::string id;
std::vector<SVGPoint> points;
+ double rx;
+ double ry;
std::string stroke;
std::optional<SVGMatrix> transform;
SVGRect viewBox;
(void)v;
}
-void SvgppContext::set(svgpp::tag::attribute::rx a, const double v) {
- (void)a;
- (void)v;
+void SvgppContext::set(svgpp::tag::attribute::rx, const double v) {
+ m_svgAnalyzer->set_rx(v);
}
-void SvgppContext::set(svgpp::tag::attribute::ry a, const double v) {
- (void)a;
- (void)v;
+void SvgppContext::set(svgpp::tag::attribute::ry, const double v) {
+ m_svgAnalyzer->set_ry(v);
}
void SvgppContext::set(svgpp::tag::attribute::x1 a, const double v) {
svgpp::tag::attribute::height, //
svgpp::tag::attribute::id, //
svgpp::tag::attribute::points, //
+ svgpp::tag::attribute::rx, //
+ svgpp::tag::attribute::ry, //
svgpp::tag::attribute::stroke, //
svgpp::tag::attribute::transform, //
svgpp::tag::attribute::viewBox, //
boost::split(recreated_svg_lines, recreated_svg, boost::is_any_of("\n"));
for (std::size_t i = 0; i < original_svg_lines.size(); i++) {
REQUIRE(i < recreated_svg_lines.size());
- if (recreated_svg_lines[i].starts_with("<ellipse fill=\"")) {
- // stop comparison here for ellipse based node shapes since we do not
- // yet handle all attributes on the 'ellipse' element
- break;
- }
if (recreated_svg_lines[i] ==
("<path fill=\"none\" stroke=\"black\"/>")) {
// stop comparison here for the 'cylinder' node shape since we do not
// 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);