code improvement

This commit is contained in:
mpa 2017-02-02 10:45:40 +03:00
parent b409504254
commit 818b9c811f
16 changed files with 61 additions and 78 deletions

View File

@ -30,7 +30,7 @@ For instance:
from salome.geom import geomBuilder from salome.geom import geomBuilder
lcc = salome.lcc lcc = salome.lcc
engineGeom = lcc.FindOrLoadComponent("myServer", "GEOM") engineGeom = lcc.FindOrLoadComponent("myServer", "GEOM")
geompy = geomBuilder.New(theStudy, engineGeom) geompy = geomBuilder.New(engineGeom)
\endcode \endcode
Or, within a Distributed Python Node of a YACS Schema, where the container 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 <em>my_container</em
from salome.geom import geomBuilder from salome.geom import geomBuilder
my_container.load_component_Library("GEOM") my_container.load_component_Library("GEOM")
engineGeom = my_container.create_component_instance("GEOM") engineGeom = my_container.create_component_instance("GEOM")
geompy = geomBuilder.New(theStudy, engineGeom) geompy = geomBuilder.New(engineGeom)
\endcode \endcode

View File

@ -1857,7 +1857,7 @@ bool EntityGUI_FieldDlg::isValid(QString& theMessage)
//================================================================================= //=================================================================================
bool EntityGUI_FieldDlg::execute() bool EntityGUI_FieldDlg::execute()
{ {
SALOMEDS::Study_var aStudyDS = GeometryGUI::GetStudy(); SALOMEDS::Study_var aStudyDS = GeometryGUI::getStudyServant();
SALOMEDS::StudyBuilder_var aBuilder = aStudyDS->NewBuilder(); SALOMEDS::StudyBuilder_var aBuilder = aStudyDS->NewBuilder();
QString aName = getNewObjectName().trimmed(); QString aName = getNewObjectName().trimmed();

View File

@ -187,7 +187,7 @@ void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox,
void GEOMBase_Skeleton::updateAttributes( GEOM::GEOM_Object_ptr theObj, void GEOMBase_Skeleton::updateAttributes( GEOM::GEOM_Object_ptr theObj,
const QStringList& theParameters) const QStringList& theParameters)
{ {
SALOMEDS::Study_var aStudy = GeometryGUI::GetStudy(); SALOMEDS::Study_var aStudy = GeometryGUI::getStudyServant();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(theObj->GetStudyEntry()); SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(theObj->GetStudyEntry());
SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString"); SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString");

View File

@ -30,7 +30,7 @@
#include <Standard_ProgramError.hxx> #include <Standard_ProgramError.hxx>
#include <gp_Trsf.hxx> #include <gp_Trsf.hxx>
#include <SalomeApp_Study.h> #include <SalomeApp_Application.h>
// Static patterns for casting value-to-string & value-from-string. The patterns are: // Static patterns for casting value-to-string & value-from-string. The patterns are:
// ITEM: { name[string] : visibility : type : values[composite] }; // ITEM: { name[string] : visibility : type : values[composite] };
@ -590,9 +590,9 @@ GEOMGUI_DimensionProperty::GEOMGUI_DimensionProperty( const GEOMGUI_DimensionPro
// function : Init constructor // function : Init constructor
// purpose : // 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 // function : LoadFromAttribute
// purpose : // purpose :
//================================================================================= //=================================================================================
void GEOMGUI_DimensionProperty::LoadFromAttribute( SalomeApp_Study* theStudy, void GEOMGUI_DimensionProperty::LoadFromAttribute( const std::string& theEntry )
const std::string& theEntry )
{ {
Clear(); Clear();
_PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry ); _PTR(SObject) aSObj = SalomeApp_Application::getStudy()->FindObjectID( theEntry );
if ( !aSObj ) if ( !aSObj )
{ {
return; return;
} }
_PTR(StudyBuilder) aBuilder = theStudy->studyDS()->NewBuilder(); _PTR(StudyBuilder) aBuilder = SalomeApp_Application::getStudy()->NewBuilder();
_PTR(GenericAttribute) aSeekAtt; _PTR(GenericAttribute) aSeekAtt;
_PTR(AttributeTableOfReal) aRecordsAtt; _PTR(AttributeTableOfReal) aRecordsAtt;
@ -1076,16 +1075,15 @@ void GEOMGUI_DimensionProperty::LoadFromAttribute( SalomeApp_Study* theStudy,
// function : SaveToAttribute // function : SaveToAttribute
// purpose : // purpose :
//================================================================================= //=================================================================================
void GEOMGUI_DimensionProperty::SaveToAttribute( SalomeApp_Study *theStudy, void GEOMGUI_DimensionProperty::SaveToAttribute( const std::string &theEntry )
const std::string &theEntry )
{ {
_PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry ); _PTR(SObject) aSObj = SalomeApp_Application::getStudy()->FindObjectID( theEntry );
if ( !aSObj ) if ( !aSObj )
{ {
return; return;
} }
_PTR(StudyBuilder) aBuilder = theStudy->studyDS()->NewBuilder(); _PTR(StudyBuilder) aBuilder = SalomeApp_Application::getStudy()->NewBuilder();
_PTR(AttributeTableOfReal) aRecordsAtt; _PTR(AttributeTableOfReal) aRecordsAtt;

View File

@ -326,7 +326,7 @@ public:
/*! /*!
* \brief Constructor. Inits property from attribute. * \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. * \brief Constructor. Inits property from formatted QString.
@ -456,17 +456,15 @@ public:
/*! /*!
* \brief Loads properties data from attribute "AttributeTableOfReal". * \brief Loads properties data from attribute "AttributeTableOfReal".
* \param theStudy [in] the study.
* \param theEntry [in] the entry of GEOM object to operate with. * \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". * \brief Saves properties data to attribute "AttributeTableOfReal".
* \param theStudy [in] the study.
* \param theEntry [in] the entry of GEOM object to operate with. * \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: private:

View File

@ -799,21 +799,13 @@ bool GEOMGUI_Selection::isFolder( const int index ) const
bool GEOMGUI_Selection::hasDimensions( const int theIndex, bool& theHidden, bool& theVisible ) const bool GEOMGUI_Selection::hasDimensions( const int theIndex, bool& theHidden, bool& theVisible ) const
{ {
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
if ( !appStudy )
{
return false;
}
QString anEntry = entry( theIndex ); QString anEntry = entry( theIndex );
_PTR(Study) aStudy = appStudy->studyDS(); if ( anEntry.isNull() )
if ( !aStudy || anEntry.isNull() )
{ {
return false; return false;
} }
GEOMGUI_DimensionProperty aDimensions( appStudy, anEntry.toStdString() ); GEOMGUI_DimensionProperty aDimensions( anEntry.toStdString() );
theHidden = false; theHidden = false;
theVisible = false; theVisible = false;

View File

@ -170,7 +170,7 @@ void GEOMGUI_TextTreeWdg::updateBranch( const QString& theEntry )
QString aName = obj->GetName().c_str(); QString aName = obj->GetName().c_str();
GEOMGUI_DimensionProperty aProp; GEOMGUI_DimensionProperty aProp;
aProp.LoadFromAttribute( myStudy, theEntry.toStdString() ); aProp.LoadFromAttribute( theEntry.toStdString() );
int nbProps = aProp.GetNumber(); int nbProps = aProp.GetNumber();
QTreeWidgetItem* objectItem = itemFromEntry( theEntry ); QTreeWidgetItem* objectItem = itemFromEntry( theEntry );
@ -237,7 +237,7 @@ void GEOMGUI_TextTreeWdg::onItemClicked( QTreeWidgetItem* theItem, int theColumn
std::string anEntry = entryFromItem( theItem->parent() ).toStdString(); std::string anEntry = entryFromItem( theItem->parent() ).toStdString();
int aDimIndex = idFromItem( theItem ); int aDimIndex = idFromItem( theItem );
GEOMGUI_DimensionProperty aProp; GEOMGUI_DimensionProperty aProp;
aProp.LoadFromAttribute( myStudy, anEntry ); aProp.LoadFromAttribute( anEntry );
if ( aProp.IsVisible( aDimIndex ) ) { if ( aProp.IsVisible( aDimIndex ) ) {
aProp.SetVisible( aDimIndex, false ); aProp.SetVisible( aDimIndex, false );
theItem->setIcon( 1, myInvisibleIcon ); theItem->setIcon( 1, myInvisibleIcon );
@ -245,7 +245,7 @@ void GEOMGUI_TextTreeWdg::onItemClicked( QTreeWidgetItem* theItem, int theColumn
aProp.SetVisible( aDimIndex, true ); aProp.SetVisible( aDimIndex, true );
theItem->setIcon( 1, myVisibleIcon ); theItem->setIcon( 1, myVisibleIcon );
} }
aProp.SaveToAttribute( myStudy, anEntry ); aProp.SaveToAttribute( anEntry );
redisplay( anEntry.c_str() ); redisplay( anEntry.c_str() );
} }
@ -303,7 +303,7 @@ void GEOMGUI_TextTreeWdg::updateVisibilityColumn( QString theEntry, Qtx::Visibil
for ( int i=0; i < anItem->childCount(); i++ ) { for ( int i=0; i < anItem->childCount(); i++ ) {
aChildItem = anItem->child( i ); aChildItem = anItem->child( i );
if ( theState == Qtx::ShownState ) { if ( theState == Qtx::ShownState ) {
aProp.LoadFromAttribute( myStudy, theEntry.toStdString() ); aProp.LoadFromAttribute( theEntry.toStdString() );
if ( aProp.GetNumber() == 0 ) if ( aProp.GetNumber() == 0 )
continue; continue;
aChildItem->setIcon( 1, aProp.IsVisible( idFromItem( aChildItem ) ) ? myVisibleIcon : myInvisibleIcon ); 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() ); QString anEntry = entryFromItem( anItem->parent() );
if ( !anEntry.isEmpty() ) { if ( !anEntry.isEmpty() ) {
GEOMGUI_DimensionProperty aProp; GEOMGUI_DimensionProperty aProp;
aProp.LoadFromAttribute( myStudy, anEntry.toStdString() ); aProp.LoadFromAttribute( anEntry.toStdString() );
if ( aProp.GetNumber() == 0 ) if ( aProp.GetNumber() == 0 )
return; return;
aMenu.clear(); aMenu.clear();
@ -401,12 +401,12 @@ void GEOMGUI_TextTreeWdg::setShapeDimensionsVisibility( QString theEntry, bool t
void GEOMGUI_TextTreeWdg::setDimensionVisibility( QString theEntry, QTreeWidgetItem* theDimItem, bool theVisibility ) void GEOMGUI_TextTreeWdg::setDimensionVisibility( QString theEntry, QTreeWidgetItem* theDimItem, bool theVisibility )
{ {
GEOMGUI_DimensionProperty aProp; GEOMGUI_DimensionProperty aProp;
aProp.LoadFromAttribute( myStudy, theEntry.toStdString() ); aProp.LoadFromAttribute( theEntry.toStdString() );
int aDimIndex = idFromItem( theDimItem ); int aDimIndex = idFromItem( theDimItem );
if ( aProp.GetNumber() == 0 || aProp.IsVisible( aDimIndex ) == theVisibility ) if ( aProp.GetNumber() == 0 || aProp.IsVisible( aDimIndex ) == theVisibility )
return;; return;;
aProp.SetVisible( aDimIndex, theVisibility ); aProp.SetVisible( aDimIndex, theVisibility );
aProp.SaveToAttribute( myStudy, theEntry.toStdString() ); aProp.SaveToAttribute( theEntry.toStdString() );
theDimItem->setIcon( 1, theVisibility ? myVisibleIcon : myInvisibleIcon ); theDimItem->setIcon( 1, theVisibility ? myVisibleIcon : myInvisibleIcon );
redisplay( theEntry ); redisplay( theEntry );

View File

@ -1260,7 +1260,7 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
} }
else else
{ {
aRecords.LoadFromAttribute( getStudy(), theIO->getEntry() ); aRecords.LoadFromAttribute( theIO->getEntry() );
} }
// create up-to-date dimension presentations // create up-to-date dimension presentations

View File

@ -180,7 +180,7 @@ CORBA::Object_var GeometryGUI::ClientSObjectToObject (_PTR(SObject) theSObject)
// function : GetStudy // function : GetStudy
// purpose : // purpose :
//======================================================================= //=======================================================================
SALOMEDS::Study_var GeometryGUI::GetStudy() SALOMEDS::Study_var GeometryGUI::getStudyServant()
{ {
SALOME_NamingService *aNamingService = SalomeApp_Application::namingService(); SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
CORBA::Object_var aStudyObject = aNamingService->Resolve("/Study"); CORBA::Object_var aStudyObject = aNamingService->Resolve("/Study");
@ -2934,7 +2934,7 @@ void GeometryGUI::storeVisualParameters (int savePoint)
std::string aStudyEntry = (*aEntryIt).toLatin1().data(); std::string aStudyEntry = (*aEntryIt).toLatin1().data();
std::string aStoreEntry = ip->encodeEntry( aStudyEntry, componentName); std::string aStoreEntry = ip->encodeEntry( aStudyEntry, componentName);
GEOMGUI_DimensionProperty aDimensions( appStudy, aStudyEntry ); GEOMGUI_DimensionProperty aDimensions( aStudyEntry );
if ( aDimensions.GetNumber() == 0 ) if ( aDimensions.GetNumber() == 0 )
{ {
@ -3022,7 +3022,7 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
if ( aParamNameStr == GEOM::propertyName( GEOM::Dimensions ) ) if ( aParamNameStr == GEOM::propertyName( GEOM::Dimensions ) )
{ {
GEOMGUI_DimensionProperty aDimensionProp( aValuesStr ); GEOMGUI_DimensionProperty aDimensionProp( aValuesStr );
aDimensionProp.SaveToAttribute( appStudy, entry.toLatin1().data() ); aDimensionProp.SaveToAttribute( entry.toLatin1().data() );
} }
continue; continue;

View File

@ -92,7 +92,7 @@ public:
static GEOM::GEOM_Gen_var GetGeomGen(); static GEOM::GEOM_Gen_var GetGeomGen();
static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject); static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
static SALOMEDS::Study_var GetStudy(); static SALOMEDS::Study_var getStudyServant();
static void Modified( bool = true ); static void Modified( bool = true );

View File

@ -87,7 +87,7 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Boolean isPublished,
CORBA::Boolean isMultiFile, CORBA::Boolean isMultiFile,
CORBA::Boolean& isValidScript) CORBA::Boolean& isValidScript)
{ {
SALOMEDS::Study_var aStudy = GetStudy(); SALOMEDS::Study_var aStudy = getStudyServant();
if(CORBA::is_nil(aStudy)) if(CORBA::is_nil(aStudy))
return new Engines::TMPFile(0); return new Engines::TMPFile(0);

View File

@ -215,7 +215,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr theSObjec
{ {
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
SALOMEDS::SObject_var aResultSO; SALOMEDS::SObject_var aResultSO;
SALOMEDS::Study_var aStudy = GetStudy(); SALOMEDS::Study_var aStudy = getStudyServant();
if(CORBA::is_nil(theObject) || aStudy->_is_nil()) return aResultSO; if(CORBA::is_nil(theObject) || aStudy->_is_nil()) return aResultSO;
GEOM::GEOM_BaseObject_var aBaseObj = GEOM::GEOM_BaseObject::_narrow(theObject); GEOM::GEOM_BaseObject_var aBaseObj = GEOM::GEOM_BaseObject::_narrow(theObject);
GEOM::GEOM_Object_var aShape = GEOM::GEOM_Object::_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(""); TCollection_AsciiString aNameWithExt("");
if (isMultiFile) if (isMultiFile)
aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath aNameWithExt = TCollection_AsciiString((char*)(SALOMEDS_Tool::GetNameFromPath
(GetStudy()->URL())).c_str()); (getStudyServant()->URL())).c_str());
#if OCC_VERSION_MAJOR > 6 #if OCC_VERSION_MAJOR > 6
aNameWithExt += TCollection_AsciiString("_GEOM.cbf"); aNameWithExt += TCollection_AsciiString("_GEOM.cbf");
#else #else
@ -661,7 +661,7 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
// Prepare a file name to open // Prepare a file name to open
TCollection_AsciiString aNameWithExt(""); TCollection_AsciiString aNameWithExt("");
SALOMEDS::Study_var study = GetStudy(); SALOMEDS::Study_var study = getStudyServant();
#if OCC_VERSION_MAJOR > 6 #if OCC_VERSION_MAJOR > 6
// Get the file name. // Get the file name.
@ -800,7 +800,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
CORBA::Long theObjectID, CORBA::Long theObjectID,
SALOMEDS::SObject_ptr theObject) { SALOMEDS::SObject_ptr theObject) {
// Find the current Study and StudyBuilder // Find the current Study and StudyBuilder
SALOMEDS::Study_var aStudy = GetStudy(); SALOMEDS::Study_var aStudy = getStudyServant();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
SALOMEDS::UseCaseBuilder_var anUseCaseBuilder = aStudy->GetUseCaseBuilder(); SALOMEDS::UseCaseBuilder_var anUseCaseBuilder = aStudy->GetUseCaseBuilder();
SALOMEDS::SObject_var aNewSO; 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) GEOM::GEOM_BaseObject_ptr theFather)
{ {
SALOMEDS::SObject_var aResultSO; SALOMEDS::SObject_var aResultSO;
SALOMEDS::Study_var aStudy = GetStudy(); SALOMEDS::Study_var aStudy = getStudyServant();
if(theObject->_is_nil() || aStudy->_is_nil()) return aResultSO; if(theObject->_is_nil() || aStudy->_is_nil()) return aResultSO;
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
@ -917,7 +917,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesO (GEOM::GEOM_Object_ptr theObject
CORBA::Boolean theAddPrefix) CORBA::Boolean theAddPrefix)
{ {
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; 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)) if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject))
return aParts._retn(); return aParts._retn();
@ -947,12 +947,12 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesO (GEOM::GEOM_Object_ptr theO
CORBA::Boolean theAddPrefix) CORBA::Boolean theAddPrefix)
{ {
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; 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(); return aParts._retn();
// find SObject in the study if it is already published // find SObject in the study if it is already published
CORBA::String_var anIORo = _orb->object_to_string(theObject); 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 <aSO> //PTv, IMP 0020001, The salome object <aSO>
// is not obligatory in case of invokation from script // is not obligatory in case of invokation from script
// if (CORBA::is_nil(aSO)) // if (CORBA::is_nil(aSO))
@ -976,7 +976,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::SObject_ptr theSObje
CORBA::Boolean theAddPrefix) CORBA::Boolean theAddPrefix)
{ {
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; 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(); return aParts._retn();
SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::GenericAttribute_var anAttr;
@ -1035,7 +1035,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(GEOM::GEOM_Object_ptr theObject,
CORBA::Boolean theAddPrefix) CORBA::Boolean theAddPrefix)
{ {
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
SALOMEDS::Study_var aStudy = GetStudy(); SALOMEDS::Study_var aStudy = getStudyServant();
//PTv, IMP 0020001, The salome object <theSObject> //PTv, IMP 0020001, The salome object <theSObject>
// is not obligatory in case of invokation from script // is not obligatory in case of invokation from script
if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/) 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) CORBA::Boolean theAddPrefix)
{ {
int i = 0; int i = 0;
SALOMEDS::Study_var aStudy = GetStudy(); SALOMEDS::Study_var aStudy = getStudyServant();
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO; GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO;
if (CORBA::is_nil(aStudy) || CORBA::is_nil(theOldSO) || 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) CORBA::Boolean theAddPrefix)
{ {
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
SALOMEDS::Study_var aStudy = GetStudy(); SALOMEDS::Study_var aStudy = getStudyServant();
//PTv, IMP 0020001, The salome object <theSObject> //PTv, IMP 0020001, The salome object <theSObject>
// is not obligatory in case of invokation from script // is not obligatory in case of invokation from script
if (CORBA::is_nil(aStudy) || CORBA::is_nil(theObject) /*|| CORBA::is_nil(theSObject)*/) 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) CORBA::Boolean theAddPrefix)
{ {
int i = 0; int i = 0;
SALOMEDS::Study_var aStudy = GetStudy(); SALOMEDS::Study_var aStudy = getStudyServant();
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO; GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO; GEOM::ListOfGO_var aNewParts = new GEOM::ListOfGO;
if (CORBA::is_nil(aStudy) || CORBA::is_nil(theOldSO) || 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 // purpose : Get Study
//============================================================================ //============================================================================
SALOMEDS::Study_var GEOM_Gen_i::GetStudy() SALOMEDS::Study_var GEOM_Gen_i::getStudyServant()
{ {
static SALOMEDS::Study_var aStudy; static SALOMEDS::Study_var aStudy;
if(CORBA::is_nil(aStudy)){ if(CORBA::is_nil(aStudy)){
@ -2684,7 +2684,7 @@ char* GEOM_Gen_i::getObjectInfo(const char* entry)
{ {
GEOM::GEOM_Object_var aGeomObject; GEOM::GEOM_Object_var aGeomObject;
SALOMEDS::SObject_var aSObj = GetStudy()->FindObjectID( entry ); SALOMEDS::SObject_var aSObj = getStudyServant()->FindObjectID( entry );
SALOMEDS::SObject_var aResultSObj; SALOMEDS::SObject_var aResultSObj;
if (aSObj->ReferencedObject(aResultSObj)) if (aSObj->ReferencedObject(aResultSObj))
aSObj = aResultSObj; aSObj = aResultSObj;
@ -2694,7 +2694,7 @@ char* GEOM_Gen_i::getObjectInfo(const char* entry)
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var aVal = anIOR->Value(); CORBA::String_var aVal = anIOR->Value();
anIOR->UnRegister(); anIOR->UnRegister();
CORBA::Object_var anObject = GetStudy()->ConvertIORToObject(aVal); CORBA::Object_var anObject = getStudyServant()->ConvertIORToObject(aVal);
aGeomObject = GEOM::GEOM_Object::_narrow(anObject); aGeomObject = GEOM::GEOM_Object::_narrow(anObject);
} }
if (!aSObj->_is_nil() ) if (!aSObj->_is_nil() )
@ -2858,7 +2858,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
aLocalID->UnRegister(); aLocalID->UnRegister();
} }
SALOMEDS::Study_var aStudy = GetStudy(); SALOMEDS::Study_var aStudy = getStudyServant();
SALOMEDS::StudyBuilder_var aStudyBuilder( aStudy->NewBuilder() ); SALOMEDS::StudyBuilder_var aStudyBuilder( aStudy->NewBuilder() );
aFolderSO = aStudyBuilder->NewObject( theFather ); aFolderSO = aStudyBuilder->NewObject( theFather );
@ -2893,7 +2893,7 @@ void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject,
SALOMEDS::SObject_ptr theFolder) { SALOMEDS::SObject_ptr theFolder) {
GEOM::object_list_var objects = new GEOM::object_list(); GEOM::object_list_var objects = new GEOM::object_list();
objects->length( 1 ); objects->length( 1 );
SALOMEDS::SObject_var aSO = GetStudy()->FindObjectID( theObject->GetStudyEntry() ); SALOMEDS::SObject_var aSO = getStudyServant()->FindObjectID( theObject->GetStudyEntry() );
objects[0] = aSO; objects[0] = aSO;
Move( objects, theFolder, -1 ); Move( objects, theFolder, -1 );
} }
@ -2911,7 +2911,7 @@ void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
SALOMEDS::SObject_var aSO; SALOMEDS::SObject_var aSO;
for (int i = 0; i < aLen; i++) { for (int i = 0; i < aLen; i++) {
aGO = GEOM::GEOM_Object::_duplicate( theListOfGO[i] ); aGO = GEOM::GEOM_Object::_duplicate( theListOfGO[i] );
aSO = GetStudy()->FindObjectID( aGO->GetStudyEntry() ); aSO = getStudyServant()->FindObjectID( aGO->GetStudyEntry() );
objects[i] = aSO; objects[i] = aSO;
} }
if ( objects->length() > 0 ) if ( objects->length() > 0 )
@ -2929,7 +2929,7 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what,
{ {
if ( CORBA::is_nil( where ) ) return; if ( CORBA::is_nil( where ) ) return;
SALOMEDS::Study_var study = GetStudy(); SALOMEDS::Study_var study = getStudyServant();
SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder(); SALOMEDS::StudyBuilder_var studyBuilder = study->NewBuilder();
SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder(); SALOMEDS::UseCaseBuilder_var useCaseBuilder = study->GetUseCaseBuilder();
SALOMEDS::SComponent_var father = where->GetFatherComponent(); SALOMEDS::SComponent_var father = where->GetFatherComponent();

View File

@ -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; } SALOME_NamingService* GetNS() { return name_service; }
// Get Study // Get Study
SALOMEDS::Study_var GetStudy(); SALOMEDS::Study_var getStudyServant();
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
// Inherited methods from SALOMEDS::Driver // // Inherited methods from SALOMEDS::Driver //

View File

@ -752,11 +752,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
## @addtogroup l1_geomBuilder_auxiliary ## @addtogroup l1_geomBuilder_auxiliary
## @{ ## @{
def init_geom(self,theStudy): def init_geom(self):
self.myStudy = theStudy self.myStudy = salome.myStudy
self.myBuilder = self.myStudy.NewBuilder() self.myBuilder = self.myStudy.NewBuilder()
self.father = self.myStudy.FindComponent("GEOM") self.father = self.myStudy.FindComponent("GEOM")
notebook.myStudy = theStudy notebook.myStudy = salome.myStudy
if self.father is None: if self.father is None:
self.father = self.myBuilder.NewComponent("GEOM") self.father = self.myBuilder.NewComponent("GEOM")
A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName") A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")

View File

@ -178,12 +178,6 @@ void MeasureGUI::ChangeDimensionsVisibility( const bool theIsVisible )
return; return;
} }
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() );
if ( !aStudy )
{
return;
}
LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr(); LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
if ( !aSelMgr ) if ( !aSelMgr )
{ {
@ -205,14 +199,15 @@ void MeasureGUI::ChangeDimensionsVisibility( const bool theIsVisible )
SUIT_OverrideCursor wc; 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 ) for ( int anIt = 0; anIt < aDimensions.GetNumber(); ++anIt )
{ {
aDimensions.SetVisible( anIt, theIsVisible ); aDimensions.SetVisible( anIt, theIsVisible );
} }
aDimensions.SaveToAttribute( aStudy, anIObject->getEntry() ); aDimensions.SaveToAttribute( anIObject->getEntry() );
GEOM_Displayer().Redisplay( anIObject, true ); GEOM_Displayer().Redisplay( anIObject, true );
} }

View File

@ -770,7 +770,7 @@ bool MeasureGUI_ManageDimensionsDlg::ClickOnApply()
QVariant() ) QVariant() )
.value<GEOMGUI_DimensionProperty>(); .value<GEOMGUI_DimensionProperty>();
mySavedPropertyState.SaveToAttribute( aStudy, myEditObject->GetStudyEntry() ); mySavedPropertyState.SaveToAttribute( myEditObject->GetStudyEntry() );
myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) ); myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
@ -919,7 +919,7 @@ void MeasureGUI_ManageDimensionsDlg::SetEditObject( const GEOM::GeomObjPtr& theO
return; return;
} }
mySavedPropertyState.LoadFromAttribute( getStudy(), myEditObject->GetStudyEntry() ); mySavedPropertyState.LoadFromAttribute( myEditObject->GetStudyEntry() );
// set property state for preview // set property state for preview
aStudy->setObjectProperty( GEOM::sharedPropertiesId(), aStudy->setObjectProperty( GEOM::sharedPropertiesId(),