From: vsr Date: Thu, 5 Feb 2015 14:42:14 +0000 (+0300) Subject: 0022739: [CEA 812] Create source plug-in to display a GEOM object via CORBA X-Git-Tag: V7_6_0a1~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eaedcff316450fe552006ff88ab78ea1a964471f;p=modules%2Fgui.git 0022739: [CEA 812] Create source plug-in to display a GEOM object via CORBA 0022740: [CEA 1250] Create source plug-in to display a SMESH object via CORBA Alternative solution via Python macro: - Add getSelection() method to the SALOME::Session CORBA interface --- diff --git a/src/Session/CMakeLists.txt b/src/Session/CMakeLists.txt index 08ea8d390..f222dfebc 100755 --- a/src/Session/CMakeLists.txt +++ b/src/Session/CMakeLists.txt @@ -33,6 +33,11 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/SUIT ${PROJECT_SOURCE_DIR}/src/Event ${PROJECT_SOURCE_DIR}/src/Style + ${PROJECT_SOURCE_DIR}/src/SUIT + ${PROJECT_SOURCE_DIR}/src/STD + ${PROJECT_SOURCE_DIR}/src/CAM + ${PROJECT_SOURCE_DIR}/src/OBJECT + ${PROJECT_SOURCE_DIR}/src/LightApp ${PROJECT_SOURCE_DIR}/src/SalomeApp ) diff --git a/src/Session/Session_Session_i.cxx b/src/Session/Session_Session_i.cxx index c5bb83a04..b6fe12df4 100755 --- a/src/Session/Session_Session_i.cxx +++ b/src/Session/Session_Session_i.cxx @@ -30,6 +30,9 @@ #include "SALOME_NamingService.hxx" #include "SALOME_Event.h" #include "SalomeApp_Engine_i.h" +#include "LightApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SALOME_ListIO.hxx" #include "SUIT_Session.h" #include "SUIT_Desktop.h" #include "SUIT_Study.h" @@ -326,3 +329,27 @@ void SALOME_Session_i::emitMessageOneWay(const char* theMessage) { emitMessage(theMessage); } + +SALOME::StringSeq* SALOME_Session_i::getSelection() +{ + SALOME::StringSeq_var selection = new SALOME::StringSeq; + _GUIMutex->lock(); + if ( SUIT_Session::session() ) { + LightApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if ( app ) { + LightApp_SelectionMgr* selMgr = dynamic_cast( app->selectionMgr() ); + SALOME_ListIO selected; + selMgr->selectedObjects( selected ); + selection->length( selected.Extent() ); + int nbSel = 0; + for ( SALOME_ListIteratorOfListIO it( selected ); it.More(); it.Next() ) { + Handle( SALOME_InteractiveObject ) io = it.Value(); + if ( io->hasEntry() ) + selection[nbSel++] = CORBA::string_dup( io->getEntry() ); + } + selection->length( nbSel ); + } + } + _GUIMutex->unlock(); + return selection._retn(); +} diff --git a/src/Session/Session_Session_i.hxx b/src/Session/Session_Session_i.hxx index 0bdab8ab6..61e94cd2c 100755 --- a/src/Session/Session_Session_i.hxx +++ b/src/Session/Session_Session_i.hxx @@ -77,6 +77,9 @@ public: //! Restors a visual state of the study at theSavePoint bool restoreVisualState(CORBA::Long theSavePoint); + //! Get list of selected entities + SALOME::StringSeq* getSelection(); + //! Emit a qt signal from the session GUI desktop window. void emitMessage(const char* theMessage); void emitMessageOneWay(const char* theMessage);