ParaView/Extending ParaView at Compile Time: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(New page: 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 compil...)
 
No edit summary
Line 23: Line 23:
   vtkSetStringMacro(FileName);
   vtkSetStringMacro(FileName);
   vtkGetStringMacro(FileName);
   vtkGetStringMacro(FileName);
  // Description:
  // Which TimeStep to read.   
  vtkSetMacro(TimeStep, int);
  vtkGetMacro(TimeStep, int);
  vtkGetVector2Macro(TimeStepRange, int);


   ...
   ...
Line 47: Line 40:
</source>
</source>


Creating the server manager XML is also necessary, and can be done as described above.
First, we need to write the server manager configuration XML describing the interface.
 
<source lang="xml">
  <ServerManagerConfiguration>
    <ProxyGroup name="sources">
      <SourceProxy name="MyFancyReader"
                  class="vtkMyFanceReader">
        <StringVectorProperty name="FileName"
                              command="SetFileName"
                              number_of_elements="1">
          <FileListDomain name="files"/>
          <Documentation>
            This property specifies the file name for the PNG reader.
          </Documentation>
        </StringVectorProperty>
      </SourceProxy>
  </ProxyGroup>
</ServerManagerConfiguration>
</source>
 
Readers, Writers, and Filters also require additional GUI side XML to describe file extensions associated with those file types.
Readers, Writers, and Filters also require additional GUI side XML to describe file extensions associated with those file types.



Revision as of 21:01, 11 September 2008

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">

  1. ifndef __vtkMyFancyReader_h
  2. define __vtkMyFancyReader_h
  1. 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);
 ...

protected:

 vtkMyFancyReader();
 ~vtkMyFancyReader();
 ...

private:

 vtkMyFancyReader(const vtkMyFancyReader&); // Not implemented
 void operator=(const vtkMyFancyReader&); // Not implemented

};

  1. endif

</source>

First, we need to write the server manager configuration XML describing the interface.

<source lang="xml">

 <ServerManagerConfiguration>
   <ProxyGroup name="sources">
     <SourceProxy name="MyFancyReader" 
                  class="vtkMyFanceReader">
       <StringVectorProperty name="FileName"
                             command="SetFileName"
                             number_of_elements="1">
          <FileListDomain name="files"/>
         <Documentation>
           This property specifies the file name for the PNG reader.
         </Documentation>
       </StringVectorProperty>
     </SourceProxy>
 </ProxyGroup>

</ServerManagerConfiguration> </source>

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>