Salome HOME
Update copyright information
[modules/smesh.git] / src / OBJECT / SMESH_Actor.cxx
index 06a9d822bbd6ba4db0e0086c89de157eaeebff6d..7be22f7c59c4aff4c83d2e4403bd9800ac5ad1e1 100644 (file)
@@ -1,43 +1,40 @@
-//  SMESH OBJECT : interactive object for SMESH visualization
+//  Copyright (C) 2007-2008  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
+//
+//  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.
 //
-//  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 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 
-// 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  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
 //
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SMESH OBJECT : interactive object for SMESH visualization
 //  File   : SMESH_Actor.cxx
 //  Author : Nicolas REJNERI
 //  Module : SMESH
 //  $Header$
-
-
+//
 #include "SMESH_ActorDef.h"
 #include "SMESH_ActorUtils.h"
 #include "SMESH_DeviceActor.h"
 #include "SMESH_ControlsDef.hxx"
 #include "VTKViewer_ExtractUnstructuredGrid.h"
+#include "SALOME_InteractiveObject.hxx"
 
 #include "SUIT_Session.h"
 #include "SUIT_ResourceMgr.h"
 
-#include <qstringlist.h>
-
 #include <vtkProperty.h>
 #include <vtkTimeStamp.h>
 #include <vtkObjectFactory.h>
@@ -117,10 +114,13 @@ SMESH_ActorDef::SMESH_ActorDef()
   myIsShrinkable = false;
   myIsShrunk = false;
 
+  myIsFacesOriented = false;
+
   myControlsPrecision = -1;
   SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+  
   if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
-    myControlsPrecision = (long)SMESH::GetFloat( "SMESH", "controls_precision", -1 );
+    myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
 
   vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
   vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
@@ -168,6 +168,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   aFilter->RegisterCellsWithType(VTK_PYRAMID);
   aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
   aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
+  aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
   aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
 
   //Definition 1D divice of the actor
@@ -288,7 +289,8 @@ SMESH_ActorDef::SMESH_ActorDef()
 
   //Fix for Bug 13314:
   //Incorrect "Min value" in Scalar Bar in Mesh:
-  myScalarBarActor->SetLabelFormat("%.4g");
+  //  myScalarBarActor->SetLabelFormat("%.4g");
+  // changes was commented because of regression bug IPAL 19981
 
   mgr = SUIT_Session::session()->resourceMgr();
   if( !mgr )
@@ -511,6 +513,22 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
 }
 
 
+void SMESH_ActorDef::SetFacesOriented(bool theIsFacesOriented)
+{
+  myIsFacesOriented = theIsFacesOriented;
+
+  my2DActor->SetFacesOriented(theIsFacesOriented);
+  my3DActor->SetFacesOriented(theIsFacesOriented);
+
+  myTimeStamp->Modified();
+}
+
+bool SMESH_ActorDef::GetFacesOriented()
+{
+  return myIsFacesOriented;
+}
+
+
 void 
 SMESH_ActorDef::
 SetControlMode(eControl theMode)
@@ -692,8 +710,8 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
   theRenderer->AddActor(myNodeActor);
   theRenderer->AddActor(myBaseActor);
 
-  theRenderer->AddActor(my3DActor);
-  theRenderer->AddActor(my2DActor);
+  my3DActor->AddToRender(theRenderer);
+  my2DActor->AddToRender(theRenderer);
 
   theRenderer->AddActor(my1DActor);
   theRenderer->AddActor(my1DExtActor);
@@ -720,8 +738,8 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
   theRenderer->RemoveActor(my1DActor);
   theRenderer->RemoveActor(my1DExtActor);
 
-  theRenderer->RemoveActor(my2DActor);
-  theRenderer->RemoveActor(my3DActor);
+  my2DActor->RemoveFromRender(theRenderer);
+  my3DActor->RemoveFromRender(theRenderer);
 
   theRenderer->RemoveActor(myScalarBarActor);
   theRenderer->RemoveActor(myPointLabels);
@@ -769,7 +787,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
   //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
   SetIsShrunkable(true);
 
-  SetShrinkFactor( SMESH::GetFloat( "SMESH:shrink_coeff", 0.75 ) );
+  SetShrinkFactor( SMESH::GetFloat( "SMESH:shrink_coeff", 75 ) / 100. );
 
   int aMode = mgr->integerValue( "SMESH", "display_mode" );
   SetRepresentation(-1);
@@ -1054,6 +1072,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
     aFilter->RegisterCellsWithType(VTK_PYRAMID);
     aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
     aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
+    aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
     aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
   }
   aFilter->Update();
@@ -1264,6 +1283,9 @@ void SMESH_ActorDef::Update(){
   if(myIsCellsLabeled){
     SetCellsLabeled(myIsCellsLabeled);
   }
+  if(myIsFacesOriented){
+    SetFacesOriented(myIsFacesOriented);
+  }
   SetEntityMode(GetEntityMode());
   SetVisibility(GetVisibility());