X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FModelAPI_Events.cpp;h=0a425d8c2eb5e67a4e558c2c9759ce6667633009;hb=dc1f458b1518baeab0479275e47fd60d50bc18b7;hp=c660afca2965748dd5c759be5b64ae5ba3e4ed73;hpb=5a67842979db286af5bb5015fe413d8b06c6587e;p=modules%2Fshaper.git diff --git a/src/ModelAPI/ModelAPI_Events.cpp b/src/ModelAPI/ModelAPI_Events.cpp index c660afca2..0a425d8c2 100644 --- a/src/ModelAPI/ModelAPI_Events.cpp +++ b/src/ModelAPI/ModelAPI_Events.cpp @@ -21,6 +21,13 @@ #include #include +#include + +//#define DEBUG_OBJECT_MOVED_MESSAGE +#ifdef DEBUG_OBJECT_MOVED_MESSAGE +#include +#endif + ModelAPI_ObjectUpdatedMessage::ModelAPI_ObjectUpdatedMessage(const Events_ID theID, const void* theSender) : Events_MessageGroup(theID, theSender) @@ -338,3 +345,64 @@ const std::set& ModelAPI_SolverFailedMessage::objects() const { return myObjects; } + + +// ===== ModelAPI_ObjectMovedMessage ===== +ModelAPI_ObjectMovedMessage::ModelAPI_ObjectMovedMessage(const void* theSender) + : Events_Message(Events_Loop::eventByName(EVENT_OBJECT_MOVED), theSender) +{ +} + +void ModelAPI_ObjectMovedMessage::setMovedObject(const ObjectPtr& theMovedObject) +{ + myMovedObject = theMovedObject; + myMovedAttribute = AttributePtr(); +} + +void ModelAPI_ObjectMovedMessage::setMovedAttribute(const AttributePtr& theMovedAttribute) +{ + myMovedAttribute = theMovedAttribute; + myMovedObject = ObjectPtr(); +} + +void ModelAPI_ObjectMovedMessage::setOriginalPosition(double theX, double theY) +{ + myOriginalPosition = std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); +#ifdef DEBUG_OBJECT_MOVED_MESSAGE + std::cout << "setOriginalPosition: " << myOriginalPosition->x() << ", " + << myOriginalPosition->y() << std::endl; +#endif +} + +void ModelAPI_ObjectMovedMessage::setOriginalPosition( + const std::shared_ptr& thePoint) +{ + myOriginalPosition = thePoint; +#ifdef DEBUG_OBJECT_MOVED_MESSAGE + std::cout << "setOriginalPosition: " << myOriginalPosition->x() << ", " + << myOriginalPosition->y() << std::endl; +#endif +} + +void ModelAPI_ObjectMovedMessage::setCurrentPosition(double theX, double theY) +{ + myCurrentPosition = std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); +#ifdef DEBUG_OBJECT_MOVED_MESSAGE + std::cout << "setCurrentPosition: " << myCurrentPosition->x() << ", " << myCurrentPosition->y() + << ", myCurrentPosition - myOriginalPosition: " + << myCurrentPosition->x() - myOriginalPosition->x() << ", " + << myCurrentPosition->y() - myOriginalPosition->y() << std::endl; +#endif +} + +void ModelAPI_ObjectMovedMessage::setCurrentPosition( + const std::shared_ptr& thePoint) +{ + myCurrentPosition = thePoint; +#ifdef DEBUG_OBJECT_MOVED_MESSAGE + std::cout << "setCurrentPosition: " << myCurrentPosition->x() << ", " << myCurrentPosition->y() + << ", myCurrentPosition - myOriginalPosition: " + << myCurrentPosition->x() - myOriginalPosition->x() << ", " + << myCurrentPosition->y() - myOriginalPosition->y() << std::endl; +#endif +}