From 1f8e319e256ac15438d63080d11a860dfa16431c Mon Sep 17 00:00:00 2001 From: Mateusz Piekos Date: Tue, 17 Jul 2012 11:59:17 +0200 Subject: Added handling of elements position updates diff --git a/Swift/QtUI/Whiteboard/FreehandLineItem.cpp b/Swift/QtUI/Whiteboard/FreehandLineItem.cpp index bd53843..92c4005 100644 --- a/Swift/QtUI/Whiteboard/FreehandLineItem.cpp +++ b/Swift/QtUI/Whiteboard/FreehandLineItem.cpp @@ -32,6 +32,7 @@ namespace Swift { void FreehandLineItem::setStartPoint(QPointF point) { + prepareGeometryChange(); points_.clear(); points_.append(point); QRectF rect(point, point); @@ -41,6 +42,8 @@ namespace Swift { void FreehandLineItem::lineTo(QPointF point) { + prepareGeometryChange(); + qreal x1, x2, y1, y2; x1 = points_.last().x(); x2 = point.x(); diff --git a/Swift/QtUI/Whiteboard/GView.cpp b/Swift/QtUI/Whiteboard/GView.cpp index 92339ce..4e7e006 100644 --- a/Swift/QtUI/Whiteboard/GView.cpp +++ b/Swift/QtUI/Whiteboard/GView.cpp @@ -11,6 +11,7 @@ namespace Swift { GView::GView(QGraphicsScene* scene, QWidget* parent) : QGraphicsView(scene, parent), brush(QColor(Qt::white)) { selectionRect = 0; + lastItem = 0; zValue = 0; } @@ -52,6 +53,7 @@ namespace Swift { // if (mousePressed && pos >= items_.size()) { // pos++; // } + itemsMap_.insert(id, item); if (pos > items_.size()) { item->setZValue(zValue++); scene()->addItem(item); @@ -86,6 +88,10 @@ namespace Swift { items_.clear(); } + QGraphicsItem* GView::getItem(QString id) { + return itemsMap_.value(id); + } + QString GView::getNewID() { return idPrefix + P2QSTRING(idGenerator.generateID()); } @@ -337,17 +343,40 @@ namespace Swift { void GView::mouseReleaseEvent(QMouseEvent *event) { mousePressed = false; - zValue++; - lastItem->setZValue(zValue++); - items_.append(lastItem); -// lastItemChanged(lastItem, lastItem->data(101).toInt()); - std::cout << "items:" << std::endl; - for (QList::const_iterator it = items_.begin(); it != items_.end(); ++it) { - std::cout << (*it)->data(100).toString().toStdString() << std::endl; - } - std::cout << std::endl; + QGraphicsPolygonItem* polygon = dynamic_cast(lastItem); + if (polygon && polygon->polygon().size() >= 3) { + int i = 1; + for (QList::const_iterator it = items_.begin(); it != items_.end(); ++it) { + if (*it == polygon) { + break; + } + i++; + } + lastItemChanged(polygon, i, Update); + } else if (lastItem) { + zValue++; + lastItem->setZValue(zValue++); + items_.append(lastItem); + itemsMap_.insert(lastItem->data(100).toString(), lastItem); + std::cout << "items:" << std::endl; + for (QList::const_iterator it = items_.begin(); it != items_.end(); ++it) { + std::cout << (*it)->data(100).toString().toStdString() << std::endl; + } + std::cout << std::endl; - lastItemChanged(lastItem, items_.size()); + lastItemChanged(lastItem, items_.size(), New); + } else if (selectionRect){ + QGraphicsItem* item = selectionRect->data(1).value(); + int i = 1; + for (QList::const_iterator it = items_.begin(); it != items_.end(); ++it) { + if (*it == item) { + break; + } + i++; + } + lastItemChanged(item, i, Update); + } +// lastItem = 0; } diff --git a/Swift/QtUI/Whiteboard/GView.h b/Swift/QtUI/Whiteboard/GView.h index 9428f3d..9b8f60f 100644 --- a/Swift/QtUI/Whiteboard/GView.h +++ b/Swift/QtUI/Whiteboard/GView.h @@ -21,6 +21,7 @@ namespace Swift { Q_OBJECT; public: enum Mode { Rubber, Line, Rect, Circle, HandLine, FilledHandLine, Text, Polygon, Select }; + enum Type { New, Update }; GView(QGraphicsScene* scene, QWidget* parent = 0); void setLineWidth(int i); void setLineColor(QColor color); @@ -34,6 +35,7 @@ namespace Swift { void addItem(QGraphicsItem* item, QString id, int pos); void setIDPrefix(QString prefix); void clear(); + QGraphicsItem* getItem(QString id); public slots: void moveUpSelectedItem(); @@ -50,12 +52,12 @@ namespace Swift { QGraphicsItem* lastItem; QGraphicsRectItem* selectionRect; TextDialog* textDialog; -// QMap items_; + QMap itemsMap_; QList items_; SimpleIDGenerator idGenerator; QString idPrefix; signals: - void lastItemChanged(QGraphicsItem* item, int pos); + void lastItemChanged(QGraphicsItem* item, int pos, GView::Type type); }; } diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp index 5743d80..add9802 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp @@ -16,10 +16,11 @@ #include #include #include +#include #include #include -using namespace std; +//using namespace std; namespace Swift { QtWhiteboardWindow::QtWhiteboardWindow(WhiteboardSession::ref whiteboardSession) : QWidget() { @@ -36,7 +37,7 @@ namespace Swift { graphicsView = new GView(scene, this); graphicsView->setMode(GView::Line); - connect(graphicsView, SIGNAL(lastItemChanged(QGraphicsItem*, int)), this, SLOT(handleLastItemChanged(QGraphicsItem*, int))); + connect(graphicsView, SIGNAL(lastItemChanged(QGraphicsItem*, int, GView::Type)), this, SLOT(handleLastItemChanged(QGraphicsItem*, int, GView::Type))); widthBox = new QSpinBox(this); connect(widthBox, SIGNAL(valueChanged(int)), this, SLOT(changeLineWidth(int))); @@ -132,18 +133,20 @@ namespace Swift { setSession(whiteboardSession); } - void QtWhiteboardWindow::handleWhiteboardElementReceive(const WhiteboardElement::ref element) { -// WhiteboardElementDrawingVisitor visitor(graphicsView); -// element->accept(visitor); - } - void QtWhiteboardWindow::handleWhiteboardOperationReceive(const WhiteboardOperation::ref operation) { - WhiteboardElementDrawingVisitor visitor(graphicsView, operation->getPos()); WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast(operation); if (insertOp) { + WhiteboardElementDrawingVisitor visitor(graphicsView, operation->getPos(), GView::New); insertOp->getElement()->accept(visitor); lastOpID = insertOp->getID(); } + + WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast(operation); + if (updateOp) { + WhiteboardElementDrawingVisitor visitor(graphicsView, operation->getPos(), GView::Update); + updateOp->getElement()->accept(visitor); + lastOpID = updateOp->getID(); + } } void QtWhiteboardWindow::changeLineWidth(int i) @@ -219,7 +222,6 @@ namespace Swift { graphicsView->clear(); whiteboardSession_ = session; graphicsView->setIDPrefix(P2QSTRING(whiteboardSession_->getClientID())); - whiteboardSession_->onElementReceived.connect(boost::bind(&QtWhiteboardWindow::handleWhiteboardElementReceive, this, _1)); whiteboardSession_->onOperationReceived.connect(boost::bind(&QtWhiteboardWindow::handleWhiteboardOperationReceive, this, _1)); whiteboardSession_->onRequestAccepted.connect(boost::bind(&QWidget::show, this)); whiteboardSession_->onSessionTerminateReceived.connect(boost::bind(&QtWhiteboardWindow::handleSessionTerminate, this)); @@ -229,13 +231,14 @@ namespace Swift { QWidget::activateWindow(); } - void QtWhiteboardWindow::handleLastItemChanged(QGraphicsItem* item, int pos) { + void QtWhiteboardWindow::handleLastItemChanged(QGraphicsItem* item, int pos, GView::Type type) { WhiteboardElement::ref el; QGraphicsLineItem* lineItem = qgraphicsitem_cast(item); if (lineItem != 0) { QLine line = lineItem->line().toLine(); QColor color = lineItem->pen().color(); - WhiteboardLineElement::ref element = boost::make_shared(line.x1(), line.y1(), line.x2(), line.y2()); + WhiteboardLineElement::ref element = boost::make_shared(line.x1()+lineItem->pos().x(), line.y1()+lineItem->pos().y(), line.x2()+lineItem->pos().x(), line.y2()+lineItem->pos().y()); +// element->setShift(lineItem->pos().x(), lineItem->pos().y()); element->setColor(Color(color.red(), color.green(), color.blue(), color.alpha())); element->setPenWidth(lineItem->pen().width()); @@ -250,7 +253,7 @@ namespace Swift { std::vector > points; QVector::const_iterator it = freehandLineItem->points().constBegin(); for ( ; it != freehandLineItem->points().constEnd(); ++it) { - points.push_back(std::pair(it->x(), it->y())); + points.push_back(std::pair(it->x()+item->pos().x(), it->y()+item->pos().y())); } element->setColor(Color(color.red(), color.green(), color.blue(), color.alpha())); @@ -265,7 +268,7 @@ namespace Swift { QGraphicsRectItem* rectItem = qgraphicsitem_cast(item); if (rectItem != 0) { QRectF rect = rectItem->rect(); - WhiteboardRectElement::ref element = boost::make_shared(rect.x(), rect.y(), rect.width(), rect.height()); + WhiteboardRectElement::ref element = boost::make_shared(rect.x()+item->pos().x(), rect.y()+item->pos().y(), rect.width(), rect.height()); QColor penColor = rectItem->pen().color(); QColor brushColor = rectItem->brush().color(); @@ -299,7 +302,7 @@ namespace Swift { std::vector > points; QVector::const_iterator it = polygon.begin(); for (; it != polygon.end(); ++it) { - points.push_back(std::pair(it->x(), it->y())); + points.push_back(std::pair(it->x()+item->pos().x(), it->y()+item->pos().y())); } element->setPoints(points); @@ -318,8 +321,8 @@ namespace Swift { QGraphicsEllipseItem* ellipseItem = qgraphicsitem_cast(item); if (ellipseItem) { QRectF rect = ellipseItem->rect(); - int cx = rect.x()+rect.width()/2; - int cy = rect.y()+rect.height()/2; + int cx = rect.x()+rect.width()/2 + item->pos().x(); + int cy = rect.y()+rect.height()/2 + item->pos().y(); int rx = rect.width()/2; int ry = rect.height()/2; WhiteboardEllipseElement::ref element = boost::make_shared(cx, cy, rx, ry); @@ -334,13 +337,24 @@ namespace Swift { // whiteboardSession_->sendElement(element); el = element; } - WhiteboardInsertOperation::ref insertOp = boost::make_shared(); - insertOp->setID(el->getID()); - insertOp->setPos(pos); - insertOp->setElement(el); - insertOp->setParentID(lastOpID); - lastOpID = el->getID(); - whiteboardSession_->sendOperation(insertOp); + + if (type == GView::New) { + WhiteboardInsertOperation::ref insertOp = boost::make_shared(); + insertOp->setID(el->getID()); + insertOp->setPos(pos); + insertOp->setElement(el); + insertOp->setParentID(lastOpID); + lastOpID = el->getID(); + whiteboardSession_->sendOperation(insertOp); + } else { + WhiteboardUpdateOperation::ref updateOp = boost::make_shared(); + updateOp->setID(el->getID()); + updateOp->setPos(pos); + updateOp->setElement(el); + updateOp->setParentID(lastOpID); + lastOpID = el->getID(); + whiteboardSession_->sendOperation(updateOp); + } } void QtWhiteboardWindow::handleSessionTerminate() { diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h index fbe98a7..8adee83 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.h @@ -49,11 +49,10 @@ namespace Swift { void setTextMode(); void setPolygonMode(); void setSelectMode(); - void handleLastItemChanged(QGraphicsItem* item, int pos); + void handleLastItemChanged(QGraphicsItem* item, int pos, GView::Type type); private: void handleSessionTerminate(); - void handleWhiteboardElementReceive(const WhiteboardElement::ref element); void handleWhiteboardOperationReceive(const WhiteboardOperation::ref operation); void closeEvent(QCloseEvent* event); diff --git a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h index d9809b5..fc28c6f 100644 --- a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h +++ b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h @@ -18,58 +18,90 @@ namespace Swift { class WhiteboardElementDrawingVisitor : public WhiteboardElementVisitor { public: - WhiteboardElementDrawingVisitor(GView* graphicsView, int pos) : graphicsView_(graphicsView), pos_(pos) {} + WhiteboardElementDrawingVisitor(GView* graphicsView, int pos, GView::Type type) : graphicsView_(graphicsView), pos_(pos), type_(type) {} void visit(WhiteboardLineElement& element) { - QGraphicsLineItem *item = new QGraphicsLineItem(element.x1(), element.y1(), element.x2(), element.y2()); - QPen pen; - Color color = element.getColor(); - pen.setColor(QColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha())); - pen.setWidth(element.getPenWidth()); - item->setPen(pen); - QString id = P2QSTRING(element.getID()); - item->setData(100, id); - graphicsView_->addItem(item, id, pos_); + QGraphicsLineItem *item; + if (type_ == GView::New) { + item = new QGraphicsLineItem(element.x1(), element.y1(), element.x2(), element.y2()); + graphicsView_->addItem(item, P2QSTRING(element.getID()), pos_); + } else { + item = qgraphicsitem_cast(graphicsView_->getItem(P2QSTRING(element.getID()))); + QLineF line(element.x1(), element.y1(), element.x2(), element.y2()); + item->setLine(line); + item->setPos(0,0); + } + if (item) { + QPen pen; + Color color = element.getColor(); + pen.setColor(QColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha())); + pen.setWidth(element.getPenWidth()); + item->setPen(pen); + QString id = P2QSTRING(element.getID()); + item->setData(100, id); + } } void visit(WhiteboardFreehandPathElement& element) { - FreehandLineItem *item = new FreehandLineItem; - QPen pen; - Color color = element.getColor(); - pen.setColor(QColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha())); - pen.setWidth(element.getPenWidth()); - item->setPen(pen); - - std::vector >::const_iterator it = element.getPoints().begin(); - item->setStartPoint(QPointF(it->first, it->second)); - for (++it; it != element.getPoints().end(); ++it) { - item->lineTo(QPointF(it->first, it->second)); + FreehandLineItem *item; + if (type_ == GView::New) { + item = new FreehandLineItem; + } else { + item = qgraphicsitem_cast(graphicsView_->getItem(P2QSTRING(element.getID()))); + item->setPos(0,0); } - QString id = P2QSTRING(element.getID()); - item->setData(100, id); - graphicsView_->addItem(item, id, pos_); + if (item) { + QPen pen; + Color color = element.getColor(); + pen.setColor(QColor(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha())); + pen.setWidth(element.getPenWidth()); + item->setPen(pen); + + std::vector >::const_iterator it = element.getPoints().begin(); + item->setStartPoint(QPointF(it->first, it->second)); + for (++it; it != element.getPoints().end(); ++it) { + item->lineTo(QPointF(it->first, it->second)); + } + + QString id = P2QSTRING(element.getID()); + item->setData(100, id); + } + if (type_ == GView::New) { + graphicsView_->addItem(item, P2QSTRING(element.getID()), pos_); + } } void visit(WhiteboardRectElement& element) { - QGraphicsRectItem* item = new QGraphicsRectItem(element.getX(), element.getY(), element.getWidth(), element.getHeight()); - QPen pen; - QBrush brush(Qt::SolidPattern); - Color penColor = element.getPenColor(); - Color brushColor = element.getBrushColor(); - pen.setColor(QColor(penColor.getRed(), penColor.getGreen(), penColor.getBlue(), penColor.getAlpha())); - pen.setWidth(element.getPenWidth()); - brush.setColor(QColor(brushColor.getRed(), brushColor.getGreen(), brushColor.getBlue(), brushColor.getAlpha())); - item->setPen(pen); - item->setBrush(brush); - QString id = P2QSTRING(element.getID()); - item->setData(100, id); - graphicsView_->addItem(item, id, pos_); + QGraphicsRectItem* item; + if (type_ == GView::New) { + item = new QGraphicsRectItem(element.getX(), element.getY(), element.getWidth(), element.getHeight()); + graphicsView_->addItem(item, P2QSTRING(element.getID()), pos_); + } else { + item = qgraphicsitem_cast(graphicsView_->getItem(P2QSTRING(element.getID()))); + QRectF rect(element.getX(), element.getY(), element.getWidth(), element.getHeight()); + item->setRect(rect); + item->setPos(0,0); + } + + if (item) { + QPen pen; + QBrush brush(Qt::SolidPattern); + Color penColor = element.getPenColor(); + Color brushColor = element.getBrushColor(); + pen.setColor(QColor(penColor.getRed(), penColor.getGreen(), penColor.getBlue(), penColor.getAlpha())); + pen.setWidth(element.getPenWidth()); + brush.setColor(QColor(brushColor.getRed(), brushColor.getGreen(), brushColor.getBlue(), brushColor.getAlpha())); + item->setPen(pen); + item->setBrush(brush); + QString id = P2QSTRING(element.getID()); + item->setData(100, id); + } } void visit(WhiteboardPolygonElement& element) { - /* QGraphicsPolygonItem* item = qgraphicsitem_cast(graphicsView_->getItem(P2QSTRING(element.getID()))); - if (item == 0) { + QGraphicsPolygonItem* item = qgraphicsitem_cast(graphicsView_->getItem(P2QSTRING(element.getID()))); + if (item == 0 && type_ == GView::New) { item = new QGraphicsPolygonItem(); QPen pen; QBrush brush(Qt::SolidPattern); @@ -89,7 +121,7 @@ namespace Swift { for (; it != element.getPoints().end(); ++it) { polygon.append(QPointF(it->first, it->second)); } - item->setPolygon(polygon);*/ + item->setPolygon(polygon); } void visit(WhiteboardTextElement& element) { @@ -108,11 +140,18 @@ namespace Swift { void visit(WhiteboardEllipseElement& element) { QRectF rect; - + QGraphicsEllipseItem* item; + QString id = P2QSTRING(element.getID()); rect.setTopLeft(QPointF(element.getCX()-element.getRX(), element.getCY()-element.getRY())); rect.setBottomRight(QPointF(element.getCX()+element.getRX(), element.getCY()+element.getRY())); - - QGraphicsEllipseItem* item = new QGraphicsEllipseItem(rect); + if (type_ == GView::New) { + item = new QGraphicsEllipseItem(rect); + graphicsView_->addItem(item, id, pos_); + } else { + item = qgraphicsitem_cast(graphicsView_->getItem(id)); + item->setRect(rect); + item->setPos(0,0); + } QPen pen; QBrush brush(Qt::SolidPattern); Color penColor = element.getPenColor(); @@ -122,13 +161,12 @@ namespace Swift { brush.setColor(QColor(brushColor.getRed(), brushColor.getGreen(), brushColor.getBlue(), brushColor.getAlpha())); item->setPen(pen); item->setBrush(brush); - QString id = P2QSTRING(element.getID()); item->setData(100, id); - graphicsView_->addItem(item, id, pos_); } private: GView* graphicsView_; int pos_; + GView::Type type_; }; } diff --git a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp index 5d4aef1..7581115 100644 --- a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp +++ b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp @@ -52,21 +52,15 @@ namespace Swift { int y1 = 0; int x2 = 0; int y2 = 0; - int xShift = 0; - int yShift = 0; try { x1 = boost::lexical_cast(attributes.getAttributeValue("x1").get_value_or("0")); y1 = boost::lexical_cast(attributes.getAttributeValue("y1").get_value_or("0")); x2 = boost::lexical_cast(attributes.getAttributeValue("x2").get_value_or("0")); y2 = boost::lexical_cast(attributes.getAttributeValue("y2").get_value_or("0")); - xShift = boost::lexical_cast(attributes.getAttributeValue("xshift").get_value_or("0")); - yShift = boost::lexical_cast(attributes.getAttributeValue("yshift").get_value_or("0")); } catch (boost::bad_lexical_cast&) { } WhiteboardLineElement::ref whiteboardElement = boost::make_shared(x1, y1, x2, y2); - whiteboardElement->setShift(xShift, yShift); - Color color(attributes.getAttributeValue("stroke").get_value_or("#000000")); color.setAlpha(opacityToAlpha(attributes.getAttributeValue("opacity").get_value_or("1"))); whiteboardElement->setColor(color); diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp index 965939a..d22d4ce 100644 --- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp @@ -20,8 +20,6 @@ namespace Swift { element->setAttribute("y1", boost::lexical_cast(line.y1())); element->setAttribute("x2", boost::lexical_cast(line.x2())); element->setAttribute("y2", boost::lexical_cast(line.y2())); - element->setAttribute("xshift", boost::lexical_cast(line.getXShift())); - element->setAttribute("yshift", boost::lexical_cast(line.getYShift())); element->setAttribute("id", line.getID()); element->setAttribute("stroke", line.getColor().toHex()); element->setAttribute("stroke-width", boost::lexical_cast(line.getPenWidth())); diff --git a/Swiften/Whiteboard/Elements/WhiteboardLineElement.h b/Swiften/Whiteboard/Elements/WhiteboardLineElement.h index 85e6302..20455b6 100644 --- a/Swiften/Whiteboard/Elements/WhiteboardLineElement.h +++ b/Swiften/Whiteboard/Elements/WhiteboardLineElement.h @@ -37,19 +37,6 @@ namespace Swift { return y2_; } - int getXShift() const { - return xShift_; - } - - int getYShift() const { - return yShift_; - } - - void setShift(int x, int y) { - xShift_ = x; - yShift_ = y; - } - const Color& getColor() const { return color_; } @@ -80,7 +67,6 @@ namespace Swift { private: int x1_, y1_, x2_, y2_; - int xShift_, yShift_; Color color_; int penWidth_; std::string id_; diff --git a/Swiften/Whiteboard/IncomingWhiteboardSession.cpp b/Swiften/Whiteboard/IncomingWhiteboardSession.cpp index 42f5934..568bed8 100644 --- a/Swiften/Whiteboard/IncomingWhiteboardSession.cpp +++ b/Swiften/Whiteboard/IncomingWhiteboardSession.cpp @@ -27,17 +27,13 @@ namespace Swift { void IncomingWhiteboardSession::handleIncomingOperation(WhiteboardOperation::ref operation) { // std::cout << "incoming pos: " << operation->getPos() << std::endl; // WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast(operation); -// if (insertOp) { - WhiteboardOperation::ref op = server.handleClientOperationReceived(operation); - //std::cout << "in1: " << operation->getID() << " " << operation->getPos() << " " << operation->getParentID() << std::endl; - //std::cout << "in2: " << op->getID() << " " << op->getPos() << " " << op->getParentID() << std::endl; - onOperationReceived(op); - WhiteboardPayload::ref payload = boost::make_shared(); - payload->setOperation(op); - sendPayload(payload); -// } else { -// std::cout << "unknown operation" << std::endl; -// } + WhiteboardOperation::ref op = server.handleClientOperationReceived(operation); + //std::cout << "in1: " << operation->getID() << " " << operation->getPos() << " " << operation->getParentID() << std::endl; + //std::cout << "in2: " << op->getID() << " " << op->getPos() << " " << op->getParentID() << std::endl; + onOperationReceived(op); + WhiteboardPayload::ref payload = boost::make_shared(); + payload->setOperation(op); + sendPayload(payload); } void IncomingWhiteboardSession::sendOperation(WhiteboardOperation::ref operation) { -- cgit v0.10.2-6-g49f6