+
+//=======================================================================
+// name : SMESHGUI_PredicateFilter::SetActor
+// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType
+// enumeration. All filters must have different ids
+//=======================================================================
+int SMESHGUI_PredicateFilter::GetId() const
+{
+ if ( myPred->GetElementType() == SMESH::NODE ) return SMESHGUI_NodeFilter;
+ else if ( myPred->GetElementType() == SMESH::EDGE ) return SMESHGUI_EdgeFilter;
+ else if ( myPred->GetElementType() == SMESH::FACE ) return SMESHGUI_FaceFilter;
+ else if ( myPred->GetElementType() == SMESH::VOLUME ) return SMESHGUI_VolumeFilter;
+ else if ( myPred->GetElementType() == SMESH::ALL ) return SMESHGUI_AllElementsFilter;
+ else return SMESHGUI_UnknownFilter;
+}
+
+
+/*
+ Class : SMESHGUI_QuadrangleFilter
+ Description : Verify whether selected cell is quadranle
+*/
+
+//=======================================================================
+// name : SMESHGUI_QuadrangleFilter::SMESHGUI_QuadrangleFilter
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_QuadrangleFilter::SMESHGUI_QuadrangleFilter()
+: SMESHGUI_Filter()
+{
+}
+
+SMESHGUI_QuadrangleFilter::~SMESHGUI_QuadrangleFilter()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_QuadrangleFilter::IsValid
+// Purpose : Verify whether selected cell is quadranle
+//=======================================================================
+bool SMESHGUI_QuadrangleFilter::IsValid( const int theCellId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
+
+ return anElem && anElem->GetType() == SMDSAbs_Face && anElem->NbNodes() == 4;
+}
+
+//=======================================================================
+// name : SMESHGUI_QuadrangleFilter::IsValid
+// Purpose : Verify whether selected cell is quadranle
+//=======================================================================
+bool SMESHGUI_QuadrangleFilter::IsObjValid( const int theObjId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
+
+ return anElem && anElem->GetType() == SMDSAbs_Face && anElem->NbNodes() == 4;
+}
+
+//=======================================================================
+// name : SMESHGUI_QuadrangleFilter::SetActor
+// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType
+// enumeration. All filters must have different ids
+//=======================================================================
+int SMESHGUI_QuadrangleFilter::GetId() const
+{
+ return SMESHGUI_QuadFilter;
+}
+
+//=======================================================================
+// name : SMESHGUI_QuadrangleFilter::IsNodeFilter
+// Purpose : Returns true if filter is intended for nodes
+//=======================================================================
+bool SMESHGUI_QuadrangleFilter::IsNodeFilter() const
+{
+ return false;
+}
+
+
+/*
+ Class : SMESHGUI_TriangleFilter
+ Description : Verify whether selected cell is triangle
+*/
+
+
+//=======================================================================
+// name : SMESHGUI_TriangleFilter::SMESHGUI_TriangleFilter
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_TriangleFilter::SMESHGUI_TriangleFilter()
+: SMESHGUI_Filter()
+{
+}
+
+SMESHGUI_TriangleFilter::~SMESHGUI_TriangleFilter()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_TriangleFilter::IsValid
+// Purpose : Verify whether selected cell is triangle
+//=======================================================================
+bool SMESHGUI_TriangleFilter::IsValid( const int theCellId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
+
+ return anElem && anElem->GetType() == SMDSAbs_Face && anElem->NbNodes() == 3;
+}
+
+//=======================================================================
+// name : SMESHGUI_TriangleFilter::IsValid
+// Purpose : Verify whether selected cell is triangle
+//=======================================================================
+bool SMESHGUI_TriangleFilter::IsObjValid( const int theObjId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
+
+ return anElem && anElem->GetType() == SMDSAbs_Face && anElem->NbNodes() == 3;
+}
+
+//=======================================================================
+// name : SMESHGUI_TriangleFilter::SetActor
+// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType
+// enumeration. All filters must have different ids
+//=======================================================================
+int SMESHGUI_TriangleFilter::GetId() const
+{
+ return SMESHGUI_TriaFilter;
+}
+
+//=======================================================================
+// name : SMESHGUI_TriangleFilter::IsNodeFilter
+// Purpose : Returns true if filter is intended for nodes
+//=======================================================================
+bool SMESHGUI_TriangleFilter::IsNodeFilter() const
+{
+ return false;
+}
+
+/*
+ Class : SMESHGUI_FacesFilter
+ Description : Verify whether selected cell is any face
+*/
+
+
+//=======================================================================
+// name : SMESHGUI_FacesFilter::SMESHGUI_FacesFilter
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_FacesFilter::SMESHGUI_FacesFilter()
+: SMESHGUI_Filter()
+{
+}
+
+SMESHGUI_FacesFilter::~SMESHGUI_FacesFilter()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_FacesFilter::IsValid
+// Purpose : Verify whether selected cell is face
+//=======================================================================
+bool SMESHGUI_FacesFilter::IsValid( const int theCellId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
+
+ return anElem && anElem->GetType() == SMDSAbs_Face;
+}
+
+//=======================================================================
+// name : SMESHGUI_FacesFilter::IsValid
+// Purpose : Verify whether selected cell is face
+//=======================================================================
+bool SMESHGUI_FacesFilter::IsObjValid( const int theObjId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
+
+ return anElem && anElem->GetType() == SMDSAbs_Face;
+}
+
+//=======================================================================
+// name : SMESHGUI_FacesFilter::GetId
+// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType
+// enumeration. All filters must have different ids
+//=======================================================================
+int SMESHGUI_FacesFilter::GetId() const
+{
+ return SMESHGUI_FaceFilter;
+}
+
+//=======================================================================
+// name : SMESHGUI_FacesFilter::IsNodeFilter
+// Purpose : Returns true if filter is intended for nodes
+//=======================================================================
+bool SMESHGUI_FacesFilter::IsNodeFilter() const
+{
+ return false;
+}
+
+
+/*
+ Class : SMESHGUI_VolumesFilter
+ Description : Verify whether selected cell is any volume
+*/
+
+
+//=======================================================================
+// name : SMESHGUI_VolumesFilter::SMESHGUI_VolumesFilter
+// Purpose : Constructor
+//=======================================================================
+SMESHGUI_VolumesFilter::SMESHGUI_VolumesFilter()
+: SMESHGUI_Filter()
+{
+}
+
+SMESHGUI_VolumesFilter::~SMESHGUI_VolumesFilter()
+{
+}
+
+//=======================================================================
+// name : SMESHGUI_VolumesFilter::IsValid
+// Purpose : Verify whether selected cell is volume
+//=======================================================================
+bool SMESHGUI_VolumesFilter::IsValid( const int theCellId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( anActor->GetElemObjId( theCellId ) );
+
+ return anElem && anElem->GetType() == SMDSAbs_Volume;
+}
+
+//=======================================================================
+// name : SMESHGUI_VolumesFilter::IsValid
+// Purpose : Verify whether selected cell is volume
+//=======================================================================
+bool SMESHGUI_VolumesFilter::IsObjValid( const int theObjId ) const
+{
+ if ( myActor == 0 )
+ return false;
+
+ SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
+ if ( anActor->GetObject() == 0 )
+ return false;
+
+ SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
+ const SMDS_MeshElement* anElem = aMesh->FindElement( theObjId );
+
+ return anElem && anElem->GetType() == SMDSAbs_Volume;
+}
+
+//=======================================================================
+// name : SMESHGUI_VolumesFilter::GetId
+// Purpose : Get ID of the filter. Must return value from SMESHGUI_FilterType
+// enumeration. All filters must have different ids
+//=======================================================================
+int SMESHGUI_VolumesFilter::GetId() const
+{
+ return SMESHGUI_VolumeFilter;
+}
+
+//=======================================================================
+// name : SMESHGUI_VolumesFilter::IsNodeFilter
+// Purpose : Returns true if filter is intended for nodes
+//=======================================================================
+bool SMESHGUI_VolumesFilter::IsNodeFilter() const
+{
+ return false;
+}