From 818b9c811fd3cd61243dab33e330e7b2d4cfce74 Mon Sep 17 00:00:00 2001 From: mpa Date: Thu, 2 Feb 2017 10:45:40 +0300 Subject: [PATCH] code improvement --- .../GEOM/input/tui_execution_distribution.doc | 4 +- src/EntityGUI/EntityGUI_FieldDlg.cxx | 2 +- src/GEOMBase/GEOMBase_Skeleton.cxx | 2 +- src/GEOMGUI/GEOMGUI_DimensionProperty.cxx | 20 ++++----- src/GEOMGUI/GEOMGUI_DimensionProperty.h | 8 ++-- src/GEOMGUI/GEOMGUI_Selection.cxx | 12 +----- src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx | 14 +++---- src/GEOMGUI/GEOM_Displayer.cxx | 2 +- src/GEOMGUI/GeometryGUI.cxx | 6 +-- src/GEOMGUI/GeometryGUI.h | 2 +- src/GEOM_I/GEOM_DumpPython.cc | 2 +- src/GEOM_I/GEOM_Gen_i.cc | 42 +++++++++---------- src/GEOM_I/GEOM_Gen_i.hh | 2 +- src/GEOM_SWIG/geomBuilder.py | 6 +-- src/MeasureGUI/MeasureGUI.cxx | 11 ++--- .../MeasureGUI_ManageDimensionsDlg.cxx | 4 +- 16 files changed, 61 insertions(+), 78 deletions(-) diff --git a/doc/salome/gui/GEOM/input/tui_execution_distribution.doc b/doc/salome/gui/GEOM/input/tui_execution_distribution.doc index 595bce263..fbf905c9e 100644 --- a/doc/salome/gui/GEOM/input/tui_execution_distribution.doc +++ b/doc/salome/gui/GEOM/input/tui_execution_distribution.doc @@ -30,7 +30,7 @@ For instance: from salome.geom import geomBuilder lcc = salome.lcc engineGeom = lcc.FindOrLoadComponent("myServer", "GEOM") -geompy = geomBuilder.New(theStudy, engineGeom) +geompy = geomBuilder.New(engineGeom) \endcode Or, within a Distributed Python Node of a YACS Schema, where the container @@ -39,7 +39,7 @@ is already provided in the Python context of the node, with my_containerNewBuilder(); QString aName = getNewObjectName().trimmed(); diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 7b505203c..069fe46ae 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -187,7 +187,7 @@ void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, void GEOMBase_Skeleton::updateAttributes( GEOM::GEOM_Object_ptr theObj, const QStringList& theParameters) { - SALOMEDS::Study_var aStudy = GeometryGUI::GetStudy(); + SALOMEDS::Study_var aStudy = GeometryGUI::getStudyServant(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(theObj->GetStudyEntry()); SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString"); diff --git a/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx b/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx index 95d18097d..7c3ed03b1 100644 --- a/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx +++ b/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx @@ -30,7 +30,7 @@ #include #include -#include +#include // Static patterns for casting value-to-string & value-from-string. The patterns are: // ITEM: { name[string] : visibility : type : values[composite] }; @@ -590,9 +590,9 @@ GEOMGUI_DimensionProperty::GEOMGUI_DimensionProperty( const GEOMGUI_DimensionPro // function : Init constructor // purpose : //================================================================================= -GEOMGUI_DimensionProperty::GEOMGUI_DimensionProperty( SalomeApp_Study* theStudy, const std::string& theEntry ) +GEOMGUI_DimensionProperty::GEOMGUI_DimensionProperty( const std::string& theEntry ) { - LoadFromAttribute( theStudy, theEntry ); + LoadFromAttribute( theEntry ); } //================================================================================= @@ -1018,18 +1018,17 @@ int GEOMGUI_DimensionProperty::GetType( const int theIndex ) const // function : LoadFromAttribute // purpose : //================================================================================= -void GEOMGUI_DimensionProperty::LoadFromAttribute( SalomeApp_Study* theStudy, - const std::string& theEntry ) +void GEOMGUI_DimensionProperty::LoadFromAttribute( const std::string& theEntry ) { Clear(); - _PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry ); + _PTR(SObject) aSObj = SalomeApp_Application::getStudy()->FindObjectID( theEntry ); if ( !aSObj ) { return; } - _PTR(StudyBuilder) aBuilder = theStudy->studyDS()->NewBuilder(); + _PTR(StudyBuilder) aBuilder = SalomeApp_Application::getStudy()->NewBuilder(); _PTR(GenericAttribute) aSeekAtt; _PTR(AttributeTableOfReal) aRecordsAtt; @@ -1076,16 +1075,15 @@ void GEOMGUI_DimensionProperty::LoadFromAttribute( SalomeApp_Study* theStudy, // function : SaveToAttribute // purpose : //================================================================================= -void GEOMGUI_DimensionProperty::SaveToAttribute( SalomeApp_Study *theStudy, - const std::string &theEntry ) +void GEOMGUI_DimensionProperty::SaveToAttribute( const std::string &theEntry ) { - _PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry ); + _PTR(SObject) aSObj = SalomeApp_Application::getStudy()->FindObjectID( theEntry ); if ( !aSObj ) { return; } - _PTR(StudyBuilder) aBuilder = theStudy->studyDS()->NewBuilder(); + _PTR(StudyBuilder) aBuilder = SalomeApp_Application::getStudy()->NewBuilder(); _PTR(AttributeTableOfReal) aRecordsAtt; diff --git a/src/GEOMGUI/GEOMGUI_DimensionProperty.h b/src/GEOMGUI/GEOMGUI_DimensionProperty.h index 3ff770055..c42bf998d 100644 --- a/src/GEOMGUI/GEOMGUI_DimensionProperty.h +++ b/src/GEOMGUI/GEOMGUI_DimensionProperty.h @@ -326,7 +326,7 @@ public: /*! * \brief Constructor. Inits property from attribute. */ - GEOMGUI_DimensionProperty( SalomeApp_Study* theStudy, const std::string& theEntry ); + GEOMGUI_DimensionProperty( const std::string& theEntry ); /*! * \brief Constructor. Inits property from formatted QString. @@ -456,17 +456,15 @@ public: /*! * \brief Loads properties data from attribute "AttributeTableOfReal". - * \param theStudy [in] the study. * \param theEntry [in] the entry of GEOM object to operate with. */ - void LoadFromAttribute( SalomeApp_Study* theStudy, const std::string& theEntry ); + void LoadFromAttribute( const std::string& theEntry ); /*! * \brief Saves properties data to attribute "AttributeTableOfReal". - * \param theStudy [in] the study. * \param theEntry [in] the entry of GEOM object to operate with. */ - void SaveToAttribute( SalomeApp_Study* theStudy, const std::string& theEntry ); + void SaveToAttribute( const std::string& theEntry ); private: diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index 291be2e15..8f1dfa44a 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -799,21 +799,13 @@ bool GEOMGUI_Selection::isFolder( const int index ) const bool GEOMGUI_Selection::hasDimensions( const int theIndex, bool& theHidden, bool& theVisible ) const { - SalomeApp_Study* appStudy = dynamic_cast( study() ); - - if ( !appStudy ) - { - return false; - } - QString anEntry = entry( theIndex ); - _PTR(Study) aStudy = appStudy->studyDS(); - if ( !aStudy || anEntry.isNull() ) + if ( anEntry.isNull() ) { return false; } - GEOMGUI_DimensionProperty aDimensions( appStudy, anEntry.toStdString() ); + GEOMGUI_DimensionProperty aDimensions( anEntry.toStdString() ); theHidden = false; theVisible = false; diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx index 6af17acd2..b43d15c75 100644 --- a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx +++ b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx @@ -170,7 +170,7 @@ void GEOMGUI_TextTreeWdg::updateBranch( const QString& theEntry ) QString aName = obj->GetName().c_str(); GEOMGUI_DimensionProperty aProp; - aProp.LoadFromAttribute( myStudy, theEntry.toStdString() ); + aProp.LoadFromAttribute( theEntry.toStdString() ); int nbProps = aProp.GetNumber(); QTreeWidgetItem* objectItem = itemFromEntry( theEntry ); @@ -237,7 +237,7 @@ void GEOMGUI_TextTreeWdg::onItemClicked( QTreeWidgetItem* theItem, int theColumn std::string anEntry = entryFromItem( theItem->parent() ).toStdString(); int aDimIndex = idFromItem( theItem ); GEOMGUI_DimensionProperty aProp; - aProp.LoadFromAttribute( myStudy, anEntry ); + aProp.LoadFromAttribute( anEntry ); if ( aProp.IsVisible( aDimIndex ) ) { aProp.SetVisible( aDimIndex, false ); theItem->setIcon( 1, myInvisibleIcon ); @@ -245,7 +245,7 @@ void GEOMGUI_TextTreeWdg::onItemClicked( QTreeWidgetItem* theItem, int theColumn aProp.SetVisible( aDimIndex, true ); theItem->setIcon( 1, myVisibleIcon ); } - aProp.SaveToAttribute( myStudy, anEntry ); + aProp.SaveToAttribute( anEntry ); redisplay( anEntry.c_str() ); } @@ -303,7 +303,7 @@ void GEOMGUI_TextTreeWdg::updateVisibilityColumn( QString theEntry, Qtx::Visibil for ( int i=0; i < anItem->childCount(); i++ ) { aChildItem = anItem->child( i ); if ( theState == Qtx::ShownState ) { - aProp.LoadFromAttribute( myStudy, theEntry.toStdString() ); + aProp.LoadFromAttribute( theEntry.toStdString() ); if ( aProp.GetNumber() == 0 ) continue; aChildItem->setIcon( 1, aProp.IsVisible( idFromItem( aChildItem ) ) ? myVisibleIcon : myInvisibleIcon ); @@ -331,7 +331,7 @@ void GEOMGUI_TextTreeWdg::showContextMenu( const QPoint& pos ) QString anEntry = entryFromItem( anItem->parent() ); if ( !anEntry.isEmpty() ) { GEOMGUI_DimensionProperty aProp; - aProp.LoadFromAttribute( myStudy, anEntry.toStdString() ); + aProp.LoadFromAttribute( anEntry.toStdString() ); if ( aProp.GetNumber() == 0 ) return; aMenu.clear(); @@ -401,12 +401,12 @@ void GEOMGUI_TextTreeWdg::setShapeDimensionsVisibility( QString theEntry, bool t void GEOMGUI_TextTreeWdg::setDimensionVisibility( QString theEntry, QTreeWidgetItem* theDimItem, bool theVisibility ) { GEOMGUI_DimensionProperty aProp; - aProp.LoadFromAttribute( myStudy, theEntry.toStdString() ); + aProp.LoadFromAttribute( theEntry.toStdString() ); int aDimIndex = idFromItem( theDimItem ); if ( aProp.GetNumber() == 0 || aProp.IsVisible( aDimIndex ) == theVisibility ) return;; aProp.SetVisible( aDimIndex, theVisibility ); - aProp.SaveToAttribute( myStudy, theEntry.toStdString() ); + aProp.SaveToAttribute( theEntry.toStdString() ); theDimItem->setIcon( 1, theVisibility ? myVisibleIcon : myInvisibleIcon ); redisplay( theEntry ); diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 5ddf00ebc..0e254273d 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -1260,7 +1260,7 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t } else { - aRecords.LoadFromAttribute( getStudy(), theIO->getEntry() ); + aRecords.LoadFromAttribute( theIO->getEntry() ); } // create up-to-date dimension presentations diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 09ef1e349..c81f9ee06 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -180,7 +180,7 @@ CORBA::Object_var GeometryGUI::ClientSObjectToObject (_PTR(SObject) theSObject) // function : GetStudy // purpose : //======================================================================= -SALOMEDS::Study_var GeometryGUI::GetStudy() +SALOMEDS::Study_var GeometryGUI::getStudyServant() { SALOME_NamingService *aNamingService = SalomeApp_Application::namingService(); CORBA::Object_var aStudyObject = aNamingService->Resolve("/Study"); @@ -2934,7 +2934,7 @@ void GeometryGUI::storeVisualParameters (int savePoint) std::string aStudyEntry = (*aEntryIt).toLatin1().data(); std::string aStoreEntry = ip->encodeEntry( aStudyEntry, componentName); - GEOMGUI_DimensionProperty aDimensions( appStudy, aStudyEntry ); + GEOMGUI_DimensionProperty aDimensions( aStudyEntry ); if ( aDimensions.GetNumber() == 0 ) { @@ -3022,7 +3022,7 @@ void GeometryGUI::restoreVisualParameters (int savePoint) if ( aParamNameStr == GEOM::propertyName( GEOM::Dimensions ) ) { GEOMGUI_DimensionProperty aDimensionProp( aValuesStr ); - aDimensionProp.SaveToAttribute( appStudy, entry.toLatin1().data() ); + aDimensionProp.SaveToAttribute( entry.toLatin1().data() ); } continue; diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 5c7718cc5..3d40f1611 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -92,7 +92,7 @@ public: static GEOM::GEOM_Gen_var GetGeomGen(); static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject); - static SALOMEDS::Study_var GetStudy(); + static SALOMEDS::Study_var getStudyServant(); static void Modified( bool = true ); diff --git a/src/GEOM_I/GEOM_DumpPython.cc b/src/GEOM_I/GEOM_DumpPython.cc index 15f4ea8f9..d948bc966 100644 --- a/src/GEOM_I/GEOM_DumpPython.cc +++ b/src/GEOM_I/GEOM_DumpPython.cc @@ -87,7 +87,7 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Boolean isPublished, CORBA::Boolean isMultiFile, CORBA::Boolean& isValidScript) { - SALOMEDS::Study_var aStudy = GetStudy(); + SALOMEDS::Study_var aStudy = getStudyServant(); if(CORBA::is_nil(aStudy)) return new Engines::TMPFile(0); diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 92dd756e4..ea8077974 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -215,7 +215,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr theSObjec { Unexpect aCatch(SALOME_SalomeException); SALOMEDS::SObject_var aResultSO; - SALOMEDS::Study_var aStudy = GetStudy(); + SALOMEDS::Study_var aStudy = getStudyServant(); if(CORBA::is_nil(theObject) || aStudy->_is_nil()) return aResultSO; GEOM::GEOM_BaseObject_var aBaseObj = GEOM::GEOM_BaseObject::_narrow(theObject); GEOM::GEOM_Object_var aShape = GEOM::GEOM_Object::_narrow(theObject); @@ -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 - (GetStudy()->URL())).c_str()); + (getStudyServant()->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 = GetStudy(); + SALOMEDS::Study_var study = getStudyServant(); #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 = GetStudy(); + SALOMEDS::Study_var aStudy = getStudyServant(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::UseCaseBuilder_var anUseCaseBuilder = aStudy->GetUseCaseBuilder(); SALOMEDS::SObject_var aNewSO; @@ -865,7 +865,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (GEOM::GEOM_BaseObject_ptr theObjec GEOM::GEOM_BaseObject_ptr theFather) { SALOMEDS::SObject_var aResultSO; - SALOMEDS::Study_var aStudy = GetStudy(); + SALOMEDS::Study_var aStudy = getStudyServant(); if(theObject->_is_nil() || aStudy->_is_nil()) return aResultSO; SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); @@ -917,7 +917,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesO (GEOM::GEOM_Object_ptr theObject CORBA::Boolean theAddPrefix) { GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; - SALOMEDS::Study_var aStudy = GetStudy(); + SALOMEDS::Study_var aStudy = getStudyServant(); if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject)) return aParts._retn(); @@ -947,12 +947,12 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesO (GEOM::GEOM_Object_ptr theO CORBA::Boolean theAddPrefix) { GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; - if (CORBA::is_nil(GetStudy()) || CORBA::is_nil(theObject)) + if (CORBA::is_nil(getStudyServant()) || CORBA::is_nil(theObject)) return aParts._retn(); // find SObject in the study if it is already published CORBA::String_var anIORo = _orb->object_to_string(theObject); - SALOMEDS::SObject_var aSO = GetStudy()->FindObjectIOR(anIORo.in()); + SALOMEDS::SObject_var aSO = getStudyServant()->FindObjectIOR(anIORo.in()); //PTv, IMP 0020001, The salome object // is not obligatory in case of invokation from script // if (CORBA::is_nil(aSO)) @@ -976,7 +976,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::SObject_ptr theSObje CORBA::Boolean theAddPrefix) { GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; - if (CORBA::is_nil(GetStudy()) || CORBA::is_nil(theSObject)) + if (CORBA::is_nil(getStudyServant()) || CORBA::is_nil(theSObject)) return aParts._retn(); SALOMEDS::GenericAttribute_var anAttr; @@ -1035,7 +1035,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(GEOM::GEOM_Object_ptr theObject, CORBA::Boolean theAddPrefix) { GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; - SALOMEDS::Study_var aStudy = GetStudy(); + SALOMEDS::Study_var aStudy = getStudyServant(); //PTv, IMP 0020001, The salome object // is not obligatory in case of invokation from script if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/) @@ -1408,7 +1408,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::SObject_ptr th CORBA::Boolean theAddPrefix) { int i = 0; - SALOMEDS::Study_var aStudy = GetStudy(); + SALOMEDS::Study_var aStudy = getStudyServant(); GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO; if (CORBA::is_nil(aStudy) || CORBA::is_nil(theOldSO) || @@ -1628,7 +1628,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(GEOM::GEOM_Object_ptr theObj CORBA::Boolean theAddPrefix) { GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; - SALOMEDS::Study_var aStudy = GetStudy(); + SALOMEDS::Study_var aStudy = getStudyServant(); //PTv, IMP 0020001, The salome object // is not obligatory in case of invokation from script if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/) @@ -1952,7 +1952,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr CORBA::Boolean theAddPrefix) { int i = 0; - SALOMEDS::Study_var aStudy = GetStudy(); + SALOMEDS::Study_var aStudy = getStudyServant(); GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO; if (CORBA::is_nil(aStudy) || CORBA::is_nil(theOldSO) || @@ -2170,10 +2170,10 @@ void GEOM_Gen_i::register_name(char * name) } //============================================================================ -// function : GetStudy() +// function : getStudyServant() // purpose : Get Study //============================================================================ -SALOMEDS::Study_var GEOM_Gen_i::GetStudy() +SALOMEDS::Study_var GEOM_Gen_i::getStudyServant() { static SALOMEDS::Study_var aStudy; if(CORBA::is_nil(aStudy)){ @@ -2684,7 +2684,7 @@ char* GEOM_Gen_i::getObjectInfo(const char* entry) { GEOM::GEOM_Object_var aGeomObject; - SALOMEDS::SObject_var aSObj = GetStudy()->FindObjectID( entry ); + SALOMEDS::SObject_var aSObj = getStudyServant()->FindObjectID( entry ); SALOMEDS::SObject_var aResultSObj; if (aSObj->ReferencedObject(aResultSObj)) aSObj = aResultSObj; @@ -2694,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 = GetStudy()->ConvertIORToObject(aVal); + CORBA::Object_var anObject = getStudyServant()->ConvertIORToObject(aVal); aGeomObject = GEOM::GEOM_Object::_narrow(anObject); } if (!aSObj->_is_nil() ) @@ -2858,7 +2858,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName, aLocalID->UnRegister(); } - SALOMEDS::Study_var aStudy = GetStudy(); + SALOMEDS::Study_var aStudy = getStudyServant(); SALOMEDS::StudyBuilder_var aStudyBuilder( aStudy->NewBuilder() ); aFolderSO = aStudyBuilder->NewObject( theFather ); @@ -2893,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 = GetStudy()->FindObjectID( theObject->GetStudyEntry() ); + SALOMEDS::SObject_var aSO = getStudyServant()->FindObjectID( theObject->GetStudyEntry() ); objects[0] = aSO; Move( objects, theFolder, -1 ); } @@ -2911,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 = GetStudy()->FindObjectID( aGO->GetStudyEntry() ); + aSO = getStudyServant()->FindObjectID( aGO->GetStudyEntry() ); objects[i] = aSO; } if ( objects->length() > 0 ) @@ -2929,7 +2929,7 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what, { if ( CORBA::is_nil( where ) ) return; - SALOMEDS::Study_var study = GetStudy(); + SALOMEDS::Study_var study = getStudyServant(); SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder(); SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder(); SALOMEDS::SComponent_var father = where->GetFatherComponent(); diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh index 6ffba33e8..7e2aec814 100644 --- a/src/GEOM_I/GEOM_Gen_i.hh +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -109,7 +109,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi SALOME_NamingService* GetNS() { return name_service; } // Get Study - SALOMEDS::Study_var GetStudy(); + SALOMEDS::Study_var getStudyServant(); //-----------------------------------------------------------------------// // Inherited methods from SALOMEDS::Driver // diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index 69bbe46b0..b7fa036dd 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -752,11 +752,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): ## @addtogroup l1_geomBuilder_auxiliary ## @{ - def init_geom(self,theStudy): - self.myStudy = theStudy + def init_geom(self): + self.myStudy = salome.myStudy self.myBuilder = self.myStudy.NewBuilder() self.father = self.myStudy.FindComponent("GEOM") - notebook.myStudy = theStudy + notebook.myStudy = salome.myStudy if self.father is None: self.father = self.myBuilder.NewComponent("GEOM") A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName") diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx index 7547b4266..4a5e476eb 100644 --- a/src/MeasureGUI/MeasureGUI.cxx +++ b/src/MeasureGUI/MeasureGUI.cxx @@ -178,12 +178,6 @@ void MeasureGUI::ChangeDimensionsVisibility( const bool theIsVisible ) return; } - SalomeApp_Study* aStudy = dynamic_cast( anApp->activeStudy() ); - if ( !aStudy ) - { - return; - } - LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr(); if ( !aSelMgr ) { @@ -205,14 +199,15 @@ void MeasureGUI::ChangeDimensionsVisibility( const bool theIsVisible ) SUIT_OverrideCursor wc; - GEOMGUI_DimensionProperty aDimensions( aStudy, anIObject->getEntry() ); + std::string anEntry(anIObject->getEntry()); + GEOMGUI_DimensionProperty aDimensions( anEntry ); for ( int anIt = 0; anIt < aDimensions.GetNumber(); ++anIt ) { aDimensions.SetVisible( anIt, theIsVisible ); } - aDimensions.SaveToAttribute( aStudy, anIObject->getEntry() ); + aDimensions.SaveToAttribute( anIObject->getEntry() ); GEOM_Displayer().Redisplay( anIObject, true ); } diff --git a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx index b0e199d3d..94c7d08d4 100644 --- a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx @@ -770,7 +770,7 @@ bool MeasureGUI_ManageDimensionsDlg::ClickOnApply() QVariant() ) .value(); - mySavedPropertyState.SaveToAttribute( aStudy, myEditObject->GetStudyEntry() ); + mySavedPropertyState.SaveToAttribute( myEditObject->GetStudyEntry() ); myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) ); @@ -919,7 +919,7 @@ void MeasureGUI_ManageDimensionsDlg::SetEditObject( const GEOM::GeomObjPtr& theO return; } - mySavedPropertyState.LoadFromAttribute( getStudy(), myEditObject->GetStudyEntry() ); + mySavedPropertyState.LoadFromAttribute( myEditObject->GetStudyEntry() ); // set property state for preview aStudy->setObjectProperty( GEOM::sharedPropertiesId(), -- 2.39.2