Salome HOME
0020511: EDF 1101 SMESH : Add CGNS to Mesh Format Supported
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.hxx
1 // Copyright (C) 2007-2011  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     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);
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   /*
335     Class       : MultiConnection_i
336     Description : Functor for calculating number of faces conneted to the edge
337   */
338   class SMESH_I_EXPORT MultiConnection_i: public virtual POA_SMESH::MultiConnection,
339                            public virtual NumericalFunctor_i
340   {
341   public:
342     MultiConnection_i();
343     FunctorType                     GetFunctorType();
344   };
345   
346   /*
347     Class       : MultiConnection2D_i
348     Description : Functor for calculating number of faces conneted to the edge
349   */
350   class SMESH_I_EXPORT MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
351                              public virtual NumericalFunctor_i
352   {
353   public:
354     MultiConnection2D_i();
355     SMESH::MultiConnection2D::Values*  GetValues();
356     FunctorType                        GetFunctorType();
357     
358   protected:
359     Controls::MultiConnection2DPtr     myMulticonnection2DPtr;
360   };
361   
362   
363   /*
364     PREDICATES
365   */
366   /*
367     Class       : Predicate_i
368     Description : Base class for all predicates
369   */
370   class SMESH_I_EXPORT Predicate_i: public virtual POA_SMESH::Predicate,
371                      public virtual Functor_i
372   {
373   public:
374     CORBA::Boolean                  IsSatisfy( CORBA::Long theElementId );
375     Controls::PredicatePtr          GetPredicate();
376     
377   protected:
378     Controls::PredicatePtr          myPredicatePtr;
379   };
380   
381   
382   /*
383     Class       : BadOrientedVolume_i
384     Description : Verify whether a mesh volume is incorrectly oriented from
385     the point of view of MED convention
386   */
387   class SMESH_I_EXPORT BadOrientedVolume_i: public virtual POA_SMESH::BadOrientedVolume,
388                              public virtual Predicate_i
389   {
390   public:
391     BadOrientedVolume_i();
392     FunctorType                     GetFunctorType();
393   };
394   
395   /*
396     Class       : BareBorderVolume_i
397     Description : Verify whether a mesh volume has a free facet without a face on it
398   */
399   class SMESH_I_EXPORT BareBorderVolume_i: public virtual POA_SMESH::BareBorderVolume,
400                                            public virtual Predicate_i
401   {
402   public:
403     BareBorderVolume_i();
404     FunctorType                     GetFunctorType();
405   };
406   
407   /*
408     Class       : BareBorderFace_i
409     Description : Verify whether a mesh face has a free border without an edge on it
410   */
411   class SMESH_I_EXPORT BareBorderFace_i: public virtual POA_SMESH::BareBorderFace,
412                                            public virtual Predicate_i
413   {
414   public:
415     BareBorderFace_i();
416     FunctorType                     GetFunctorType();
417   };
418   
419   /*
420     Class       : OverConstrainedVolume_i
421     Description : Verify whether a mesh volume has only one facet shared with other volumes
422   */
423   class SMESH_I_EXPORT OverConstrainedVolume_i: public virtual POA_SMESH::OverConstrainedVolume,
424                                            public virtual Predicate_i
425   {
426   public:
427     OverConstrainedVolume_i();
428     FunctorType                     GetFunctorType();
429   };
430   
431   /*
432     Class       : OverConstrainedFace_i
433     Description : Verify whether a mesh face has only one border shared with other faces
434   */
435   class SMESH_I_EXPORT OverConstrainedFace_i: public virtual POA_SMESH::OverConstrainedFace,
436                                            public virtual Predicate_i
437   {
438   public:
439     OverConstrainedFace_i();
440     FunctorType                     GetFunctorType();
441   };
442   
443   /*
444     Class       : BelongToGeom_i
445     Description : Predicate for selection on geometrical support
446   */
447   class SMESH_I_EXPORT BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
448                         public virtual Predicate_i
449   {
450   public:
451     BelongToGeom_i();
452     virtual                         ~BelongToGeom_i();
453     
454     void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
455     void                            SetElementType( ElementType theType );
456     FunctorType                     GetFunctorType();
457     
458     void                            SetGeom( const TopoDS_Shape& theShape );
459     
460     void                            SetShapeName( const char* theName );
461     void                            SetShape( const char* theID, const char* theName );
462     char*                           GetShapeName();
463     char*                           GetShapeID();
464
465     void                            SetTolerance( CORBA::Double );
466     CORBA::Double                   GetTolerance();
467     
468   protected:
469     Controls::BelongToGeomPtr       myBelongToGeomPtr;
470     char*                           myShapeName;
471     char*                           myShapeID;
472   };
473   
474   /*
475     Class       : BelongToSurface_i
476     Description : Verify whether mesh element lie in pointed Geom planar object
477   */
478   class SMESH_I_EXPORT BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
479                            public virtual Predicate_i
480   {
481   public:
482     BelongToSurface_i( const Handle(Standard_Type)& );
483     virtual                         ~BelongToSurface_i();
484     
485     void                            SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
486     
487     void                            SetShapeName( const char* theName, ElementType theType );
488     void                            SetShape( const char* theID, const char* theName, ElementType theType );
489     char*                           GetShapeName();
490     char*                           GetShapeID();
491
492     void                            SetTolerance( CORBA::Double );
493     CORBA::Double                   GetTolerance();
494     
495     void                            SetUseBoundaries( CORBA::Boolean theUseBndRestrictions );
496     CORBA::Boolean                  GetUseBoundaries();
497
498   protected:
499     Controls::ElementsOnSurfacePtr  myElementsOnSurfacePtr;
500     char*                           myShapeName;
501     char*                           myShapeID;
502     Handle(Standard_Type)           mySurfaceType;
503   };
504   
505   /*
506     Class       : BelongToPlane_i
507     Description : Verify whether mesh element lie in pointed Geom planar object
508   */
509   class SMESH_I_EXPORT BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
510                          public virtual BelongToSurface_i
511   {
512   public:
513     BelongToPlane_i();
514     void                            SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
515     FunctorType                     GetFunctorType();
516   };
517   
518   /*
519     Class       : BelongToCylinder_i
520     Description : Verify whether mesh element lie in pointed Geom cylindrical object
521   */
522   class SMESH_I_EXPORT BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
523                             public virtual BelongToSurface_i
524   {
525   public:
526     BelongToCylinder_i();
527     void                            SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
528     FunctorType                     GetFunctorType();
529   };
530
531   /*
532     Class       : BelongToGenSurface_i
533     Description : Verify whether mesh element lie on pointed Geom surfasic object
534   */
535   class BelongToGenSurface_i: public virtual POA_SMESH::BelongToGenSurface,
536                               public virtual BelongToSurface_i
537   {
538   public:
539     BelongToGenSurface_i();
540     void                            SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
541     FunctorType                     GetFunctorType();
542   };
543   
544   /*
545     Class       : LyingOnGeom_i
546     Description : Predicate for selection on geometrical support(lying or partially lying)
547   */
548   class SMESH_I_EXPORT LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
549                        public virtual Predicate_i
550   {
551   public:
552     LyingOnGeom_i();
553     virtual                         ~LyingOnGeom_i();
554     
555     void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
556     void                            SetElementType( ElementType theType );
557     FunctorType                     GetFunctorType();
558     
559     void                            SetGeom( const TopoDS_Shape& theShape );
560     
561     void                            SetShapeName( const char* theName );
562     void                            SetShape( const char* theID, const char* theName );
563     char*                           GetShapeName();
564     char*                           GetShapeID();
565
566     void                            SetTolerance( CORBA::Double );
567     CORBA::Double                   GetTolerance();
568     
569   protected:
570     Controls::LyingOnGeomPtr        myLyingOnGeomPtr;
571     char*                           myShapeName;
572     char*                           myShapeID;
573   };
574   
575   /*
576     Class       : FreeBorders_i
577     Description : Predicate for free borders
578   */
579   class SMESH_I_EXPORT FreeBorders_i: public virtual POA_SMESH::FreeBorders,
580                        public virtual Predicate_i
581   {
582   public:
583     FreeBorders_i();
584     FunctorType                     GetFunctorType();
585   };
586   
587   
588   /*
589     Class       : FreeEdges_i
590     Description : Predicate for free edges
591   */
592   class SMESH_I_EXPORT FreeEdges_i: public virtual POA_SMESH::FreeEdges,
593                      public virtual Predicate_i
594   {
595   public:
596     FreeEdges_i();
597     SMESH::FreeEdges::Borders*      GetBorders();
598     FunctorType                     GetFunctorType();
599     
600   protected:
601     Controls::FreeEdgesPtr          myFreeEdgesPtr;
602   };
603   
604
605   /*
606     Class       : FreeFaces_i
607     Description : Predicate for free faces
608   */
609   class SMESH_I_EXPORT FreeFaces_i: public virtual POA_SMESH::FreeFaces,
610                        public virtual Predicate_i
611   {
612   public:
613     FreeFaces_i();
614     FunctorType                     GetFunctorType();
615   };
616   
617
618   /*
619     Class       : FreeNodes_i
620     Description : Predicate for free nodes
621   */
622   class SMESH_I_EXPORT FreeNodes_i: public virtual POA_SMESH::FreeNodes,
623                        public virtual Predicate_i
624   {
625   public:
626     FreeNodes_i();
627     FunctorType                     GetFunctorType();
628   };
629   
630   
631   /*
632     Class       : RangeOfIds_i
633     Description : Predicate for Range of Ids
634   */
635   class SMESH_I_EXPORT RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
636                       public virtual Predicate_i
637   {
638   public:
639     RangeOfIds_i();
640     void                            SetRange( const SMESH::long_array& theIds );
641     CORBA::Boolean                  SetRangeStr( const char* theRange );
642     char*                           GetRangeStr();
643     
644     void                            SetElementType( ElementType theType );
645     FunctorType                     GetFunctorType();
646     
647   protected:
648     Controls::RangeOfIdsPtr         myRangeOfIdsPtr;
649   };
650
651   /*
652     Class       : LinearOrQuadratic_i
653     Description : Verify whether a mesh element is linear
654   */
655   class SMESH_I_EXPORT LinearOrQuadratic_i: public virtual POA_SMESH::LinearOrQuadratic,
656                              public virtual Predicate_i
657   {
658   public:
659     LinearOrQuadratic_i();
660     FunctorType                    GetFunctorType();
661     void                           SetElementType( ElementType theType );
662
663   private:
664    Controls::LinearOrQuadraticPtr  myLinearOrQuadraticPtr;
665   };
666   
667   /*
668     Class       : GroupColor_i
669     Description : Functor for check color of group to whic mesh element belongs to
670   */
671   class SMESH_I_EXPORT GroupColor_i: public virtual POA_SMESH::GroupColor,
672                   public virtual Predicate_i
673   {
674   public:
675     GroupColor_i();
676     FunctorType             GetFunctorType();
677
678     void                    SetElementType( ElementType theType );
679     void                    SetColorStr( const char* theColor );
680     char*                   GetColorStr();
681
682   private:
683     Controls::GroupColorPtr myGroupColorPtr;
684   };
685   
686   /*
687     Class       : ElemGeomType_i
688     Description : Functor for check element geometry type
689   */
690   class SMESH_I_EXPORT ElemGeomType_i: public virtual POA_SMESH::ElemGeomType,
691                   public virtual Predicate_i
692   {
693   public:
694     ElemGeomType_i();
695     FunctorType             GetFunctorType();
696
697     void                    SetElementType ( ElementType  theType );
698     void                    SetGeometryType( GeometryType theType );
699     GeometryType            GetGeometryType() const;
700
701   private:
702     Controls::ElemGeomTypePtr myElemGeomTypePtr;
703   };
704   
705   /*
706     Class       : CoplanarFaces_i
707     Description : Returns true if a mesh face is a coplanar neighbour to a given one
708   */
709   class SMESH_I_EXPORT CoplanarFaces_i: public virtual POA_SMESH::CoplanarFaces,
710                   public virtual Predicate_i
711   {
712   public:
713     CoplanarFaces_i();
714     FunctorType             GetFunctorType();
715
716     void                    SetFace ( CORBA::Long theFaceID );
717     void                    SetTolerance( CORBA::Double theToler );
718     char*                   GetFaceAsString () const;
719     CORBA::Long             GetFace () const;
720     CORBA::Double           GetTolerance () const;
721   private:
722     Controls::CoplanarFacesPtr myCoplanarFacesPtr;
723   };
724   
725   /*
726     Class       : Comparator_i
727     Description : Base class for comparators
728   */
729   class SMESH_I_EXPORT Comparator_i: public virtual POA_SMESH::Comparator,
730                       public virtual Predicate_i
731   {
732   public:
733     virtual                         ~Comparator_i();
734     
735     virtual void                    SetMargin( CORBA::Double );
736     virtual void                    SetNumFunctor( NumericalFunctor_ptr );
737     
738     Controls::ComparatorPtr         GetComparator();
739     NumericalFunctor_i*             GetNumFunctor_i();
740     CORBA::Double                   GetMargin();
741     
742   protected:
743     Comparator_i();
744   protected:                                  
745     Controls::ComparatorPtr         myComparatorPtr;
746     NumericalFunctor_i*             myNumericalFunctor;
747   };
748   
749   
750   /*
751     Class       : LessThan_i
752     Description : Comparator "<"
753   */
754   class SMESH_I_EXPORT LessThan_i: public virtual POA_SMESH::LessThan,
755                     public virtual Comparator_i
756   {
757   public:
758     LessThan_i();
759     FunctorType                     GetFunctorType();
760   };
761   
762   
763   /*
764     Class       : MoreThan_i
765     Description : Comparator ">"
766   */
767   class SMESH_I_EXPORT MoreThan_i: public virtual POA_SMESH::MoreThan,
768                     public virtual Comparator_i
769   {
770   public:
771     MoreThan_i();
772     FunctorType                     GetFunctorType();
773   };
774   
775   
776   /*
777     Class       : EqualTo_i
778     Description : Comparator "="
779   */
780   class SMESH_I_EXPORT EqualTo_i: public virtual POA_SMESH::EqualTo,
781                    public virtual Comparator_i
782   {
783   public:
784     EqualTo_i();
785     virtual void                    SetTolerance( CORBA::Double );
786     CORBA::Double                   GetTolerance();
787     FunctorType                     GetFunctorType();
788     
789   protected:
790     Controls::EqualToPtr            myEqualToPtr;
791   };
792   
793   
794   /*
795     Class       : LogicalNOT_i
796     Description : Logical NOT predicate
797   */
798   class SMESH_I_EXPORT LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
799                       public virtual Predicate_i
800   {
801   public:
802     LogicalNOT_i();
803   virtual                         ~LogicalNOT_i();
804     
805     virtual void                    SetPredicate( Predicate_ptr );
806     Predicate_i*                    GetPredicate_i();
807     FunctorType                     GetFunctorType();
808     
809   protected:
810     Controls::LogicalNOTPtr         myLogicalNOTPtr;
811     Predicate_i*                    myPredicate;
812   };
813   
814   
815   /*
816     Class       : LogicalBinary_i
817     Description : Base class for binary logical predicate
818   */
819   class SMESH_I_EXPORT LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
820                          public virtual Predicate_i
821   {
822   public:
823     virtual                         ~LogicalBinary_i();
824     virtual void                    SetMesh( SMESH_Mesh_ptr theMesh );
825     virtual void                    SetPredicate1( Predicate_ptr );
826     virtual void                    SetPredicate2( Predicate_ptr );
827     
828     Controls::LogicalBinaryPtr      GetLogicalBinary();
829     Predicate_i*                    GetPredicate1_i();
830     Predicate_i*                    GetPredicate2_i();
831     
832   protected:
833     LogicalBinary_i();
834   protected:  
835     Controls::LogicalBinaryPtr      myLogicalBinaryPtr;
836     Predicate_i*                    myPredicate1;
837     Predicate_i*                    myPredicate2;
838   };
839   
840   
841   /*
842     Class       : LogicalAND_i
843     Description : Logical AND
844   */
845   class SMESH_I_EXPORT LogicalAND_i: public virtual POA_SMESH::LogicalAND,
846                       public virtual LogicalBinary_i
847   {
848   public:
849     LogicalAND_i();
850     FunctorType                     GetFunctorType();
851   };
852   
853   
854   /*
855     Class       : LogicalOR_i
856     Description : Logical OR
857   */
858   class SMESH_I_EXPORT LogicalOR_i: public virtual POA_SMESH::LogicalOR,
859                      public virtual LogicalBinary_i
860   {
861   public:
862     LogicalOR_i();
863     FunctorType                     GetFunctorType();
864   };
865   
866   
867   /*
868     FILTER
869   */
870   class SMESH_I_EXPORT Filter_i: public virtual POA_SMESH::Filter,
871                                  public virtual SALOME::GenericObj_i
872   {
873   public:
874     Filter_i();
875     ~Filter_i();
876     
877     virtual
878     void
879     SetPredicate( Predicate_ptr );
880
881     virtual
882     void
883     SetMesh( SMESH_Mesh_ptr );
884
885     static
886     void
887     GetElementsId( Predicate_i*,
888                    const SMDS_Mesh*,
889                    Controls::Filter::TIdSequence& );
890     static
891     void           
892     GetElementsId( Predicate_i*,
893                    SMESH_Mesh_ptr,
894                    Controls::Filter::TIdSequence& );
895     
896     virtual
897     long_array*      
898     GetElementsId( SMESH_Mesh_ptr );
899
900     virtual
901     ElementType      
902     GetElementType();
903     
904     virtual
905     CORBA::Boolean   
906     GetCriteria( SMESH::Filter::Criteria_out theCriteria );
907
908     virtual
909     CORBA::Boolean
910     SetCriteria( const SMESH::Filter::Criteria& theCriteria );
911     
912     virtual
913     Predicate_ptr
914     GetPredicate();
915
916     Predicate_i*     GetPredicate_i();
917
918     // =========================
919     // SMESH_IDSource interface
920     // =========================
921     virtual SMESH::long_array*           GetIDs();
922     virtual SMESH::long_array*           GetMeshInfo();
923     virtual SMESH::array_of_ElementType* GetTypes();
924     virtual SMESH::SMESH_Mesh_ptr        GetMesh();
925
926     /*!
927      * \brief Object notified on change of predicate
928      */
929     struct TPredicateChangeWaiter
930     {
931       virtual void PredicateChanged() = 0;
932     };
933     void AddWaiter( TPredicateChangeWaiter* waiter );
934     void RemoveWaiter( TPredicateChangeWaiter* waiter );
935
936   private:
937     Controls::Filter myFilter;
938     Predicate_i*     myPredicate;
939     SMESH_Mesh_var   myMesh;
940
941     std::list<TPredicateChangeWaiter*> myWaiters;
942   };
943   
944   
945   /*
946     FILTER LIBRARY
947   */
948   class SMESH_I_EXPORT FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
949                                         public virtual SALOME::GenericObj_i
950   {
951   public:
952     FilterLibrary_i( const char* theFileName );
953     FilterLibrary_i();
954     ~FilterLibrary_i();
955     
956     Filter_ptr              Copy( const char* theFilterName );
957     
958     CORBA::Boolean          Add     ( const char* theFilterName, Filter_ptr theFilter );
959     CORBA::Boolean          AddEmpty( const char* theFilterName, ElementType theType );
960     CORBA::Boolean          Delete  ( const char* theFilterName );
961     CORBA::Boolean          Replace ( const char* theFilterName, 
962                                       const char* theNewName, 
963                                       Filter_ptr  theFilter );
964     
965     CORBA::Boolean          Save();
966     CORBA::Boolean          SaveAs( const char* aFileName );
967     
968     CORBA::Boolean          IsPresent( const char* aFilterName );
969     CORBA::Long             NbFilters( ElementType );
970     string_array*           GetNames( ElementType );
971     string_array*           GetAllNames();
972     void                    SetFileName( const char* theFileName );
973     char*                   GetFileName();
974     
975   private:
976     char*                   myFileName;
977     LDOM_Document           myDoc;
978     FilterManager_var       myFilterMgr;
979   };
980   
981   
982   /*
983     FILTER MANAGER
984   */
985   
986   class SMESH_I_EXPORT FilterManager_i: public virtual POA_SMESH::FilterManager,
987                          public virtual SALOME::GenericObj_i
988   {
989   public:
990     FilterManager_i();
991     ~FilterManager_i();
992
993     MinimumAngle_ptr          CreateMinimumAngle();
994     AspectRatio_ptr           CreateAspectRatio();
995     AspectRatio3D_ptr         CreateAspectRatio3D();
996     Warping_ptr               CreateWarping();
997     Taper_ptr                 CreateTaper();
998     Skew_ptr                  CreateSkew();
999     Area_ptr                  CreateArea();
1000     Volume3D_ptr              CreateVolume3D();
1001     MaxElementLength2D_ptr    CreateMaxElementLength2D();
1002     MaxElementLength3D_ptr    CreateMaxElementLength3D();
1003     Length_ptr                CreateLength();
1004     Length2D_ptr              CreateLength2D();
1005     MultiConnection_ptr       CreateMultiConnection();
1006     MultiConnection2D_ptr     CreateMultiConnection2D();
1007     
1008     BelongToGeom_ptr          CreateBelongToGeom();
1009     BelongToPlane_ptr         CreateBelongToPlane();
1010     BelongToCylinder_ptr      CreateBelongToCylinder();
1011     BelongToGenSurface_ptr    CreateBelongToGenSurface();
1012     
1013     LyingOnGeom_ptr           CreateLyingOnGeom();
1014     
1015     FreeBorders_ptr           CreateFreeBorders();
1016     FreeEdges_ptr             CreateFreeEdges();
1017     FreeNodes_ptr             CreateFreeNodes();
1018     FreeFaces_ptr             CreateFreeFaces();
1019     
1020     RangeOfIds_ptr            CreateRangeOfIds();
1021     BadOrientedVolume_ptr     CreateBadOrientedVolume();
1022     BareBorderFace_ptr        CreateBareBorderFace();
1023     BareBorderVolume_ptr      CreateBareBorderVolume();
1024     OverConstrainedFace_ptr   CreateOverConstrainedFace();
1025     OverConstrainedVolume_ptr CreateOverConstrainedVolume();
1026     LinearOrQuadratic_ptr     CreateLinearOrQuadratic();
1027     GroupColor_ptr            CreateGroupColor();
1028     ElemGeomType_ptr          CreateElemGeomType();
1029     CoplanarFaces_ptr         CreateCoplanarFaces();
1030
1031     LessThan_ptr              CreateLessThan();
1032     MoreThan_ptr              CreateMoreThan();
1033     EqualTo_ptr               CreateEqualTo();
1034     
1035     LogicalNOT_ptr            CreateLogicalNOT();
1036     LogicalAND_ptr            CreateLogicalAND();
1037     LogicalOR_ptr             CreateLogicalOR();
1038     
1039     Filter_ptr                CreateFilter();
1040     
1041     FilterLibrary_ptr         LoadLibrary( const char* aFileName );
1042     FilterLibrary_ptr         CreateLibrary();
1043     CORBA::Boolean            DeleteLibrary( const char* aFileName );
1044   };
1045   
1046   
1047   Predicate_i* 
1048   GetPredicate( SMESH::Predicate_ptr thePredicate );
1049
1050   const char*        FunctorTypeToString(SMESH::FunctorType ft);
1051   SMESH::FunctorType StringToFunctorType(const char*       str);
1052 }
1053
1054
1055 #endif