}
//=======================================================================
-//function : IsGlobalPredicate::IsOk
+//function : IsAssignedToPredicate::IsOk
//purpose :
//=======================================================================
-bool SMESH_HypoFilter::IsGlobalPredicate::IsOk(const SMESH_Hypothesis* aHyp,
+bool SMESH_HypoFilter::IsAssignedToPredicate::IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& aShape) const
{
return ( !_mainShape.IsNull() && !aShape.IsNull() && _mainShape.IsSame( aShape ));
//purpose :
//=======================================================================
-void SMESH_HypoFilter::And( SMESH_HypoPredicate* aPredicate )
+SMESH_HypoFilter & SMESH_HypoFilter::And( SMESH_HypoPredicate* aPredicate )
{
add( AND, aPredicate );
+ return *this;
}
//=======================================================================
//purpose :
//=======================================================================
-void SMESH_HypoFilter::AndNot( SMESH_HypoPredicate* aPredicate )
+SMESH_HypoFilter & SMESH_HypoFilter::AndNot( SMESH_HypoPredicate* aPredicate )
{
add( AND_NOT, aPredicate );
+ return *this;
}
//=======================================================================
//purpose :
//=======================================================================
-void SMESH_HypoFilter::Or( SMESH_HypoPredicate* aPredicate )
+SMESH_HypoFilter & SMESH_HypoFilter::Or( SMESH_HypoPredicate* aPredicate )
{
add( OR, aPredicate );
+ return *this;
}
//=======================================================================
//purpose : Return predicates
//=======================================================================
-void SMESH_HypoFilter::OrNot( SMESH_HypoPredicate* aPredicate )
+SMESH_HypoFilter & SMESH_HypoFilter::OrNot( SMESH_HypoPredicate* aPredicate )
{
add( OR_NOT, aPredicate );
+ return *this;
}
//=======================================================================
SMESH_HypoPredicate* SMESH_HypoFilter::IsGlobal(const TopoDS_Shape& theMainShape)
{
- return new IsGlobalPredicate( theMainShape );
+ return new IsAssignedToPredicate( theMainShape );
+}
+
+//=======================================================================
+//function : IsAssignedTo
+//purpose :
+//=======================================================================
+
+ SMESH_HypoPredicate* SMESH_HypoFilter::IsAssignedTo(const TopoDS_Shape& theShape)
+{
+ return new IsAssignedToPredicate( theShape );
}
//=======================================================================
//purpose :
//=======================================================================
-void SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNagate )
+SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNagate )
{
list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
for ( ; pred != myPredicates.end(); ++pred )
delete *pred;
add( notNagate ? AND : AND_NOT, aPredicate );
+ return *this;
}
#include <list>
#include <string>
+#include <TopoDS_Shape.hxx>
class SMESH_HypoFilter;
class SMESH_Hypothesis;
-class TopoDS_Shape;
class SMESH_HypoPredicate {
public:
SMESH_HypoFilter();
SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNagate = true );
// notNagate==false means !aPredicate->IsOk()
- void Init ( SMESH_HypoPredicate* aPredicate, bool notNagate = true );
- void And ( SMESH_HypoPredicate* aPredicate );
- void AndNot( SMESH_HypoPredicate* aPredicate );
- void Or ( SMESH_HypoPredicate* aPredicate );
- void OrNot ( SMESH_HypoPredicate* aPredicate );
+ SMESH_HypoFilter & Init ( SMESH_HypoPredicate* aPredicate, bool notNagate = true );
+ SMESH_HypoFilter & And ( SMESH_HypoPredicate* aPredicate );
+ SMESH_HypoFilter & AndNot( SMESH_HypoPredicate* aPredicate );
+ SMESH_HypoFilter & Or ( SMESH_HypoPredicate* aPredicate );
+ SMESH_HypoFilter & OrNot ( SMESH_HypoPredicate* aPredicate );
// Create predicates
static SMESH_HypoPredicate* IsAlgo();
- static SMESH_HypoPredicate* IsApplicableTo(const TopoDS_Shape& theMainShape);
+ static SMESH_HypoPredicate* IsApplicableTo(const TopoDS_Shape& theShape);
+ static SMESH_HypoPredicate* IsAssignedTo(const TopoDS_Shape& theShape);
static SMESH_HypoPredicate* Is(const SMESH_Hypothesis* theHypo);
static SMESH_HypoPredicate* IsGlobal(const TopoDS_Shape& theMainShape);
static SMESH_HypoPredicate* HasName(const std::string & theName);
const TopoDS_Shape& aShape) const;
};
- struct IsGlobalPredicate : public SMESH_HypoPredicate {
- const TopoDS_Shape& _mainShape;
- IsGlobalPredicate( const TopoDS_Shape& mainShape ):_mainShape(mainShape){}
+ struct IsAssignedToPredicate : public SMESH_HypoPredicate {
+ TopoDS_Shape _mainShape;
+ IsAssignedToPredicate( const TopoDS_Shape& mainShape ):_mainShape(mainShape){}
bool IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& aShape) const;
};
//=============================================================================
const SMESH_Hypothesis* SMESH_Mesh::IsLocal1DHypothesis (const TopoDS_Shape& theEdge)
{
- SMESH_HypoFilter filter( SMESH_HypoFilter::HasDim( 1 ));
- filter.AndNot( SMESH_HypoFilter::IsAlgo() );
- filter.AndNot( SMESH_HypoFilter::IsGlobal( GetMeshDS()->ShapeToMesh() ));
+ SMESH_HypoFilter hypo ( SMESH_HypoFilter::HasDim( 1 ));
+ hypo.AndNot( hypo.IsAlgo() ).AndNot( hypo.IsAssignedTo( GetMeshDS()->ShapeToMesh() ));
- return GetHypothesis( theEdge, filter, true );
+ return GetHypothesis( theEdge, hypo, true );
}
//=============================================================================
SMDSAbs_ElementType SMESH_Mesh::GetElementType( const int id, const bool iselem )
{
return _myMeshDS->GetElementType( id, iselem );
-}
\ No newline at end of file
+}