Salome HOME
Merge from V6_5_BR 05/06/2012
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.hxx
1 // Copyright (C) 2007-2012  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       : EqualNodes_i
633     Description : Predicate for equal nodes
634   */
635   class SMESH_I_EXPORT EqualNodes_i: public virtual POA_SMESH::EqualNodes,
636                                      public virtual Predicate_i
637   {
638   public:
639     EqualNodes_i();
640     FunctorType                     GetFunctorType();
641     void                            SetTolerance( double );
642     double                          GetTolerance();
643
644   private:
645     Controls::CoincidentNodesPtr myCoincidentNodesPtr;
646   };
647   /*
648     Class       : EqualEdges_i
649     Description : Predicate for equal edges
650   */
651   class SMESH_I_EXPORT EqualEdges_i: public virtual POA_SMESH::EqualEdges,
652                                      public virtual Predicate_i
653   {
654   public:
655     EqualEdges_i();
656     FunctorType                     GetFunctorType();
657   };
658   /*
659     Class       : EqualFaces_i
660     Description : Predicate for equal Faces
661   */
662   class SMESH_I_EXPORT EqualFaces_i: public virtual POA_SMESH::EqualFaces,
663                                      public virtual Predicate_i
664   {
665   public:
666     EqualFaces_i();
667     FunctorType                     GetFunctorType();
668   };
669   /*
670     Class       : EqualVolumes_i
671     Description : Predicate for equal Volumes
672   */
673   class SMESH_I_EXPORT EqualVolumes_i: public virtual POA_SMESH::EqualVolumes,
674                                        public virtual Predicate_i
675   {
676   public:
677     EqualVolumes_i();
678     FunctorType                     GetFunctorType();
679   };
680   
681   
682   /*
683     Class       : RangeOfIds_i
684     Description : Predicate for Range of Ids
685   */
686   class SMESH_I_EXPORT RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
687                       public virtual Predicate_i
688   {
689   public:
690     RangeOfIds_i();
691     void                            SetRange( const SMESH::long_array& theIds );
692     CORBA::Boolean                  SetRangeStr( const char* theRange );
693     char*                           GetRangeStr();
694     
695     void                            SetElementType( ElementType theType );
696     FunctorType                     GetFunctorType();
697     
698   protected:
699     Controls::RangeOfIdsPtr         myRangeOfIdsPtr;
700   };
701
702   /*
703     Class       : LinearOrQuadratic_i
704     Description : Verify whether a mesh element is linear
705   */
706   class SMESH_I_EXPORT LinearOrQuadratic_i: public virtual POA_SMESH::LinearOrQuadratic,
707                              public virtual Predicate_i
708   {
709   public:
710     LinearOrQuadratic_i();
711     FunctorType                    GetFunctorType();
712     void                           SetElementType( ElementType theType );
713
714   private:
715    Controls::LinearOrQuadraticPtr  myLinearOrQuadraticPtr;
716   };
717   
718   /*
719     Class       : GroupColor_i
720     Description : Functor for check color of group to whic mesh element belongs to
721   */
722   class SMESH_I_EXPORT GroupColor_i: public virtual POA_SMESH::GroupColor,
723                   public virtual Predicate_i
724   {
725   public:
726     GroupColor_i();
727     FunctorType             GetFunctorType();
728
729     void                    SetElementType( ElementType theType );
730     void                    SetColorStr( const char* theColor );
731     char*                   GetColorStr();
732
733   private:
734     Controls::GroupColorPtr myGroupColorPtr;
735   };
736   
737   /*
738     Class       : ElemGeomType_i
739     Description : Functor for check element geometry type
740   */
741   class SMESH_I_EXPORT ElemGeomType_i: public virtual POA_SMESH::ElemGeomType,
742                   public virtual Predicate_i
743   {
744   public:
745     ElemGeomType_i();
746     FunctorType             GetFunctorType();
747
748     void                    SetElementType ( ElementType  theType );
749     void                    SetGeometryType( GeometryType theType );
750     GeometryType            GetGeometryType() const;
751
752   private:
753     Controls::ElemGeomTypePtr myElemGeomTypePtr;
754   };
755   
756   /*
757     Class       : CoplanarFaces_i
758     Description : Returns true if a mesh face is a coplanar neighbour to a given one
759   */
760   class SMESH_I_EXPORT CoplanarFaces_i: public virtual POA_SMESH::CoplanarFaces,
761                   public virtual Predicate_i
762   {
763   public:
764     CoplanarFaces_i();
765     FunctorType             GetFunctorType();
766
767     void                    SetFace ( CORBA::Long theFaceID );
768     void                    SetTolerance( CORBA::Double theToler );
769     char*                   GetFaceAsString () const;
770     CORBA::Long             GetFace () const;
771     CORBA::Double           GetTolerance () const;
772   private:
773     Controls::CoplanarFacesPtr myCoplanarFacesPtr;
774   };
775   
776   /*
777     Class       : Comparator_i
778     Description : Base class for comparators
779   */
780   class SMESH_I_EXPORT Comparator_i: public virtual POA_SMESH::Comparator,
781                       public virtual Predicate_i
782   {
783   public:
784     virtual                         ~Comparator_i();
785     
786     virtual void                    SetMargin( CORBA::Double );
787     virtual void                    SetNumFunctor( NumericalFunctor_ptr );
788     
789     Controls::ComparatorPtr         GetComparator();
790     NumericalFunctor_i*             GetNumFunctor_i();
791     CORBA::Double                   GetMargin();
792     
793   protected:
794     Comparator_i();
795   protected:                                  
796     Controls::ComparatorPtr         myComparatorPtr;
797     NumericalFunctor_i*             myNumericalFunctor;
798   };
799   
800   
801   /*
802     Class       : LessThan_i
803     Description : Comparator "<"
804   */
805   class SMESH_I_EXPORT LessThan_i: public virtual POA_SMESH::LessThan,
806                     public virtual Comparator_i
807   {
808   public:
809     LessThan_i();
810     FunctorType                     GetFunctorType();
811   };
812   
813   
814   /*
815     Class       : MoreThan_i
816     Description : Comparator ">"
817   */
818   class SMESH_I_EXPORT MoreThan_i: public virtual POA_SMESH::MoreThan,
819                     public virtual Comparator_i
820   {
821   public:
822     MoreThan_i();
823     FunctorType                     GetFunctorType();
824   };
825   
826   
827   /*
828     Class       : EqualTo_i
829     Description : Comparator "="
830   */
831   class SMESH_I_EXPORT EqualTo_i: public virtual POA_SMESH::EqualTo,
832                    public virtual Comparator_i
833   {
834   public:
835     EqualTo_i();
836     virtual void                    SetTolerance( CORBA::Double );
837     CORBA::Double                   GetTolerance();
838     FunctorType                     GetFunctorType();
839     
840   protected:
841     Controls::EqualToPtr            myEqualToPtr;
842   };
843   
844   
845   /*
846     Class       : LogicalNOT_i
847     Description : Logical NOT predicate
848   */
849   class SMESH_I_EXPORT LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
850                       public virtual Predicate_i
851   {
852   public:
853     LogicalNOT_i();
854   virtual                         ~LogicalNOT_i();
855     
856     virtual void                    SetPredicate( Predicate_ptr );
857     Predicate_i*                    GetPredicate_i();
858     FunctorType                     GetFunctorType();
859     
860   protected:
861     Controls::LogicalNOTPtr         myLogicalNOTPtr;
862     Predicate_i*                    myPredicate;
863   };
864   
865   
866   /*
867     Class       : LogicalBinary_i
868     Description : Base class for binary logical predicate
869   */
870   class SMESH_I_EXPORT LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
871                          public virtual Predicate_i
872   {
873   public:
874     virtual                         ~LogicalBinary_i();
875     virtual void                    SetMesh( SMESH_Mesh_ptr theMesh );
876     virtual void                    SetPredicate1( Predicate_ptr );
877     virtual void                    SetPredicate2( Predicate_ptr );
878     
879     Controls::LogicalBinaryPtr      GetLogicalBinary();
880     Predicate_i*                    GetPredicate1_i();
881     Predicate_i*                    GetPredicate2_i();
882     
883   protected:
884     LogicalBinary_i();
885   protected:  
886     Controls::LogicalBinaryPtr      myLogicalBinaryPtr;
887     Predicate_i*                    myPredicate1;
888     Predicate_i*                    myPredicate2;
889   };
890   
891   
892   /*
893     Class       : LogicalAND_i
894     Description : Logical AND
895   */
896   class SMESH_I_EXPORT LogicalAND_i: public virtual POA_SMESH::LogicalAND,
897                       public virtual LogicalBinary_i
898   {
899   public:
900     LogicalAND_i();
901     FunctorType                     GetFunctorType();
902   };
903   
904   
905   /*
906     Class       : LogicalOR_i
907     Description : Logical OR
908   */
909   class SMESH_I_EXPORT LogicalOR_i: public virtual POA_SMESH::LogicalOR,
910                      public virtual LogicalBinary_i
911   {
912   public:
913     LogicalOR_i();
914     FunctorType                     GetFunctorType();
915   };
916   
917   
918   /*
919     FILTER
920   */
921   class SMESH_I_EXPORT Filter_i: public virtual POA_SMESH::Filter,
922                                  public virtual SALOME::GenericObj_i
923   {
924   public:
925     Filter_i();
926     ~Filter_i();
927     
928     virtual
929     void
930     SetPredicate( Predicate_ptr );
931
932     virtual
933     void
934     SetMesh( SMESH_Mesh_ptr );
935
936     static
937     void
938     GetElementsId( Predicate_i*,
939                    const SMDS_Mesh*,
940                    Controls::Filter::TIdSequence& );
941     static
942     void           
943     GetElementsId( Predicate_i*,
944                    SMESH_Mesh_ptr,
945                    Controls::Filter::TIdSequence& );
946     
947     virtual
948     long_array*      
949     GetElementsId( SMESH_Mesh_ptr );
950
951     virtual
952     ElementType      
953     GetElementType();
954     
955     virtual
956     CORBA::Boolean   
957     GetCriteria( SMESH::Filter::Criteria_out theCriteria );
958
959     virtual
960     CORBA::Boolean
961     SetCriteria( const SMESH::Filter::Criteria& theCriteria );
962     
963     virtual
964     Predicate_ptr
965     GetPredicate();
966
967     Predicate_i*     GetPredicate_i();
968
969     // =========================
970     // SMESH_IDSource interface
971     // =========================
972     virtual SMESH::long_array*           GetIDs();
973     virtual SMESH::long_array*           GetMeshInfo();
974     virtual SMESH::array_of_ElementType* GetTypes();
975     virtual SMESH::SMESH_Mesh_ptr        GetMesh();
976     virtual bool                         IsMeshInfoCorrect() { return true; }
977
978     /*!
979      * \brief Object notified on change of predicate
980      */
981     struct TPredicateChangeWaiter
982     {
983       virtual void PredicateChanged() = 0;
984     };
985     void AddWaiter( TPredicateChangeWaiter* waiter );
986     void RemoveWaiter( TPredicateChangeWaiter* waiter );
987
988   private:
989     Controls::Filter myFilter;
990     Predicate_i*     myPredicate;
991     SMESH_Mesh_var   myMesh;
992
993     std::list<TPredicateChangeWaiter*> myWaiters;
994   };
995   
996   
997   /*
998     FILTER LIBRARY
999   */
1000   class SMESH_I_EXPORT FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
1001                                         public virtual SALOME::GenericObj_i
1002   {
1003   public:
1004     FilterLibrary_i( const char* theFileName );
1005     FilterLibrary_i();
1006     ~FilterLibrary_i();
1007     
1008     Filter_ptr              Copy( const char* theFilterName );
1009     
1010     CORBA::Boolean          Add     ( const char* theFilterName, Filter_ptr theFilter );
1011     CORBA::Boolean          AddEmpty( const char* theFilterName, ElementType theType );
1012     CORBA::Boolean          Delete  ( const char* theFilterName );
1013     CORBA::Boolean          Replace ( const char* theFilterName, 
1014                                       const char* theNewName, 
1015                                       Filter_ptr  theFilter );
1016     
1017     CORBA::Boolean          Save();
1018     CORBA::Boolean          SaveAs( const char* aFileName );
1019     
1020     CORBA::Boolean          IsPresent( const char* aFilterName );
1021     CORBA::Long             NbFilters( ElementType );
1022     string_array*           GetNames( ElementType );
1023     string_array*           GetAllNames();
1024     void                    SetFileName( const char* theFileName );
1025     char*                   GetFileName();
1026     
1027   private:
1028     char*                   myFileName;
1029     LDOM_Document           myDoc;
1030     FilterManager_var       myFilterMgr;
1031   };
1032   
1033   
1034   /*
1035     FILTER MANAGER
1036   */
1037   
1038   class SMESH_I_EXPORT FilterManager_i: public virtual POA_SMESH::FilterManager,
1039                          public virtual SALOME::GenericObj_i
1040   {
1041   public:
1042     FilterManager_i();
1043     ~FilterManager_i();
1044
1045     MinimumAngle_ptr          CreateMinimumAngle();
1046     AspectRatio_ptr           CreateAspectRatio();
1047     AspectRatio3D_ptr         CreateAspectRatio3D();
1048     Warping_ptr               CreateWarping();
1049     Taper_ptr                 CreateTaper();
1050     Skew_ptr                  CreateSkew();
1051     Area_ptr                  CreateArea();
1052     Volume3D_ptr              CreateVolume3D();
1053     MaxElementLength2D_ptr    CreateMaxElementLength2D();
1054     MaxElementLength3D_ptr    CreateMaxElementLength3D();
1055     Length_ptr                CreateLength();
1056     Length2D_ptr              CreateLength2D();
1057     MultiConnection_ptr       CreateMultiConnection();
1058     MultiConnection2D_ptr     CreateMultiConnection2D();
1059     
1060     BelongToGeom_ptr          CreateBelongToGeom();
1061     BelongToPlane_ptr         CreateBelongToPlane();
1062     BelongToCylinder_ptr      CreateBelongToCylinder();
1063     BelongToGenSurface_ptr    CreateBelongToGenSurface();
1064     
1065     LyingOnGeom_ptr           CreateLyingOnGeom();
1066     
1067     FreeBorders_ptr           CreateFreeBorders();
1068     FreeEdges_ptr             CreateFreeEdges();
1069     FreeNodes_ptr             CreateFreeNodes();
1070     FreeFaces_ptr             CreateFreeFaces();
1071
1072     EqualNodes_ptr            CreateEqualNodes();
1073     EqualEdges_ptr            CreateEqualEdges();
1074     EqualFaces_ptr            CreateEqualFaces();
1075     EqualVolumes_ptr          CreateEqualVolumes();
1076
1077     RangeOfIds_ptr            CreateRangeOfIds();
1078     BadOrientedVolume_ptr     CreateBadOrientedVolume();
1079     BareBorderFace_ptr        CreateBareBorderFace();
1080     BareBorderVolume_ptr      CreateBareBorderVolume();
1081     OverConstrainedFace_ptr   CreateOverConstrainedFace();
1082     OverConstrainedVolume_ptr CreateOverConstrainedVolume();
1083     LinearOrQuadratic_ptr     CreateLinearOrQuadratic();
1084     GroupColor_ptr            CreateGroupColor();
1085     ElemGeomType_ptr          CreateElemGeomType();
1086     CoplanarFaces_ptr         CreateCoplanarFaces();
1087
1088     LessThan_ptr              CreateLessThan();
1089     MoreThan_ptr              CreateMoreThan();
1090     EqualTo_ptr               CreateEqualTo();
1091     
1092     LogicalNOT_ptr            CreateLogicalNOT();
1093     LogicalAND_ptr            CreateLogicalAND();
1094     LogicalOR_ptr             CreateLogicalOR();
1095     
1096     Filter_ptr                CreateFilter();
1097     
1098     FilterLibrary_ptr         LoadLibrary( const char* aFileName );
1099     FilterLibrary_ptr         CreateLibrary();
1100     CORBA::Boolean            DeleteLibrary( const char* aFileName );
1101   };
1102   
1103   
1104   Predicate_i* 
1105   GetPredicate( SMESH::Predicate_ptr thePredicate );
1106
1107   const char*        FunctorTypeToString(SMESH::FunctorType ft);
1108   SMESH::FunctorType StringToFunctorType(const char*       str);
1109 }
1110
1111
1112 #endif