1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
24 // File : SMESH_Filter_i.hxx
25 // Author : Alexey Petrov, OCC
28 #ifndef _SMESH_FILTER_I_HXX_
29 #define _SMESH_FILTER_I_HXX_
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(SMESH_Filter)
36 #include <LDOM_Document.hxx>
37 #include <TopoDS_Shape.hxx>
39 #include "SALOME_GenericObj_i.hh"
40 #include "SMESH_ControlsDef.hxx"
52 Description : Predicate for verifying whether entiy belong to
53 specified geometrical support
55 class SMESH_I_EXPORT BelongToGeom: public virtual Predicate
60 virtual void SetMesh( const SMDS_Mesh* theMesh );
61 virtual void SetGeom( const TopoDS_Shape& theShape );
63 virtual bool IsSatisfy( long theElementId );
65 virtual void SetType( SMDSAbs_ElementType theType );
66 virtual SMDSAbs_ElementType GetType() const;
68 TopoDS_Shape GetShape();
69 const SMESHDS_Mesh* GetMeshDS() const;
71 void SetTolerance( double );
72 double GetTolerance();
78 const SMESHDS_Mesh* myMeshDS;
79 SMDSAbs_ElementType myType;
81 double myTolerance; // only if myIsSubshape == false
82 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
84 typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
88 Description : Predicate for verifying whether entiy lying or partially lying on
89 specified geometrical support
91 class SMESH_I_EXPORT LyingOnGeom: public virtual Predicate
96 virtual void SetMesh( const SMDS_Mesh* theMesh );
97 virtual void SetGeom( const TopoDS_Shape& theShape );
99 virtual bool IsSatisfy( long theElementId );
101 virtual void SetType( SMDSAbs_ElementType theType );
102 virtual SMDSAbs_ElementType GetType() const;
104 TopoDS_Shape GetShape();
105 const SMESHDS_Mesh* GetMeshDS() const;
107 void SetTolerance( double );
108 double GetTolerance();
110 virtual bool Contains( const SMESHDS_Mesh* theMeshDS,
111 const TopoDS_Shape& theShape,
112 const SMDS_MeshElement* theElem,
113 TopAbs_ShapeEnum theFindShapeEnum,
114 TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE );
118 TopoDS_Shape myShape;
119 const SMESHDS_Mesh* myMeshDS;
120 SMDSAbs_ElementType myType;
122 double myTolerance; // only if myIsSubshape == false
123 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
125 typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
134 Description : An abstact class for all functors
136 class SMESH_I_EXPORT Functor_i: public virtual POA_SMESH::Functor,
137 public virtual SALOME::GenericObj_i
140 void SetMesh( SMESH_Mesh_ptr theMesh );
141 Controls::FunctorPtr GetFunctor(){ return myFunctorPtr;}
142 ElementType GetElementType();
148 Controls::FunctorPtr myFunctorPtr;
152 Class : NumericalFunctor_i
153 Description : Base class for numerical functors
155 class SMESH_I_EXPORT NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,
156 public virtual Functor_i
159 CORBA::Double GetValue( CORBA::Long theElementId );
160 SMESH::Histogram* GetHistogram(CORBA::Short nbIntervals);
161 void SetPrecision( CORBA::Long thePrecision );
162 CORBA::Long GetPrecision();
163 Controls::NumericalFunctorPtr GetNumericalFunctor();
166 Controls::NumericalFunctorPtr myNumericalFunctorPtr;
171 Class : SMESH_MinimumAngleFunct
172 Description : Functor for calculation of minimum angle
174 class SMESH_I_EXPORT MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,
175 public virtual NumericalFunctor_i
179 FunctorType GetFunctorType();
184 Class : AspectRatio_i
185 Description : Functor for calculating aspect ratio
187 class SMESH_I_EXPORT AspectRatio_i: public virtual POA_SMESH::AspectRatio,
188 public virtual NumericalFunctor_i
192 FunctorType GetFunctorType();
197 Class : AspectRatio3D_i
198 Description : Functor for calculating aspect ratio for 3D
200 class SMESH_I_EXPORT AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D,
201 public virtual NumericalFunctor_i
205 FunctorType GetFunctorType();
211 Description : Functor for calculating warping
213 class SMESH_I_EXPORT Warping_i: public virtual POA_SMESH::Warping,
214 public virtual NumericalFunctor_i
218 FunctorType GetFunctorType();
224 Description : Functor for calculating taper
226 class SMESH_I_EXPORT Taper_i: public virtual POA_SMESH::Taper,
227 public virtual NumericalFunctor_i
231 FunctorType GetFunctorType();
237 Description : Functor for calculating skew in degrees
239 class SMESH_I_EXPORT Skew_i: public virtual POA_SMESH::Skew,
240 public virtual NumericalFunctor_i
244 FunctorType GetFunctorType();
250 Description : Functor for calculating area
252 class SMESH_I_EXPORT Area_i: public virtual POA_SMESH::Area,
253 public virtual NumericalFunctor_i
257 FunctorType GetFunctorType();
263 Description : Functor for calculating volume of 3D element
265 class SMESH_I_EXPORT Volume3D_i: public virtual POA_SMESH::Volume3D,
266 public virtual NumericalFunctor_i
270 FunctorType GetFunctorType();
275 Class : MaxElementLength2D_i
276 Description : Functor for calculating maximum length of 2D element
278 class SMESH_I_EXPORT MaxElementLength2D_i: public virtual POA_SMESH::MaxElementLength2D,
279 public virtual NumericalFunctor_i
282 MaxElementLength2D_i();
283 FunctorType GetFunctorType();
288 Class : MaxElementLength3D_i
289 Description : Functor for calculating maximum length of 3D element
291 class SMESH_I_EXPORT MaxElementLength3D_i: public virtual POA_SMESH::MaxElementLength3D,
292 public virtual NumericalFunctor_i
295 MaxElementLength3D_i();
296 FunctorType GetFunctorType();
302 Description : Functor for calculating length of edge
304 class SMESH_I_EXPORT Length_i: public virtual POA_SMESH::Length,
305 public virtual NumericalFunctor_i
309 FunctorType GetFunctorType();
314 Description : Functor for calculating length of edge
316 class SMESH_I_EXPORT Length2D_i: public virtual POA_SMESH::Length2D,
317 public virtual NumericalFunctor_i
321 SMESH::Length2D::Values* GetValues();
322 FunctorType GetFunctorType();
325 Controls::Length2DPtr myLength2DPtr;
330 Class : MultiConnection_i
331 Description : Functor for calculating number of faces conneted to the edge
333 class SMESH_I_EXPORT MultiConnection_i: public virtual POA_SMESH::MultiConnection,
334 public virtual NumericalFunctor_i
338 FunctorType GetFunctorType();
342 Class : MultiConnection2D_i
343 Description : Functor for calculating number of faces conneted to the edge
345 class SMESH_I_EXPORT MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
346 public virtual NumericalFunctor_i
349 MultiConnection2D_i();
350 SMESH::MultiConnection2D::Values* GetValues();
351 FunctorType GetFunctorType();
354 Controls::MultiConnection2DPtr myMulticonnection2DPtr;
363 Description : Base class for all predicates
365 class SMESH_I_EXPORT Predicate_i: public virtual POA_SMESH::Predicate,
366 public virtual Functor_i
369 CORBA::Boolean IsSatisfy( CORBA::Long theElementId );
370 Controls::PredicatePtr GetPredicate();
373 Controls::PredicatePtr myPredicatePtr;
378 Class : BadOrientedVolume_i
379 Description : Verify whether a mesh volume is incorrectly oriented from
380 the point of view of MED convention
382 class SMESH_I_EXPORT BadOrientedVolume_i: public virtual POA_SMESH::BadOrientedVolume,
383 public virtual Predicate_i
386 BadOrientedVolume_i();
387 FunctorType GetFunctorType();
391 Class : BelongToGeom_i
392 Description : Predicate for selection on geometrical support
394 class SMESH_I_EXPORT BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
395 public virtual Predicate_i
399 virtual ~BelongToGeom_i();
401 void SetGeom( GEOM::GEOM_Object_ptr theGeom );
402 void SetElementType( ElementType theType );
403 FunctorType GetFunctorType();
405 void SetGeom( const TopoDS_Shape& theShape );
407 void SetShapeName( const char* theName );
408 void SetShape( const char* theID, const char* theName );
409 char* GetShapeName();
412 void SetTolerance( CORBA::Double );
413 CORBA::Double GetTolerance();
416 Controls::BelongToGeomPtr myBelongToGeomPtr;
422 Class : BelongToSurface_i
423 Description : Verify whether mesh element lie in pointed Geom planar object
425 class SMESH_I_EXPORT BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
426 public virtual Predicate_i
429 BelongToSurface_i( const Handle(Standard_Type)& );
430 virtual ~BelongToSurface_i();
432 void SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
434 void SetShapeName( const char* theName, ElementType theType );
435 void SetShape( const char* theID, const char* theName, ElementType theType );
436 char* GetShapeName();
439 void SetTolerance( CORBA::Double );
440 CORBA::Double GetTolerance();
442 void SetUseBoundaries( CORBA::Boolean theUseBndRestrictions );
443 CORBA::Boolean GetUseBoundaries();
446 Controls::ElementsOnSurfacePtr myElementsOnSurfacePtr;
449 Handle(Standard_Type) mySurfaceType;
453 Class : BelongToPlane_i
454 Description : Verify whether mesh element lie in pointed Geom planar object
456 class SMESH_I_EXPORT BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
457 public virtual BelongToSurface_i
461 void SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
462 FunctorType GetFunctorType();
466 Class : BelongToCylinder_i
467 Description : Verify whether mesh element lie in pointed Geom cylindrical object
469 class SMESH_I_EXPORT BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
470 public virtual BelongToSurface_i
473 BelongToCylinder_i();
474 void SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
475 FunctorType GetFunctorType();
479 Class : BelongToGenSurface_i
480 Description : Verify whether mesh element lie on pointed Geom surfasic object
482 class BelongToGenSurface_i: public virtual POA_SMESH::BelongToGenSurface,
483 public virtual BelongToSurface_i
486 BelongToGenSurface_i();
487 void SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
488 FunctorType GetFunctorType();
492 Class : LyingOnGeom_i
493 Description : Predicate for selection on geometrical support(lying or partially lying)
495 class SMESH_I_EXPORT LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
496 public virtual Predicate_i
500 virtual ~LyingOnGeom_i();
502 void SetGeom( GEOM::GEOM_Object_ptr theGeom );
503 void SetElementType( ElementType theType );
504 FunctorType GetFunctorType();
506 void SetGeom( const TopoDS_Shape& theShape );
508 void SetShapeName( const char* theName );
509 void SetShape( const char* theID, const char* theName );
510 char* GetShapeName();
513 void SetTolerance( CORBA::Double );
514 CORBA::Double GetTolerance();
517 Controls::LyingOnGeomPtr myLyingOnGeomPtr;
523 Class : FreeBorders_i
524 Description : Predicate for free borders
526 class SMESH_I_EXPORT FreeBorders_i: public virtual POA_SMESH::FreeBorders,
527 public virtual Predicate_i
531 FunctorType GetFunctorType();
537 Description : Predicate for free edges
539 class SMESH_I_EXPORT FreeEdges_i: public virtual POA_SMESH::FreeEdges,
540 public virtual Predicate_i
544 SMESH::FreeEdges::Borders* GetBorders();
545 FunctorType GetFunctorType();
548 Controls::FreeEdgesPtr myFreeEdgesPtr;
554 Description : Predicate for free faces
556 class SMESH_I_EXPORT FreeFaces_i: public virtual POA_SMESH::FreeFaces,
557 public virtual Predicate_i
561 FunctorType GetFunctorType();
567 Description : Predicate for free nodes
569 class SMESH_I_EXPORT FreeNodes_i: public virtual POA_SMESH::FreeNodes,
570 public virtual Predicate_i
574 FunctorType GetFunctorType();
580 Description : Predicate for Range of Ids
582 class SMESH_I_EXPORT RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
583 public virtual Predicate_i
587 void SetRange( const SMESH::long_array& theIds );
588 CORBA::Boolean SetRangeStr( const char* theRange );
591 void SetElementType( ElementType theType );
592 FunctorType GetFunctorType();
595 Controls::RangeOfIdsPtr myRangeOfIdsPtr;
599 Class : LinearOrQuadratic_i
600 Description : Verify whether a mesh element is linear
602 class SMESH_I_EXPORT LinearOrQuadratic_i: public virtual POA_SMESH::LinearOrQuadratic,
603 public virtual Predicate_i
606 LinearOrQuadratic_i();
607 FunctorType GetFunctorType();
608 void SetElementType( ElementType theType );
611 Controls::LinearOrQuadraticPtr myLinearOrQuadraticPtr;
616 Description : Functor for check color of group to whic mesh element belongs to
618 class SMESH_I_EXPORT GroupColor_i: public virtual POA_SMESH::GroupColor,
619 public virtual Predicate_i
623 FunctorType GetFunctorType();
625 void SetElementType( ElementType theType );
626 void SetColorStr( const char* theColor );
630 Controls::GroupColorPtr myGroupColorPtr;
634 Class : ElemGeomType_i
635 Description : Functor for check element geometry type
637 class SMESH_I_EXPORT ElemGeomType_i: public virtual POA_SMESH::ElemGeomType,
638 public virtual Predicate_i
642 FunctorType GetFunctorType();
644 void SetElementType ( ElementType theType );
645 void SetGeometryType( GeometryType theType );
646 GeometryType GetGeometryType() const;
649 Controls::ElemGeomTypePtr myElemGeomTypePtr;
653 Class : CoplanarFaces_i
654 Description : Returns true if a mesh face is a coplanar neighbour to a given one
656 class SMESH_I_EXPORT CoplanarFaces_i: public virtual POA_SMESH::CoplanarFaces,
657 public virtual Predicate_i
661 FunctorType GetFunctorType();
663 void SetFace ( CORBA::Long theFaceID );
664 void SetTolerance( CORBA::Double theToler );
665 char* GetFaceAsString () const;
666 CORBA::Long GetFace () const;
667 CORBA::Double GetTolerance () const;
669 Controls::CoplanarFacesPtr myCoplanarFacesPtr;
674 Description : Base class for comparators
676 class SMESH_I_EXPORT Comparator_i: public virtual POA_SMESH::Comparator,
677 public virtual Predicate_i
680 virtual ~Comparator_i();
682 virtual void SetMargin( CORBA::Double );
683 virtual void SetNumFunctor( NumericalFunctor_ptr );
685 Controls::ComparatorPtr GetComparator();
686 NumericalFunctor_i* GetNumFunctor_i();
687 CORBA::Double GetMargin();
692 Controls::ComparatorPtr myComparatorPtr;
693 NumericalFunctor_i* myNumericalFunctor;
699 Description : Comparator "<"
701 class SMESH_I_EXPORT LessThan_i: public virtual POA_SMESH::LessThan,
702 public virtual Comparator_i
706 FunctorType GetFunctorType();
712 Description : Comparator ">"
714 class SMESH_I_EXPORT MoreThan_i: public virtual POA_SMESH::MoreThan,
715 public virtual Comparator_i
719 FunctorType GetFunctorType();
725 Description : Comparator "="
727 class SMESH_I_EXPORT EqualTo_i: public virtual POA_SMESH::EqualTo,
728 public virtual Comparator_i
732 virtual void SetTolerance( CORBA::Double );
733 CORBA::Double GetTolerance();
734 FunctorType GetFunctorType();
737 Controls::EqualToPtr myEqualToPtr;
743 Description : Logical NOT predicate
745 class SMESH_I_EXPORT LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
746 public virtual Predicate_i
750 virtual ~LogicalNOT_i();
752 virtual void SetPredicate( Predicate_ptr );
753 Predicate_i* GetPredicate_i();
754 FunctorType GetFunctorType();
757 Controls::LogicalNOTPtr myLogicalNOTPtr;
758 Predicate_i* myPredicate;
763 Class : LogicalBinary_i
764 Description : Base class for binary logical predicate
766 class SMESH_I_EXPORT LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
767 public virtual Predicate_i
770 virtual ~LogicalBinary_i();
771 virtual void SetMesh( SMESH_Mesh_ptr theMesh );
772 virtual void SetPredicate1( Predicate_ptr );
773 virtual void SetPredicate2( Predicate_ptr );
775 Controls::LogicalBinaryPtr GetLogicalBinary();
776 Predicate_i* GetPredicate1_i();
777 Predicate_i* GetPredicate2_i();
782 Controls::LogicalBinaryPtr myLogicalBinaryPtr;
783 Predicate_i* myPredicate1;
784 Predicate_i* myPredicate2;
790 Description : Logical AND
792 class SMESH_I_EXPORT LogicalAND_i: public virtual POA_SMESH::LogicalAND,
793 public virtual LogicalBinary_i
797 FunctorType GetFunctorType();
803 Description : Logical OR
805 class SMESH_I_EXPORT LogicalOR_i: public virtual POA_SMESH::LogicalOR,
806 public virtual LogicalBinary_i
810 FunctorType GetFunctorType();
817 class SMESH_I_EXPORT Filter_i: public virtual POA_SMESH::Filter,
818 public virtual SALOME::GenericObj_i
826 SetPredicate( Predicate_ptr );
830 SetMesh( SMESH_Mesh_ptr );
834 GetElementsId( Predicate_i*,
836 Controls::Filter::TIdSequence& );
839 GetElementsId( Predicate_i*,
841 Controls::Filter::TIdSequence& );
845 GetElementsId( SMESH_Mesh_ptr );
853 GetCriteria( SMESH::Filter::Criteria_out theCriteria );
857 SetCriteria( const SMESH::Filter::Criteria& theCriteria );
863 Predicate_i* GetPredicate_i();
865 // =========================
866 // SMESH_IDSource interface
867 // =========================
868 virtual SMESH::long_array* GetIDs();
869 virtual SMESH::long_array* GetMeshInfo();
870 virtual SMESH::array_of_ElementType* GetTypes();
871 virtual SMESH::SMESH_Mesh_ptr GetMesh();
874 Controls::Filter myFilter;
875 Predicate_i* myPredicate;
876 SMESH_Mesh_var myMesh;
883 class SMESH_I_EXPORT FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
884 public virtual SALOME::GenericObj_i
887 FilterLibrary_i( const char* theFileName );
891 Filter_ptr Copy( const char* theFilterName );
893 CORBA::Boolean Add ( const char* theFilterName, Filter_ptr theFilter );
894 CORBA::Boolean AddEmpty( const char* theFilterName, ElementType theType );
895 CORBA::Boolean Delete ( const char* theFilterName );
896 CORBA::Boolean Replace ( const char* theFilterName,
897 const char* theNewName,
898 Filter_ptr theFilter );
900 CORBA::Boolean Save();
901 CORBA::Boolean SaveAs( const char* aFileName );
903 CORBA::Boolean IsPresent( const char* aFilterName );
904 CORBA::Long NbFilters( ElementType );
905 string_array* GetNames( ElementType );
906 string_array* GetAllNames();
907 void SetFileName( const char* theFileName );
913 FilterManager_var myFilterMgr;
921 class SMESH_I_EXPORT FilterManager_i: public virtual POA_SMESH::FilterManager,
922 public virtual SALOME::GenericObj_i
928 MinimumAngle_ptr CreateMinimumAngle();
929 AspectRatio_ptr CreateAspectRatio();
930 AspectRatio3D_ptr CreateAspectRatio3D();
931 Warping_ptr CreateWarping();
932 Taper_ptr CreateTaper();
933 Skew_ptr CreateSkew();
934 Area_ptr CreateArea();
935 Volume3D_ptr CreateVolume3D();
936 MaxElementLength2D_ptr CreateMaxElementLength2D();
937 MaxElementLength3D_ptr CreateMaxElementLength3D();
938 Length_ptr CreateLength();
939 Length2D_ptr CreateLength2D();
940 MultiConnection_ptr CreateMultiConnection();
941 MultiConnection2D_ptr CreateMultiConnection2D();
943 BelongToGeom_ptr CreateBelongToGeom();
944 BelongToPlane_ptr CreateBelongToPlane();
945 BelongToCylinder_ptr CreateBelongToCylinder();
946 BelongToGenSurface_ptr CreateBelongToGenSurface();
948 LyingOnGeom_ptr CreateLyingOnGeom();
950 FreeBorders_ptr CreateFreeBorders();
951 FreeEdges_ptr CreateFreeEdges();
952 FreeNodes_ptr CreateFreeNodes();
953 FreeFaces_ptr CreateFreeFaces();
955 RangeOfIds_ptr CreateRangeOfIds();
956 BadOrientedVolume_ptr CreateBadOrientedVolume();
957 LinearOrQuadratic_ptr CreateLinearOrQuadratic();
958 GroupColor_ptr CreateGroupColor();
959 ElemGeomType_ptr CreateElemGeomType();
960 CoplanarFaces_ptr CreateCoplanarFaces();
962 LessThan_ptr CreateLessThan();
963 MoreThan_ptr CreateMoreThan();
964 EqualTo_ptr CreateEqualTo();
966 LogicalNOT_ptr CreateLogicalNOT();
967 LogicalAND_ptr CreateLogicalAND();
968 LogicalOR_ptr CreateLogicalOR();
970 Filter_ptr CreateFilter();
972 FilterLibrary_ptr LoadLibrary( const char* aFileName );
973 FilterLibrary_ptr CreateLibrary();
974 CORBA::Boolean DeleteLibrary( const char* aFileName );
979 GetPredicate( SMESH::Predicate_ptr thePredicate );