Salome HOME
Typo-fix by Kunda
[modules/geom.git] / src / GEOM_I / GEOM_Gen_i.cc
old mode 100755 (executable)
new mode 100644 (file)
index 3719658..fc6cee5
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  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
@@ -58,7 +58,6 @@
 #include <TColStd_HArray1OfInteger.hxx>
 #include <TopAbs_ShapeEnum.hxx>
 #include <TopExp.hxx>
-#include <TopTools_SequenceOfShape.hxx>
 #include <OSD.hxx>
 #include <TDataStd_ChildNodeIterator.hxx>
 #include <TDocStd_Owner.hxx>
@@ -66,7 +65,6 @@
 
 #include <SALOMEDS_Tool.hxx>
 #include <SALOMEDS_wrap.hxx>
-#include <SALOME_DataContainer_i.hxx>
 #include <Basics_DirUtils.hxx>
 
 #include <set>
@@ -86,7 +84,7 @@
  #define UnLoadLib( handle ) FreeLibrary( handle );
 #else
  #define LibHandle void*
- #define LoadLib( name ) dlopen( name, RTLD_LAZY )
+ #define LoadLib( name ) dlopen( name, RTLD_LAZY | RTLD_GLOBAL )
  #define GetProc dlsym
  #define UnLoadLib( handle ) dlclose( handle );
 #endif
@@ -143,6 +141,9 @@ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr            orb,
 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)
+    delete (*it).second;
 }
 
 
@@ -158,7 +159,7 @@ char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
   GEOM::GEOM_BaseObject_var anObject =
     GEOM::GEOM_BaseObject::_narrow(_orb->string_to_object(IORString));
   if (!CORBA::is_nil(anObject)) {
-    return CORBA::string_dup(anObject->GetEntry());
+    return anObject->GetEntry();
   }
   return 0;
 }
