]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 23 Apr 2014 14:05:43 +0000 (18:05 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 23 Apr 2014 14:05:43 +0000 (18:05 +0400)
Conflicts:
src/ModuleBase/ModuleBase_Operation.h
src/PartSet/PartSet_OperationSketchBase.cpp

27 files changed:
1  2 
CMakeLists.txt
src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
src/GeomAPI/GeomAPI.i
src/GeomAlgoAPI/GeomAlgoAPI.i
src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h
src/Model/CMakeLists.txt
src/Model/Model_Application.cpp
src/Model/Model_AttributeDocRef.cpp
src/Model/Model_Data.cpp
src/Model/Model_Document.cpp
src/Model/Model_Events.cpp
src/Model/Model_Iterator.cpp
src/Model/Model_PluginManager.cpp
src/ModelAPI/ModelAPI_PluginManager.cpp
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSetPlugin/PartSetPlugin_Part.cpp
src/PartSetPlugin/PartSetPlugin_Plugin.cpp
src/SketchPlugin/SketchPlugin_Feature.cpp
src/SketchPlugin/SketchPlugin_Feature.h
src/SketchPlugin/SketchPlugin_Sketch.cpp
src/SketchPlugin/SketchPlugin_Sketch.h
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_Workshop.cpp

diff --cc CMakeLists.txt
Simple merge
index 0000000000000000000000000000000000000000,c433491f9f5a0e9fffd7b4dd10e94f9636a2f745..5c1f39f2f8de2dfc5bc87f1df52371d2fbb9dff3
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,24 +1,24 @@@
 -shared_ptr<ModelAPI_Feature> ConstructionPlugin_Plugin::createFeature(string theFeatureID)
+ #include "ConstructionPlugin_Plugin.h"
+ #include "ConstructionPlugin_Point.h"
+ #include <ModelAPI_PluginManager.h>
+ #include <ModelAPI_Document.h>
+ using namespace std;
+ // the only created instance of this plugin
+ static ConstructionPlugin_Plugin* MY_INSTANCE = new ConstructionPlugin_Plugin();
+ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin() 
+ {
+   // register this plugin
+   ModelAPI_PluginManager::get()->registerPlugin(this);
+ }
 -    return shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Point);
++boost::shared_ptr<ModelAPI_Feature> ConstructionPlugin_Plugin::createFeature(string theFeatureID)
+ {
+   if (theFeatureID == "Point") {
 -  return shared_ptr<ModelAPI_Feature>();
++    return boost::shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Point);
+   }
+   // feature of such kind is not found
++  return boost::shared_ptr<ModelAPI_Feature>();
+ }
index 0000000000000000000000000000000000000000,717c7d264ad4ded423606aaa3888e3f0f0add158..3f65f05f21ba8978b0bdeec124704d11051ce7bd
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,28 +1,29 @@@
 -  #include "memory"
+ /* GeomAPI.i */
+ %module GeomAPI
+ %{
 -%include <std_shared_ptr.i>
++  #include "boost/shared_ptr.hpp"
+   #include "GeomAPI.h"
+   #include "GeomAPI_Interface.h"
+   #include "GeomAPI_Pnt.h"
+   #include "GeomAPI_Shape.h"
+ %}
+ // to avoid error on this
+ #define GEOMAPI_EXPORT
+ // standard definitions
+ %include "typemaps.i"
+ %include "std_string.i"
++//%include <std_shared_ptr.i>
++%include <boost_shared_ptr.i>
+ // boost pointers
+ // %include <boost_shared_ptr.i>
+ %shared_ptr(GeomAPI_Interface)
+ %shared_ptr(GeomAPI_Pnt)
+ %shared_ptr(GeomAPI_Shape)
+ // all supported interfaces
+ %include "GeomAPI_Interface.h"
+ %include "GeomAPI_Pnt.h"
+ %include "GeomAPI_Shape.h"
index 0000000000000000000000000000000000000000,4e71ea109728f3dea7bee048c14e60a7e8c88931..99a815f744a870d1b0d90f71dd916ad3b3d7f167
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,18 +1,19 @@@
 -%include <std_shared_ptr.i>
+ /* GeomAPI.i */
+ %module GeomAlgoAPI
+ %{
+   #include "memory"
+   #include "GeomAlgoAPI.h"
+   #include "GeomAlgoAPI_FaceBuilder.h"
+ %}
+ // to avoid error on this
+ #define GEOMALGOAPI_EXPORT
+ // standard definitions
+ %include "typemaps.i"
+ %include "std_string.i"
++//%include <std_shared_ptr.i>
++%include <boost_shared_ptr.i>
+ // all supported interfaces
+ %include "GeomAlgoAPI_FaceBuilder.h"
index 0000000000000000000000000000000000000000,bec2c7f1bcfd72238d95337eced517ce9ff5903d..642e90996af905bf1de718affb8156547e6417c4
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,23 +1,23 @@@
 -std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
 -  std::shared_ptr<GeomAPI_Pnt> theCenter, std::shared_ptr<GeomAPI_Dir> theNormal,
+ // File:        GeomAlgoAPI_FaceBuilder.cpp
+ // Created:     23 Apr 2014
+ // Author:      Mikhail PONIKAROV
+ #include <GeomAlgoAPI_FaceBuilder.h>
+ #include <gp_Pln.hxx>
+ #include <BRepBuilderAPI_MakeFace.hxx>
+ #include <TopoDS_Face.hxx>
 -  std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
++boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
++  boost::shared_ptr<GeomAPI_Pnt> theCenter, boost::shared_ptr<GeomAPI_Dir> theNormal,
+   const double theSize)
+ {
+   gp_Pnt* aCenter = static_cast<gp_Pnt*>(theCenter->implementation());
+   gp_Dir* aDir = static_cast<gp_Dir*>(theNormal->implementation());
+   gp_Pln aPlane(*aCenter, *aDir);
+   // half of the size in each direction from the center
+   BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, 
+     -theSize / 2., theSize / 2., -theSize / 2., theSize / 2.);
++  boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+   aRes->setImplementation(new TopoDS_Shape(aFaceBuilder.Face()));
+   return aRes;
+ }
index 0000000000000000000000000000000000000000,15243f233099d9f5e41ee61dc5f608d39e15b386..61ebfaeb6139ae0a172f1ab2a6c2213b7a82953d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,28 +1,28 @@@
 -#include <memory>
+ // File:        GeomAlgoAPI_FaceBuilder.h
+ // Created:     23 Apr 2014
+ // Author:      Mikhail PONIKAROV
+ #ifndef GeomAlgoAPI_FaceBuilder_HeaderFile
+ #define GeomAlgoAPI_FaceBuilder_HeaderFile
+ #include <GeomAlgoAPI.h>
+ #include <GeomAPI_Shape.h>
+ #include <GeomAPI_Pnt.h>
+ #include <GeomAPI_Dir.h>
 -  static std::shared_ptr<GeomAPI_Shape> square(std::shared_ptr<GeomAPI_Pnt> theCenter,
 -    std::shared_ptr<GeomAPI_Dir> theNormal, const double theSize);
