]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom
authormpv <mikhail.ponikarov@opencascade.com>
Tue, 1 Apr 2014 10:19:31 +0000 (14:19 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Tue, 1 Apr 2014 10:19:31 +0000 (14:19 +0400)
18 files changed:
src/Model/CMakeLists.txt
src/Model/Model_Application.cxx
src/Model/Model_Application.h
src/Model/Model_Document.cxx
src/Model/Model_Document.h
src/Model/Model_Feature.cxx
src/Model/Model_Feature.h
src/Model/Model_PluginManager.cxx
src/Model/Model_PluginManager.h
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI.i
src/ModelAPI/ModelAPI_Document.h
src/ModelAPI/ModelAPI_Plugin.h
src/ModelAPI/ModelAPI_PluginManager.cxx
src/ModelAPI/ModelAPI_PluginManager.h
src/PartSetPlugin/CMakeLists.txt
src/PartSetPlugin/PartSetPlugin_Plugin.cxx
src/PartSetPlugin/PartSetPlugin_Plugin.h

index 42ee4f4c64d9fc1f2895cb1c2b53d3b8cd86917a..c7b23b3a090d7a16121acf70c3bf6e489f797fe4 100644 (file)
@@ -2,22 +2,23 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
 
 INCLUDE(Common)
 INCLUDE(FindCAS)
-INCLUDE(FindBoost)
 
 SET(PROJECT_HEADERS
     Model.h
+    Model_Application.h
     Model_Document.h
     Model_PluginManager.h
     Model_Feature.h
 )
 
 SET(PROJECT_SOURCES
+    Model_Application.cxx
     Model_Document.cxx
     Model_PluginManager.cxx
     Model_Feature.cxx
 )
 
-ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS})
+ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS})
 ADD_LIBRARY(Model SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
 TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES} ${CAS_OCAF} ModelAPI Event Config)
 
index dab193d13b3cf3a2734c3e8dafea19a93b5f3640..ac1eeb896c8cb9ce1eb51564de0902ad3cc987a2 100644 (file)
@@ -2,8 +2,8 @@
 // Created:    Fri Sep 2 2011
 // Author:     Mikhail PONIKAROV
 
-#include <Model_Application.hxx>
-#include <Model_Document.hxx>
+#include <Model_Application.h>
+#include <Model_Document.h>
 
 IMPLEMENT_STANDARD_HANDLE(Model_Application, TDocStd_Application)
 IMPLEMENT_STANDARD_RTTIEXT(Model_Application, TDocStd_Application)
@@ -14,7 +14,7 @@ static Handle_Model_Application TheApplication = new Model_Application;
 //function : getApplication
 //purpose  : 
 //=======================================================================
-Handle_Model_Application Model_Application::GetApplication()
+Handle(Model_Application) Model_Application::getApplication()
 {
   return TheApplication;
 }
@@ -23,13 +23,14 @@ Handle_Model_Application Model_Application::GetApplication()
 //function : getDocument
 //purpose  : 
 //=======================================================================
-ModelAPI_Document* Model_Application::GetMainDocument()
+std::shared_ptr<Model_Document> Model_Application::getDocument(std::string theDocID)
 {
+  if (myDocs.find(theDocID) != myDocs.end())
+    return myDocs[theDocID];
 
-  if (myMainDoc.IsNull()) {
-    myMainDoc = new Model_Document("BinOcaf");
-  }
-  return *myMainDoc;
+  std::shared_ptr<Model_Document> aNew(new Model_Document);
+  myDocs[theDocID] = aNew;
+  return aNew;
 }
 
 //=======================================================================
index 77d669257079fc13b303f0bd4203334cf570a16b..75aa172afbaae4798eac9f331427a73551aa4362 100644 (file)
@@ -6,9 +6,9 @@
 #ifndef Model_Application_HeaderFile
 #define Model_Application_HeaderFile
 
-#include <Model_Document.hxx> 
-#include <ModelAPI_Application.hxx> 
+#include <Model_Document.h> 
 #include <TDocStd_Application.hxx>
