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,
This commit is contained in:
eap 2012-01-26 15:58:58 +00:00
parent da61389f82
commit 98460fb0dc
2 changed files with 208 additions and 75 deletions

View File

@ -1432,6 +1432,77 @@ FunctorType FreeNodes_i::GetFunctorType()
return SMESH::FT_FreeNodes; 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 Class : RangeOfIds_i
Description : Predicate for Range of Ids. Description : Predicate for Range of Ids.
@ -2085,6 +2156,36 @@ FreeNodes_ptr FilterManager_i::CreateFreeNodes()
return anObj._retn(); return anObj._retn();
} }
EqualNodes_ptr FilterManager_i::CreateEqualNodes()
{
SMESH::EqualNodes_i* aServant = new SMESH::EqualNodes_i();
SMESH::EqualNodes_var anObj = aServant->_this();
TPythonDump()<<aServant<<" = "<<this<<".CreateEqualNodes()";
return anObj._retn();
}
EqualEdges_ptr FilterManager_i::CreateEqualEdges()
{
SMESH::EqualEdges_i* aServant = new SMESH::EqualEdges_i();
SMESH::EqualEdges_var anObj = aServant->_this();
TPythonDump()<<aServant<<" = "<<this<<".CreateEqualEdges()";
return anObj._retn();
}
EqualFaces_ptr FilterManager_i::CreateEqualFaces()
{
SMESH::EqualFaces_i* aServant = new SMESH::EqualFaces_i();
SMESH::EqualFaces_var anObj = aServant->_this();
TPythonDump()<<aServant<<" = "<<this<<".CreateEqualFaces()";
return anObj._retn();
}
EqualVolumes_ptr FilterManager_i::CreateEqualVolumes()
{
SMESH::EqualVolumes_i* aServant = new SMESH::EqualVolumes_i();
SMESH::EqualVolumes_var anObj = aServant->_this();
TPythonDump()<<aServant<<" = "<<this<<".CreateEqualVolumes()";
return anObj._retn();
}
RangeOfIds_ptr FilterManager_i::CreateRangeOfIds() RangeOfIds_ptr FilterManager_i::CreateRangeOfIds()
{ {
SMESH::RangeOfIds_i* aServant = new SMESH::RangeOfIds_i(); SMESH::RangeOfIds_i* aServant = new SMESH::RangeOfIds_i();
@ -2510,6 +2611,14 @@ static inline bool getCriteria( Predicate_i* thePred,
case FT_FreeFaces: case FT_FreeFaces:
case FT_LinearOrQuadratic: case FT_LinearOrQuadratic:
case FT_FreeNodes: case FT_FreeNodes:
case FT_EqualEdges:
case FT_EqualFaces:
case FT_EqualVolumes:
case FT_BadOrientedVolume:
case FT_BareBorderVolume:
case FT_BareBorderFace:
case FT_OverConstrainedVolume:
case FT_OverConstrainedFace:
{ {
CORBA::ULong i = theCriteria->length(); CORBA::ULong i = theCriteria->length();
theCriteria->length( i + 1 ); theCriteria->length( i + 1 );
@ -2587,6 +2696,20 @@ static inline bool getCriteria( Predicate_i* thePred,
theCriteria[ i ].ThresholdID = faceId; theCriteria[ i ].ThresholdID = faceId;
theCriteria[ i ].Tolerance = aPred->GetTolerance(); theCriteria[ i ].Tolerance = aPred->GetTolerance();
return true;
}
case FT_EqualNodes:
{
EqualNodes_i* aPred = dynamic_cast<EqualNodes_i*>( thePred );
CORBA::ULong i = theCriteria->length();
theCriteria->length( i + 1 );
theCriteria[ i ] = createCriterion();
theCriteria[ i ].Type = FT_EqualNodes;
theCriteria[ i ].Tolerance = aPred->GetTolerance();
return true; return true;
} }
case FT_RangeOfIds: case FT_RangeOfIds:
@ -2602,76 +2725,6 @@ static inline bool getCriteria( Predicate_i* thePred,
theCriteria[ i ].ThresholdStr = aPred->GetRangeStr(); theCriteria[ i ].ThresholdStr = aPred->GetRangeStr();
theCriteria[ i ].TypeOfElement = aPred->GetElementType(); theCriteria[ i ].TypeOfElement = aPred->GetElementType();
return true;
}
case FT_BadOrientedVolume:
{
BadOrientedVolume_i* aPred = dynamic_cast<BadOrientedVolume_i*>( 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:
{
BareBorderVolume_i* aPred = dynamic_cast<BareBorderVolume_i*>( 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<BareBorderFace_i*>( 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<OverConstrainedVolume_i*>( thePred );
CORBA::ULong i = theCriteria->length();
theCriteria->length( i + 1 );
theCriteria[ i ] = createCriterion();
theCriteria[ i ].Type = FT_OverConstrainedVolume;
theCriteria[ i ].TypeOfElement = aPred->GetElementType();
return true;
}
case FT_OverConstrainedFace:
{
OverConstrainedFace_i* aPred = dynamic_cast<OverConstrainedFace_i*>( thePred );
CORBA::ULong i = theCriteria->length();
theCriteria->length( i + 1 );
theCriteria[ i ] = createCriterion();
theCriteria[ i ].Type = FT_OverConstrainedFace;
theCriteria[ i ].TypeOfElement = aPred->GetElementType();
return true; return true;
} }
case FT_LessThan: case FT_LessThan:
@ -2873,6 +2926,22 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
case SMESH::FT_FreeNodes: case SMESH::FT_FreeNodes:
aPredicate = aFilterMgr->CreateFreeNodes(); aPredicate = aFilterMgr->CreateFreeNodes();
break; 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: case SMESH::FT_BelongToGeom:
{ {
SMESH::BelongToGeom_ptr tmpPred = aFilterMgr->CreateBelongToGeom(); 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_FreeEdges : return "Free edges";
case FT_FreeFaces : return "Free faces"; case FT_FreeFaces : return "Free faces";
case FT_FreeNodes : return "Free nodes"; 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_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_Length : return "Length";
case FT_Length2D : return "Length 2D"; case FT_Length2D : return "Length 2D";
case FT_LessThan : return "Less than"; 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 edges" ) ) return FT_FreeEdges;
else if ( theStr.equals( "Free faces" ) ) return FT_FreeFaces; else if ( theStr.equals( "Free faces" ) ) return FT_FreeFaces;
else if ( theStr.equals( "Free nodes" ) ) return FT_FreeNodes; 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" ) ) return FT_MultiConnection;
// else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D; // else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D;
else if ( theStr.equals( "Length" ) ) return FT_Length; else if ( theStr.equals( "Length" ) ) return FT_Length;
@ -3779,13 +3856,13 @@ string_array* FilterLibrary_i::GetAllNames()
static const char** getFunctNames() static const char** getFunctNames()
{ {
static const char* functName[ SMESH::FT_Undefined + 1 ] = { 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 according to enum FunctorType (SMESH_Filter.idl)
// it's necessary to update this array accordingly (refer to SMESH_Filter.idl)
// The order is IMPORTANT !!! // The order is IMPORTANT !!!
"FT_AspectRatio", "FT_AspectRatio3D", "FT_Warping", "FT_MinimumAngle", "FT_AspectRatio", "FT_AspectRatio3D", "FT_Warping", "FT_MinimumAngle",
"FT_Taper", "FT_Skew", "FT_Area", "FT_Volume3D", "FT_MaxElementLength2D", "FT_Taper", "FT_Skew", "FT_Area", "FT_Volume3D", "FT_MaxElementLength2D",
"FT_MaxElementLength3D", "FT_FreeBorders", "FT_FreeEdges", "FT_FreeNodes", "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_Length2D", "FT_BelongToGeom", "FT_BelongToPlane", "FT_BelongToCylinder",
"FT_BelongToGenSurface", "FT_LyingOnGeom", "FT_RangeOfIds", "FT_BadOrientedVolume", "FT_BelongToGenSurface", "FT_LyingOnGeom", "FT_RangeOfIds", "FT_BadOrientedVolume",
"FT_BareBorderVolume", "FT_BareBorderFace", "FT_OverConstrainedVolume", "FT_BareBorderVolume", "FT_BareBorderFace", "FT_OverConstrainedVolume",

View File

@ -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 Class : RangeOfIds_i
Description : Predicate for Range of Ids Description : Predicate for Range of Ids
@ -1017,6 +1068,11 @@ namespace SMESH
FreeNodes_ptr CreateFreeNodes(); FreeNodes_ptr CreateFreeNodes();
FreeFaces_ptr CreateFreeFaces(); FreeFaces_ptr CreateFreeFaces();
EqualNodes_ptr CreateEqualNodes();
EqualEdges_ptr CreateEqualEdges();
EqualFaces_ptr CreateEqualFaces();
EqualVolumes_ptr CreateEqualVolumes();
RangeOfIds_ptr CreateRangeOfIds(); RangeOfIds_ptr CreateRangeOfIds();
BadOrientedVolume_ptr CreateBadOrientedVolume(); BadOrientedVolume_ptr CreateBadOrientedVolume();
BareBorderFace_ptr CreateBareBorderFace(); BareBorderFace_ptr CreateBareBorderFace();