Salome HOME
0022098: EDF 2036 SMESH: Create groups from none conected parts of a mesh
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.hxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
24 //  File   : SMESH_Filter_i.hxx
25 //  Author : Alexey Petrov, OCC
26 //  Module : SMESH
27
28 #ifndef _SMESH_FILTER_I_HXX_
29 #define _SMESH_FILTER_I_HXX_
30
31 #include "SMESH.hxx"
32
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(SMESH_Filter)
35
36 #include <LDOM_Document.hxx>
37 #include <TopoDS_Shape.hxx>
38
39 #include "SALOME_GenericObj_i.hh"
40 #include "SMESH_ControlsDef.hxx"
41
42 #include <list>
43
44 class SMESHDS_Mesh;
45
46 namespace SMESH
47 {
48
49   // ================================================================================
50   namespace Controls
51   {
52
53     /*
54       Class       : BelongToGeom
55       Description : Predicate for verifying whether entiy belong to
56       specified geometrical support
57     */
58     class SMESH_I_EXPORT BelongToGeom: public virtual Predicate
59     {
60     public:
61       BelongToGeom();
62
63       virtual void                    SetMesh( const SMDS_Mesh* theMesh );
64       virtual void                    SetGeom( const TopoDS_Shape& theShape );
65
66       virtual bool                    IsSatisfy( long theElementId );
67
68       virtual void                    SetType( SMDSAbs_ElementType theType );
69       virtual                         SMDSAbs_ElementType GetType() const;
70
71       TopoDS_Shape                    GetShape();
72       const SMESHDS_Mesh*             GetMeshDS() const;
73
74       void                            SetTolerance( double );
75       double                          GetTolerance();
76
77     private:
78       virtual void                    init();
79
80       TopoDS_Shape                    myShape;
81       const SMESHDS_Mesh*             myMeshDS;
82       SMDSAbs_ElementType             myType;
83       bool                            myIsSubshape;
84       double                          myTolerance;          // only if myIsSubshape == false
85       Controls::ElementsOnShapePtr    myElementsOnShapePtr; // only if myIsSubshape == false
86     };
87     typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
88
89     /*
90       Class       : LyingOnGeom
91       Description : Predicate for verifying whether entiy lying or partially lying on
92       specified geometrical support
93     */
94     class SMESH_I_EXPORT LyingOnGeom: public virtual Predicate
95     {
96     public:
97       LyingOnGeom();
98       
99       virtual void                    SetMesh( const SMDS_Mesh* theMesh );
100       virtual void                    SetGeom( const TopoDS_Shape& theShape );
101       
102       virtual bool                    IsSatisfy( long theElementId );
103       
104       virtual void                    SetType( SMDSAbs_ElementType theType );
105       virtual                         SMDSAbs_ElementType GetType() const;
106       
107       TopoDS_Shape                    GetShape();
108       const SMESHDS_Mesh*             GetMeshDS() const;
109
110       void                            SetTolerance( double );
111       double                          GetTolerance();
112       
113       virtual bool                    Contains( const SMESHDS_Mesh*     theMeshDS,
114                                                 const TopoDS_Shape&     theShape,
115                                                 const SMDS_MeshElement* theElem,
116                                                 TopAbs_ShapeEnum        theFindShapeEnum,
117                                                 TopAbs_ShapeEnum        theAvoidShapeEnum = TopAbs_SHAPE );
118     private:
119       virtual void                    init();
120
121       TopoDS_Shape                    myShape;
122       const SMESHDS_Mesh*             myMeshDS;
123       SMDSAbs_ElementType             myType;
124       bool                            myIsSubshape;
125       double                          myTolerance;          // only if myIsSubshape == false
126       Controls::ElementsOnShapePtr    myElementsOnShapePtr; // only if myIsSubshape == false
127     };
128     typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
129
130   } // namespace Controls
131
132   // ================================================================================
133   /*
134     FUNCTORS
135   */
136   
137   /*
138     Class       : Functor_i
139     Description : An abstact class for all functors 
140   */
141   class SMESH_I_EXPORT Functor_i: public virtual POA_SMESH::Functor,
142                                   public virtual SALOME::GenericObj_i
143   {
144   public:
145     virtual void                    SetMesh( SMESH_Mesh_ptr theMesh );
146     Controls::FunctorPtr            GetFunctor() { return myFunctorPtr; }
147     ElementType                     GetElementType();
148
149   protected:
150     Functor_i();
151     ~Functor_i();
152   protected:                                
153     Controls::FunctorPtr            myFunctorPtr;
154   };
155   
156   /*
157     Class       : NumericalFunctor_i
158     Description : Base class for numerical functors 
159   */
160   class SMESH_I_EXPORT NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,
161                                            public virtual Functor_i
162   {
163   public:
164     CORBA::Double                   GetValue( CORBA::Long theElementId );
165     SMESH::Histogram*               GetHistogram(CORBA::Short nbIntervals, CORBA::Boolean isLogarithmic);
166     void                            SetPrecision( CORBA::Long thePrecision );
167     CORBA::Long                     GetPrecision();
168     Controls::NumericalFunctorPtr   GetNumericalFunctor();
169     
170   protected:
171     Controls::NumericalFunctorPtr   myNumericalFunctorPtr;
172   };
173   
174   
175   /*
176     Class       : SMESH_MinimumAngleFunct
177     Description : Functor for calculation of minimum angle
178   */
179   class SMESH_I_EXPORT MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,
180                                        public virtual NumericalFunctor_i
181   {
182   public:
183     MinimumAngle_i();
184     FunctorType                     GetFunctorType();
185   };
186   
187   
188   /*
189     Class       : AspectRatio_i
190     Description : Functor for calculating aspect ratio
191   */
192   class SMESH_I_EXPORT AspectRatio_i: public virtual POA_SMESH::AspectRatio,
193                                       public virtual NumericalFunctor_i
194   {
195   public:
196     AspectRatio_i();
197     FunctorType                     GetFunctorType();
198   };
199   
200   
201   /*
202     Class       : AspectRatio3D_i
203     Description : Functor for calculating aspect ratio for 3D
204   */
205   class SMESH_I_EXPORT AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D,
206                                         public virtual NumericalFunctor_i
207   {
208   public:
209     AspectRatio3D_i();
210     FunctorType                     GetFunctorType();
211   };
212   
213
214   /*
215     Class       : Warping_i
216     Description : Functor for calculating warping
217   */
218   class SMESH_I_EXPORT Warping_i: public virtual POA_SMESH::Warping,
219                                   public virtual NumericalFunctor_i
220   {
221   public:
222     Warping_i();
223     FunctorType                     GetFunctorType();
224   };
225   
226   
227   /*
228     Class       : Taper_i
229     Description : Functor for calculating taper
230   */
231   class SMESH_I_EXPORT Taper_i: public virtual POA_SMESH::Taper,
232                                 public virtual NumericalFunctor_i
233   {
234   public:
235     Taper_i();
236     FunctorType                     GetFunctorType();
237   };
238   
239   
240   /*
241     Class       : Skew_i
242     Description : Functor for calculating skew in degrees
243   */
244   class SMESH_I_EXPORT Skew_i: public virtual POA_SMESH::Skew,
245                                public virtual NumericalFunctor_i
246   {
247   public:
248     Skew_i();
249     FunctorType                     GetFunctorType();
250   };
251   
252   
253   /*
254     Class       : Area_i
255     Description : Functor for calculating area
256   */
257   class SMESH_I_EXPORT Area_i: public virtual POA_SMESH::Area,
258                                public virtual NumericalFunctor_i
259   {
260   public:
261     Area_i();
262     FunctorType                     GetFunctorType();
263   };
264   
265   
266   /*
267     Class       : Volume3D_i
268     Description : Functor for calculating volume of 3D element
269   */
270   class SMESH_I_EXPORT Volume3D_i: public virtual POA_SMESH::Volume3D,
271                                    public virtual NumericalFunctor_i
272   {
273   public:
274     Volume3D_i();
275     FunctorType                     GetFunctorType();
276   };
277   
278   
279   /*
280     Class       : MaxElementLength2D_i
281     Description : Functor for calculating maximum length of 2D element
282   */
283   class SMESH_I_EXPORT MaxElementLength2D_i: public virtual POA_SMESH::MaxElementLength2D,
284                                              public virtual NumericalFunctor_i
285   {
286   public:
287     MaxElementLength2D_i();
288     FunctorType                     GetFunctorType();
289   };
290   
291   
292   /*
293     Class       : MaxElementLength3D_i
294     Description : Functor for calculating maximum length of 3D element
295   */
296   class SMESH_I_EXPORT MaxElementLength3D_i: public virtual POA_SMESH::MaxElementLength3D,
297                                              public virtual NumericalFunctor_i
298   {
299   public:
300     MaxElementLength3D_i();
301     FunctorType                     GetFunctorType();
302   };
303   
304   
305   /*
306     Class       : Length_i
307     Description : Functor for calculating length of edge
308   */
309   class SMESH_I_EXPORT Length_i: public virtual POA_SMESH::Length,
310                                  public virtual NumericalFunctor_i
311   {
312   public:
313     Length_i();
314     FunctorType                     GetFunctorType();
315   };
316   
317   /*
318     Class       : Length2D_i
319     Description : Functor for calculating length of edge
320   */
321   class SMESH_I_EXPORT Length2D_i: public virtual POA_SMESH::Length2D,
322                                    public virtual NumericalFunctor_i
323   {
324   public:
325     Length2D_i();
326     SMESH::Length2D::Values*        GetValues();
327     FunctorType                     GetFunctorType();
328     
329   protected:
330     Controls::Length2DPtr          myLength2DPtr;
331   };
332   
333   /*
334     Class       : MultiConnection_i
335     Description : Functor for calculating number of faces conneted to the edge
336   */
337   class SMESH_I_EXPORT MultiConnection_i: public virtual POA_SMESH::MultiConnection,
338                                           public virtual NumericalFunctor_i
339   {
340   public:
341     MultiConnection_i();
342     FunctorType                     GetFunctorType();
343   };
344   
345   /*
346     Class       : MultiConnection2D_i
347     Description : Functor for calculating number of faces conneted to the edge
348   */
349   class SMESH_I_EXPORT MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
350                                             public virtual NumericalFunctor_i
351   {
352   public:
353     MultiConnection2D_i();
354     SMESH::MultiConnection2D::Values*  GetValues();
355     FunctorType                        GetFunctorType();
356     
357   protected:
358     Controls::MultiConnection2DPtr     myMulticonnection2DPtr;
359   };
360   
361   /*
362     Class       : BallDiameter_i
363     Description : Functor returning diameter of a ball element
364   */
365   class SMESH_I_EXPORT BallDiameter_i: public virtual POA_SMESH::BallDiameter,
366                                        public virtual NumericalFunctor_i
367   {
368   public:
369     BallDiameter_i();
370     FunctorType                     GetFunctorType();
371   };
372   
373   
374   /*
375     PREDICATES
376   */
377   /*
378     Class       : Predicate_i
379     Description : Base class for all predicates
380   */
381   class SMESH_I_EXPORT Predicate_i: public virtual POA_SMESH::Predicate,
382                                     public virtual Functor_i
383   {
384   public:
385     CORBA::Boolean                  IsSatisfy( CORBA::Long theElementId );
386     Controls::PredicatePtr          GetPredicate();
387     
388   protected:
389     Controls::PredicatePtr          myPredicatePtr;
390   };
391   
392   
393   /*
394     Class       : BadOrientedVolume_i
395     Description : Verify whether a mesh volume is incorrectly oriented from
396     the point of view of MED convention
397   */
398   class SMESH_I_EXPORT BadOrientedVolume_i: public virtual POA_SMESH::BadOrientedVolume,
399                                             public virtual Predicate_i
400   {
401   public:
402     BadOrientedVolume_i();
403     FunctorType                     GetFunctorType();
404   };
405   
406   /*
407     Class       : BareBorderVolume_i
408     Description : Verify whether a mesh volume has a free facet without a face on it
409   */
410   class SMESH_I_EXPORT BareBorderVolume_i: public virtual POA_SMESH::BareBorderVolume,
411                                            public virtual Predicate_i
412   {
413   public:
414     BareBorderVolume_i();
415     FunctorType                     GetFunctorType();
416   };
417   
418   /*
419     Class       : BareBorderFace_i
420     Description : Verify whether a mesh face has a free border without an edge on it
421   */
422   class SMESH_I_EXPORT BareBorderFace_i: public virtual POA_SMESH::BareBorderFace,
423                                          public virtual Predicate_i
424   {
425   public:
426     BareBorderFace_i();
427     FunctorType                     GetFunctorType();
428   };
429   
430   /*
431     Class       : OverConstrainedVolume_i
432     Description : Verify whether a mesh volume has only one facet shared with other volumes
433   */
434   class SMESH_I_EXPORT OverConstrainedVolume_i: public virtual POA_SMESH::OverConstrainedVolume,
435                                                 public virtual Predicate_i
436   {
437   public:
438     OverConstrainedVolume_i();
439     FunctorType                     GetFunctorType();
440   };
441   
442   /*
443     Class       : OverConstrainedFace_i
444     Description : Verify whether a mesh face has only one border shared with other faces
445   */
446   class SMESH_I_EXPORT OverConstrainedFace_i: public virtual POA_SMESH::OverConstrainedFace,
447                                               public virtual Predicate_i
448   {
449   public:
450     OverConstrainedFace_i();
451     FunctorType                     GetFunctorType();
452   };
453
454   /*
455     Class       : BelongToGeom_i
456     Description : Predicate for selection on geometrical support
457   */
458   class SMESH_I_EXPORT BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
459                                        public virtual Predicate_i
460   {
461   public:
462     BelongToGeom_i();
463     virtual                         ~BelongToGeom_i();
464     
465     void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
466     void                            SetElementType( ElementType theType );
467     FunctorType                     GetFunctorType();
468     
469     void                            SetGeom( const TopoDS_Shape& theShape );
470     
471     void                            SetShapeName( const char* theName );
472     void                            SetShape( const char* theID, const char* theName );
473     char*                           GetShapeName();
474     char*                           GetShapeID();
475
476     void                            SetTolerance( CORBA::Double );
477     CORBA::Double                   GetTolerance();
478     
479   protected:
480     Controls::BelongToGeomPtr       myBelongToGeomPtr;
481     char*                           myShapeName;
482     char*                           myShapeID;
483   };
484   
485   /*
486     Class       : BelongToSurface_i
487     Description : Verify whether mesh element lie in pointed Geom planar object
488   */
489   class SMESH_I_EXPORT BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
490                                           public virtual Predicate_i
491   {
492   public:
493     BelongToSurface_i( const Handle(Standard_Type)& );
494     virtual                         ~BelongToSurface_i();
495     
496     void                            SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
497     
498     void                            SetShapeName( const char* theName, ElementType theType );
499     void                            SetShape( const char* theID, const char* theName, ElementType theType );
500     char*                           GetShapeName();
501     char*                           GetShapeID();
502
503     void                            SetTolerance( CORBA::Double );
504     CORBA::Double                   GetTolerance();
505     
506     void                            SetUseBoundaries( CORBA::Boolean theUseBndRestrictions );
507     CORBA::Boolean                  GetUseBoundaries();
508
509   protected:
510     Controls::ElementsOnSurfacePtr  myElementsOnSurfacePtr;
511     char*                           myShapeName;
512     char*                           myShapeID;
513     Handle(Standard_Type)           mySurfaceType;
514   };
515   
516   /*
517     Class       : BelongToPlane_i
518     Description : Verify whether mesh element lie in pointed Geom planar object
519   */
520   class SMESH_I_EXPORT BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
521                                         public virtual BelongToSurface_i
522   {
523   public:
524     BelongToPlane_i();
525     void                            SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
526     FunctorType                     GetFunctorType();
527   };
528   
529   /*
530     Class       : BelongToCylinder_i
531     Description : Verify whether mesh element lie in pointed Geom cylindrical object
532   */
533   class SMESH_I_EXPORT BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
534                                            public virtual BelongToSurface_i
535   {
536   public:
537     BelongToCylinder_i();
538     void                            SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
539     FunctorType                     GetFunctorType();
540   };
541
542   /*
543     Class       : BelongToGenSurface_i
544     Description : Verify whether mesh element lie on pointed Geom surfasic object
545   */
546   class BelongToGenSurface_i: public virtual POA_SMESH::BelongToGenSurface,
547                               public virtual BelongToSurface_i
548   {
549   public:
550     BelongToGenSurface_i();
551     void                            SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
552     FunctorType                     GetFunctorType();
553   };
554   
555   /*
556     Class       : LyingOnGeom_i
557     Description : Predicate for selection on geometrical support(lying or partially lying)
558   */
559   class SMESH_I_EXPORT LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
560                                       public virtual Predicate_i
561   {
562   public:
563     LyingOnGeom_i();
564     virtual                         ~LyingOnGeom_i();
565     
566     void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
567     void                            SetElementType( ElementType theType );
568     FunctorType                     GetFunctorType();
569     
570     void                            SetGeom( const TopoDS_Shape& theShape );
571     
572     void                            SetShapeName( const char* theName );
573     void                            SetShape( const char* theID, const char* theName );
574     char*                           GetShapeName();
575     char*                           GetShapeID();
576
577     void                            SetTolerance( CORBA::Double );
578     CORBA::Double                   GetTolerance();
579     
580   protected:
581     Controls::LyingOnGeomPtr        myLyingOnGeomPtr;
582     char*                           myShapeName;
583     char*                           myShapeID;
584   };
585   
586   /*
587     Class       : FreeBorders_i
588     Description : Predicate for free borders
589   */
590   class SMESH_I_EXPORT FreeBorders_i: public virtual POA_SMESH::FreeBorders,
591                                       public virtual Predicate_i
592   {
593   public:
594     FreeBorders_i();
595     FunctorType                     GetFunctorType();
596   };
597   
598   
599   /*
600     Class       : FreeEdges_i
601     Description : Predicate for free edges
602   */
603   class SMESH_I_EXPORT FreeEdges_i: public virtual POA_SMESH::FreeEdges,
604                                     public virtual Predicate_i
605   {
606   public:
607     FreeEdges_i();
608     SMESH::FreeEdges::Borders*      GetBorders();
609     FunctorType                     GetFunctorType();
610     
611   protected:
612     Controls::FreeEdgesPtr          myFreeEdgesPtr;
613   };
614   
615
616   /*
617     Class       : FreeFaces_i
618     Description : Predicate for free faces
619   */
620   class SMESH_I_EXPORT FreeFaces_i: public virtual POA_SMESH::FreeFaces,
621                                     public virtual Predicate_i
622   {
623   public:
624     FreeFaces_i();
625     FunctorType                     GetFunctorType();
626   };
627   
628
629   /*
630     Class       : FreeNodes_i
631     Description : Predicate for free nodes
632   */
633   class SMESH_I_EXPORT FreeNodes_i: public virtual POA_SMESH::FreeNodes,
634                                     public virtual Predicate_i
635   {
636   public:
637     FreeNodes_i();
638     FunctorType                     GetFunctorType();
639   };
640   
641   
642   /*
643     Class       : EqualNodes_i
644     Description : Predicate for equal nodes
645   */
646   class SMESH_I_EXPORT EqualNodes_i: public virtual POA_SMESH::EqualNodes,
647                                      public virtual Predicate_i
648   {
649   public:
650     EqualNodes_i();
651     FunctorType                     GetFunctorType();
652     void                            SetTolerance( double );
653     double                          GetTolerance();
654
655   private:
656     Controls::CoincidentNodesPtr myCoincidentNodesPtr;
657   };
658   /*
659     Class       : EqualEdges_i
660     Description : Predicate for equal edges
661   */
662   class SMESH_I_EXPORT EqualEdges_i: public virtual POA_SMESH::EqualEdges,
663                                      public virtual Predicate_i
664   {
665   public:
666     EqualEdges_i();
667     FunctorType                     GetFunctorType();
668   };
669   /*
670     Class       : EqualFaces_i
671     Description : Predicate for equal Faces
672   */
673   class SMESH_I_EXPORT EqualFaces_i: public virtual POA_SMESH::EqualFaces,
674                                      public virtual Predicate_i
675   {
676   public:
677     EqualFaces_i();
678     FunctorType                     GetFunctorType();
679   };
680   /*
681     Class       : EqualVolumes_i
682     Description : Predicate for equal Volumes
683   */
684   class SMESH_I_EXPORT EqualVolumes_i: public virtual POA_SMESH::EqualVolumes,
685                                        public virtual Predicate_i
686   {
687   public:
688     EqualVolumes_i();
689     FunctorType                     GetFunctorType();
690   };
691   
692   
693   /*
694     Class       : RangeOfIds_i
695     Description : Predicate for Range of Ids
696   */
697   class SMESH_I_EXPORT RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
698                                      public virtual Predicate_i
699   {
700   public:
701     RangeOfIds_i();
702     void                            SetRange( const SMESH::long_array& theIds );
703     CORBA::Boolean                  SetRangeStr( const char* theRange );
704     char*                           GetRangeStr();
705     
706     void                            SetElementType( ElementType theType );
707     FunctorType                     GetFunctorType();
708     
709   protected:
710     Controls::RangeOfIdsPtr         myRangeOfIdsPtr;
711   };
712
713   /*
714     Class       : LinearOrQuadratic_i
715     Description : Verify whether a mesh element is linear
716   */
717   class SMESH_I_EXPORT LinearOrQuadratic_i: public virtual POA_SMESH::LinearOrQuadratic,
718                                             public virtual Predicate_i
719   {
720   public:
721     LinearOrQuadratic_i();
722     FunctorType                    GetFunctorType();
723     void                           SetElementType( ElementType theType );
724
725   private:
726    Controls::LinearOrQuadraticPtr  myLinearOrQuadraticPtr;
727   };
728   
729   /*
730     Class       : GroupColor_i
731     Description : Functor for check color of group to whic mesh element belongs to
732   */
733   class SMESH_I_EXPORT GroupColor_i: public virtual POA_SMESH::GroupColor,
734                                      public virtual Predicate_i
735   {
736   public:
737     GroupColor_i();
738     FunctorType             GetFunctorType();
739
740     void                    SetElementType( ElementType theType );
741     void                    SetColorStr( const char* theColor );
742     char*                   GetColorStr();
743
744   private:
745     Controls::GroupColorPtr myGroupColorPtr;
746   };
747   
748   /*
749     Class       : ElemGeomType_i
750     Description : Functor for check element geometry type
751   */
752   class SMESH_I_EXPORT ElemGeomType_i: public virtual POA_SMESH::ElemGeomType,
753                                        public virtual Predicate_i
754   {
755   public:
756     ElemGeomType_i();
757     FunctorType             GetFunctorType();
758
759     void                    SetElementType ( ElementType  theType );
760     void                    SetGeometryType( GeometryType theType );
761     GeometryType            GetGeometryType() const;
762
763   private:
764     Controls::ElemGeomTypePtr myElemGeomTypePtr;
765   };
766
767   /*
768     Class       : ElemEntityType_i
769     Description : Functor for check element entity type
770   */
771   class SMESH_I_EXPORT ElemEntityType_i: public virtual POA_SMESH::ElemEntityType,
772                                          public virtual Predicate_i
773   {
774   public:
775     ElemEntityType_i();
776     FunctorType             GetFunctorType();
777
778     void                    SetElementType ( ElementType  theType );
779     void                    SetEntityType( EntityType theEntityType );
780     EntityType              GetEntityType() const;
781
782   private:
783     Controls::ElemEntityTypePtr myElemEntityTypePtr;
784   };
785   
786   /*
787     Class       : CoplanarFaces_i
788     Description : Returns true if a mesh face is a coplanar neighbour to a given one
789   */
790   class SMESH_I_EXPORT CoplanarFaces_i: public virtual POA_SMESH::CoplanarFaces,
791                                         public virtual Predicate_i
792   {
793   public:
794     CoplanarFaces_i();
795     FunctorType             GetFunctorType();
796
797     void                    SetFace ( CORBA::Long theFaceID );
798     void                    SetTolerance( CORBA::Double theToler );
799     char*                   GetFaceAsString () const;
800     CORBA::Long             GetFace () const;
801     CORBA::Double           GetTolerance () const;
802   private:
803     Controls::CoplanarFacesPtr myCoplanarFacesPtr;
804   };
805
806   /*
807    * Class       : ConnectedElements_i
808    * Description : Returns true if an element is connected via other elements to the element
809    *               located at a given point.
810    */
811   class SMESH_I_EXPORT ConnectedElements_i: public virtual POA_SMESH::ConnectedElements,
812                                             public virtual Predicate_i
813   {
814   public:
815     ConnectedElements_i();
816     FunctorType             GetFunctorType();
817
818     void                    SetElementType( ElementType theType );
819     void                    SetPoint( CORBA::Double x, CORBA::Double y, CORBA::Double z );
820     void                    SetVertex( GEOM::GEOM_Object_ptr vertex )
821       throw (SALOME::SALOME_Exception);
822     void                    SetNode ( CORBA::Long nodeID )
823       throw (SALOME::SALOME_Exception);
824     void                    SetThreshold ( const char* threshold,
825                                            SMESH::ConnectedElements::ThresholdType type )
826       throw (SALOME::SALOME_Exception);
827     char*                   GetThreshold ( SMESH::ConnectedElements::ThresholdType& type );
828
829   private:
830     Controls::ConnectedElementsPtr          myConnectedElementsPtr;
831     std::string                             myVertexID;
832   };
833   
834   /*
835     Class       : Comparator_i
836     Description : Base class for comparators
837   */
838   class SMESH_I_EXPORT Comparator_i: public virtual POA_SMESH::Comparator,
839                                      public virtual Predicate_i
840   {
841   public:
842     virtual                         ~Comparator_i();
843     
844     virtual void                    SetMargin( CORBA::Double );
845     virtual void                    SetNumFunctor( NumericalFunctor_ptr );
846     
847     Controls::ComparatorPtr         GetComparator();
848     NumericalFunctor_i*             GetNumFunctor_i();
849     CORBA::Double                   GetMargin();
850     
851   protected:
852     Comparator_i();
853   protected:                                  
854     Controls::ComparatorPtr         myComparatorPtr;
855     NumericalFunctor_i*             myNumericalFunctor;
856   };
857   
858   
859   /*
860     Class       : LessThan_i
861     Description : Comparator "<"
862   */
863   class SMESH_I_EXPORT LessThan_i: public virtual POA_SMESH::LessThan,
864                                    public virtual Comparator_i
865   {
866   public:
867     LessThan_i();
868     FunctorType                     GetFunctorType();
869   };
870   
871   
872   /*
873     Class       : MoreThan_i
874     Description : Comparator ">"
875   */
876   class SMESH_I_EXPORT MoreThan_i: public virtual POA_SMESH::MoreThan,
877                                    public virtual Comparator_i
878   {
879   public:
880     MoreThan_i();
881     FunctorType                     GetFunctorType();
882   };
883   
884   
885   /*
886     Class       : EqualTo_i
887     Description : Comparator "="
888   */
889   class SMESH_I_EXPORT EqualTo_i: public virtual POA_SMESH::EqualTo,
890                                   public virtual Comparator_i
891   {
892   public:
893     EqualTo_i();
894     virtual void                    SetTolerance( CORBA::Double );
895     CORBA::Double                   GetTolerance();
896     FunctorType                     GetFunctorType();
897     
898   protected:
899     Controls::EqualToPtr            myEqualToPtr;
900   };
901   
902   
903   /*
904     Class       : LogicalNOT_i
905     Description : Logical NOT predicate
906   */
907   class SMESH_I_EXPORT LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
908                                      public virtual Predicate_i
909   {
910   public:
911     LogicalNOT_i();
912   virtual                         ~LogicalNOT_i();
913     
914     virtual void                    SetPredicate( Predicate_ptr );
915     Predicate_i*                    GetPredicate_i();
916     FunctorType                     GetFunctorType();
917     
918   protected:
919     Controls::LogicalNOTPtr         myLogicalNOTPtr;
920     Predicate_i*                    myPredicate;
921   };
922   
923   
924   /*
925     Class       : LogicalBinary_i
926     Description : Base class for binary logical predicate
927   */
928   class SMESH_I_EXPORT LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
929                                         public virtual Predicate_i
930   {
931   public:
932     virtual                         ~LogicalBinary_i();
933     virtual void                    SetMesh( SMESH_Mesh_ptr theMesh );
934     virtual void                    SetPredicate1( Predicate_ptr );
935     virtual void                    SetPredicate2( Predicate_ptr );
936     
937     Controls::LogicalBinaryPtr      GetLogicalBinary();
938     Predicate_i*                    GetPredicate1_i();
939     Predicate_i*                    GetPredicate2_i();
940     
941   protected:
942     LogicalBinary_i();
943   protected:  
944     Controls::LogicalBinaryPtr      myLogicalBinaryPtr;
945     Predicate_i*                    myPredicate1;
946     Predicate_i*                    myPredicate2;
947   };
948   
949   
950   /*
951     Class       : LogicalAND_i
952     Description : Logical AND
953   */
954   class SMESH_I_EXPORT LogicalAND_i: public virtual POA_SMESH::LogicalAND,
955                                      public virtual LogicalBinary_i
956   {
957   public:
958     LogicalAND_i();
959     FunctorType                     GetFunctorType();
960   };
961   
962   
963   /*
964     Class       : LogicalOR_i
965     Description : Logical OR
966   */
967   class SMESH_I_EXPORT LogicalOR_i: public virtual POA_SMESH::LogicalOR,
968                                     public virtual LogicalBinary_i
969   {
970   public:
971     LogicalOR_i();
972     FunctorType                     GetFunctorType();
973   };
974   
975   
976   /*
977     FILTER
978   */
979   class SMESH_I_EXPORT Filter_i: public virtual POA_SMESH::Filter,
980                                  public virtual SALOME::GenericObj_i
981   {
982   public:
983     Filter_i();
984     ~Filter_i();
985     
986     virtual
987     void
988     SetPredicate( Predicate_ptr );
989
990     virtual
991     void
992     SetMesh( SMESH_Mesh_ptr );
993
994     static
995     void
996     GetElementsId( Predicate_i*,
997                    const SMDS_Mesh*,
998                    Controls::Filter::TIdSequence& );
999     static
1000     void           
1001     GetElementsId( Predicate_i*,
1002                    SMESH_Mesh_ptr,
1003                    Controls::Filter::TIdSequence& );
1004     
1005     virtual
1006     long_array*      
1007     GetElementsId( SMESH_Mesh_ptr );
1008
1009     virtual
1010     ElementType      
1011     GetElementType();
1012     
1013     virtual
1014     CORBA::Boolean   
1015     GetCriteria( SMESH::Filter::Criteria_out theCriteria );
1016
1017     virtual
1018     CORBA::Boolean
1019     SetCriteria( const SMESH::Filter::Criteria& theCriteria );
1020     
1021     virtual
1022     Predicate_ptr
1023     GetPredicate();
1024
1025     Predicate_i*     GetPredicate_i();
1026
1027     // =========================
1028     // SMESH_IDSource interface
1029     // =========================
1030     virtual SMESH::long_array*           GetIDs();
1031     virtual SMESH::long_array*           GetMeshInfo();
1032     virtual SMESH::array_of_ElementType* GetTypes();
1033     virtual SMESH::SMESH_Mesh_ptr        GetMesh();
1034     virtual bool                         IsMeshInfoCorrect() { return true; }
1035
1036     /*!
1037      * \brief Object notified on change of predicate
1038      */
1039     struct TPredicateChangeWaiter
1040     {
1041       virtual void PredicateChanged() = 0;
1042     };
1043     void AddWaiter( TPredicateChangeWaiter* waiter );
1044     void RemoveWaiter( TPredicateChangeWaiter* waiter );
1045
1046   private:
1047     Controls::Filter myFilter;
1048     Predicate_i*     myPredicate;
1049     SMESH_Mesh_var   myMesh;
1050
1051     std::list<TPredicateChangeWaiter*> myWaiters;
1052   };
1053   
1054   
1055   /*
1056     FILTER LIBRARY
1057   */
1058   class SMESH_I_EXPORT FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
1059                                         public virtual SALOME::GenericObj_i
1060   {
1061   public:
1062     FilterLibrary_i( const char* theFileName );
1063     FilterLibrary_i();
1064     ~FilterLibrary_i();
1065     
1066     Filter_ptr              Copy( const char* theFilterName );
1067     
1068     CORBA::Boolean          Add     ( const char* theFilterName, Filter_ptr theFilter );
1069     CORBA::Boolean          AddEmpty( const char* theFilterName, ElementType theType );
1070     CORBA::Boolean          Delete  ( const char* theFilterName );
1071     CORBA::Boolean          Replace ( const char* theFilterName, 
1072                                       const char* theNewName, 
1073                                       Filter_ptr  theFilter );
1074     
1075     CORBA::Boolean          Save();
1076     CORBA::Boolean          SaveAs( const char* aFileName );
1077     
1078     CORBA::Boolean          IsPresent( const char* aFilterName );
1079     CORBA::Long             NbFilters( ElementType );
1080     string_array*           GetNames( ElementType );
1081     string_array*           GetAllNames();
1082     void                    SetFileName( const char* theFileName );
1083     char*                   GetFileName();
1084     
1085   private:
1086     char*                   myFileName;
1087     LDOM_Document           myDoc;
1088     FilterManager_var       myFilterMgr;
1089   };
1090   
1091   
1092   /*
1093     FILTER MANAGER
1094   */
1095   
1096   class SMESH_I_EXPORT FilterManager_i: public virtual POA_SMESH::FilterManager,
1097                                         public virtual SALOME::GenericObj_i
1098   {
1099   public:
1100     FilterManager_i();
1101     ~FilterManager_i();
1102
1103     MinimumAngle_ptr          CreateMinimumAngle();
1104     AspectRatio_ptr           CreateAspectRatio();
1105     AspectRatio3D_ptr         CreateAspectRatio3D();
1106     Warping_ptr               CreateWarping();
1107     Taper_ptr                 CreateTaper();
1108     Skew_ptr                  CreateSkew();
1109     Area_ptr                  CreateArea();
1110     Volume3D_ptr              CreateVolume3D();
1111     MaxElementLength2D_ptr    CreateMaxElementLength2D();
1112     MaxElementLength3D_ptr    CreateMaxElementLength3D();
1113     Length_ptr                CreateLength();
1114     Length2D_ptr              CreateLength2D();
1115     MultiConnection_ptr       CreateMultiConnection();
1116     MultiConnection2D_ptr     CreateMultiConnection2D();
1117     BallDiameter_ptr          CreateBallDiameter();
1118     
1119     BelongToGeom_ptr          CreateBelongToGeom();
1120     BelongToPlane_ptr         CreateBelongToPlane();
1121     BelongToCylinder_ptr      CreateBelongToCylinder();
1122     BelongToGenSurface_ptr    CreateBelongToGenSurface();
1123     
1124     LyingOnGeom_ptr           CreateLyingOnGeom();
1125     
1126     FreeBorders_ptr           CreateFreeBorders();
1127     FreeEdges_ptr             CreateFreeEdges();
1128     FreeNodes_ptr             CreateFreeNodes();
1129     FreeFaces_ptr             CreateFreeFaces();
1130
1131     EqualNodes_ptr            CreateEqualNodes();
1132     EqualEdges_ptr            CreateEqualEdges();
1133     EqualFaces_ptr            CreateEqualFaces();
1134     EqualVolumes_ptr          CreateEqualVolumes();
1135
1136     RangeOfIds_ptr            CreateRangeOfIds();
1137     BadOrientedVolume_ptr     CreateBadOrientedVolume();
1138     BareBorderFace_ptr        CreateBareBorderFace();
1139     BareBorderVolume_ptr      CreateBareBorderVolume();
1140     OverConstrainedFace_ptr   CreateOverConstrainedFace();
1141     OverConstrainedVolume_ptr CreateOverConstrainedVolume();
1142     LinearOrQuadratic_ptr     CreateLinearOrQuadratic();
1143     GroupColor_ptr            CreateGroupColor();
1144     ElemGeomType_ptr          CreateElemGeomType();
1145     ElemEntityType_ptr        CreateElemEntityType();
1146     CoplanarFaces_ptr         CreateCoplanarFaces();
1147     ConnectedElements_ptr     CreateConnectedElements();
1148
1149     LessThan_ptr              CreateLessThan();
1150     MoreThan_ptr              CreateMoreThan();
1151     EqualTo_ptr               CreateEqualTo();
1152     
1153     LogicalNOT_ptr            CreateLogicalNOT();
1154     LogicalAND_ptr            CreateLogicalAND();
1155     LogicalOR_ptr             CreateLogicalOR();
1156     
1157     Filter_ptr                CreateFilter();
1158     
1159     FilterLibrary_ptr         LoadLibrary( const char* aFileName );
1160     FilterLibrary_ptr         CreateLibrary();
1161     CORBA::Boolean            DeleteLibrary( const char* aFileName );
1162   };
1163   
1164   
1165   Predicate_i* 
1166   GetPredicate( SMESH::Predicate_ptr thePredicate );
1167
1168   const char*        FunctorTypeToString(SMESH::FunctorType ft);
1169   SMESH::FunctorType StringToFunctorType(const char*       str);
1170 }
1171
1172
1173 #endif