Some simple svg output.
This commit is contained in:
parent
1fc730d413
commit
b101a5f87c
11 changed files with 87 additions and 6 deletions
|
@ -21,7 +21,7 @@ void SvgShapeElement::setFill(const Color& fill)
|
|||
addAttribute(std::move(attr));
|
||||
}
|
||||
|
||||
void SvgShapeElement::setStrokeWidth(unsigned width)
|
||||
void SvgShapeElement::setStrokeWidth(double width)
|
||||
{
|
||||
auto attr = std::make_unique<XmlAttribute>("stroke-width");
|
||||
attr->setValue(std::to_string(width));
|
||||
|
|
|
@ -10,7 +10,7 @@ public:
|
|||
|
||||
void setFill(const Color& fill);
|
||||
|
||||
void setStrokeWidth(unsigned width);
|
||||
void setStrokeWidth(double width);
|
||||
|
||||
void setStrokeColor(const Color& stroke);
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue