Salome HOME
Update copyright information
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Filter.cxx
index 19b3fcb1ab62d0a354d550b888be0701a19603a0..a022365c898804b353febf70580269a8609e1529 100755 (executable)
@@ -1,6 +1,6 @@
-//  SMESHGUI_PredicateFilter : Filters for VTK viewer
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  Copyright (C) 2003-2007  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
 //  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
 //
+// SMESHGUI_Filter : Filters for VTK viewer
+// File   : SMESHGUI_Filter.cxx
+// Author : Sergey LITONIN, Open CASCADE S.A.S.
+// SMESH includes
 //
-//
-//  File   : SMESHGUI_Filter.cxx
-//  Author : Sergey LITONIN
-//  Module : SMESH
-
 #include "SMESHGUI_Filter.h"
 
-#include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
 
-#include "SMESH_Actor.h"
-#include "SMDS_Mesh.hxx"
-#include "SMDS_MeshElement.hxx"
-#include "SMDSAbs_ElementType.hxx"
-
-// OCCT Includes
-#include <gp_Vec.hxx>
-#include <Precision.hxx>
-
-// VTK Includes
-#include <vtkCell.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)
@@ -138,7 +128,7 @@ bool SMESHGUI_PredicateFilter::IsObjValid( const int theObjId ) const
 //=======================================================================
 bool SMESHGUI_PredicateFilter::IsNodeFilter() const
 {
-  return GetId() == SMESHGUI_NodeFilter;
+  return GetId() == SMESH::NodeFilter;
 }
 
 //=======================================================================
@@ -182,12 +172,12 @@ void SMESHGUI_PredicateFilter::SetActor( SALOME_Actor* theActor )
 //=======================================================================
 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;
 }
 
 
@@ -225,7 +215,8 @@ bool SMESHGUI_QuadrangleFilter::IsValid( const int theCellId ) const
   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 ));
 }
 
 //=======================================================================
@@ -244,7 +235,8 @@ bool SMESHGUI_QuadrangleFilter::IsObjValid( const int theObjId ) const
   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 ));
 }
 
 //=======================================================================
@@ -254,7 +246,7 @@ bool SMESHGUI_QuadrangleFilter::IsObjValid( const int theObjId ) const
 //=======================================================================
 int SMESHGUI_QuadrangleFilter::GetId() const
 {
-  return SMESHGUI_QuadFilter;
+  return SMESH::QuadFilter;
 }
 
 //=======================================================================
@@ -302,7 +294,8 @@ bool SMESHGUI_TriangleFilter::IsValid( const int theCellId ) const
   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 ));
 }
 
 //=======================================================================
@@ -321,7 +314,8 @@ bool SMESHGUI_TriangleFilter::IsObjValid( const int theObjId ) const
   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 ));
 }
 
 //=======================================================================
@@ -331,7 +325,7 @@ bool SMESHGUI_TriangleFilter::IsObjValid( const int theObjId ) const
 //=======================================================================
 int SMESHGUI_TriangleFilter::GetId() const
 {
-  return SMESHGUI_TriaFilter;
+  return SMESH::TriaFilter;
 }
 
 //=======================================================================
@@ -407,7 +401,7 @@ bool SMESHGUI_FacesFilter::IsObjValid( const int theObjId ) const
 //=======================================================================
 int SMESHGUI_FacesFilter::GetId() const
 {
-  return SMESHGUI_FaceFilter;
+  return SMESH::FaceFilter;
 }
 
 //=======================================================================
@@ -484,7 +478,7 @@ bool SMESHGUI_VolumesFilter::IsObjValid( const int theObjId ) const
 //=======================================================================
 int SMESHGUI_VolumesFilter::GetId() const
 {
-  return SMESHGUI_VolumeFilter;
+  return SMESH::VolumeFilter;
 }
 
 //=======================================================================