Initial scene to svg conversion.

This commit is contained in:
James Grogan 2022-12-08 08:48:18 +00:00
parent 65ac927929
commit 1fc730d413
15 changed files with 164 additions and 28 deletions

View file

@ -1,5 +1,7 @@
#include "SvgShapeElements.h"
#include <sstream>
SvgCircle::SvgCircle()
: SvgShapeElement("circle")
{
@ -60,3 +62,24 @@ void SvgRectangle::setHeight(unsigned h)
addAttribute(std::move(height));
}
SvgPolygon::SvgPolygon()
: SvgShapeElement("polygon")
{
}
void SvgPolygon::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));
}