Back to index

salome-gui  6.5.0
Public Member Functions | Static Public Member Functions | Private Attributes
SALOME_AppStudyEditor Class Reference

#include <SALOME_AppStudyEditor.hxx>

Collaboration diagram for SALOME_AppStudyEditor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SALOME_AppStudyEditor (SalomeApp_Application *salomeApp)
int updateActiveStudy ()
 This updates the editor with the current active study.
SALOMEDS::SObject_ptr IObjectToSObject (const Handle(SALOME_InteractiveObject)&iobject)
SALOME_StudyEditor::SObjectList * getSelectedObjects ()
 This function creates a list of all the "study objects" (SObject) that map with the selection in the object browser (the "interactive objects", IObjects).

Static Public Member Functions

static int getActiveStudyId (SalomeApp_Application *salomeApp)

Private Attributes

SalomeApp_Application_salomeApp

Detailed Description

Definition at line 32 of file SALOME_AppStudyEditor.hxx.


Constructor & Destructor Documentation

Definition at line 29 of file SALOME_AppStudyEditor.cxx.

  : SALOME_StudyEditor()
{
  _salomeApp = salomeApp;
  updateActiveStudy();
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 50 of file SALOME_AppStudyEditor.cxx.

                                                                             {
  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*> (salomeApp->activeStudy());
  _PTR(Study) aCStudy = appStudy->studyDS();
  int studyId = aCStudy->StudyId();
  return studyId;
}

Here is the call graph for this function:

Here is the caller graph for this function:

SALOME_StudyEditor::SObjectList * SALOME_AppStudyEditor::getSelectedObjects ( )

This function creates a list of all the "study objects" (SObject) that map with the selection in the object browser (the "interactive objects", IObjects).

Please note that the objects belongs to the active study.

Definition at line 73 of file SALOME_AppStudyEditor.cxx.

                                                                          {

  // _GBO_: please note that the use of this function can be
  // underoptimal in the case where the number of selected objects is
  // high, because we create a vector list of SObjects while the list
  // of IObject can be processed directly. In the case where a high
  // number of objects is selected (~1000), it's certainly better to
  // use directly the SALOME_ListIO and iterators on it.

  LightApp_SelectionMgr* aSelectionMgr = _salomeApp->selectionMgr();
  SALOME_ListIO selectedIObjects;
  aSelectionMgr->selectedObjects(selectedIObjects);
  /* 
   * This returns a list containing the selected objects of the objects
   * browser. Please note that the objects of the browser ARE NOT the
   * objects of the study. What is returned by this function is a list
   * of "interactive objects" (IObject) which are objects of the
   * graphical context. Each of this IObject is characterized by an
   * entry string that corresponds to the entry string of an associated
   * "study object" (SObject) in the active study. The mapping can be
   * done using the function IObjectToSObject.
   */

  SObjectList * listOfSObject = new SObjectList();
  SALOME_ListIteratorOfListIO It (selectedIObjects);
  for (; It.More(); It.Next()) {
    SALOMEDS::SObject_ptr sobject = this->IObjectToSObject(It.Value());
    if (!sobject->_is_nil()) {
      listOfSObject->push_back(sobject);
    }
  }

  return listOfSObject;
}

Here is the call graph for this function:

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

Definition at line 57 of file SALOME_AppStudyEditor.cxx.

                                                                                                           {
  if (!iobject.IsNull()) {
    if (iobject->hasEntry()) {
      SALOMEDS::SObject_var sobject = _study->FindObjectID(iobject->getEntry());
      return sobject._retn();
    }
  }
  return SALOMEDS::SObject::_nil();
}

Here is the call graph for this function:

Here is the caller graph for this function:

This updates the editor with the current active study.

If the active study id is identical to the study id currently associated to this object, then no update is performed.

Definition at line 41 of file SALOME_AppStudyEditor.cxx.

                                             {
  int activeStudyId = SALOME_AppStudyEditor::getActiveStudyId(_salomeApp);
  if ( activeStudyId != this->getStudyId() ) {
    this->setStudyById(activeStudyId);
  }
  return activeStudyId;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 43 of file SALOME_AppStudyEditor.hxx.


The documentation for this class was generated from the following files: