Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/smesh.git] / src / SMESHFiltersSelection / SMESH_NumberFilter.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  File   : SMESH_NumberFilter.hxx
21 //  Module : SMESH
22
23 #ifndef _SMESH_NumberFilter_HeaderFile
24 #define _SMESH_NumberFilter_HeaderFile
25
26 #include "SMESH_Type.h"
27
28 #include "SUIT_SelectionFilter.h"
29
30 #include <TopAbs_ShapeEnum.hxx>
31 #include <TColStd_MapOfInteger.hxx>
32
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(GEOM_Gen)
35
36 #include <string>
37
38 class SUIT_DataOwner;
39
40 /*!
41  *  Class       : SMESH_NumberFilter
42  *  Description : Filter for geom or smesh objects.
43  *                Filter geom objects by number of subshapes of the given type
44  *                Parameters of constructor:
45  *                * theSubShapeType - Type of subshape
46  *                * theNumber       - Number of subshapes. Object is selected if it contains
47  *                                    theNumber of theSubShapeType sub-shapes, or at least
48  *                                    one theSubShapeType, provided that theNumber==0
49  *                * theShapeType    - This map specifies types of object to be selected
50  *                * theMainObject   - Sub-shapes of this object is selected only
51  *                * theIsClosedOnly - Closed shapes is selected if this parameter is true
52  */
53 class SMESHFILTERSSELECTION_EXPORT SMESH_NumberFilter : public SUIT_SelectionFilter
54 {
55  public:
56   SMESH_NumberFilter (const char*            theKind,
57                       const TopAbs_ShapeEnum theSubShapeType,
58                       const int              theNumber,
59                       const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE,
60                       GEOM::GEOM_Object_ptr  theMainObj = GEOM::GEOM_Object::_nil(),
61                       const bool             theIsClosedOnly = false );
62
63   SMESH_NumberFilter (const char*                 theKind,
64                       const TopAbs_ShapeEnum      theSubShapeType,
65                       const int                   theNumber,
66                       const TColStd_MapOfInteger& theShapeTypes,
67                       GEOM::GEOM_Object_ptr       theMainObj = GEOM::GEOM_Object::_nil(),
68                       const bool                  theIsClosedOnly = false );
69
70   virtual ~SMESH_NumberFilter();
71
72   virtual bool isOk (const SUIT_DataOwner*) const;
73
74   void SetSubShapeType (const TopAbs_ShapeEnum);
75   void SetNumber       (const int);
76   void SetClosedOnly   (const bool);
77   void SetShapeType    (const TopAbs_ShapeEnum);
78   void SetShapeTypes   (const TColStd_MapOfInteger&);
79   void SetMainShape    (GEOM::GEOM_Object_ptr);
80
81  private:
82   GEOM::GEOM_Object_ptr getGeom (const SUIT_DataOwner*, const bool extractReference = true ) const;
83
84  private:
85   std::string           myKind;
86   TopAbs_ShapeEnum      mySubShapeType;
87   int                   myNumber;
88   bool                  myIsClosedOnly;
89   TColStd_MapOfInteger  myShapeTypes;
90   GEOM::GEOM_Object_var myMainObj;
91 };
92
93 #endif