Salome HOME
PAL18352, PAL19290: Conflict in objects selections when switching modules
authoreap <eap@opencascade.com>
Wed, 16 Apr 2008 08:22:32 +0000 (08:22 +0000)
committereap <eap@opencascade.com>
Wed, 16 Apr 2008 08:22:32 +0000 (08:22 +0000)
+  virtual bool                        isSelectionCompatible();

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

index 9c0f854b2ebca43a6df121990bc13c2750e27e6c..01e535f2d841fbdefdf3a94b3d98368b2aeb6a78 100644 (file)
@@ -3039,6 +3039,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 33ced9a762fe2ccab76d3c066f22e43c9e0b4ef5..e5b4cec8704d3108cd0864b8ad1862bf8a2e0ed7 100644 (file)
@@ -136,6 +136,8 @@ protected:
   
   virtual LightApp_Operation*      createOperation( const int ) const;
 
+  virtual bool                     isSelectionCompatible();
+
 private:
   void OnEditDelete();