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