@@ -177,7 +178,7 @@ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
 {
   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
 
-  Handle(GEOM_BaseObject) anObject =
+  Handle(::GEOM_BaseObject) anObject =
     _impl->GetObject(aStudy->StudyId(), aLocalPersistentID);
   if ( !anObject.IsNull() )
   {
@@ -224,7 +225,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr   theStudy,
 
   SALOMEDS::GenericAttribute_var anAttr;
   SALOMEDS::StudyBuilder_var     aStudyBuilder = theStudy->NewBuilder();
-  SALOMEDS::UseCaseBuilder_var   useCaseBuilder = theStudy->GetUseCaseBuilder();
+  SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = theStudy->GetUseCaseBuilder();
 
   SALOMEDS::SComponent_var       aFather = theStudy->FindComponent("GEOM");
   if (aFather->_is_nil()) {
@@ -261,9 +262,9 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr   theStudy,
   // BEGIN: try to find existed name for current shape
   if ( !aShape->_is_nil() && mytype != GEOM_GROUP)
   {
-    // recieve current TopoDS shape
+    // receive current TopoDS shape
     CORBA::String_var entry = aShape->GetEntry();
-    Handle(GEOM_Object) aGShape = Handle(GEOM_Object)::DownCast
+    Handle(::GEOM_Object) aGShape = Handle(::GEOM_Object)::DownCast
       ( _impl->GetObject( aShape->GetStudyID(), entry ));
     TopoDS_Shape TopoSh = aGShape->GetValue();
     // find label of main shape
@@ -272,7 +273,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr   theStudy,
       aMainSh = aMainSh->GetMainShape();
     }
     entry = aMainSh->GetEntry();
-    Handle(GEOM_BaseObject) anObj = _impl->GetObject( aMainSh->GetStudyID(), entry );
+    Handle(::GEOM_BaseObject) anObj = _impl->GetObject( aMainSh->GetStudyID(), entry );
     TDF_Label aMainLbl = anObj->GetFunction(1)->GetNamingEntry();
 
     // check all named shapes using iterator
@@ -312,29 +313,32 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr   theStudy,
       aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_SOLID");
       aNamePrefix = "Group_Of_Solids_";
       break;
+    default:
+      aNamePrefix = "Group_";
     }
   } else if ( mytype == GEOM_MARKER ) {
     aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_LCS");
     aNamePrefix = "LocalCS_";
   }  else if ( mytype >= USER_TYPE_EX ) {
-      char buf[20];
-      sprintf( buf, "%d", aBaseObj->GetType() );
-      GEOM::CreationInformation_var info = aBaseObj->GetCreationInformation();
-      std::string plgId;
-      for ( size_t i = 0; i < info->params.length(); ++i ) {
-       std::string param_name = info->params[i].name.in();
-       std::string param_value = info->params[i].value.in();   
-       if( param_name == PLUGIN_NAME) {
-         plgId = param_value;
-         break;
-       }
-      }
-      if(plgId.length() > 0 ) {
-       plgId += "::";
+    char buf[20];
+    sprintf( buf, "%d", aBaseObj->GetType() );
+    GEOM::CreationInformationSeq_var infoSeq = aBaseObj->GetCreationInformation();
+    std::string plgId;
+    for ( size_t j = 0; j < infoSeq->length(); ++j )
+      for ( size_t i = 0; i < infoSeq[j].params.length(); ++i ) {
+        std::string param_name  = infoSeq[j].params[i].name.in();
+        std::string param_value = infoSeq[j].params[i].value.in();
+        if( param_name == PLUGIN_NAME) {
+          plgId = param_value;
+          break;
+        }
       }
-      plgId +="ICON_OBJBROWSER_"; 
-      plgId += buf;
-      aResultSO->SetAttrString("AttributePixMap",plgId.c_str());
+    if(plgId.length() > 0 ) {
+      plgId += "::";
+    }
+    plgId +="ICON_OBJBROWSER_";
+    plgId += buf;
+    aResultSO->SetAttrString("AttributePixMap",plgId.c_str());
   } else if ( mytype > USER_TYPE ) {
     char buf[20];
     sprintf( buf, "%d", aBaseObj->GetType() );
@@ -448,7 +452,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr   theStudy,
 
 //============================================================================
 // function : CreateAndPublishGroup
-// purpose  : auxilary for PublishNamedShapesInStudy
+// purpose  : auxiliary for PublishNamedShapesInStudy
 //============================================================================
 void GEOM_Gen_i::CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,
                                        GEOM::GEOM_Object_var theMainShape,
@@ -459,7 +463,7 @@ void GEOM_Gen_i::CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,
                                        GEOM::ListOfGO_var aResList)
 {
   CORBA::String_var entry = theMainShape->GetEntry();
-  //Handle(GEOM_Object) aMainShape = _impl->GetObject(theMainShape->GetStudyID(), entry);
+  //Handle(::GEOM_Object) aMainShape = _impl->GetObject(theMainShape->GetStudyID(), entry);
   Handle(TColStd_HArray1OfInteger) anArray;
   if(SeqS.Length()>0) {
     // create a group
@@ -467,9 +471,9 @@ void GEOM_Gen_i::CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,
     GEOM::GEOM_Object_wrap GrObj = GOp->CreateGroup( theMainShape, SeqS(1).ShapeType() );
     AddInStudy(theStudy, GrObj, GrName, theMainShape._retn());
     //CORBA::String_var GrEntry = GrObj->GetEntry();
-    //Handle(GEOM_Object) HGrObj = _impl->GetObject(GrObj->GetStudyID(), GrEntry);
+    //Handle(::GEOM_Object) HGrObj = _impl->GetObject(GrObj->GetStudyID(), GrEntry);
     // add named objects
-    //Handle(GEOM_Object) anObj;
+    //Handle(::GEOM_Object) anObj;
     for(int i=1; i<=SeqS.Length(); i++) {
       TopoDS_Shape aValue = SeqS.Value(i);
       //anArray = new TColStd_HArray1OfInteger(1,1);
@@ -478,7 +482,7 @@ void GEOM_Gen_i::CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,
       GOp->AddObject(GrObj,anIndex);
       //anObj = GEOM_Engine::GetEngine()->AddObject(aMainShape->GetDocID(), GEOM_SUBSHAPE);
       //if (anObj.IsNull()) continue;
-      //Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOM_Object::GetSubShapeID(), 1);
+      //Handle(::GEOM_Function) aFunction = anObj->AddFunction(GEOM_Object::GetSubShapeID(), 1);
       //if (aFunction.IsNull()) continue;
       //GEOM_ISubShape aSSI(aFunction);
       //aSSI.SetMainShape(aMainShape->GetLastFunction());
@@ -512,7 +516,7 @@ GEOM::ListOfGO* GEOM_Gen_i::
   if(theMainShape->_is_nil()) return aResList._retn();
 
   CORBA::String_var entry = theMainShape->GetEntry();
-  Handle(GEOM_Object) aMainShape = Handle(GEOM_Object)::DownCast
+  Handle(::GEOM_Object) aMainShape = Handle(::GEOM_Object)::DownCast
     ( _impl->GetObject( theMainShape->GetStudyID(), entry ));
   if (aMainShape.IsNull()) return aResList._retn();
   TopoDS_Shape MainSh = aMainShape->GetValue();
@@ -598,7 +602,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
   if (isMultiFile)
     aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
                                                    (theComponent->GetStudy()->URL())).c_str());
-  aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
+  aNameWithExt += TCollection_AsciiString("_GEOM.cbf");
   aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString());
   // Build a full file name of temporary file
   TCollection_AsciiString aFullName = TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt;
@@ -660,11 +664,23 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
   // Prepare a file name to open
   TCollection_AsciiString aNameWithExt("");
   SALOMEDS::Study_var study = theComponent->GetStudy();
-  if (isMultiFile) {
-    CORBA::String_var url = study->URL();
-    aNameWithExt = (char*)SALOMEDS_Tool::GetNameFromPath(url.in()).c_str();
+
+  // Get the file name.
+  int         i;
+  int         aLength  = aSeq->length();
+  const char *aGeomSgd = "_GEOM.sgd";
+  const char *aGeomcbf = "_GEOM.cbf";
+
+  for(i = 0; i < aLength; i++) {
+    std::string aName(aSeq[i]);
+
+    if (aName.rfind(aGeomSgd) != std::string::npos ||
+        aName.rfind(aGeomcbf) != std::string::npos) {
+      aNameWithExt = aName.c_str();
+      break;
+    }
   }
-  aNameWithExt += "_GEOM.sgd";
+
   TCollection_AsciiString aFullName = (TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt);
 
   // Open document
@@ -680,8 +696,8 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
     useCaseBuilder->SetRootCurrent();
     useCaseBuilder->Append( theComponent ); // component object is added as the top level item
   }
-  
-  SALOMEDS::ChildIterator_wrap it = study->NewChildIterator( theComponent ); 
+
+  SALOMEDS::ChildIterator_wrap it = study->NewChildIterator( theComponent );
   for ( it->InitEx(true); it->More(); it->Next() ) {
     if ( !useCaseBuilder->IsUseCaseNode( it->Value() ) ) {
       useCaseBuilder->AppendTo( it->Value()->GetFather(), it->Value() );
@@ -799,8 +815,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
 
 
   //Create a new GEOM_Object
-  Handle(GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID);
-  Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);
+  Handle(::GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID);
+  Handle(::GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);
   aFunction->SetValue(aTopology);
 
   TCollection_AsciiString anEntry;
@@ -903,7 +919,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr     theStudy,
   CORBA::String_var anIORo = _orb->object_to_string(theObject);
   SALOMEDS::SObject_var aSO = theStudy->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();
 
@@ -933,7 +949,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesO (SALOMEDS::Study_ptr     theS
   CORBA::String_var anIORo = _orb->object_to_string(theObject);
   SALOMEDS::SObject_var aSO = theStudy->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();
 
@@ -1017,7 +1033,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr     theStudy,
 {
   GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
   //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(theStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/)
     return aParts._retn();
 
@@ -1118,16 +1134,16 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr     theStudy,
             GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anArgO, theObject);
             if (!CORBA::is_nil(anArgOTrsf)) {
               CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
-              Handle(GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
-              Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
+              Handle(::GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
+              Handle(::GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
               anArgOTrsfFun->SetDescription("");
               aSubO = aShapesOp->GetInPlace(theObject, anArgOTrsf);
             }
             /*
-            Handle(GEOM_Function) anOFun = theObject->GetLastFunction();
+            Handle(::GEOM_Function) anOFun = theObject->GetLastFunction();
             if (!anOFun.IsNull()) {
               CORBA::String_var entryArg = anArgO->GetEntry();
-              Handle(GEOM_Object) anArgOImpl = _impl->GetObject(anArgO->GetStudyID(), entryArg);
+              Handle(::GEOM_Object) anArgOImpl = _impl->GetObject(anArgO->GetStudyID(), entryArg);
               if (!anArgOImpl.IsNull()) {
                 TopoDS_Shape anArgOShape = anArgOImpl->GetValue();
                 TopoDS_Shape aMultiArgShape;
@@ -1162,7 +1178,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr     theStudy,
                   {}
                 }
                 GEOM::GEOM_Object_var anArgOMulti = (aMultiArgShape); // TODO
-                Handle(GEOM_Function) anArgOMultiFun = anArgOMulti->GetLastFunction();
+                Handle(::GEOM_Function) anArgOMultiFun = anArgOMulti->GetLastFunction();
                 anArgOMultiFun->SetDescription("");
                 aSubO = aShapesOp->GetInPlace(theObject, anArgOMulti);
               }
@@ -1313,8 +1329,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr     theStudy,
   aResParts->length(nb);
   if (nb > 0)
   {
-    Handle(GEOM_BaseObject) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
-    Handle(GEOM_Function) aFunction = aMainObj->GetLastFunction();
+    Handle(::GEOM_BaseObject) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+    Handle(::GEOM_Function) aFunction = aMainObj->GetLastFunction();
     GEOM::TPythonDump pd (aFunction, true);
     pd <<"[";
     int i = 0, j = 0;
@@ -1329,8 +1345,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr     theStudy,
       anObjEntryMap.insert(anEntry);
       aResParts[nbRes++] = anObj;
       // clear python dump of object
-      Handle(GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry);
-      Handle(GEOM_Function)   anObjFun = aGeomObj->GetLastFunction();
+      Handle(::GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry);
+      Handle(::GEOM_Function)   anObjFun = aGeomObj->GetLastFunction();
       if ( !anObjFun.IsNull() )
         anObjFun->SetDescription( "" );
       if ( j > 0 )
@@ -1347,7 +1363,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr     theStudy,
       GEOM::GEOM_Object_var anObj = anOutArgs[ i ];
       if (CORBA::is_nil(anObj))
         continue;
-      Handle(GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry());
+      Handle(::GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry());
       if ( j > 0 )
         pd << ", ";
       pd << aGeomObj;
@@ -1439,8 +1455,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr     th
             GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anOldSubO, theNewO);
             if (!CORBA::is_nil(anArgOTrsf)) {
               CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
-              Handle(GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
-              Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
+              Handle(::GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
+              Handle(::GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
               anArgOTrsfFun->SetDescription("");
               aNewSubO = aShapesOp->GetInPlace(theNewO, anArgOTrsf);
             }
@@ -1609,7 +1625,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr     theStu
 {
   GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
   //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(theStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/)
     return aParts._retn();
 
@@ -1715,8 +1731,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr     theStu
             GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anArgO, theObject);
             if (!CORBA::is_nil(anArgOTrsf)) {
               CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
-              Handle(GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
-              Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
+              Handle(::GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
+              Handle(::GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
               anArgOTrsfFun->SetDescription("");
               aSubO = aShapesOp->GetInPlace(theObject, anArgOTrsf);
             }
@@ -1859,8 +1875,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr     theStu
   aResParts->length(nb);
   if (nb > 0)
   {
-    Handle(GEOM_BaseObject) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
-    Handle(GEOM_Function) aFunction = aMainObj->GetLastFunction();
+    Handle(::GEOM_BaseObject) aMainObj = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+    Handle(::GEOM_Function) aFunction = aMainObj->GetLastFunction();
     GEOM::TPythonDump pd (aFunction, true);
     pd <<"[";
     int i = 0, j = 0;
@@ -1875,8 +1891,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr     theStu
       anObjEntryMap.insert(anEntry);
       aResParts[nbRes++] = anObj;
       // clear python dump of object
-      Handle(GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry);
-      Handle(GEOM_Function)   anObjFun = aGeomObj->GetLastFunction();
+      Handle(::GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anEntry);
+      Handle(::GEOM_Function)   anObjFun = aGeomObj->GetLastFunction();
       if ( !anObjFun.IsNull() )
         anObjFun->SetDescription( "" );
       if ( j > 0 )
@@ -1891,7 +1907,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr     theStu
       GEOM::GEOM_Object_var anObj = theArgs[ i ];
       if (CORBA::is_nil(anObj))
         continue;
-      Handle(GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry());
+      Handle(::GEOM_BaseObject) aGeomObj = _impl->GetObject(anObj->GetStudyID(), anObj->GetEntry());
       if ( j > 0 )
         pd << ", ";
       pd << aGeomObj;
@@ -1991,8 +2007,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::Study_ptr
             GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anOldSubO, theNewO);
             if (!CORBA::is_nil(anArgOTrsf)) {
               CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
-              Handle(GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
-              Handle(GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
+              Handle(::GEOM_BaseObject) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
+              Handle(::GEOM_Function) anArgOTrsfFun = anArgOTrsfImpl->GetLastFunction();
               anArgOTrsfFun->SetDescription("");
               aNewSubO = aShapesOp->GetInPlace(theNewO, anArgOTrsf);
             }
@@ -2455,7 +2471,7 @@ GEOM::GEOM_IOperations_ptr GEOM_Gen_i::GetPluginOperations(CORBA::Long theStudyI
       aServant = myOpCreatorMap[aLibName]->Create(_poa, theStudyID, engine, _impl);
       // activate the CORBA servant
       if (aServant)
-       operations = aServant->_this();
+        operations = aServant->_this();
     }
   }
   catch (SALOME_Exception& S_ex) {
@@ -2472,28 +2488,31 @@ GEOM::GEOM_IOperations_ptr GEOM_Gen_i::GetPluginOperations(CORBA::Long theStudyI
 void GEOM_Gen_i::LoadPlugin(const std::string& theLibName)
 {
   std::string aPlatformLibName;
-#ifdef WIN32
-  aPlatformLibName = theLibName;
-  aPlatformLibName += ".dll" ;
-#else
+#if !defined(WIN32)
   aPlatformLibName = "lib";
+#endif
   aPlatformLibName += theLibName;
+#if defined(WIN32)
+  aPlatformLibName += ".dll" ;
+#elif defined(__APPLE__)
+  aPlatformLibName += ".dylib";
+#else
   aPlatformLibName += ".so";
 #endif
-  
+
   // check, if corresponding operations are already created
   if (myOpCreatorMap.find(theLibName) == myOpCreatorMap.end()) {
     // load plugin library
     LibHandle libHandle = LoadLib( aPlatformLibName.c_str() );
     if (!libHandle) {
-      // report any error, if occured
+      // report any error, if occurred
 #ifndef WIN32
       throw(SALOME_Exception(dlerror()));
 #else
       throw(SALOME_Exception(LOCALIZED( "Can't load server geometry plugin library" )));
 #endif
     }
-    
+
     // get method, returning operations creator
     typedef GEOM_GenericOperationsCreator* (*GetOperationsCreator)();
     GetOperationsCreator procHandle =
@@ -2502,7 +2521,7 @@ void GEOM_Gen_i::LoadPlugin(const std::string& theLibName)
       UnLoadLib(libHandle);
       throw(SALOME_Exception(LOCALIZED("bad geometry plugin library")));
     }
-    
+
     // get operations creator
     GEOM_GenericOperationsCreator* aCreator = procHandle();
     if (aCreator) {
@@ -2526,14 +2545,14 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr   theMainSh
   if (CORBA::is_nil(theMainShape) || theIndices.length() < 1)
     return GEOM::GEOM_Object::_nil();
   CORBA::String_var entry = theMainShape->GetEntry();
-  Handle(GEOM_Object) aMainShape = Handle(GEOM_Object)::DownCast
+  Handle(::GEOM_Object) aMainShape = Handle(::GEOM_Object)::DownCast
     ( _impl->GetObject( theMainShape->GetStudyID(), entry ));
   if (aMainShape.IsNull()) return GEOM::GEOM_Object::_nil();
 
   Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length());
-  for(Standard_Integer i = 0; i<theIndices.length(); i++) anArray->SetValue(i+1, theIndices[i]);
+  for(CORBA::ULong i = 0; i<theIndices.length(); i++) anArray->SetValue(i+1, theIndices[i]);
 
-  Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainShape, anArray, true);
+  Handle(::GEOM_Object) anObject = _impl->AddSubShape(aMainShape, anArray, true);
   if(anObject.IsNull()) return GEOM::GEOM_Object::_nil();
 
   TCollection_AsciiString anEntry;
@@ -2549,7 +2568,7 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr   theMainSh
 void GEOM_Gen_i::RemoveObject(GEOM::GEOM_BaseObject_ptr theObject)
 {
   CORBA::String_var anEntry = theObject->GetEntry();
-  Handle(GEOM_BaseObject) anObject = _impl->GetObject(theObject->GetStudyID(), anEntry, false);
+  Handle(::GEOM_BaseObject) anObject = _impl->GetObject(theObject->GetStudyID(), anEntry, false);
   if (!anObject.IsNull())
     _impl->RemoveObject(anObject);
 }
@@ -2584,7 +2603,7 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::GetIORFromString(const char* stringIOR) {
 GEOM::GEOM_BaseObject_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const char* theEntry)
 {
   GEOM::GEOM_BaseObject_var obj;
-  Handle(GEOM_BaseObject) handle_object = _impl->GetObject(theStudyID, (char*)theEntry);
+  Handle(::GEOM_BaseObject) handle_object = _impl->GetObject(theStudyID, (char*)theEntry);
   if (handle_object.IsNull()) return obj._retn();
 
   TCollection_AsciiString stringIOR = handle_object->GetIOR();
@@ -2599,12 +2618,12 @@ GEOM::GEOM_BaseObject_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const c
   GEOM_BaseObject_i* servant = 0;
   switch( handle_object->GetType() ) {
   case GEOM_FIELD: {
-    servant = new GEOM_Field_i (_poa, engine, Handle(GEOM_Field)::DownCast( handle_object ));
+    servant = new GEOM_Field_i (_poa, engine, Handle(::GEOM_Field)::DownCast( handle_object ));
     break;
   }
   case GEOM_FIELD_STEP: {
-    Handle(GEOM_FieldStep) step = Handle(GEOM_FieldStep)::DownCast( handle_object );
-    Handle(GEOM_Field)    field = step->GetField();
+    Handle(::GEOM_FieldStep) step = Handle(::GEOM_FieldStep)::DownCast( handle_object );
+    Handle(::GEOM_Field)    field = step->GetField();
     int type = ( !field.IsNull() ? field->GetDataType() : 0 );
     switch( type ) {
     case GEOM::FDT_Bool:
@@ -2622,7 +2641,7 @@ GEOM::GEOM_BaseObject_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const c
     break;
   }
   default:
-    servant = new GEOM_Object_i (_poa, engine, Handle(GEOM_Object)::DownCast( handle_object ));
+    servant = new GEOM_Object_i (_poa, engine, Handle(::GEOM_Object)::DownCast( handle_object ));
   }
   PortableServer::ObjectId_var id = _poa->activate_object(servant);
 
@@ -2782,8 +2801,9 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry)
     }
   }
 
-  char* anInfo = new char[strlen("Module ") + strlen(ComponentDataType()) + strlen(", ") + strlen(aTypeInfo) + 3];
-  sprintf(anInfo, "Module %s, %s", ComponentDataType(), aTypeInfo);
+  CORBA::String_var compType = ComponentDataType();
+  char* anInfo = new char[strlen("Module ") + strlen(compType.in()) + strlen(", ") + strlen(aTypeInfo) + 3];
+  sprintf(anInfo, "Module %s, %s", compType.in(), aTypeInfo);
 
   char* ret = CORBA::string_dup(anInfo);
   delete [] anInfo;
@@ -2804,8 +2824,8 @@ char* GEOM_Gen_i::getVersion()
 // function : CreateFolder()
 // purpose  : Creates and returns a new folder object
 //=================================================================================
-SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName, 
-                                              SALOMEDS::SObject_ptr theFather)
+SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
+                                               SALOMEDS::SObject_ptr theFather)
 {
   SALOMEDS::SObject_var aFolderSO;
 
@@ -2857,8 +2877,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
 // function : MoveToFolder()
 // purpose  : Moves GEOM object to the specified folder
 //=================================================================================
-void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject, 
-                             SALOMEDS::SObject_ptr theFolder) {
+void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject,
+                              SALOMEDS::SObject_ptr theFolder) {
   GEOM::object_list_var objects = new GEOM::object_list();
   objects->length( 1 );
   SALOMEDS::SObject_var aSO = theFolder->GetStudy()->FindObjectID( theObject->GetStudyEntry() );
@@ -2870,8 +2890,8 @@ void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject,
 // function : MoveListToFolder()
 // purpose  : Moves list of GEOM objects to the specified folder
 //=================================================================================
-void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO, 
-                                  SALOMEDS::SObject_ptr theFolder) {
+void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
+                                   SALOMEDS::SObject_ptr theFolder) {
   int aLen = theListOfGO.length();
   GEOM::object_list_var objects = new GEOM::object_list();
   objects->length( aLen );
@@ -2888,12 +2908,12 @@ void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
 
 //=================================================================================
 // function : Move()
-// purpose  : Moves objects to the specified position. 
+// purpose  : Moves objects to the specified position.
 //            Is used in the drag-n-drop functionality.
 //=================================================================================
 void GEOM_Gen_i::Move( const GEOM::object_list& what,
-                      SALOMEDS::SObject_ptr where,
-                      CORBA::Long row )
+                       SALOMEDS::SObject_ptr where,
+                       CORBA::Long row )
 {
   if ( CORBA::is_nil( where ) ) return;
 
@@ -2903,7 +2923,7 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what,
   SALOMEDS::SComponent_var father = where->GetFatherComponent();
   std::string dataType = father->ComponentDataType();
   if ( dataType != "GEOM" ) return; // not a GEOM component
-  
+
   SALOMEDS::SObject_var objAfter;
   if ( row >= 0 && useCaseBuilder->HasChildren( where ) ) {
     // insert at given row -> find insertion position
@@ -2914,8 +2934,8 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what,
       objAfter = useCaseIt->Value();
     }
   }
-  
-  for ( int i = 0; i < what.length(); i++ ) {
+
+  for ( CORBA::ULong i = 0; i < what.length(); i++ ) {
     SALOMEDS::SObject_var sobj = what[i];
     if ( CORBA::is_nil( sobj ) ) continue; // skip bad object
     // insert the object to the use case tree
@@ -2926,160 +2946,17 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what,
   }
 }
 
-//=================================================================================
-// function : importData
-// purpose  : imports geometrical data file into the GEOM internal data structure
-//=================================================================================
-Engines::ListOfIdentifiers* GEOM_Gen_i::importData(
-  CORBA::Long studyId, Engines::DataContainer_ptr data, const Engines::ListOfOptions& options)
-{
-  CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" );
-  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
-  SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId );
-
-  Engines::ListOfIdentifiers_var aResult = new Engines::ListOfIdentifiers;
-  GEOM::GEOM_IInsertOperations_var aInsOp = GetIInsertOperations(aStudy->StudyId());
-  if (aInsOp->_is_nil()) {
-    MESSAGE("No insert operations!");
-    return aResult._retn();
-  }
-
-  // Get a temporary directory to store a file
-  std::string aTmpDir = SALOMEDS_Tool::GetTmpDir();
-  std::string aFileName("file");
-  if (aFileName.rfind("/") != std::string::npos) { // remove folders from the name
-    aFileName = aFileName.substr(aFileName.rfind("/") + 1);
-  }
-
-  std::string anExtension(data->extension());
-  aFileName += "." + anExtension;
-  // convert extension to upper case
-  std::transform(anExtension.begin(), anExtension.end(), anExtension.begin(), ::toupper);
-  std::string aFullPath = aTmpDir + aFileName;
-
-  Engines::TMPFile* aFileStream = data->get();
-  const char *aBuffer = (const char*)aFileStream->NP_data();
-#ifdef WIN32
-  std::ofstream aFile(aFullPath.c_str(), std::ios::binary);
-#else
-  std::ofstream aFile(aFullPath.c_str());
-#endif
-  aFile.write(aBuffer, aFileStream->length());
-  aFile.close();
-
-  GEOM::ListOfGBO_var aObjects = aInsOp->ImportFile(aFullPath.c_str(), "XAO");
-
-  if ( aObjects->length() > 0 && aInsOp->IsDone() ) {
-    aResult->length(aObjects->length());
-    // publish main object (first in the list of returned geom objects)
-    CORBA::String_var aName = aObjects[0]->GetName();
-    SALOMEDS::SObject_var aSO = PublishInStudy(aStudy.in(), SALOMEDS::SObject::_nil(), aObjects[0].in(), aName.in());
-    aResult[0] = aSO->GetID();
-    // publish groups && fields
-    for (int i = 1; i < aObjects->length(); i++ ) {
-      aName = aObjects[i]->GetName();
-      aSO = AddInStudy(aStudy.in(), aObjects[0].in(), aName.in(), aObjects[0].in());
-      aResult[i] = aSO->GetID();
-    }
-  }
-  else {
-    if (aObjects->length() == 0)
-      MESSAGE("ImportXAO operation is failed for file "<<aFullPath.c_str());
-    if (!aInsOp->IsDone())
-      MESSAGE("Import operation is not done for file "<<aFullPath.c_str());
-    return aResult._retn();
-  }
-
-  // remove temporary file and directory
-  SALOMEDS::ListOfFileNames aTmpFiles;
-  aTmpFiles.length(1);
-  aTmpFiles[0] = aFileName.c_str();
-  SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aTmpFiles, true);
-
-  _impl->DocumentModified(studyId, false);
-  return aResult._retn();
-}
-
-//=================================================================================
-// function : getModifiedData
-// purpose  : exports all geometry of this GEOM module into one BRep file
-//=================================================================================
-Engines::ListOfData* GEOM_Gen_i::getModifiedData(CORBA::Long studyId)
-{
-  Engines::ListOfData_var aResult = new Engines::ListOfData;
-
-  if (!_impl->DocumentModified(studyId)) {
-    MESSAGE("Document is not modified")
-    return aResult._retn();
-  }
-
-  CORBA::Object_var aSMObject = name_service->Resolve("/myStudyManager");
-  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
-  if (CORBA::is_nil(aStudyManager))
-    return aResult._retn();
-  SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId );
-  if (CORBA::is_nil(aStudy))
-    return aResult._retn();
-  SALOMEDS::SComponent_var aComponent = aStudy->FindComponent("GEOM");
-  if (CORBA::is_nil(aComponent))
-    return aResult._retn();
-  SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(aComponent); // check only published shapes
-
-  GEOM::GEOM_IInsertOperations_var aInsOp    = GetIInsertOperations(aStudy->StudyId());
-  if (aInsOp->_is_nil()) {
-    MESSAGE("No insert operations!");
-    return aResult._retn();
-  }
-
-  GEOM::GEOM_Object_var shapeObj;
-  
-  for(; anIter->More(); anIter->Next()) {
-    SALOMEDS::SObject_var aSO = anIter->Value();
-    SALOMEDS::SObject_var aRefSO;
-    // export only not referenced objects, or referenced outside of GEOM
-    if (!aSO->ReferencedObject(aRefSO) || aRefSO->GetFatherComponent()->GetID() != aComponent->GetID()) {
-      CORBA::Object_var anObj = aSO->GetObject();
-      if (!CORBA::is_nil(anObj)) {
-        GEOM::GEOM_Object_var aCORBAMainShape = GEOM::GEOM_Object::_narrow(anObj);
-        if(!aCORBAMainShape->_is_nil()) {
-          CORBA::String_var entry = aCORBAMainShape->GetEntry();
-          Handle(GEOM_Object) aMainShape = Handle(GEOM_Object)::DownCast(_impl->GetObject(studyId, entry));
-
-          GEOM::shape_type aCORBAShapeType = aCORBAMainShape->GetShapeType();
-          if (!aMainShape.IsNull() && !(aCORBAShapeType == GEOM::VERTEX) && !(aCORBAShapeType == GEOM::EDGE)) {
-            shapeObj = aCORBAMainShape;
-            break;
-          }
-        }
-      }
-    }
-  }
-
-  if (!CORBA::is_nil(shapeObj)) { // Shape is correct, write it to the temporary file
-    std::string aPath = Kernel_Utils::GetTmpFileName() + ".xao";
-    aInsOp->Export(shapeObj.in(), aPath.c_str(), "XAO");
-    aResult->length(1);
-    Engines::DataContainer_var aData = (new Engines_DataContainer_i(
-                    aPath.c_str(), "", "", true))->_this();
-    aResult[0] = aData;
-  } else {
-    MESSAGE("No shapes to export");
-  }
-
-  return aResult._retn();
-}
-                                                               
 //=======================================================================
 // function : GetDependencyTree
 // purpose  : Collects dependencies of the given objects from other ones
 //=======================================================================
 SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
-                                                 const GEOM::string_array& theObjectEntries ) {
+                                                  const GEOM::string_array& theObjectEntries ) {
   // fill in the tree structure
   GEOMUtils::TreeModel tree;
 
   std::string entry;
-  for ( int i = 0; i < theObjectEntries.length(); i++ ) {
+  for ( CORBA::ULong i = 0; i < theObjectEntries.length(); i++ ) {
     // process objects one-by-one
     entry = theObjectEntries[i].in();
     GEOM::GEOM_BaseObject_var anObj = GetObject( theStudy->StudyId(), entry.c_str() );
@@ -3098,7 +2975,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
   // translation the tree into string
   std::string treeStr;
   GEOMUtils::ConvertTreeToString( tree, treeStr );
-  
+
   // put string into stream
   char* aBuffer = (char*)CORBA::string_dup(treeStr.c_str());
   int aBufferSize = strlen((char*)aBuffer);
@@ -3114,33 +2991,33 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
 // function : getUpwardDependency
 // purpose  : Collects the entries of objects on that the given one depends
 //=======================================================================
-void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo, 
-                                     GEOMUtils::LevelsList &upLevelList, 
-                                     std::map< std::string, std::set<std::string> > &passedEntries,
-                                     int level ) {
+void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+                                      GEOMUtils::LevelsList &upLevelList,
+                                      std::map< std::string, std::set<std::string> > &passedEntries,
+                                      int level ) {
   std::string aGboEntry = gbo->GetEntry();
   GEOMUtils::NodeLinks anEntries;
   GEOMUtils::LevelInfo aLevelMap;
   if ( level > 0 ) {
-    if ( level-1 >= upLevelList.size() ) {
+    if ( level-1 >= (int)upLevelList.size() ) {
       // create a new map
       upLevelList.push_back( aLevelMap );
     } else {
       // get the existent map
       aLevelMap = upLevelList.at(level-1);
       if ( aLevelMap.count( aGboEntry ) > 0 ) {
-       anEntries = aLevelMap[ aGboEntry ];
+        anEntries = aLevelMap[ aGboEntry ];
       }
     }
   }
   // get objects on that the current one depends
   GEOM::ListOfGBO_var depList = gbo->GetDependency();
   std::string aDepEntry;
-  for( int j = 0; j < depList->length(); j++ ) {
+  for( CORBA::ULong j = 0; j < depList->length(); j++ ) {
     if ( depList[j]->_is_nil() )
       continue;
     aDepEntry = depList[j]->GetEntry();
-    if ( passedEntries.count( aGboEntry ) > 0 && 
+    if ( passedEntries.count( aGboEntry ) > 0 &&
          passedEntries[aGboEntry].count( aDepEntry ) > 0 ) {
       //avoid checking the passed objects
       continue;
@@ -3162,14 +3039,14 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
 // function : getDownwardDependency
 // purpose  : Collects the entries of objects that depends on the given one
 //=======================================================================
-void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo, 
-                                       GEOMUtils::LevelsList &downLevelList, 
-                                       std::map< std::string, std::set<std::string> > &passedEntries,
-                                       int level ) {
+void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+                                        GEOMUtils::LevelsList &downLevelList,
+                                        std::map< std::string, std::set<std::string> > &passedEntries,
+                                        int level ) {
   std::string aGboEntry = gbo->GetEntry();
   Handle(TDocStd_Document) aDoc = GEOM_Engine::GetEngine()->GetDocument(gbo->GetStudyID());
   Handle(TDataStd_TreeNode) aNode, aRoot;
-  Handle(GEOM_Function) aFunction;
+  Handle(::GEOM_Function) aFunction;
   if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
     // go through the whole OCAF tree
     TDataStd_ChildNodeIterator Itr( aRoot );
@@ -3192,12 +3069,12 @@ void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
         continue;
       std::string aGoEntry = geomObj->GetEntry();
       // go through dependencies of current object to check whether it depends on the given object
-      for( int i = 0; i < depList->length(); i++ ) {
+      for( CORBA::ULong i = 0; i < depList->length(); i++ ) {
         if ( depList[i]->_is_nil() )
           continue;
         if ( depList[i]->_is_equivalent( gbo ) ) {
           // yes, the current object depends on the given object
-          if ( passedEntries.count( aGoEntry ) > 0 && 
+          if ( passedEntries.count( aGoEntry ) > 0 &&
                passedEntries[aGoEntry].count( aGboEntry ) > 0 ) {
             //avoid checking the passed objects
             continue;
@@ -3206,7 +3083,7 @@ void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
           GEOMUtils::NodeLinks anEntries;
           GEOMUtils::LevelInfo aLevelMap;
           anEntries.push_back( aGboEntry );
-          if ( level >= downLevelList.size() ) {
+          if ( level >= (int)downLevelList.size() ) {
             downLevelList.push_back( aLevelMap );
           } else {
             aLevelMap = downLevelList.at(level);
@@ -3230,19 +3107,19 @@ void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
 // purpose  : Fills 3 lists that is used to clean study of redundant objects
 //==============================================================================
 void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
-                                       GEOM::string_array& theSelectedEntries,
-                                       GEOM::string_array& theParentEntries,
-                                       GEOM::string_array& theSubEntries,
-                                       GEOM::string_array& theOtherEntries)
+                                         GEOM::string_array& theSelectedEntries,
+                                         GEOM::string_array& theParentEntries,
+                                         GEOM::string_array& theSubEntries,
+                                         GEOM::string_array& theOtherEntries)
 {
   std::set<std::string> aSelected, aParents, aChildren, anOthers;
-  for ( int i = 0; i < theSelectedEntries.length(); i++ ) {
+  for ( CORBA::ULong i = 0; i < theSelectedEntries.length(); i++ ) {
     aSelected.insert( CORBA::string_dup( theSelectedEntries[i] ) );
   }
 
   Handle(TDocStd_Document) aDoc = GEOM_Engine::GetEngine()->GetDocument(theStudy->StudyId());
   Handle(TDataStd_TreeNode) aNode, aRoot;
-  Handle(GEOM_Function) aFunction;
+  Handle(::GEOM_Function) aFunction;
   if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
     // go through the whole OCAF tree
     TDF_Label aLabel;
@@ -3267,7 +3144,7 @@ void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
       if ( aSelected.count( anEntry ) > 0 &&
            aParents.count( anEntry ) == 0 ) {
         includeParentDependencies( geomObj, aSelected, aParents, aChildren, anOthers );
-      } else if ( aParents.count( anEntry ) == 0 && 
+      } else if ( aParents.count( anEntry ) == 0 &&
                   aChildren.count( anEntry ) == 0 ) {
         anOthers.insert( geomObj->GetEntry() );
       }
@@ -3284,11 +3161,11 @@ void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
     }
 
     // if some selected object is not a main shape,
-    // we move it's main shapes into 'selected' list, 
+    // we move it's main shapes into 'selected' list,
     // because they could not be modified anyhow.
     std::set<std::string> aToBeInSelected;
     for ( it = aSelected.begin(); it != aSelected.end(); ++it ) {
-      Handle(GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), (*it).c_str(), false);
+      Handle(::GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), (*it).c_str(), false);
       if ( handle_object.IsNull() )
         continue;
 
@@ -3337,13 +3214,13 @@ void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
 
 //==============================================================================
 // function : includeParentDependencies
-// purpose  : 
+// purpose  :
 //==============================================================================
 void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj,
-                                          std::set<std::string>& aSelected,
-                                          std::set<std::string>& aParents,
-                                          std::set<std::string>& aChildren,
-                                          std::set<std::string>& anOthers)
+                                           std::set<std::string>& aSelected,
+                                           std::set<std::string>& aParents,
+                                           std::set<std::string>& aChildren,
+                                           std::set<std::string>& anOthers)
 {
   std::string anEntry = geomObj->GetEntry();
   if ( aSelected.count( anEntry ) == 0 ) {
@@ -3362,13 +3239,13 @@ void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj,
     return;
   // go through dependencies of current object to check whether it depends on the given object
   std::string aDepEntry;
-  for( int i = 0; i < depList->length(); i++ ) {
+  for( CORBA::ULong i = 0; i < depList->length(); i++ ) {
     aDepEntry = depList[i]->GetEntry();
     if ( depList[i]->_is_nil() ||
-        aDepEntry == anEntry ||             // skip self-depending
-        aSelected.count( aDepEntry ) > 0 || // skip selected objects
-        aParents.count( aDepEntry ) > 0     // skip already processed objects
-        )
+         aDepEntry == anEntry ||             // skip self-depending
+         aSelected.count( aDepEntry ) > 0 || // skip selected objects
+         aParents.count( aDepEntry ) > 0     // skip already processed objects
+         )
       continue;
     includeParentDependencies( depList[i], aSelected, aParents, aChildren, anOthers );
   }
@@ -3376,21 +3253,21 @@ void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj,
 
 //==============================================================================
 // function : includeSubObjects
-// purpose  : 
+// purpose  :
 //==============================================================================
 void GEOM_Gen_i::includeSubObjects(SALOMEDS::Study_ptr theStudy,
-                                  const std::string& aSelectedEntry,
-                                  std::set<std::string>& aSelected,
-                                  std::set<std::string>& aParents,
-                                  std::set<std::string>& aChildren,
-                                  std::set<std::string>& anOthers)
+                                   const std::string& aSelectedEntry,
+                                   std::set<std::string>& aSelected,
+                                   std::set<std::string>& aParents,
+                                   std::set<std::string>& aChildren,
+                                   std::set<std::string>& anOthers)
 {
   std::set<std::string>::iterator foundIt;
-  Handle(GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), aSelectedEntry.c_str(), false);
+  Handle(::GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), aSelectedEntry.c_str(), false);
   if ( handle_object.IsNull() )
     return;
 
-  Handle(GEOM_Function) aShapeFun = handle_object->GetFunction(1);
+  Handle(::GEOM_Function) aShapeFun = handle_object->GetFunction(1);
   if ( aShapeFun.IsNull() || !aShapeFun->HasSubShapeReferences() )
     return;
 
@@ -3408,10 +3285,10 @@ void GEOM_Gen_i::includeSubObjects(SALOMEDS::Study_ptr theStudy,
     if ( foundIt == aParents.end() ) { // add to sub-objects if it is not in parents list
       foundIt = aSelected.find( aSubEntryStr );
       if ( foundIt == aSelected.end() ) { // add to sub-objects if it is not in selected list
-           aChildren.insert( aSubEntryStr );
-           foundIt = anOthers.find( aSubEntryStr );
-           if ( foundIt != anOthers.end() )
-             anOthers.erase( foundIt );
+            aChildren.insert( aSubEntryStr );
+            foundIt = anOthers.find( aSubEntryStr );
+            if ( foundIt != anOthers.end() )
+              anOthers.erase( foundIt );
       }
     }
     includeSubObjects( theStudy, aSubEntryStr, aSelected, aParents, aChildren, anOthers );