Salome HOME
NPAL16812: Elements Info dialog is added. The size of dialog is modified.
[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 "SUIT_SelectionFilter.h"
27
28 #include <TopAbs_ShapeEnum.hxx>
29 #include <TColStd_MapOfInteger.hxx>
30
31 #include <SALOMEconfig.h>
32 #include CORBA_SERVER_HEADER(GEOM_Gen)
33
34 #include <string>
35
36 class SUIT_DataOwner;
37
38 /*!
39  *  Class       : SMESH_NumberFilter
40  *  Description : Filter for geom or smesh objects.
41  *                Filter geom objects by number of subshapes of the given type
42  *                Parameters of constructor:
43  *                * theSubShapeType - Type of subshape
44  *                * theNumber       - Number of subshapes. Object is selected if it contains
45  *                                    theNumber of theSubShapeType sub-shapes, or at least
46  *                                    one theSubShapeType, provided that theNumber==0
47  *                * theShapeType    - This map specifies types of object to be selected
48  *                * theMainObject   - Sub-shapes of this object is selected only
49  *                * theIsClosedOnly - Closed shapes is selected if this parameter is true
50  */
51 class SMESH_NumberFilter : public SUIT_SelectionFilter
52 {
53  public:
54   SMESH_NumberFilter (const char*            theKind,
55                       const TopAbs_ShapeEnum theSubShapeType,
56                       const int              theNumber,
57                       const TopAbs_ShapeEnum theShapeType = TopAbs_SHAPE,
58                       GEOM::GEOM_Object_ptr  theMainObj = GEOM::GEOM_Object::_nil(),
59                       const bool             theIsClosedOnly = false );
60
61   SMESH_NumberFilter (const char*                 theKind,
62                       const TopAbs_ShapeEnum      theSubShapeType,
63                       const int                   theNumber,
64                       const TColStd_MapOfInteger& theShapeTypes,
65                       GEOM::GEOM_Object_ptr       theMainObj = GEOM::GEOM_Object::_nil(),
66                       const bool                  theIsClosedOnly = false );
67
68   virtual ~SMESH_NumberFilter();
69
70   virtual bool isOk (const SUIT_DataOwner*) const;
71
72   void SetSubShapeType (const TopAbs_ShapeEnum);
73   void SetNumber       (const int);
74   void SetClosedOnly   (const bool);
75   void SetShapeType    (const TopAbs_ShapeEnum);
76   void SetShapeTypes   (const TColStd_MapOfInteger&);
77   void SetMainShape    (GEOM::GEOM_Object_ptr);
78
79  private:
80   GEOM::GEOM_Object_ptr getGeom (const SUIT_DataOwner*, const bool extractReference = true ) const;
81
82  private:
83   std::string           myKind;
84   TopAbs_ShapeEnum      mySubShapeType;
85   int                   myNumber;
86   bool                  myIsClosedOnly;
87   TColStd_MapOfInteger  myShapeTypes;
88   GEOM::GEOM_Object_var myMainObj;
89 };
90
91 #endif