Salome HOME
Integration of PAL/SALOME V2.1.0c from OCC
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.hxx
1 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
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 <SALOMEconfig.h>
32 #include CORBA_SERVER_HEADER(SMESH_Filter)
33
34 #include <LDOM_Document.hxx>
35 #include <TopoDS_Shape.hxx>
36
37 #include "SALOME_GenericObj_i.hh"
38 #include "SMESH_Controls.hxx"
39
40 class SMESHDS_Mesh;
41
42 namespace SMESH
43 {
44
45 namespace Controls
46 {
47
48 /*
49   Class       : BelongToGeom
50   Description : Predicate for verifying whether entiy belong to
51                 specified geometrical support
52 */
53 class BelongToGeom: public virtual Predicate
54 {
55 public:
56                                   BelongToGeom();
57
58   virtual void                    SetMesh( SMDS_Mesh* theMesh );
59   virtual void                    SetGeom( const TopoDS_Shape& theShape );
60
61   virtual bool                    IsSatisfy( long theElementId );
62
63   virtual void                    SetType( SMDSAbs_ElementType theType );
64   virtual                         SMDSAbs_ElementType GetType() const;
65
66   TopoDS_Shape                    GetShape();
67   SMESHDS_Mesh*                   GetMeshDS();
68
69 private:
70   TopoDS_Shape                    myShape;
71   SMESHDS_Mesh*                   myMeshDS;
72   SMDSAbs_ElementType             myType;
73 };
74 typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
75 }
76
77 /*
78                                 FUNCTORS
79 */
80
81 /*
82   Class       : Functor_i
83   Description : An abstact class for all functors 
84 */
85 class Functor_i: public virtual POA_SMESH::Functor,
86                  public virtual SALOME::GenericObj_i
87 {
88 public:
89   void                            SetMesh( SMESH_Mesh_ptr theMesh );
90   Controls::FunctorPtr            GetFunctor(){ return myFunctorPtr;}
91   ElementType                     GetElementType();
92   
93 protected:
94                                   Functor_i();
95 protected:                                
96   Controls::FunctorPtr            myFunctorPtr;
97 };
98
99
100 /*
101   Class       : NumericalFunctor_i
102   Description : Base class for numerical functors 
103 */
104 class NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,
105                           public virtual Functor_i
106 {
107 public:
108   CORBA::Double                   GetValue( CORBA::Long theElementId );
109   void                            SetPrecision( CORBA::Long thePrecision );
110   CORBA::Long                     GetPrecision();
111   Controls::NumericalFunctorPtr   GetNumericalFunctor();
112   
113 protected:
114   Controls::NumericalFunctorPtr   myNumericalFunctorPtr;
115 };
116
117
118 /*
119   Class       : SMESH_MinimumAngleFunct
120   Description : Functor for calculation of minimum angle
121 */
122 class MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,
123                       public virtual NumericalFunctor_i
124 {
125 public:
126                                   MinimumAngle_i();
127   FunctorType                     GetFunctorType();
128 };
129
130
131 /*
132   Class       : AspectRatio_i
133   Description : Functor for calculating aspect ratio
134 */
135 class AspectRatio_i: public virtual POA_SMESH::AspectRatio,
136                      public virtual NumericalFunctor_i
137 {
138 public:
139                                   AspectRatio_i();
140   FunctorType                     GetFunctorType();
141 };
142
143
144 /*
145   Class       : Warping_i
146   Description : Functor for calculating warping
147 */
148 class Warping_i: public virtual POA_SMESH::Warping,
149                  public virtual NumericalFunctor_i
150 {
151 public:
152                                   Warping_i();
153   FunctorType                     GetFunctorType();
154 };
155
156
157 /*
158   Class       : Taper_i
159   Description : Functor for calculating taper
160 */
161 class Taper_i: public virtual POA_SMESH::Taper,
162                public virtual NumericalFunctor_i
163 {
164 public:
165                                   Taper_i();
166   FunctorType                     GetFunctorType();
167 };
168
169
170 /*
171   Class       : Skew_i
172   Description : Functor for calculating skew in degrees
173 */
174 class Skew_i: public virtual POA_SMESH::Skew,
175               public virtual NumericalFunctor_i
176 {
177 public:
178                                   Skew_i();
179   FunctorType                     GetFunctorType();
180 };
181
182
183 /*
184   Class       : Area_i
185   Description : Functor for calculating area
186 */
187 class Area_i: public virtual POA_SMESH::Area,
188               public virtual NumericalFunctor_i
189 {
190 public:
191                                   Area_i();
192   FunctorType                     GetFunctorType();
193 };
194
195
196 /*
197   Class       : Length_i
198   Description : Functor for calculating length of edge
199 */
200 class Length_i: public virtual POA_SMESH::Length,
201                 public virtual NumericalFunctor_i
202 {
203 public:
204                                   Length_i();
205   FunctorType                     GetFunctorType();
206 };
207
208
209 /*
210   Class       : MultiConnection_i
211   Description : Functor for calculating number of faces conneted to the edge
212 */
213 class MultiConnection_i: public virtual POA_SMESH::MultiConnection,
214                          public virtual NumericalFunctor_i
215 {
216 public:
217                                   MultiConnection_i();
218   FunctorType                     GetFunctorType();
219 };
220
221
222 /*
223                             PREDICATES
224 */
225 /*
226   Class       : Predicate_i
227   Description : Base class for all predicates
228 */
229 class Predicate_i: public virtual POA_SMESH::Predicate,
230                    public virtual Functor_i
231 {
232 public:
233   CORBA::Boolean                  IsSatisfy( CORBA::Long theElementId );
234   Controls::PredicatePtr          GetPredicate();
235   
236 protected:
237   Controls::PredicatePtr          myPredicatePtr;
238 };
239
240
241 /*
242   Class       : BelongToGeom_i
243   Description : Predicate for selection on geometrical support
244 */
245 class BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
246                       public virtual Predicate_i
247 {
248 public:
249                                   BelongToGeom_i();
250   virtual                         ~BelongToGeom_i();
251                                   
252   void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
253   void                            SetElementType( ElementType theType );
254   FunctorType                     GetFunctorType();
255
256   void                            SetGeom( const TopoDS_Shape& theShape );
257
258   void                            SetShapeName( const char* theName );
259   char*                           GetShapeName();
260
261 protected:
262   Controls::BelongToGeomPtr       myBelongToGeomPtr;
263   char*                           myShapeName;
264 };
265
266 /*
267   Class       : BelongToSurface_i
268   Description : Verify whether mesh element lie in pointed Geom planar object
269 */
270 class BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
271                          public virtual Predicate_i
272 {
273 public:
274                                   BelongToSurface_i( const Handle(Standard_Type)& );
275   virtual                         ~BelongToSurface_i();
276
277   void                            SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
278
279   void                            SetShapeName( const char* theName, ElementType theType );
280   char*                           GetShapeName();
281
282   void                            SetTolerance( CORBA::Double );
283   CORBA::Double                   GetTolerance();
284
285 protected:
286   Controls::ElementsOnSurfacePtr  myElementsOnSurfacePtr;
287   char*                           myShapeName;
288   Handle(Standard_Type)           mySurfaceType;
289 };
290
291 /*
292   Class       : BelongToPlane_i
293   Description : Verify whether mesh element lie in pointed Geom planar object
294 */
295 class BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
296                        public virtual BelongToSurface_i
297 {
298 public:
299                                   BelongToPlane_i();
300   void                            SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
301   FunctorType                     GetFunctorType();
302 };
303
304 /*
305   Class       : BelongToCylinder_i
306   Description : Verify whether mesh element lie in pointed Geom cylindrical object
307 */
308 class BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
309                           public virtual BelongToSurface_i
310 {
311 public:
312                                   BelongToCylinder_i();
313   void                            SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
314   FunctorType                     GetFunctorType();
315 };
316
317
318 /*
319   Class       : FreeBorders_i
320   Description : Predicate for free borders
321 */
322 class FreeBorders_i: public virtual POA_SMESH::FreeBorders,
323                      public virtual Predicate_i
324 {
325 public:
326                                   FreeBorders_i();
327   FunctorType                     GetFunctorType();
328 };
329
330
331 /*
332   Class       : FreeEdges_i
333   Description : Predicate for free edges
334 */
335 class FreeEdges_i: public virtual POA_SMESH::FreeEdges,
336                    public virtual Predicate_i
337 {
338 public:
339                                   FreeEdges_i();
340   SMESH::FreeEdges::Borders*      GetBorders();
341   FunctorType                     GetFunctorType();
342   
343 protected:
344   Controls::FreeEdgesPtr          myFreeEdgesPtr;
345 };
346
347
348 /*
349   Class       : RangeOfIds_i
350   Description : Predicate for Range of Ids
351 */
352 class RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
353                     public virtual Predicate_i
354 {
355 public:
356                                   RangeOfIds_i();
357   void                            SetRange( const SMESH::long_array& theIds );
358   CORBA::Boolean                  SetRangeStr( const char* theRange );
359   char*                           GetRangeStr();
360
361   void                            SetElementType( ElementType theType );
362   FunctorType                     GetFunctorType();
363
364 protected:
365   Controls::RangeOfIdsPtr         myRangeOfIdsPtr;
366 };
367
368 /*
369   Class       : Comparator_i
370   Description : Base class for comparators
371 */
372 class Comparator_i: public virtual POA_SMESH::Comparator,
373                     public virtual Predicate_i
374 {
375 public:
376   virtual                         ~Comparator_i();
377   
378   virtual void                    SetMargin( CORBA::Double );
379   virtual void                    SetNumFunctor( NumericalFunctor_ptr );
380   
381   Controls::ComparatorPtr         GetComparator();
382   NumericalFunctor_i*             GetNumFunctor_i();
383   CORBA::Double                   GetMargin();
384   
385 protected:
386                                   Comparator_i();
387 protected:                                  
388   Controls::ComparatorPtr         myComparatorPtr;
389   NumericalFunctor_i*             myNumericalFunctor;
390 };
391
392
393 /*
394   Class       : LessThan_i
395   Description : Comparator "<"
396 */
397 class LessThan_i: public virtual POA_SMESH::LessThan,
398                   public virtual Comparator_i
399 {
400 public:
401                                   LessThan_i();
402   FunctorType                     GetFunctorType();
403 };
404
405
406 /*
407   Class       : MoreThan_i
408   Description : Comparator ">"
409 */
410 class MoreThan_i: public virtual POA_SMESH::MoreThan,
411                   public virtual Comparator_i
412 {
413 public:
414                                   MoreThan_i();
415   FunctorType                     GetFunctorType();
416 };
417
418
419 /*
420   Class       : EqualTo_i
421   Description : Comparator "="
422 */
423 class EqualTo_i: public virtual POA_SMESH::EqualTo,
424                  public virtual Comparator_i
425 {
426 public:
427                                   EqualTo_i();
428   virtual void                    SetTolerance( CORBA::Double );
429   CORBA::Double                   GetTolerance();
430   FunctorType                     GetFunctorType();
431   
432 protected:
433   Controls::EqualToPtr            myEqualToPtr;
434 };
435
436
437 /*
438   Class       : LogicalNOT_i
439   Description : Logical NOT predicate
440 */
441 class LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
442                     public virtual Predicate_i
443 {
444 public:
445                                   LogicalNOT_i();
446   virtual                         ~LogicalNOT_i();
447   
448   virtual void                    SetPredicate( Predicate_ptr );
449   Predicate_i*                    GetPredicate_i();
450   FunctorType                     GetFunctorType();
451   
452 protected:
453   Controls::LogicalNOTPtr         myLogicalNOTPtr;
454   Predicate_i*                    myPredicate;
455 };
456
457
458 /*
459   Class       : LogicalBinary_i
460   Description : Base class for binary logical predicate
461 */
462 class LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
463                        public virtual Predicate_i
464 {
465 public:
466   virtual                         ~LogicalBinary_i();
467   virtual void                    SetMesh( SMESH_Mesh_ptr theMesh );
468   virtual void                    SetPredicate1( Predicate_ptr );
469   virtual void                    SetPredicate2( Predicate_ptr );
470   
471   Controls::LogicalBinaryPtr      GetLogicalBinary();
472   Predicate_i*                    GetPredicate1_i();
473   Predicate_i*                    GetPredicate2_i();
474   
475 protected:
476                                   LogicalBinary_i();
477 protected:  
478   Controls::LogicalBinaryPtr      myLogicalBinaryPtr;
479   Predicate_i*                    myPredicate1;
480   Predicate_i*                    myPredicate2;
481 };
482
483
484 /*
485   Class       : LogicalAND_i
486   Description : Logical AND
487 */
488 class LogicalAND_i: public virtual POA_SMESH::LogicalAND,
489                     public virtual LogicalBinary_i
490 {
491 public:
492                                   LogicalAND_i();
493   FunctorType                     GetFunctorType();
494 };
495
496
497 /*
498   Class       : LogicalOR_i
499   Description : Logical OR
500 */
501 class LogicalOR_i: public virtual POA_SMESH::LogicalOR,
502                    public virtual LogicalBinary_i
503 {
504 public:
505                                   LogicalOR_i();
506   FunctorType                     GetFunctorType();
507 };
508
509
510 /*
511                                FILTER
512 */
513 class Filter_i: public virtual POA_SMESH::Filter,
514                 public virtual SALOME::GenericObj_i
515 {
516 public:
517                                   Filter_i();
518   virtual                         ~Filter_i();
519   
520   void                            SetPredicate( Predicate_ptr );
521   void                            SetMesh( SMESH_Mesh_ptr );
522
523   long_array*                     GetElementsId( SMESH_Mesh_ptr );
524   ElementType                     GetElementType();
525
526   CORBA::Boolean                  GetCriteria( SMESH::Filter::Criteria_out theCriteria );
527   CORBA::Boolean                  SetCriteria( const SMESH::Filter::Criteria& theCriteria );
528   
529   Predicate_ptr                   GetPredicate();
530   Predicate_i*                    GetPredicate_i();
531
532 private:
533   Controls::Filter                myFilter;
534   Predicate_i*                    myPredicate;
535 };
536
537
538 /*
539                             FILTER LIBRARY
540 */
541 class FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
542                        public virtual SALOME::GenericObj_i
543 {
544 public:
545                           FilterLibrary_i( const char* theFileName );
546                           FilterLibrary_i();
547                           ~FilterLibrary_i();
548
549   Filter_ptr              Copy( const char* theFilterName );
550
551   CORBA::Boolean          Add     ( const char* theFilterName, Filter_ptr theFilter );
552   CORBA::Boolean          AddEmpty( const char* theFilterName, ElementType theType );
553   CORBA::Boolean          Delete  ( const char* theFilterName );
554   CORBA::Boolean          Replace ( const char* theFilterName, 
555                                     const char* theNewName, 
556                                     Filter_ptr  theFilter );
557
558   CORBA::Boolean          Save();
559   CORBA::Boolean          SaveAs( const char* aFileName );
560   
561   CORBA::Boolean          IsPresent( const char* aFilterName );
562   CORBA::Long             NbFilters( ElementType );
563   string_array*           GetNames( ElementType );
564   string_array*           GetAllNames();
565   void                    SetFileName( const char* theFileName );
566   char*                   GetFileName();
567
568 private:
569   char*                   myFileName;
570   LDOM_Document           myDoc;
571   FilterManager_var       myFilterMgr;
572 };
573
574
575 /*
576                             FILTER MANAGER
577 */
578
579 class FilterManager_i: public virtual POA_SMESH::FilterManager,
580                        public virtual SALOME::GenericObj_i
581 {
582 public:
583                             FilterManager_i();
584   MinimumAngle_ptr          CreateMinimumAngle();
585   AspectRatio_ptr           CreateAspectRatio();
586   Warping_ptr               CreateWarping();
587   Taper_ptr                 CreateTaper();
588   Skew_ptr                  CreateSkew();
589   Area_ptr                  CreateArea();
590   Length_ptr                CreateLength();
591   MultiConnection_ptr       CreateMultiConnection();
592   
593   BelongToGeom_ptr          CreateBelongToGeom();
594   BelongToPlane_ptr         CreateBelongToPlane();
595   BelongToCylinder_ptr      CreateBelongToCylinder();
596
597   FreeBorders_ptr           CreateFreeBorders();
598   FreeEdges_ptr             CreateFreeEdges();
599
600   RangeOfIds_ptr            CreateRangeOfIds();
601
602   LessThan_ptr              CreateLessThan();
603   MoreThan_ptr              CreateMoreThan();
604   EqualTo_ptr               CreateEqualTo();
605   
606   LogicalNOT_ptr            CreateLogicalNOT();
607   LogicalAND_ptr            CreateLogicalAND();
608   LogicalOR_ptr             CreateLogicalOR();
609
610   Filter_ptr                CreateFilter();
611
612   FilterLibrary_ptr         LoadLibrary( const char* aFileName );
613   FilterLibrary_ptr         CreateLibrary();
614   CORBA::Boolean            DeleteLibrary( const char* aFileName );
615 };
616
617
618
619 };
620
621
622 #endif