///////////////////////////////////////////////////////////////
/// \internal
/// \brief Get study object by its study UID or IOR.
- /// \param studyId Study UID.
/// \param uid Object's study UID or IOR.
/// \return Pointer to study object (null object if it isn't
/// found).
///////////////////////////////////////////////////////////////
- _PTR(SObject) uid2object(int studyId, const std::string& uid)
+ _PTR(SObject) uid2object(const std::string& uid)
{
_PTR(SObject) sobject;
- if ( studyId > 0 )
{
- _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByID( studyId );
+ _PTR(Study) study = SMESH::getStudy();
if ( study )
{
sobject = study->FindObjectID( uid );
/// \brief Constructor.
/////////////////////////////////////////////////////////////////
SMESH_Swig::SMESH_Swig()
- : myCachedStudyId( 0 )
{
init();
}
// load SMESH GUI if it's not yet loaded
ProcessVoidEvent( new TInitEvent() );
-
- // set current study
- std::vector<std::string> studies = SalomeApp_Application::studyMgr()->GetOpenStudies();
- if ( studies.size() > 0 )
- {
- _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByName( studies[0] );
- int studyId = study->StudyId();
- if ( myCachedStudyId != studyId )
- {
- myCachedStudyId = studyId;
- SMESHGUI::GetSMESHGen()->SetCurrentStudy( _CAST(Study, study)->GetStudy() );
- }
- }
- else
- {
- myCachedStudyId = 0;
- }
+ SMESHGUI::GetSMESHGen()->UpdateStudy();
}
/////////////////////////////////////////////////////////////////
init();
std::string uid;
-
- if ( myCachedStudyId > 0 )
- {
- _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByID( myCachedStudyId );
- CORBA::Object_var object = string2object( ior );
- if ( study && !CORBA::is_nil( object ) )
+ CORBA::Object_var object = string2object( ior );
+ if ( !CORBA::is_nil( object ) )
{
SALOMEDS::SObject_var sobject =
- SMESHGUI::GetSMESHGen()->PublishInStudy( _CAST(Study, study)->GetStudy(),
- SALOMEDS::SObject::_nil(),
+ SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(),
object.in(),
name );
if ( !CORBA::is_nil( sobject ) )
- {
- uid = sobject->GetID();
- }
+ {
+ uid = sobject->GetID();
+ }
sobject->UnRegister();
}
- }
return strdup( uid.c_str() );
}
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
sobject->SetAttrString( "AttributeName", name );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TDisplayEvent( sobject->GetID().c_str(), viewUid, updateViewer ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TEraseEvent( sobject->GetID().c_str(), viewUid, updateViewer ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TUpdateEvent( uid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
props = ProcessEvent( new TGetPropsEvent( sobject->GetID().c_str(), viewUid ) );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetPropsEvent( sobject->GetID().c_str(), props, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
numbering = ProcessEvent( new TGetNodeNumberingEvent( sobject->GetID().c_str(), viewUid ) );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetNodeNumberingEvent( sobject->GetID().c_str(), numbering, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
numbering = ProcessEvent( new TGetElementNumberingEvent( sobject->GetID().c_str(), viewUid ) );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetElementNumberingEvent( sobject->GetID().c_str(), numbering, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
mode = ProcessEvent( new TGetDisplayModeEvent( sobject->GetID().c_str(), viewUid ) );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetDisplayModeEvent( sobject->GetID().c_str(), mode, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
shrinkMode = ProcessEvent( new TGetShrinkModeEvent( sobject->GetID().c_str(), viewUid ) );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetShrinkModeEvent( sobject->GetID().c_str(), shrink, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
opacity = ProcessEvent( new TGetOpacityEvent( sobject->GetID().c_str(), viewUid ) );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetOpacityEvent( sobject->GetID().c_str(), opacity, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
shown = ProcessEvent( new TGetOrientationEvent( sobject->GetID().c_str(), viewUid ) );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetOrientationEvent( sobject->GetID().c_str(), shown, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetEntitiesEvent( sobject->GetID().c_str(), entities, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
{
int entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
{
int entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) );
/////////////////////////////////////////////////////////////////
/// \brief Initialize %SMESH GUI Python interface.
/// \deprecated Interface is initialized automatically.
-/// \param studyID Study UID (not used).
/////////////////////////////////////////////////////////////////
-void SMESH_Swig::Init(int /*studyID*/)
+void SMESH_Swig::Init()
{
deprecated("SMESH_Swig::Init");
// does nothing; initialization is done automatically.
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSelectListEvent( sobject->GetID().c_str(), ids, append ) );
}
std::vector<int> ids;
ids.push_back( id );
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSelectListEvent( sobject->GetID().c_str(), ids, append ) );
}
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSelectListOfPairEvent( sobject->GetID().c_str(), ids, append ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ids = ProcessEvent( new TGetSelectedEvent( sobject->GetID().c_str() ) );
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
pairs = ProcessEvent( new TGetSelectedPairEvent( sobject->GetID().c_str() ) );