Salome HOME
added support for all type of edges in KindOfShape method
[modules/geom.git] / src / GEOM_I / GEOM_Gen_i.cc
index 756ebd362ac3ca128baadda2f85c918025a67f19..f4da6559580e882eb24336f21e96feb2f9c9e7e7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -98,13 +98,12 @@ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr            orb,
                        PortableServer::POA_ptr   poa,
                        PortableServer::ObjectId* contId,
                        const char*               instanceName,
-                       const char*               interfaceName) :
-  Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
+                       const char*               interfaceName,
+                       bool withRegistry) :
+  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, withRegistry)
 {
   _thisObj = this;
   _id = _poa->activate_object(_thisObj);
-  name_service = new SALOME_NamingService(_orb);
-
   _impl = new ::GEOMImpl_Gen;
 
   //PAL10867: disable signals catching with "noexcepthandler" option
@@ -140,10 +139,8 @@ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr            orb,
 // purpose  : destructor
 //============================================================================
 GEOM_Gen_i::~GEOM_Gen_i() {
-  delete name_service;
   delete _impl;
-  std::map<std::string, GEOM_GenericOperationsCreator*>::const_iterator it;
-  for ( it = myOpCreatorMap.begin(); it != myOpCreatorMap.end(); ++it)
+  for (auto it = myOpCreatorMap.cbegin(); it != myOpCreatorMap.cend(); ++it)
     delete (*it).second;
 }
 
@@ -152,10 +149,10 @@ GEOM_Gen_i::~GEOM_Gen_i() {
 // function : IORToLocalPersistentID()
 // purpose  :
 //============================================================================
-char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
+char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr /*theSObject*/,
                                          const char* IORString,
-                                         CORBA::Boolean isMultiFile,
-                                         CORBA::Boolean isASCII)
+                                         CORBA::Boolean /*isMultiFile*/,
+                                         CORBA::Boolean /*isASCII*/)
 {
   GEOM::GEOM_BaseObject_var anObject =
     GEOM::GEOM_BaseObject::_narrow(_orb->string_to_object(IORString));
@@ -172,10 +169,10 @@ char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
 //          : Used when a study is loaded
 //          : The IOR (IORName) of object created is returned
 //============================================================================
-char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
+char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr /*theSObject*/,
                                          const char* aLocalPersistentID,
-                                         CORBA::Boolean isMultiFile,
-                                         CORBA::Boolean isASCII)
+                                         CORBA::Boolean /*isMultiFile*/,
+                                         CORBA::Boolean /*isASCII*/)
 {
   Handle(::GEOM_BaseObject) anObject =
     _impl->GetObject(aLocalPersistentID);
@@ -212,7 +209,7 @@ bool GEOM_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR)
 SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr theSObject,
                                                  CORBA::Object_ptr     theObject,
                                                  const char*           theName)