+#include <map>
 
 // Define handle class 
 DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application)
@@ -19,19 +19,18 @@ DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application)
  * Application supports the formats and document management. It is uses OCAF-lke
  * architecture and just implements specific features of the module.
  */
-class Model_Application: public TDocStd_Application, public ModelAPI_Application
+class Model_Application: public TDocStd_Application
 {
 public:
   // useful methods inside of the module
 
   // CASCADE RTTI
-  DEFINE_STANDARD_RTTI(Model_Application)
-  ;
+  DEFINE_STANDARD_RTTI(Model_Application);
 
   //! Retuns the application: one per process    
-  MODEL_EXPORT static Handle_Model_Application GetApplication();
-  //! Returns the main document (on first call creates it)
-  MODEL_EXPORT ModelAPI_Document* GetMainDocument();
+  MODEL_EXPORT static Handle_Model_Application getApplication();
+  //! Returns the main document (on first call creates it) by the string identifier
+  MODEL_EXPORT std::shared_ptr<Model_Document> getDocument(std::string theDocID);
 
 public:
   // Redefined OCAF methods
@@ -46,8 +45,8 @@ public:
   Model_Application();
 
 private:
-
-  Handle_Model_Document myMainDoc; ///< main document of an application
+  /// Map from string identifiers to created documents of an application
+  std::map<std::string, std::shared_ptr<Model_Document> > myDocs;
 };
 
 #endif
index dd34e598b24aeb0e165af8b104c162084fa69c21..ffce8a4520513b5346e0aece5540b12973d40947 100644 (file)
@@ -1,21 +1,17 @@
 // File:        Model_Document.cxx
-// Created:     28 Dec 2011
+// Created:     28 Feb 2014
 // Author:      Mikhail PONIKAROV
-// Copyright:   CEA 2011
 
 #include <Model_Document.h>
+#include <Model_Feature.h>
 
 #include <TDataStd_Integer.hxx>
 
-IMPLEMENT_STANDARD_HANDLE(Model_Document, MMgt_TShared)
-IMPLEMENT_STANDARD_RTTIEXT(Model_Document, MMgt_TShared)
-
-static const int UNDO_LIMIT = 10; // number of possible undo operations in the module
+static const int UNDO_LIMIT = 10; // number of possible undo operations
 
 static const int TAG_GENERAL = 1; // general properties tag
 static const int TAG_OBJECTS = 2; // tag of the objects sub-tree (Root for Model_ObjectsMgr)
 static const int TAG_HISTORY = 3; // tag of the history sub-tree (Root for Model_History)
-static const int TAG_ISOTOPES = 4; // tag of the isotopes sub-tree (Root for MaterialMC_Isotope)
 
 using namespace std;
 
@@ -100,28 +96,28 @@ bool Model_Document::Save(const char* theFileName)
 
 void Model_Document::Close()
 {
-  TDocStd_Document::Close();
+  myDoc->Close();
 }
 
 void Model_Document::StartOperation()
 {
-  TDocStd_Document::NewCommand();
+  myDoc->NewCommand();
 }
 
 void Model_Document::FinishOperation()
 {
-  TDocStd_Document::CommitCommand();
+  myDoc->CommitCommand();
   myTransactionsAfterSave++;
 }
 
 void Model_Document::AbortOperation()
 {
-  TDocStd_Document::AbortCommand();
+  myDoc->AbortCommand();
 }
 
 bool Model_Document::IsOperation()
 {
-  return TDocStd_Document::HasOpenCommand() == Standard_True ;
+  return myDoc->HasOpenCommand() == Standard_True ;
 }
 
 bool Model_Document::IsModified()
