From: mpa Date: Tue, 31 Jan 2017 09:27:37 +0000 (+0300) Subject: Deleted Study as an input parameter and as a class field. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b409504254cf389f4c2a5c2b1440a6f5ccb5145e;p=modules%2Fgeom.git Deleted Study as an input parameter and as a class field. --- diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index 0552e3588..19339c6ea 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -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( 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 ) diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index 51fd17889..291be2e15 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -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++; } } diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 94325cb09..09ef1e349 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -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; diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index f5a2dd843..a578fde6d 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -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& objects ) +static bool inUse( const QString& component, const QMap& 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& geomObjList, QMap& 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( 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 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 diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h index c01c580d6..23557233b 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -97,7 +97,6 @@ private: // Recursive deletion of object with children void removeObjectWithChildren( _PTR(SObject), - _PTR(Study), QList, GEOM_Displayer* ); }; diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.cxx index a6715a0ed..691a5b7e3 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.cxx @@ -185,15 +185,7 @@ void GEOMToolsGUI_PublishDlg::initData() { if(!myGeomRoot) return; - SalomeApp_Study* appStudy = dynamic_cast( 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(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(*itr)); + buildTree(dynamic_cast(*itr)); itr++; } } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.h index e36392bbf..6b68eb01f 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_PublishDlg.h @@ -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& theList); void getTails(QTreeWidgetItem* theItem, QList& theList); diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.cxx index f965bd210..cfd849575 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.cxx @@ -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( 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& theObjects ) { - _PTR(StudyBuilder) aStudyBuilder = myStudy->NewBuilder(); + _PTR(Study) aStudy = SalomeApp_Application::getStudy(); + _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder(); std::set::iterator it; for( it = theObjects.begin(); it != theObjects.end(); ++it ) { std::string objectEntry = *it; @@ -396,14 +397,14 @@ void GEOMToolsGUI_ReduceStudyDlg::unpublishObjects( std::set& 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& theObjec void GEOMToolsGUI_ReduceStudyDlg::removeObject( std::string& theStudyEntry ) { SalomeApp_Study* appStudy = dynamic_cast( 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 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& theFolders ) { - _PTR(UseCaseBuilder) aUseCaseBuilder = myStudy->GetUseCaseBuilder(); + _PTR(UseCaseBuilder) aUseCaseBuilder = SalomeApp_Application::getStudy()->GetUseCaseBuilder(); bool isFolder = false; _PTR(GenericAttribute) anAttr; diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.h index f27efa5a1..a5a17ae0c 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.h @@ -120,7 +120,6 @@ private: GEOM_Displayer myDisplayer; SalomeApp_Application* myApp; - _PTR(Study) myStudy; }; diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 8a6e5e965..92dd756e4 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -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(); diff --git a/src/GEOM_PY/structelem/__init__.py b/src/GEOM_PY/structelem/__init__.py index 6b985d7ae..689944ab9 100644 --- a/src/GEOM_PY/structelem/__init__.py +++ b/src/GEOM_PY/structelem/__init__.py @@ -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)