summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-06-24 18:37:27 (GMT)
committerMateusz Piekos <mateuszpiekos@gmail.com>2012-06-24 18:37:27 (GMT)
commit06bbc72598ece3e62b82471e474b0753d5439f00 (patch)
treeb1af2cd0717aff4e8d3427e22873b87410375cd2 /Swiften/Whiteboard
parent286a3d119ec95b235b09935296450ec36e640aeb (diff)
downloadswift-contrib-06bbc72598ece3e62b82471e474b0753d5439f00.zip
swift-contrib-06bbc72598ece3e62b82471e474b0753d5439f00.tar.bz2
Added handling of rects and basic handling of polygons
Diffstat (limited to 'Swiften/Whiteboard')
-rw-r--r--Swiften/Whiteboard/Elements/WhiteboardElementVisitor.h6
-rw-r--r--Swiften/Whiteboard/Elements/WhiteboardPolygonElement.h72
-rw-r--r--Swiften/Whiteboard/Elements/WhiteboardRectElement.h83
-rw-r--r--Swiften/Whiteboard/Elements/WhiteboardTextElement.h73
4 files changed, 234 insertions, 0 deletions
diff --git a/Swiften/Whiteboard/Elements/WhiteboardElementVisitor.h b/Swiften/Whiteboard/Elements/WhiteboardElementVisitor.h
index d546e7f..7244ad1 100644
--- a/Swiften/Whiteboard/Elements/WhiteboardElementVisitor.h
+++ b/Swiften/Whiteboard/Elements/WhiteboardElementVisitor.h
@@ -9,11 +9,17 @@
namespace Swift {
class WhiteboardLineElement;
class WhiteboardFreehandPathElement;
+ class WhiteboardRectElement;
+ class WhiteboardPolygonElement;
+ class WhiteboardTextElement;
class WhiteboardElementVisitor {
public:
virtual ~WhiteboardElementVisitor() {}
virtual void visit(WhiteboardLineElement& /*element*/) = 0;
virtual void visit(WhiteboardFreehandPathElement& /*element*/) = 0;
+ virtual void visit(WhiteboardRectElement& /*element*/) = 0;
+ virtual void visit(WhiteboardPolygonElement& /*element*/) = 0;
+ virtual void visit(WhiteboardTextElement& /*element*/) = 0;
};
}
diff --git a/Swiften/Whiteboard/Elements/WhiteboardPolygonElement.h b/Swiften/Whiteboard/Elements/WhiteboardPolygonElement.h
new file mode 100644
index 0000000..1134b1a
--- /dev/null
+++ b/Swiften/Whiteboard/Elements/WhiteboardPolygonElement.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2012 Mateusz Piękos
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Whiteboard/Elements/WhiteboardElement.h>
+#include <Swiften/Whiteboard/Elements/Color.h>
+
+namespace Swift {
+ class WhiteboardPolygonElement : public WhiteboardElement {
+ typedef std::pair<int, int> Point;
+ public:
+ typedef boost::shared_ptr<WhiteboardPolygonElement> ref;
+ public:
+ WhiteboardPolygonElement() {
+ }
+
+ const std::vector<Point>& getPoints() const {
+ return points_;
+ }
+
+ void setPoints(const std::vector<Point>& points) {
+ points_ = points;
+ }
+
+ const Color& getPenColor() const {
+ return penColor_;
+ }
+
+ void setPenColor(const Color& color) {
+ penColor_ = color;
+ }
+
+ const Color& getBrushColor() const {
+ return brushColor_;
+ }
+
+ void setBrushColor(const Color& color) {
+ brushColor_ = color;
+ }
+
+ std::string getID() const {
+ return id_;
+ }
+
+ void setID(const std::string& id) {
+ id_ = id;
+ }
+
+ int getPenWidth() const {
+ return penWidth_;
+ }
+
+ void setPenWidth(const int penWidth) {
+ penWidth_ = penWidth;
+ }
+
+ void accept(WhiteboardElementVisitor& visitor) {
+ visitor.visit(*this);
+ }
+
+ private:
+ std::vector<Point> points_;
+ Color penColor_;
+ Color brushColor_;
+ int penWidth_;
+ std::string id_;
+ };
+}
diff --git a/Swiften/Whiteboard/Elements/WhiteboardRectElement.h b/Swiften/Whiteboard/Elements/WhiteboardRectElement.h
new file mode 100644
index 0000000..313c3bd
--- /dev/null
+++ b/Swiften/Whiteboard/Elements/WhiteboardRectElement.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012 Mateusz Piękos
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Whiteboard/Elements/WhiteboardElement.h>
+#include <Swiften/Whiteboard/Elements/Color.h>
+
+namespace Swift {
+ class WhiteboardRectElement : public WhiteboardElement {
+ public:
+ typedef boost::shared_ptr<WhiteboardRectElement> ref;
+ public:
+ WhiteboardRectElement(int x, int y, int width, int height) {
+ x_ = x;
+ y_ = y;
+ width_ = width;
+ height_ = height;
+ }
+
+ int getX() const {
+ return x_;
+ }
+
+ int getY() const {
+ return y_;
+ }
+
+ int getWidth() const {
+ return width_;
+ }
+
+ int getHeight() const {
+ return height_;
+ }
+
+ const Color& getPenColor() const {
+ return penColor_;
+ }
+
+ void setPenColor(const Color& color) {
+ penColor_ = color;
+ }
+
+ const Color& getBrushColor() const {
+ return brushColor_;
+ }
+
+ void setBrushColor(const Color& color) {
+ brushColor_ = color;
+ }
+
+ std::string getID() const {
+ return id_;
+ }
+
+ void setID(const std::string& id) {
+ id_ = id;
+ }
+
+ int getPenWidth() const {
+ return penWidth_;
+ }
+
+ void setPenWidth(const int penWidth) {
+ penWidth_ = penWidth;
+ }
+
+ void accept(WhiteboardElementVisitor& visitor) {
+ visitor.visit(*this);
+ }
+
+ private:
+ int x_, y_, width_, height_;
+ Color penColor_;
+ Color brushColor_;
+ int penWidth_;
+ std::string id_;
+ };
+}
diff --git a/Swiften/Whiteboard/Elements/WhiteboardTextElement.h b/Swiften/Whiteboard/Elements/WhiteboardTextElement.h
new file mode 100644
index 0000000..d9fe58f
--- /dev/null
+++ b/Swiften/Whiteboard/Elements/WhiteboardTextElement.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2012 Mateusz Piękos
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Whiteboard/Elements/WhiteboardElement.h>
+#include <Swiften/Whiteboard/Elements/Color.h>
+
+namespace Swift {
+ class WhiteboardTextElement : public WhiteboardElement {
+ public:
+ typedef boost::shared_ptr<WhiteboardTextElement> ref;
+ public:
+ WhiteboardTextElement(int x, int y) {
+ x_ = x;
+ y_ = y;
+ }
+
+ void setText(const std::string text) {
+ text_ = text;
+ }
+
+ const std::string& getText() const {
+ return text_;
+ }
+
+ int getX() const {
+ return x_;
+ }
+
+ int getY() const {
+ return y_;
+ }
+
+ const Color& getColor() const {
+ return color_;
+ }
+
+ void setColor(const Color& color) {
+ color_ = color;
+ }
+
+ std::string getID() const {
+ return id_;
+ }
+
+ void setID(const std::string& id) {
+ id_ = id;
+ }
+
+ int getSize() const {
+ return size_;
+ }
+
+ void setSize(const int size) {
+ size_ = size;
+ }
+
+ void accept(WhiteboardElementVisitor& visitor) {
+ visitor.visit(*this);
+ }
+
+ private:
+ int x_, y_;
+ int size_;
+ std::string text_;
+ std::string id_;
+ Color color_;
+ };
+}