Commit 3fd44bd4 authored by Amy Squillacote's avatar Amy Squillacote

ENH: GetInput should return the correct data object type

parent bcc45bd9
......@@ -28,7 +28,7 @@
#include <vtkstd/string>
vtkCxxRevisionMacro(vtkBYUWriter, "1.57");
vtkCxxRevisionMacro(vtkBYUWriter, "1.58");
vtkStandardNewMacro(vtkBYUWriter);
// Create object so that it writes displacement, scalar, and texture files
......@@ -69,13 +69,7 @@ vtkBYUWriter::~vtkBYUWriter()
void vtkBYUWriter::WriteData()
{
FILE *geomFp;
vtkPolyData *input= vtkPolyData::SafeDownCast(this->GetInput());
if (!input)
{
vtkErrorMacro("Input is not a vtkPolyData.");
return;
}
vtkPolyData *input= this->GetInput();
int numPts=input->GetNumberOfPoints();
......@@ -182,7 +176,7 @@ void vtkBYUWriter::WriteGeometryFile(FILE *geomFile, int numPts)
vtkIdType *pts = 0;
vtkPoints *inPts;
vtkCellArray *inPolys;
vtkPolyData *input= vtkPolyData::SafeDownCast(this->GetInput());
vtkPolyData *input= this->GetInput();
//
// Check input
//
......@@ -271,7 +265,7 @@ void vtkBYUWriter::WriteDisplacementFile(int numPts)
int i;
double *v;
vtkDataArray *inVectors;
vtkPolyData *input= vtkPolyData::SafeDownCast(this->GetInput());
vtkPolyData *input= this->GetInput();
if ( this->WriteDisplacement && this->DisplacementFileName &&
(inVectors = input->GetPointData()->GetVectors()) != NULL )
......@@ -320,7 +314,7 @@ void vtkBYUWriter::WriteScalarFile(int numPts)
int i;
float s;
vtkDataArray *inScalars;
vtkPolyData *input= vtkPolyData::SafeDownCast(this->GetInput());
vtkPolyData *input= this->GetInput();
if ( this->WriteScalar && this->ScalarFileName &&
(inScalars = input->GetPointData()->GetScalars()) != NULL )
......@@ -369,7 +363,7 @@ void vtkBYUWriter::WriteTextureFile(int numPts)
int i;
double *t;
vtkDataArray *inTCoords;
vtkPolyData *input= vtkPolyData::SafeDownCast(this->GetInput());
vtkPolyData *input= this->GetInput();
if ( this->WriteTexture && this->TextureFileName &&
(inTCoords = input->GetPointData()->GetTCoords()) != NULL )
......
......@@ -24,7 +24,7 @@
#include "vtkCellData.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkCGMWriter, "1.19");
vtkCxxRevisionMacro(vtkCGMWriter, "1.20");
vtkStandardNewMacro(vtkCGMWriter);
vtkCxxSetObjectMacro(vtkCGMWriter, Viewport, vtkViewport);
......@@ -528,13 +528,7 @@ int vtkCGMqsortCompare(const void *val1, const void *val2)
void vtkCGMWriter::WriteData()
{
FILE *outf;
vtkPolyData *input=vtkPolyData::SafeDownCast(this->GetInput());
if (!input)
{
vtkErrorMacro("Input is not a vtkPolyData.");
return;
}
vtkPolyData *input=this->GetInput();
vtkIdType numCells=input->GetNumberOfCells(), cellId;
vtkIdType numPts=input->GetNumberOfPoints();
......
......@@ -29,7 +29,7 @@
#include "vtkUnstructuredGrid.h"
#include "vtkUnstructuredGridWriter.h"
vtkCxxRevisionMacro(vtkDataSetWriter, "1.39");
vtkCxxRevisionMacro(vtkDataSetWriter, "1.40");
vtkStandardNewMacro(vtkDataSetWriter);
void vtkDataSetWriter::WriteData()
......@@ -119,6 +119,16 @@ int vtkDataSetWriter::FillInputPortInformation(int, vtkInformation *info)
return 1;
}
vtkDataSet* vtkDataSetWriter::GetInput()
{
return vtkDataSet::SafeDownCast(this->Superclass::GetInput());
}
vtkDataSet* vtkDataSetWriter::GetInput(int port)
{
return vtkDataSet::SafeDownCast(this->Superclass::GetInput(port));
}
void vtkDataSetWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -30,6 +30,11 @@ public:
vtkTypeRevisionMacro(vtkDataSetWriter,vtkDataWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get the input to this writer.
vtkDataSet* GetInput();
vtkDataSet* GetInput(int port);
protected:
vtkDataSetWriter() {};
~vtkDataSetWriter() {};
......
......@@ -20,7 +20,7 @@
#include "vtkObjectFactory.h"
#include "vtkPolyData.h"
vtkCxxRevisionMacro(vtkIVWriter, "1.32");
vtkCxxRevisionMacro(vtkIVWriter, "1.33");
vtkStandardNewMacro(vtkIVWriter);
void vtkIVWriter::WriteData()
......@@ -48,7 +48,7 @@ void vtkIVWriter::WriteData()
vtkDebugMacro("Writing OpenInventor file");
fprintf(fp,"#Inventor V2.0 ascii\n");
fprintf(fp,"# OpenInventor file written by the visualization toolkit\n\n");
this->WritePolyData(vtkPolyData::SafeDownCast(this->GetInput()), fp);
this->WritePolyData(this->GetInput(), fp);
if (fclose(fp))
{
vtkErrorMacro(<< this->FileName
......
......@@ -20,7 +20,7 @@
#include "vtkPointData.h"
#include "vtkPolyData.h"
vtkCxxRevisionMacro(vtkMCubesWriter, "1.33");
vtkCxxRevisionMacro(vtkMCubesWriter, "1.34");
vtkStandardNewMacro(vtkMCubesWriter);
// Create object.
......@@ -46,13 +46,7 @@ void vtkMCubesWriter::WriteData()
vtkPoints *pts;
vtkDataArray *normals;
vtkCellArray *polys;
vtkPolyData *input=vtkPolyData::SafeDownCast(this->GetInput());
if (!input)
{
vtkErrorMacro("Input is not a vtkPolyData.");
return;
}
vtkPolyData *input=this->GetInput();
polys = input->GetPolys();
pts = input->GetPoints();
......
......@@ -24,7 +24,7 @@
#include <stddef.h>
vtkCxxRevisionMacro(vtkPLYWriter, "1.21");
vtkCxxRevisionMacro(vtkPLYWriter, "1.22");
vtkStandardNewMacro(vtkPLYWriter);
vtkCxxSetObjectMacro(vtkPLYWriter,LookupTable,vtkScalarsToColors);
......@@ -72,13 +72,7 @@ void vtkPLYWriter::WriteData()
vtkIdType i, j, idx;
vtkPoints *inPts;
vtkCellArray *polys;
vtkPolyData *input = vtkPolyData::SafeDownCast(this->GetInput());
if (!input)
{
vtkErrorMacro("Input is not a vtkPolyData.");
return;
}
vtkPolyData *input = this->GetInput();
unsigned char *cellColors, *pointColors;
PlyFile *ply;
......
......@@ -24,13 +24,13 @@
# include <io.h> /* unlink */
#endif
vtkCxxRevisionMacro(vtkPolyDataWriter, "1.25");
vtkCxxRevisionMacro(vtkPolyDataWriter, "1.26");
vtkStandardNewMacro(vtkPolyDataWriter);
void vtkPolyDataWriter::WriteData()
{
ostream *fp;
vtkPolyData *input = vtkPolyData::SafeDownCast(this->GetInput());
vtkPolyData *input = this->GetInput();
vtkDebugMacro(<<"Writing vtk polygonal data...");
......@@ -132,6 +132,16 @@ int vtkPolyDataWriter::FillInputPortInformation(int, vtkInformation *info)
return 1;
}
vtkPolyData* vtkPolyDataWriter::GetInput()
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput());
}
vtkPolyData* vtkPolyDataWriter::GetInput(int port)
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput(port));
}
void vtkPolyDataWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -33,6 +33,11 @@ public:
vtkTypeRevisionMacro(vtkPolyDataWriter,vtkDataWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get the input to this writer.
vtkPolyData* GetInput();
vtkPolyData* GetInput(int port);
protected:
vtkPolyDataWriter() {};
~vtkPolyDataWriter() {};
......
......@@ -24,7 +24,7 @@
# include <io.h> /* unlink */
#endif
vtkCxxRevisionMacro(vtkRectilinearGridWriter, "1.25");
vtkCxxRevisionMacro(vtkRectilinearGridWriter, "1.26");
vtkStandardNewMacro(vtkRectilinearGridWriter);
void vtkRectilinearGridWriter::WriteData()
......@@ -111,6 +111,16 @@ int vtkRectilinearGridWriter::FillInputPortInformation(int,
return 1;
}
vtkRectilinearGrid* vtkRectilinearGridWriter::GetInput()
{
return vtkRectilinearGrid::SafeDownCast(this->Superclass::GetInput());
}
vtkRectilinearGrid* vtkRectilinearGridWriter::GetInput(int port)
{
return vtkRectilinearGrid::SafeDownCast(this->Superclass::GetInput(port));
}
void vtkRectilinearGridWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -34,6 +34,11 @@ public:
vtkTypeRevisionMacro(vtkRectilinearGridWriter,vtkDataWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get the input to this writer.
vtkRectilinearGrid* GetInput();
vtkRectilinearGrid* GetInput(int port);
protected:
vtkRectilinearGridWriter() {};
~vtkRectilinearGridWriter() {};
......
......@@ -27,7 +27,7 @@
# include <io.h> /* unlink */
#endif
vtkCxxRevisionMacro(vtkSTLWriter, "1.56");
vtkCxxRevisionMacro(vtkSTLWriter, "1.57");
vtkStandardNewMacro(vtkSTLWriter);
vtkSTLWriter::vtkSTLWriter()
......@@ -39,13 +39,7 @@ void vtkSTLWriter::WriteData()
{
vtkPoints *pts;
vtkCellArray *polys;
vtkPolyData *input = vtkPolyData::SafeDownCast(this->GetInput());
if (!input)
{
vtkErrorMacro("Input is not a vtkPolyData.");
return;
}
vtkPolyData *input = this->GetInput();
polys = input->GetPolys();
pts = input->GetPoints();
......
......@@ -25,7 +25,7 @@
# include <io.h> /* unlink */
#endif
vtkCxxRevisionMacro(vtkStructuredGridWriter, "1.39");
vtkCxxRevisionMacro(vtkStructuredGridWriter, "1.40");
vtkStandardNewMacro(vtkStructuredGridWriter);
void vtkStructuredGridWriter::WriteData()
......@@ -119,6 +119,16 @@ int vtkStructuredGridWriter::FillInputPortInformation(int,
return 1;
}
vtkStructuredGrid* vtkStructuredGridWriter::GetInput()
{
return vtkStructuredGrid::SafeDownCast(this->Superclass::GetInput());
}
vtkStructuredGrid* vtkStructuredGridWriter::GetInput(int port)
{
return vtkStructuredGrid::SafeDownCast(this->Superclass::GetInput(port));
}
void vtkStructuredGridWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -34,6 +34,11 @@ public:
vtkTypeRevisionMacro(vtkStructuredGridWriter,vtkDataWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get the input to this writer.
vtkStructuredGrid* GetInput();
vtkStructuredGrid* GetInput(int port);
protected:
vtkStructuredGridWriter() {};
~vtkStructuredGridWriter() {};
......
......@@ -25,7 +25,7 @@
#endif
vtkCxxRevisionMacro(vtkStructuredPointsWriter, "1.41");
vtkCxxRevisionMacro(vtkStructuredPointsWriter, "1.42");
vtkStandardNewMacro(vtkStructuredPointsWriter);
void vtkStructuredPointsWriter::WriteData()
......@@ -103,6 +103,16 @@ int vtkStructuredPointsWriter::FillInputPortInformation(int,
return 1;
}
vtkImageData* vtkStructuredPointsWriter::GetInput()
{
return vtkImageData::SafeDownCast(this->Superclass::GetInput());
}
vtkImageData* vtkStructuredPointsWriter::GetInput(int port)
{
return vtkImageData::SafeDownCast(this->Superclass::GetInput(port));
}
void vtkStructuredPointsWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -33,6 +33,11 @@ public:
vtkTypeRevisionMacro(vtkStructuredPointsWriter,vtkDataWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get the input to this writer.
vtkImageData* GetInput();
vtkImageData* GetInput(int port);
protected:
vtkStructuredPointsWriter() {};
~vtkStructuredPointsWriter() {};
......
......@@ -26,7 +26,7 @@
# include <io.h> /* unlink */
#endif
vtkCxxRevisionMacro(vtkUnstructuredGridWriter, "1.42");
vtkCxxRevisionMacro(vtkUnstructuredGridWriter, "1.43");
vtkStandardNewMacro(vtkUnstructuredGridWriter);
void vtkUnstructuredGridWriter::WriteData()
......@@ -132,6 +132,16 @@ int vtkUnstructuredGridWriter::FillInputPortInformation(int,
return 1;
}
vtkUnstructuredGrid* vtkUnstructuredGridWriter::GetInput()
{
return vtkUnstructuredGrid::SafeDownCast(this->Superclass::GetInput());
}
vtkUnstructuredGrid* vtkUnstructuredGridWriter::GetInput(int port)
{
return vtkUnstructuredGrid::SafeDownCast(this->Superclass::GetInput(port));
}
void vtkUnstructuredGridWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -32,6 +32,11 @@ public:
vtkTypeRevisionMacro(vtkUnstructuredGridWriter,vtkDataWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get the input to this writer.
vtkUnstructuredGrid* GetInput();
vtkUnstructuredGrid* GetInput(int port);
protected:
vtkUnstructuredGridWriter() {};
~vtkUnstructuredGridWriter() {};
......
......@@ -62,8 +62,10 @@ public:
// Set/get the input to this writer.
void SetInput(vtkDataObject *input);
void SetInput(int index, vtkDataObject *input);
//BTX
vtkDataObject *GetInput();
vtkDataObject *GetInput(int port);
//ETX
protected:
vtkWriter();
......
......@@ -22,7 +22,7 @@
#include "vtkRectilinearGrid.h"
#include "vtkErrorCode.h"
vtkCxxRevisionMacro(vtkPDataSetWriter, "1.15");
vtkCxxRevisionMacro(vtkPDataSetWriter, "1.16");
vtkStandardNewMacro(vtkPDataSetWriter);
//----------------------------------------------------------------------------
......@@ -70,7 +70,7 @@ int vtkPDataSetWriter::Write()
char *fileName;
ostream *fptr;
vtkDataSet *input = vtkDataSet::SafeDownCast(this->GetInput());
vtkDataSet *input = this->GetInput();
if (this->FileName == NULL)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment