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