]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESH_I/SMESH_Filter_i.hxx
Salome HOME
removed python file SMESH_test.py
[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_ControlsDef.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       : AspectRatio3D_i
146   Description : Functor for calculating aspect ratio for 3D
147 */
148 class AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D,
149                        public virtual NumericalFunctor_i
150 {
151 public:
152                                   AspectRatio3D_i();
153   FunctorType                     GetFunctorType();
154 };
155
156
157 /*
158   Class       : Warping_i
159   Description : Functor for calculating warping
160 */
161 class Warping_i: public virtual POA_SMESH::Warping,
162                  public virtual NumericalFunctor_i
163 {
164 public:
165                                   Warping_i();
166   FunctorType                     GetFunctorType();
167 };
168
169
170 /*
171   Class       : Taper_i
172   Description : Functor for calculating taper
173 */
174 class Taper_i: public virtual POA_SMESH::Taper,
175                public virtual NumericalFunctor_i
176 {
177 public:
178                                   Taper_i();
179   FunctorType                     GetFunctorType();
180 };
181
182
183 /*
184   Class       : Skew_i
185   Description : Functor for calculating skew in degrees
186 */
187 class Skew_i: public virtual POA_SMESH::Skew,
188               public virtual NumericalFunctor_i
189 {
190 public:
191                                   Skew_i();
192   FunctorType                     GetFunctorType();
193 };
194
195
196 /*
197   Class       : Area_i
198   Description : Functor for calculating area
199 */
200 class Area_i: public virtual POA_SMESH::Area,
201               public virtual NumericalFunctor_i
202 {
203 public:
204                                   Area_i();
205   FunctorType                     GetFunctorType();
206 };
207
208
209 /*
210   Class       : Length_i
211   Description : Functor for calculating length of edge
212 */
213 class Length_i: public virtual POA_SMESH::Length,
214                 public virtual NumericalFunctor_i
215 {
216 public:
217                                   Length_i();
218   FunctorType                     GetFunctorType();
219 };
220
221 /*
222   Class       : Length2D_i
223   Description : Functor for calculating length of edge
224 */
225 class Length2D_i: public virtual POA_SMESH::Length2D,
226                   public virtual NumericalFunctor_i
227 {
228 public:
229                                   Length2D_i();
230   SMESH::Length2D::Values*        GetValues();
231   FunctorType                     GetFunctorType();
232
233 protected:
234   Controls::Length2DPtr          myLength2DPtr;
235 };
236
237
238 /*
239   Class       : MultiConnection_i
240   Description : Functor for calculating number of faces conneted to the edge
241 */
242 class MultiConnection_i: public virtual POA_SMESH::MultiConnection,
243                          public virtual NumericalFunctor_i
244 {
245 public:
246                                   MultiConnection_i();
247   FunctorType                     GetFunctorType();
248 };
249
250 /*
251   Class       : MultiConnection2D_i
252   Description : Functor for calculating number of faces conneted to the edge
253 */
254 class MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
255                            public virtual NumericalFunctor_i
256 {
257 public:
258                                      MultiConnection2D_i();
259   SMESH::MultiConnection2D::Values*  GetValues();
260   FunctorType                        GetFunctorType();
261
262 protected:
263   Controls::MultiConnection2DPtr     myMulticonnection2DPtr;
264 };
265
266
267 /*
268                             PREDICATES
269 */
270 /*
271   Class       : Predicate_i
272   Description : Base class for all predicates
273 */
274 class Predicate_i: public virtual POA_SMESH::Predicate,
275                    public virtual Functor_i
276 {
277 public:
278   CORBA::Boolean                  IsSatisfy( CORBA::Long theElementId );
279   Controls::PredicatePtr          GetPredicate();
280   
281 protected:
282   Controls::PredicatePtr          myPredicatePtr;
283 };
284
285
286 /*
287   Class       : BelongToGeom_i
288   Description : Predicate for selection on geometrical support
289 */
290 class BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
291                       public virtual Predicate_i
292 {
293 public:
294                                   BelongToGeom_i();
295   virtual                         ~BelongToGeom_i();
296                                   
297   void                            SetGeom( GEOM::GEOM_Object_ptr theGeom );
298   void                            SetElementType( ElementType theType );
299   FunctorType                     GetFunctorType();
300
301   void                            SetGeom( const TopoDS_Shape& theShape );
302
303   void                            SetShapeName( const char* theName );
304   char*                           GetShapeName();
305
306 protected:
307   Controls::BelongToGeomPtr       myBelongToGeomPtr;
308   char*                           myShapeName;
309 };
310
311 /*
312   Class       : BelongToSurface_i
313   Description : Verify whether mesh element lie in pointed Geom planar object
314 */
315 class BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
316                          public virtual Predicate_i
317 {
318 public:
319                                   BelongToSurface_i( const Handle(Standard_Type)& );
320   virtual                         ~BelongToSurface_i();
321
322   void                            SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
323
324   void                            SetShapeName( const char* theName, ElementType theType );
325   char*                           GetShapeName();
326
327   void                            SetTolerance( CORBA::Double );
328   CORBA::Double                   GetTolerance();
329
330 protected:
331   Controls::ElementsOnSurfacePtr  myElementsOnSurfacePtr;
332   char*                           myShapeName;
333   Handle(Standard_Type)           mySurfaceType;
334 };
335
336 /*
337   Class       : BelongToPlane_i
338   Description : Verify whether mesh element lie in pointed Geom planar object
339 */
340 class BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
341                        public virtual BelongToSurface_i
342 {
343 public:
344                                   BelongToPlane_i();
345   void                            SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
346   FunctorType                     GetFunctorType();
347 };
348
349 /*
350   Class       : BelongToCylinder_i
351   Description : Verify whether mesh element lie in pointed Geom cylindrical object
352 */
353 class BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
354                           public virtual BelongToSurface_i
355 {
356 public:
357                                   BelongToCylinder_i();
358   void                            SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
359   FunctorType                     GetFunctorType();
360 };
361
362
363 /*
364   Class       : FreeBorders_i
365   Description : Predicate for free borders
366 */
367 class FreeBorders_i: public virtual POA_SMESH::FreeBorders,
368                      public virtual Predicate_i
369 {
370 public:
371                                   FreeBorders_i();
372   FunctorType                     GetFunctorType();
373 };
374
375
376 /*
377   Class       : FreeEdges_i
378   Description : Predicate for free edges
379 */
380 class FreeEdges_i: public virtual POA_SMESH::FreeEdges,
381                    public virtual Predicate_i
382 {
383 public:
384                                   FreeEdges_i();
385   SMESH::FreeEdges::Borders*      GetBorders();
386   FunctorType                     GetFunctorType();
387   
388 protected:
389   Controls::FreeEdgesPtr          myFreeEdgesPtr;
390 };
391
392
393 /*
394   Class       : RangeOfIds_i
395   Description : Predicate for Range of Ids
396 */
397 class RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
398                     public virtual Predicate_i
399 {
400 public:
401                                   RangeOfIds_i();
402   void                            SetRange( const SMESH::long_array& theIds );
403   CORBA::Boolean                  SetRangeStr( const char* theRange );
404   char*                           GetRangeStr();
405
406   void                            SetElementType( ElementType theType );
407   FunctorType                     GetFunctorType();
408
409 protected:
410   Controls::RangeOfIdsPtr         myRangeOfIdsPtr;
411 };
412
413 /*
414   Class       : Comparator_i
415   Description : Base class for comparators
416 */
417 class Comparator_i: public virtual POA_SMESH::Comparator,
418                     public virtual Predicate_i
419 {
420 public:
421   virtual                         ~Comparator_i();
422   
423   virtual void                    SetMargin( CORBA::Double );
424   virtual void                    SetNumFunctor( NumericalFunctor_ptr );
425   
426   Controls::ComparatorPtr         GetComparator();
427   NumericalFunctor_i*             GetNumFunctor_i();
428   CORBA::Double                   GetMargin();
429   
430 protected:
431                                   Comparator_i();
432 protected:                                  
433   Controls::ComparatorPtr         myComparatorPtr;
434   NumericalFunctor_i*             myNumericalFunctor;
435 };
436
437
438 /*
439   Class       : LessThan_i
440   Description : Comparator "<"
441 */
442 class LessThan_i: public virtual POA_SMESH::LessThan,
443                   public virtual Comparator_i
444 {
445 public:
446                                   LessThan_i();
447   FunctorType                     GetFunctorType();
448 };
449
450
451 /*
452   Class       : MoreThan_i
453   Description : Comparator ">"
454 */
455 class MoreThan_i: public virtual POA_SMESH::MoreThan,
456                   public virtual Comparator_i
457 {
458 public:
459                                   MoreThan_i();
460   FunctorType                     GetFunctorType();
461 };
462
463
464 /*
465   Class       : EqualTo_i
466   Description : Comparator "="
467 */
468 class EqualTo_i: public virtual POA_SMESH::EqualTo,
469                  public virtual Comparator_i
470 {
471 public:
472                                   EqualTo_i();
473   virtual void                    SetTolerance( CORBA::Double );
474   CORBA::Double                   GetTolerance();
475   FunctorType                     GetFunctorType();
476   
477 protected:
478   Controls::EqualToPtr            myEqualToPtr;
479 };
480
481
482 /*
483   Class       : LogicalNOT_i
484   Description : Logical NOT predicate
485 */
486 class LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
487                     public virtual Predicate_i
488 {
489 public:
490                                   LogicalNOT_i();
491   virtual                         ~LogicalNOT_i();
492   
493   virtual void                    SetPredicate( Predicate_ptr );
494   Predicate_i*                    GetPredicate_i();
495   FunctorType                     GetFunctorType();
496   
497 protected:
498   Controls::LogicalNOTPtr         myLogicalNOTPtr;
499   Predicate_i*                    myPredicate;
500 };
501
502
503 /*
504   Class       : LogicalBinary_i
505   Description : Base class for binary logical predicate
506 */
507 class LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
508                        public virtual Predicate_i
509 {
510 public:
511   virtual                         ~LogicalBinary_i();
512   virtual void                    SetMesh( SMESH_Mesh_ptr theMesh );
513   virtual void                    SetPredicate1( Predicate_ptr );
514   virtual void                    SetPredicate2( Predicate_ptr );
515   
516   Controls::LogicalBinaryPtr      GetLogicalBinary();
517   Predicate_i*                    GetPredicate1_i();
518   Predicate_i*                    GetPredicate2_i();
519   
520 protected:
521                                   LogicalBinary_i();
522 protected:  
523   Controls::LogicalBinaryPtr      myLogicalBinaryPtr;
524   Predicate_i*                    myPredicate1;
525   Predicate_i*                    myPredicate2;
526 };
527
528
529 /*
530   Class       : LogicalAND_i
531   Description : Logical AND
532 */
533 class LogicalAND_i: public virtual POA_SMESH::LogicalAND,
534                     public virtual LogicalBinary_i
535 {
536 public:
537                                   LogicalAND_i();
538   FunctorType                     GetFunctorType();
539 };
540
541
542 /*
543   Class       : LogicalOR_i
544   Description : Logical OR
545 */
546 class LogicalOR_i: public virtual POA_SMESH::LogicalOR,
547                    public virtual LogicalBinary_i
548 {
549 public:
550                                   LogicalOR_i();
551   FunctorType                     GetFunctorType();
552 };
553
554
555 /*
556                                FILTER
557 */
558 class Filter_i: public virtual POA_SMESH::Filter,
559                 public virtual SALOME::GenericObj_i
560 {
561 public:
562                                   Filter_i();
563   virtual                         ~Filter_i();
564   
565   void                            SetPredicate( Predicate_ptr );
566   void                            SetMesh( SMESH_Mesh_ptr );
567
568   long_array*                     GetElementsId( SMESH_Mesh_ptr );
569   ElementType                     GetElementType();
570
571   CORBA::Boolean                  GetCriteria( SMESH::Filter::Criteria_out theCriteria );
572   CORBA::Boolean                  SetCriteria( const SMESH::Filter::Criteria& theCriteria );
573   
574   Predicate_ptr                   GetPredicate();
575   Predicate_i*                    GetPredicate_i();
576
577 private:
578   Controls::Filter                myFilter;
579   Predicate_i*                    myPredicate;
580 };
581
582
583 /*
584                             FILTER LIBRARY
585 */
586 class FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
587                        public virtual SALOME::GenericObj_i
588 {
589 public:
590                           FilterLibrary_i( const char* theFileName );
591                           FilterLibrary_i();
592                           ~FilterLibrary_i();
593
594   Filter_ptr              Copy( const char* theFilterName );
595
596   CORBA::Boolean          Add     ( const char* theFilterName, Filter_ptr theFilter );
597   CORBA::Boolean          AddEmpty( const char* theFilterName, ElementType theType );
598   CORBA::Boolean          Delete  ( const char* theFilterName );
599   CORBA::Boolean          Replace ( const char* theFilterName, 
600                                     const char* theNewName, 
601                                     Filter_ptr  theFilter );
602
603   CORBA::Boolean          Save();
604   CORBA::Boolean          SaveAs( const char* aFileName );
605   
606   CORBA::Boolean          IsPresent( const char* aFilterName );
607   CORBA::Long             NbFilters( ElementType );
608   string_array*           GetNames( ElementType );
609   string_array*           GetAllNames();
610   void                    SetFileName( const char* theFileName );
611   char*                   GetFileName();
612
613 private:
614   char*                   myFileName;
615   LDOM_Document           myDoc;
616   FilterManager_var       myFilterMgr;
617 };
618
619
620 /*
621                             FILTER MANAGER
622 */
623
624 class FilterManager_i: public virtual POA_SMESH::FilterManager,
625                        public virtual SALOME::GenericObj_i
626 {
627 public:
628                             FilterManager_i();
629   MinimumAngle_ptr          CreateMinimumAngle();
630   AspectRatio_ptr           CreateAspectRatio();
631   AspectRatio3D_ptr         CreateAspectRatio3D();
632   Warping_ptr               CreateWarping();
633   Taper_ptr                 CreateTaper();
634   Skew_ptr                  CreateSkew();
635   Area_ptr                  CreateArea();
636   Length_ptr                CreateLength();
637   Length2D_ptr              CreateLength2D();
638   MultiConnection_ptr       CreateMultiConnection();
639   MultiConnection2D_ptr     CreateMultiConnection2D();
640   
641   BelongToGeom_ptr          CreateBelongToGeom();
642   BelongToPlane_ptr         CreateBelongToPlane();
643   BelongToCylinder_ptr      CreateBelongToCylinder();
644
645   FreeBorders_ptr           CreateFreeBorders();
646   FreeEdges_ptr             CreateFreeEdges();
647
648   RangeOfIds_ptr            CreateRangeOfIds();
649
650   LessThan_ptr              CreateLessThan();
651   MoreThan_ptr              CreateMoreThan();
652   EqualTo_ptr               CreateEqualTo();
653   
654   LogicalNOT_ptr            CreateLogicalNOT();
655   LogicalAND_ptr            CreateLogicalAND();
656   LogicalOR_ptr             CreateLogicalOR();
657
658   Filter_ptr                CreateFilter();
659
660   FilterLibrary_ptr         LoadLibrary( const char* aFileName );
661   FilterLibrary_ptr         CreateLibrary();
662   CORBA::Boolean            DeleteLibrary( const char* aFileName );
663 };
664
665
666
667 };
668
669
670 #endif