Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.hxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
24 //  File   : SMESH_Filter_i.hxx
25 //  Author : Alexey Petrov, OCC
26 //  Module : SMESH
27 //
28 #ifndef _SMESH_FILTER_I_HXX_
29 #define _SMESH_FILTER_I_HXX_
30
31 #include "SMESH.hxx"
32
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(SMESH_Filter)
35
36 #include <LDOM_Document.hxx>
37 #include <TopoDS_Shape.hxx>
38
39 #include "SALOME_GenericObj_i.hh"
40 #include "SMESH_ControlsDef.hxx"
41
42 #include <list>
43
44 class SMESHDS_Mesh;
45
46 namespace SMESH
47 {
48
49   // ================================================================================
50   namespace Controls
51   {
52
53     /*
54       Class       : BelongToGeom
55       Description : Predicate for verifying whether entiy belong to
56       specified geometrical support
57     */
58     class SMESH_I_EXPORT BelongToGeom: public virtual Predicate
59     {
60     public:
61       BelongToGeom();
62
63       virtual void                    SetMesh( const SMDS_Mesh* theMesh );
64       virtual void                    SetGeom( const TopoDS_Shape& theShape );
65
66       virtual bool                    IsSatisfy( long theElementId );
67
68       virtual void                    SetType( SMDSAbs_ElementType theType );
69       virtual                         SMDSAbs_ElementType GetType() const;
70
71       TopoDS_Shape                    GetShape();
72       const SMESHDS_Mesh*             GetMeshDS() const;
73
74       void                            SetTolerance( double );
75       double                          GetTolerance();
76
77     private:
78       virtual void                    init();
79
80       TopoDS_Shape                    myShape;
81       const SMESHDS_Mesh*             myMeshDS;
82       SMDSAbs_ElementType             myType;
83       bool                            myIsSubshape;
84       double                          myTolerance;          // only if myIsSubshape == false
85       Controls::ElementsOnShapePtr    myElementsOnShapePtr; // only if myIsSubshape == false
86     };
87     typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
88
89     /*
90       Class       : LyingOnGeom
91       Description : Predicate for verifying whether entiy lying or partially lying on
92       specified geometrical support
93     */
94     class SMESH_I_EXPORT LyingOnGeom: public virtual Predicate
95     {
96     public:
97       LyingOnGeom();
98       
99       virtual void                    SetMesh( const SMDS_Mesh* theMesh );
100       virtual void                    SetGeom( const TopoDS_Shape& theShape );
101       
102       virtual bool                    IsSatisfy( long theElementId );
103       
104       virtual void                    SetType( SMDSAbs_ElementType theType );
105       virtual                         SMDSAbs_ElementType GetType() const;
106       
107       TopoDS_Shape                    GetShape();
108       const SMESHDS_Mesh*             GetMeshDS() const;
109
110       void                            SetTolerance( double );
111       double                          GetTolerance();
112       
113       virtual bool                    Contains( const SMESHDS_Mesh*     theMeshDS,
114                                                 const TopoDS_Shape&     theShape,
115                                                 const SMDS_MeshElement* theElem,
116                                                 TopAbs_ShapeEnum        theFindShapeEnum,
117                                                 TopAbs_ShapeEnum        theAvoidShapeEnum = TopAbs_SHAPE );
118     private:
119       virtual void                    init();
120
121       TopoDS_Shape                    myShape;
122       const SMESHDS_Mesh*             myMeshDS;
123       SMDSAbs_ElementType             myType;
124       bool                            myIsSubshape;
125       double                          myTolerance;          // only if myIsSubshape == false
126       Controls::ElementsOnShapePtr    myElementsOnShapePtr; // only if myIsSubshape == false
127     };
128     typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
129
130   } // namespace Controls
131
132   // ================================================================================
133   /*
134     FUNCTORS
135   */
136   
137   /*
138     Class       : Functor_i
139     Description : An abstact class for all functors 
140   */
141   class SMESH_I_EXPORT Functor_i: public virtual POA_SMESH::Functor,
142                                   public virtual SALOME::GenericObj_i
143   {
144   public:
145     void                            SetMesh( SMESH_Mesh_ptr theMesh );
146     Controls::FunctorPtr            GetFunctor(){ return myFunctorPtr;}
147     ElementType                     GetElementType();
148     
149   protected:
150     Functor_i();
151     ~Functor_i();
152   protected:                                
153     Controls::FunctorPtr            myFunctorPtr;
154   };
155   
156   /*
157     Class       : NumericalFunctor_i
158     Description : Base class for numerical functors 
159   */
160   class SMESH_I_EXPORT NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,
161                                            public virtual Functor_i
162   {
163   public:
164     CORBA::Double                   GetValue( CORBA::Long theElementId );
165     SMESH::Histogram*               GetHistogram(CORBA::Short nbIntervals);
166     void                            SetPrecision( CORBA::Long thePrecision );
167     CORBA::Long                     GetPrecision();
168     Controls::NumericalFunctorPtr   GetNumericalFunctor();
169     
170   protected:
171     Controls::NumericalFunctorPtr   myNumericalFunctorPtr;
172   };
173   
174   
175   /*
176     Class       : SMESH_MinimumAngleFunct
177     Description : Functor for calculation of minimum angle
178   */
179   class SMESH_I_EXPORT MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,
180                                        public virtual NumericalFunctor_i
181   {
182   public:
183     MinimumAngle_i();
184     FunctorType                     GetFunctorType();
185   };
186   
187   
188   /*
189     Class       : AspectRatio_i
190     Description : Functor for calculating aspect ratio
191   */
192   class SMESH_I_EXPORT AspectRatio_i: public virtual POA_SMESH::AspectRatio,
193                                       public virtual NumericalFunctor_i
194   {
195   public:
196     AspectRatio_i();
197     FunctorType                     GetFunctorType();
198   };
199   
200   
201   /*
202     Class       : AspectRatio3D_i
203     Description : Functor for calculating aspect ratio for 3D
204   */
205   class SMESH_I_EXPORT AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D,
206                                         public virtual NumericalFunctor_i
207   {
208   public:
209     AspectRatio3D_i();
210     FunctorType                     GetFunctorType();
211   };
212   
213
214   /*
215     Class       : Warping_i
216     Description : Functor for calculating warping
217   */
218   class SMESH_I_EXPORT Warping_i: public virtual POA_SMESH::Warping,
219                                   public virtual NumericalFunctor_i
220   {
221   public:
222     Warping_i();
223     FunctorType                     GetFunctorType();
224   };
225   
226   
227   /*
228     Class       : Taper_i
229     Description : Functor for calculating taper
230   */
231   class SMESH_I_EXPORT Taper_i: public virtual POA_SMESH::Taper,
232                                 public virtual NumericalFunctor_i
233   {
234   public:
235     Taper_i();
236     FunctorType                     GetFunctorType();
237   };
238   
239   
240   /*
241     Class       : Skew_i
242     Description : Functor for calculating skew in degrees
243   */
244   class SMESH_I_EXPORT Skew_i: public virtual POA_SMESH::Skew,
245                                public virtual NumericalFunctor_i
246   {
247   public:
248     Skew_i();
249     FunctorType                     GetFunctorType();
250   };
251   
252   
253   /*
254     Class       : Area_i
255     Description : Functor for calculating area
256   */
257   class SMESH_I_EXPORT Area_i: public virtual POA_SMESH::Area,
258                                public virtual NumericalFunctor_i
259   {
260   public:
261     Area_i();
262     FunctorType                     GetFunctorType();
263   };
264   
265   
266   /*
267     Class       : Volume3D_i
268     Description : Functor for calculating volume of 3D element
269   */
270   class SMESH_I_EXPORT Volume3D_i: public virtual POA_SMESH::Volume3D,
271                                    public virtual NumericalFunctor_i
272   {
273   public:
274     Volume3D_i();
275     FunctorType                     GetFunctorType();
276   };
277   
278   
279   /*
280     Class       : MaxElementLength2D_i
281     Description : Functor for calculating maximum length of 2D element
282   */
283   class SMESH_I_EXPORT MaxElementLength2D_i: public virtual POA_SMESH::MaxElementLength2D,
284                                              public virtual NumericalFunctor_i
285   {
286   public:
287     MaxElementLength2D_i();
288     FunctorType                     GetFunctorType();
289   };
290   
291   
292   /*
293     Class       : MaxElementLength3D_i
294     Description : Functor for calculating maximum length of 3D element
295   */
296   class SMESH_I_EXPORT MaxElementLength3D_i: public virtual POA_SMESH::MaxElementLength3D,
297                                              public virtual NumericalFunctor_i
298   {
299   public:
300     MaxElementLength3D_i();
301     FunctorType                     GetFunctorType();
302   };
303   
304   
305   /*
306     Class       : Length_i
307     Description : Functor for calculating length of edge
308   */
309   class SMESH_I_EXPORT Length_i: public virtual POA_SMESH::Length,
310                                  public virtual NumericalFunctor_i
311   {
312   public:
313     Length_i();
314     FunctorType                     GetFunctorType();
315   };
316   
317   /*
318     Class       : Length2D_i
319     Description : Functor for calculating length of edge
320   */
321   class SMESH_I_EXPORT Length2D_i: public virtual POA_SMESH::Length2D,
322                                    public virtual NumericalFunctor_i
323   {
324   public:
325     Length2D_i();
326     SMESH::Length2D::Values*        GetValues();
327     FunctorType                     GetFunctorType();
328     
329   protected:
330     Controls::Length2DPtr          myLength2DPtr;
331   };
332   
333   
334   /*
335     Class       : MultiConnection_i
336     Description : Functor for calculating number of faces conneted to the edge
337   */
338   class SMESH_I_EXPORT MultiConnection_i: public virtual POA_SMESH::MultiConnection,
339                                           public virtual NumericalFunctor_i
340   {
341   public:
342     MultiConnection_i();
343     FunctorType                     GetFunctorType();
344   };
345   
346   /*
347     Class       : MultiConnection2D_i
348     Description : Functor for calculating number of faces conneted to the edge
349   */
350   class SMESH_I_EXPORT MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
351                                             public virtual NumericalFunctor_i
352   {
353   public:
354     MultiConnection2D_i();
355     SMESH::MultiConnection2D::Values*  GetValues();
356     FunctorType                        GetFunctorType();
357     
358   protected:
359     Controls::MultiConnection2DPtr     myMulticonnection2DPtr;
360   };
361   
362   /*
363     Class       : BallDiameter_i
364     Description : Functor returning diameter of a ball element
365   */
366   class SMESH_I_EXPORT BallDiameter_i: public virtual POA_SMESH::BallDiameter,
367                                        public virtual NumericalFunctor_i
368   {
369   public:
370     BallDiameter_i();
371     FunctorType                     GetFunctorType();
372   };
373   
374   
375   /*
376     PREDICATES
377   */
378   /*
379     Class       : Predicate_i
380     Description : Base class for all predicates
381   */
382   class SMESH_I_EXPORT Predicate_i: public virtual POA_SMESH::Predicate,
383                                     public virtual Functor_i
384   {
385   public:
386     CORBA::Boolean                  IsSatisfy( CORBA::Long theElementId );
387     Controls::PredicatePtr          GetPredicate();
388     
389   protected:
390     Controls::PredicatePtr          myPredicatePtr;
391   };
392   
393   
394   /*
395     Class       : BadOrientedVolume_i
396     Description : Verify whether a mesh volume is incorrectly oriented from
397     the point of view of MED convention
398   */
399   class SMESH_I_EXPORT BadOrientedVolume_i: public virtual POA_SMESH::BadOrientedVolume,
400                                             public virtual Predicate_i
401   {
402   public:
403     BadOrientedVolume_i();
404     FunctorType                     GetFunctorType();
405   };
406   
407   /*
408     Class       : BareBorderVolume_i
409     Description : Verify whether a mesh volume has a free facet without a face on it
410   */
411   class SMESH_I_EXPORT BareBorderVolume_i: public virtual POA_SMESH::BareBorderVolume,
412                                            public virtual Predicate_i
413   {
414   public:
415     BareBorderVolume_i();
416     FunctorType                     GetFunctorType();
417   };
418   
419   /*
420     Class       : BareBorderFace_i
421     Description : Verify whether a mesh face has a free border without an edge on it
422   */
423   class SMESH_I_EXPORT BareBorderFace_i: public virtual POA_SMESH::BareBorderFace,
424                                          public virtual Predicate_i
425   {
426   public:
427     BareBorderFace_i();
428     FunctorType                     GetFunctorType();
429   };
430   
431   /*
432     Class       : OverConstrainedVolume_i
433     Description : Verify whether a mesh volume has only one facet shared with other volumes
434   */
435   class SMESH_I_EXPORT OverConstrainedVolume_i: public virtual POA_SMESH::OverConstrainedVolume,
436                                                 public virtual Predicate_i
437   {
438   public:
439     OverConstrainedVolume_i();
440     FunctorType                     GetFunctorType();
441   };
442   
443   /*
444     Class       : OverConstrainedFace_i
445     Description : Verify whether a mesh face has only one border shared with other faces
446   */
447   class SMESH_I_EXPORT OverConstrainedFace_i: public virtual POA_SMESH::OverConstrainedFace,
448                                               public virtual Predicate_i
449   {
450   public:
451     OverConstrainedFace_i();
452     FunctorType                     GetFunctorType();
453   };
454   
455   /*
456     Class       : BelongToGeom_i
457     Description : Predicate for selection on geometrical support
458   */
459   class SMESH_I_EXPORT BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
460                                        public virtual Predicate_i
461   {
462   public:
463     BelongToGeom_i();
464     virtual                         ~BelongToGeom_i();
465     
466     void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
467     void                            SetElementType( ElementType theType );
468     FunctorType                     GetFunctorType();
469     
470     void                            SetGeom( const TopoDS_Shape& theShape );
471     
472     void                            SetShapeName( const char* theName );
473     void                            SetShape( const char* theID, const char* theName );
474     char*                           GetShapeName();
475     char*                           GetShapeID();
476
477     void                            SetTolerance( CORBA::Double );
478     CORBA::Double                   GetTolerance();
479     
480   protected:
481     Controls::BelongToGeomPtr       myBelongToGeomPtr;
482     char*                           myShapeName;
483     char*                           myShapeID;
484   };
485   
486   /*
487     Class       : BelongToSurface_i
488     Description : Verify whether mesh element lie in pointed Geom planar object
489   */
490   class SMESH_I_EXPORT BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
491                                           public virtual Predicate_i
492   {
493   public:
494     BelongToSurface_i( const Handle(Standard_Type)& );
495     virtual                         ~BelongToSurface_i();
496     
497     void                            SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
498     
499     void                            SetShapeName( const char* theName, ElementType theType );
500     void                            SetShape( const char* theID, const char* theName, ElementType theType );
501     char*                           GetShapeName();
502     char*                           GetShapeID();
503
504     void                            SetTolerance( CORBA::Double );
505     CORBA::Double                   GetTolerance();
506     
507     void                            SetUseBoundaries( CORBA::Boolean theUseBndRestrictions );
508     CORBA::Boolean                  GetUseBoundaries();
509
510   protected:
511     Controls::ElementsOnSurfacePtr  myElementsOnSurfacePtr;
512     char*                           myShapeName;
513     char*                           myShapeID;
514     Handle(Standard_Type)           mySurfaceType;
515   };
516   
517   /*
518     Class       : BelongToPlane_i
519     Description : Verify whether mesh element lie in pointed Geom planar object
520   */
521   class SMESH_I_EXPORT BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
522                                         public virtual BelongToSurface_i
523   {
524   public:
525     BelongToPlane_i();
526     void                            SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
527     FunctorType                     GetFunctorType();
528   };
529   
530   /*
531     Class       : BelongToCylinder_i
532     Description : Verify whether mesh element lie in pointed Geom cylindrical object
533   */
534   class SMESH_I_EXPORT BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
535                                            public virtual BelongToSurface_i
536   {
537   public:
538     BelongToCylinder_i();
539     void                            SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
540     FunctorType                     GetFunctorType();
541   };
542
543   /*
544     Class       : BelongToGenSurface_i
545     Description : Verify whether mesh element lie on pointed Geom surfasic object
546   */
547   class BelongToGenSurface_i: public virtual POA_SMESH::BelongToGenSurface,
548                               public virtual BelongToSurface_i
549   {
550   public:
551     BelongToGenSurface_i();
552     void                            SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
553     FunctorType                     GetFunctorType();
554   };
555   
556   /*
557     Class       : LyingOnGeom_i
558     Description : Predicate for selection on geometrical support(lying or partially lying)
559   */
560   class SMESH_I_EXPORT LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
561                                       public virtual Predicate_i
562   {
563   public:
564     LyingOnGeom_i();
565     virtual                         ~LyingOnGeom_i();
566     
567     void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
568     void                            SetElementType( ElementType theType );
569     FunctorType                     GetFunctorType();
570     
571     void                            SetGeom( const TopoDS_Shape& theShape );
572     
573     void                            SetShapeName( const char* theName );
574     void                            SetShape( const char* theID, const char* theName );
575     char*                           GetShapeName();
576     char*                           GetShapeID();
577
578     void                            SetTolerance( CORBA::Double );
579     CORBA::Double                   GetTolerance();
580     
581   protected:
582     Controls::LyingOnGeomPtr        myLyingOnGeomPtr;
583     char*                           myShapeName;
584     char*                           myShapeID;
585   };
586   
587   /*
588     Class       : FreeBorders_i
589     Description : Predicate for free borders
590   */
591   class SMESH_I_EXPORT FreeBorders_i: public virtual POA_SMESH::FreeBorders,
592                                       public virtual Predicate_i
593   {
594   public:
595     FreeBorders_i();
596     FunctorType                     GetFunctorType();
597   };
598   
599   
600   /*
601     Class       : FreeEdges_i
602     Description : Predicate for free edges
603   */
604   class SMESH_I_EXPORT FreeEdges_i: public virtual POA_SMESH::FreeEdges,
605                                     public virtual Predicate_i
606   {
607   public:
608     FreeEdges_i();
609     SMESH::FreeEdges::Borders*      GetBorders();
610     FunctorType                     GetFunctorType();
611     
612   protected:
613     Controls::FreeEdgesPtr          myFreeEdgesPtr;
614   };
615   
616
617   /*
618     Class       : FreeFaces_i
619     Description : Predicate for free faces
620   */
621   class SMESH_I_EXPORT FreeFaces_i: public virtual POA_SMESH::FreeFaces,
622                                     public virtual Predicate_i
623   {
624   public:
625     FreeFaces_i();
626     FunctorType                     GetFunctorType();
627   };
628   
629
630   /*
631     Class       : FreeNodes_i
632     Description : Predicate for free nodes
633   */
634   class SMESH_I_EXPORT FreeNodes_i: public virtual POA_SMESH::FreeNodes,
635                                     public virtual Predicate_i
636   {
637   public:
638     FreeNodes_i();
639     FunctorType                     GetFunctorType();
640   };
641   
642   
643   /*
644     Class       : EqualNodes_i
645     Description : Predicate for equal nodes
646   */
647   class SMESH_I_EXPORT EqualNodes_i: public virtual POA_SMESH::EqualNodes,
648                                      public virtual Predicate_i
649   {
650   public:
651     EqualNodes_i();
652     FunctorType                     GetFunctorType();
653     void                            SetTolerance( double );
654     double                          GetTolerance();
655
656   private:
657     Controls::CoincidentNodesPtr myCoincidentNodesPtr;
658   };
659   /*
660     Class       : EqualEdges_i
661     Description : Predicate for equal edges
662   */
663   class SMESH_I_EXPORT EqualEdges_i: public virtual POA_SMESH::EqualEdges,
664                                      public virtual Predicate_i
665   {
666   public:
667     EqualEdges_i();
668     FunctorType                     GetFunctorType();
669   };
670   /*
671     Class       : EqualFaces_i
672     Description : Predicate for equal Faces
673   */
674   class SMESH_I_EXPORT EqualFaces_i: public virtual POA_SMESH::EqualFaces,
675                                      public virtual Predicate_i
676   {
677   public:
678     EqualFaces_i();
679     FunctorType                     GetFunctorType();
680   };
681   /*
682     Class       : EqualVolumes_i
683     Description : Predicate for equal Volumes
684   */
685   class SMESH_I_EXPORT EqualVolumes_i: public virtual POA_SMESH::EqualVolumes,
686                                        public virtual Predicate_i
687   {
688   public:
689     EqualVolumes_i();
690     FunctorType                     GetFunctorType();
691   };
692   
693   
694   /*
695     Class       : RangeOfIds_i
696     Description : Predicate for Range of Ids
697   */
698   class SMESH_I_EXPORT RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
699                                      public virtual Predicate_i
700   {
701   public:
702     RangeOfIds_i();
703     void                            SetRange( const SMESH::long_array& theIds );
704     CORBA::Boolean                  SetRangeStr( const char* theRange );
705     char*                           GetRangeStr();
706     
707     void                            SetElementType( ElementType theType );
708     FunctorType                     GetFunctorType();
709     
710   protected:
711     Controls::RangeOfIdsPtr         myRangeOfIdsPtr;
712   };
713
714   /*
715     Class       : LinearOrQuadratic_i
716     Description : Verify whether a mesh element is linear
717   */
718   class SMESH_I_EXPORT LinearOrQuadratic_i: public virtual POA_SMESH::LinearOrQuadratic,
719                                             public virtual Predicate_i
720   {
721   public:
722     LinearOrQuadratic_i();
723     FunctorType                    GetFunctorType();
724     void                           SetElementType( ElementType theType );
725
726   private:
727    Controls::LinearOrQuadraticPtr  myLinearOrQuadraticPtr;
728   };
729   
730   /*
731     Class       : GroupColor_i
732     Description : Functor for check color of group to whic mesh element belongs to
733   */
734   class SMESH_I_EXPORT GroupColor_i: public virtual POA_SMESH::GroupColor,
735                                      public virtual Predicate_i
736   {
737   public:
738     GroupColor_i();
739     FunctorType             GetFunctorType();
740
741     void                    SetElementType( ElementType theType );
742     void                    SetColorStr( const char* theColor );
743     char*                   GetColorStr();
744
745   private:
746     Controls::GroupColorPtr myGroupColorPtr;
747   };
748   
749   /*
750     Class       : ElemGeomType_i
751     Description : Functor for check element geometry type
752   */
753   class SMESH_I_EXPORT ElemGeomType_i: public virtual POA_SMESH::ElemGeomType,
754                                        public virtual Predicate_i
755   {
756   public:
757     ElemGeomType_i();
758     FunctorType             GetFunctorType();
759
760     void                    SetElementType ( ElementType  theType );
761     void                    SetGeometryType( GeometryType theType );
762     GeometryType            GetGeometryType() const;
763
764   private:
765     Controls::ElemGeomTypePtr myElemGeomTypePtr;
766   };
767   
768   /*
769     Class       : CoplanarFaces_i
770     Description : Returns true if a mesh face is a coplanar neighbour to a given one
771   */
772   class SMESH_I_EXPORT CoplanarFaces_i: public virtual POA_SMESH::CoplanarFaces,
773                                         public virtual Predicate_i
774   {
775   public:
776     CoplanarFaces_i();
777     FunctorType             GetFunctorType();
778
779     void                    SetFace ( CORBA::Long theFaceID );
780     void                    SetTolerance( CORBA::Double theToler );
781     char*                   GetFaceAsString () const;
782     CORBA::Long             GetFace () const;
783     CORBA::Double           GetTolerance () const;
784   private:
785     Controls::CoplanarFacesPtr myCoplanarFacesPtr;
786   };
787   
788   /*
789     Class       : Comparator_i
790     Description : Base class for comparators
791   */
792   class SMESH_I_EXPORT Comparator_i: public virtual POA_SMESH::Comparator,
793                                      public virtual Predicate_i
794   {
795   public:
796     virtual                         ~Comparator_i();
797     
798     virtual void                    SetMargin( CORBA::Double );
799     virtual void                    SetNumFunctor( NumericalFunctor_ptr );
800     
801     Controls::ComparatorPtr         GetComparator();
802     NumericalFunctor_i*             GetNumFunctor_i();
803     CORBA::Double                   GetMargin();
804     
805   protected:
806     Comparator_i();
807   protected:                                  
808     Controls::ComparatorPtr         myComparatorPtr;
809     NumericalFunctor_i*             myNumericalFunctor;
810   };
811   
812   
813   /*
814     Class       : LessThan_i
815     Description : Comparator "<"
816   */
817   class SMESH_I_EXPORT LessThan_i: public virtual POA_SMESH::LessThan,
818                                    public virtual Comparator_i
819   {
820   public:
821     LessThan_i();
822     FunctorType                     GetFunctorType();
823   };
824   
825   
826   /*
827     Class       : MoreThan_i
828     Description : Comparator ">"
829   */
830   class SMESH_I_EXPORT MoreThan_i: public virtual POA_SMESH::MoreThan,
831                                    public virtual Comparator_i
832   {
833   public:
834     MoreThan_i();
835     FunctorType                     GetFunctorType();
836   };
837   
838   
839   /*
840     Class       : EqualTo_i
841     Description : Comparator "="
842   */
843   class SMESH_I_EXPORT EqualTo_i: public virtual POA_SMESH::EqualTo,
844                                   public virtual Comparator_i
845   {
846   public:
847     EqualTo_i();
848     virtual void                    SetTolerance( CORBA::Double );
849     CORBA::Double                   GetTolerance();
850     FunctorType                     GetFunctorType();
851     
852   protected:
853     Controls::EqualToPtr            myEqualToPtr;
854   };
855   
856   
857   /*
858     Class       : LogicalNOT_i
859     Description : Logical NOT predicate
860   */
861   class SMESH_I_EXPORT LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
862                                      public virtual Predicate_i
863   {
864   public:
865     LogicalNOT_i();
866   virtual                         ~LogicalNOT_i();
867     
868     virtual void                    SetPredicate( Predicate_ptr );
869     Predicate_i*                    GetPredicate_i();
870     FunctorType                     GetFunctorType();
871     
872   protected:
873     Controls::LogicalNOTPtr         myLogicalNOTPtr;
874     Predicate_i*                    myPredicate;
875   };
876   
877   
878   /*
879     Class       : LogicalBinary_i
880     Description : Base class for binary logical predicate
881   */
882   class SMESH_I_EXPORT LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
883                                         public virtual Predicate_i
884   {
885   public:
886     virtual                         ~LogicalBinary_i();
887     virtual void                    SetMesh( SMESH_Mesh_ptr theMesh );
888     virtual void                    SetPredicate1( Predicate_ptr );
889     virtual void                    SetPredicate2( Predicate_ptr );
890     
891     Controls::LogicalBinaryPtr      GetLogicalBinary();
892     Predicate_i*                    GetPredicate1_i();
893     Predicate_i*                    GetPredicate2_i();
894     
895   protected:
896     LogicalBinary_i();
897   protected:  
898     Controls::LogicalBinaryPtr      myLogicalBinaryPtr;
899     Predicate_i*                    myPredicate1;
900     Predicate_i*                    myPredicate2;
901   };
902   
903   
904   /*
905     Class       : LogicalAND_i
906     Description : Logical AND
907   */
908   class SMESH_I_EXPORT LogicalAND_i: public virtual POA_SMESH::LogicalAND,
909                                      public virtual LogicalBinary_i
910   {
911   public:
912     LogicalAND_i();
913     FunctorType                     GetFunctorType();
914   };
915   
916   
917   /*
918     Class       : LogicalOR_i
919     Description : Logical OR
920   */
921   class SMESH_I_EXPORT LogicalOR_i: public virtual POA_SMESH::LogicalOR,
922                                     public virtual LogicalBinary_i
923   {
924   public:
925     LogicalOR_i();
926     FunctorType                     GetFunctorType();
927   };
928   
929   
930   /*
931     FILTER
932   */
933   class SMESH_I_EXPORT Filter_i: public virtual POA_SMESH::Filter,
934                                  public virtual SALOME::GenericObj_i
935   {
936   public:
937     Filter_i();
938     ~Filter_i();
939     
940     virtual
941     void
942     SetPredicate( Predicate_ptr );
943
944     virtual
945     void
946     SetMesh( SMESH_Mesh_ptr );
947
948     static
949     void
950     GetElementsId( Predicate_i*,
951                    const SMDS_Mesh*,
952                    Controls::Filter::TIdSequence& );
953     static
954     void           
955     GetElementsId( Predicate_i*,
956                    SMESH_Mesh_ptr,
957                    Controls::Filter::TIdSequence& );
958     
959     virtual
960     long_array*      
961     GetElementsId( SMESH_Mesh_ptr );
962
963     virtual
964     ElementType      
965     GetElementType();
966     
967     virtual
968     CORBA::Boolean   
969     GetCriteria( SMESH::Filter::Criteria_out theCriteria );
970
971     virtual
972     CORBA::Boolean
973     SetCriteria( const SMESH::Filter::Criteria& theCriteria );
974     
975     virtual
976     Predicate_ptr
977     GetPredicate();
978
979     Predicate_i*     GetPredicate_i();
980
981     // =========================
982     // SMESH_IDSource interface
983     // =========================
984     virtual SMESH::long_array*           GetIDs();
985     virtual SMESH::long_array*           GetMeshInfo();
986     virtual SMESH::array_of_ElementType* GetTypes();
987     virtual SMESH::SMESH_Mesh_ptr        GetMesh();
988     virtual bool                         IsMeshInfoCorrect() { return true; }
989
990     /*!
991      * \brief Object notified on change of predicate
992      */
993     struct TPredicateChangeWaiter
994     {
995       virtual void PredicateChanged() = 0;
996     };
997     void AddWaiter( TPredicateChangeWaiter* waiter );
998     void RemoveWaiter( TPredicateChangeWaiter* waiter );
999
1000   private:
1001     Controls::Filter myFilter;
1002     Predicate_i*     myPredicate;
1003     SMESH_Mesh_var   myMesh;
1004
1005     std::list<TPredicateChangeWaiter*> myWaiters;
1006   };
1007   
1008   
1009   /*
1010     FILTER LIBRARY
1011   */
1012   class SMESH_I_EXPORT FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
1013                                         public virtual SALOME::GenericObj_i
1014   {
1015   public:
1016     FilterLibrary_i( const char* theFileName );
1017     FilterLibrary_i();
1018     ~FilterLibrary_i();
1019     
1020     Filter_ptr              Copy( const char* theFilterName );
1021     
1022     CORBA::Boolean          Add     ( const char* theFilterName, Filter_ptr theFilter );
1023     CORBA::Boolean          AddEmpty( const char* theFilterName, ElementType theType );
1024     CORBA::Boolean          Delete  ( const char* theFilterName );
1025     CORBA::Boolean          Replace ( const char* theFilterName, 
1026                                       const char* theNewName, 
1027                                       Filter_ptr  theFilter );
1028     
1029     CORBA::Boolean          Save();
1030     CORBA::Boolean          SaveAs( const char* aFileName );
1031     
1032     CORBA::Boolean          IsPresent( const char* aFilterName );
1033     CORBA::Long             NbFilters( ElementType );
1034     string_array*           GetNames( ElementType );
1035     string_array*           GetAllNames();
1036     void                    SetFileName( const char* theFileName );
1037     char*                   GetFileName();
1038     
1039   private:
1040     char*                   myFileName;
1041     LDOM_Document           myDoc;
1042     FilterManager_var       myFilterMgr;
1043   };
1044   
1045   
1046   /*
1047     FILTER MANAGER
1048   */
1049   
1050   class SMESH_I_EXPORT FilterManager_i: public virtual POA_SMESH::FilterManager,
1051                                         public virtual SALOME::GenericObj_i
1052   {
1053   public:
1054     FilterManager_i();
1055     ~FilterManager_i();
1056
1057     MinimumAngle_ptr          CreateMinimumAngle();
1058     AspectRatio_ptr           CreateAspectRatio();
1059     AspectRatio3D_ptr         CreateAspectRatio3D();
1060     Warping_ptr               CreateWarping();
1061     Taper_ptr                 CreateTaper();
1062     Skew_ptr                  CreateSkew();
1063     Area_ptr                  CreateArea();
1064     Volume3D_ptr              CreateVolume3D();
1065     MaxElementLength2D_ptr    CreateMaxElementLength2D();
1066     MaxElementLength3D_ptr    CreateMaxElementLength3D();
1067     Length_ptr                CreateLength();
1068     Length2D_ptr              CreateLength2D();
1069     MultiConnection_ptr       CreateMultiConnection();
1070     MultiConnection2D_ptr     CreateMultiConnection2D();
1071     BallDiameter_ptr          CreateBallDiameter();
1072     
1073     BelongToGeom_ptr          CreateBelongToGeom();
1074     BelongToPlane_ptr         CreateBelongToPlane();
1075     BelongToCylinder_ptr      CreateBelongToCylinder();
1076     BelongToGenSurface_ptr    CreateBelongToGenSurface();
1077     
1078     LyingOnGeom_ptr           CreateLyingOnGeom();
1079     
1080     FreeBorders_ptr           CreateFreeBorders();
1081     FreeEdges_ptr             CreateFreeEdges();
1082     FreeNodes_ptr             CreateFreeNodes();
1083     FreeFaces_ptr             CreateFreeFaces();
1084
1085     EqualNodes_ptr            CreateEqualNodes();
1086     EqualEdges_ptr            CreateEqualEdges();
1087     EqualFaces_ptr            CreateEqualFaces();
1088     EqualVolumes_ptr          CreateEqualVolumes();
1089
1090     RangeOfIds_ptr            CreateRangeOfIds();
1091     BadOrientedVolume_ptr     CreateBadOrientedVolume();
1092     BareBorderFace_ptr        CreateBareBorderFace();
1093     BareBorderVolume_ptr      CreateBareBorderVolume();
1094     OverConstrainedFace_ptr   CreateOverConstrainedFace();
1095     OverConstrainedVolume_ptr CreateOverConstrainedVolume();
1096     LinearOrQuadratic_ptr     CreateLinearOrQuadratic();
1097     GroupColor_ptr            CreateGroupColor();
1098     ElemGeomType_ptr          CreateElemGeomType();
1099     CoplanarFaces_ptr         CreateCoplanarFaces();
1100
1101     LessThan_ptr              CreateLessThan();
1102     MoreThan_ptr              CreateMoreThan();
1103     EqualTo_ptr               CreateEqualTo();
1104     
1105     LogicalNOT_ptr            CreateLogicalNOT();
1106     LogicalAND_ptr            CreateLogicalAND();
1107     LogicalOR_ptr             CreateLogicalOR();
1108     
1109     Filter_ptr                CreateFilter();
1110     
1111     FilterLibrary_ptr         LoadLibrary( const char* aFileName );
1112     FilterLibrary_ptr         CreateLibrary();
1113     CORBA::Boolean            DeleteLibrary( const char* aFileName );
1114   };
1115   
1116   
1117   Predicate_i* 
1118   GetPredicate( SMESH::Predicate_ptr thePredicate );
1119
1120   const char*        FunctorTypeToString(SMESH::FunctorType ft);
1121   SMESH::FunctorType StringToFunctorType(const char*       str);
1122 }
1123
1124
1125 #endif