X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FModelAPI_Events.cpp;h=45f321509798da7148d9fa5380d1abad96928c23;hb=28bb5c301466d4581d9a1b4aa920e0e101b8ac47;hp=074ba050190420822d423c221ee3d12ecb04d962;hpb=a7f44a41bdf29e7bd978ff3b8c8bd514d1223be7;p=modules%2Fshaper.git diff --git a/src/ModelAPI/ModelAPI_Events.cpp b/src/ModelAPI/ModelAPI_Events.cpp index 074ba0501..45f321509 100644 --- a/src/ModelAPI/ModelAPI_Events.cpp +++ b/src/ModelAPI/ModelAPI_Events.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + /* * ModelAPI_Events.cpp * @@ -32,3 +34,218 @@ ModelAPI_ObjectDeletedMessage::~ModelAPI_ObjectDeletedMessage() } +ModelAPI_OrderUpdatedMessage::ModelAPI_OrderUpdatedMessage(const Events_ID theID, + const void* theSender) + : Events_Message(theID, theSender) +{ + +} + +ModelAPI_OrderUpdatedMessage::~ModelAPI_OrderUpdatedMessage() +{ + +} + +ModelAPI_FeatureStateMessage::ModelAPI_FeatureStateMessage(const Events_ID theID, + const void* theSender) + : Events_Message(theID, theSender) +{ + myCurrentFeature = std::shared_ptr(); +} + +ModelAPI_FeatureStateMessage::~ModelAPI_FeatureStateMessage() +{ + +} + +std::shared_ptr ModelAPI_FeatureStateMessage::feature() const +{ + return myCurrentFeature; +} + +void ModelAPI_FeatureStateMessage::setFeature(std::shared_ptr& theFeature) +{ + myCurrentFeature = theFeature; +} + +bool ModelAPI_FeatureStateMessage::hasState(const std::string& theKey) const +{ + return myFeatureState.find(theKey) != myFeatureState.end(); +} + +bool ModelAPI_FeatureStateMessage::state(const std::string& theFeatureId, bool theDefault) const +{ + if(hasState(theFeatureId)) { + return myFeatureState.at(theFeatureId); + } + return theDefault; +} + +void ModelAPI_FeatureStateMessage::setState(const std::string& theFeatureId, bool theValue) +{ + myFeatureState[theFeatureId] = theValue; +} + +std::list ModelAPI_FeatureStateMessage::features() const +{ + std::list result; + std::map::const_iterator it = myFeatureState.begin(); + for( ; it != myFeatureState.end(); ++it) { + result.push_back(it->first); + } + return result; +} + + +ModelAPI_DocumentCreatedMessage::ModelAPI_DocumentCreatedMessage(const Events_ID theID, + const void* theSender) +: Events_Message(theID, theSender) +{ + +} + +ModelAPI_DocumentCreatedMessage::~ModelAPI_DocumentCreatedMessage() +{ + +} + +DocumentPtr ModelAPI_DocumentCreatedMessage::document() const +{ + return myDocument; +} + +void ModelAPI_DocumentCreatedMessage::setDocument(DocumentPtr theDocument) +{ + myDocument = theDocument; +} + +ModelAPI_AttributeEvalMessage::ModelAPI_AttributeEvalMessage(const Events_ID theID, + const void* theSender) +: Events_Message(theID, theSender) +{ + +} + +ModelAPI_AttributeEvalMessage::~ModelAPI_AttributeEvalMessage() +{ + +} + +AttributePtr ModelAPI_AttributeEvalMessage::attribute() const +{ + return myAttribute; +} + +void ModelAPI_AttributeEvalMessage::setAttribute(AttributePtr theDocument) +{ + myAttribute = theDocument; +} + +ModelAPI_ObjectRenamedMessage::ModelAPI_ObjectRenamedMessage(const Events_ID theID, + const void* theSender) +: Events_Message(theID, theSender) +{ + +} + +ModelAPI_ObjectRenamedMessage::~ModelAPI_ObjectRenamedMessage() +{ + +} + +void ModelAPI_ObjectRenamedMessage::send(ObjectPtr theObject, + const std::string& theOldName, + const std::string& theNewName, + const void* theSender) +{ + std::shared_ptr aMessage( + new ModelAPI_ObjectRenamedMessage(eventId(), theSender)); + aMessage->setObject(theObject); + aMessage->setOldName(theOldName); + aMessage->setNewName(theNewName); + Events_Loop::loop()->send(aMessage); +} + +ObjectPtr ModelAPI_ObjectRenamedMessage::object() const +{ + return myObject; +} + +void ModelAPI_ObjectRenamedMessage::setObject(ObjectPtr theObject) +{ + myObject = theObject; +} + +std::string ModelAPI_ObjectRenamedMessage::oldName() const +{ + return myOldName; +} + +void ModelAPI_ObjectRenamedMessage::setOldName(const std::string& theOldName) +{ + myOldName = theOldName; +} + +std::string ModelAPI_ObjectRenamedMessage::newName() const +{ + return myNewName; +} + +void ModelAPI_ObjectRenamedMessage::setNewName(const std::string& theNewName) +{ + myNewName = theNewName; +} + +ModelAPI_ReplaceParameterMessage::ModelAPI_ReplaceParameterMessage(const Events_ID theID, + const void* theSender) +: Events_Message(theID, theSender) +{ + +} + +ModelAPI_ReplaceParameterMessage::~ModelAPI_ReplaceParameterMessage() +{ + +} + +void ModelAPI_ReplaceParameterMessage::send(ObjectPtr theObject, + const void* theSender) +{ + std::shared_ptr aMessage( + new ModelAPI_ReplaceParameterMessage(eventId(), theSender)); + aMessage->setObject(theObject); + Events_Loop::loop()->send(aMessage); +} + +ObjectPtr ModelAPI_ReplaceParameterMessage::object() const +{ + return myObject; +} + +void ModelAPI_ReplaceParameterMessage::setObject(ObjectPtr theObject) +{ + myObject = theObject; +} + + +// ===== ModelAPI_SolverFailedMessage ===== +ModelAPI_SolverFailedMessage::ModelAPI_SolverFailedMessage(const Events_ID theID, const void* theSender) + : Events_Message(theID, theSender), + myDOF(-1) +{ +} + +ModelAPI_SolverFailedMessage::~ModelAPI_SolverFailedMessage() +{ +} + +void ModelAPI_SolverFailedMessage::setObjects(const std::set& theObjects) +{ + myObjects = theObjects; +} + +const std::set& ModelAPI_SolverFailedMessage::objects() const +{ + return myObjects; +} +