-// SMESHGUI_PredicateFilter : Filters for VTK viewer
+// SMESHGUI_Filter : Filters for VTK viewer
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// File : SMESHGUI_Filter.cxx
+// Author : Sergey LITONIN, Open CASCADE S.A.S.
//
-//
-// File : SMESHGUI_Filter.cxx
-// Author : Sergey LITONIN
-// Module : SMESH
+// SMESH includes
#include "SMESHGUI_Filter.h"
-#include "SMESHGUI_Utils.h"
-#include "SMDS_Mesh.hxx"
-#include "SMDS_MeshElement.hxx"
-#include "SMDSAbs_ElementType.hxx"
-#include <vtkCell.h>
+#include "SMESHGUI_Utils.h"
-#include <gp_Vec.hxx>
-#include <Precision.hxx>
-#include "SMESH_Actor.h"
-#include "SMESHGUI.h"
+#include <SMESH_Actor.h>
+#include <SMDS_Mesh.hxx>
+#include <SMDSAbs_ElementType.hxx>
IMPLEMENT_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter)
IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_Filter, VTKViewer_Filter)
if ( myActor == 0 || myPred->_is_nil() )
return false;
- SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
- if ( anActor->GetObject() == 0 )
+ SMESH_Actor* anActor = dynamic_cast<SMESH_Actor*>( myActor );
+ if ( !anActor || anActor->GetObject() == 0 )
return false;
-
+
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
SMESH::ElementType anElemType = myPred->GetElementType();
int aMeshId = anElemType == SMESH::NODE ? anActor->GetNodeObjId( theCellId )
: aMesh->FindElement( aMeshId );
if ( anElem != 0 && anElem->GetType() != (SMDSAbs_ElementType)myPred->GetElementType() )
return true;
-
+
return myPred->IsSatisfy( aMeshId );
}
SMESH_Actor* anActor = ( SMESH_Actor* )myActor;
if ( anActor->GetObject() == 0 )
return false;
-
+
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
SMESH::ElementType anElemType = 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 == SMESH::NODE ? aMesh->FindNode( theObjId )
//=======================================================================
bool SMESHGUI_PredicateFilter::IsNodeFilter() const
{
- return GetId() == SMESHGUI_NodeFilter;
+ return GetId() == SMESH::NodeFilter;
}
//=======================================================================
if ( myActor != 0 && !myPred->_is_nil() )
{
- Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+ 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);
//=======================================================================
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;
+ 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;
}
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;
+
+ return anElem && anElem->GetType() == SMDSAbs_Face &&
+ ( anElem->NbNodes() == ( anElem->IsQuadratic() ? 8 : 4 ));
}
//=======================================================================
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;
+ return anElem && anElem->GetType() == SMDSAbs_Face &&
+ ( anElem->NbNodes() == ( anElem->IsQuadratic() ? 8 : 4 ));
}
//=======================================================================
//=======================================================================
int SMESHGUI_QuadrangleFilter::GetId() const
{
- return SMESHGUI_QuadFilter;
+ return SMESH::QuadFilter;
}
//=======================================================================
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;
+ return anElem && anElem->GetType() == SMDSAbs_Face &&
+ ( anElem->NbNodes() == ( anElem->IsQuadratic() ? 6 : 3 ));
}
//=======================================================================
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;
+ return anElem && anElem->GetType() == SMDSAbs_Face &&
+ ( anElem->NbNodes() == ( anElem->IsQuadratic() ? 6 : 3 ));
}
//=======================================================================
//=======================================================================
int SMESHGUI_TriangleFilter::GetId() const
{
- return SMESHGUI_TriaFilter;
+ return SMESH::TriaFilter;
}
//=======================================================================
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 ) );
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 );
//=======================================================================
int SMESHGUI_FacesFilter::GetId() const
{
- return SMESHGUI_FaceFilter;
+ return SMESH::FaceFilter;
}
//=======================================================================
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 ) );
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 );
//=======================================================================
int SMESHGUI_VolumesFilter::GetId() const
{
- return SMESHGUI_VolumeFilter;
+ return SMESH::VolumeFilter;
}
//=======================================================================
{
return false;
}
-
-
-
-
-
-
-
-
-
-
-