Start cleaning geometry module.
This commit is contained in:
parent
26ecae46b3
commit
cd688f608f
52 changed files with 493 additions and 277 deletions
|
@ -2,8 +2,9 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
SvgCircle::SvgCircle()
|
||||
: SvgShapeElement("circle")
|
||||
SvgCircle::SvgCircle(Type type)
|
||||
: SvgShapeElement(type == Type::REGULAR ? "circle" : "ellipse"),
|
||||
mType(type)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -22,7 +23,23 @@ void SvgCircle::setLocation(const Point& loc)
|
|||
|
||||
void SvgCircle::setRadius(double rad)
|
||||
{
|
||||
auto r = std::make_unique<XmlAttribute>("r");
|
||||
if (mType == Type::REGULAR)
|
||||
{
|
||||
auto r = std::make_unique<XmlAttribute>("r");
|
||||
r->setValue(std::to_string(rad));
|
||||
addAttribute(std::move(r));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto r = std::make_unique<XmlAttribute>("rx");
|
||||
r->setValue(std::to_string(rad));
|
||||
addAttribute(std::move(r));
|
||||
}
|
||||
}
|
||||
|
||||
void SvgCircle::setMinorRadius(double rad)
|
||||
{
|
||||
auto r = std::make_unique<XmlAttribute>("ry");
|
||||
r->setValue(std::to_string(rad));
|
||||
addAttribute(std::move(r));
|
||||
}
|
||||
|
|
|
@ -8,11 +8,21 @@
|
|||
class SvgCircle : public SvgShapeElement
|
||||
{
|
||||
public:
|
||||
SvgCircle();
|
||||
enum class Type
|
||||
{
|
||||
REGULAR,
|
||||
ELLIPSE
|
||||
};
|
||||
|
||||
SvgCircle(Type type = Type::REGULAR);
|
||||
|
||||
void setLocation(const Point& loc);
|
||||
|
||||
void setRadius(double rad);
|
||||
|
||||
void setMinorRadius(double rad);
|
||||
private:
|
||||
Type mType{ Type::REGULAR };
|
||||
};
|
||||
|
||||
class SvgRectangle : public SvgShapeElement
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue