]> SALOME platform Git repositories - modules/visu.git/blobdiff - src/OBJECT/VISU_MeshAct.cxx
Salome HOME
Update copyright information
[modules/visu.git] / src / OBJECT / VISU_MeshAct.cxx
index 40f6c9c1aea1c56fa3865a42f8366c2188619620..a39c49dd365484a5051e83c1d3c034b844913f11 100644 (file)
@@ -1,24 +1,25 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 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
-//  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  VISU OBJECT : interactive object for VISU entities implementation
 //  File   : VISU_MeshAct.cxx
 //  Author : 
@@ -53,19 +54,21 @@ VISU_MeshAct
   m = vtkMatrix4x4::New();
 
   mySurfaceActor = SVTK_DeviceActor::New();
-  mySurfaceActor->SetRepresentation(SVTK::Representation::Surface);
+  mySurfaceActor->SetRepresentation(VTKViewer::Representation::Surface);
   mySurfaceActor->SetUserMatrix(m);
+  mySurfaceActor->SetCoincident3DAllowed(true);
 
   myEdgeActor = SVTK_DeviceActor::New();
-  myEdgeActor->SetRepresentation(SVTK::Representation::Wireframe);
+  myEdgeActor->SetRepresentation(VTKViewer::Representation::Wireframe);
   myEdgeActor->SetUserMatrix(m);
+  myEdgeActor->SetCoincident3DAllowed(true);
 
   myNodeActor = SVTK_DeviceActor::New();
-  myNodeActor->SetRepresentation(SVTK::Representation::Points);
+  myNodeActor->SetRepresentation(VTKViewer::Representation::Points);
   myNodeActor->SetUserMatrix(m);
 
   m->Delete();
-  SetRepresentation(SVTK::Representation::Surface);
+  SetRepresentation(VTKViewer::Representation::Surface);
 
   SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
   //Quadratic 2D elements representation
@@ -248,19 +251,19 @@ VISU_MeshAct
 void
 VISU_MeshAct
 ::SetFeatureEdgesFlags(bool theIsFeatureEdges,
-                      bool theIsBoundaryEdges,
-                      bool theIsManifoldEdges,
-                      bool theIsNonManifoldEdges)
+                       bool theIsBoundaryEdges,
+                       bool theIsManifoldEdges,
+                       bool theIsNonManifoldEdges)
 {
   Superclass::SetFeatureEdgesFlags(theIsFeatureEdges,
-                                  theIsBoundaryEdges,
-                                  theIsManifoldEdges,
-                                  theIsNonManifoldEdges);
+                                   theIsBoundaryEdges,
+                                   theIsManifoldEdges,
+                                   theIsNonManifoldEdges);
 
   mySurfaceActor->SetFeatureEdgesFlags(theIsFeatureEdges,
-                                      theIsBoundaryEdges,
-                                      theIsManifoldEdges,
-                                      theIsNonManifoldEdges);
+                                       theIsBoundaryEdges,
+                                       theIsManifoldEdges,
+                                       theIsNonManifoldEdges);
 }
 
 void
@@ -292,10 +295,10 @@ VISU_MeshAct
 {
   Superclass::SetRepresentation(theMode);
 
-  if(theMode == SVTK::Representation::Insideframe)
-    myEdgeActor->SetRepresentation(SVTK::Representation::Insideframe);
+  if(theMode == VTKViewer::Representation::Insideframe)
+    myEdgeActor->SetRepresentation(VTKViewer::Representation::Insideframe);
   else
-    myEdgeActor->SetRepresentation(SVTK::Representation::Wireframe);
+    myEdgeActor->SetRepresentation(VTKViewer::Representation::Wireframe);
 }
 
 //----------------------------------------------------------------------------
@@ -338,7 +341,7 @@ VISU_MeshAct
   GetMatrix(myEdgeActor->GetUserMatrix());
   GetMatrix(mySurfaceActor->GetUserMatrix());
 
-  using namespace SVTK::Representation;
+  using namespace VTKViewer::Representation;
   switch(GetRepresentation()){
   case Points : 
     myNodeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
@@ -350,6 +353,7 @@ VISU_MeshAct
     myEdgeActor->RenderOpaqueGeometry(ren);
     break;
   case Surface : 
+  case FeatureEdges :
     mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
     mySurfaceActor->RenderOpaqueGeometry(ren);
     break;
@@ -360,23 +364,23 @@ VISU_MeshAct
     myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
     myEdgeActor->RenderOpaqueGeometry(ren);
     break;
-  case FeatureEdges :
-    mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
-    mySurfaceActor->RenderOpaqueGeometry(ren);
-    break;
   }
   return 1;
 }
 
 int
 VISU_MeshAct
+#if (VTK_XVERSION < 0x050100)
 ::RenderTranslucentGeometry(vtkViewport *ren)
+#else
+::RenderTranslucentPolygonalGeometry(vtkViewport *ren)
+#endif
 {
   GetMatrix(myNodeActor->GetUserMatrix());
   GetMatrix(myEdgeActor->GetUserMatrix());
   GetMatrix(mySurfaceActor->GetUserMatrix());
 
-  using namespace SVTK::Representation;
+  using namespace VTKViewer::Representation;
   switch(GetRepresentation()){
   case Points : 
     myNodeActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
@@ -396,6 +400,7 @@ VISU_MeshAct
 #endif
     break;
   case Surface : 
+  case FeatureEdges :
     mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
 #if (VTK_XVERSION < 0x050100)
     mySurfaceActor->RenderTranslucentGeometry(ren);
@@ -416,20 +421,44 @@ VISU_MeshAct
     myEdgeActor->RenderTranslucentGeometry(ren);
 #else
     myEdgeActor->RenderTranslucentPolygonalGeometry(ren);
-#endif
-    break;
-  case FeatureEdges :
-    mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
-#if (VTK_XVERSION < 0x050100)
-    mySurfaceActor->RenderTranslucentGeometry(ren);
-#else
-    mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
 #endif
     break;
   }
   return 1;
 }
 
+#if (VTK_XVERSION >= 0x050100)
+int
+VISU_MeshAct
+::HasTranslucentPolygonalGeometry()
+{
+  int result = 0; 
+
+  using namespace VTKViewer::Representation;
+  switch ( GetRepresentation() ) {
+  case Points:
+    result |= myNodeActor->HasTranslucentPolygonalGeometry();
+    break;
+  case Wireframe: 
+  case Insideframe: 
+    result |= myEdgeActor->HasTranslucentPolygonalGeometry();
+    break;
+  case Surface:
+  case FeatureEdges:
+    result |= mySurfaceActor->HasTranslucentPolygonalGeometry();
+    break;
+  case Surfaceframe:
+    result |= mySurfaceActor->HasTranslucentPolygonalGeometry();
+    result |= myEdgeActor->HasTranslucentPolygonalGeometry();
+    break;
+  default:
+    break;
+  }
+
+  return result;
+}
+#endif
+
 VISU_Actor::EQuadratic2DRepresentation 
 VISU_MeshAct::GetQuadratic2DRepresentation() const
 {
@@ -457,3 +486,15 @@ void VISU_MeshAct::SetQuadratic2DRepresentation( EQuadratic2DRepresentation theM
     break;
   }    
 }
+
+void VISU_MeshAct::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
+{
+  Superclass::SetMarkerStd( theMarkerType, theMarkerScale );
+  myNodeActor->SetMarkerStd( theMarkerType, theMarkerScale );
+}
+
+void VISU_MeshAct::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
+{
+  Superclass::SetMarkerTexture( theMarkerId, theMarkerTexture );
+  myNodeActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
+}