++#include <boost/shared_ptr.hpp>
+ /**\class GeomAlgoAPI_FaceBuilder
+  * \ingroup DataAlgo
+  * \brief Allows to create face-shapes by different parameters
+  */
+ class GEOMALGOAPI_EXPORT GeomAlgoAPI_FaceBuilder
+ {
+ public:
+   /// Creates square planar face by given point of the center,
+   /// normal to the plane and size of square
++  static boost::shared_ptr<GeomAPI_Shape> square(boost::shared_ptr<GeomAPI_Pnt> theCenter,
++    boost::shared_ptr<GeomAPI_Dir> theNormal, const double theSize);
+ };
+ #endif
index 53f1ec956eef3537a14856c1f92268ea24832ef6,abad9811b1fcf26e6572523c8576ffaf6e8efe7f..310c9f8a305d4a271dd6748fd9549dffff3635f7
@@@ -14,17 -14,17 +14,17 @@@ SET(PROJECT_HEADER
  )
  
  SET(PROJECT_SOURCES
-     Model_Application.cxx
-     Model_Document.cxx
-     Model_PluginManager.cxx
-     Model_Data.cxx
-     Model_Iterator.cxx
-     Model_AttributeDouble.cxx
-     Model_AttributeDocRef.cxx
-     Model_Events.cxx
+     Model_Application.cpp
+     Model_Document.cpp
+     Model_PluginManager.cpp
+     Model_Data.cpp
+     Model_Iterator.cpp
+     Model_AttributeDouble.cpp
+     Model_AttributeDocRef.cpp
+     Model_Events.cpp
  )
  
 -ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS})
 +ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS})
  ADD_LIBRARY(Model SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
  TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES} ${CAS_OCAF} ModelAPI Event Config)
  
index 0000000000000000000000000000000000000000,40704967e8de9cef5e8a568dac24330bd0fc5f37..166b4e1a173f3812013eabdce23d4aec14c8f8f2
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,61 +1,61 @@@
 -const std::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
+ // File:      Model_Application.cxx
+ // Created:   Fri Sep 2 2011
+ // Author:    Mikhail PONIKAROV
+ #include <Model_Application.h>
+ #include <Model_Document.h>
+ IMPLEMENT_STANDARD_HANDLE(Model_Application, TDocStd_Application)
+ IMPLEMENT_STANDARD_RTTIEXT(Model_Application, TDocStd_Application)
+ using namespace std;
+ static Handle_Model_Application TheApplication = new Model_Application;
+ //=======================================================================
+ Handle(Model_Application) Model_Application::getApplication()
+ {
+   return TheApplication;
+ }
+ //=======================================================================
 -  std::shared_ptr<Model_Document> aNew(new Model_Document(theDocID));
++const boost::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
+ {
+   if (myDocs.find(theDocID) != myDocs.end())
+     return myDocs[theDocID];
++  boost::shared_ptr<Model_Document> aNew(new Model_Document(theDocID));
+   myDocs[theDocID] = aNew;
+   return myDocs[theDocID];
+ }
+ void Model_Application::deleteDocument(string theDocID)
+ {
+   myDocs.erase(theDocID);
+ }
+ //=======================================================================
+ bool Model_Application::hasDocument(std::string theDocID)
+ {
+   return myDocs.find(theDocID) != myDocs.end();
+ }
+ //=======================================================================
+ Model_Application::Model_Application()
+ {
+   // store handle to the application to avoid nullification
+   static Handle(Model_Application) TheKeepHandle;
+   TheKeepHandle = this;
+ }
+ //=======================================================================
+ void Model_Application::Formats(TColStd_SequenceOfExtendedString& theFormats)
+ {
+   theFormats.Append(TCollection_ExtendedString("BinOcaf")); // standard binary schema
+ }
+ //=======================================================================
+ Standard_CString Model_Application::ResourcesName()
+ {
+   return Standard_CString("Standard");
+ }
index 0000000000000000000000000000000000000000,07712d0b6a568a12559ac8bd058abfd3680f3c4a..9df9c22190611371b1cd80357fc9de7b3de3fa14
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,31 +1,31 @@@
 -void Model_AttributeDocRef::setValue(std::shared_ptr<ModelAPI_Document> theDoc)
+ // File:        ModelAPI_AttributeDocRef.cxx
+ // Created:     2 Apr 2014
+ // Author:      Mikhail PONIKAROV
+ #include "Model_AttributeDocRef.h"
+ #include "Model_Application.h"
+ using namespace std;
 -std::shared_ptr<ModelAPI_Document> Model_AttributeDocRef::value()
++void Model_AttributeDocRef::setValue(boost::shared_ptr<ModelAPI_Document> theDoc)
+ {
+   myComment->Set(TCollection_ExtendedString(theDoc->id().c_str()));
+ }
 -  return std::shared_ptr<ModelAPI_Document>();
++boost::shared_ptr<ModelAPI_Document> Model_AttributeDocRef::value()
+ {
+   if (myComment->Get().Length())
+     return Model_Application::getApplication()->getDocument(
+       TCollection_AsciiString(myComment->Get()).ToCString());
+   // not initialized
++  return boost::shared_ptr<ModelAPI_Document>();
+ }
+ Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label& theLabel)
+ {
+   // check the attribute could be already presented in this doc (after load document)
+   if (!theLabel.FindAttribute(TDataStd_Comment::GetID(), myComment)) {
+     // create attribute: not initialized by value yet, just empty string
+     myComment = TDataStd_Comment::Set(theLabel, "");
+   }
+ }
index 0000000000000000000000000000000000000000,a9ac29bf05dc6d9303df6c33972a99b63a89fb58..87c7be8672fda2dfa7b0a6b7c95ad461598d2bbc
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,77 +1,77 @@@
 -    myAttrs[theID] = std::shared_ptr<ModelAPI_Attribute>(anAttr);
+ // File:        Model_Data.hxx
+ // Created:     21 Mar 2014
+ // Author:      Mikhail PONIKAROV
+ #include <Model_Data.h>
+ #include <Model_AttributeDocRef.h>
+ #include <Model_AttributeDouble.h>
+ #include <TDataStd_Name.hxx>
+ using namespace std;
+ Model_Data::Model_Data()
+ {
+ }
+ void Model_Data::setLabel(TDF_Label& theLab)
+ {
+   myLab = theLab;
+ }
+ string Model_Data::getName()
+ {
+   Handle(TDataStd_Name) aName;
+   if (myLab.FindAttribute(TDataStd_Name::GetID(), aName))
+     return string(TCollection_AsciiString(aName->Get()).ToCString());
+   return ""; // not defined
+ }
+ void Model_Data::setName(string theName)
+ {
+   TDataStd_Name::Set(myLab, theName.c_str());
+ }
+ void Model_Data::addAttribute(string theID, string theAttrType)
+ {
+   TDF_Label anAttrLab = myLab.FindChild(myAttrs.size() + 1);
+   ModelAPI_Attribute* anAttr = 0;
+   if (theAttrType == ModelAPI_AttributeDocRef::type())
+     anAttr = new Model_AttributeDocRef(anAttrLab);
+   else if (theAttrType == ModelAPI_AttributeDouble::type())
+     anAttr = new Model_AttributeDouble(anAttrLab);
+   if (anAttr)
 -shared_ptr<ModelAPI_AttributeDocRef> Model_Data::docRef(const string theID)
++    myAttrs[theID] = boost::shared_ptr<ModelAPI_Attribute>(anAttr);
+   else
+     ; // TODO: generate error on unknown attribute request and/or add mechanism for customization
+ }
 -  map<string, shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
++boost::shared_ptr<ModelAPI_AttributeDocRef> Model_Data::docRef(const string theID)
+ {
 -    return std::shared_ptr<ModelAPI_AttributeDocRef>();
++  map<string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
+   if (aFound == myAttrs.end()) {
+     // TODO: generate error on unknown attribute request and/or add mechanism for customization
 -  shared_ptr<ModelAPI_AttributeDocRef> aRes = 
 -    dynamic_pointer_cast<ModelAPI_AttributeDocRef>(aFound->second);
++    return boost::shared_ptr<ModelAPI_AttributeDocRef>();
+   }
 -shared_ptr<ModelAPI_AttributeDouble> Model_Data::real(const string theID)
++  boost::shared_ptr<ModelAPI_AttributeDocRef> aRes = 
++    boost::dynamic_pointer_cast<ModelAPI_AttributeDocRef>(aFound->second);
+   if (!aRes) {
+     // TODO: generate error on invalid attribute type request
+   }
+   return aRes;
+ }
 -  map<string, shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
++boost::shared_ptr<ModelAPI_AttributeDouble> Model_Data::real(const string theID)
+ {
 -    return std::shared_ptr<ModelAPI_AttributeDouble>();
++  map<string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
+   if (aFound == myAttrs.end()) {
+     // TODO: generate error on unknown attribute request and/or add mechanism for customization
 -  shared_ptr<ModelAPI_AttributeDouble> aRes = 
 -    dynamic_pointer_cast<ModelAPI_AttributeDouble>(aFound->second);
++    return boost::shared_ptr<ModelAPI_AttributeDouble>();
+   }
++  boost::shared_ptr<ModelAPI_AttributeDouble> aRes = 
++    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aFound->second);
+   if (!aRes) {
+     // TODO: generate error on invalid attribute type request
+   }
+   return aRes;
+ }
index 0000000000000000000000000000000000000000,22641f4b3d7665376060fb4f3221448119503efd..c022362e82d372f38824e1f6b4d6a26724fad4ee
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,445 +1,444 @@@
 -shared_ptr<ModelAPI_Feature> Model_Document::addFeature(string theID)
+ // File:        Model_Document.cxx
+ // Created:     28 Feb 2014
+ // Author:      Mikhail PONIKAROV
+ #include <Model_Document.h>
+ #include <ModelAPI_Feature.h>
+ #include <Model_Data.h>
+ #include <Model_Application.h>
+ #include <Model_PluginManager.h>
+ #include <Model_Iterator.h>
+ #include <Model_Events.h>
+ #include <Event_Loop.h>
+ #include <TDataStd_Integer.hxx>
+ #include <TDataStd_Comment.hxx>
+ #include <TDF_ChildIDIterator.hxx>
+ #include <climits>
+ 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_DatasMgr)
+ static const int TAG_HISTORY = 3; // tag of the history sub-tree (Root for Model_History)
+ using namespace std;
+ bool Model_Document::load(const char* theFileName)
+ {
+   bool myIsError = Standard_False;
+   /*
+    TCollection_ExtendedString aPath ((const Standard_CString)theFileName);
+    PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus) -1;
+    try
+    {
+    Handle(TDocStd_Document) aDoc = this;
+    aStatus = Model_Application::GetApplication()->Open(aPath, aDoc);
+    }
+    catch (Standard_Failure)
+    {}
+    myIsError = aStatus != PCDM_RS_OK;
+    if (myIsError)
+    {
+    switch (aStatus)
+    {
+    case PCDM_RS_UnknownDocument: cout<<"OCAFApp_Appl_RUnknownDocument"<<endl; break;
+    case PCDM_RS_AlreadyRetrieved: cout<<"OCAFApp_Appl_RAlreadyRetrieved"<<endl; break;
+    case PCDM_RS_AlreadyRetrievedAndModified: cout<<"OCAFApp_Appl_RAlreadyRetrievedAndModified"<<endl; break;
+    case PCDM_RS_NoDriver: cout<<"OCAFApp_Appl_RNoDriver"<<endl; break;
+    case PCDM_RS_UnknownFileDriver: cout<<"OCAFApp_Appl_RNoDriver"<<endl; break;
+    case PCDM_RS_OpenError: cout<<"OCAFApp_Appl_ROpenError"<<endl; break;
+    case PCDM_RS_NoVersion: cout<<"OCAFApp_Appl_RNoVersion"<<endl; break;
+    case PCDM_RS_NoModel: cout<<"OCAFApp_Appl_RNoModel"<<endl; break;
+    case PCDM_RS_NoDocument: cout<<"OCAFApp_Appl_RNoDocument"<<endl; break;
+    case PCDM_RS_FormatFailure: cout<<"OCAFApp_Appl_RFormatFailure"<<endl; break;
+    case PCDM_RS_TypeNotFoundInSchema: cout<<"OCAFApp_Appl_RTypeNotFound"<<endl; break;
+    case PCDM_RS_UnrecognizedFileFormat: cout<<"OCAFApp_Appl_RBadFileFormat"<<endl; break;
+    case PCDM_RS_MakeFailure: cout<<"OCAFApp_Appl_RMakeFailure"<<endl; break;
+    case PCDM_RS_PermissionDenied: cout<<"OCAFApp_Appl_RPermissionDenied"<<endl; break;
+    case PCDM_RS_DriverFailure: cout<<"OCAFApp_Appl_RDriverFailure"<<endl; break;
+    default: cout<<"OCAFApp_Appl_RUnknownFail"<<endl; break;
+    }
+    }
+    SetUndoLimit(UNDO_LIMIT);
+    */
+   return !myIsError;
+ }
+ bool Model_Document::save(const char* theFileName)
+ {
+   bool myIsError = true;
+   /*
+    TCollection_ExtendedString aPath ((const Standard_CString)theFileName);
+    PCDM_StoreStatus aStatus;
+    try {
+    Handle(TDocStd_Document) aDoc = this;
+    aStatus = Model_Application::GetApplication()->SaveAs (aDoc, aPath);
+    }
+    catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    cout<<"OCAFApp_Engine:save Error: "<<aFail->GetMessageString()<<endl;
+    return false;
+    }
+    myIsError = aStatus != PCDM_SS_OK;
+    if (myIsError)
+    {
+    switch (aStatus)
+    {
+    case PCDM_SS_DriverFailure:
+    cout<<"OCAFApp_Appl_SDriverFailure"<<endl;
+    break;
+    case PCDM_SS_WriteFailure:
+    cout<<"OCAFApp_Appl_SWriteFailure"<<endl;
+    break;
+    case PCDM_SS_Failure:
+    default:
+    cout<<"OCAFApp_Appl_SUnknownFailure"<<endl;
+    break;
+    }
+    }
+    myTransactionsAfterSave = 0;
+    Standard::Purge(); // Release free memory
+    */
+   return !myIsError;
+ }
+ void Model_Document::close()
+ {
+   // close all subs
+   set<string>::iterator aSubIter = mySubs.begin();
+   for(; aSubIter != mySubs.end(); aSubIter++)
+     subDocument(*aSubIter)->close();
+   mySubs.clear();
+   // close this
+   myDoc->Close();
+   Model_Application::getApplication()->deleteDocument(myID);
+ }
+ void Model_Document::startOperation()
+ {
+   // new command for this
+   myDoc->NewCommand();
+   // new command for all subs
+   set<string>::iterator aSubIter = mySubs.begin();
+   for(; aSubIter != mySubs.end(); aSubIter++)
+     subDocument(*aSubIter)->startOperation();
+ }
+ void Model_Document::finishOperation()
+ {
+   // returns false if delta is empty and no transaction was made
+   myIsEmptyTr[myTransactionsAfterSave] = !myDoc->CommitCommand();
+   myTransactionsAfterSave++;
+   // finish for all subs
+   set<string>::iterator aSubIter = mySubs.begin();
+   for(; aSubIter != mySubs.end(); aSubIter++)
+     subDocument(*aSubIter)->finishOperation();
+ }
+ void Model_Document::abortOperation()
+ {
+   myDoc->AbortCommand();
+   // abort for all subs
+   set<string>::iterator aSubIter = mySubs.begin();
+   for(; aSubIter != mySubs.end(); aSubIter++)
+     subDocument(*aSubIter)->abortOperation();
+ }
+ bool Model_Document::isOperation()
+ {
+   // operation is opened for all documents: no need to check subs
+   return myDoc->HasOpenCommand() == Standard_True ;
+ }
+ bool Model_Document::isModified()
+ {
+   // is modified if at least one operation was commited and not undoed
+   return myTransactionsAfterSave > 0;
+ }
+ bool Model_Document::canUndo()
+ {
+   if (myDoc->GetAvailableUndos() > 0)
+     return true;
+   // check other subs contains operation that can be undoed
+   set<string>::iterator aSubIter = mySubs.begin();
+   for(; aSubIter != mySubs.end(); aSubIter++)
+     if (subDocument(*aSubIter)->canUndo())
+       return true;
+   return false;
+ }
+ void Model_Document::undo()
+ {
+   myTransactionsAfterSave--;
+   if (!myIsEmptyTr[myTransactionsAfterSave])
+     myDoc->Undo();
+   synchronizeFeatures();
+   // undo for all subs
+   set<string>::iterator aSubIter = mySubs.begin();
+   for(; aSubIter != mySubs.end(); aSubIter++)
+     subDocument(*aSubIter)->undo();
+ }
+ bool Model_Document::canRedo()
+ {
+   if (myDoc->GetAvailableRedos() > 0)
+     return true;
+   // check other subs contains operation that can be redoed
+   set<string>::iterator aSubIter = mySubs.begin();
+   for(; aSubIter != mySubs.end(); aSubIter++)
+     if (subDocument(*aSubIter)->canRedo())
+       return true;
+   return false;
+ }
+ void Model_Document::redo()
+ {
+   if (!myIsEmptyTr[myTransactionsAfterSave])
+     myDoc->Redo();
+   myTransactionsAfterSave++;
+   synchronizeFeatures();
+   // redo for all subs
+   set<string>::iterator aSubIter = mySubs.begin();
+   for(; aSubIter != mySubs.end(); aSubIter++)
+     subDocument(*aSubIter)->redo();
+ }
 -  shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(theID);
