]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Deleted Study as an input parameter and as a class field.
authormpa <mpa@opencascade.com>
Tue, 31 Jan 2017 09:27:37 +0000 (12:27 +0300)
committermpa <mpa@opencascade.com>
Tue, 31 Jan 2017 09:27:37 +0000 (12:27 +0300)
src/DisplayGUI/DisplayGUI.cxx
src/GEOMGUI/GEOMGUI_Selection.cxx
src/GEOMGUI/GeometryGUI.cxx
src/GEOMToolsGUI/GEOMToolsGUI.cxx
src/GEOMToolsGUI/GEOMToolsGUI.h
src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.cxx
src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.h
src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.cxx
src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.h
src/GEOM_I/GEOM_Gen_i.cc
src/GEOM_PY/structelem/__init__.py

index 0552e358882d61682b8cfa23a4e2bec30433b5fb..19339c6ea1399894a6038d7a93ecdedcbdc4e554 100644 (file)
@@ -180,12 +180,7 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
 //=====================================================================================
 void DisplayGUI::DisplayAll()
 {
-  SalomeApp_Application* app = getGeometryGUI()->getApp();
-  if ( !app ) return;
-
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
-  if ( !appStudy ) return;
-  _PTR(Study) aStudy = appStudy->studyDS();
+  _PTR(Study) aStudy = SalomeApp_Application::getStudy();
   if ( !aStudy ) return;
   _PTR(SComponent) SC ( aStudy->FindComponent( "GEOM" ) );
   if ( !SC )
index 51fd1788927a8f834e3b52c82f085532a9bff0b2..291be2e156d9b18d9834938d038944fde388eba1 100644 (file)
@@ -529,7 +529,7 @@ bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj )
 {
   if ( obj ) {
     // as soon as Use Case browser data tree was added
-    return obj->GetStudy()->GetUseCaseBuilder()->HasChildren( obj );
+    return SalomeApp_Application::getStudy()->GetUseCaseBuilder()->HasChildren( obj );
   }
 }
 
