Salome HOME
0020832: EDF 1359 SMESH : Automatic meshing of boundary layers
authoreap <eap@opencascade.com>
Tue, 18 Jan 2011 12:20:13 +0000 (12:20 +0000)
committereap <eap@opencascade.com>
Tue, 18 Jan 2011 12:20:13 +0000 (12:20 +0000)
-  StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0 );
+  StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0,
+                                     TopAbs_ShapeEnum aSubShType = TopAbs_EDGE );

+  void                           setFilter();

src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx
src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h

index 9a8e3827cdba266006dc49908b8f40e824c8512e..a51d6a16d8d269a32e045c906d754814691dbbcf 100644 (file)
@@ -50,7 +50,7 @@
 
 // GEOM Includes
 #include <GEOMBase.h>
-#include <GEOM_EdgeFilter.h>
+#include <GEOM_TypeFilter.h>
 #include <GEOM_CompoundFilter.h>
 
 // Qt includes
@@ -82,7 +82,7 @@
 //================================================================================
 
 StdMeshersGUI_SubShapeSelectorWdg
-::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ): 
+::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent, TopAbs_ShapeEnum aSubShType ): 
   QWidget( parent ),
   myPreviewActor( 0 ),
   myMaxSize( -1 )
@@ -108,7 +108,7 @@ StdMeshersGUI_SubShapeSelectorWdg
   setLayout( edgesLayout );
   setMinimumWidth( 300 );
 
-  mySubShType = TopAbs_EDGE;
+  mySubShType = aSubShType;
 
   init();
 }
@@ -166,15 +166,8 @@ void StdMeshersGUI_SubShapeSelectorWdg::init()
   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
     aViewWindow->SetSelectionMode( ActorSelection );
 
-
-  SalomeApp_Study* study = mySMESHGUI->activeStudy();
-  GEOM_EdgeFilter* edgeFilter = new GEOM_EdgeFilter(study,StdSelect_AnyEdge);
-  GEOM_CompoundFilter* gpoupFilter = new GEOM_CompoundFilter(study);
-  gpoupFilter->addSubType( TopAbs_EDGE );
-  myGeomFilters.append( edgeFilter );
-  myGeomFilters.append( gpoupFilter );
-  myFilter = new SMESH_LogicalFilter( myGeomFilters, SMESH_LogicalFilter::LO_OR );
-  mySelectionMgr->installFilter( myFilter );
+  myFilter=0;
+  //setFilter();
 
   connect( myAddButton,    SIGNAL(clicked()), SLOT(onAdd()));
   connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove()));
@@ -185,6 +178,24 @@ void StdMeshersGUI_SubShapeSelectorWdg::init()
   updateState();
 }
 
+//================================================================================
+/*!
+ * \brief Install filters to select sub-shapes of mySubShType or their groups
+ */
+//================================================================================
+
+void StdMeshersGUI_SubShapeSelectorWdg::setFilter()
+{
+  SalomeApp_Study* study = mySMESHGUI->activeStudy();
+  GEOM_TypeFilter* typeFilter = new GEOM_TypeFilter(study, mySubShType, /*isShapeType=*/true );
+  GEOM_CompoundFilter* gpoupFilter = new GEOM_CompoundFilter(study);
+  gpoupFilter->addSubType( mySubShType );
+  myGeomFilters.append( typeFilter );
+  myGeomFilters.append( gpoupFilter );
+  myFilter = new SMESH_LogicalFilter( myGeomFilters, SMESH_LogicalFilter::LO_OR );
+  mySelectionMgr->installFilter( myFilter );
+}
+
 //================================================================================
 /*!
  *  Create a layout, initialize fields
@@ -371,7 +382,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::onListSelectionChanged()
 
 //=================================================================================
 // function : setGeomShape
-// purpose  : Called to set geometry
+// purpose  : Called to set geometry whose sub-shapes are selected
 //================================================================================
 void StdMeshersGUI_SubShapeSelectorWdg::SetGeomShapeEntry( const QString& theEntry )
 {
@@ -484,7 +495,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::SetListOfIDs( SMESH::long_array_var theI
 
 //=================================================================================
 // function : SetMainShapeEntry
-// purpose  : Called to set the Main Object Entry
+// purpose  : Called to set the Entry of main shape of the mesh
 //=================================================================================
 void StdMeshersGUI_SubShapeSelectorWdg::SetMainShapeEntry( const QString& theEntry )
 {
index 591d28b6f8af53465eacaa3f7253cc691d1264ea..e18f32e08125dc2b89b06de7363a5b886719377e 100644 (file)
@@ -52,7 +52,8 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget
   Q_OBJECT
 
 public:
-  StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0 );
+  StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0,
+                                     TopAbs_ShapeEnum aSubShType = TopAbs_EDGE );
   ~StdMeshersGUI_SubShapeSelectorWdg();
 
   SMESH::long_array_var          GetListOfIDs();
@@ -79,10 +80,11 @@ public:
   int                            GetListSize() { return myListOfIDs.size(); }
 
   void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; }
-  void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; }
+  //void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; }
 
 private:
   void                           updateState();
+  void                           setFilter();
 
 private slots:
   void                           onAdd(); 
@@ -98,8 +100,8 @@ private:
   LightApp_SelectionMgr*         mySelectionMgr;          /* User shape selection */
   SVTK_Selector*                 mySelector;
   SMESH::SMESH_Mesh_var          myMesh;
-  TopoDS_Shape                   myGeomShape;
-  TopoDS_Shape                   myMainShape;
+  TopoDS_Shape                   myGeomShape; // shape whose sub-shapes are selected
+  TopoDS_Shape                   myMainShape; // main shape of the mesh
   QString                        myEntry;
   QString                        myMainEntry;
   vtkRenderer*                   myRenderer;