#include <SMESHGUI_Filter.h>

Public Member Functions | |
| Standard_EXPORT | SMESHGUI_PredicateFilter () |
| virtual Standard_EXPORT | ~SMESHGUI_PredicateFilter () |
| virtual Standard_EXPORT bool | IsValid (const int) const |
| virtual Standard_EXPORT bool | IsObjValid (const int) const |
| virtual Standard_EXPORT int | GetId () const |
| virtual Standard_EXPORT bool | IsNodeFilter () const |
| Standard_EXPORT void | SetPredicate (SMESH::Predicate_ptr) |
| Standard_EXPORT void | SetActor (SALOME_Actor *) |
Private Attributes | |
| SMESH::Predicate_var | myPred |
Definition at line 81 of file SMESHGUI_Filter.h.
| SMESHGUI_PredicateFilter::SMESHGUI_PredicateFilter | ( | ) |
Definition at line 64 of file SMESHGUI_Filter.cxx.
{
}
| SMESHGUI_PredicateFilter::~SMESHGUI_PredicateFilter | ( | ) | [virtual] |
Definition at line 68 of file SMESHGUI_Filter.cxx.
{
}
| int SMESHGUI_PredicateFilter::GetId | ( | ) | const [virtual] |
Definition at line 176 of file SMESHGUI_Filter.cxx.
References SMESH.ALL, SMESH.AllElementsFilter, EDGE, SMESH.EdgeFilter, FACE, SMESH.FaceFilter, myPred, SMESH.NODE, SMESH.NodeFilter, SMESH.UnknownFilter, VOLUME, and SMESH.VolumeFilter.
Referenced by IsNodeFilter().
{
if ( myPred->GetElementType() == SMESH::NODE ) return SMESH::NodeFilter;
else if ( myPred->GetElementType() == SMESH::EDGE ) return SMESH::EdgeFilter;
else if ( myPred->GetElementType() == SMESH::FACE ) return SMESH::FaceFilter;
else if ( myPred->GetElementType() == SMESH::VOLUME ) return SMESH::VolumeFilter;
else if ( myPred->GetElementType() == SMESH::ALL ) return SMESH::AllElementsFilter;
else return SMESH::UnknownFilter;
}
| bool SMESHGUI_PredicateFilter::IsNodeFilter | ( | ) | const [virtual] |
Definition at line 132 of file SMESHGUI_Filter.cxx.
References GetId(), and SMESH.NodeFilter.
{
return GetId() == SMESH::NodeFilter;
}
Implements SMESHGUI_Filter.
Definition at line 105 of file SMESHGUI_Filter.cxx.
References SMESH_BelongToGeom.anElemType, SMDS_Mesh.FindElement(), SMDS_Mesh.FindNode(), SMESH_Actor.GetObject(), SMDS_MeshElement.GetType(), myPred, SMDSAbs_All, and SMDSAbs_Node.
{
if ( myActor == 0 || myPred->_is_nil() )
return false;
SMESH_Actor* anActor = dynamic_cast< SMESH_Actor* >( myActor );
if ( !anActor || anActor->GetObject() == 0 )
return false;
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
SMDSAbs_ElementType anElemType = (SMDSAbs_ElementType)myPred->GetElementType();
// if type of element != type of predicate return true because
// this predicate is not intended for filtering sush elements
const SMDS_MeshElement* anElem = anElemType == SMDSAbs_Node ? aMesh->FindNode( theObjId )
: aMesh->FindElement( theObjId );
// here we guess that predicate element type can not be All in case of node selection
if ( !anElem || (anElemType != SMDSAbs_All && anElem->GetType() != anElemType) )
return false;
return myPred->IsSatisfy( theObjId );
}
Definition at line 76 of file SMESHGUI_Filter.cxx.
References SMESH_BelongToGeom.anElemType, SMDS_Mesh.FindElement(), SMDS_Mesh.FindNode(), SMESH_Actor.GetObject(), SMDS_MeshElement.GetType(), myPred, SMDSAbs_All, and SMDSAbs_Node.
{
if ( myActor == 0 || myPred->_is_nil() )
return false;
SMESH_Actor* anActor = dynamic_cast<SMESH_Actor*>( myActor );
if ( !anActor || anActor->GetObject() == 0 )
return false;
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
SMDSAbs_ElementType anElemType = (SMDSAbs_ElementType)myPred->GetElementType();
int aMeshId = anElemType == SMDSAbs_Node ? anActor->GetNodeObjId( theCellId )
: anActor->GetElemObjId( theCellId );
// if type of element != type of predicate return true because
// this predicate is not intended for filtering sush elements
const SMDS_MeshElement* anElem = anElemType == SMDSAbs_Node ? aMesh->FindNode( aMeshId )
: aMesh->FindElement( aMeshId );
// here we guess that predicate element type can not be All in case of node selection
if ( !anElem || (anElemType != SMDSAbs_All && anElem->GetType() != anElemType) )
return false;
return myPred->IsSatisfy( aMeshId );
}
| void SMESHGUI_PredicateFilter::SetActor | ( | SALOME_Actor * | theActor | ) |
Definition at line 150 of file SMESHGUI_Filter.cxx.
References Handle(), and myPred.
{
if ( myActor == theActor )
return;
SMESHGUI_Filter::SetActor( theActor );
if ( myActor != 0 && !myPred->_is_nil() )
{
SALOME_Actor* sActor = dynamic_cast<SALOME_Actor*>( myActor );
Handle(SALOME_InteractiveObject) anIO;
if( sActor )
anIO = sActor->getIO();
if ( !anIO.IsNull() )
{
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
if(!aMesh->_is_nil())
myPred->SetMesh(aMesh);
}
}
}
| void SMESHGUI_PredicateFilter::SetPredicate | ( | SMESH::Predicate_ptr | thePred | ) |
Definition at line 141 of file SMESHGUI_Filter.cxx.
References myPred.
{
myPred = SMESH::Predicate::_duplicate( thePred );
}
SMESH::Predicate_var SMESHGUI_PredicateFilter.myPred [private] |
Definition at line 96 of file SMESHGUI_Filter.h.
Referenced by GetId(), IsObjValid(), IsValid(), SetActor(), and SetPredicate().