Salome HOME
PAL10332 - references are interpreted as original objects in filters, dialogs, etc.
[modules/smesh.git] / src / SMESHFiltersSelection / SMESH_NumberFilter.hxx
1 //  File   : SMESH_NumberFilter.hxx
2 //  Module : SMESH
3
4 #ifndef _SMESH_NumberFilter_HeaderFile
5 #define _SMESH_NumberFilter_HeaderFile
6
7 #include "SUIT_SelectionFilter.h"
8
9 #include <TopAbs_ShapeEnum.hxx>
10 #include <TColStd_MapOfInteger.hxx>
11
12 #include <SALOMEconfig.h>
13 #include CORBA_SERVER_HEADER(GEOM_Gen)
14
15 class SUIT_DataOwner;
16
17 /*!
18  *  Class       : SMESH_NumberFilter
19  *  Description : Filter for geom or smesh objects.
20  *                Filter geom objects by number of subshapes of the given type
21  *                Parameters of constructor:
22  *                * theSubShapeType - Type of subshape
23  *                * theNumber       - Number of subshapes. Object is selected if it contains theNumber of
24  *                                    theSubShapeType sub-shapes
25  *                * theShapeType    - This map specifies types of object to be selected
26  *                * theMainObject   - Sub-shapes of this object is selected only
27  *                * theIsClosedOnly - Closed shapes is selected if this parameter is true
28  */
29 class SMESH_NumberFilter : public SUIT_SelectionFilter
30 {
31  public:
32   SMESH_NumberFilter (const char*            theKind,
33                       const TopAbs_ShapeEnum theSubShapeType,
34                       const int              theNumber,
35                       const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE,
36                       GEOM::GEOM_Object_ptr  theMainObj = GEOM::GEOM_Object::_nil(),
37                       const bool             theIsClosedOnly = false );
38
39   SMESH_NumberFilter (const char*                 theKind,
40                       const TopAbs_ShapeEnum      theSubShapeType,
41                       const int                   theNumber,
42                       const TColStd_MapOfInteger& theShapeTypes,
43                       GEOM::GEOM_Object_ptr       theMainObj = GEOM::GEOM_Object::_nil(),
44                       const bool                  theIsClosedOnly = false );
45
46   virtual ~SMESH_NumberFilter();
47
48   virtual bool isOk (const SUIT_DataOwner*) const;
49
50   void SetSubShapeType (const TopAbs_ShapeEnum);
51   void SetNumber       (const int);
52   void SetClosedOnly   (const bool);
53   void SetShapeType    (const TopAbs_ShapeEnum);
54   void SetShapeTypes   (const TColStd_MapOfInteger&);
55   void SetMainShape    (GEOM::GEOM_Object_ptr);
56
57  private:
58   GEOM::GEOM_Object_ptr getGeom (const SUIT_DataOwner*, const bool extractReference = true ) const;
59
60  private:
61   char*                 myKind;
62   TopAbs_ShapeEnum      mySubShapeType;
63   int                   myNumber;
64   bool                  myIsClosedOnly;
65   TColStd_MapOfInteger  myShapeTypes;
66   GEOM::GEOM_Object_var myMainObj;
67 };
68
69 #endif