-  throw (SALOME::SALOME_Exception)
+  
 {
   Unexpect aCatch(SALOME_SalomeException);
   SALOMEDS::SObject_var aResultSO;
@@ -226,23 +223,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr theSObjec
   SALOMEDS::StudyBuilder_var     aStudyBuilder = aStudy->NewBuilder();
   SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = aStudy->GetUseCaseBuilder();
 
-  SALOMEDS::SComponent_var       aFather = aStudy->FindComponent("GEOM");
-  if (aFather->_is_nil()) {
-    aFather = aStudyBuilder->NewComponent("GEOM");
-    anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName");
-    SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
-    aName->SetValue("Geometry");
-    aName->UnRegister();
-    anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributePixMap");
-    SALOMEDS::AttributePixMap_var aPixMap=SALOMEDS::AttributePixMap::_narrow(anAttr);
-    aPixMap->SetPixMap("ICON_OBJBROWSER_Geometry");
-    aPixMap->UnRegister();
-    aStudyBuilder->DefineComponentInstance(aFather, (GEOM::GEOM_Gen_var)GEOM_Gen::_this());
-    // add component to the use case tree
-    // (to support tree representation customization and drag-n-drop)
-    useCaseBuilder->SetRootCurrent();
-    useCaseBuilder->Append( aFather ); // component object is added as the top level item
-  }
+  SALOMEDS::SComponent_var aFather = findOrCreateComponent();
   if (aFather->_is_nil()) return aResultSO;
 
   if (CORBA::is_nil(theSObject)) {
@@ -456,9 +437,9 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr theSObjec
 void GEOM_Gen_i::CreateAndPublishGroup(GEOM::GEOM_Object_var theMainShape,
                                        const TopTools_IndexedMapOfShape& anIndices,
                                        const TopTools_SequenceOfShape& SeqS,
-                                       const TColStd_SequenceOfAsciiString& SeqN,
+                                       const TColStd_SequenceOfAsciiString& /*SeqN*/,
                                        const Standard_CString& GrName,
-                                       GEOM::ListOfGO_var aResList)
+                                       GEOM::ListOfGO_var /*aResList*/)
 {
   CORBA::String_var entry = theMainShape->GetEntry();
   //Handle(::GEOM_Object) aMainShape = _impl->GetObject(entry);
@@ -574,7 +555,7 @@ GEOM::ListOfGO* GEOM_Gen_i::
 // function : Save()
 // purpose  : save OCAF/Geom document
 //============================================================================
-SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
+SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr /*theComponent*/,
                                     const char* theURL,
                                     bool isMultiFile) {
   SALOMEDS::TMPFile_var aStreamFile;
@@ -604,12 +585,12 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
   // Build a full file name of temporary file
   TCollection_AsciiString aFullName = TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt;
   // Save GEOM component in this file
-  _impl->Save((char*) aFullName.ToCString());
-  // Conver a file to the byte stream
-  aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq, isMultiFile);
-  // Remove the created file and tmp directory
-  if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq, true);
-
+  if (_impl->Save((char*) aFullName.ToCString())) {
+    // Convert a file to the byte stream
+    aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq, isMultiFile);
+    // Remove the created file and tmp directory
+    if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq, true);
+  }
   // Return the created byte stream
   return aStreamFile._retn();
 }
@@ -721,7 +702,7 @@ CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
 // function : Close()
 // purpose  :
 //============================================================================
-void GEOM_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent)
+void GEOM_Gen_i::Close(SALOMEDS::SComponent_ptr /*theComponent*/)
 {
   _impl->Close();
 }
@@ -775,7 +756,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::
 // function : CanPaste()
 // purpose  :
 //============================================================================
