From 6309c58e87b2b0a2f190c133650be6c83269fb51 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 4 Apr 2014 14:55:07 +0400 Subject: [PATCH] Model is updated: event is generated by the document on feature creation --- src/Model/Model_Document.cxx | 7 +++++++ src/ModelAPI/ModelAPI_Document.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/Model/Model_Document.cxx b/src/Model/Model_Document.cxx index 3aea0ff6e..d435a0127 100644 --- a/src/Model/Model_Document.cxx +++ b/src/Model/Model_Document.cxx @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -163,6 +164,12 @@ void Model_Document::addFeature( setUniqueName(theFeature, theGroupID); theFeature->initAttributes(); TDataStd_Comment::Set(anObjLab, theFeature->getKind().c_str()); + + // event: model is updated + static Event_ID anEvent = Event_Loop::eventByName(EVENT_MODEL_UPDATED); + Event_Message anUpdateMsg(anEvent, this); + Event_Loop::loop()->send(anUpdateMsg); + } std::shared_ptr Model_Document::feature(TDF_Label& theLabel) diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index e40e9f5b5..b06dd8899 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -20,6 +20,10 @@ static const std::string CONSTRUCTIONS_GROUP = "Construction"; /// Group of parts static const std::string PARTS_GROUP = "Parts"; +/// Event ID that model is updated +static const char* EVENT_MODEL_UPDATED = "ModelUpdated"; + + /**\class Model_Document * \ingroup DataModel * \brief Document for internal data structure of any object storage. Corresponds to the SALOME study. -- 2.39.2