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