Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/smesh.git] / src / SMESHFiltersSelection / SMESH_NumberFilter.hxx
1 //  SALOME SALOMEGUI : implementation of desktop and GUI kernel
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMESH_NumberFilter.hxx
25 //  Author : Sergey LITONIN
26 //  Module : SMESH
27
28 #ifndef _SMESH_NumberFilter_HeaderFile
29 #define _SMESH_NumberFilter_HeaderFile
30
31 #include <Standard_DefineHandle.hxx>
32 #include "SALOME_TypeFilter.hxx"
33 #include <TopAbs_ShapeEnum.hxx>
34 #include <TColStd_MapOfInteger.hxx>
35
36 #include <SALOMEconfig.h>
37 #include CORBA_SERVER_HEADER(SMESH_Mesh)
38 #include CORBA_SERVER_HEADER(GEOM_Gen)
39
40 DEFINE_STANDARD_HANDLE( SMESH_NumberFilter, SALOME_TypeFilter )
41
42 /*
43   Class       : SMESH_NumberFilter
44   Description : Filter for geom or smesh objects.
45                 Filter geom objects by number of subshapes of the given type
46                 Parameters of constructor:
47                 * theSubShapeType - Type of subshape
48                 * theNumber       - Number of subshapes. Object is selected if it contains theNumber of
49                                     theSubShapeType sub-shapes
50                 * theShapeType    - This map specifies types of object to be selected
51                 * theMainObject   - Sub-shapes of this object is selected only
52                 * theIsClosedOnly - Closed shapes is selected if this parameter is true
53 */
54 class SMESH_NumberFilter : public SALOME_TypeFilter
55 {
56
57 public:
58
59                         SMESH_NumberFilter( const char*            theKind,
60                                             const TopAbs_ShapeEnum theSubShapeType,
61                                             const int              theNumber,
62                                             const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE,
63                                             GEOM::GEOM_Object_ptr  theMainObj = GEOM::GEOM_Object::_nil(),
64                                             const bool             theIsClosedOnly = false );
65
66                         SMESH_NumberFilter( const char*                 theKind,
67                                             const TopAbs_ShapeEnum      theSubShapeType,
68                                             const int                   theNumber,
69                                             const TColStd_MapOfInteger& theShapeTypes,
70                                             GEOM::GEOM_Object_ptr       theMainObj = GEOM::GEOM_Object::_nil(),
71                                             const bool                  theIsClosedOnly = false );
72                                         
73   virtual               ~SMESH_NumberFilter();
74   virtual               Standard_Boolean IsOk( const Handle(SALOME_InteractiveObject)& ) const;
75   
76   void                  SetSubShapeType( const TopAbs_ShapeEnum );
77   void                  SetNumber( const int );
78   void                  SetClosedOnly( const bool );
79   void                  SetShapeType( const TopAbs_ShapeEnum );
80   void                  SetShapeTypes( const TColStd_MapOfInteger& );
81   void                  SetMainShape( GEOM::GEOM_Object_ptr );
82
83 private:
84   GEOM::GEOM_Object_ptr getGeom( const Handle(SALOME_InteractiveObject)& theObj ) const;
85
86                                   
87 private:
88   TopAbs_ShapeEnum      mySubShapeType;
89   int                   myNumber;
90   bool                  myIsClosedOnly;
91   TColStd_MapOfInteger  myShapeTypes;
92   GEOM::GEOM_Object_var myMainObj;
93   
94 public:
95   DEFINE_STANDARD_RTTI( SMESH_NumberFilter )
96 };
97
98 #endif
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124