// Author: Mikhail PONIKAROV
#include <Event_Message.h>
-
-Event_Message::Event_Message(const Event_ID theID, const void* theSender)
- : myEventId(theID), mySender((void*) theSender)
-{
-}
public:
//! Creates the message
- Event_Message(const Event_ID theID, const void* theSender = 0);
+ Event_Message(const Event_ID theID, const void* theSender = 0)
+ : myEventId(theID), mySender((void*) theSender) {}
+ //! do nothing in the destructor yet
virtual ~Event_Message() {}
//! Returns identifier of the message
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);
+ static Event_ID anEvent = Event_Loop::eventByName(EVENT_FEATURE_UPDATED);
+ ModelAPI_FeatureUpdatedMessage aMsg(theFeature);
+ Event_Loop::loop()->send(aMsg);
}
shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
theFeature->data()->setName(aName);
}
+
+
+ModelAPI_FeatureUpdatedMessage::ModelAPI_FeatureUpdatedMessage(
+ shared_ptr<ModelAPI_Feature> theFeature)
+ : Event_Message(messageId(), 0), myFeature(theFeature)
+{}
+
+const Event_ID ModelAPI_FeatureUpdatedMessage::messageId()
+{
+ static Event_ID MY_ID = Event_Loop::eventByName("FeatureUpdated");
+ return MY_ID;
+}
+
+shared_ptr<ModelAPI_Feature> ModelAPI_FeatureUpdatedMessage::feature()
+{
+ return myFeature;
+}
#include <Model.h>
#include <ModelAPI_Document.h>
+#include <Event_Message.h>
+
#include <TDocStd_Document.hxx>
#include <map>
std::vector<std::string> myGroupsNames; ///< names of added groups to the document
};
+/// Event ID that model is updated
+static const char * EVENT_FEATURE_UPDATED = "FeatureUpdated";
+
+/// Message that feature was changed (used for Object Browser update)
+class ModelAPI_FeatureUpdatedMessage : public Event_Message {
+ std::shared_ptr<ModelAPI_Feature> myFeature; ///< which feature is changed
+public:
+ /// sender is not important, all information is located in the feature
+ ModelAPI_FeatureUpdatedMessage(std::shared_ptr<ModelAPI_Feature> theFeature);
+
+ /// Returns the ID of this message
+ static const Event_ID messageId();
+
+ /// Returns the feature that has been updated
+ std::shared_ptr<ModelAPI_Feature> feature();
+};
+
#endif
/// 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.
#include "ModelAPI.h"
#include "ModelAPI_PluginManager.h"
+
#include <string>
#include <memory>
* \brief Functionality of the model object: to update result,
* to initialize attributes, etc.
*/
-
class MODELAPI_EXPORT ModelAPI_Feature
{
std::shared_ptr<ModelAPI_Object> myData; ///< manager of the data model of a feature