Commit 7f5f0bbc authored by Berk Geveci's avatar Berk Geveci Committed by Chris Harris

Moved readers and writers of the legacy VTK format to their own module.

The legacy readers and writers somehow ended up in the IO/Geometry
module. I moved them to their own: IO/Legacy. I also cleaned
up dependencies. Some writers somewhat incorrectly subclasses from
the legacy writers even though they supported completely different formats.
They did this to just use things like FileName.

Change-Id: I603753bc7145b317bd71e7798cd2ea8a6c5c56c1
parent 6f1490f1
......@@ -8,6 +8,6 @@ vtk_module(vtkCommonExecutionModel
TEST_DEPENDS
vtkTestingCore
vtkIOCore
vtkIOGeometry
vtkIOLegacy
vtkFiltersExtraction
)
......@@ -63,9 +63,9 @@ vtkStandardNewMacro(vtkCMLMoleculeReader);
//----------------------------------------------------------------------------
vtkCMLMoleculeReader::vtkCMLMoleculeReader()
: vtkDataReader(),
FileName(NULL)
: FileName(NULL)
{
this->SetNumberOfInputPorts(0);
}
//----------------------------------------------------------------------------
......
......@@ -20,15 +20,15 @@
#define __vtkCMLMoleculeReader_h
#include "vtkDomainsChemistryModule.h" // For export macro
#include "vtkDataReader.h"
#include "vtkMoleculeAlgorithm.h"
class vtkMolecule;
class VTKDOMAINSCHEMISTRY_EXPORT vtkCMLMoleculeReader : public vtkDataReader
class VTKDOMAINSCHEMISTRY_EXPORT vtkCMLMoleculeReader : public vtkMoleculeAlgorithm
{
public:
static vtkCMLMoleculeReader *New();
vtkTypeMacro(vtkCMLMoleculeReader,vtkDataReader);
vtkTypeMacro(vtkCMLMoleculeReader,vtkMoleculeAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -9,6 +9,7 @@ vtk_module(vtkFiltersCore
vtkCommonMath
TEST_DEPENDS
vtkTestingRendering
vtkIOLegacy
vtkIOXML
vtkImagingCore
vtkFiltersGeneral
......
......@@ -5,7 +5,7 @@ vtk_module(vtkFiltersExtraction
vtkFiltersCore
vtkFiltersGeneral
TEST_DEPENDS
vtkIOGeometry
vtkIOLegacy
vtkIOXML
vtkRenderingOpenGL
vtkTestingRendering
......
......@@ -5,7 +5,7 @@ vtk_module(vtkFiltersGeneral
vtkCommonComputationalGeometry
vtkFiltersCore
TEST_DEPENDS
vtkIOGeometry
vtkIOLegacy
vtkIOXML
vtkRenderingOpenGL
vtkRenderingFreeTypeOpenGL
......
......@@ -5,6 +5,7 @@ vtk_module(vtkFiltersHyperTree
vtkFiltersGeneral
TEST_DEPENDS
vtkIOXML
vtkIOLegacy
vtkRenderingOpenGL
vtkTestingRendering
vtkInteractionStyle
......
......@@ -2,6 +2,7 @@ vtk_module(vtkFiltersParallelImaging
GROUPS
StandAlone
DEPENDS
vtkIOLegacy
vtkImagingCore
vtkFiltersImaging
vtkFiltersParallel
......
......@@ -5,6 +5,6 @@ vtk_module(vtkFiltersVerdict
vtkCommonExecutionModel
vtkverdict
TEST_DEPENDS
vtkIOGeometry
vtkIOLegacy
vtkTestingCore
)
......@@ -7,14 +7,8 @@ SET(Module_SRCS
vtkBase64OutputStream.cxx
vtkBase64Utilities.cxx
vtkDataCompressor.cxx
vtkDataObjectReader.cxx
vtkDataObjectWriter.cxx
vtkDataReader.cxx
vtkDataWriter.cxx
vtkDelimitedTextWriter.cxx
vtkGlobFileNames.cxx
vtkGraphReader.cxx
vtkGraphWriter.cxx
vtkInputStream.cxx
vtkJavaScriptDataWriter.cxx
vtkOutputStream.cxx
......@@ -25,8 +19,6 @@ SET(Module_SRCS
vtkUTF8TextCodec.cxx
vtkWriter.cxx
vtkZLibDataCompressor.cxx
vtkTableReader.cxx
vtkTableWriter.cxx
vtkArrayDataReader.cxx
vtkArrayDataWriter.cxx
)
......
......@@ -4,16 +4,10 @@ SET(Module_SRCS
vtkBYUWriter.cxx
#vtkCGMWriter.cxx # Needs vtkViewport.
vtkChacoReader.cxx
vtkCompositeDataReader.cxx
vtkCompositeDataWriter.cxx
vtkDataSetReader.cxx
vtkDataSetWriter.cxx
vtkFacetWriter.cxx
vtkFLUENTReader.cxx
vtkGAMBITReader.cxx
vtkGaussianCubeReader.cxx
vtkGenericDataObjectReader.cxx
vtkGenericDataObjectWriter.cxx
vtkIVWriter.cxx
vtkMCubesReader.cxx
vtkMCubesWriter.cxx
......@@ -24,27 +18,12 @@ SET(Module_SRCS
vtkOpenFOAMReader.cxx
vtkParticleReader.cxx
vtkPDBReader.cxx
vtkPolyDataReader.cxx
vtkPolyDataWriter.cxx
vtkProStarReader.cxx
vtkRectilinearGridReader.cxx
vtkRectilinearGridWriter.cxx
vtkSESAMEReader.cxx
vtkSimplePointsReader.cxx
vtkSimplePointsWriter.cxx
vtkSTLReader.cxx
vtkSTLWriter.cxx
vtkStructuredGridReader.cxx
vtkStructuredGridWriter.cxx
vtkTecplotReader.cxx
vtkTreeReader.cxx
vtkTreeWriter.cxx
vtkUGFacetReader.cxx
vtkUnstructuredGridReader.cxx
vtkUnstructuredGridWriter.cxx
vtkStructuredPointsReader.cxx
vtkStructuredPointsWriter.cxx
vtkXYZMolReader.cxx
)
......
......@@ -9,6 +9,7 @@ vtk_module(vtkIOGeometry
vtkzlib
TEST_DEPENDS
vtkIOAMR
vtkIOLegacy
vtkFiltersGeometry
vtkRenderingOpenGL
vtkTestingRendering
......
......@@ -16,6 +16,7 @@
#include "vtkCellArray.h"
#include "vtkErrorCode.h"
#include "vtkInformation.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkPolyData.h"
......@@ -425,3 +426,18 @@ void vtkBYUWriter::PrintSelf(ostream& os, vtkIndent indent)
<< (this->TextureFileName ? this->TextureFileName : "(none)") << "\n";
}
vtkPolyData* vtkBYUWriter::GetInput()
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput());
}
vtkPolyData* vtkBYUWriter::GetInput(int port)
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput(port));
}
int vtkBYUWriter::FillInputPortInformation(int, vtkInformation *info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
return 1;
}
......@@ -27,14 +27,16 @@
#define __vtkBYUWriter_h
#include "vtkIOGeometryModule.h" // For export macro
#include "vtkPolyDataWriter.h"
#include "vtkWriter.h"
class VTKIOGEOMETRY_EXPORT vtkBYUWriter : public vtkPolyDataWriter
class vtkPolyData;
class VTKIOGEOMETRY_EXPORT vtkBYUWriter : public vtkWriter
{
public:
static vtkBYUWriter *New();
vtkTypeMacro(vtkBYUWriter,vtkPolyDataWriter);
vtkTypeMacro(vtkBYUWriter,vtkWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......@@ -75,6 +77,11 @@ public:
vtkGetMacro(WriteTexture,int);
vtkBooleanMacro(WriteTexture,int);
// Description:
// Get the input to this writer.
vtkPolyData* GetInput();
vtkPolyData* GetInput(int port);
protected:
vtkBYUWriter();
~vtkBYUWriter();
......@@ -93,6 +100,9 @@ protected:
void WriteDisplacementFile(int numPts);
void WriteScalarFile(int numPts);
void WriteTextureFile(int numPts);
virtual int FillInputPortInformation(int port, vtkInformation *info);
private:
vtkBYUWriter(const vtkBYUWriter&); // Not implemented.
void operator=(const vtkBYUWriter&); // Not implemented.
......
......@@ -15,6 +15,7 @@
#include "vtkIVWriter.h"
#include "vtkCellArray.h"
#include "vtkInformation.h"
#include "vtkLookupTable.h"
#include "vtkObjectFactory.h"
#include "vtkPolyData.h"
......@@ -226,3 +227,22 @@ void vtkIVWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
//----------------------------------------------------------------------------
vtkPolyData* vtkIVWriter::GetInput()
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput());
}
//----------------------------------------------------------------------------
vtkPolyData* vtkIVWriter::GetInput(int port)
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput(port));
}
//----------------------------------------------------------------------------
int vtkIVWriter::FillInputPortInformation(int, vtkInformation *info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
return 1;
}
......@@ -25,21 +25,45 @@
#define __vtkIVWriter_h
#include "vtkIOGeometryModule.h" // For export macro
#include "vtkPolyDataWriter.h"
#include "vtkWriter.h"
class VTKIOGEOMETRY_EXPORT vtkIVWriter : public vtkPolyDataWriter
class vtkPolyData;
class VTKIOGEOMETRY_EXPORT vtkIVWriter : public vtkWriter
{
public:
static vtkIVWriter *New();
vtkTypeMacro(vtkIVWriter,vtkPolyDataWriter);
vtkTypeMacro(vtkIVWriter,vtkWriter);
virtual void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get the input to this writer.
vtkPolyData* GetInput();
vtkPolyData* GetInput(int port);
// Description:
// Specify file name of vtk polygon data file to write.
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
protected:
vtkIVWriter() {};
~vtkIVWriter() {};
vtkIVWriter()
{
this->FileName = NULL;
}
~vtkIVWriter()
{
delete[] this->FileName;
}
void WriteData();
void WritePolyData(vtkPolyData *polyData, FILE *fp);
char *FileName;
virtual int FillInputPortInformation(int port, vtkInformation *info);
private:
vtkIVWriter(const vtkIVWriter&); // Not implemented.
void operator=(const vtkIVWriter&); // Not implemented.
......
......@@ -16,6 +16,7 @@
#include "vtkByteSwap.h"
#include "vtkCellArray.h"
#include "vtkInformation.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkPolyData.h"
......@@ -25,11 +26,14 @@ vtkStandardNewMacro(vtkMCubesWriter);
// Create object.
vtkMCubesWriter::vtkMCubesWriter()
{
this->FileName = 0;
this->LimitsFileName = NULL;
}
vtkMCubesWriter::~vtkMCubesWriter()
{
delete[] this->FileName;
if ( this->LimitsFileName )
{
delete [] this->LimitsFileName;
......@@ -156,3 +160,18 @@ void vtkMCubesWriter::PrintSelf(ostream& os, vtkIndent indent)
<< (this->LimitsFileName ? this->LimitsFileName : "(none)") << "\n";
}
vtkPolyData* vtkMCubesWriter::GetInput()
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput());
}
vtkPolyData* vtkMCubesWriter::GetInput(int port)
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput(port));
}
int vtkMCubesWriter::FillInputPortInformation(int, vtkInformation *info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
return 1;
}
......@@ -32,13 +32,18 @@
#define __vtkMCubesWriter_h
#include "vtkIOGeometryModule.h" // For export macro
#include "vtkPolyDataWriter.h"
#include "vtkWriter.h"
class VTKIOGEOMETRY_EXPORT vtkMCubesWriter : public vtkPolyDataWriter
class vtkCellArray;
class vtkDataArray;
class vtkPoints;
class vtkPolyData;
class VTKIOGEOMETRY_EXPORT vtkMCubesWriter : public vtkWriter
{
public:
static vtkMCubesWriter *New();
vtkTypeMacro(vtkMCubesWriter,vtkPolyDataWriter);
vtkTypeMacro(vtkMCubesWriter,vtkWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......@@ -46,6 +51,16 @@ public:
vtkSetStringMacro(LimitsFileName);
vtkGetStringMacro(LimitsFileName);
// Description:
// Get the input to this writer.
vtkPolyData* GetInput();
vtkPolyData* GetInput(int port);
// Description:
// Specify file name of vtk polygon data file to write.
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
protected:
vtkMCubesWriter();
~vtkMCubesWriter();
......@@ -57,6 +72,11 @@ protected:
void WriteLimits(FILE *fp, double *bounds);
char *LimitsFileName;
char *FileName;
virtual int FillInputPortInformation(int port, vtkInformation *info);
private:
vtkMCubesWriter(const vtkMCubesWriter&); // Not implemented.
void operator=(const vtkMCubesWriter&); // Not implemented.
......
......@@ -17,6 +17,7 @@
#include "vtkByteSwap.h"
#include "vtkCellArray.h"
#include "vtkErrorCode.h"
#include "vtkInformation.h"
#include "vtkObjectFactory.h"
#include "vtkPolyData.h"
#include "vtkTriangle.h"
......@@ -35,6 +36,8 @@ static char header[]="Visualization Toolkit generated SLA File
vtkSTLWriter::vtkSTLWriter()
{
this->FileType = VTK_ASCII;
this->FileName = NULL;
this->Header = new char[257];
strcpy(this->Header, header);
}
......@@ -281,3 +284,22 @@ void vtkSTLWriter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
//----------------------------------------------------------------------------
vtkPolyData* vtkSTLWriter::GetInput()
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput());
}
//----------------------------------------------------------------------------
vtkPolyData* vtkSTLWriter::GetInput(int port)
{
return vtkPolyData::SafeDownCast(this->Superclass::GetInput(port));
}
//----------------------------------------------------------------------------
int vtkSTLWriter::FillInputPortInformation(int, vtkInformation *info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
return 1;
}
......@@ -27,23 +27,55 @@
#define __vtkSTLWriter_h
#include "vtkIOGeometryModule.h" // For export macro
#include "vtkPolyDataWriter.h"
#include "vtkWriter.h"
class VTKIOGEOMETRY_EXPORT vtkSTLWriter : public vtkPolyDataWriter
class vtkCellArray;
class vtkPoints;
class vtkPolyData;
class VTKIOGEOMETRY_EXPORT vtkSTLWriter : public vtkWriter
{
public:
static vtkSTLWriter *New();
vtkTypeMacro(vtkSTLWriter,vtkPolyDataWriter);
vtkTypeMacro(vtkSTLWriter,vtkWriter);
virtual void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get the input to this writer.
vtkPolyData* GetInput();
vtkPolyData* GetInput(int port);
// Description:
// Specify file name of vtk polygon data file to write.
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
// Description:
// Specify file type (ASCII or BINARY) for vtk data file.
vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
vtkGetMacro(FileType,int);
void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
protected:
vtkSTLWriter();
~vtkSTLWriter() {};
~vtkSTLWriter()
{
delete[] this->FileName;
delete[] this->Header;
}
void WriteData();
void WriteBinarySTL(vtkPoints *pts, vtkCellArray *polys);
void WriteAsciiSTL(vtkPoints *pts, vtkCellArray *polys);
char* FileName;
char *Header;
int FileType;
virtual int FillInputPortInformation(int port, vtkInformation *info);
private:
vtkSTLWriter(const vtkSTLWriter&); // Not implemented.
void operator=(const vtkSTLWriter&); // Not implemented.
......
......@@ -6,6 +6,7 @@ vtk_module(vtkIOInfovis
vtkCommonSystem
vtkCommonMisc
vtkIOCore
vtkIOLegacy
vtkInfovisCore
vtklibxml2
TEST_DEPENDS
......
SET(Module_SRCS
vtkCompositeDataReader.cxx
vtkCompositeDataWriter.cxx
vtkDataObjectReader.cxx
vtkDataObjectWriter.cxx
vtkDataReader.cxx
vtkDataSetReader.cxx
vtkDataSetWriter.cxx
vtkDataWriter.cxx
vtkGenericDataObjectReader.cxx
vtkGenericDataObjectWriter.cxx
vtkGraphReader.cxx
vtkGraphWriter.cxx
vtkPolyDataReader.cxx
vtkPolyDataWriter.cxx
vtkRectilinearGridReader.cxx
vtkRectilinearGridWriter.cxx
vtkSimplePointsReader.cxx
vtkSimplePointsWriter.cxx
vtkStructuredGridReader.cxx
vtkStructuredGridWriter.cxx
vtkStructuredPointsReader.cxx
vtkStructuredPointsWriter.cxx
vtkTableReader.cxx
vtkTableWriter.cxx
vtkTreeReader.cxx
vtkTreeWriter.cxx
vtkUnstructuredGridReader.cxx
vtkUnstructuredGridWriter.cxx
)
vtk_module_library(vtkIOLegacy ${Module_SRCS})
vtk_module(vtkIOLegacy
GROUPS
StandAlone
DEPENDS
vtkCommonDataModel
vtkCommonSystem
vtkCommonMisc
vtkIOCore
)
......@@ -18,7 +18,7 @@
#ifndef __vtkCompositeDataReader_h
#define __vtkCompositeDataReader_h
#include "vtkIOGeometryModule.h" // For export macro
#include "vtkIOLegacyModule.h" // For export macro
#include "vtkDataReader.h"
class vtkCompositeDataSet;
......@@ -28,7 +28,7 @@ class vtkMultiPieceDataSet;
class vtkNonOverlappingAMR;
class vtkOverlappingAMR;
class VTKIOGEOMETRY_EXPORT vtkCompositeDataReader : public vtkDataReader
class VTKIOLEGACY_EXPORT vtkCompositeDataReader : public vtkDataReader
{
public:
static vtkCompositeDataReader* New();
......
......@@ -21,7 +21,7 @@
#ifndef __vtkCompositeDataWriter_h
#define __vtkCompositeDataWriter_h
#include "vtkIOGeometryModule.h" // For export macro
#include "vtkIOLegacyModule.h" // For export macro
#include "vtkDataWriter.h"
class vtkCompositeDataSet;
......@@ -31,7 +31,7 @@ class vtkMultiPieceDataSet;
class vtkNonOverlappingAMR;
class vtkOverlappingAMR;
class VTKIOGEOMETRY_EXPORT vtkCompositeDataWriter : public vtkDataWriter
class VTKIOLEGACY_EXPORT vtkCompositeDataWriter : public vtkDataWriter
{
public:
static vtkCompositeDataWriter* New();
......
......@@ -28,12 +28,12 @@
#ifndef __vtkDataObjectReader_h
#define __vtkDataObjectReader_h
#include "vtkIOCoreModule.h" // For export macro
#include "vtkIOLegacyModule.h" // For export macro
#include "vtkDataReader.h"
class vtkDataObject;
class VTKIOCORE_EXPORT vtkDataObjectReader : public vtkDataReader
class VTKIOLEGACY_EXPORT vtkDataObjectReader : public vtkDataReader
{
public:
static vtkDataObjectReader *New();
......@@ -59,5 +59,3 @@ private:
};
#endif
......@@ -27,12 +27,12 @@
#ifndef __vtkDataObjectWriter_h
#define __vtkDataObjectWriter_h
#include "vtkIOCoreModule.h" // For export macro
#include "vtkIOLegacyModule.h" // For export macro
#include "vtkWriter.h"
#include "vtkDataWriter.h" // Needs data because it calls methods on it
#include "vtkStdString.h" // For string used in api
class VTKIOCORE_EXPORT vtkDataObjectWriter : public vtkWriter
class VTKIOLEGACY_EXPORT vtkDataObjectWriter : public vtkWriter
{
public:
static vtkDataObjectWriter *New();
......
......@@ -26,7 +26,7 @@
#ifndef __vtkDataReader_h
#define __vtkDataReader_h
#include "vtkIOCoreModule.h" // For export macro
#include "vtkIOLegacyModule.h" // For export macro
#include "vtkAlgorithm.h"
#include "vtkStdString.h" // For API using strings
......@@ -43,7 +43,7 @@ class vtkPointSet;
class vtkRectilinearGrid;
class vtkTable;
class VTKIOCORE_EXPORT vtkDataReader : public vtkAlgorithm
class VTKIOLEGACY_EXPORT vtkDataReader : public vtkAlgorithm
{
public:
static vtkDataReader *New();
......@@ -437,5 +437,3 @@ private:
};
#endif
......@@ -31,7 +31,7 @@
#ifndef __vtkDataSetReader_h
#define __vtkDataSetReader_h
#include "vtkIOGeometryModule.h" // For export macro
#include "vtkIOLegacyModule.h" // For export macro
#include "vtkDataReader.h"
class vtkDataSet;
......@@ -41,7 +41,7 @@ class vtkStructuredGrid;
class vtkStructuredPoints;
class vtkUnstructuredGrid;
class VTKIOGEOMETRY_EXPORT vtkDataSetReader : public vtkDataReader
class VTKIOLEGACY_EXPORT vtkDataSetReader : public vtkDataReader
{
public:
static vtkDataSetReader *New();
......@@ -90,5 +90,3 @@ private:
};
#endif
......@@ -21,10 +21,10 @@
#ifndef __vtkDataSetWriter_h
#define __vtkDataSetWriter_h
#include "vtkIOGeometryModule.h" // For export macro
#include "vtkIOLegacyModule.h" // For export macro
#include "vtkDataWriter.h"
class VTKIOGEOMETRY_EXPORT vtkDataSetWriter : public vtkDataWriter
class VTKIOLEGACY_EXPORT vtkDataSetWriter : public vtkDataWriter
{
public:
static vtkDataSetWriter *New();
......@@ -50,5 +50,3 @@ private:
};
#endif
......@@ -26,7 +26,7 @@
#ifndef __vtkDataWriter_h
#define __vtkDataWriter_h