]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Moved the model messages from Model to ModelAPI and removed dependencies on Model
authormpv <mikhail.ponikarov@opencascade.com>
Tue, 1 Jul 2014 07:41:29 +0000 (11:41 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Tue, 1 Jul 2014 07:41:29 +0000 (11:41 +0400)
14 files changed:
src/Model/Model_Data.cpp
src/Model/Model_Document.cpp
src/Model/Model_Events.cpp
src/Model/Model_Events.h
src/Model/Model_Update.cpp
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI_Events.h [new file with mode: 0644]
src/ModelAPI/ModelAPI_PluginManager.cpp
src/PartSet/CMakeLists.txt
src/PartSet/PartSet_Listener.cpp
src/PartSet/PartSet_OperationFeatureEdit.cpp
src/PartSet/PartSet_OperationFeatureEditMulti.cpp
src/SketchSolver/SketchSolver_ConstraintGroup.cpp
src/SketchSolver/SketchSolver_ConstraintManager.cpp

index 80eba05b0e5a4cac492a4c0930e6d2e2100fca5e..5b3a944c914e5e62828e508b19b5ca4ac7d71167 100644 (file)
@@ -49,8 +49,7 @@ void Model_Data::setName(string theName)
   }
   if (isModified) {
     static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_UPDATED);
-    Model_FeatureUpdatedMessage aMsg(myFeature, anEvent);
-    Events_Loop::loop()->send(aMsg, false);
+    ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent, false);
   }
 }
 
@@ -223,8 +222,7 @@ void Model_Data::sendAttributeUpdated(ModelAPI_Attribute* theAttr)
 {
   theAttr->setInitialized();
   static const Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_UPDATED);
-  Model_FeatureUpdatedMessage aMsg(myFeature, anEvent);
-  Events_Loop::loop()->send(aMsg);
+  ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent);
 }
 
 #include <TNaming_Builder.hxx>
index e17a14af55719000c54b58eb0747eb7cb040b5eb..95cc5a9d1a348a8220f6794db21279fe3d04ac2a 100644 (file)
@@ -386,8 +386,7 @@ void Model_Document::addFeature(const FeaturePtr theFeature)
 
   // event: feature is added
   static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_CREATED);
-  Model_FeatureUpdatedMessage aMsg(theFeature, anEvent);
-  Events_Loop::loop()->send(aMsg);
+  ModelAPI_EventCreator::get()->sendUpdated(theFeature, anEvent);
 }
 
 /// Appenad to the array of references a new referenced label.
@@ -444,8 +443,7 @@ void Model_Document::removeFeature(FeaturePtr theFeature)
   RemoveFromRefArray(groupLabel(FEATURES_GROUP), aData->label());
 
   // event: feature is added
-  Model_FeatureDeletedMessage aMsg(theFeature->document(), theFeature->getGroup());
-  Events_Loop::loop()->send(aMsg);
+  ModelAPI_EventCreator::get()->sendDeleted(theFeature->document(), theFeature->getGroup());
 }
 
 FeaturePtr Model_Document::feature(TDF_Label& theLabel)
@@ -607,11 +605,9 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
       aFIter = myFeatures.erase(aFIter);
       // event: model is updated
       if (aFeature->isInHistory()) {
-        Model_FeatureDeletedMessage aMsg1(aThis, FEATURES_GROUP);
-        Events_Loop::loop()->send(aMsg1);
+        ModelAPI_EventCreator::get()->sendDeleted(aThis, FEATURES_GROUP);
       }