++boost::shared_ptr<ModelAPI_Feature> Model_Document::addFeature(string theID)
+ {
 -    dynamic_pointer_cast<Model_Document>(aFeature->documentToAdd())->addFeature(aFeature);
++  boost::shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(theID);
+   if (aFeature) {
 -void Model_Document::addFeature(const std::shared_ptr<ModelAPI_Feature> theFeature)
++    boost::dynamic_pointer_cast<Model_Document>(aFeature->documentToAdd())->addFeature(aFeature);
+   } else {
+     // TODO: generate error that feature is not created
+   }
+   return aFeature;
+ }
 -  std::shared_ptr<Model_Data> aData(new Model_Data);
++void Model_Document::addFeature(const boost::shared_ptr<ModelAPI_Feature> theFeature)
+ {
+   const std::string& aGroup = theFeature->getGroup();
+   TDF_Label aGroupLab = groupLabel(aGroup);
+   TDF_Label anObjLab = aGroupLab.NewChild();
 -  shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
++  boost::shared_ptr<Model_Data> aData(new Model_Data);
+   aData->setLabel(anObjLab);
 -shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
++  boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
+   aData->setDocument(aThis);
+   theFeature->setData(aData);
+   setUniqueName(theFeature);
+   theFeature->initAttributes();
+   // keep the feature ID to restore document later correctly
+   TDataStd_Comment::Set(anObjLab, theFeature->getKind().c_str());
+   // put index of the feature in the group in the tree
+   TDataStd_Integer::Set(anObjLab, myFeatures[aGroup].size());
+   myFeatures[aGroup].push_back(theFeature);
+   // event: feature is added
+   static Event_ID anEvent = Event_Loop::eventByName(EVENT_FEATURE_CREATED);
+   ModelAPI_FeatureUpdatedMessage aMsg(aThis, theFeature, anEvent);
+   Event_Loop::loop()->send(aMsg);
+ }
 -  return std::shared_ptr<ModelAPI_Feature>(); // not found
++boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
+ {
+   Handle(TDataStd_Integer) aFeatureIndex;
+   if (theLabel.FindAttribute(TDataStd_Integer::GetID(), aFeatureIndex)) {
+     Handle(TDataStd_Comment) aGroupID;
+     if (theLabel.Father().FindAttribute(TDataStd_Comment::GetID(), aGroupID)) {
+       string aGroup = TCollection_AsciiString(aGroupID->Get()).ToCString();
+       return myFeatures[aGroup][aFeatureIndex->Get()];
+     }
+   }
 -int Model_Document::featureIndex(shared_ptr<ModelAPI_Feature> theFeature)
++  return boost::shared_ptr<ModelAPI_Feature>(); // not found
+ }
 -  shared_ptr<Model_Data> aData = dynamic_pointer_cast<Model_Data>(theFeature->data());
++int Model_Document::featureIndex(boost::shared_ptr<ModelAPI_Feature> theFeature)
+ {
+   if (theFeature->data()->document().get() != this) {
+     return theFeature->data()->document()->featureIndex(theFeature);
+   }
 -shared_ptr<ModelAPI_Document> Model_Document::subDocument(string theDocID)
++  boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theFeature->data());
+   Handle(TDataStd_Integer) aFeatureIndex;
+   if (aData->label().FindAttribute(TDataStd_Integer::GetID(), aFeatureIndex)) {
+     return aFeatureIndex->Get();
+   }
+   return -1; // not found
+ }
 -shared_ptr<ModelAPI_Iterator> Model_Document::featuresIterator(const string theGroup)
++boost::shared_ptr<ModelAPI_Document> Model_Document::subDocument(string theDocID)
+ {
+   // just store sub-document identifier here to manage it later
+   if (mySubs.find(theDocID) == mySubs.end())
+     mySubs.insert(theDocID);
+   return Model_Application::getApplication()->getDocument(theDocID);
+ }
 -  shared_ptr<Model_Document> aThis(Model_Application::getApplication()->getDocument(myID));
++boost::shared_ptr<ModelAPI_Iterator> Model_Document::featuresIterator(const string theGroup)
+ {
 -    return shared_ptr<ModelAPI_Iterator>(new Model_Iterator());
 -  return shared_ptr<ModelAPI_Iterator>(new Model_Iterator(aThis, groupLabel(theGroup)));
++  boost::shared_ptr<Model_Document> aThis(Model_Application::getApplication()->getDocument(myID));
+   // create an empty iterator for not existing group 
+   // (to avoidance of attributes management outside the transaction)
+   if (myGroups.find(theGroup) == myGroups.end())
 -shared_ptr<ModelAPI_Feature> Model_Document::feature(const string& theGroupID, const int theIndex)
++    return boost::shared_ptr<ModelAPI_Iterator>(new Model_Iterator());
++  return boost::shared_ptr<ModelAPI_Iterator>(new Model_Iterator(aThis, groupLabel(theGroup)));
+ }
 -  shared_ptr<ModelAPI_Iterator>  anIter = featuresIterator(theGroupID);
++boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(const string& theGroupID, const int theIndex)
+ {
+   // TODO: optimize this method
 -  return anIter->more() ? anIter->current() : shared_ptr<ModelAPI_Feature>();
++  boost::shared_ptr<ModelAPI_Iterator>  anIter = featuresIterator(theGroupID);
+   for(int a = 0; a != theIndex && anIter->more(); anIter->next()) a++;
 -    myFeatures[theGroup] = vector<shared_ptr<ModelAPI_Feature> >();
++  return anIter->more() ? anIter->current() : boost::shared_ptr<ModelAPI_Feature>();
+ }
+ const vector<string>& Model_Document::getGroups() const
+ {
+   return myGroupsNames;
+ }
+ Model_Document::Model_Document(const std::string theID)
+     : myID(theID), myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format
+ {
+   myDoc->SetUndoLimit(UNDO_LIMIT);
+   myTransactionsAfterSave = 0;
+   // to avoid creation of tag outside of the transaction (by iterator, for example)
+   /*
+   if (!myDoc->Main().FindChild(TAG_OBJECTS).IsAttribute(TDF_TagSource::GetID()))
+     TDataStd_Comment::Set(myDoc->Main().FindChild(TAG_OBJECTS).NewChild(), "");
+     */
+ }
+ TDF_Label Model_Document::groupLabel(const string theGroup)
+ {
+   if (myGroups.find(theGroup) == myGroups.end()) {
+     myGroups[theGroup] = myDoc->Main().FindChild(TAG_OBJECTS).NewChild();
+     myGroupsNames.push_back(theGroup);
+     // set to the group label the group idntifier to restore on "open"
+     TDataStd_Comment::Set(myGroups[theGroup], theGroup.c_str());
 -void Model_Document::setUniqueName(
 -  shared_ptr<ModelAPI_Feature> theFeature)
++    myFeatures[theGroup] = vector<boost::shared_ptr<ModelAPI_Feature> >();
+   }
+   return myGroups[theGroup];
+ }
 -  shared_ptr<ModelAPI_Iterator> anIter = featuresIterator(theFeature->getGroup());
++void Model_Document::setUniqueName(boost::shared_ptr<ModelAPI_Feature> theFeature)
+ {
+   // first count all objects of such kind to start with index = count + 1
+   int aNumObjects = 0;
 -  shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
++  boost::shared_ptr<ModelAPI_Iterator> anIter = featuresIterator(theFeature->getGroup());
+   for(; anIter->more(); anIter->next()) {
+     if (anIter->currentKind() == theFeature->getKind())
+       aNumObjects++;
+   }
+   // generate candidate name
+   stringstream aNameStream;
+   aNameStream<<theFeature->getKind()<<"_"<<aNumObjects + 1;
+   string aName = aNameStream.str();
+   // check this is unique, if not, increase index by 1
+   for(anIter = featuresIterator(theFeature->getGroup()); anIter->more();) {
+     if (anIter->currentName() == aName) {
+       aNumObjects++;
+       stringstream aNameStream;
+       aNameStream<<theFeature->getKind()<<"_"<<aNumObjects + 1;
+       // reinitialize iterator to make sure a new name is unique
+       anIter = featuresIterator(theFeature->getGroup());
+     } else anIter->next();
+   }
+   theFeature->data()->setName(aName);
+ }
+ void Model_Document::synchronizeFeatures()
+ {
 -    myFeatures[aGroupName] = vector<shared_ptr<ModelAPI_Feature> >();
++  boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
+   // iterate groups labels
+   TDF_ChildIDIterator aGroupsIter(myDoc->Main().FindChild(TAG_OBJECTS),
+     TDataStd_Comment::GetID(), Standard_False);
+   vector<string>::iterator aGroupNamesIter = myGroupsNames.begin();
+   for(; aGroupsIter.More() && aGroupNamesIter != myGroupsNames.end();
+         aGroupsIter.Next(), aGroupNamesIter++) {
+     string aGroupName = TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(
+       aGroupsIter.Value())->Get()).ToCString();
+     if (*aGroupNamesIter != aGroupName) 
+       break; // all since there is a change this must be recreated from scratch
+   }
+   // delete all groups left after the data model groups iteration
+   while(aGroupNamesIter != myGroupsNames.end()) {
+     string aGroupName = *aGroupNamesIter;
+     myFeatures.erase(aGroupName);
+     myGroups.erase(aGroupName);
+     aGroupNamesIter = myGroupsNames.erase(aGroupNamesIter);
+     // say that features were deleted from group
+     ModelAPI_FeatureDeletedMessage aMsg(aThis, aGroupName);
+     Event_Loop::loop()->send(aMsg);
+   }
+   // create new groups basing on the following data model update
+   for(; aGroupsIter.More(); aGroupsIter.Next()) {
+     string aGroupName = TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(
+       aGroupsIter.Value())->Get()).ToCString();
+     myGroupsNames.push_back(aGroupName);
+     myGroups[aGroupName] = aGroupsIter.Value()->Label();
 -    vector<shared_ptr<ModelAPI_Feature> >& aFeatures = myFeatures[aGroupName];
 -    vector<shared_ptr<ModelAPI_Feature> >::iterator aFIter = aFeatures.begin();
++    myFeatures[aGroupName] = vector<boost::shared_ptr<ModelAPI_Feature> >();
+   }
+   // update features group by group
+   aGroupsIter.Initialize(myDoc->Main().FindChild(TAG_OBJECTS),
+     TDataStd_Comment::GetID(), Standard_False);
+   for(; aGroupsIter.More(); aGroupsIter.Next()) {
+     string aGroupName = TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(
+       aGroupsIter.Value())->Get()).ToCString();
+     // iterate features in internal container
 -        shared_ptr<Model_Data> aData = dynamic_pointer_cast<Model_Data>((*aFIter)->data());
++    vector<boost::shared_ptr<ModelAPI_Feature> >& aFeatures = myFeatures[aGroupName];
++    vector<boost::shared_ptr<ModelAPI_Feature> >::iterator aFIter = aFeatures.begin();
+     // and in parallel iterate labels of features
+     TDF_ChildIDIterator aFLabIter(
+       aGroupsIter.Value()->Label(), TDataStd_Comment::GetID(), Standard_False);
+     while(aFIter != aFeatures.end() || aFLabIter.More()) {
+       static const int INFINITE_TAG = INT_MAX; // no label means that it exists somwhere in infinite
+       int aFeatureTag = INFINITE_TAG; 
+       if (aFIter != aFeatures.end()) { // existing tag for feature
 -        shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(
++        boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>((*aFIter)->data());
+         aFeatureTag = aData->label().Tag();
+       }
+       int aDSTag = INFINITE_TAG; 
+       if (aFLabIter.More()) { // next label in DS is existing
+         aDSTag = aFLabIter.Value()->Label().Tag();
+       }
+       if (aDSTag > aFeatureTag) { // feature is removed
+         aFIter = aFeatures.erase(aFIter);
+         // event: model is updated
+         ModelAPI_FeatureDeletedMessage aMsg(aThis, aGroupName);
+         Event_Loop::loop()->send(aMsg);
+       } else if (aDSTag < aFeatureTag) { // a new feature is inserted
+         // create a feature
 -        std::shared_ptr<Model_Data> aData(new Model_Data);
++        boost::shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(
+           TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(
+           aFLabIter.Value())->Get()).ToCString());
++        boost::shared_ptr<Model_Data> aData(new Model_Data);
+         TDF_Label aLab = aFLabIter.Value()->Label();
+         aData->setLabel(aLab);
+         aData->setDocument(Model_Application::getApplication()->getDocument(myID));
+         aFeature->setData(aData);
+         aFeature->initAttributes();
+         // event: model is updated
+         static Event_ID anEvent = Event_Loop::eventByName(EVENT_FEATURE_CREATED);
+         ModelAPI_FeatureUpdatedMessage aMsg(aThis, aFeature, anEvent);
+         Event_Loop::loop()->send(aMsg);
+         if (aFIter == aFeatures.end()) {
+           aFeatures.push_back(aFeature);
+           aFIter = aFeatures.end();
+         } else {
+           aFIter++;
+           aFeatures.insert(aFIter, aFeature);
+         }
+         // feature for this label is added, so go to the next label
+         aFLabIter.Next();
+       } else { // nothing is changed, both iterators are incremented
+         aFIter++;
+         aFLabIter.Next();
+       }
+     }
+   }
+ }
index 0000000000000000000000000000000000000000,dc35573ebae8a405ab2eab7f77800ebcdb2d41f0..a83e9cabd738ea63e2a1a3728e01c432ee44c6f0
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,25 +1,25 @@@
 -  const std::shared_ptr<ModelAPI_Document>& theDoc,
 -  const std::shared_ptr<ModelAPI_Feature>& theFeature, const Event_ID& theEvent)
