Initial svg support.
This commit is contained in:
parent
101bfb4207
commit
65ac927929
22 changed files with 284 additions and 30 deletions
62
src/web/svg/elements/SvgShapeElements.cpp
Normal file
62
src/web/svg/elements/SvgShapeElements.cpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
#include "SvgShapeElements.h"
|
||||
|
||||
SvgCircle::SvgCircle()
|
||||
: SvgShapeElement("circle")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SvgCircle::setLocation(const DiscretePoint& loc)
|
||||
{
|
||||
auto cx = std::make_unique<XmlAttribute>("cx");
|
||||
auto cy = std::make_unique<XmlAttribute>("cy");
|
||||
|
||||
cx->setValue(std::to_string(loc.GetX()));
|
||||
cy->setValue(std::to_string(loc.GetY()));
|
||||
|
||||
addAttribute(std::move(cx));
|
||||
addAttribute(std::move(cy));
|
||||
}
|
||||
|
||||
void SvgCircle::setRadius(unsigned rad)
|
||||
{
|
||||
auto r = std::make_unique<XmlAttribute>("r");
|
||||
r->setValue(std::to_string(rad));
|
||||
addAttribute(std::move(r));
|
||||
}
|
||||
|
||||
SvgRectangle::SvgRectangle()
|
||||
: SvgShapeElement("rect")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SvgRectangle::setLocation(const DiscretePoint& loc)
|
||||
{
|
||||
auto x = std::make_unique<XmlAttribute>("x");
|
||||
auto y = std::make_unique<XmlAttribute>("y");
|
||||
|
||||
x->setValue(std::to_string(loc.GetX()));
|
||||
y->setValue(std::to_string(loc.GetY()));
|
||||
|
||||
addAttribute(std::move(x));
|
||||
addAttribute(std::move(y));
|
||||
}
|
||||
|
||||
void SvgRectangle::setWidth(unsigned w)
|
||||
{
|
||||
auto width = std::make_unique<XmlAttribute>("width");
|
||||
|
||||
width->setValue(std::to_string(w));
|
||||
|
||||
addAttribute(std::move(width));
|
||||
}
|
||||
|
||||
void SvgRectangle::setHeight(unsigned h)
|
||||
{
|
||||
auto height = std::make_unique<XmlAttribute>("height");
|
||||
|
||||
height->setValue(std::to_string(h));
|
||||
|
||||
addAttribute(std::move(height));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue