From bc14b529ab52eb674d602c16a865bd20fc4a3a92 Mon Sep 17 00:00:00 2001
From: Chris Harris <chris.harris@kitware.com>
Date: Tue, 3 Jan 2012 14:54:03 -0500
Subject: [PATCH] COMP: Update to new VTK API

---
 Graphics/vtkImplicitPolyDataDistance.cxx   |  3 +--
 Graphics/vtkIntersectionPolyDataFilter.cxx |  6 ++----
 Hybrid/vtkBSplineTransform.cxx             | 12 ++++--------
 Imaging/vtkImageBSplineCoefficients.cxx    |  4 ++--
 Imaging/vtkImageHistogram.cxx              | 12 +++++++++---
 Imaging/vtkImageHistogram.h                |  6 +++++-
 Infovis/vtkConvexHull2D.cxx                |  2 +-
 Infovis/vtkGraphAnnotationLayersFilter.cxx |  6 +++---
 Rendering/vtkOpenGLImageSliceMapper.cxx    |  8 +++++++-
 Widgets/vtkBrokenLineWidget.cxx            |  4 ++--
 10 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/Graphics/vtkImplicitPolyDataDistance.cxx b/Graphics/vtkImplicitPolyDataDistance.cxx
index cfca064c18c..3e0f518c7ae 100644
--- a/Graphics/vtkImplicitPolyDataDistance.cxx
+++ b/Graphics/vtkImplicitPolyDataDistance.cxx
@@ -53,7 +53,7 @@ void vtkImplicitPolyDataDistance::SetInput(vtkPolyData* input)
     triangleFilter->PassVertsOff();
     triangleFilter->PassLinesOff();
 
-    triangleFilter->SetInput( input );
+    triangleFilter->SetInputData( input );
     triangleFilter->Update();
 
     this->Input = triangleFilter->GetOutput();
@@ -83,7 +83,6 @@ unsigned long vtkImplicitPolyDataDistance::GetMTime()
 
   if ( this->Input != NULL )
     {
-    this->Input->Update();
     InputMTime = this->Input->GetMTime();
     mTime = (InputMTime > mTime ? InputMTime : mTime);
     }
diff --git a/Graphics/vtkIntersectionPolyDataFilter.cxx b/Graphics/vtkIntersectionPolyDataFilter.cxx
index cefa8a5c1d5..6f0da1ea4a6 100644
--- a/Graphics/vtkIntersectionPolyDataFilter.cxx
+++ b/Graphics/vtkIntersectionPolyDataFilter.cxx
@@ -696,8 +696,8 @@ vtkCellArray* vtkIntersectionPolyDataFilter::Impl
 
   vtkSmartPointer< vtkDelaunay2D > del2D =
     vtkSmartPointer< vtkDelaunay2D >::New();
-  del2D->SetInput(pd);
-  del2D->SetSource(pd);
+  del2D->SetInputData(pd);
+  del2D->SetSourceData(pd); 
   del2D->SetTolerance(0.0);
   del2D->SetAlpha(0.0);
   del2D->SetOffset(10);
@@ -1099,11 +1099,9 @@ int vtkIntersectionPolyDataFilter::RequestData(vtkInformation*        vtkNotUsed
   // Set up new poly data for the inputs to build cells and links.
   vtkSmartPointer< vtkPolyData > mesh0 = vtkSmartPointer< vtkPolyData >::New();
   mesh0->DeepCopy(input0);
-  mesh0->SetSource(NULL);
 
   vtkSmartPointer< vtkPolyData > mesh1 = vtkSmartPointer< vtkPolyData >::New();
   mesh1->DeepCopy(input1);
-  mesh1->SetSource(NULL);
 
   // Find the triangle-triangle intersections between mesh0 and mesh1
   vtkSmartPointer< vtkOBBTree > obbTree0 = vtkSmartPointer< vtkOBBTree >::New();
diff --git a/Hybrid/vtkBSplineTransform.cxx b/Hybrid/vtkBSplineTransform.cxx
index a2650598520..edd71f3ced1 100644
--- a/Hybrid/vtkBSplineTransform.cxx
+++ b/Hybrid/vtkBSplineTransform.cxx
@@ -430,10 +430,7 @@ unsigned long vtkBSplineTransform::GetMTime()
   result = vtkWarpTransform::GetMTime();
   if (this->Coefficients)
     {
-    this->Coefficients->UpdateInformation();
-
-    mtime = this->Coefficients->GetPipelineMTime();
-    result = ( mtime > result ? mtime : result );
+    //this->Coefficients->UpdateInformation();
 
     mtime = this->Coefficients->GetMTime();
     result = ( mtime > result ? mtime : result );
@@ -817,8 +814,7 @@ void vtkBSplineTransform::InternalUpdate()
     {
     return;
     }
-
-  grid->UpdateInformation();
+  //grid->UpdateInformation();
 
   if (grid->GetNumberOfScalarComponents() != 3)
     {
@@ -841,8 +837,8 @@ void vtkBSplineTransform::InternalUpdate()
       break;
     }
 
-  grid->SetUpdateExtent(grid->GetWholeExtent());
-  grid->Update();
+  //grid->SetUpdateExtent(grid->GetWholeExtent());
+  //grid->Update();
 
   this->GridPointer = grid->GetScalarPointer();
   grid->GetSpacing(this->GridSpacing);
diff --git a/Imaging/vtkImageBSplineCoefficients.cxx b/Imaging/vtkImageBSplineCoefficients.cxx
index c34d198ca22..7fdac66b6b4 100644
--- a/Imaging/vtkImageBSplineCoefficients.cxx
+++ b/Imaging/vtkImageBSplineCoefficients.cxx
@@ -90,8 +90,8 @@ int vtkImageBSplineCoefficients::RequestData(
     }
 
   // Allocate the output data
-  outData->SetExtent(outData->GetWholeExtent());
-  outData->AllocateScalars();
+  outData->SetExtent(outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));
+  outData->AllocateScalars(outInfo);
 
   if (outData->GetScalarType() != VTK_FLOAT &&
       outData->GetScalarType() != VTK_DOUBLE)
diff --git a/Imaging/vtkImageHistogram.cxx b/Imaging/vtkImageHistogram.cxx
index bdb1705050b..d3b7b54602a 100644
--- a/Imaging/vtkImageHistogram.cxx
+++ b/Imaging/vtkImageHistogram.cxx
@@ -123,9 +123,15 @@ vtkIdTypeArray *vtkImageHistogram::GetHistogram()
 }
 
 //----------------------------------------------------------------------------
-void vtkImageHistogram::SetStencil(vtkImageStencilData *stencil)
+void vtkImageHistogram::SetStencilData(vtkImageStencilData *stencil)
 {
-  this->SetInput(1, stencil);
+  this->SetInputData(1, stencil);
+}
+
+//----------------------------------------------------------------------------
+void vtkImageHistogram::SetStencilConnection(vtkAlgorithmOutput* algOutput)
+{
+  this->SetInputConnection(1, algOutput);
 }
 
 //----------------------------------------------------------------------------
@@ -674,7 +680,7 @@ int vtkImageHistogram::RequestData(
         int updateExtent[6];
         outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
                      updateExtent);
-        this->AllocateOutputData(outData, updateExtent);
+        this->AllocateOutputData(outData, outInfo, updateExtent);
         }
       }
     }
diff --git a/Imaging/vtkImageHistogram.h b/Imaging/vtkImageHistogram.h
index 14613550004..95fa6c505a2 100644
--- a/Imaging/vtkImageHistogram.h
+++ b/Imaging/vtkImageHistogram.h
@@ -100,9 +100,13 @@ public:
 
   // Description:
   // Use a stencil to compute the histogram for just a part of the image.
-  void SetStencil(vtkImageStencilData *stencil);
+  void SetStencilData(vtkImageStencilData *stencil);
   vtkImageStencilData *GetStencil();
 
+  // Description:
+  // Equivalent to SetInputConnection(1, algOutput).
+  void SetStencilConnection(vtkAlgorithmOutput* algOutput);
+
   // Description:
   // If this is On, then a histogram image will be produced as the output.
   // Regardless of this setting, the histogram is always available as a
diff --git a/Infovis/vtkConvexHull2D.cxx b/Infovis/vtkConvexHull2D.cxx
index beb655e042a..ac4a7d4bb2d 100644
--- a/Infovis/vtkConvexHull2D.cxx
+++ b/Infovis/vtkConvexHull2D.cxx
@@ -289,7 +289,7 @@ int vtkConvexHull2D::RequestData(vtkInformation *vtkNotUsed(request),
   this->OutputTransform->Translate(centre);
   this->OutputTransform->Scale(this->ScaleFactor, this->ScaleFactor, this->ScaleFactor);
   this->OutputTransform->Translate(-centre[0], -centre[1], -centre[2]);
-  this->OutputTransformFilter->SetInput(hullPolyData);
+  this->OutputTransformFilter->SetInputData(hullPolyData);
   this->OutputTransformFilter->Update();
   hullPolyData = this->OutputTransformFilter->GetOutput();
 
diff --git a/Infovis/vtkGraphAnnotationLayersFilter.cxx b/Infovis/vtkGraphAnnotationLayersFilter.cxx
index f053f642637..019bdc32db4 100644
--- a/Infovis/vtkGraphAnnotationLayersFilter.cxx
+++ b/Infovis/vtkGraphAnnotationLayersFilter.cxx
@@ -206,7 +206,7 @@ int vtkGraphAnnotationLayersFilter::RequestData(vtkInformation *vtkNotUsed(reque
       vtkSmartPointer<vtkPolyData> hullPolyData =
         vtkSmartPointer<vtkPolyData>::New();
       hullPolyData->SetPoints(hullPoints);
-      ConvexHullFilter->SetInput(hullPolyData);
+      ConvexHullFilter->SetInputData(hullPolyData);
       ConvexHullFilter->Update();
       hullPolyData->ShallowCopy(ConvexHullFilter->GetOutput());
 
@@ -261,14 +261,14 @@ int vtkGraphAnnotationLayersFilter::RequestData(vtkInformation *vtkNotUsed(reque
       hullPolyData->GetCellData()->AddArray(hullCentreVertex);
       hullCentreVertex->Delete();
 
-      this->HullAppend->AddInput(hullPolyData);
+      this->HullAppend->AddInputData(hullPolyData);
 
       if (this->ConvexHullFilter->GetOutline())
         {
         vtkSmartPointer<vtkPolyData> outlinePolyData =
           vtkSmartPointer<vtkPolyData>::New();
         outlinePolyData->ShallowCopy(ConvexHullFilter->GetOutput(1));
-        this->OutlineAppend->AddInput(outlinePolyData);
+        this->OutlineAppend->AddInputData(outlinePolyData);
         }
       } // Next selection node.
     } // Next annotation.
diff --git a/Rendering/vtkOpenGLImageSliceMapper.cxx b/Rendering/vtkOpenGLImageSliceMapper.cxx
index 5e4b4197209..e613b96e13a 100644
--- a/Rendering/vtkOpenGLImageSliceMapper.cxx
+++ b/Rendering/vtkOpenGLImageSliceMapper.cxx
@@ -31,6 +31,10 @@
 #include "vtkTimerLog.h"
 #include "vtkGarbageCollector.h"
 #include "vtkTemplateAliasMacro.h"
+#include "vtkStreamingDemandDrivenPipeline.h"
+#include "vtkInformation.h"
+#include "vtkInformationVector.h"
+
 
 #include <math.h>
 
@@ -974,7 +978,9 @@ void vtkOpenGLImageSliceMapper::Render(vtkRenderer *ren, vtkImageSlice *prop)
   vtkImageData *input = this->GetInput();
   input->GetSpacing(this->DataSpacing);
   input->GetOrigin(this->DataOrigin);
-  input->GetWholeExtent(this->DataWholeExtent);
+  vtkInformation *inputInfo = this->GetInputInformation(0, 0);
+  inputInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),
+                 this->DataWholeExtent);
 
   // OpenGL matrices are column-order, not row-order like VTK
   vtkMatrix4x4 *matrix = this->GetDataToWorldMatrix();
diff --git a/Widgets/vtkBrokenLineWidget.cxx b/Widgets/vtkBrokenLineWidget.cxx
index a9d72524416..8dcb9710fec 100644
--- a/Widgets/vtkBrokenLineWidget.cxx
+++ b/Widgets/vtkBrokenLineWidget.cxx
@@ -83,7 +83,7 @@ vtkBrokenLineWidget::vtkBrokenLineWidget()
     this->HandleGeometry[i]->SetThetaResolution( 16 );
     this->HandleGeometry[i]->SetPhiResolution( 8 );
     vtkPolyDataMapper* handleMapper = vtkPolyDataMapper::New();
-    handleMapper->SetInput( this->HandleGeometry[i]->GetOutput() );
+    handleMapper->SetInputConnection(this->HandleGeometry[i]->GetOutputPort() );
     this->Handle[i] = vtkActor::New();
     this->Handle[i]->SetMapper( handleMapper );
     handleMapper->Delete();
@@ -1147,7 +1147,7 @@ void vtkBrokenLineWidget::SetNumberOfHandles( int npts )
     this->HandleGeometry[i]->SetThetaResolution( 16 );
     this->HandleGeometry[i]->SetPhiResolution( 8 );
     vtkPolyDataMapper* handleMapper = vtkPolyDataMapper::New();
-    handleMapper->SetInput( this->HandleGeometry[i]->GetOutput() );
+    handleMapper->SetInputConnection( this->HandleGeometry[i]->GetOutputPort() );
     this->Handle[i] = vtkActor::New();
     this->Handle[i]->SetMapper( handleMapper );
     handleMapper->Delete();
-- 
GitLab