[vtkusers] how to derive vtkPloyDataAlgorithm class

normanius juch at zhaw.ch
Sat Jan 2 07:11:23 EST 2016


Hi Chiang

Happy new year to you too.

I'd go by example. Have a look at vtkClipPolyData.cxx, which derives from
vtkPolyDataAlgorithm. In essence, only vtkPolyDataAlgorithm::RequestData()
has to be overridden by the subclass, that's where all the functionality of
an algorithm is supposed to go. 

The input and output data is contained in generic containers that are passed
as function arguments.


inputVector represents what you feed to the algorithm, typically by using
vtkAlgorithm::SetInputConnection(), vtkAlgorithm::SetInputData(),
vtkAlgorithm::GetOutputPort(), etc. You are supposed to access the data in
the following way.


You have the chance to notify the progress by calling
vtkAlgorithm::UpdateProgress().
You can check if the user requested the termination of an algorithm by
checking the value of vtkAlgorithm::GetAbortExecute().

Besides that, make sure to first carefully read through the documentation of 
vtkPolyDataAlgorithm
<http://www.vtk.org/doc/nightly/html/classvtkPolyDataAlgorithm>   and 
vtkAlgorithm <http://www.vtk.org/doc/nightly/html/classvtkAlgorithm.html>  .
The implementation of the  vtkAlgorithm.cxx
<https://github.com/Kitware/VTK/blob/master/Common/ExecutionModel/vtkAlgorithm.cxx>  
and  vtkPolyDataAlgorithm.cxx
<https://github.com/Kitware/VTK/blob/master/Common/ExecutionModel/vtkPolyDataAlgorithm.cxx>  
may also serve as reference.

I hope this helped.
Norman



--
View this message in context: http://vtk.1045678.n5.nabble.com/how-to-derive-vtkPloyDataAlgorithm-class-tp5735719p5735730.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list