ParaView/Extending ParaView at Compile Time
Plugins can be used to extend ParaView functionality. However, that requires that ParaView is built with shared libraries. It is also possible to extend ParaView at compile time by compiling extra source into it. This documents describes how that can be done.
Let's say we have a file format called MyFancy and we require a reader for it. The file format is something completely new, so we cannot reuse any other class. So we write our own VTK reader and now we want to use it in the ParaView. Let's say the header file for the reader looks like this:
<source lang="cpp">
- ifndef __vtkMyFancyReader_h
- define __vtkMyFancyReader_h
- include "vtkUnstructuredGridAlgorithm.h"
...
class VTK_EXPORT vtkMyFancyReader : public vtkUnstructuredGridAlgorithm { public:
static vtkMyFancyReader *New(); vtkTypeMacro(vtkMyFancyReader,vtkUnstructuredGridAlgorithm); void PrintSelf(ostream& os, vtkIndent indent);
// Description: // Specify file name of the MyFancy file. vtkSetStringMacro(FileName); vtkGetStringMacro(FileName);
// Description: // Which TimeStep to read. vtkSetMacro(TimeStep, int); vtkGetMacro(TimeStep, int);
vtkGetVector2Macro(TimeStepRange, int);
...
protected:
vtkMyFancyReader(); ~vtkMyFancyReader();
...
private:
vtkMyFancyReader(const vtkMyFancyReader&); // Not implemented void operator=(const vtkMyFancyReader&); // Not implemented
};
- endif
</source>
Creating the server manager XML is also necessary, and can be done as described above. Readers, Writers, and Filters also require additional GUI side XML to describe file extensions associated with those file types.
<ParaViewReaders> <Reader name="MyFancyReader" extensions="myfan" file_description="My Fancy Files"> </Reader> </ParaViewReaders>
<ParaViewFilters> <Filter name="MyFancyFilter" /> </ParaViewFilters>