Salome HOME
Bug PAL7334 - DEVELOPMENT : Control Improvement
[modules/smesh.git] / idl / SMESH_Filter.idl
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 //
20 //
21 //
22 //  File   : SMESH_Filter.idl
23 //  Author : Alexey Petrov, OCC
24
25 #ifndef _SMESH_FILTER_IDL_
26 #define _SMESH_FILTER_IDL_
27
28 #include "SALOME_Exception.idl"
29 #include "SALOME_GenericObj.idl"
30 #include "SMESH_Mesh.idl"
31
32
33 module GEOM
34 {
35   interface GEOM_Object;
36 };
37
38
39 module SMESH
40 {
41
42   /*!
43   * Enumeration of functor types
44   */
45   enum FunctorType
46   {
47     FT_AspectRatio,
48     FT_AspectRatio3D,
49     FT_Warping,   
50     FT_MinimumAngle,
51     FT_Taper,       
52     FT_Skew,         
53     FT_Area,          
54     FT_FreeBorders,
55     FT_FreeEdges,
56     FT_MultiConnection,
57     FT_MultiConnection2D,
58     FT_Length,
59     FT_Length2D,
60     FT_BelongToGeom,
61     FT_BelongToPlane,
62     FT_BelongToCylinder,
63     FT_RangeOfIds,
64     FT_LessThan,
65     FT_MoreThan,
66     FT_EqualTo,
67     FT_LogicalNOT,
68     FT_LogicalAND,
69     FT_LogicalOR,
70     FT_Undefined
71   };
72
73   /*!
74   * Base interface for all functors ( i.e. numerical functors and predicates )
75   */
76   interface Functor: SALOME::GenericObj
77   {
78     void            SetMesh( in SMESH_Mesh theMesh );
79     FunctorType     GetFunctorType();
80     ElementType     GetElementType();
81   };
82
83
84
85   /*!
86   * Numerical functors are intended for calculating value by Id of mesh entity
87   */
88   interface NumericalFunctor: Functor
89   {
90     double GetValue( in long theElementId );
91
92     /*!
93     * Set precision for calculation. It is a position after point which is
94     * used to functor value after calculation.
95     */
96     void   SetPrecision( in long thePrecision );
97     long   GetPrecision();
98   };
99   interface MinimumAngle    : NumericalFunctor{};
100   interface AspectRatio     : NumericalFunctor{};
101   interface AspectRatio3D   : NumericalFunctor{};
102   interface Warping         : NumericalFunctor{};
103   interface Taper           : NumericalFunctor{};
104   interface Skew            : NumericalFunctor{};
105   interface Area            : NumericalFunctor{};
106   interface Length          : NumericalFunctor{};
107   interface Length2D        : NumericalFunctor
108   {
109     struct Value
110     {
111       double myLength;
112       long myPnt1, myPnt2;
113     };
114     typedef sequence<Value> Values;
115     Values GetValues();
116   };
117   interface MultiConnection   : NumericalFunctor{};
118   interface MultiConnection2D : NumericalFunctor
119   {
120     struct Value
121     {
122       long myNbConnects;
123       long myPnt1, myPnt2;
124     };
125     
126     typedef sequence<Value> Values;
127     Values GetValues();
128   };
129
130   /*!
131   * Predicates are intended for verification of criteria,
132   *            must return bool value by mesh id
133   */
134   interface Predicate: Functor
135   {
136     boolean IsSatisfy( in long thEntityId );
137   };
138
139   /*!
140   * Logical functor (predicate) "Belong To Geometry".
141   * Verify whether mesh element or node belong to pointed Geom Object
142   */
143   interface BelongToGeom: Predicate
144   {
145     void SetGeom( in GEOM::GEOM_Object theGeom );
146     void SetElementType( in ElementType theType );
147
148     void   SetShapeName( in string theName );
149     string GetShapeName();    
150   };
151
152   /*!
153   * Logical functor (predicate) "Belong To Surface".
154   * Base interface for "belong to plane" and "belong to cylinder interfaces"
155   */
156   interface BelongToSurface: Predicate
157   {
158     void   SetTolerance( in double theToler );
159     double GetTolerance();
160     void   SetShapeName( in string theName, in ElementType theType );
161     string GetShapeName();
162   };
163
164
165   /*!
166   * Logical functor (predicate) "Belong To Plane".
167   * Verify whether mesh element lie in pointed Geom planar object
168   */
169   interface BelongToPlane: BelongToSurface
170   {
171     void   SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
172   };
173
174   /*!
175   * Logical functor (predicate) "Belong To Culinder".
176   * Verify whether mesh element lie in pointed Geom cylindrical object
177   */
178   interface BelongToCylinder: BelongToSurface
179   {
180     void   SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
181   };
182
183   /*!
184   * Logical functor (predicate) "Free borders".
185   * Verify whether 1D mesh element is free ( i.e. connected to one face only )
186   */
187   interface FreeBorders: Predicate{};
188
189   /*!
190   * Logical functor (predicate) "Free edges".
191   * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
192   */
193   interface FreeEdges: Predicate
194
195   {
196     struct Border
197     {
198       long myElemId;
199       long myPnt1, myPnt2;
200     };
201     typedef sequence<Border> Borders;
202     Borders GetBorders();
203   };
204
205
206   /*!
207   * Abstract logical functor (predicate) "RangeOfIds".
208   * Verify whether an Entity Id belongs to defined sequence of id's
209   */
210   interface RangeOfIds: Predicate
211   {
212     void            SetRange( in long_array theIds );
213     boolean         SetRangeStr( in string theRange );
214     string          GetRangeStr();
215
216     void            SetElementType( in ElementType theType );
217   };
218
219   /*!
220   * Comparator. Predicate for compare value calculated
221   *             by numerical functor with threshold value
222   */
223   interface Comparator: Predicate
224   {
225     void    SetMargin( in double theValue );
226     void    SetNumFunctor( in NumericalFunctor theFunct );
227     double  GetMargin();
228   };
229   interface LessThan: Comparator{};
230   interface MoreThan: Comparator{};
231   interface EqualTo : Comparator
232   {
233     void    SetTolerance( in double theToler );
234     double  GetTolerance();
235   };
236
237   /*!
238   * Logical predicates are intended for compose predicates using boolean operations
239   */
240   interface Logical: Predicate{};
241
242   interface LogicalNOT: Logical
243   {
244     void SetPredicate(in Predicate thePredicate);
245   };
246
247   interface LogicalBinary: Logical
248 {
249     void SetPredicate1( in Predicate thePredicate );
250     void SetPredicate2( in Predicate thePredicate );
251   };
252
253   interface LogicalAND: LogicalBinary{};
254   interface LogicalOR : LogicalBinary{};
255
256   /*!
257   *  Filter
258   */
259   interface Filter: SALOME::GenericObj
260   {
261     /*!
262     * Structure containing information about one criterion
263     *   Type          - FT_Taper, FT_Skew ...
264     *   Compare       - FT_LessThan, FT_MoreThan, FT_EqualTo
265     *   Threshold     - threshold value
266     *   UnaryOp       - unary logical operation: FT_LogicalNOT or FT_Undefined
267     *   BinaryOp      - binary logical operation FT_LogicalAND, FT_LogicalOR or
268     *                   (FT_Undefined must be for the last criterion)
269     *   ThresholdStr  - Threshold value defined as string. Used for:
270     *                   1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"
271     *                   2. BelongToGeom predicate for storing name of shape
272     *   Tolerance     - Tolerance is used for comparators (EqualTo comparision) and for
273     *                   "Belong to plane" and "Belong to cylinder" predicates
274     *   TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
275     *   Precision     - Precision of numerical functors
276     */
277     struct Criterion
278     {
279       long        Type;
280       long        Compare;
281       double      Threshold;
282       string      ThresholdStr;
283       long        UnaryOp;
284       long        BinaryOp;
285       double      Tolerance;
286       ElementType TypeOfElement;
287       long        Precision;
288     };
289
290     typedef sequence<Criterion> Criteria;
291
292     void          SetPredicate( in Predicate thePredicate );
293     long_array    GetElementsId( in SMESH_Mesh theMesh );
294     ElementType   GetElementType();
295     Predicate     GetPredicate();
296
297     boolean       GetCriteria( out Criteria theCriteria );
298     boolean       SetCriteria( in Criteria theCriteria );
299   };
300
301
302   /*!
303   *  Interface for working with library of filters
304   */
305   interface FilterLibrary : SALOME::GenericObj
306   {
307     /*!
308     *  Copy filter from library by name (new filter is created)
309     */
310     Filter        Copy( in string theFilterName );
311
312     /*!
313     * Methods for editing library
314     */
315     boolean       Add     ( in string theFilterName, in Filter theFilter );
316     boolean       AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
317     boolean       Delete  ( in string theFilterName );
318     boolean       Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
319
320     /*!
321     *  Save library on disk
322     */
323     boolean       Save();
324     boolean       SaveAs( in string aFileName );
325
326     /*!
327     * Query methods
328     */
329     boolean       IsPresent( in string aFilterName );
330     long          NbFilters( in ElementType aType );
331     string_array  GetNames( in ElementType aType );
332     string_array  GetAllNames();
333     void          SetFileName( in string aFilterName );
334     string        GetFileName();
335   };
336
337
338   /*!
339   * Interface of Filter manager
340   */
341   interface FilterManager: SALOME::GenericObj
342   {
343     /*!
344     *  Create numerical functors
345     */
346     MinimumAngle      CreateMinimumAngle();
347     AspectRatio       CreateAspectRatio();
348     AspectRatio3D     CreateAspectRatio3D();
349     Warping           CreateWarping();
350     Taper             CreateTaper();
351     Skew              CreateSkew();
352     Area              CreateArea();
353     Length            CreateLength();
354     Length2D          CreateLength2D();
355     MultiConnection   CreateMultiConnection();
356     MultiConnection2D CreateMultiConnection2D();
357
358     /*!
359     *  Create logical functors ( predicates )
360     */
361     BelongToGeom      CreateBelongToGeom();
362     BelongToPlane     CreateBelongToPlane();
363     BelongToCylinder  CreateBelongToCylinder();
364
365     FreeBorders       CreateFreeBorders();
366     FreeEdges         CreateFreeEdges();
367
368     RangeOfIds        CreateRangeOfIds();
369
370     /*!
371     *  Create comparators ( predicates )
372     */
373     LessThan          CreateLessThan();
374     MoreThan          CreateMoreThan();
375     EqualTo           CreateEqualTo();
376
377     /*!
378     *  Create boolean operations ( predicates )
379     */
380     LogicalNOT        CreateLogicalNOT();
381     LogicalAND        CreateLogicalAND();
382     LogicalOR         CreateLogicalOR();
383
384     /*!
385     *  Create filter
386     */
387     Filter            CreateFilter();
388
389     /*!
390     *  Load filter library. If libary does not exist it is created
391     */
392     FilterLibrary     LoadLibrary( in string aFileName );
393
394     /*!
395     *  Create new library
396     */
397     FilterLibrary     CreateLibrary();
398
399     /*!
400     *  Delete library
401     */
402     boolean           DeleteLibrary( in string aFileName );
403   };
404 };
405
406
407 #endif