Salome HOME
PAL18352, PAL19290: Conflict in objects selections when switching modules
authoreap <eap@opencascade.com>
Thu, 17 Apr 2008 09:09:35 +0000 (09:09 +0000)
committereap <eap@opencascade.com>
Thu, 17 Apr 2008 09:09:35 +0000 (09:09 +0000)
+  virtual bool                        isSelectionCompatible();

src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI.h

index 1a952b542b07c3c3f3b815faedff409d65af4b0f..2aef7901273a886400d8abf18f6f2e6a45c9f858 100644 (file)
@@ -2938,6 +2938,30 @@ void SMESHGUI::initialize( CAM_Application* app )
           this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
 }
 
+//================================================================================
+/*!
+ * \brief Return true if SMESH or GEOM objects are selected.
+ * Is called form LightApp_Module::activateModule() which clear selection if
+ * not isSelectionCompatible()
+ */
+//================================================================================
+
+bool SMESHGUI::isSelectionCompatible()
+{
+  bool isCompatible = true;
+  SALOME_ListIO selected;
+  if ( LightApp_SelectionMgr *Sel = selectionMgr() )
+    Sel->selectedObjects( selected );
+
+  SALOME_ListIteratorOfListIO It( selected );
+  for ( ; isCompatible && It.More(); It.Next())
+    isCompatible =
+      ( strcmp("GEOM", It.Value()->getComponentDataType()) == 0 ) ||
+      ( strcmp("SMESH", It.Value()->getComponentDataType()) == 0 );
+
+  return isCompatible;
+}
+
 bool SMESHGUI::activateModule( SUIT_Study* study )
 {
   bool res = SalomeApp_Module::activateModule( study );
index a2a8fb6ddc1368ee1fe9785cb5e0e1ad636ef944..1f873c70fbd60dc2a070689c5f05f309ac9de2ef 100644 (file)
@@ -132,6 +132,8 @@ protected:
   
   virtual LightApp_Operation*      createOperation( const int ) const;
 
+  virtual bool                     isSelectionCompatible();
+
 private:
   void OnEditDelete();