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