Salome HOME
54381: TC8.5.0: SMESH: Regression reading HDF files
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupOnShapeDlg.cxx
index 2bfdd1bc948ed16c0d4ad93b626c8138eb087201..3a4fc2c2d3f3f8f17a590952bcacca696c264f96 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -33,6 +33,7 @@
 
 #include <GeometryGUI.h>
 #include <GEOM_SelectionFilter.h>
+#include <GEOM_wrap.hxx>
 
 #include <SUIT_Session.h>
 #include <SUIT_OverrideCursor.h>
@@ -76,7 +77,8 @@ SMESHGUI_GroupOnShapeDlg::SMESHGUI_GroupOnShapeDlg()
 
   // Elem geom
 
-  QGroupBox* elemsGrp = new QGroupBox( tr( "SMESH_ELEMENTS" ), mainFrame() );
+  QGroupBox* elemsGrp = new QGroupBox( tr( "ELEMENTS" ), mainFrame() );
+  elemsGrp->setToolTip( tr("ELEMENTS_TOOLTIP") );
   QLabel* label = new QLabel( tr( "SMESH_GEOM" ), elemsGrp );
   myElemGeomBtn = new QPushButton( elemsGrp );
   myElemGeomBtn->setCheckable(true);
@@ -132,7 +134,7 @@ SMESHGUI_GroupOnShapeDlg::~SMESHGUI_GroupOnShapeDlg()
 
 //================================================================================
 /*!
- * \brief slot to enable/diable [Apply]
+ * \brief slot to enable/disable [Apply]
  */
 //================================================================================
 
@@ -178,7 +180,7 @@ SMESHGUI_GroupOnShapeOp::SMESHGUI_GroupOnShapeOp()
   : SMESHGUI_SelectionOp(ActorSelection),
     myDlg( 0 )
 {
-  myHelpFileName = "create_groups_from_geometry_page.html";
+  myHelpFileName = "create_groups_from_geometry.html";
 }
 
 SMESHGUI_GroupOnShapeOp::~SMESHGUI_GroupOnShapeOp()
@@ -204,7 +206,7 @@ LightApp_Dialog* SMESHGUI_GroupOnShapeOp::dlg() const
  */
 //================================================================================
 
-static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom)
+static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
 {
   if ( !geom->_is_nil() ) {
     switch ( geom->GetShapeType() ) {
@@ -219,17 +221,18 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom)
     default:             return SMESH::ALL;
     }
     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-    GEOM::GEOM_IShapesOperations_var aShapeOp =
+    GEOM::GEOM_IShapesOperations_wrap aShapeOp =
       SMESH::GetGEOMGen()->GetIShapesOperations(aStudy->StudyId());
 
     if ( geom->GetType() == 37 ) { // geom group
-      GEOM::GEOM_IGroupOperations_var  aGroupOp =
+      GEOM::GEOM_IGroupOperations_wrap aGroupOp =
         SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
       if ( !aGroupOp->_is_nil() ) {
+        // mainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
         GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom );
         GEOM::ListOfLong_var        ids = aGroupOp->GetObjects( geom );
         if ( ids->length() && !mainShape->_is_nil() && !aShapeOp->_is_nil() ) {
-          GEOM::GEOM_Object_var member = aShapeOp->GetSubShape( mainShape, ids[0] );
+          GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( mainShape, ids[0] );
           return elementType( member );
         }
       }
@@ -237,7 +240,7 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom)
     else if ( !aShapeOp->_is_nil() ) { // just a compoud shape
       GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false );
       if ( ids->length() ) {
-        GEOM::GEOM_Object_var member = aShapeOp->GetSubShape( geom, ids[0] );
+        GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( geom, ids[0] );
         return elementType( member );
       }
     }
@@ -353,10 +356,10 @@ bool SMESHGUI_GroupOnShapeOp::onApply()
           anEntryList.append( aSObject->GetID().c_str() );
     }
   }
-  update( UF_ObjBrowser | UF_Model );
-
   SMESHGUI::Modified();
 
+  update( UF_ObjBrowser | UF_Model );
+
   // Re-init controls to create the next group
   myElemGeoIDs.clear();
   myNodeGeoIDs.clear();
@@ -367,8 +370,6 @@ bool SMESHGUI_GroupOnShapeOp::onApply()
   myDlg->myNodeGeomBtn->setChecked(false);
   myDlg->updateButtons();
 
-  update( UF_ObjBrowser | UF_Model );
-
   if( LightApp_Application* anApp =
       dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
     anApp->browseObjects( anEntryList, isApplyAndClose() );
@@ -421,7 +422,7 @@ SUIT_SelectionFilter* SMESHGUI_GroupOnShapeOp::createFilter( const int theId ) c
   if ( theId == _ELEM_GEOM || theId == _NODE_GEOM )
     return new GEOM_SelectionFilter( (SalomeApp_Study*)study(), true );
   else if ( theId == _MESH )
-    return new SMESH_TypeFilter( MESH );
+    return new SMESH_TypeFilter( SMESH::MESH );
   else
     return ( SUIT_SelectionFilter*) 0;
 }
@@ -491,19 +492,19 @@ void SMESHGUI_GroupOnShapeOp::selectionDone()
     }
   }
 
-  if ( myDlg->myElemGeomBtn->isChecked() ) // elem geomerty selection
+  if ( myDlg->myElemGeomBtn->isChecked() ) // elem geometry selection
   {
     myDlg->myElemGeomList->clear();
     myDlg->myElemGeomList->addItems( goodNames );
     myElemGeoIDs = goodIds;
   }
-  else if ( myDlg->myNodeGeomBtn->isChecked() ) // Node geomerty selection
+  else if ( myDlg->myNodeGeomBtn->isChecked() ) // Node geometry selection
   {
     myDlg->myNodeGeomList->clear();
     myDlg->myNodeGeomList->addItems( goodNames );
     myNodeGeoIDs = goodIds;
   }
 
-  // enable/diable Apply, which can change at selection
+  // enable/disable Apply, which can change at selection
   myDlg->updateButtons();
 }