+ // File:        Model_Events.cxx
+ // Created:     10 Apr 2014
+ // Author:      Mikhail PONIKAROV
+ #include <Model_Events.h>
+ #include <Event_Loop.h>
+ ModelAPI_FeatureUpdatedMessage::ModelAPI_FeatureUpdatedMessage(
 -  const std::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
++  const boost::shared_ptr<ModelAPI_Document>& theDoc,
++  const boost::shared_ptr<ModelAPI_Feature>& theFeature, const Event_ID& theEvent)
+   : Event_Message(theEvent, 0), myFeature(theFeature), myDoc(theDoc)
+ {}
+ ModelAPI_FeatureDeletedMessage::ModelAPI_FeatureDeletedMessage(
++  const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
+   : Event_Message(messageId(), 0), myDoc(theDoc), myGroup(theGroup)
+ {
+ }
+ const Event_ID ModelAPI_FeatureDeletedMessage::messageId()
+ {
+   static Event_ID MY_ID = Event_Loop::eventByName(EVENT_FEATURE_DELETED);
+   return MY_ID;
+ }
index 0000000000000000000000000000000000000000,001ebdff8146c3d2bab6e71cc80cbca487696fa2..ba59cdf75aadf63089514734eff3f0b5b9744928
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,67 +1,67 @@@
 -shared_ptr<ModelAPI_Feature> Model_Iterator::current()
+ // File:        Model_Iterator.hxx
+ // Created:     1 Apr 2014
+ // Author:      Mikhail PONIKAROV
+ #include "Model_Iterator.h"
+ #include "Model_Document.h"
+ #include "ModelAPI_Feature.h"
+ #include "Model_Data.h"
+ #include <TDataStd_Comment.hxx>
+ #include <TDataStd_Name.hxx>
+ using namespace std;
+ void Model_Iterator::next()
+ {
+   return myIter.Next();
+ }
+ bool Model_Iterator::more()
+ {
+   return myIter.More() == Standard_True;
+ }
 -bool Model_Iterator::isEqual(std::shared_ptr<ModelAPI_Feature> theFeature)
++boost::shared_ptr<ModelAPI_Feature> Model_Iterator::current()
+ {
+   TDF_Label aLab = myIter.Value()->Label();
+   return myDoc->feature(aLab);
+ }
+ string Model_Iterator::currentKind()
+ {
+   return string(TCollection_AsciiString(
+     Handle(TDataStd_Comment)::DownCast(myIter.Value())->Get()).ToCString());
+ }
+ string Model_Iterator::currentName()
+ {
+   TDF_Label aLab = myIter.Value()->Label();
+   Handle(TDataStd_Name) aName;
+   if (aLab.FindAttribute(TDataStd_Name::GetID(), aName))
+     return string(TCollection_AsciiString(aName->Get()).ToCString());
+   return ""; // name is not found
+ }
+ int Model_Iterator::numIterationsLeft()
+ {
+   int aResult = 0;
+   TDF_ChildIDIterator aTempIter(myIter);
+   for(; aTempIter.More(); aTempIter.Next())
+     aResult++;
+   return aResult;
+ }
 -    dynamic_pointer_cast<Model_Data>(theFeature->data())->label()) == Standard_True;
++bool Model_Iterator::isEqual(boost::shared_ptr<ModelAPI_Feature> theFeature)
+ {
+   return (myIter.Value()->Label() == 
 -Model_Iterator::Model_Iterator(std::shared_ptr<Model_Document> theDoc, TDF_Label theLab)
++    boost::dynamic_pointer_cast<Model_Data>(theFeature->data())->label()) == Standard_True;
+ }
+ Model_Iterator::Model_Iterator()
+ {
+ }
++Model_Iterator::Model_Iterator(boost::shared_ptr<Model_Document> theDoc, TDF_Label theLab)
+   : myDoc(theDoc), myIter(theLab, TDataStd_Comment::GetID(), Standard_False)
+ {}
index 0000000000000000000000000000000000000000,75cc0430c17ea114ed9f8b2f42c09ae8b2ceeda3..e816fdd4a2edc81ab38a75ad84fc9ab480c6bc23
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,103 +1,103 @@@
 -shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
+ // File:        Model_PluginManager.cxx
+ // Created:     20 Mar 2014
+ // Author:      Mikhail PONIKAROV
+ #include <Model_PluginManager.h>
+ #include <ModelAPI_Feature.h>
+ #include <ModelAPI_Plugin.h>
+ #include <Model_Data.h>
+ #include <Model_Document.h>
+ #include <Model_Application.h>
+ #include <Event_Loop.h>
+ #include <Config_FeatureMessage.h>
+ #include <Config_ModuleReader.h>
+ using namespace std;
+ static Model_PluginManager* myImpl = new Model_PluginManager();
 -      std::shared_ptr<ModelAPI_Feature> aCreated = 
++boost::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
+ {
+   if (this != myImpl) return myImpl->createFeature(theFeatureID);
+   LoadPluginsInfo();
+   if (myPlugins.find(theFeatureID) != myPlugins.end()) {
+     myCurrentPluginName = myPlugins[theFeatureID];
+     if (myPluginObjs.find(myCurrentPluginName) == myPluginObjs.end()) {
+       // load plugin library if not yet done
+       loadLibrary(myCurrentPluginName);
+     }
+     if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) {
 -  return std::shared_ptr<ModelAPI_Feature>(); // return nothing
++      boost::shared_ptr<ModelAPI_Feature> aCreated = 
+         myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
+       return aCreated;
+     }
+   }
 -std::shared_ptr<ModelAPI_Document> Model_PluginManager::rootDocument()
