From: eap Date: Thu, 26 Jan 2012 15:58:58 +0000 (+0000) Subject: 0021338: EDF 1926 SMESH: New controls and filters X-Git-Tag: V6_5_0a1~168 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=98460fb0dcb4172fd31550a60732a3b475389f7d;p=modules%2Fsmesh.git 0021338: EDF 1926 SMESH: New controls and filters + class SMESH_I_EXPORT EqualNodes_i: public virtual POA_SMESH::EqualNodes, + class SMESH_I_EXPORT EqualEdges_i: public virtual POA_SMESH::EqualEdges, + class SMESH_I_EXPORT EqualFaces_i: public virtual POA_SMESH::EqualFaces, --- diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx index ea935418b..06a6e674a 100644 --- a/src/SMESH_I/SMESH_Filter_i.cxx +++ b/src/SMESH_I/SMESH_Filter_i.cxx @@ -1432,6 +1432,77 @@ FunctorType FreeNodes_i::GetFunctorType() return SMESH::FT_FreeNodes; } +/* + Class : EqualNodes_i + Description : Predicate for Equal nodes +*/ +EqualNodes_i::EqualNodes_i() +{ + myCoincidentNodesPtr.reset(new Controls::CoincidentNodes()); + myFunctorPtr = myPredicatePtr = myCoincidentNodesPtr; +} + +FunctorType EqualNodes_i::GetFunctorType() +{ + return SMESH::FT_EqualNodes; +} + +void EqualNodes_i::SetTolerance( double tol ) +{ + myCoincidentNodesPtr->SetTolerance( tol ); +} + +double EqualNodes_i::GetTolerance() +{ + return myCoincidentNodesPtr->GetTolerance(); +} + +/* + Class : EqualEdges_i + Description : Predicate for Equal Edges +*/ +EqualEdges_i::EqualEdges_i() +{ + myPredicatePtr.reset(new Controls::CoincidentElements1D()); + myFunctorPtr = myPredicatePtr; +} + +FunctorType EqualEdges_i::GetFunctorType() +{ + return SMESH::FT_EqualEdges; +} + +/* + Class : EqualFaces_i + Description : Predicate for Equal Faces +*/ +EqualFaces_i::EqualFaces_i() +{ + myPredicatePtr.reset(new Controls::CoincidentElements2D()); + myFunctorPtr = myPredicatePtr; +} + +FunctorType EqualFaces_i::GetFunctorType() +{ + return SMESH::FT_EqualFaces; +} + +/* + Class : EqualVolumes_i + Description : Predicate for Equal Volumes +*/ +EqualVolumes_i::EqualVolumes_i() +{ + myPredicatePtr.reset(new Controls::CoincidentElements3D()); + myFunctorPtr = myPredicatePtr; +} + +FunctorType EqualVolumes_i::GetFunctorType() +{ + return SMESH::FT_EqualVolumes; +} + + /* Class : RangeOfIds_i Description : Predicate for Range of Ids. @@ -2085,6 +2156,36 @@ FreeNodes_ptr FilterManager_i::CreateFreeNodes() return anObj._retn(); } +EqualNodes_ptr FilterManager_i::CreateEqualNodes() +{ + SMESH::EqualNodes_i* aServant = new SMESH::EqualNodes_i(); + SMESH::EqualNodes_var anObj = aServant->_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<_this(); + TPythonDump()<length(); theCriteria->length( i + 1 ); @@ -2589,87 +2698,31 @@ static inline bool getCriteria( Predicate_i* thePred, return true; } - case FT_RangeOfIds: - { - RangeOfIds_i* aPred = dynamic_cast( thePred ); - - CORBA::ULong i = theCriteria->length(); - theCriteria->length( i + 1 ); - - theCriteria[ i ] = createCriterion(); - - theCriteria[ i ].Type = FT_RangeOfIds; - theCriteria[ i ].ThresholdStr = aPred->GetRangeStr(); - theCriteria[ i ].TypeOfElement = aPred->GetElementType(); - - return true; - } - case FT_BadOrientedVolume: - { - BadOrientedVolume_i* aPred = dynamic_cast( thePred ); - - CORBA::ULong i = theCriteria->length(); - theCriteria->length( i + 1 ); - - theCriteria[ i ] = createCriterion(); - - theCriteria[ i ].Type = FT_BadOrientedVolume; - theCriteria[ i ].TypeOfElement = aPred->GetElementType(); - - return true; - } - case FT_BareBorderVolume: + case FT_EqualNodes: { - BareBorderVolume_i* aPred = dynamic_cast( thePred ); + EqualNodes_i* aPred = dynamic_cast( thePred ); CORBA::ULong i = theCriteria->length(); theCriteria->length( i + 1 ); theCriteria[ i ] = createCriterion(); - theCriteria[ i ].Type = FT_BareBorderVolume; - theCriteria[ i ].TypeOfElement = aPred->GetElementType(); - - return true; - } - case FT_BareBorderFace: - { - BareBorderFace_i* aPred = dynamic_cast( thePred ); - - CORBA::ULong i = theCriteria->length(); - theCriteria->length( i + 1 ); - - theCriteria[ i ] = createCriterion(); - - theCriteria[ i ].Type = FT_BareBorderFace; - theCriteria[ i ].TypeOfElement = aPred->GetElementType(); - - return true; - } - case FT_OverConstrainedVolume: - { - OverConstrainedVolume_i* aPred = dynamic_cast( thePred ); - - CORBA::ULong i = theCriteria->length(); - theCriteria->length( i + 1 ); - - theCriteria[ i ] = createCriterion(); - - theCriteria[ i ].Type = FT_OverConstrainedVolume; - theCriteria[ i ].TypeOfElement = aPred->GetElementType(); + theCriteria[ i ].Type = FT_EqualNodes; + theCriteria[ i ].Tolerance = aPred->GetTolerance(); return true; } - case FT_OverConstrainedFace: + case FT_RangeOfIds: { - OverConstrainedFace_i* aPred = dynamic_cast( thePred ); + RangeOfIds_i* aPred = dynamic_cast( thePred ); CORBA::ULong i = theCriteria->length(); theCriteria->length( i + 1 ); theCriteria[ i ] = createCriterion(); - theCriteria[ i ].Type = FT_OverConstrainedFace; + theCriteria[ i ].Type = FT_RangeOfIds; + theCriteria[ i ].ThresholdStr = aPred->GetRangeStr(); theCriteria[ i ].TypeOfElement = aPred->GetElementType(); return true; @@ -2873,6 +2926,22 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria case SMESH::FT_FreeNodes: aPredicate = aFilterMgr->CreateFreeNodes(); break; + case SMESH::FT_EqualNodes: + { + SMESH::EqualNodes_ptr pred = aFilterMgr->CreateEqualNodes(); + pred->SetTolerance( aTolerance ); + aPredicate = pred; + break; + } + case SMESH::FT_EqualEdges: + aPredicate = aFilterMgr->CreateEqualEdges(); + break; + case SMESH::FT_EqualFaces: + aPredicate = aFilterMgr->CreateEqualFaces(); + break; + case SMESH::FT_EqualVolumes: + aPredicate = aFilterMgr->CreateEqualVolumes(); + break; case SMESH::FT_BelongToGeom: { SMESH::BelongToGeom_ptr tmpPred = aFilterMgr->CreateBelongToGeom(); @@ -3194,8 +3263,12 @@ static inline LDOMString toString( CORBA::Long theType ) case FT_FreeEdges : return "Free edges"; case FT_FreeFaces : return "Free faces"; case FT_FreeNodes : return "Free nodes"; + case FT_EqualNodes : return "Equal nodes"; + case FT_EqualEdges : return "Equal edges"; + case FT_EqualFaces : return "Equal faces"; + case FT_EqualVolumes : return "Equal volumes"; case FT_MultiConnection : return "Borders at multi-connections"; - case FT_MultiConnection2D: return "Borders at multi-connections 2D"; + case FT_MultiConnection2D:return "Borders at multi-connections 2D"; case FT_Length : return "Length"; case FT_Length2D : return "Length 2D"; case FT_LessThan : return "Less than"; @@ -3236,6 +3309,10 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr ) else if ( theStr.equals( "Free edges" ) ) return FT_FreeEdges; else if ( theStr.equals( "Free faces" ) ) return FT_FreeFaces; else if ( theStr.equals( "Free nodes" ) ) return FT_FreeNodes; + else if ( theStr.equals( "Equal nodes" ) ) return FT_EqualNodes; + else if ( theStr.equals( "Equal edges" ) ) return FT_EqualEdges; + else if ( theStr.equals( "Equal faces" ) ) return FT_EqualFaces; + else if ( theStr.equals( "Equal volumes" ) ) return FT_EqualVolumes; else if ( theStr.equals( "Borders at multi-connections" ) ) return FT_MultiConnection; // else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D; else if ( theStr.equals( "Length" ) ) return FT_Length; @@ -3779,13 +3856,13 @@ string_array* FilterLibrary_i::GetAllNames() static const char** getFunctNames() { static const char* functName[ SMESH::FT_Undefined + 1 ] = { - // If this line doesn't compile, this means that enum FunctorType has changed and - // it's necessary to update this array accordingly (refer to SMESH_Filter.idl) + // IT's necessary to update this array according to enum FunctorType (SMESH_Filter.idl) // The order is IMPORTANT !!! "FT_AspectRatio", "FT_AspectRatio3D", "FT_Warping", "FT_MinimumAngle", "FT_Taper", "FT_Skew", "FT_Area", "FT_Volume3D", "FT_MaxElementLength2D", "FT_MaxElementLength3D", "FT_FreeBorders", "FT_FreeEdges", "FT_FreeNodes", - "FT_FreeFaces", "FT_MultiConnection", "FT_MultiConnection2D", "FT_Length", + "FT_FreeFaces","FT_EqualNodes","FT_EqualEdges","FT_EqualFaces","FT_EqualVolumes", + "FT_MultiConnection", "FT_MultiConnection2D", "FT_Length", "FT_Length2D", "FT_BelongToGeom", "FT_BelongToPlane", "FT_BelongToCylinder", "FT_BelongToGenSurface", "FT_LyingOnGeom", "FT_RangeOfIds", "FT_BadOrientedVolume", "FT_BareBorderVolume", "FT_BareBorderFace", "FT_OverConstrainedVolume", diff --git a/src/SMESH_I/SMESH_Filter_i.hxx b/src/SMESH_I/SMESH_Filter_i.hxx index 1cb20d8f7..ca041a7a7 100644 --- a/src/SMESH_I/SMESH_Filter_i.hxx +++ b/src/SMESH_I/SMESH_Filter_i.hxx @@ -628,6 +628,57 @@ namespace SMESH }; + /* + Class : EqualNodes_i + Description : Predicate for equal nodes + */ + class SMESH_I_EXPORT EqualNodes_i: public virtual POA_SMESH::EqualNodes, + public virtual Predicate_i + { + public: + EqualNodes_i(); + FunctorType GetFunctorType(); + void SetTolerance( double ); + double GetTolerance(); + + private: + Controls::CoincidentNodesPtr myCoincidentNodesPtr; + }; + /* + Class : EqualEdges_i + Description : Predicate for equal edges + */ + class SMESH_I_EXPORT EqualEdges_i: public virtual POA_SMESH::EqualEdges, + public virtual Predicate_i + { + public: + EqualEdges_i(); + FunctorType GetFunctorType(); + }; + /* + Class : EqualFaces_i + Description : Predicate for equal Faces + */ + class SMESH_I_EXPORT EqualFaces_i: public virtual POA_SMESH::EqualFaces, + public virtual Predicate_i + { + public: + EqualFaces_i(); + FunctorType GetFunctorType(); + }; + /* + Class : EqualVolumes_i + Description : Predicate for equal Volumes + */ + class SMESH_I_EXPORT EqualVolumes_i: public virtual POA_SMESH::EqualVolumes, + public virtual Predicate_i + { + public: + EqualVolumes_i(); + FunctorType GetFunctorType(); + }; + + /* Class : RangeOfIds_i Description : Predicate for Range of Ids @@ -1016,7 +1067,12 @@ namespace SMESH FreeEdges_ptr CreateFreeEdges(); FreeNodes_ptr CreateFreeNodes(); FreeFaces_ptr CreateFreeFaces(); - + + EqualNodes_ptr CreateEqualNodes(); + EqualEdges_ptr CreateEqualEdges(); + EqualFaces_ptr CreateEqualFaces(); + EqualVolumes_ptr CreateEqualVolumes(); + RangeOfIds_ptr CreateRangeOfIds(); BadOrientedVolume_ptr CreateBadOrientedVolume(); BareBorderFace_ptr CreateBareBorderFace();