@@ -131,30 +127,42 @@ bool Model_Document::IsModified()
 
 bool Model_Document::CanUndo()
 {
-  return TDocStd_Document::GetAvailableUndos() > 0;
+  return myDoc->GetAvailableUndos() > 0;
 }
 
 void Model_Document::Undo()
 {
-  TDocStd_Document::Undo();
+  myDoc->Undo();
   myTransactionsAfterSave--;
 }
 
 bool Model_Document::CanRedo()
 {
-  return TDocStd_Document::GetAvailableRedos() > 0;
+  return myDoc->GetAvailableRedos() > 0;
 }
 
 void Model_Document::Redo()
 {
-  TDocStd_Document::Redo();
+  myDoc->Redo();
   myTransactionsAfterSave++;
 }
 
-Model_Document::Model_Document(const TCollection_ExtendedString& theStorageFormat)
-    : TDocStd_Document(theStorageFormat)
+void Model_Document::AddObject(
+  std::shared_ptr<ModelAPI_Feature> theFeature, const int theGroupID)
+{
+  std::shared_ptr<Model_Feature> aModelFeature = 
+    std::dynamic_pointer_cast<Model_Feature>(theFeature);
+  if (aModelFeature) {
+    TDF_Label aGroupLab = myDoc->Main().FindChild(TAG_OBJECTS).FindChild(theGroupID + 1);
+    TDF_Label anObjLab = aGroupLab.NewChild();
+    aModelFeature->setLabel(anObjLab);
+  }
+}
+
+Model_Document::Model_Document()
+    : myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format
 {
-  SetUndoLimit(UNDO_LIMIT);
+  myDoc->SetUndoLimit(UNDO_LIMIT);
   myTransactionsAfterSave = 0;
 }
 
index bdd5d8e0c510d8d04b28d42b4860da287dfb3180..22ad95fa0cb72e7ddb8f19a32b23c2c43cb9837b 100644 (file)
@@ -1,7 +1,6 @@
-// File:        Model_Document.hxx
-// Created:     28 Dec 2011
+// File:        Model_Document.cxx
+// Created:     28 Feb 2014
 // Author:      Mikhail PONIKAROV
-// Copyright:   CEA 2011
 
 #ifndef Model_Document_HeaderFile
 #define Model_Document_HeaderFile
@@ -21,15 +20,12 @@ class Handle_Model_Document;
  * to provide access to all stored data.
  */
 
-class Model_Document: public TDocStd_Document, public ModelAPI_Document
+class Model_Document: public ModelAPI_Document
 {
 public:
 
-  DEFINE_STANDARD_RTTI(Model_Document)
-  ;
-
-  //! Creates new document by the format string of a storage
-  Model_Document(const TCollection_ExtendedString& theStorageFormat);
+  //! Creates new document with binary file format
+  Model_Document();
   //! Deletes all high-level data, managed this document
   ~Model_Document();
 
@@ -67,13 +63,17 @@ public:
   //! Redoes last operation
   MODEL_EXPORT void Redo();
 
+  //! Adds to the document the new object of the given group id
+  //! \param theFeature a feature object that will be connected to the document in this method
+  //! \param theGroupID identifier of the groups of objects (must be greater than zero)
+  MODEL_EXPORT virtual void AddObject(std::shared_ptr<ModelAPI_Feature> theFeature,
+    const int theGroupID);
+
 protected:
 
 private:
+  Handle_TDocStd_Document myDoc; ///< OCAF document
   int myTransactionsAfterSave; ///< number of transactions after the last "save" call, used for "IsModified" method
 };
 
-// Define handle class 
-DEFINE_STANDARD_HANDLE(Model_Document, TDocStd_Document)
-
 #endif
index 0ff28389207f8e70c5a7c8cf5922f0625c5247c9..10455a7fc6ac9bb9ec1fdb35d907aa9109aa28fd 100644 (file)
@@ -10,7 +10,7 @@ Model_Feature::Model_Feature()
 {
 }
 
-string Model_Feature::GetKind()
+void Model_Feature::setLabel(TDF_Label& theLab)
 {
-  return "Point";
+  myLab = theLab;
 }
index 0b51f725f54d6904898359bd599ceb7a87af93b5..ac930c0784e807ede7d7a814272bd0759e23a9af 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "Model.h"
 #include <ModelAPI_Feature.h>
