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
75 * Base interface for all functors ( i.e. numerical functors and predicates )
77 interface Functor: SALOME::GenericObj
79 void SetMesh( in SMESH_Mesh theMesh );
80 FunctorType GetFunctorType();
81 ElementType GetElementType();
87 * Numerical functors are intended for calculating value by Id of mesh entity
89 interface NumericalFunctor: Functor
91 double GetValue( in long theElementId );
94 * Set precision for calculation. It is a position after point which is
95 * used to functor value after calculation.
97 void SetPrecision( in long thePrecision );
100 interface MinimumAngle : NumericalFunctor{};
101 interface AspectRatio : NumericalFunctor{};
102 interface AspectRatio3D : NumericalFunctor{};
103 interface Warping : NumericalFunctor{};
104 interface Taper : NumericalFunctor{};
105 interface Skew : NumericalFunctor{};
106 interface Area : NumericalFunctor{};
107 interface Length : NumericalFunctor{};
108 interface Length2D : NumericalFunctor
115 typedef sequence<Value> Values;
118 interface MultiConnection : NumericalFunctor{};
119 interface MultiConnection2D : NumericalFunctor
127 typedef sequence<Value> Values;
132 * Predicates are intended for verification of criteria,
133 * must return bool value by mesh id
135 interface Predicate: Functor
137 boolean IsSatisfy( in long thEntityId );
141 * Logical functor (predicate) "Belong To Geometry".
142 * Verify whether mesh element or node belong to pointed Geom Object
144 interface BelongToGeom: Predicate
146 void SetGeom( in GEOM::GEOM_Object theGeom );
147 void SetElementType( in ElementType theType );
149 void SetShapeName( in string theName );
150 string GetShapeName();
154 * Logical functor (predicate) "Belong To Surface".
155 * Base interface for "belong to plane" and "belong to cylinder interfaces"
157 interface BelongToSurface: Predicate
159 void SetTolerance( in double theToler );
160 double GetTolerance();
161 void SetShapeName( in string theName, in ElementType theType );
162 string GetShapeName();
167 * Logical functor (predicate) "Belong To Plane".
168 * Verify whether mesh element lie in pointed Geom planar object
170 interface BelongToPlane: BelongToSurface
172 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
176 * Logical functor (predicate) "Belong To Culinder".
177 * Verify whether mesh element lie in pointed Geom cylindrical object
179 interface BelongToCylinder: BelongToSurface
181 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
185 * Logical functor (predicate) "Lying On Geometry".
186 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
188 interface LyingOnGeom: Predicate
190 void SetGeom( in GEOM::GEOM_Object theGeom );
191 void SetElementType( in ElementType theType );
193 void SetShapeName( in string theName );
194 string GetShapeName();
198 * Logical functor (predicate) "Free borders".
199 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
201 interface FreeBorders: Predicate{};
204 * Logical functor (predicate) "Free edges".
205 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
207 interface FreeEdges: Predicate
215 typedef sequence<Border> Borders;
216 Borders GetBorders();
221 * Abstract logical functor (predicate) "RangeOfIds".
222 * Verify whether an Entity Id belongs to defined sequence of id's
224 interface RangeOfIds: Predicate
226 void SetRange( in long_array theIds );
227 boolean SetRangeStr( in string theRange );
228 string GetRangeStr();
230 void SetElementType( in ElementType theType );
234 * Comparator. Predicate for compare value calculated
235 * by numerical functor with threshold value
237 interface Comparator: Predicate
239 void SetMargin( in double theValue );
240 void SetNumFunctor( in NumericalFunctor theFunct );
243 interface LessThan: Comparator{};
244 interface MoreThan: Comparator{};
245 interface EqualTo : Comparator
247 void SetTolerance( in double theToler );
248 double GetTolerance();
252 * Logical predicates are intended for compose predicates using boolean operations
254 interface Logical: Predicate{};
256 interface LogicalNOT: Logical
258 void SetPredicate(in Predicate thePredicate);
261 interface LogicalBinary: Logical
263 void SetPredicate1( in Predicate thePredicate );
264 void SetPredicate2( in Predicate thePredicate );
267 interface LogicalAND: LogicalBinary{};
268 interface LogicalOR : LogicalBinary{};
273 interface Filter: SALOME::GenericObj
276 * Structure containing information about one criterion
277 * Type - FT_Taper, FT_Skew ...
278 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
279 * Threshold - threshold value
280 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
281 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
282 * (FT_Undefined must be for the last criterion)
283 * ThresholdStr - Threshold value defined as string. Used for:
284 * 1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"
285 * 2. BelongToGeom predicate for storing name of shape
286 * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
287 * "Belong to plane" and "Belong to cylinder" predicates
288 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
289 * Precision - Precision of numerical functors
300 ElementType TypeOfElement;
304 typedef sequence<Criterion> Criteria;
306 void SetPredicate( in Predicate thePredicate );
307 long_array GetElementsId( in SMESH_Mesh theMesh );
308 ElementType GetElementType();
309 Predicate GetPredicate();
311 boolean GetCriteria( out Criteria theCriteria );
312 boolean SetCriteria( in Criteria theCriteria );
317 * Interface for working with library of filters
319 interface FilterLibrary : SALOME::GenericObj
322 * Copy filter from library by name (new filter is created)
324 Filter Copy( in string theFilterName );
327 * Methods for editing library
329 boolean Add ( in string theFilterName, in Filter theFilter );
330 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
331 boolean Delete ( in string theFilterName );
332 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
335 * Save library on disk
338 boolean SaveAs( in string aFileName );
343 boolean IsPresent( in string aFilterName );
344 long NbFilters( in ElementType aType );
345 string_array GetNames( in ElementType aType );
346 string_array GetAllNames();
347 void SetFileName( in string aFilterName );
348 string GetFileName();
353 * Interface of Filter manager
355 interface FilterManager: SALOME::GenericObj
358 * Create numerical functors
360 MinimumAngle CreateMinimumAngle();
361 AspectRatio CreateAspectRatio();
362 AspectRatio3D CreateAspectRatio3D();
363 Warping CreateWarping();
367 Length CreateLength();
368 Length2D CreateLength2D();
369 MultiConnection CreateMultiConnection();
370 MultiConnection2D CreateMultiConnection2D();
373 * Create logical functors ( predicates )
375 BelongToGeom CreateBelongToGeom();
376 BelongToPlane CreateBelongToPlane();
377 BelongToCylinder CreateBelongToCylinder();
379 LyingOnGeom CreateLyingOnGeom();
381 FreeBorders CreateFreeBorders();
382 FreeEdges CreateFreeEdges();
384 RangeOfIds CreateRangeOfIds();
387 * Create comparators ( predicates )
389 LessThan CreateLessThan();
390 MoreThan CreateMoreThan();
391 EqualTo CreateEqualTo();
394 * Create boolean operations ( predicates )
396 LogicalNOT CreateLogicalNOT();
397 LogicalAND CreateLogicalAND();
398 LogicalOR CreateLogicalOR();
403 Filter CreateFilter();
406 * Load filter library. If libary does not exist it is created
408 FilterLibrary LoadLibrary( in string aFileName );
413 FilterLibrary CreateLibrary();
418 boolean DeleteLibrary( in string aFileName );