-      Model_FeatureDeletedMessage aMsg2(aThis, aFeature->getGroup());
-      Events_Loop::loop()->send(aMsg2);
+      ModelAPI_EventCreator::get()->sendDeleted(aThis, aFeature->getGroup());
     } else if (aDSTag < aFeatureTag) { // a new feature is inserted
       // create a feature
       FeaturePtr aFeature = ModelAPI_PluginManager::get()->createFeature(
@@ -635,12 +631,10 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
 
       // event: model is updated
       static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_CREATED);
-      Model_FeatureUpdatedMessage aMsg1(aFeature, anEvent);
-      Events_Loop::loop()->send(aMsg1);
+      ModelAPI_EventCreator::get()->sendUpdated(aFeature, anEvent);
       FeaturePtr anObj = objectByFeature(aFeature);
       if (anObj) {
-        Model_FeatureUpdatedMessage aMsg2(anObj, anEvent);
-        Events_Loop::loop()->send(aMsg2);
+        ModelAPI_EventCreator::get()->sendUpdated(anObj, anEvent);
       }
 
       // feature for this label is added, so go to the next label
@@ -648,8 +642,7 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
     } else { // nothing is changed, both iterators are incremented
       if (theMarkUpdated) {
         static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_UPDATED);
-        Model_FeatureUpdatedMessage aMsg(*aFIter, anEvent);
-        Events_Loop::loop()->send(aMsg);
+        ModelAPI_EventCreator::get()->sendUpdated(*aFIter, anEvent);
       }
       aFIter++;
       aFLabIter.Next();
index 538305efb72d9270c76f0400bcee586efeba9697..fb94001b86aa83d13717f28861f40b63181da385 100644 (file)
@@ -5,31 +5,82 @@
 #include <Model_Events.h>
 #include <Events_Loop.h>
 