++  return boost::shared_ptr<ModelAPI_Feature>(); // return nothing
+ }
 -  return std::shared_ptr<ModelAPI_Document>(
++boost::shared_ptr<ModelAPI_Document> Model_PluginManager::rootDocument()
+ {
 -shared_ptr<ModelAPI_Document> Model_PluginManager::currentDocument()
++  return boost::shared_ptr<ModelAPI_Document>(
+     Model_Application::getApplication()->getDocument("root"));
+ }
+ bool Model_PluginManager::hasRootDocument()
+ {
+   return Model_Application::getApplication()->hasDocument("root");
+ }
 -void Model_PluginManager::setCurrentDocument(shared_ptr<ModelAPI_Document> theDoc)
++boost::shared_ptr<ModelAPI_Document> Model_PluginManager::currentDocument()
+ {
+   if (!myCurrentDoc)
+     myCurrentDoc = rootDocument();
+   return myCurrentDoc;
+ }
 -  ModelAPI_PluginManager::SetPluginManager(std::shared_ptr<ModelAPI_PluginManager>(this));
++void Model_PluginManager::setCurrentDocument(boost::shared_ptr<ModelAPI_Document> theDoc)
+ {
+   myCurrentDoc = theDoc;
+ }
+ Model_PluginManager::Model_PluginManager()
+ {
+   myPluginsInfoLoaded = false;
+   //TODO(sbh): Implement static method to extract event id [SEID]
+   static Event_ID aFeatureEvent = Event_Loop::eventByName("FeatureRegisterEvent");
++  ModelAPI_PluginManager::SetPluginManager(boost::shared_ptr<ModelAPI_PluginManager>(this));
+   // register the configuration reading listener
+   Event_Loop* aLoop = Event_Loop::loop();
+   aLoop->registerListener(this, aFeatureEvent);
+ }
+ void Model_PluginManager::processEvent(const Event_Message* theMessage)
+ {
+   const Config_FeatureMessage* aMsg =
+     dynamic_cast<const Config_FeatureMessage*>(theMessage);
+   if (aMsg) {
+     // proccess the plugin info, load plugin
+     if (myPlugins.find(aMsg->id()) == myPlugins.end()) {
+       myPlugins[aMsg->id()] = aMsg->pluginLibrary();
+     }
+   }
+   // plugins information was started to load, so, it will be loaded
+   myPluginsInfoLoaded = true;
+ }
+ void Model_PluginManager::LoadPluginsInfo()
+ {
+   if (myPluginsInfoLoaded) // nothing to do
+     return;
+   // Read plugins information from XML files
+   Config_ModuleReader aXMLReader("FeatureRegisterEvent");
+   aXMLReader.setAutoImport(true);
+   aXMLReader.readAll();
+ }
+ void Model_PluginManager::registerPlugin(ModelAPI_Plugin* thePlugin)
+ {
+   myPluginObjs[myCurrentPluginName] = thePlugin;
+ }
index 0000000000000000000000000000000000000000,f3e7e9b9d5f13b377247169f802d41162eed67bb..772ac8d9888b4ea4ac3893c5ca1e1c4cebf20d7c
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,94 +1,94 @@@
 -std::shared_ptr<ModelAPI_PluginManager> MY_MANAGER;
+ // File:        ModelAPI_PluginManager.hxx
+ // Created:     20 Mar 2014
+ // Author:      Mikhail PONIKAROV
+ #include <ModelAPI_PluginManager.h>
+ // to avoid unresolved ModelAPI_Document()
+ #include <ModelAPI_Document.h>
+ // to avoid unresolved ModelAPI_Feature()
+ #include <ModelAPI_Feature.h>
+ // to avoid unresolved ModelAPI_Data()
+ #include <ModelAPI_Data.h>
+ // to avoid unresolved ModelAPI_Plugin()
+ #include <ModelAPI_Plugin.h>
+ // to avoid unresolved ModelAPI_Iterator()
+ #include <ModelAPI_Iterator.h>
+ // to avoid unresolved ModelAPI_Iterator()
+ #include <ModelAPI_Iterator.h>
+ #include <ModelAPI_Attribute.h>
+ #include <ModelAPI_AttributeDocRef.h>
+ #include <ModelAPI_AttributeDouble.h>
+ #ifdef WIN32
+ #include <windows.h>
+ #else
+ #include <dlfcn.h>
+ #endif
+ using namespace std;
+ /// Converts library name to the operation system file name
+ string library(const string& theLibName);
+ /// Manager that will be initialized from Model package, one per application
 -  std::shared_ptr<ModelAPI_PluginManager> theManager)
++boost::shared_ptr<ModelAPI_PluginManager> MY_MANAGER;
+ ModelAPI_PluginManager::ModelAPI_PluginManager()
+ {
+ }
+ void ModelAPI_PluginManager::SetPluginManager(
 -std::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
++  boost::shared_ptr<ModelAPI_PluginManager> theManager)
+ {
+   MY_MANAGER = theManager;
+ }
++boost::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
+ {
+   if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI
+     loadLibrary("Model");
+   }
+   return MY_MANAGER;
+ }
+ string library(const string& theLibName)
+ {
+   string aLibName = theLibName;
+ #ifndef WIN32
+   static string aLibExt( ".so" );
+   if (aLibName.size() < 3 || aLibName.substr(0, 3) !="lib")
+     aLibName = "lib" + aLibName;
+ #else
+   static string aLibExt( ".dll" );
+ #endif
+   string anExt = aLibName.substr(aLibName.size() - 4);
+   if ( anExt != aLibExt)
+     aLibName += aLibExt;
+   return aLibName;
+ }
+ // for debug purpose only (cerr), before the error management system is implemented
+ #include <iostream>
+ void ModelAPI_PluginManager::loadLibrary(const string theLibName)
+ {
+   string aFileName = library(theLibName);
+   if ( aFileName.empty() )
+   {
+     cerr<<"Library "<<theLibName.c_str()<<" can not be imported"<<endl;
+     return;
+   }
+ #ifdef WIN32
+   HINSTANCE aModLib = ::LoadLibrary( aFileName.c_str() ); 
+   if (!aModLib)
+     cerr<<"Failed to load "<<aFileName.c_str()<<endl;
+ #else
+   void* aModLib = dlopen( aFileName.c_str(), RTLD_LAZY );
+   if ( !aModLib )
+     cerr<<"Failed to load "<<aFileName.c_str()<<endl;
+ #endif
+ }
index d7441c339f5acad50cace04bf61e82de73b6a307,6e109860b8ca56052459d678b1f66a92f08225d8..75724ea34e6e418524ebf2230986c3594fee9ac2
@@@ -131,8 -131,7 +131,7 @@@ private
  
    //!< Next fields could be extracted into a subclass;
    QString myOperationId;
-   QString myXmlRepr;
 -  std::shared_ptr<ModelAPI_Feature> myFeature;
 +  boost::shared_ptr<ModelAPI_Feature> myFeature;
  };
  
  #endif
index 69bbe52dce430078739c7e84f908e9bc99f61e78,9b34aa2ebd34779ca8525508110440319b93035c..ec0d695d529d49eaf43aa6d4bb347b3663931221
@@@ -31,8 -31,8 +31,8 @@@ PartSet_OperationSketchBase::~PartSet_O
   */
  const TopoDS_Shape& PartSet_OperationSketchBase::preview() const
  {
 -  shared_ptr<SketchPlugin_Feature> aFeature = dynamic_pointer_cast<SketchPlugin_Feature>(feature());
 +  boost::shared_ptr<SketchPlugin_Feature> aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
-   return aFeature->preview();
+   return *(static_cast<TopoDS_Shape*>(aFeature->preview()->implementation()));
  }
  
  /*!
index 0000000000000000000000000000000000000000,440eb6f2596322c2ed2f98a6e840a6115904db14..144411717f28f3fc8de381777c41e5a3bc97407d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,34 +1,34 @@@
 -  shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->docRef(PART_ATTR_DOC_REF);
+ // File:        PartSetPlugin_Part.cxx
+ // Created:     27 Mar 2014
+ // Author:      Mikhail PONIKAROV
+ #include "PartSetPlugin_Part.h"
+ #include "ModelAPI_PluginManager.h"
+ #include "ModelAPI_Document.h"
+ #include "ModelAPI_Data.h"
+ #include "ModelAPI_Iterator.h"
+ #include "ModelAPI_AttributeDocRef.h"
+ using namespace std;
+ PartSetPlugin_Part::PartSetPlugin_Part()
+ {
+ }
+ void PartSetPlugin_Part::initAttributes()
+ {
+   data()->addAttribute(PART_ATTR_DOC_REF, ModelAPI_AttributeDocRef::type());
+ }
+ void PartSetPlugin_Part::execute() 
+ {
 -    shared_ptr<ModelAPI_Document> aPartSetDoc = ModelAPI_PluginManager::get()->rootDocument();
++  boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->docRef(PART_ATTR_DOC_REF);
+   if (!aDocRef->value()) { // create a document if not yet created
 -shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd() {
++    boost::shared_ptr<ModelAPI_Document> aPartSetDoc = ModelAPI_PluginManager::get()->rootDocument();
+     aDocRef->setValue(aPartSetDoc->subDocument(data()->getName()));
+   }
+ }
++boost::shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd() {
+   return ModelAPI_PluginManager::get()->rootDocument();
+ }
index 0000000000000000000000000000000000000000,7ef8f66e1e4d657f2a11e35d0108b5057535b8a6..85ea1c37eacf527337a523ae115b3684134ef227
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,24 +1,24 @@@
 -shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
+ #include "PartSetPlugin_Plugin.h"
+ #include "PartSetPlugin_Part.h"
+ #include <ModelAPI_PluginManager.h>
+ #include <ModelAPI_Document.h>
+ using namespace std;
+ // the only created instance of this plugin
+ static PartSetPlugin_Plugin* MY_INSTANCE = new PartSetPlugin_Plugin();
+ PartSetPlugin_Plugin::PartSetPlugin_Plugin() 
+ {
+   // register this plugin
+   ModelAPI_PluginManager::get()->registerPlugin(this);
+ }
 -    return shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
++boost::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
+ {
+   if (theFeatureID == "Part") {
 -  return shared_ptr<ModelAPI_Feature>();
++    return boost::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
+   }
+   // feature of such kind is not found
++  return boost::shared_ptr<ModelAPI_Feature>();
+ }
index 57bc3582d406a411e1e1cecd1029b40c14d2077c,27040b92d88233ed76e4bd3597fec416f546ca31..8586525f792f4a46811caef7d1c1bfaaaae2201d
@@@ -3,7 -3,7 +3,7 @@@
  /**
   * Returns the sketch preview
   */
