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"
47 // ================================================================================
53 Description : Predicate for verifying whether entiy belong to
54 specified geometrical support
56 class SMESH_I_EXPORT BelongToGeom: public virtual Predicate
61 virtual void SetMesh( const SMDS_Mesh* theMesh );
62 virtual void SetGeom( const TopoDS_Shape& theShape );
64 virtual bool IsSatisfy( long theElementId );
66 virtual void SetType( SMDSAbs_ElementType theType );
67 virtual SMDSAbs_ElementType GetType() const;
69 TopoDS_Shape GetShape();
70 const SMESHDS_Mesh* GetMeshDS() const;
72 void SetTolerance( double );
73 double GetTolerance();
79 const SMESHDS_Mesh* myMeshDS;
80 SMDSAbs_ElementType myType;
82 double myTolerance; // only if myIsSubshape == false
83 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
85 typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
89 Description : Predicate for verifying whether entiy lying or partially lying on
90 specified geometrical support
92 class SMESH_I_EXPORT LyingOnGeom: public virtual Predicate
97 virtual void SetMesh( const SMDS_Mesh* theMesh );
98 virtual void SetGeom( const TopoDS_Shape& theShape );
100 virtual bool IsSatisfy( long theElementId );
102 virtual void SetType( SMDSAbs_ElementType theType );
103 virtual SMDSAbs_ElementType GetType() const;
105 TopoDS_Shape GetShape();
106 const SMESHDS_Mesh* GetMeshDS() const;
108 void SetTolerance( double );
109 double GetTolerance();
111 virtual bool Contains( const SMESHDS_Mesh* theMeshDS,
112 const TopoDS_Shape& theShape,
113 const SMDS_MeshElement* theElem,
114 TopAbs_ShapeEnum theFindShapeEnum,
115 TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE );
119 TopoDS_Shape myShape;
120 const SMESHDS_Mesh* myMeshDS;
121 SMDSAbs_ElementType myType;
123 double myTolerance; // only if myIsSubshape == false
124 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
126 typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
128 } // namespace Controls
130 // ================================================================================
137 Description : An abstact class for all functors
139 class SMESH_I_EXPORT Functor_i: public virtual POA_SMESH::Functor,
140 public virtual SALOME::GenericObj_i
143 void SetMesh( SMESH_Mesh_ptr theMesh );
144 Controls::FunctorPtr GetFunctor(){ return myFunctorPtr;}
145 ElementType GetElementType();
151 Controls::FunctorPtr myFunctorPtr;
155 Class : NumericalFunctor_i
156 Description : Base class for numerical functors
158 class SMESH_I_EXPORT NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor,
159 public virtual Functor_i
162 CORBA::Double GetValue( CORBA::Long theElementId );
163 SMESH::Histogram* GetHistogram(CORBA::Short nbIntervals);
164 void SetPrecision( CORBA::Long thePrecision );
165 CORBA::Long GetPrecision();
166 Controls::NumericalFunctorPtr GetNumericalFunctor();
169 Controls::NumericalFunctorPtr myNumericalFunctorPtr;
174 Class : SMESH_MinimumAngleFunct
175 Description : Functor for calculation of minimum angle
177 class SMESH_I_EXPORT MinimumAngle_i: public virtual POA_SMESH::MinimumAngle,
178 public virtual NumericalFunctor_i
182 FunctorType GetFunctorType();
187 Class : AspectRatio_i
188 Description : Functor for calculating aspect ratio
190 class SMESH_I_EXPORT AspectRatio_i: public virtual POA_SMESH::AspectRatio,
191 public virtual NumericalFunctor_i
195 FunctorType GetFunctorType();
200 Class : AspectRatio3D_i
201 Description : Functor for calculating aspect ratio for 3D
203 class SMESH_I_EXPORT AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D,
204 public virtual NumericalFunctor_i
208 FunctorType GetFunctorType();
214 Description : Functor for calculating warping
216 class SMESH_I_EXPORT Warping_i: public virtual POA_SMESH::Warping,
217 public virtual NumericalFunctor_i
221 FunctorType GetFunctorType();
227 Description : Functor for calculating taper
229 class SMESH_I_EXPORT Taper_i: public virtual POA_SMESH::Taper,
230 public virtual NumericalFunctor_i
234 FunctorType GetFunctorType();
240 Description : Functor for calculating skew in degrees
242 class SMESH_I_EXPORT Skew_i: public virtual POA_SMESH::Skew,
243 public virtual NumericalFunctor_i
247 FunctorType GetFunctorType();
253 Description : Functor for calculating area
255 class SMESH_I_EXPORT Area_i: public virtual POA_SMESH::Area,
256 public virtual NumericalFunctor_i
260 FunctorType GetFunctorType();
266 Description : Functor for calculating volume of 3D element
268 class SMESH_I_EXPORT Volume3D_i: public virtual POA_SMESH::Volume3D,
269 public virtual NumericalFunctor_i
273 FunctorType GetFunctorType();
278 Class : MaxElementLength2D_i
279 Description : Functor for calculating maximum length of 2D element
281 class SMESH_I_EXPORT MaxElementLength2D_i: public virtual POA_SMESH::MaxElementLength2D,
282 public virtual NumericalFunctor_i
285 MaxElementLength2D_i();
286 FunctorType GetFunctorType();
291 Class : MaxElementLength3D_i
292 Description : Functor for calculating maximum length of 3D element
294 class SMESH_I_EXPORT MaxElementLength3D_i: public virtual POA_SMESH::MaxElementLength3D,
295 public virtual NumericalFunctor_i
298 MaxElementLength3D_i();
299 FunctorType GetFunctorType();
305 Description : Functor for calculating length of edge
307 class SMESH_I_EXPORT Length_i: public virtual POA_SMESH::Length,
308 public virtual NumericalFunctor_i
312 FunctorType GetFunctorType();
317 Description : Functor for calculating length of edge
319 class SMESH_I_EXPORT Length2D_i: public virtual POA_SMESH::Length2D,
320 public virtual NumericalFunctor_i
324 SMESH::Length2D::Values* GetValues();
325 FunctorType GetFunctorType();
328 Controls::Length2DPtr myLength2DPtr;
333 Class : MultiConnection_i
334 Description : Functor for calculating number of faces conneted to the edge
336 class SMESH_I_EXPORT MultiConnection_i: public virtual POA_SMESH::MultiConnection,
337 public virtual NumericalFunctor_i
341 FunctorType GetFunctorType();
345 Class : MultiConnection2D_i
346 Description : Functor for calculating number of faces conneted to the edge
348 class SMESH_I_EXPORT MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
349 public virtual NumericalFunctor_i
352 MultiConnection2D_i();
353 SMESH::MultiConnection2D::Values* GetValues();
354 FunctorType GetFunctorType();
357 Controls::MultiConnection2DPtr myMulticonnection2DPtr;
366 Description : Base class for all predicates
368 class SMESH_I_EXPORT Predicate_i: public virtual POA_SMESH::Predicate,
369 public virtual Functor_i
372 CORBA::Boolean IsSatisfy( CORBA::Long theElementId );
373 Controls::PredicatePtr GetPredicate();
376 Controls::PredicatePtr myPredicatePtr;
381 Class : BadOrientedVolume_i
382 Description : Verify whether a mesh volume is incorrectly oriented from
383 the point of view of MED convention
385 class SMESH_I_EXPORT BadOrientedVolume_i: public virtual POA_SMESH::BadOrientedVolume,
386 public virtual Predicate_i
389 BadOrientedVolume_i();
390 FunctorType GetFunctorType();
394 Class : BareBorderVolume_i
395 Description : Verify whether a mesh volume is incorrectly oriented from
396 the point of view of MED convention
398 class SMESH_I_EXPORT BareBorderVolume_i: public virtual POA_SMESH::BareBorderVolume,
399 public virtual Predicate_i
402 BareBorderVolume_i();
403 FunctorType GetFunctorType();
407 Class : BareBorderFace_i
408 Description : Verify whether a mesh volume is incorrectly oriented from
409 the point of view of MED convention
411 class SMESH_I_EXPORT BareBorderFace_i: public virtual POA_SMESH::BareBorderFace,
412 public virtual Predicate_i
416 FunctorType GetFunctorType();
420 Class : BelongToGeom_i
421 Description : Predicate for selection on geometrical support
423 class SMESH_I_EXPORT BelongToGeom_i: public virtual POA_SMESH::BelongToGeom,
424 public virtual Predicate_i
428 virtual ~BelongToGeom_i();
430 void SetGeom( GEOM::GEOM_Object_ptr theGeom );
431 void SetElementType( ElementType theType );
432 FunctorType GetFunctorType();
434 void SetGeom( const TopoDS_Shape& theShape );
436 void SetShapeName( const char* theName );
437 void SetShape( const char* theID, const char* theName );
438 char* GetShapeName();
441 void SetTolerance( CORBA::Double );
442 CORBA::Double GetTolerance();
445 Controls::BelongToGeomPtr myBelongToGeomPtr;
451 Class : BelongToSurface_i
452 Description : Verify whether mesh element lie in pointed Geom planar object
454 class SMESH_I_EXPORT BelongToSurface_i: public virtual POA_SMESH::BelongToSurface,
455 public virtual Predicate_i
458 BelongToSurface_i( const Handle(Standard_Type)& );
459 virtual ~BelongToSurface_i();
461 void SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
463 void SetShapeName( const char* theName, ElementType theType );
464 void SetShape( const char* theID, const char* theName, ElementType theType );
465 char* GetShapeName();
468 void SetTolerance( CORBA::Double );
469 CORBA::Double GetTolerance();
471 void SetUseBoundaries( CORBA::Boolean theUseBndRestrictions );
472 CORBA::Boolean GetUseBoundaries();
475 Controls::ElementsOnSurfacePtr myElementsOnSurfacePtr;
478 Handle(Standard_Type) mySurfaceType;
482 Class : BelongToPlane_i
483 Description : Verify whether mesh element lie in pointed Geom planar object
485 class SMESH_I_EXPORT BelongToPlane_i: public virtual POA_SMESH::BelongToPlane,
486 public virtual BelongToSurface_i
490 void SetPlane( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
491 FunctorType GetFunctorType();
495 Class : BelongToCylinder_i
496 Description : Verify whether mesh element lie in pointed Geom cylindrical object
498 class SMESH_I_EXPORT BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder,
499 public virtual BelongToSurface_i
502 BelongToCylinder_i();
503 void SetCylinder( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
504 FunctorType GetFunctorType();
508 Class : BelongToGenSurface_i
509 Description : Verify whether mesh element lie on pointed Geom surfasic object
511 class BelongToGenSurface_i: public virtual POA_SMESH::BelongToGenSurface,
512 public virtual BelongToSurface_i
515 BelongToGenSurface_i();
516 void SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType );
517 FunctorType GetFunctorType();
521 Class : LyingOnGeom_i
522 Description : Predicate for selection on geometrical support(lying or partially lying)
524 class SMESH_I_EXPORT LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
525 public virtual Predicate_i
529 virtual ~LyingOnGeom_i();
531 void SetGeom( GEOM::GEOM_Object_ptr theGeom );
532 void SetElementType( ElementType theType );
533 FunctorType GetFunctorType();
535 void SetGeom( const TopoDS_Shape& theShape );
537 void SetShapeName( const char* theName );
538 void SetShape( const char* theID, const char* theName );
539 char* GetShapeName();
542 void SetTolerance( CORBA::Double );
543 CORBA::Double GetTolerance();
546 Controls::LyingOnGeomPtr myLyingOnGeomPtr;
552 Class : FreeBorders_i
553 Description : Predicate for free borders
555 class SMESH_I_EXPORT FreeBorders_i: public virtual POA_SMESH::FreeBorders,
556 public virtual Predicate_i
560 FunctorType GetFunctorType();
566 Description : Predicate for free edges
568 class SMESH_I_EXPORT FreeEdges_i: public virtual POA_SMESH::FreeEdges,
569 public virtual Predicate_i
573 SMESH::FreeEdges::Borders* GetBorders();
574 FunctorType GetFunctorType();
577 Controls::FreeEdgesPtr myFreeEdgesPtr;
583 Description : Predicate for free faces
585 class SMESH_I_EXPORT FreeFaces_i: public virtual POA_SMESH::FreeFaces,
586 public virtual Predicate_i
590 FunctorType GetFunctorType();
596 Description : Predicate for free nodes
598 class SMESH_I_EXPORT FreeNodes_i: public virtual POA_SMESH::FreeNodes,
599 public virtual Predicate_i
603 FunctorType GetFunctorType();
609 Description : Predicate for Range of Ids
611 class SMESH_I_EXPORT RangeOfIds_i: public virtual POA_SMESH::RangeOfIds,
612 public virtual Predicate_i
616 void SetRange( const SMESH::long_array& theIds );
617 CORBA::Boolean SetRangeStr( const char* theRange );
620 void SetElementType( ElementType theType );
621 FunctorType GetFunctorType();
624 Controls::RangeOfIdsPtr myRangeOfIdsPtr;
628 Class : LinearOrQuadratic_i
629 Description : Verify whether a mesh element is linear
631 class SMESH_I_EXPORT LinearOrQuadratic_i: public virtual POA_SMESH::LinearOrQuadratic,
632 public virtual Predicate_i
635 LinearOrQuadratic_i();
636 FunctorType GetFunctorType();
637 void SetElementType( ElementType theType );
640 Controls::LinearOrQuadraticPtr myLinearOrQuadraticPtr;
645 Description : Functor for check color of group to whic mesh element belongs to
647 class SMESH_I_EXPORT GroupColor_i: public virtual POA_SMESH::GroupColor,
648 public virtual Predicate_i
652 FunctorType GetFunctorType();
654 void SetElementType( ElementType theType );
655 void SetColorStr( const char* theColor );
659 Controls::GroupColorPtr myGroupColorPtr;
663 Class : ElemGeomType_i
664 Description : Functor for check element geometry type
666 class SMESH_I_EXPORT ElemGeomType_i: public virtual POA_SMESH::ElemGeomType,
667 public virtual Predicate_i
671 FunctorType GetFunctorType();
673 void SetElementType ( ElementType theType );
674 void SetGeometryType( GeometryType theType );
675 GeometryType GetGeometryType() const;
678 Controls::ElemGeomTypePtr myElemGeomTypePtr;
683 Description : Base class for comparators
685 class SMESH_I_EXPORT Comparator_i: public virtual POA_SMESH::Comparator,
686 public virtual Predicate_i
689 virtual ~Comparator_i();
691 virtual void SetMargin( CORBA::Double );
692 virtual void SetNumFunctor( NumericalFunctor_ptr );
694 Controls::ComparatorPtr GetComparator();
695 NumericalFunctor_i* GetNumFunctor_i();
696 CORBA::Double GetMargin();
701 Controls::ComparatorPtr myComparatorPtr;
702 NumericalFunctor_i* myNumericalFunctor;
708 Description : Comparator "<"
710 class SMESH_I_EXPORT LessThan_i: public virtual POA_SMESH::LessThan,
711 public virtual Comparator_i
715 FunctorType GetFunctorType();
721 Description : Comparator ">"
723 class SMESH_I_EXPORT MoreThan_i: public virtual POA_SMESH::MoreThan,
724 public virtual Comparator_i
728 FunctorType GetFunctorType();
734 Description : Comparator "="
736 class SMESH_I_EXPORT EqualTo_i: public virtual POA_SMESH::EqualTo,
737 public virtual Comparator_i
741 virtual void SetTolerance( CORBA::Double );
742 CORBA::Double GetTolerance();
743 FunctorType GetFunctorType();
746 Controls::EqualToPtr myEqualToPtr;
752 Description : Logical NOT predicate
754 class SMESH_I_EXPORT LogicalNOT_i: public virtual POA_SMESH::LogicalNOT,
755 public virtual Predicate_i
759 virtual ~LogicalNOT_i();
761 virtual void SetPredicate( Predicate_ptr );
762 Predicate_i* GetPredicate_i();
763 FunctorType GetFunctorType();
766 Controls::LogicalNOTPtr myLogicalNOTPtr;
767 Predicate_i* myPredicate;
772 Class : LogicalBinary_i
773 Description : Base class for binary logical predicate
775 class SMESH_I_EXPORT LogicalBinary_i: public virtual POA_SMESH::LogicalBinary,
776 public virtual Predicate_i
779 virtual ~LogicalBinary_i();
780 virtual void SetMesh( SMESH_Mesh_ptr theMesh );
781 virtual void SetPredicate1( Predicate_ptr );
782 virtual void SetPredicate2( Predicate_ptr );
784 Controls::LogicalBinaryPtr GetLogicalBinary();
785 Predicate_i* GetPredicate1_i();
786 Predicate_i* GetPredicate2_i();
791 Controls::LogicalBinaryPtr myLogicalBinaryPtr;
792 Predicate_i* myPredicate1;
793 Predicate_i* myPredicate2;
799 Description : Logical AND
801 class SMESH_I_EXPORT LogicalAND_i: public virtual POA_SMESH::LogicalAND,
802 public virtual LogicalBinary_i
806 FunctorType GetFunctorType();
812 Description : Logical OR
814 class SMESH_I_EXPORT LogicalOR_i: public virtual POA_SMESH::LogicalOR,
815 public virtual LogicalBinary_i
819 FunctorType GetFunctorType();
826 class SMESH_I_EXPORT Filter_i: public virtual POA_SMESH::Filter,
827 public virtual SALOME::GenericObj_i
835 SetPredicate( Predicate_ptr );
839 SetMesh( SMESH_Mesh_ptr );
843 GetElementsId( Predicate_i*,
845 Controls::Filter::TIdSequence& );
848 GetElementsId( Predicate_i*,
850 Controls::Filter::TIdSequence& );
854 GetElementsId( SMESH_Mesh_ptr );
862 GetCriteria( SMESH::Filter::Criteria_out theCriteria );
866 SetCriteria( const SMESH::Filter::Criteria& theCriteria );
872 Predicate_i* GetPredicate_i();
874 // =========================
875 // SMESH_IDSource interface
876 // =========================
877 virtual SMESH::long_array* GetIDs();
878 virtual SMESH::long_array* GetMeshInfo();
879 virtual SMESH::array_of_ElementType* GetTypes();
880 virtual SMESH::SMESH_Mesh_ptr GetMesh();
883 Controls::Filter myFilter;
884 Predicate_i* myPredicate;
885 SMESH_Mesh_var myMesh;
892 class SMESH_I_EXPORT FilterLibrary_i: public virtual POA_SMESH::FilterLibrary,
893 public virtual SALOME::GenericObj_i
896 FilterLibrary_i( const char* theFileName );
900 Filter_ptr Copy( const char* theFilterName );
902 CORBA::Boolean Add ( const char* theFilterName, Filter_ptr theFilter );
903 CORBA::Boolean AddEmpty( const char* theFilterName, ElementType theType );
904 CORBA::Boolean Delete ( const char* theFilterName );
905 CORBA::Boolean Replace ( const char* theFilterName,
906 const char* theNewName,
907 Filter_ptr theFilter );
909 CORBA::Boolean Save();
910 CORBA::Boolean SaveAs( const char* aFileName );
912 CORBA::Boolean IsPresent( const char* aFilterName );
913 CORBA::Long NbFilters( ElementType );
914 string_array* GetNames( ElementType );
915 string_array* GetAllNames();
916 void SetFileName( const char* theFileName );
922 FilterManager_var myFilterMgr;
930 class SMESH_I_EXPORT FilterManager_i: public virtual POA_SMESH::FilterManager,
931 public virtual SALOME::GenericObj_i
937 MinimumAngle_ptr CreateMinimumAngle();
938 AspectRatio_ptr CreateAspectRatio();
939 AspectRatio3D_ptr CreateAspectRatio3D();
940 Warping_ptr CreateWarping();
941 Taper_ptr CreateTaper();
942 Skew_ptr CreateSkew();
943 Area_ptr CreateArea();
944 Volume3D_ptr CreateVolume3D();
945 MaxElementLength2D_ptr CreateMaxElementLength2D();
946 MaxElementLength3D_ptr CreateMaxElementLength3D();
947 Length_ptr CreateLength();
948 Length2D_ptr CreateLength2D();
949 MultiConnection_ptr CreateMultiConnection();
950 MultiConnection2D_ptr CreateMultiConnection2D();
952 BelongToGeom_ptr CreateBelongToGeom();
953 BelongToPlane_ptr CreateBelongToPlane();
954 BelongToCylinder_ptr CreateBelongToCylinder();
955 BelongToGenSurface_ptr CreateBelongToGenSurface();
957 LyingOnGeom_ptr CreateLyingOnGeom();
959 FreeBorders_ptr CreateFreeBorders();
960 FreeEdges_ptr CreateFreeEdges();
961 FreeNodes_ptr CreateFreeNodes();
962 FreeFaces_ptr CreateFreeFaces();
964 RangeOfIds_ptr CreateRangeOfIds();
966 BadOrientedVolume_ptr CreateBadOrientedVolume();
967 BareBorderFace_ptr CreateBareBorderFace();
968 BareBorderVolume_ptr CreateBareBorderVolume();
969 LinearOrQuadratic_ptr CreateLinearOrQuadratic();
971 GroupColor_ptr CreateGroupColor();
973 ElemGeomType_ptr CreateElemGeomType();
975 LessThan_ptr CreateLessThan();
976 MoreThan_ptr CreateMoreThan();
977 EqualTo_ptr CreateEqualTo();
979 LogicalNOT_ptr CreateLogicalNOT();
980 LogicalAND_ptr CreateLogicalAND();
981 LogicalOR_ptr CreateLogicalOR();
983 Filter_ptr CreateFilter();
985 FilterLibrary_ptr LoadLibrary( const char* aFileName );
986 FilterLibrary_ptr CreateLibrary();
987 CORBA::Boolean DeleteLibrary( const char* aFileName );
992 GetPredicate( SMESH::Predicate_ptr thePredicate );