-// DELETED methods
-//Events_MessageGroup* Model_FeatureDeletedMessage::newEmpty() {
-//  return new Model_FeatureDeletedMessage(myDoc, "");
-//}
-//
-//Model_FeatureDeletedMessage::Model_FeatureDeletedMessage(
-//  const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
-//  : Events_MessageGroup(messageId(), 0), myDoc(theDoc)
-//
-//{
-//  if (!theGroup.empty())
-//    myGroups.insert(theGroup);
-//}
-//
-//const Events_ID Model_FeatureDeletedMessage::messageId()
-//{
-//  static Events_ID MY_ID = Events_Loop::eventByName(EVENT_FEATURE_DELETED);
-//  return MY_ID;
-//}
-//
-//void Model_FeatureDeletedMessage::Join(Events_MessageGroup& theJoined)
-//{
-//  Model_FeatureDeletedMessage* aJoined = dynamic_cast<Model_FeatureDeletedMessage*>(&theJoined);
-//  std::set<std::string>::iterator aGIter = aJoined->myGroups.begin();
-//  for(; aGIter != aJoined->myGroups.end(); aGIter++) {
-//    myGroups.insert(*aGIter);
-//  }
-//}
+/// Alone instance of the creator per application
+Model_EventCreator MY_CREATOR;
+
+/////////////////////// CREATOR /////////////////////////////
+void Model_EventCreator::sendUpdated(
+  const FeaturePtr& theFeature, const Events_ID& theEvent, const bool isGroupped) const
+{
+  Model_FeatureUpdatedMessage aMsg(theFeature, theEvent);
+  Events_Loop::loop()->send(aMsg, isGroupped);
+}
+
+void Model_EventCreator::sendDeleted(
+  const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup) const
+{
+  Model_FeatureDeletedMessage aMsg(theDoc, theGroup);
+  Events_Loop::loop()->send(aMsg, true);
+}
+
+Model_EventCreator::Model_EventCreator()
+{
+  ModelAPI_EventCreator::set(this);
+}
+
+/////////////////////// UPDATED MESSAGE /////////////////////////////
+Model_FeatureUpdatedMessage::Model_FeatureUpdatedMessage(
+  const FeaturePtr& theFeature,
+  const Events_ID& theEvent) : ModelAPI_FeatureUpdatedMessage(theEvent, 0)
+{
+  if (theFeature) myFeatures.insert(theFeature);
+}
+
+std::set<FeaturePtr> Model_FeatureUpdatedMessage::features() const 
+{
+  return myFeatures;
+}
+
+Events_MessageGroup* Model_FeatureUpdatedMessage::newEmpty() 
+{
+  FeaturePtr anEmptyFeature;
+  return new Model_FeatureUpdatedMessage(anEmptyFeature, eventID());
+}
+
+void Model_FeatureUpdatedMessage::Join(Events_MessageGroup& theJoined) 
+{
+  Model_FeatureUpdatedMessage* aJoined = dynamic_cast<Model_FeatureUpdatedMessage*>(&theJoined);
+  std::set<FeaturePtr >::iterator aFIter = aJoined->myFeatures.begin();
+  for(; aFIter != aJoined->myFeatures.end(); aFIter++) {
+    myFeatures.insert(*aFIter);
+  }
+}
+
+/////////////////////// DELETED MESSAGE /////////////////////////////
+Model_FeatureDeletedMessage::Model_FeatureDeletedMessage(
+  const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
+  : ModelAPI_FeatureDeletedMessage(messageId(), 0), myDoc(theDoc)
+{
+  if (!theGroup.empty())
+    myGroups.insert(theGroup);
+}
+
+Events_MessageGroup* Model_FeatureDeletedMessage::newEmpty() 
+{
+  return new Model_FeatureDeletedMessage(myDoc, "");
+}
+
+const Events_ID Model_FeatureDeletedMessage::messageId()
+{
+  static Events_ID MY_ID = Events_Loop::eventByName(EVENT_FEATURE_DELETED);
+  return MY_ID;
+}
+
+void Model_FeatureDeletedMessage::Join(Events_MessageGroup& theJoined)
+{
+  Model_FeatureDeletedMessage* aJoined = dynamic_cast<Model_FeatureDeletedMessage*>(&theJoined);
+  std::set<std::string>::iterator aGIter = aJoined->myGroups.begin();
+  for(; aGIter != aJoined->myGroups.end(); aGIter++) {
+    myGroups.insert(*aGIter);
+  }
+}
index 68b277b94c03f9084f0dc79d3add800be884319c..a4912648dd62a99db9876a444920b6653362aacf 100644 (file)
 #define Model_Events_HeaderFile
 
 #include <Model.h>
-#include <Events_MessageGroup.h>
-#include <Events_Loop.h>
-#include <boost/shared_ptr.hpp>
-#include <string>
-#include <set>
+#include <ModelAPI_Events.h>
 
-#include "ModelAPI_Feature.h"
-
-class ModelAPI_Document;
-
-/// Event ID that feature is created (comes with Model_FeatureUpdatedMessage)
-static const char * EVENT_FEATURE_CREATED = "FeatureCreated";
-/// Event ID that data of feature is updated (comes with Model_FeatureUpdatedMessage)
-static const char * EVENT_FEATURE_UPDATED = "FeatureUpdated";
-/// Event ID that data of feature is deleted (comes with Model_FeatureDeletedMessage)
-static const char * EVENT_FEATURE_DELETED = "FeatureDeleted";
-/// Event ID that data of feature is updated (comes with Model_FeaturesMovedMessage)
-static const char * EVENT_FEATURE_MOVED = "FeaturesMoved";
+/// Allovs to create ModelAPI messages
+class Model_EventCreator : public ModelAPI_EventCreator {
+public:
+  /// creates created, updated or moved messages and sends to the loop
+  virtual void sendUpdated(
+    const FeaturePtr& theFeature, const Events_ID& theEvent, const bool isGroupped = true) const;
+  /// creates deleted message and sends to the loop
+  virtual void sendDeleted(
+    const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup) const;
+
+  /// must be one per application, the constructor for internal usage only
+  Model_EventCreator();
+};
 
 /// Message that feature was changed (used for Object Browser update): moved, updated and deleted
-class Model_FeatureUpdatedMessage : public Events_MessageGroup {
-  std::set<FeaturePtr > myFeatures; ///< which feature is changed
-public:
-  /// sender is not important, all information is located in the feature
+class Model_FeatureUpdatedMessage : public ModelAPI_FeatureUpdatedMessage {
+  std::set<FeaturePtr> myFeatures; ///< which feature is changed
+
+  /// Sender is not important, all information is located in the feature.
+  /// Use ModelAPI for creation of this event. Used for creation, movement and edition events.
   Model_FeatureUpdatedMessage(
     const FeaturePtr& theFeature,
-    const Events_ID& theEvent) : Events_MessageGroup(theEvent, 0)
-  {if (theFeature) myFeatures.insert(theFeature);}
+    const Events_ID& theEvent);
+
+  friend class Model_EventCreator;
+public:
 
   /// Returns the feature that has been updated
-  std::set<FeaturePtr> features() const {return myFeatures;}
+  virtual std::set<FeaturePtr> features() const;
 
   //! Creates a new empty group (to store it in the loop before flush)
-  virtual Events_MessageGroup* newEmpty() {
-    FeaturePtr anEmptyFeature;
-    return new Model_FeatureUpdatedMessage(anEmptyFeature, eventID());
-  }
+  virtual Events_MessageGroup* newEmpty();
 
   //! Allows to join the given message with the current one
-  virtual void Join(Events_MessageGroup& theJoined) {
-    Model_FeatureUpdatedMessage* aJoined = dynamic_cast<Model_FeatureUpdatedMessage*>(&theJoined);
-    std::set<FeaturePtr >::iterator aFIter = aJoined->myFeatures.begin();
-    for(; aFIter != aJoined->myFeatures.end(); aFIter++) {
-      myFeatures.insert(*aFIter);
-    }
-  }
+  virtual void Join(Events_MessageGroup& theJoined);
 };
 
 /// Message that feature was deleted (used for Object Browser update)
-class Model_FeatureDeletedMessage : public Events_MessageGroup {
+class Model_FeatureDeletedMessage : public ModelAPI_FeatureDeletedMessage {
   boost::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
   std::set<std::string> myGroups; ///< group identifiers that contained the deleted feature
-public:
-  /// creates a message by initialization of fields
-//  Model_FeatureDeletedMessage(const boost::shared_ptr<ModelAPI_Document>& theDoc,
-//    const std::string& theGroup);
 
-  /// Returns the ID of this message (EVENT_FEATURE_DELETED)
-//  static const Events_ID messageId();
+  /// Use ModelAPI for creation of this event.
+  Model_FeatureDeletedMessage(
+    const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup);
 
+  friend class Model_EventCreator;
+public:
   /// Returns the feature that has been updated
-  boost::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
+  virtual boost::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
 
   /// Returns the group where the feature was deleted
-  const std::set<std::string >& groups() const {return myGroups;}
+  virtual const std::set<std::string >& groups() const {return myGroups;}
 
-  //! Creates a new empty group (to store it in the loop before flush)
-//  virtual Events_MessageGroup* newEmpty();
+  virtual Events_MessageGroup* newEmpty();
 
-  //! Allows to join the given message with the current one
-//  virtual void Join(Events_MessageGroup& theJoined);
 
-  Events_MessageGroup* newEmpty() {
-    return new Model_FeatureDeletedMessage(myDoc, "");
-  }
+  virtual const Events_ID messageId();
 
-  Model_FeatureDeletedMessage(
-    const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
-    : Events_MessageGroup(messageId(), 0), myDoc(theDoc)
-
-  {
-    if (!theGroup.empty())
-      myGroups.insert(theGroup);
-  }
-
-  const Events_ID messageId()
-  {
-    static Events_ID MY_ID = Events_Loop::eventByName(EVENT_FEATURE_DELETED);
-    return MY_ID;
-  }
-
-  void Join(Events_MessageGroup& theJoined)
-  {
-    Model_FeatureDeletedMessage* aJoined = dynamic_cast<Model_FeatureDeletedMessage*>(&theJoined);
-    std::set<std::string>::iterator aGIter = aJoined->myGroups.begin();
-    for(; aGIter != aJoined->myGroups.end(); aGIter++) {
-      myGroups.insert(*aGIter);
-    }
-  }
+  virtual void Join(Events_MessageGroup& theJoined);
 };
 
 #endif
index 595579b085d483da386afcb6b60240f614657119..e1f52a9bbe4b8ecf8fff44cb7da299abc4a68653 100644 (file)
@@ -6,9 +6,10 @@
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_AttributeRefList.h>
+#include <Events_Loop.h>
 
 using namespace std;
 
@@ -21,8 +22,8 @@ Model_Update::Model_Update()
 
 void Model_Update::processEvent(const Events_Message* theMessage)
 {
-  const Model_FeatureUpdatedMessage* aMsg = 
-    dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
+  const ModelAPI_FeatureUpdatedMessage* aMsg = 
+    dynamic_cast<const ModelAPI_FeatureUpdatedMessage*>(theMessage);
   myInitial = aMsg->features();
   // collect all documents involved into the update
   set<boost::shared_ptr<ModelAPI_Document> > aDocs;
index 981d5567d82e4bda6a5dd79f327fd2762fa21217..3fd7da3a04a52cefe747998c39d369d932fc37f7 100644 (file)
@@ -17,6 +17,7 @@ SET(PROJECT_HEADERS
     ModelAPI_AttributeRefAttr.h
     ModelAPI_AttributeRefList.h
     ModelAPI_AttributeBoolean.h
+    ModelAPI_Events.h
 )
 
 SET(PROJECT_SOURCES
@@ -33,7 +34,7 @@ SET_TARGET_PROPERTIES(ModelAPI PROPERTIES LINKER_LANGUAGE CXX)
 TARGET_LINK_LIBRARIES(ModelAPI ${PROJECT_LIBRARIES})
 
 INCLUDE_DIRECTORIES(
-  ../Config
+  ../Config ../Events
 )
 
 SET(CMAKE_SWIG_FLAGS "")
diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h
new file mode 100644 (file)
index 0000000..5ab3df1
--- /dev/null
@@ -0,0 +1,81 @@
+// File:        ModelAPI_Events.h
+// Created:     10 Apr 2014
+// Author:      Mikhail PONIKAROV
+
+#ifndef ModelAPI_Events_HeaderFile
+#define ModelAPI_Events_HeaderFile
+
+#include <ModelAPI.h>
+#include <Events_MessageGroup.h>
+#include <boost/shared_ptr.hpp>
+#include <string>
+#include <set>
+
+#include "ModelAPI_Feature.h"
+
+class ModelAPI_Document;
+
+/// Event ID that feature is created (comes with Model_FeatureUpdatedMessage)
+static const char * EVENT_FEATURE_CREATED = "FeatureCreated";
+/// Event ID that data of feature is updated (comes with Model_FeatureUpdatedMessage)
+static const char * EVENT_FEATURE_UPDATED = "FeatureUpdated";
+/// Event ID that data of feature is deleted (comes with Model_FeatureDeletedMessage)
+static const char * EVENT_FEATURE_DELETED = "FeatureDeleted";
+/// Event ID that data of feature is updated (comes with Model_FeaturesMovedMessage)
+static const char * EVENT_FEATURE_MOVED = "FeaturesMoved";
+
+/// Message that feature was changed (used for Object Browser update): moved, updated and deleted
+class ModelAPI_FeatureUpdatedMessage : public Events_MessageGroup {
+protected:
+  ModelAPI_FeatureUpdatedMessage(const Events_ID theID, const void* theSender = 0)
+    : Events_MessageGroup(theID, theSender) {}
+
+public:
+  /// Returns the feature that has been updated
+  virtual std::set<FeaturePtr> features() const = 0;
+
+  //! Creates a new empty group (to store it in the loop before flush)
+  virtual Events_MessageGroup* newEmpty() = 0;
+
+  //! Allows to join the given message with the current one
+  virtual void Join(Events_MessageGroup& theJoined) = 0;
+};
+
+/// Message that feature was deleted (used for Object Browser update)
+class ModelAPI_FeatureDeletedMessage : public Events_MessageGroup {
+protected:
+  ModelAPI_FeatureDeletedMessage(const Events_ID theID, const void* theSender = 0)
+    : Events_MessageGroup(theID, theSender) {}
+
+public:
+  /// Returns the feature that has been updated
+  virtual boost::shared_ptr<ModelAPI_Document> document() const = 0;
+
+  /// Returns the group where the feature was deleted
+  virtual const std::set<std::string >& groups() const = 0;
+
+  virtual Events_MessageGroup* newEmpty() = 0;
+
+  virtual const Events_ID messageId() = 0;
+
+  virtual void Join(Events_MessageGroup& theJoined) = 0;
+};
+
+/// Allows to create ModelAPI messages
+class MODELAPI_EXPORT ModelAPI_EventCreator {
+public:
+  /// creates created, updated or moved messages and sends to the loop
+  virtual void sendUpdated(const FeaturePtr& theFeature, const Events_ID& theEvent,
+                           const bool isGroupped = true) const = 0;
+  /// creates deleted message and sends to the loop
+  virtual void sendDeleted(
+    const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup) const = 0;
+
+  /// returns the creator instance
+  static const ModelAPI_EventCreator* get();
+  
+  /// sets the creator instance
+  static void set(const ModelAPI_EventCreator* theCreator);
+};
+
+#endif
index 4cf100d5c12719b0fd6f02d6267e08065190f2b8..766590a2eea048ab2136313ef981444c26277a86 100644 (file)
@@ -19,6 +19,7 @@
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_Events.h>
 
 #include <Config_ModuleReader.h>
 
@@ -54,3 +55,18 @@ boost::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
   }
   return MY_MANAGER;
 }
+
+const ModelAPI_EventCreator* MY_CREATOR = 0; ///< instance of the events creator, one pre application
+
+const ModelAPI_EventCreator* ModelAPI_EventCreator::get()
+{
+  if (!MY_CREATOR) { // import Model library that implements this interface of ModelAPI
+    Config_ModuleReader::loadLibrary("Model");
+  }
+  return MY_CREATOR;
+}
+  
+void ModelAPI_EventCreator::set(const ModelAPI_EventCreator* theCreator)
+{
+  MY_CREATOR = theCreator;
+}
index a111f81615c78088ba59030839c09e24d9462ae7..9a90b72f761bd7930f650a46349fd34121c871dc 100644 (file)
@@ -66,7 +66,6 @@ SOURCE_GROUP ("Resource Files" FILES ${PROJECT_RESOURCES})
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/XGUI 
                     ${CMAKE_SOURCE_DIR}/src/Config
                     ${CMAKE_SOURCE_DIR}/src/Events
-                    ${CMAKE_SOURCE_DIR}/src/Model
                     ${CMAKE_SOURCE_DIR}/src/ModuleBase
                     ${CMAKE_SOURCE_DIR}/src/ModelAPI
                     ${CMAKE_SOURCE_DIR}/src/GeomDataAPI
@@ -86,7 +85,7 @@ ADD_LIBRARY(PartSet SHARED
 )
 
 # The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
-TARGET_LINK_LIBRARIES(PartSet ${PROJECT_LIBRARIES} XGUI ModelAPI Model GeomAlgoAPI)
+TARGET_LINK_LIBRARIES(PartSet ${PROJECT_LIBRARIES} XGUI ModelAPI GeomAlgoAPI)
 
 ADD_DEPENDENCIES(PartSet ModuleBase)
 
index 1f3505ee771821645ce24f312f47364718f4e481..0a8a6e9d40e6d0ebcae08a8f8d29e460c758da4e 100644 (file)
@@ -9,7 +9,7 @@
 #include <XGUI_Displayer.h>
 
 #include <Events_Loop.h>
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
 
 #include <SketchPlugin_Sketch.h>
 
@@ -39,8 +39,8 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
   if (aType == EVENT_FEATURE_UPDATED ||
       aType == EVENT_FEATURE_CREATED)
   {
-    const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>
-                                                                                    (theMessage);
+    const ModelAPI_FeatureUpdatedMessage* aUpdMsg = 
+      dynamic_cast<const ModelAPI_FeatureUpdatedMessage*>(theMessage);
     std::set<FeaturePtr > aFeatures = aUpdMsg->features();
     std::set<FeaturePtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
     for (; anIt != aLast; anIt++) {
@@ -56,7 +56,8 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
   }
   if (aType == EVENT_FEATURE_DELETED)
   {
-    const Model_FeatureDeletedMessage* aDelMsg = dynamic_cast<const Model_FeatureDeletedMessage*>(theMessage);
+    const ModelAPI_FeatureDeletedMessage* aDelMsg = 
+      dynamic_cast<const ModelAPI_FeatureDeletedMessage*>(theMessage);
     boost::shared_ptr<ModelAPI_Document> aDoc = aDelMsg->document();
 
     std::set<std::string> aGroups = aDelMsg->groups();
index 6ab6edf9544939745ec5ad11589c1ab09f90e7e2..07f077d2bf04e76cf9a7a33b8ab8ce9319c4a5a4 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <ModuleBase_OperationDescription.h>
 #include <ModuleBase_WidgetEditor.h>
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
 
 #include <XGUI_ViewerPrs.h>
 
@@ -19,7 +19,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
 
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
 
 #include <Events_Loop.h>
 
@@ -198,9 +198,7 @@ void PartSet_OperationFeatureEdit::sendFeatures()
   static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_MOVED);
 
   FeaturePtr aFeature = feature();
-
-  Model_FeatureUpdatedMessage aMessage(aFeature, anEvent);
-  Events_Loop::loop()->send(aMessage);
+  ModelAPI_EventCreator::get()->sendUpdated(aFeature, anEvent);
 
   Events_Loop::loop()->flush(anEvent);
   flushUpdated();
index 89928ccded1b616101be1a0add75ccd01a8a95c2..e5feef62d5a40f3a02fa2435625a4311793d7078 100644 (file)
@@ -7,7 +7,7 @@
 #include <PartSet_OperationSketch.h>
 
 #include <ModuleBase_OperationDescription.h>
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
 
 #include <XGUI_ViewerPrs.h>
 
@@ -16,7 +16,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
 
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
 
 #include <Events_Loop.h>
 
@@ -190,8 +190,7 @@ void PartSet_OperationFeatureEditMulti::sendFeatures()
     if (!aFeature)
       continue;
 
-    Model_FeatureUpdatedMessage aMessage(aFeature, anEvent);
-    Events_Loop::loop()->send(aMessage);
+    ModelAPI_EventCreator::get()->sendUpdated(aFeature, anEvent);
   }
   Events_Loop::loop()->flush(anEvent);
   flushUpdated();
index 1e09050316c49d8b00c35e4617ebdae59fd7fcd4..2f7931f9b59c87b53491a52b3ad251fab1737ffb 100644 (file)
@@ -13,7 +13,7 @@
 #include <GeomDataAPI_Point2D.h>
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefList.h>
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
 
 #include <SketchPlugin_Constraint.h>
 #include <SketchPlugin_ConstraintLength.h>
@@ -1148,8 +1148,7 @@ void SketchSolver_ConstraintGroup::updateRelatedConstraints(
       if (isUpd)
       {
         static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_UPDATED);
-        Model_FeatureUpdatedMessage aMsg(aConstrIter->first, anEvent);
-        Events_Loop::loop()->send(aMsg, true);
+        ModelAPI_EventCreator::get()->sendUpdated(aConstrIter->first, anEvent);
         break;
       }
     }
@@ -1175,8 +1174,7 @@ void SketchSolver_ConstraintGroup::updateRelatedConstraints(
       if (aRefAttr && aRefAttr->isFeature() && aRefAttr->feature() == theFeature)
       {
         static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_UPDATED);
-        Model_FeatureUpdatedMessage aMsg(aConstrIter->first, anEvent);
-        Events_Loop::loop()->send(aMsg, true);
+        ModelAPI_EventCreator::get()->sendUpdated(aConstrIter->first, anEvent);
         break;
       }
     }
index 0e39b5a42331166176c3a2184c9c99c2b9d4068e..ff571878b964b567331ea2949d5efdb6fe9c38fd 100644 (file)
@@ -8,7 +8,7 @@
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_Data.h>
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
 
 #include <SketchPlugin_Constraint.h>
 
@@ -63,10 +63,12 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa
       theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_UPDATED) || 
       theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_MOVED))
   {
-    const Model_FeatureUpdatedMessage* anUpdateMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
+    const ModelAPI_FeatureUpdatedMessage* anUpdateMsg = 
+      dynamic_cast<const ModelAPI_FeatureUpdatedMessage*>(theMessage);
     std::set< FeaturePtr > aFeatures = anUpdateMsg->features();
 
-    bool isModifiedEvt = theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_MOVED);
+    bool isModifiedEvt = 
+      theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_MOVED);
     if (!isModifiedEvt)
     {
       std::set< FeaturePtr >::iterator aFeatIter;
@@ -102,7 +104,8 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa
   }
   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_DELETED))
   {
-    const Model_FeatureDeletedMessage* aDeleteMsg = dynamic_cast<const Model_FeatureDeletedMessage*>(theMessage);
+    const ModelAPI_FeatureDeletedMessage* aDeleteMsg = 
+      dynamic_cast<const ModelAPI_FeatureDeletedMessage*>(theMessage);
     const std::set<std::string>& aFeatureGroups = aDeleteMsg->groups();
 
     // Find SKETCH_KIND in groups. The constraint groups should be updated when an object removed from Sketch