]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0022739: [CEA 812] Create source plug-in to display a GEOM object via CORBA
authorvsr <vsr@opencascade.com>
Thu, 5 Feb 2015 14:42:14 +0000 (17:42 +0300)
committervsr <vsr@opencascade.com>
Thu, 5 Feb 2015 14:42:14 +0000 (17:42 +0300)
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

src/Session/CMakeLists.txt
src/Session/Session_Session_i.cxx
src/Session/Session_Session_i.hxx

index 08ea8d390dc07184906ab473cd1dd7256568352f..f222dfebcc75353c1b83c75aa0494bd21dd33f63 100755 (executable)
@@ -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
 )
 
index c5bb83a04fe7f5617f2351a5c5b028084f468cdc..b6fe12df4a05c6dcf6f20c5cc49e0891d836c1ca 100755 (executable)
@@ -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<LightApp_Application*>( SUIT_Session::session()->activeApplication() );
+    if ( app ) {
+      LightApp_SelectionMgr* selMgr = dynamic_cast<LightApp_SelectionMgr*>( 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();
+}
index 0bdab8ab6530948ec9ae76befa717514f4006272..61e94cd2cb3e4f8ecdf212b7a33fa9d9ec8ee6e3 100755 (executable)
@@ -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);