[vtkusers] usage of vtkCompositePolyDataMapper

Alex Malyushytskyy alexmalvtk at gmail.com
Tue Aug 25 19:34:10 EDT 2009


I am new to VTK, so if you see problem with general design or logic
below, all comments are appreciated.

My application needs to display a set of geometrical blocks. Each
block is represented as a set of triangles.
I decided to create a vtkMultiBlockDataSet object with blocks defined
as vtkPolyData:

Assume the data is stored in:
      vtkSmartPointer<vtkMultiBlockDataSet> compositeDataSet;

Now I need to create and assign the mapper and actor.
I think I can have single mapper and actor,  because all the data is
the same type.

If it were just single vtkPolyData, I could write something like:

    vtkSmartPointer<vtkPolyData> polyData =
vtkSmartPointer<vtkPolyData>:: New();
    // fill poly data  here
      ..................

    // create mapper and actor
    vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
    mapper->SetInput( polyData );

    vtkLODActor *actor = vtkLODActor::New();
    actor->SetMapper(mapper);


I was looking for mapper which would work for poly data sets and found
vtkCompositePolyDataMapper.
But it is not clear for me how to use it in my case.

First of all vtkCompositePolyDataMapper seems does not have
SetInput( ) method.
It seems the only input can be specified is output of another filter with:

vtkCompositePolyDataMapper::SetInputConnection(int port,
vtkAlgorithmOutput* input);

But I don't have any filter at this point, only vtkMultiBlockDataSet
which contains vtkPolyData is available.

Does it mean I have to iterate through vtkMultiBlockDataSet  myself
and create mapper for each vtkPolyData, instead of using
vtkCompositePolyDataMapper or there is  a way to use
vtkCompositePolyDataMapper in such situation ?


Regards,
    Alex



More information about the vtkusers mailing list