[vtkusers] usage of vtkCompositePolyDataMapper
Clinton Stimpson
clinton at elemtech.com
Tue Aug 25 22:51:34 EDT 2009
Then maybe you're missing a
compositeDataSet->Modified();
after you fill it up with data.
Clint
On 08/25/2009 08:04 PM, Alex Malyushytskyy wrote:
> Clinton ,
>
> Thanks a lot for suggestion.
>
> But for some reason using GetProducerPort() did not work - nothing is shown.
> If I create vtkCompositeDataGeometryFilter and use it GetOutputPort( 0
> ) to provide port for
> compositePolyDatamapperMapper->SetInputConnection, as in the code
> below, it does.
>
> If anybody could provide better solution, I would appreciate it.
>
>
> Regards,
> Alex
>
>
> // create renderer, attach to window
>
> ren = vtkSmartPointer<vtkRenderer>::New();
>
> this->GetRenderWindow()->AddRenderer( ren );
> initBackground();
>
>
> compositeDataSet = vtkSmartPointer<vtkMultiBlockDataSet>::New();
>
> // geometry filter
> vtkSmartPointer<vtkCompositeDataGeometryFilter> geom =
> vtkSmartPointer<vtkCompositeDataGeometryFilter>::New();
> geom->SetInput( compositeDataSet );
>
> // mapper
> compositePolyDatamapperMapper =
> vtkSmartPointer<vtkCompositePolyDataMapper>::New();
> compositePolyDatamapperMapper->SetInputConnection(0,
> geom->GetOutputPort( 0 ) ); // This works
> // compositePolyDatamapperMapper->SetInputConnection(0,
> compositeDataSet->GetProducerPort() ); // this does not work
>
> // actor
> lodActor = vtkSmartPointer<vtkLODActor>::New();
> lodActor->SetMapper( compositePolyDatamapperMapper );
> ren->AddActor(lodActor );
>
> // fill the composite data set, render, update window
> createRegionFromStl();
>
>
> On Tue, Aug 25, 2009 at 5:04 PM, Clinton Stimpson<cjstimpson at gmail.com> wrote:
>
>> On 08/25/2009 05:34 PM, Alex Malyushytskyy wrote:
>>
>>> 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 ?
>>>
>>>
>>>
>> You can use vtkMultiBlockDataSet::GetProducerPort() as an argument to
>> vtkCompositePolyDataMapper::SetInputConnection().
>>
>> Clint
>>
>>
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list