+#include <TDF_Label.hxx>
 
 /**\class Model_Feature
  * \ingroup DataModel
 
 class Model_Feature: public ModelAPI_Feature
 {
-  Model_Feature();
+  TDF_Label myLab; ///< label of the feature in the document
 
+  Model_Feature();
   friend class Model_PluginManager;
 public:
   /// Returns the kind of a feature (like "Point")
-  virtual std::string GetKind();
+  virtual std::string GetKind() = 0;
+
+  void setLabel(TDF_Label& theLab);
 };
 
 #endif
index c4e28665dcd82d3e7d086d489d0ca02ac801caeb..2ef8883f44202d166c16838bc0a210380cafaf58 100644 (file)
@@ -6,6 +6,8 @@
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Plugin.h>
 #include <Model_Feature.h>
+#include <Model_Document.h>
+#include <Model_Application.h>
 #include <Event_Loop.h>
 #include <Config_FeatureMessage.h>
 #include <Config_ModuleReader.h>
@@ -14,7 +16,7 @@ using namespace std;
 
 static Model_PluginManager* myImpl = new Model_PluginManager();
 
-boost::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
+std::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
 {
   if (this != myImpl) return myImpl->createFeature(theFeatureID);
 
@@ -26,19 +28,27 @@ boost::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string th
       loadLibrary(myCurrentPluginName);
     }
     if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) {
-      return myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
+      std::shared_ptr<ModelAPI_Feature> aCreated = 
+        myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
     }
   }
 
-  return boost::shared_ptr<ModelAPI_Feature>(); // return nothing
+  return std::shared_ptr<ModelAPI_Feature>(); // return nothing
 }
 
+std::shared_ptr<ModelAPI_Document> Model_PluginManager::rootDocument()
+{
+  return std::shared_ptr<ModelAPI_Document>(
+    Model_Application::getApplication()->getDocument("root"));
+}
+
+
 Model_PluginManager::Model_PluginManager()
 {
   myPluginsInfoLoaded = false;
   static Event_ID aFeatureEvent = Event_Loop::eventByName("RegisterFeature");
 
-  ModelAPI_PluginManager::SetPluginManager(boost::shared_ptr<ModelAPI_PluginManager>(this));
+  ModelAPI_PluginManager::SetPluginManager(std::shared_ptr<ModelAPI_PluginManager>(this));
   // register the configuration reading listener
   Event_Loop* aLoop = Event_Loop::loop();
   aLoop->registerListener(this, aFeatureEvent);
@@ -51,7 +61,7 @@ void Model_PluginManager::processEvent(const Event_Message* theMessage)
   if (aMsg) {
     // proccess the plugin info, load plugin
     if (myPlugins.find(aMsg->id()) == myPlugins.end()) {
-      myPlugins[aMsg->id()] = aMsg->pluginLibrary(); // TO DO: plugin name must be also imported from XMLs
+      myPlugins[aMsg->id()] = aMsg->pluginLibrary();
     }
   }
   // plugins information was started to load, so, it will be loaded
index 5a847abce16589cfe4f65c7c2b274afcbfe8586d..47b326ac2d3121a15d2578b3df1a3cb1bd07f2ff 100644 (file)
@@ -10,6 +10,8 @@
 #include <Event_Listener.h>
 #include <map>
 
+class Model_Document;
+
 /**\class Model_PluginManager
  * \ingroup DataModel
  * \brief Object that knows (from the initial XML file) which
@@ -26,7 +28,10 @@ class Model_PluginManager : public ModelAPI_PluginManager, public Event_Listener
   std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently
 public:
   /// Creates the feature object using plugins functionality
-  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+
+  /// Returns the root document of the application (that may contains sub-documents)
+  virtual std::shared_ptr<ModelAPI_Document> rootDocument();
 
   /// Registers the plugin that creates features.
   /// It is obligatory for each plugin to call this function on loading to be found by 
index 33fe1bcf872463b28e92cc516c38076fd8bf63ae..0a4868ddc9fb8b84e49900458456a64e565f1504 100644 (file)
@@ -4,7 +4,6 @@ INCLUDE(Common)
 FIND_PACKAGE(SWIG REQUIRED)
 INCLUDE(${SWIG_USE_FILE})
 INCLUDE(FindPython)
-INCLUDE(FindBoost)
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
 
 SET(PROJECT_HEADERS
index 6deac8560d12022d94d480dbdb03a81772a588b1..bbb3d7a412dbb25d7dd6ac3335829ea0028d2677 100644 (file)
@@ -15,9 +15,9 @@
 %include "std_string.i"
 
 // boost pointers
-%include <boost_shared_ptr.i>
-%shared_ptr(ModelAPI_PluginManager)
-%shared_ptr(ModelAPI_Feature)
+// %include <boost_shared_ptr.i>
+// %shared_ptr(ModelAPI_PluginManager)
+// %shared_ptr(ModelAPI_Feature)
 
 // all supported interfaces
 %include "ModelAPI_Document.h"
index 911aca0680be06183f0093859ee21bebed285c9a..6f720526442bebb8f237a40ebd298136242663c7 100644 (file)
@@ -1,12 +1,14 @@
-// File:        Model_Document.hxx
-// Created:     28 Dec 2011
+// File:        ModelAPI_Document.cxx
+// Created:     28 Feb 2014
 // Author:      Mikhail PONIKAROV
-// Copyright:   CEA 2011
 
 #ifndef ModelAPI_Document_HeaderFile
 #define ModelAPI_Document_HeaderFile
 
 #include <ModelAPI.h>
+#include <memory>
+
+class ModelAPI_Feature;
 
 /**\class Model_Document
  * \ingroup DataModel
@@ -55,6 +57,12 @@ public:
   //! Redoes last operation
   MODELAPI_EXPORT virtual void Redo() = 0;
 
+  //! Adds to the document the new object of the given group id
+  //! \param theFeature a feature object that will be connected to the document in this method
+  //! \param theGroupID identifier of the groups of objects (must be greater than zero)
+  MODELAPI_EXPORT virtual void AddObject(std::shared_ptr<ModelAPI_Feature> theFeature,
+    const int theGroupID) = 0;
+
 protected:
   /// Only for SWIG wrapping it is here
   MODELAPI_EXPORT ModelAPI_Document()
index 5d2d0430ceec5c39db9222803d1f184a9869b76c..0605d8b6f1997c5bedc6f5a18b965ec709dc5e71 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "ModelAPI.h"
 #include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
 
 class ModelAPI_Feature;
 
@@ -20,7 +20,7 @@ class MODELAPI_EXPORT ModelAPI_Plugin
 {
 public:
   /// Creates the feature object of this plugin by the feature string ID
-  virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
 
 protected:
   /// Is needed for python wrapping by swig
index d4a20feaeeed02c0db864f2e2f50e7dc7524ab63..6ec5a9d7ab1c39025fe92e18c4a3556166460098 100644 (file)
@@ -22,19 +22,19 @@ using namespace std;
 string library(const string& theLibName);
 
 /// Manager that will be initialized from Model package, one per application
-boost::shared_ptr<ModelAPI_PluginManager> MY_MANAGER;
+std::shared_ptr<ModelAPI_PluginManager> MY_MANAGER;
 
 ModelAPI_PluginManager::ModelAPI_PluginManager()
 {
 }
 
 void ModelAPI_PluginManager::SetPluginManager(
-  boost::shared_ptr<ModelAPI_PluginManager> theManager)
+  std::shared_ptr<ModelAPI_PluginManager> theManager)
 {
   MY_MANAGER = theManager;
 }
 
-boost::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
+std::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
 {
   if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI
     loadLibrary("Model");
@@ -62,6 +62,7 @@ string library(const string& theLibName)
   return aLibName;
 }
 
+#include <iostream>
 void ModelAPI_PluginManager::loadLibrary(const string theLibName)
 {
   string aFileName = library(theLibName);
index 620501bfd07e97d18d1cbf8dc82236ba6a5fafce..b53a66336d512b13dd815dcdb6bbd3318f6c8190 100644 (file)
@@ -7,10 +7,11 @@
 
 #include "ModelAPI.h"
 #include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
 
 class ModelAPI_Feature;
 class ModelAPI_Plugin;
+class ModelAPI_Document;
 
 /**\class ModelAPI_PluginManager
  * \ingroup DataModel
@@ -23,16 +24,19 @@ class MODELAPI_EXPORT ModelAPI_PluginManager
 {
 public:
   /// Creates the feature object using plugins functionality
-  virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
 
   /// Returns the real implementation (the alone instance per application) of the plugin manager
-  static boost::shared_ptr<ModelAPI_PluginManager> get();
+  static std::shared_ptr<ModelAPI_PluginManager> get();
 
   /// Registers the plugin that creates features.
   /// It is obligatory for each plugin to call this function on loading to be found by 
   /// the plugin manager on call of the feature)
   virtual void registerPlugin(ModelAPI_Plugin* thePlugin) = 0;
 
+  /// Returns the root document of the application (that may contains sub-documents)
+  virtual std::shared_ptr<ModelAPI_Document> rootDocument() = 0;
+
   /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
   static void ModelAPI_PluginManager::loadLibrary(const std::string theLibName);
 
@@ -40,7 +44,7 @@ public:
   ModelAPI_PluginManager();
 
 protected:
-  static void SetPluginManager(boost::shared_ptr<ModelAPI_PluginManager> theManager);
+  static void SetPluginManager(std::shared_ptr<ModelAPI_PluginManager> theManager);
 };
 
 #endif
index ab07cdc88c95c8d495c2127794685c3ff07cf55c..10d71fce75c5f3a173699115416a23a07bce5762 100644 (file)
@@ -1,7 +1,6 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
 
 INCLUDE(Common)
-INCLUDE(FindBoost)
 
 SET(PROJECT_HEADERS
     PartSetPlugin.h
index d3d295dc72f8c90fc1e81cf81b3d84e83c6cbf9c..91baf0bc4e37b040e300aecba81a1b415140c292 100644 (file)
@@ -1,9 +1,13 @@
 #include "PartSetPlugin_Plugin.h"
 #include "PartSetPlugin_NewPart.h"
 #include <ModelAPI_PluginManager.h>
+#include <ModelAPI_Document.h>
 
 using namespace std;
 
+// group identification of the newly created parts in the Part Set document
+const int MY_PARTS_GROUP = 1;
+
 // the only created instance of this plugin
 static PartSetPlugin_Plugin* MY_INSTANCE = new PartSetPlugin_Plugin();
 
@@ -13,11 +17,15 @@ PartSetPlugin_Plugin::PartSetPlugin_Plugin()
   ModelAPI_PluginManager::get()->registerPlugin(this);
 }
 
-boost::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
+std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
 {
+  std::shared_ptr<ModelAPI_Feature> aCreated;
   if (theFeatureID == "new_part") {
-    return boost::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_NewPart());
+    aCreated = std::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_NewPart());
   }
+  // add to a root document for the current moment
+  if (aCreated)
+    ModelAPI_PluginManager::get()->rootDocument()->AddObject(aCreated, MY_PARTS_GROUP);
   // feature of such kind is not found
-  return boost::shared_ptr<ModelAPI_Feature>();
+  return aCreated;
 }
index ff577f79a3adec8e2003a43ece502a805e536255..74f6e73c02d90caa136d918152b0ce52d2f5c650 100644 (file)
@@ -13,7 +13,7 @@ class PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin: public ModelAPI_Plugin
 {
 public:
   /// Creates the feature object of this plugin by the feature string ID
-  virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
 
 public:
   /// Is needed for python wrapping by swig