Back to index

salome-smesh  6.5.0
Public Member Functions | Private Attributes
SMESHGUI_PredicateFilter Class Reference

#include <SMESHGUI_Filter.h>

Inheritance diagram for SMESHGUI_PredicateFilter:
Inheritance graph
[legend]
Collaboration diagram for SMESHGUI_PredicateFilter:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

Definition at line 81 of file SMESHGUI_Filter.h.


Constructor & Destructor Documentation

Definition at line 64 of file SMESHGUI_Filter.cxx.

{
}

Definition at line 68 of file SMESHGUI_Filter.cxx.

{
}

Member Function Documentation

int SMESHGUI_PredicateFilter::GetId ( ) const [virtual]

Definition at line 176 of file SMESHGUI_Filter.cxx.

{
  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;
}

Here is the caller graph for this function:

bool SMESHGUI_PredicateFilter::IsNodeFilter ( ) const [virtual]

Definition at line 132 of file SMESHGUI_Filter.cxx.

{
  return GetId() == SMESH::NodeFilter;
}

Here is the call graph for this function:

bool SMESHGUI_PredicateFilter::IsObjValid ( const int  theObjId) const [virtual]

Implements SMESHGUI_Filter.

Definition at line 105 of file SMESHGUI_Filter.cxx.

{
  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 );
}
bool SMESHGUI_PredicateFilter::IsValid ( const int  theCellId) const [virtual]

Definition at line 76 of file SMESHGUI_Filter.cxx.

{
  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.

{
  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);
    }
  }
}

Here is the call graph for this function:

void SMESHGUI_PredicateFilter::SetPredicate ( SMESH::Predicate_ptr  thePred)

Definition at line 141 of file SMESHGUI_Filter.cxx.

{
  myPred = SMESH::Predicate::_duplicate( thePred );
}

Member Data Documentation

SMESH::Predicate_var SMESHGUI_PredicateFilter::myPred [private]

Definition at line 96 of file SMESHGUI_Filter.h.


The documentation for this class was generated from the following files: