Salome HOME
Merge branch 'hydro/imps_2015'
[modules/gui.git] / src / VTKViewer / VTKViewer_Actor.cxx
index 624ed1deb6c8b95429868396a59d6dfd0d76059d..76df0121df2e987ffec40e361a369c628153d6f3 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015  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
@@ -6,7 +6,7 @@
 // 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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -180,30 +180,26 @@ VTKViewer_Actor
 {
   if(theMapper){
     int anId = 0;
-    myPassFilter[ anId ]->SetInput( theMapper->GetInput() );
-    myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
+    myPassFilter[ anId ]->SetInputData( theMapper->GetInput() );
+    myPassFilter[ anId + 1]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
     
     anId++; // 1
     myGeomFilter->SetStoreMapping( myStoreMapping );
-    myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
+    myGeomFilter->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
 
     anId++; // 2
-    myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() ); 
-    myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+    myPassFilter[ anId ]->SetInputConnection( myGeomFilter->GetOutputPort() ); 
+    myPassFilter[ anId + 1 ]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
 
     anId++; // 3
-    myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
+    myTransformFilter->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
 
     anId++; // 4
-    myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
-    myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+    myPassFilter[ anId ]->SetInputConnection( myTransformFilter->GetOutputPort() );
+    myPassFilter[ anId + 1 ]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
 
     anId++; // 5
-    if(vtkDataSetMapper* aMapper = dynamic_cast<vtkDataSetMapper*>(theMapper)){
-      aMapper->SetInput(myPassFilter[anId]->GetOutput());
-    }else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper)){
-      aMapper->SetInput(myPassFilter[anId]->GetPolyDataOutput());
-    }
+    theMapper->SetInputConnection(myPassFilter[anId]->GetOutputPort());
   }
   Superclass::SetMapper(theMapper);
 }
@@ -216,15 +212,15 @@ VTKViewer_Actor
 ::Render(vtkRenderer *ren, vtkMapper* m)
 {
   if(vtkDataSet* aDataSet = GetInput()){
-    static vtkFloatingPointType PERCENTS_OF_DETAILS = 0.50;
+    static double PERCENTS_OF_DETAILS = 0.50;
     vtkIdType aNbOfPoints = vtkIdType(aDataSet->GetNumberOfPoints()*PERCENTS_OF_DETAILS);
     if(aNbOfPoints > 0)
       SetNumberOfCloudPoints(aNbOfPoints);
   }
 
+  int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
   if(myIsResolveCoincidentTopology){
-    int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
-    vtkFloatingPointType aFactor, aUnit; 
+    double aFactor, aUnit; 
     vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
     
     vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
@@ -233,10 +229,11 @@ VTKViewer_Actor
     Superclass::Render(ren,m);
     
     vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
-    vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology);
   }else{
+    vtkMapper::SetResolveCoincidentTopologyToOff();
     Superclass::Render(ren,m);
   }
+  vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology);
 }
 
 /*!
@@ -256,8 +253,8 @@ VTKViewer_Actor
 */
 void
 VTKViewer_Actor
-::SetPolygonOffsetParameters(vtkFloatingPointType factor, 
-                             vtkFloatingPointType units)
+::SetPolygonOffsetParameters(double factor, 
+                             double units)
 {
   myPolygonOffsetFactor = factor;
   myPolygonOffsetUnits = units;
@@ -269,8 +266,8 @@ VTKViewer_Actor
 */
 void
 VTKViewer_Actor
-::GetPolygonOffsetParameters(vtkFloatingPointType& factor, 
-                             vtkFloatingPointType& units)
+::GetPolygonOffsetParameters(double& factor, 
+                             double& units)
 {
   factor = myPolygonOffsetFactor;
   units = myPolygonOffsetUnits;
@@ -279,7 +276,7 @@ VTKViewer_Actor
 /*!
   \return shrink factor
 */
-vtkFloatingPointType
+double
 VTKViewer_Actor
 ::GetShrinkFactor() 
 { 
@@ -433,7 +430,7 @@ VTKViewer_Actor
 /*!
   Get coordinates of a node for given object index
 */
-vtkFloatingPointType* 
+double* 
 VTKViewer_Actor
 ::GetNodeCoord(int theObjID)
 {
@@ -494,14 +491,14 @@ VTKViewer_Actor
   if(myIsInfinite)
     return true;
 
-  static vtkFloatingPointType MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT;
-  vtkFloatingPointType aBounds[6];
+  static double MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT;
+  double aBounds[6];
   GetBounds(aBounds);
   for(int i = 0; i < 6; i++)
     if(fabs(aBounds[i]) > MAX_DISTANCE)
       return true;
   
-  static vtkFloatingPointType MIN_DISTANCE = 1.0/VTK_LARGE_FLOAT;
+  static double MIN_DISTANCE = 1.0/VTK_LARGE_FLOAT;
   if(GetLength() < MIN_DISTANCE)
     return true;
   
@@ -511,7 +508,7 @@ VTKViewer_Actor
 /*!
   \return current bounding box
 */
-vtkFloatingPointType* 
+double* 
 VTKViewer_Actor
 ::GetBounds()
 {
@@ -524,7 +521,7 @@ VTKViewer_Actor
 */
 void
 VTKViewer_Actor
-::GetBounds(vtkFloatingPointType theBounds[6])
+::GetBounds(double theBounds[6])
 {
   Superclass::GetBounds(theBounds);
 }
@@ -546,7 +543,7 @@ VTKViewer_Actor
 
 void
 VTKViewer_Actor
-::SetSize( const vtkFloatingPointType ) 
+::SetSize( const double ) 
 {}
 
 
@@ -558,13 +555,13 @@ VTKViewer_Actor
 
 void
 VTKViewer_Actor
-::SetOpacity(vtkFloatingPointType theOpacity)
+::SetOpacity(double theOpacity)
 { 
   myOpacity = theOpacity;
   GetProperty()->SetOpacity(theOpacity);
 }
 
-vtkFloatingPointType
+double
 VTKViewer_Actor
 ::GetOpacity()
 {
@@ -577,9 +574,9 @@ VTKViewer_Actor
 */
 void
 VTKViewer_Actor
-::SetColor(vtkFloatingPointType r,
-           vtkFloatingPointType g,
-           vtkFloatingPointType b)
+::SetColor(double r,
+           double g,
+           double b)
 {
   GetProperty()->SetColor(r,g,b);
 }
@@ -589,7 +586,7 @@ VTKViewer_Actor
 */
 void
 VTKViewer_Actor
-::SetColor(const vtkFloatingPointType theRGB[3])
+::SetColor(const double theRGB[3])
 { 
   SetColor(theRGB[0],theRGB[1],theRGB[2]);
 }
@@ -599,11 +596,11 @@ VTKViewer_Actor
 */
 void
 VTKViewer_Actor
-::GetColor(vtkFloatingPointType& r,
-           vtkFloatingPointType& g,
-           vtkFloatingPointType& b)
+::GetColor(double& r,
+           double& g,
+           double& b)
 {
-  vtkFloatingPointType aColor[3];
+  double aColor[3];
   GetProperty()->GetColor(aColor);
   r = aColor[0];
   g = aColor[1];
@@ -621,13 +618,23 @@ VTKViewer_Actor
 }
 
 /*!
-  Get current material
-*/
-vtkProperty* 
-VTKViewer_Actor
-::GetMaterial()
-{
-  return NULL;
+  Get current front material\r
+*/\r
+vtkProperty* \r
+VTKViewer_Actor\r
+::GetFrontMaterial()\r
+{\r
+  return NULL;\r
+}\r
+\r
+/*!\r
+  Get current back material\r
+*/\r
+vtkProperty* \r
+VTKViewer_Actor\r
+::GetBackMaterial()\r
+{\r
+  return NULL;\r
 }
 
 /*!
@@ -718,14 +725,14 @@ bool VTKViewer_Actor::GetQuadraticArcMode() const{
 /*!
  * Set Max angle for representation 2D quadratic element as arked polygon
  */
-void VTKViewer_Actor::SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle){
+void VTKViewer_Actor::SetQuadraticArcAngle(double theMaxAngle){
   myGeomFilter->SetQuadraticArcAngle(theMaxAngle);
 }
 
 /*!
  * Return Max angle of the representation 2D quadratic element as arked polygon
  */
-vtkFloatingPointType VTKViewer_Actor::GetQuadraticArcAngle() const{
+double VTKViewer_Actor::GetQuadraticArcAngle() const{
   return myGeomFilter->GetQuadraticArcAngle();
 }