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