- const TopoDS_Shape& SketchPlugin_Feature::preview()
 -const std::shared_ptr<GeomAPI_Shape>& SketchPlugin_Feature::preview()
++const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Feature::preview()
  {
    return myPreview;
  }
@@@ -12,7 -12,7 +12,7 @@@
   * Set the shape to the internal preview field
   * \param theShape a preview shape
   */
- void SketchPlugin_Feature::setPreview(const TopoDS_Shape& theShape)
 -void SketchPlugin_Feature::setPreview(const std::shared_ptr<GeomAPI_Shape>& theShape)
++void SketchPlugin_Feature::setPreview(const boost::shared_ptr<GeomAPI_Shape>& theShape)
  {
    myPreview = theShape;
  }
index 4b91631c9ed43e799a43ae00cf83959c8ffa2f5a,a440dbdfdd2a353e6f6c74530c5a990a277344da..964abe80e4f8b97c299afb162abcfbb95146b044
  class SketchPlugin_Feature: public ModelAPI_Feature
  {
  public:
-  SKETCHPLUGIN_EXPORT virtual const TopoDS_Shape& preview() = 0;
 - SKETCHPLUGIN_EXPORT virtual const std::shared_ptr<GeomAPI_Shape>& preview() = 0;
++ SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview() = 0;
  
  protected:
-   void setPreview(const TopoDS_Shape& theShape); ///< the preview shape
 -  void setPreview(const std::shared_ptr<GeomAPI_Shape>& theShape); ///< the preview shape
++  void setPreview(const boost::shared_ptr<GeomAPI_Shape>& theShape); ///< the preview shape
  
  private:
-   TopoDS_Shape myPreview; ///< the preview shape
 -  std::shared_ptr<GeomAPI_Shape> myPreview; ///< the preview shape
++  boost::shared_ptr<GeomAPI_Shape> myPreview; ///< the preview shape
  };
  
  #endif
index 7fb20f0798af5a74af220aebc6a835e99173ccda,9a3624daf39295bae1573005d6092ae084019731..f450ec74660b28ce3eaa72c5bd68d5a50e6a595b
@@@ -34,23 -22,18 +22,18 @@@ void SketchPlugin_Sketch::initAttribute
  
  void SketchPlugin_Sketch::execute() 
  {
-   /*shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->docRef(PART_ATTR_DOC_REF);
-   if (!aDocRef->value()) { // create a document if not yet created
-     shared_ptr<ModelAPI_Document> aPartSetDoc = ModelAPI_PluginManager::get()->rootDocument();
-     aDocRef->setValue(aPartSetDoc->subDocument(data()->getName()));
-   }*/
  }
  
- const TopoDS_Shape& SketchPlugin_Sketch::preview()
 -const shared_ptr<GeomAPI_Shape>& SketchPlugin_Sketch::preview()
++const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Sketch::preview()
  {
-   if (SketchPlugin_Feature::preview().IsNull())
+   if (!SketchPlugin_Feature::preview())
    {
-     gp_Pnt anOrigin(0, 0, 0);
-     gp_Dir aDir(gp_Vec(gp_Pnt(0,0,0), gp_Pnt(1,0,0)));
-     gp_Pln aPlane(anOrigin, aDir);
-     BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, PLANE_U_MIN, PLANE_U_MAX, PLANE_V_MIN,
-                                          PLANE_V_MAX);
-     setPreview(aFaceBuilder.Face());
 -    shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
 -    shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(1, 0, 0));
 -    shared_ptr<GeomAPI_Shape> aFace = 
++    boost::shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
++    boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(1, 0, 0));
++    boost::shared_ptr<GeomAPI_Shape> aFace = 
+       GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal, PLANE_SIZE);
+     setPreview(aFace);
    }
    return SketchPlugin_Feature::preview();
  }
index a2b63388a83d7d4a75af49ae21cd2071671865e1,e261df1a8625dc9c275c17af60b3aac5fb3e1a00..4cceee37f4b7e1fca07f95f199119c773b0411d3
@@@ -35,7 -33,7 +33,7 @@@ public
   SKETCHPLUGIN_EXPORT virtual void initAttributes();
  
    /// Returns the sketch preview
-   SKETCHPLUGIN_EXPORT virtual const TopoDS_Shape& preview();
 -  SKETCHPLUGIN_EXPORT virtual const std::shared_ptr<GeomAPI_Shape>& preview();
++  SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
  
    /// Use plugin manager for features creation
    SketchPlugin_Sketch();
index 5300fe5c15a66b68775e2ef721a074c41628659a,79abb676fa53a737e597b59bb99447934625abfe..8fb825b5bd30d03e02fb398fc82a8d14f012de68
@@@ -45,3 -45,15 +45,15 @@@ void XGUI_Displayer::Display(boost::sha
  
    aContext->UpdateCurrentViewer();
  }
 -void XGUI_Displayer::Erase(std::shared_ptr<ModelAPI_Feature> theFeature,
+ /*!
+  * Erase the feature and a shape.
+  * \param theFeature a feature instance
+  * \param theFeature a shape
+  */
++void XGUI_Displayer::Erase(boost::shared_ptr<ModelAPI_Feature> theFeature,
+                            const TopoDS_Shape& theShape)
+ {
+   Handle(AIS_InteractiveContext) aContext = myViewer->AISContext();
+   aContext->EraseAll();
+ }
index 10480ef9732bd2fd468f729f7bede378742a0bd1,4c5333f45b6f33ad2b00a99b650b1a33a4851e35..dc09d99bd06da1a1cedfb6852e0327aad04a4c52
@@@ -21,10 -20,12 +21,12 @@@ public
    XGUI_Displayer(XGUI_Viewer* theViewer);
    virtual ~XGUI_Displayer();
  
 -  void Display(std::shared_ptr<ModelAPI_Feature> theFeature);
 +  void Display(boost::shared_ptr<ModelAPI_Feature> theFeature);
  
 -  void Display(std::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape);
 +  void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape);
  
 -  void Erase(std::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape);
++  void Erase(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape);
  protected:
    XGUI_Viewer* myViewer; ///< the viewer
  };
Simple merge