@@ -592,8 +592,8 @@ int GEOMGUI_Selection::nbChildren( const int index ) const
     _PTR(Study) study = appStudy->studyDS();
     if ( study && !anEntry.isEmpty() ) {
       _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
-      if ( aSO && aSO->GetStudy()->GetUseCaseBuilder()->IsUseCaseNode(aSO) ) {
-        _PTR(UseCaseIterator) it = aSO->GetStudy()->GetUseCaseBuilder()->GetUseCaseIterator( aSO ); 
+      if ( aSO && study->GetUseCaseBuilder()->IsUseCaseNode(aSO) ) {
+        _PTR(UseCaseIterator) it = study->GetUseCaseBuilder()->GetUseCaseIterator( aSO );
         for (it->Init(false); it->More(); it->Next()) nb++;
       }
     }
index 94325cb09216284a5ecdb686baeffc7f1736dbe4..09ef1e3493d2818976412d570f15dd05a75c0cc2 100644 (file)
@@ -3399,7 +3399,7 @@ bool GeometryGUI::isDraggable( const SUIT_DataObject* what ) const
       _PTR(SObject) aSO = dataObj->object();
       if ( aSO ) {
         _PTR(GenericAttribute) anAttr;
-        _PTR(SObject) aFatherSO = aSO->GetStudy()->GetUseCaseBuilder()->GetFather( aSO );
+        _PTR(SObject) aFatherSO = SalomeApp_Application::getStudy()->GetUseCaseBuilder()->GetFather( aSO );
         if ( aFatherSO && aFatherSO->FindAttribute(anAttr, "AttributeLocalID") ) {
           _PTR(AttributeLocalID) aLocalID( anAttr );
           anObjectInFolder = aLocalID->Value() == 999;
@@ -3476,7 +3476,7 @@ void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* wher
   _PTR(SObject) parentObj = dataObj->object();
 
   // Find the current Study and StudyBuilder
-  _PTR(Study) aStudy = parentObj->GetStudy();
+  _PTR(Study) aStudy = SalomeApp_Application::getStudy();
   _PTR(UseCaseBuilder) aUseCaseBuilder = aStudy->GetUseCaseBuilder();
   // collect all parents of the target node
   QStringList parentIDs;
index f5a2dd843a4141a177b041be1ce41b5be1dad843..a578fde6d17a015b873c51f46910c1602ea3f82c 100644 (file)
@@ -80,8 +80,9 @@ static QString getParentComponent( _PTR( SObject ) obj )
 // purpose  : check if the object(s) passed as the the second arguments are used
 //            by the other objects in the study
 //=====================================================================================
-static bool inUse( _PTR(Study) study, const QString& component, const QMap<QString,QString>& objects )
+static bool inUse( const QString& component, const QMap<QString,QString>& objects )
 {
+  _PTR(Study) study = SalomeApp_Application::getStudy();
   _PTR(SObject) comp = study->FindObjectID( component.toLatin1().data() );
   if ( !comp )
     return false;
@@ -154,7 +155,7 @@ static void getGeomChildrenAndFolders( _PTR(SObject) theSO,
                                        QMap<QString,QString>& geomObjList, 
                                        QMap<QString,QString>& folderList ) {
   if ( !theSO ) return;
-  _PTR(Study) aStudy = theSO->GetStudy();
+  _PTR(Study) aStudy = SalomeApp_Application::getStudy();
   if ( !aStudy ) return;
   _PTR(UseCaseBuilder) aUseCaseBuilder = aStudy->GetUseCaseBuilder();
 
@@ -355,8 +356,7 @@ void GEOMToolsGUI::OnEditDelete()
     return;
 
   LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
-  if ( !aSelMgr || !appStudy )
+  if ( !aSelMgr )
     return;
 
   // get selection
@@ -364,7 +364,7 @@ void GEOMToolsGUI::OnEditDelete()
   if ( selected.IsEmpty() )
     return;
 
-  _PTR(Study) aStudy = appStudy->studyDS();
+  _PTR(Study) aStudy = SalomeApp_Application::getStudy();
   _PTR(UseCaseBuilder) aUseCaseBuilder = aStudy->GetUseCaseBuilder();
 
   // check if study is locked
@@ -469,7 +469,7 @@ void GEOMToolsGUI::OnEditDelete()
     for ( it->InitEx( false ); it->More(); it->Next() ) {
       _PTR(SObject) child( it->Value() );
       // remove object from GEOM engine
-      removeObjectWithChildren( child, aStudy, views, disp );
+      removeObjectWithChildren( child, views, disp );
       // remove object from study
       aStudyBuilder->RemoveObjectWithChildren( child );
       // remove object from use case tree
@@ -478,7 +478,7 @@ void GEOMToolsGUI::OnEditDelete()
   }
   else {
     // GEOM component is not selected: check if selected objects are in use
-    if ( inUse( aStudy, geomComp, allDeleted ) && 
+    if ( inUse( geomComp, allDeleted ) &&
          SUIT_MessageBox::question( app->desktop(),
                                     QObject::tr("WRN_WARNING"),
                                     QObject::tr("DEP_OBJECT"),
@@ -491,7 +491,7 @@ void GEOMToolsGUI::OnEditDelete()
     for ( it = toBeDeleted.begin(); it != toBeDeleted.end(); ++it ) {
       _PTR(SObject) obj ( aStudy->FindObjectID( it.key().toLatin1().data() ) );
       // remove object from GEOM engine
-      removeObjectWithChildren( obj, aStudy, views, disp );
+      removeObjectWithChildren( obj, views, disp );
       // remove objects from study
       aStudyBuilder->RemoveObjectWithChildren( obj );
       // remove object from use case tree
@@ -501,7 +501,7 @@ void GEOMToolsGUI::OnEditDelete()
     for ( it = toBeDelFolders.begin(); it != toBeDelFolders.end(); ++it ) {
       _PTR(SObject) obj ( aStudy->FindObjectID( it.key().toLatin1().data() ) );
       // remove object from GEOM engine
-      removeObjectWithChildren( obj, aStudy, views, disp );
+      removeObjectWithChildren( obj, views, disp );
       // remove objects from study
       aStudyBuilder->RemoveObjectWithChildren( obj );
       // remove object from use case tree
@@ -520,15 +520,15 @@ void GEOMToolsGUI::OnEditDelete()
 // purpose  : used by OnEditDelete() method
 //=====================================================================================
 void GEOMToolsGUI::removeObjectWithChildren(_PTR(SObject) obj,
-                                            _PTR(Study) aStudy,
                                             QList<SALOME_View*> views,
                                             GEOM_Displayer* disp)
 {
+  _PTR(Study) aStudy = SalomeApp_Application::getStudy();
   // iterate through all children of obj
   for (_PTR(ChildIterator) it (aStudy->NewChildIterator(obj)); it->More(); it->Next()) {
   // for (_PTR(UseCaseIterator) it (aStudy->GetUseCaseBuilder()->GetUseCaseIterator(obj)); it->More(); it->Next()) {
     _PTR(SObject) child (it->Value());
-    removeObjectWithChildren(child, aStudy, views, disp);
+    removeObjectWithChildren(child, views, disp);
   }
 
   // erase object and remove it from engine
index c01c580d685375cdacff806cb07e8ed06437b3f2..23557233b8e01677b811d8fa11d7332895c138fa 100644 (file)
@@ -97,7 +97,6 @@ private:
 
   // Recursive deletion of object with children
   void         removeObjectWithChildren( _PTR(SObject),
-                                         _PTR(Study),
                                          QList<SALOME_View*>,
                                          GEOM_Displayer* );
 };
index a6715a0ed57624992b224d48056723e0e81bf753..691a5b7e3703223726c90da82c59c45bbb98d46a 100644 (file)
@@ -185,15 +185,7 @@ void GEOMToolsGUI_PublishDlg::initData() {
   if(!myGeomRoot)
     return;
 
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
-  if(!appStudy ) 
-    return;
-
-  _PTR(Study) aStudy = appStudy->studyDS();
-  if(!aStudy)
-    return;
-
-  buildTree(aStudy, myGeomRoot);
+  buildTree(myGeomRoot);
 
   myTreeWidget->resizeColumnToContents(0);
   myTreeWidget->resizeColumnToContents(1);
@@ -231,7 +223,7 @@ QTreeWidgetItem* GEOMToolsGUI_PublishDlg::createItem(QTreeWidgetItem* theParent,
 // function : findParentItem()
 // purpose  :
 //=================================================================================
-QTreeWidgetItem* GEOMToolsGUI_PublishDlg::findParentItem(_PTR(Study) theStudy, SalomeApp_DataObject* theObject, BufferedList& theList ) {
+QTreeWidgetItem* GEOMToolsGUI_PublishDlg::findParentItem(SalomeApp_DataObject* theObject, BufferedList& theList ) {
   
   QTreeWidgetItem* aResult = NULL;
   SalomeApp_DataObject* aParrent = dynamic_cast<SalomeApp_DataObject*>(theObject->parent());
@@ -240,14 +232,14 @@ QTreeWidgetItem* GEOMToolsGUI_PublishDlg::findParentItem(_PTR(Study) theStudy, S
     if( !(aResult = myEntryToItem.value(targetEntry)) ) {
       if( aParrent != myGeomRoot ) {
         QString aName;
-        _PTR(SObject) aSO ( theStudy->FindObjectID(qPrintable(aParrent->entry())));
+        _PTR(SObject) aSO ( SalomeApp_Application::getStudy()->FindObjectID(qPrintable(aParrent->entry())));
         _PTR(GenericAttribute) anAttr;
         if ( aSO->FindAttribute(anAttr, "AttributeName") ) {
           _PTR(AttributeName) anAttrName (anAttr);
           aName = anAttrName->Value().c_str();
         }
         theList.push_front(qMakePair(targetEntry, aName));
-        aResult = findParentItem(theStudy,aParrent,theList);
+        aResult = findParentItem(aParrent,theList);
       } else {
         //Publish List
         for(int i = 0; i < theList.size(); i++ ) {
@@ -270,7 +262,7 @@ QTreeWidgetItem* GEOMToolsGUI_PublishDlg::findParentItem(_PTR(Study) theStudy, S
 // function : buildTree()
 // purpose  :
 //=================================================================================
-void GEOMToolsGUI_PublishDlg::buildTree(_PTR(Study) theStudy, SalomeApp_DataObject* theItem) {
+void GEOMToolsGUI_PublishDlg::buildTree(SalomeApp_DataObject* theItem) {
   if(!theItem || theItem->isReference())
     return;
   
@@ -278,7 +270,7 @@ void GEOMToolsGUI_PublishDlg::buildTree(_PTR(Study) theStudy, SalomeApp_DataObje
 
     //If object hasn't "AttributeDrawable" => it visible
     bool isDrawable = true;
-    _PTR(SObject) SO ( theStudy->FindObjectID(qPrintable(theItem->entry())));
+    _PTR(SObject) SO ( SalomeApp_Application::getStudy()->FindObjectID(qPrintable(theItem->entry())));
     _PTR(GenericAttribute) anAttr;
     if ( SO && SO->FindAttribute(anAttr, "AttributeDrawable") ) {
       _PTR(AttributeDrawable) aDrw (anAttr);
@@ -292,7 +284,7 @@ void GEOMToolsGUI_PublishDlg::buildTree(_PTR(Study) theStudy, SalomeApp_DataObje
         aName = aAttrName->Value().c_str();
       }
       BufferedList aList;
-      QTreeWidgetItem* parentItem = findParentItem(theStudy, theItem, aList);
+      QTreeWidgetItem* parentItem = findParentItem(theItem, aList);
       createItem(parentItem,qMakePair(theItem->entry(),aName),true);
     }
   }
@@ -300,7 +292,7 @@ void GEOMToolsGUI_PublishDlg::buildTree(_PTR(Study) theStudy, SalomeApp_DataObje
   DataObjectList listObj = theItem->children( false );
   DataObjectList::iterator itr = listObj.begin();
   while( itr != listObj.end()) {
-    buildTree(theStudy, dynamic_cast<SalomeApp_DataObject*>(*itr));
+    buildTree(dynamic_cast<SalomeApp_DataObject*>(*itr));
     itr++;
   }
 }
index e36392bbfe80d0e6fef38e8e456ce7424e67f3a9..6b68eb01f7ee894b81ee323d982f58587f29bc2e 100644 (file)
@@ -59,8 +59,8 @@ public:
 
 protected:
   void               initData();
-  void               buildTree(_PTR(Study) theStudy, SalomeApp_DataObject* theItem);
-  QTreeWidgetItem*   findParentItem(_PTR(Study) theStudy, SalomeApp_DataObject* theItem, BufferedList& theList);
+  void               buildTree(SalomeApp_DataObject* theItem);
+  QTreeWidgetItem*   findParentItem(SalomeApp_DataObject* theItem, BufferedList& theList);
   QTreeWidgetItem*   createItem(QTreeWidgetItem* theItem, Pair theAttributes, bool isCheckable);
   void               getDrawableList(QTreeWidgetItem* theItem, QList<QTreeWidgetItem*>& theList);
   void               getTails(QTreeWidgetItem* theItem, QList<QTreeWidgetItem*>& theList);
index f965bd210be26755bcd1a073fcf7a51a9d673d3a..cfd8495755515339e0ed2c786431a71209c9f23a 100644 (file)
@@ -50,8 +50,7 @@ GEOMToolsGUI_ReduceStudyDlg::GEOMToolsGUI_ReduceStudyDlg( QWidget* parent )
 
   myApp = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
   if ( !myApp ) return;
-  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
-  myStudy = study->studyDS();
+
   myDisplayer = GEOM_Displayer();
 
   setWindowTitle( tr( "GEOM_REDUCE_STUDY_TITLE" ) );
@@ -370,10 +369,11 @@ void GEOMToolsGUI_ReduceStudyDlg::checkVisibleIcon( QTreeWidget* theWidget )
 //=================================================================================
 bool GEOMToolsGUI_ReduceStudyDlg::isObjectDrawable( std::string theStudyEntry )
 {
-  _PTR(StudyBuilder) aStudyBuilder = myStudy->NewBuilder();
+  _PTR(Study) aStudy = SalomeApp_Application::getStudy();
+  _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
   //If object hasn't "AttributeDrawable" => it visible
   bool isDrawable = true;
-  _PTR(SObject) SO ( myStudy->FindObjectID( theStudyEntry ) );
+  _PTR(SObject) SO ( aStudy->FindObjectID( theStudyEntry ) );
   _PTR(GenericAttribute) anAttr;
   if ( SO && SO->FindAttribute( anAttr, "AttributeDrawable" ) ) {
     _PTR(AttributeDrawable) aDrw (anAttr);
@@ -388,7 +388,8 @@ bool GEOMToolsGUI_ReduceStudyDlg::isObjectDrawable( std::string theStudyEntry )
 //=================================================================================
 void GEOMToolsGUI_ReduceStudyDlg::unpublishObjects( std::set<std::string>& theObjects )
 {
-  _PTR(StudyBuilder) aStudyBuilder = myStudy->NewBuilder();
+  _PTR(Study) aStudy = SalomeApp_Application::getStudy();
+  _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
   std::set<std::string>::iterator it;
   for( it = theObjects.begin(); it != theObjects.end(); ++it ) {
     std::string objectEntry = *it;
@@ -396,14 +397,14 @@ void GEOMToolsGUI_ReduceStudyDlg::unpublishObjects( std::set<std::string>& theOb
     std::string studyEntry = GeomBaseObject->GetStudyEntry();
     if ( studyEntry == "" || !isObjectDrawable( studyEntry ) )
       continue;
-    _PTR(SObject) obj ( myStudy->FindObjectID( studyEntry.c_str() ) );
+    _PTR(SObject) obj ( aStudy->FindObjectID( studyEntry.c_str() ) );
     _PTR(GenericAttribute) anAttr;
     if ( obj ) {
       _PTR(AttributeDrawable) aDrw = aStudyBuilder->FindOrCreateAttribute( obj, "AttributeDrawable" );
       aDrw->SetDrawable( false );
       myDisplayer.EraseWithChildren( new SALOME_InteractiveObject( studyEntry.c_str(), "GEOM", "TEMP_IO" ) );
       // hide references if any
-      std::vector< _PTR(SObject) > vso = myStudy->FindDependances(obj);
+      std::vector< _PTR(SObject) > vso = aStudy->FindDependances(obj);
       for ( int i = 0; i < vso.size(); i++ ) {
         _PTR(SObject) refObj = vso[i];
         aDrw = aStudyBuilder->FindOrCreateAttribute( refObj, "AttributeDrawable" );
@@ -445,10 +446,11 @@ void GEOMToolsGUI_ReduceStudyDlg::removeObjects( std::set<std::string>& theObjec
 void GEOMToolsGUI_ReduceStudyDlg::removeObject( std::string& theStudyEntry )
 {
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
-  _PTR(StudyBuilder) aStudyBuilder = myStudy->NewBuilder();
-  _PTR(UseCaseBuilder) aUseCaseBuilder = myStudy->GetUseCaseBuilder();
+  _PTR(Study) aStudy = SalomeApp_Application::getStudy();
+  _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
+  _PTR(UseCaseBuilder) aUseCaseBuilder = aStudy->GetUseCaseBuilder();
 
-  _PTR(SObject) obj ( myStudy->FindObjectID( theStudyEntry.c_str() ) );
+  _PTR(SObject) obj ( aStudy->FindObjectID( theStudyEntry.c_str() ) );
   if ( obj ) {
     // remove visual properties of the object
     appStudy->removeObjectProperties(obj->GetID().c_str());
@@ -470,10 +472,11 @@ void GEOMToolsGUI_ReduceStudyDlg::removeEmptyFolders()
 {
   std::set<std::string> emptyFolders;
 
-  _PTR(SComponent) SC ( myStudy->FindComponent( "GEOM" ) );
+  _PTR(Study) aStudy = SalomeApp_Application::getStudy();
+  _PTR(SComponent) SC ( aStudy->FindComponent( "GEOM" ) );
   if ( !SC )
     return;
-  _PTR(ChildIterator) anIter ( myStudy->NewChildIterator( SC ) );
+  _PTR(ChildIterator) anIter ( aStudy->NewChildIterator( SC ) );
   anIter->InitEx( true );
   while( anIter->More() ) {
     _PTR(SObject) valSO ( anIter->Value() );
@@ -498,7 +501,7 @@ void GEOMToolsGUI_ReduceStudyDlg::removeEmptyFolders()
 //=================================================================================
 void GEOMToolsGUI_ReduceStudyDlg::getEmptyFolders( _PTR(SObject) theSO, std::set<std::string>& theFolders )
 {
-  _PTR(UseCaseBuilder) aUseCaseBuilder = myStudy->GetUseCaseBuilder();
+  _PTR(UseCaseBuilder) aUseCaseBuilder = SalomeApp_Application::getStudy()->GetUseCaseBuilder();
 
   bool isFolder = false;
   _PTR(GenericAttribute) anAttr;
index f27efa5a1c7f8568fdfc0c5840c3015b25d82cf1..a5a17ae0cdb2da89a4ae50c0d4a1321293e42844 100644 (file)
@@ -120,7 +120,6 @@ private:
 
   GEOM_Displayer                myDisplayer;
   SalomeApp_Application*        myApp;
-  _PTR(Study)                   myStudy;
 
 };
 
index 8a6e5e965523707b72e2e070e85702a970c6f3f3..92dd756e4c0b0c2dc091936d9d392d84a234c731 100644 (file)
@@ -595,7 +595,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
   TCollection_AsciiString aNameWithExt("");
   if (isMultiFile)
     aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
-                                                   (theComponent->GetStudy()->URL())).c_str());
+                                                   (GetStudy()->URL())).c_str());
 #if OCC_VERSION_MAJOR > 6
   aNameWithExt += TCollection_AsciiString("_GEOM.cbf");
 #else
@@ -661,7 +661,7 @@ 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();
+  SALOMEDS::Study_var study = GetStudy();
 
 #if OCC_VERSION_MAJOR > 6
   // Get the file name.
@@ -800,7 +800,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
                                             CORBA::Long theObjectID,
                                             SALOMEDS::SObject_ptr theObject) {
   // Find the current Study and StudyBuilder
-  SALOMEDS::Study_var aStudy = theObject->GetStudy();
+  SALOMEDS::Study_var aStudy = GetStudy();
   SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
   SALOMEDS::UseCaseBuilder_var anUseCaseBuilder = aStudy->GetUseCaseBuilder();
   SALOMEDS::SObject_var aNewSO;
@@ -2175,8 +2175,11 @@ void GEOM_Gen_i::register_name(char * name)
 //============================================================================
 SALOMEDS::Study_var GEOM_Gen_i::GetStudy()
 {
-  CORBA::Object_var aStudyObject = name_service->Resolve( "/Study" );
-  SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( aStudyObject );
+  static SALOMEDS::Study_var aStudy;
+  if(CORBA::is_nil(aStudy)){
+    CORBA::Object_ptr anObject = name_service->Resolve("/Study");
+    aStudy = SALOMEDS::Study::_narrow(anObject);
+  }
   return aStudy;
 }
 
@@ -2681,9 +2684,7 @@ char* GEOM_Gen_i::getObjectInfo(const char* entry)
 {
   GEOM::GEOM_Object_var aGeomObject;
 
-  CORBA::Object_var aStudyObject = name_service->Resolve( "/Study" );
-  SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow( aStudyObject );
-  SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( entry );
+  SALOMEDS::SObject_var aSObj = GetStudy()->FindObjectID( entry );
   SALOMEDS::SObject_var aResultSObj;
   if (aSObj->ReferencedObject(aResultSObj))
     aSObj = aResultSObj;
@@ -2693,7 +2694,7 @@ char* GEOM_Gen_i::getObjectInfo(const char* entry)
     SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
     CORBA::String_var aVal = anIOR->Value();
     anIOR->UnRegister();
-    CORBA::Object_var anObject = aStudy->ConvertIORToObject(aVal);
+    CORBA::Object_var anObject = GetStudy()->ConvertIORToObject(aVal);
     aGeomObject = GEOM::GEOM_Object::_narrow(anObject);
   }
   if (!aSObj->_is_nil() )
@@ -2857,7 +2858,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
     aLocalID->UnRegister();
   }
 
-  SALOMEDS::Study_var aStudy = theFather->GetStudy();
+  SALOMEDS::Study_var aStudy = GetStudy();
   SALOMEDS::StudyBuilder_var aStudyBuilder( aStudy->NewBuilder() );
   aFolderSO = aStudyBuilder->NewObject( theFather );
 
@@ -2892,7 +2893,7 @@ 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() );
+  SALOMEDS::SObject_var aSO = GetStudy()->FindObjectID( theObject->GetStudyEntry() );
   objects[0] = aSO;
   Move( objects, theFolder, -1 );
 }
@@ -2910,7 +2911,7 @@ void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
   SALOMEDS::SObject_var aSO;
   for (int i = 0; i < aLen; i++) {
     aGO = GEOM::GEOM_Object::_duplicate( theListOfGO[i] );
-    aSO = theFolder->GetStudy()->FindObjectID( aGO->GetStudyEntry() );
+    aSO = GetStudy()->FindObjectID( aGO->GetStudyEntry() );
     objects[i] = aSO;
   }
   if ( objects->length() > 0 )
@@ -2928,7 +2929,7 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what,
 {
   if ( CORBA::is_nil( where ) ) return;
 
-  SALOMEDS::Study_var study = where->GetStudy();
+  SALOMEDS::Study_var study = GetStudy();
   SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
   SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
   SALOMEDS::SComponent_var father = where->GetFatherComponent();
index 6b985d7aed387bdc42ebf8cacb08f0cfa7199ff3..689944ab948434433a661f254793716b3adbf3c8 100644 (file)
@@ -476,8 +476,7 @@ class StructuralElement:
         """
         if theSObject is not None:
             gg = salome.ImportComponentGUI("GEOM")
-            aStudy = theSObject.GetStudy()
-            useCaseBuilder = aStudy.GetUseCaseBuilder()
+            useCaseBuilder = salome.myStudy.GetUseCaseBuilder()
             editor = getStudyEditor()
             aIterator = useCaseBuilder.GetUseCaseIterator(theSObject)
             aIterator.Init(False)