1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 // File : SMESH_Filter.idl
23 // Author : Alexey Petrov, OCC
25 #ifndef _SMESH_FILTER_IDL_
26 #define _SMESH_FILTER_IDL_
28 #include "SALOME_Exception.idl"
29 #include "SALOME_GenericObj.idl"
30 #include "SMESH_Mesh.idl"
35 interface GEOM_Object;
43 * Enumeration of functor types
73 * Base interface for all functors ( i.e. numerical functors and predicates )
75 interface Functor: SALOME::GenericObj
77 void SetMesh( in SMESH_Mesh theMesh );
78 FunctorType GetFunctorType();
79 ElementType GetElementType();
85 * Numerical functors are intended for calculating value by Id of mesh entity
87 interface NumericalFunctor: Functor
89 double GetValue( in long theElementId );
92 * Set precision for calculation. It is a position after point which is
93 * used to functor value after calculation.
95 void SetPrecision( in long thePrecision );
98 interface MinimumAngle : NumericalFunctor{};
99 interface AspectRatio : NumericalFunctor{};
100 interface AspectRatio3D : NumericalFunctor{};
101 interface Warping : NumericalFunctor{};
102 interface Taper : NumericalFunctor{};
103 interface Skew : NumericalFunctor{};
104 interface Area : NumericalFunctor{};
105 interface Length : NumericalFunctor{};
106 interface Length2D : NumericalFunctor
114 typedef sequence<Value> Values;
117 interface MultiConnection : NumericalFunctor{};
120 * Predicates are intended for verification of criteria,
121 * must return bool value by mesh id
123 interface Predicate: Functor
125 boolean IsSatisfy( in long thEntityId );
129 * Logical functor (predicate) "Belong To Geometry".
130 * Verify whether mesh element or node belong to pointed Geom Object
132 interface BelongToGeom: Predicate
134 void SetGeom( in GEOM::GEOM_Object theGeom );
135 void SetElementType( in ElementType theType );
137 void SetShapeName( in string theName );
138 string GetShapeName();
142 * Logical functor (predicate) "Belong To Surface".
143 * Base interface for "belong to plane" and "belong to cylinder interfaces"
145 interface BelongToSurface: Predicate
147 void SetTolerance( in double theToler );
148 double GetTolerance();
149 void SetShapeName( in string theName, in ElementType theType );
150 string GetShapeName();
155 * Logical functor (predicate) "Belong To Plane".
156 * Verify whether mesh element lie in pointed Geom planar object
158 interface BelongToPlane: BelongToSurface
160 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
164 * Logical functor (predicate) "Belong To Culinder".
165 * Verify whether mesh element lie in pointed Geom cylindrical object
167 interface BelongToCylinder: BelongToSurface
169 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
173 * Logical functor (predicate) "Free borders".
174 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
176 interface FreeBorders: Predicate{};
179 * Logical functor (predicate) "Free edges".
180 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
182 interface FreeEdges: Predicate
190 typedef sequence<Border> Borders;
191 Borders GetBorders();
196 * Abstract logical functor (predicate) "RangeOfIds".
197 * Verify whether an Entity Id belongs to defined sequence of id's
199 interface RangeOfIds: Predicate
201 void SetRange( in long_array theIds );
202 boolean SetRangeStr( in string theRange );
203 string GetRangeStr();
205 void SetElementType( in ElementType theType );
209 * Comparator. Predicate for compare value calculated
210 * by numerical functor with threshold value
212 interface Comparator: Predicate
214 void SetMargin( in double theValue );
215 void SetNumFunctor( in NumericalFunctor theFunct );
218 interface LessThan: Comparator{};
219 interface MoreThan: Comparator{};
220 interface EqualTo : Comparator
222 void SetTolerance( in double theToler );
223 double GetTolerance();
227 * Logical predicates are intended for compose predicates using boolean operations
229 interface Logical: Predicate{};
231 interface LogicalNOT: Logical
233 void SetPredicate(in Predicate thePredicate);
236 interface LogicalBinary: Logical
238 void SetPredicate1( in Predicate thePredicate );
239 void SetPredicate2( in Predicate thePredicate );
242 interface LogicalAND: LogicalBinary{};
243 interface LogicalOR : LogicalBinary{};
248 interface Filter: SALOME::GenericObj
251 * Structure containing information about one criterion
252 * Type - FT_Taper, FT_Skew ...
253 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
254 * Threshold - threshold value
255 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
256 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
257 * (FT_Undefined must be for the last criterion)
258 * ThresholdStr - Threshold value defined as string. Used for:
259 * 1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"
260 * 2. BelongToGeom predicate for storing name of shape
261 * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
262 * "Belong to plane" and "Belong to cylinder" predicates
263 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
264 * Precision - Precision of numerical functors
275 ElementType TypeOfElement;
279 typedef sequence<Criterion> Criteria;
281 void SetPredicate( in Predicate thePredicate );
282 long_array GetElementsId( in SMESH_Mesh theMesh );
283 ElementType GetElementType();
284 Predicate GetPredicate();
286 boolean GetCriteria( out Criteria theCriteria );
287 boolean SetCriteria( in Criteria theCriteria );
292 * Interface for working with library of filters
294 interface FilterLibrary : SALOME::GenericObj
297 * Copy filter from library by name (new filter is created)
299 Filter Copy( in string theFilterName );
302 * Methods for editing library
304 boolean Add ( in string theFilterName, in Filter theFilter );
305 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
306 boolean Delete ( in string theFilterName );
307 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
310 * Save library on disk
313 boolean SaveAs( in string aFileName );
318 boolean IsPresent( in string aFilterName );
319 long NbFilters( in ElementType aType );
320 string_array GetNames( in ElementType aType );
321 string_array GetAllNames();
322 void SetFileName( in string aFilterName );
323 string GetFileName();
328 * Interface of Filter manager
330 interface FilterManager: SALOME::GenericObj
333 * Create numerical functors
335 MinimumAngle CreateMinimumAngle();
336 AspectRatio CreateAspectRatio();
337 AspectRatio3D CreateAspectRatio3D();
338 Warping CreateWarping();
342 Length CreateLength();
343 Length2D CreateLength2D();
344 MultiConnection CreateMultiConnection();
347 * Create logical functors ( predicates )
349 BelongToGeom CreateBelongToGeom();
350 BelongToPlane CreateBelongToPlane();
351 BelongToCylinder CreateBelongToCylinder();
353 FreeBorders CreateFreeBorders();
354 FreeEdges CreateFreeEdges();
356 RangeOfIds CreateRangeOfIds();
359 * Create comparators ( predicates )
361 LessThan CreateLessThan();
362 MoreThan CreateMoreThan();
363 EqualTo CreateEqualTo();
366 * Create boolean operations ( predicates )
368 LogicalNOT CreateLogicalNOT();
369 LogicalAND CreateLogicalAND();
370 LogicalOR CreateLogicalOR();
375 Filter CreateFilter();
378 * Load filter library. If libary does not exist it is created
380 FilterLibrary LoadLibrary( in string aFileName );
385 FilterLibrary CreateLibrary();
390 boolean DeleteLibrary( in string aFileName );