-CORBA::Boolean GEOM_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) {
+CORBA::Boolean GEOM_Gen_i::CanPaste(const char* theComponentName, CORBA::Long /*theObjectID*/) {
   // The Geometry component can paste only objects copied by Geometry component
   // and with the object type = 1
   if (strcmp(theComponentName, ComponentDataType()) != 0) return false;
@@ -800,7 +781,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
   BRep_Builder aBuilder;
   try {
     BRepTools::Read(aTopology, aStreamedBrep, aBuilder);
-  } catch (Standard_Failure) {
+  } catch (Standard_Failure&) {
     return aNewSO._retn();
   }
 
@@ -915,7 +896,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesO (GEOM::GEOM_Object_ptr   theObject
   CORBA::String_var anIORo = _orb->object_to_string(theObject);
   SALOMEDS::SObject_var aSO = aStudy->FindObjectIOR(anIORo.in());
   //PTv, IMP 0020001, The salome object <aSO>
-  // is not obligatory in case of invokation from script
+  // is not obligatory in case of invocation from script
   // if (CORBA::is_nil(aSO))
   //  return aParts._retn();
 
@@ -944,7 +925,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesO (GEOM::GEOM_Object_ptr   theO
   CORBA::String_var anIORo = _orb->object_to_string(theObject);
   SALOMEDS::SObject_var aSO = getStudyServant()->FindObjectIOR(anIORo.in());
   //PTv, IMP 0020001, The salome object <aSO>
-  // is not obligatory in case of invokation from script
+  // is not obligatory in case of invocation from script
   // if (CORBA::is_nil(aSO))
   //  return aParts._retn();
 
@@ -1027,7 +1008,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(GEOM::GEOM_Object_ptr   theObject,
   GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
   SALOMEDS::Study_var aStudy = getStudyServant();
   //PTv, IMP 0020001, The salome object <theSObject>
-  //     is not obligatory in case of invokation from script
+  //     is not obligatory in case of invocation from script
   if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/)
     return aParts._retn();
 
@@ -1097,7 +1078,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(GEOM::GEOM_Object_ptr   theObject,
 
     // Reconstruct arguments and tree of sub-shapes of the arguments
     CORBA::String_var anIOR;
-    SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+    SALOMEDS::StudyBuilder_var      aStudyBuilder = aStudy->NewBuilder();
+    SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = aStudy->GetUseCaseBuilder();
     for (Standard_Integer i = 0; i < aLength; i++)
     {
       GEOM::GEOM_Object_var anArgO = aList[i];
@@ -1264,7 +1246,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(GEOM::GEOM_Object_ptr   theObject,
           if (!CORBA::is_nil(anArgSO)) {
             SALOMEDS::SObject_var aSubSO;
             if (!CORBA::is_nil(theSObject))
+            {
               aSubSO = aStudyBuilder->NewObject(theSObject);
+              useCaseBuilder->AppendTo( theSObject, aSubSO );
+            }
 
             // Restore published sub-shapes of the argument
             GEOM::ListOfGO_var aSubParts =
@@ -1405,7 +1390,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::SObject_ptr   th
       CORBA::is_nil(theNewO) /*|| CORBA::is_nil(theNewSO)*/)
     return aParts._retn();
 
-  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var     aStudyBuilder = aStudy->NewBuilder();
+  SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = aStudy->GetUseCaseBuilder();
 
   // Get interface, containing method, which we will use to reconstruct sub-shapes
   GEOM::GEOM_IShapesOperations_var  aShapesOp = GetIShapesOperations();
@@ -1524,6 +1510,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::SObject_ptr   th
               if (anOldSubO->GetMarkerType() == GEOM::MT_USER)
                 aNewSubO->SetMarkerTexture(anOldSubO->GetMarkerTexture());
             }
+            // reference to arg
+            SALOMEDS::SObject_wrap aReferenceSO = aStudyBuilder->NewObject( aNewSubSO );
+            aStudyBuilder->Addreference( aReferenceSO, anOldSubSO );
+            useCaseBuilder->AppendTo( theNewSO, aReferenceSO );
           }
           // Restore published sub-shapes of the argument
           GEOM::ListOfGO_var aSubParts;
@@ -1540,8 +1530,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::SObject_ptr   th
         else { // GetInPlace failed, try to build from published parts
           SALOMEDS::SObject_var aNewSubSO;
           if (!CORBA::is_nil(theNewSO))
+          {
             aNewSubSO = aStudyBuilder->NewObject(theNewSO);
-
+            useCaseBuilder->AppendTo( theNewSO, aNewSubSO );
+          }
           // Restore published sub-shapes of the argument
           GEOM::ListOfGO_var aSubParts =
             RestoreSubShapesOneLevel(anOldSubSO, aNewSubSO,
@@ -1620,7 +1612,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(GEOM::GEOM_Object_ptr   theObj
   GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
   SALOMEDS::Study_var aStudy = getStudyServant();
   //PTv, IMP 0020001, The salome object <theSObject>
-  //     is not obligatory in case of invokation from script
+  //     is not obligatory in case of invocation from script
   if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/)
     return aParts._retn();
 
@@ -1631,7 +1623,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(GEOM::GEOM_Object_ptr   theObj
 
   // Get all arguments
   GEOM::ListOfGBO_var anOpArgsList = theObject->GetDependency();
-  Standard_Integer    nbArgsActual = anOpArgsList->length();
+  Standard_Integer    nbOpArgs     = anOpArgsList->length();
+  Standard_Integer    nbArgsActual = nbOpArgs;
 
   // If anOpArgsList list is empty, nothing to do
   if (nbArgsActual == 0)
@@ -1663,7 +1656,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(GEOM::GEOM_Object_ptr   theObj
   if (nbArgsActual < 1)
     return aParts._retn();
 
-  if (theInheritFirstArg || (nbArgsActual == 1)) {
+  if (theInheritFirstArg || (nbOpArgs == 1)) {
     // Do not publish argument's reflection,
     // but only reconstruct its published sub-shapes
 
@@ -1695,7 +1688,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(GEOM::GEOM_Object_ptr   theObj
 
     // Reconstruct arguments and tree of sub-shapes of the arguments
     CORBA::String_var anIOR;
-    SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+    SALOMEDS::StudyBuilder_var      aStudyBuilder = aStudy->NewBuilder();
+    SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = aStudy->GetUseCaseBuilder();
     for (Standard_Integer i = 0; i < nbArgsActual; i++)
     {
       GEOM::GEOM_Object_var anArgO = aList[i];
@@ -1814,8 +1808,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(GEOM::GEOM_Object_ptr   theObj
           if (!CORBA::is_nil(anArgSO)) {
             SALOMEDS::SObject_var aSubSO;
             if (!CORBA::is_nil(theSObject))
+            {
               aSubSO = aStudyBuilder->NewObject(theSObject);
-
+              useCaseBuilder->AppendTo( theSObject, aSubSO );
+            }
             // Restore published sub-shapes of the argument
             GEOM::ListOfGO_var aSubParts =
               RestoreGivenSubShapesOneLevel(anArgSO, aSubSO,
@@ -1949,7 +1945,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
       CORBA::is_nil(theNewO) /*|| CORBA::is_nil(theNewSO)*/)
     return aParts._retn();
 
-  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var      aStudyBuilder = aStudy->NewBuilder();
+  SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = aStudy->GetUseCaseBuilder();
 
   // Get interface, containing method, which we will use to reconstruct sub-shapes
   GEOM::GEOM_IShapesOperations_var  aShapesOp = GetIShapesOperations();
@@ -2073,6 +2070,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
               if (anOldSubO->GetMarkerType() == GEOM::MT_USER)
                 aNewSubO->SetMarkerTexture(anOldSubO->GetMarkerTexture());
             }
+            // reference to arg
+            SALOMEDS::SObject_wrap aReferenceSO = aStudyBuilder->NewObject( aNewSubSO );
+            aStudyBuilder->Addreference( aReferenceSO, anOldSubSO );
+            useCaseBuilder->AppendTo( theNewSO, aReferenceSO );
           }
           // Restore published sub-shapes of the argument
           GEOM::ListOfGO_var aSubParts;
@@ -2089,8 +2090,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
         else { // GetInPlace failed, try to build from published parts
           SALOMEDS::SObject_var aNewSubSO;
           if (!CORBA::is_nil(theNewSO))
+          {
             aNewSubSO = aStudyBuilder->NewObject(theNewSO);
-
+            useCaseBuilder->AppendTo( theNewSO, aNewSubSO );
+          }
           // Restore published sub-shapes of the argument
           GEOM::ListOfGO_var aSubParts =
             RestoreGivenSubShapesOneLevel(anOldSubSO, aNewSubSO,
@@ -2150,27 +2153,38 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
 }
 
 //============================================================================
-// function : register()
-// purpose  : register 'name' in 'name_service'
+// function : findOrCreateComponent()
+// purpose  : Find root study component; create if it does not exist
 //============================================================================
-void GEOM_Gen_i::register_name(char * name)
+SALOMEDS::SComponent_var GEOM_Gen_i::findOrCreateComponent()
 {
-  GEOM::GEOM_Gen_var g = _this();
-  name_service->Register(g, name);
-}
+  SALOMEDS::SComponent_var aComponent;
 
-//============================================================================
-// function : getStudyServant()
-// purpose  : Get Study
-//============================================================================
-SALOMEDS::Study_var GEOM_Gen_i::getStudyServant()
-{
-  static SALOMEDS::Study_var aStudy;
-  if(CORBA::is_nil(aStudy)){
-    CORBA::Object_ptr anObject = name_service->Resolve("/Study");
-    aStudy = SALOMEDS::Study::_narrow(anObject);
+  SALOMEDS::Study_var aStudy = getStudyServant();
+  if (aStudy->_is_nil()) return aComponent;
+
+  SALOMEDS::GenericAttribute_var anAttr;
+  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+  SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = aStudy->GetUseCaseBuilder();
+
+  aComponent = aStudy->FindComponent(ComponentDataType());
+  if (aComponent->_is_nil()) {
+    aComponent = aStudyBuilder->NewComponent(ComponentDataType());
+    anAttr = aStudyBuilder->FindOrCreateAttribute(aComponent.in(), "AttributeName");
+    SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+    aName->SetValue("Geometry");
+    aName->UnRegister();
+    anAttr = aStudyBuilder->FindOrCreateAttribute(aComponent.in(), "AttributePixMap");
+    SALOMEDS::AttributePixMap_var aPixMap=SALOMEDS::AttributePixMap::_narrow(anAttr);
+    aPixMap->SetPixMap("ICON_OBJBROWSER_Geometry");
+    aPixMap->UnRegister();
+    aStudyBuilder->DefineComponentInstance(aComponent.in(), (GEOM::GEOM_Gen_var)GEOM_Gen::_this());
+    // add component to the use case tree
+    // (to support tree representation customization and drag-n-drop)
+    useCaseBuilder->SetRootCurrent();
+    useCaseBuilder->Append(aComponent.in()); // component object is added as the top level item
   }
-  return aStudy;
+  return aComponent;
 }
 
 //============================================================================
@@ -2196,7 +2210,6 @@ void GEOM_Gen_i::Redo()
 // purpose  :
 //============================================================================
 GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations()
-     throw ( SALOME::SALOME_Exception )
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIBasicOperations" );
@@ -2218,7 +2231,6 @@ GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_ITransformOperations_ptr GEOM_Gen_i::GetITransformOperations()
-     throw ( SALOME::SALOME_Exception )
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetITransformOperations" );
@@ -2238,7 +2250,7 @@ GEOM::GEOM_ITransformOperations_ptr GEOM_Gen_i::GetITransformOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_I3DPrimOperations_ptr GEOM_Gen_i::GetI3DPrimOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetI3DPrimOperations" );
@@ -2259,7 +2271,7 @@ GEOM::GEOM_I3DPrimOperations_ptr GEOM_Gen_i::GetI3DPrimOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_IShapesOperations_ptr GEOM_Gen_i::GetIShapesOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIShapesOperations" );
@@ -2279,7 +2291,7 @@ GEOM::GEOM_IShapesOperations_ptr GEOM_Gen_i::GetIShapesOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_IBlocksOperations_ptr GEOM_Gen_i::GetIBlocksOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIBlocksOperations" );
@@ -2299,7 +2311,7 @@ GEOM::GEOM_IBlocksOperations_ptr GEOM_Gen_i::GetIBlocksOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_IBooleanOperations_ptr GEOM_Gen_i::GetIBooleanOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIBooleanOperations" );
@@ -2319,7 +2331,7 @@ GEOM::GEOM_IBooleanOperations_ptr GEOM_Gen_i::GetIBooleanOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_ICurvesOperations_ptr GEOM_Gen_i::GetICurvesOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetICurvesOperations" );
@@ -2339,7 +2351,7 @@ GEOM::GEOM_ICurvesOperations_ptr GEOM_Gen_i::GetICurvesOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_ILocalOperations_ptr GEOM_Gen_i::GetILocalOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetILocalOperations" );
@@ -2359,7 +2371,7 @@ GEOM::GEOM_ILocalOperations_ptr GEOM_Gen_i::GetILocalOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_IHealingOperations_ptr GEOM_Gen_i::GetIHealingOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::IHealingOperations" );
@@ -2379,7 +2391,7 @@ GEOM::GEOM_IHealingOperations_ptr GEOM_Gen_i::GetIHealingOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_IInsertOperations_ptr GEOM_Gen_i::GetIInsertOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIInsertOperations" );
@@ -2399,7 +2411,7 @@ GEOM::GEOM_IInsertOperations_ptr GEOM_Gen_i::GetIInsertOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_IMeasureOperations_ptr GEOM_Gen_i::GetIMeasureOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIMeasureOperations" );
@@ -2419,7 +2431,7 @@ GEOM::GEOM_IMeasureOperations_ptr GEOM_Gen_i::GetIMeasureOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIGroupOperations" );
@@ -2439,7 +2451,7 @@ GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations()
 // purpose  :
 //============================================================================
 GEOM::GEOM_IFieldOperations_ptr GEOM_Gen_i::GetIFieldOperations()
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIFieldOperations" );
@@ -2454,12 +2466,50 @@ GEOM::GEOM_IFieldOperations_ptr GEOM_Gen_i::GetIFieldOperations()
   return operations._retn();
 }
 
+//============================================================================
+// function : GetITestOperations
+// purpose  :
+//============================================================================
+GEOM::GEOM_ITestOperations_ptr GEOM_Gen_i::GetITestOperations()
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  MESSAGE( "GEOM_Gen_i::GetITestOperations" );
+
+  GEOM::GEOM_Gen_ptr engine = _this();
+
+  GEOM_ITestOperations_i* aServant =
+    new GEOM_ITestOperations_i(_poa, engine, _impl->GetITestOperations());
+
+  // activate the CORBA servant
+  GEOM::GEOM_ITestOperations_var operations = aServant->_this();
+  return operations._retn();
+}
+
+//============================================================================
+// function : GetICanonicalRecognition
+// purpose  :
+//============================================================================
+GEOM::GEOM_ICanonicalRecognition_ptr GEOM_Gen_i::GetICanonicalRecognition()
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  MESSAGE("GEOM_Gen_i::GetICanonicalRecognition");
+
+  GEOM::GEOM_Gen_ptr engine = _this();
+
+  GEOM_ICanonicalRecognition_i* aServant =
+    new GEOM_ICanonicalRecognition_i(_poa, engine, _impl->GetICanonicalRecognition());
+
+  // activate the CORBA servant
+  GEOM::GEOM_ICanonicalRecognition_var operations = aServant->_this();
+  return operations._retn();
+}
+
 //============================================================================
 // function : GetPluginOperations
 // purpose  :
 //============================================================================
 GEOM::GEOM_IOperations_ptr GEOM_Gen_i::GetPluginOperations(const char* theLibName)
-     throw ( SALOME::SALOME_Exception )
+     
 {
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetPluginOperations" );
@@ -2510,8 +2560,18 @@ void GEOM_Gen_i::LoadPlugin(const std::string& theLibName)
 
   // check, if corresponding operations are already created
   if (myOpCreatorMap.find(theLibName) == myOpCreatorMap.end()) {
+#if WIN32
+  #if UNICODE 
+       std::wstring strL = Kernel_Utils::utf8_decode_s(aPlatformLibName);
+    const wchar_t* aPath = strL.c_str();
+  #else
+    const char* aPath = aPlatformLibName.c_str();
+  #endif
     // load plugin library
-    LibHandle libHandle = LoadLib( aPlatformLibName.c_str() );
+    LibHandle libHandle = LoadLib(aPath);
+#else
+    LibHandle libHandle = LoadLib(aPlatformLibName.c_str());
+#endif
     if (!libHandle) {
       // report any error, if occurred
 #ifndef WIN32
@@ -2794,6 +2854,18 @@ char* GEOM_Gen_i::getObjectInfo(const char* entry)
       case GEOM::GEOM_IKindOfShape::SEGMENT:
         aTypeInfo = "Segment";
         break;
+      case GEOM::GEOM_IKindOfShape::CRV_BSPLINE:
+        aTypeInfo = "Crv BSpline";
+        break;
+      case GEOM::GEOM_IKindOfShape::CRV_BEZIER:
+        aTypeInfo = "Crv Bezier";
+        break;
+      case GEOM::GEOM_IKindOfShape::HYPERBOLA:
+        aTypeInfo = "Hyperbola";
+        break;
+      case GEOM::GEOM_IKindOfShape::PARABOLA:
+        aTypeInfo = "Parabola";
+        break;
       case GEOM::GEOM_IKindOfShape::EDGE:
         aTypeInfo = "Edge";
         break;
@@ -2834,6 +2906,11 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
 {
   SALOMEDS::SObject_var aFolderSO;
 
+  if ( CORBA::is_nil(theFather) ) {
+    SALOMEDS::SComponent_var aComponent = findOrCreateComponent();
+    if (aComponent->_is_nil()) return aFolderSO._retn();
+    theFather = SALOMEDS::SObject::_narrow(aComponent);
+  }
   if ( CORBA::is_nil(theFather) ) return aFolderSO._retn();
 
   SALOMEDS::GenericAttribute_var anAttr;
@@ -3174,7 +3251,7 @@ void GEOM_Gen_i::GetEntriesToReduceStudy(GEOM::string_array& theSelectedEntries,
         continue;
 
       stringIOR = handle_object->GetIOR();
-      if ( !stringIOR.Length() > 1 )
+      if ( stringIOR.Length() < 1 )
         continue;
 
       geomObj = GetIORFromString( stringIOR.ToCString() );
@@ -3297,24 +3374,4 @@ void GEOM_Gen_i::includeSubObjects(const std::string& aSelectedEntry,
     includeSubObjects( aSubEntryStr, aSelected, aParents, aChildren, anOthers );
   }
 }
-//=====================================================================================
-// EXPORTED METHODS
-//=====================================================================================
-extern "C"
-{
-  /*
-  GEOM_I_EXPORT
-  PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB*, PortableServer::POA*, PortableServer::ObjectId*, const char*, const char*);
-  */
-
-  GEOM_I_EXPORT
-  PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB_ptr            orb,
-                                               PortableServer::POA_ptr   poa,
-                                               PortableServer::ObjectId* contId,
-                                               const char*               instanceName,
-                                               const char*               interfaceName)
-  {
-    GEOM_Gen_i* myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName);
-    return myGEOM_Gen_i->getId();
-  }
-}
+