Salome HOME
Prevent exception at shape selection if no mesh was pre-selected
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Filter.h
1 //  SMESHGUI_Filter : Filters for VTK viewer
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   : SMESHGUI_Filter.h
25 //  Author : Sergey LITONIN
26 //  Module : SMESH
27
28 #ifndef SMESHGUI_Filter_HeaderFile
29 #define SMESHGUI_Filter_HeaderFile
30
31 #include "VTKViewer_Filter.h"
32
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(SMESH_Filter)
35
36 class SALOME_Actor;
37
38 enum SMESHGUI_FilterType
39 {
40   SMESHGUI_UnknownFilter      = -1,
41   SMESHGUI_NodeFilter         =  0,
42   SMESHGUI_EdgeFilter         =  1,
43   SMESHGUI_FaceFilter         =  2,
44   SMESHGUI_VolumeFilter       =  3,
45   SMESHGUI_AllElementsFilter  =  4,
46   SMESHGUI_QuadFilter         =  5,
47   SMESHGUI_TriaFilter         =  6
48 };
49
50 /*
51   Class       : SMESHGUI_Filter
52   Description : Base class for SMESH selection filters for VTK viewer. 
53 */
54
55 DEFINE_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
56
57 class SMESHGUI_Filter : public VTKViewer_Filter
58 {
59
60 public:
61
62   virtual bool                IsObjValid( const int theObjId ) const = 0;
63 public:
64   DEFINE_STANDARD_RTTI(SMESHGUI_Filter)
65 };
66
67 /*
68   Class       : SMESHGUI_PredicateFilter
69   Description : Selection filter for VTK viewer. This class aggregate object
70                 of SMESH_Predicate class and uses it for verification of criterion
71 */
72
73 DEFINE_STANDARD_HANDLE(SMESHGUI_PredicateFilter, SMESHGUI_Filter)
74
75 class SMESHGUI_PredicateFilter : public SMESHGUI_Filter
76 {
77
78 public:
79                               SMESHGUI_PredicateFilter();
80   virtual                     ~SMESHGUI_PredicateFilter();
81
82   virtual bool                IsValid( const int theCellId ) const;
83   virtual bool                IsObjValid( const int theObjId ) const;
84   virtual int                 GetId() const;
85   virtual bool                IsNodeFilter() const;
86   void                        SetPredicate( SMESH::Predicate_ptr );
87
88   void                        SetActor( SALOME_Actor* );
89
90 private:
91
92   SMESH::Predicate_var        myPred;
93
94 public:
95   DEFINE_STANDARD_RTTI(SMESHGUI_PredicateFilter)
96 };
97
98 /*
99   Class       : SMESHGUI_QuadrangleFilter
100   Description : Verify whether selected cell is quadranle
101 */
102
103 DEFINE_STANDARD_HANDLE(SMESHGUI_QuadrangleFilter, SMESHGUI_Filter)
104
105 class SMESHGUI_QuadrangleFilter : public SMESHGUI_Filter
106 {
107
108 public:
109                               SMESHGUI_QuadrangleFilter();
110   virtual                     ~SMESHGUI_QuadrangleFilter();
111
112   virtual bool                IsValid( const int theCellId ) const;
113   virtual bool                IsObjValid( const int theObjId ) const;
114   virtual int                 GetId() const;
115   virtual bool                IsNodeFilter() const;
116
117 public:
118   DEFINE_STANDARD_RTTI(SMESHGUI_QuadrangleFilter)
119 };
120
121 /*
122   Class       : SMESHGUI_TriangleFilter
123   Description : Verify whether selected cell is triangle
124 */
125
126 DEFINE_STANDARD_HANDLE(SMESHGUI_TriangleFilter, SMESHGUI_Filter)
127
128 class SMESHGUI_TriangleFilter : public SMESHGUI_Filter
129 {
130
131 public:
132                               SMESHGUI_TriangleFilter();
133   virtual                     ~SMESHGUI_TriangleFilter();
134
135   virtual bool                IsValid( const int theCellId ) const;
136   virtual bool                IsObjValid( const int theObjId ) const;
137   virtual int                 GetId() const;
138   virtual bool                IsNodeFilter() const;  
139
140 public:
141   DEFINE_STANDARD_RTTI(SMESHGUI_TriangleFilter)
142 };
143
144 #endif