Back to index

salome-gui  6.5.0
Functions
GUI Namespace Reference

Functions

SalomeApp_ApplicationgetSalomeApplication ()
 Get the SALOME application, i.e.
LightApp_SelectionMgr * getSelectionManager ()
 Get the selection manager of the SALOME application.
SUIT_ResourceMgr * getResourcesManager ()
int getActiveStudyId ()
 This returns the current active study id if an active study is defined in the SALOME session, returns -1 otherwise.
SALOMEDS::Study_ptr getActiveStudy ()
 This returns the current active study if an active study is defined in the SALOME session, returns null otherwise.
SalomeApp_Study * getSalomeAppActiveStudy ()
SALOMEDS::SObject_ptr IObjectToSObject (const Handle(SALOME_InteractiveObject)&iobject)
template<class TInterface >
TInterface::_var_type IObjectToInterface (const Handle(SALOME_InteractiveObject)&iobject)

Function Documentation

SALOMEDS::Study_ptr GUI::getActiveStudy ( )

This returns the current active study if an active study is defined in the SALOME session, returns null otherwise.

Definition at line 91 of file SALOME_GuiServices.cxx.

                                     {
    return KERNEL::getStudyById(getActiveStudyId());
  }

Here is the call graph for this function:

This returns the current active study id if an active study is defined in the SALOME session, returns -1 otherwise.

Note that the active study doesn't make sense outside of the GUI SALOME process, i.e. the SALOME_SessionServer embedding the SalomeApp_Application.

Definition at line 78 of file SALOME_GuiServices.cxx.

                         {
    SALOME::Session_var aSession = KERNEL::getSalomeSession();
    if ( CORBA::is_nil(aSession) ) {
      INFOS("ERR: can't request for active study because the session is NULL");
      return -1;
    }
    return aSession->GetActiveStudyId();
  }

Here is the caller graph for this function:

SUIT_ResourceMgr * GUI::getResourcesManager ( )

Definition at line 64 of file SALOME_GuiServices.cxx.

                                           {
    return SUIT_Session::session()->resourceMgr();
  }
SalomeApp_Study * GUI::getSalomeAppActiveStudy ( )

Definition at line 98 of file SALOME_GuiServices.cxx.

                                             {
    SUIT_Application* app = getSalomeApplication();
    if( app )
      return dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
    else
      return NULL;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Get the SALOME application, i.e.

the main GUI framework of SALOME. This function returns a pointer to the singleton instance of the SalomeApp_Application.

The SALOME application can be used to get reference to the SALOME KERNEL services such that the naming service, the lifeCycleCORBA, ... Theses services can be retrieved using static functions (not required to get the singleton instance):

SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();

Please note that this usage can be done only from within the SALOME session server process, i.e. the process that embed the SALOME application.

Definition at line 42 of file SALOME_GuiServices.cxx.

                                                 {
    static SalomeApp_Application * app;
    if ( app == NULL ) {
      app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
    }
    return app;
  }

Here is the caller graph for this function:

LightApp_SelectionMgr * GUI::getSelectionManager ( )

Get the selection manager of the SALOME application.

The selection manager can be used to get the selected items in the objects browser that is a GUI display of the active study. The function returns a pointer to the selectionMgr attribute of the SalomeApp_Application singleton instance.

Definition at line 57 of file SALOME_GuiServices.cxx.

                                                {
    SalomeApp_Application* anApp = GUI::getSalomeApplication();
    if ( anApp == NULL ) return NULL;
    return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
  }

Here is the call graph for this function:

template<class TInterface >
TInterface::_var_type GUI::IObjectToInterface ( const Handle(SALOME_InteractiveObject)&  iobject)

Definition at line 71 of file SALOME_GuiServices.hxx.

                                                                      {
    SALOMEDS::SObject_ptr sobject = IObjectToSObject(iobject);
    return KERNEL::SObjectToInterface<TInterface>(sobject);
  }

Here is the call graph for this function:

SALOMEDS::SObject_ptr GUI::IObjectToSObject ( const Handle(SALOME_InteractiveObject)&  iobject)

Definition at line 107 of file SALOME_GuiServices.cxx.

                                                                                        {
    if (!iobject.IsNull()) {
      if (iobject->hasEntry()) {
        SalomeApp_Study* appStudy = getSalomeAppActiveStudy();
        if ( appStudy != NULL ) {
          //
          // IMPORTANT NOTE:
          //
          // Note that the SalomeApp_Study give acces to shared
          // pointer (i.e. _PTR(<BaseClassName>)) that points to proxy
          // objects (i.e. SALOMEDSClien_<BaseClassName>) that embeds
          // the CORBA servants (i.e. SALOMEDS::<BaseClassName>_ptr).
          // Then to retrieve the corba servant, a method is to
          // retrieve the SALOMEDS::Study servant first and the to
          // request this servant to get the SObject given its entry.
          //
          _PTR(Study) studyClient = appStudy->studyDS();
          SALOMEDS::Study_var study = KERNEL::getStudyManager()->GetStudyByID(studyClient->StudyId());
          SALOMEDS::SObject_ptr sobject = study->FindObjectID(iobject->getEntry());
          return sobject;
        }
      }
    }
    return SALOMEDS::SObject::_nil();
  }

Here is the call graph for this function:

Here is the caller graph for this function: