summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer')
-rw-r--r--Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp17
-rw-r--r--Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
index 5ce8c20..a15d7ae 100644
--- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
@@ -96,6 +96,23 @@ namespace Swift {
}
}
+ void WhiteboardElementSerializingVisitor::visit(WhiteboardEllipseElement& ellipse) {
+ element = boost::make_shared<XMLElement>("ellipse");
+ try {
+ element->setAttribute("cx", boost::lexical_cast<std::string>(ellipse.getCX()));
+ element->setAttribute("cy", boost::lexical_cast<std::string>(ellipse.getCY()));
+ element->setAttribute("rx", boost::lexical_cast<std::string>(ellipse.getRX()));
+ element->setAttribute("ry", boost::lexical_cast<std::string>(ellipse.getRY()));
+ element->setAttribute("id", ellipse.getID());
+ element->setAttribute("stroke", ellipse.getPenColor().toHex());
+ element->setAttribute("fill", ellipse.getBrushColor().toHex());;
+ element->setAttribute("stroke-width", boost::lexical_cast<std::string>(ellipse.getPenWidth()));
+ element->setAttribute("opacity", alphaToOpacity(ellipse.getPenColor().getAlpha()));
+ element->setAttribute("fill-opacity", alphaToOpacity(ellipse.getBrushColor().getAlpha()));
+ } catch (boost::bad_lexical_cast&) {
+ }
+ }
+
std::string WhiteboardElementSerializingVisitor::intToStr(const int t) const {
std::stringstream ss;
ss << t;
diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h
index 4251cca..cc25bd1 100644
--- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h
@@ -12,6 +12,7 @@
#include <Swiften/Whiteboard/Elements/WhiteboardRectElement.h>
#include <Swiften/Whiteboard/Elements/WhiteboardPolygonElement.h>
#include <Swiften/Whiteboard/Elements/WhiteboardTextElement.h>
+#include <Swiften/Whiteboard/Elements/WhiteboardEllipseElement.h>
#include <Swiften/Whiteboard/Elements/WhiteboardElementVisitor.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
@@ -24,6 +25,7 @@ namespace Swift {
void visit(WhiteboardRectElement& rect);
void visit(WhiteboardPolygonElement& polygon);
void visit(WhiteboardTextElement& text);
+ void visit(WhiteboardEllipseElement& ellipse);
XMLElement::ref getResult() const;
private: