Some simple svg output.

This commit is contained in:
James Grogan 2022-12-08 13:52:37 +00:00
parent 1fc730d413
commit b101a5f87c
11 changed files with 87 additions and 6 deletions

View file

@ -83,3 +83,24 @@ void SvgPolygon::setPoints(const std::vector<DiscretePoint>& locs)
addAttribute(std::move(points));
}
SvgPolyline::SvgPolyline()
: SvgShapeElement("polyline")
{
auto fill = std::make_unique<XmlAttribute>("fill");
fill->setValue("none");
addAttribute(std::move(fill));
}
void SvgPolyline::setPoints(const std::vector<DiscretePoint>& locs)
{
auto points = std::make_unique<XmlAttribute>("points");
std::stringstream sstr;
for (const auto& loc : locs)
{
sstr << loc.GetX() << "," << loc.GetY() << " ";
}
points->setValue(sstr.str());
addAttribute(std::move(points));
}

View file

@ -34,3 +34,11 @@ public:
void setPoints(const std::vector<DiscretePoint>& loc);
};
class SvgPolyline : public SvgShapeElement
{
public:
SvgPolyline();
void setPoints(const std::vector<DiscretePoint>& loc);
};