With VTK >= 6, how to "choose" between SetInputData() or
SetInputConnection() ? How to know which one SHOULD be used ? I read carefully this http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Replacement_of_SetInput, and, I digged several VTK examples http://www.vtk.org/Wiki/VTK/Examples/Cxx... Lot of things clarified but I'am still confused in exercising this: I feel like I missed some major stuffs... To make it quick, my understanding is that : 1. If I need B to be modified if A is changed, I NEED to do "B->SetInputConnection(A->GetOutputPort())". 2. Otherwise, "B->SetInputData(A)" is enough (A will be an input of B BUT no link will be set between A and B : changing A does not trigger update of B). Up to here I guess (?) I'am right (at least for the big headlines)... Stop me here if not ! Now, I want to have a source (grid) and I need to apply a filter on it. Say that in a call back I modify the source: I want BOTH source and filter to be updated when call backs are modifying the source. Here is what I have: vtkSmartPointer<vtkUnstructuredGrid> spGrid = vtkSmartPointer<vtkUnstructuredGrid>::New(); // Source // Fill the source with points and cells... vtkSmartPointer<vtkVertexGlyphFilter> spVertexGlyphs = vtkSmartPointer<vtkVertexGlyphFilter>::New(); spVertexGlyphs->SetInputData(spGrid); // Case 2 vtkSmartPointer<vtkPolyDataMapper> spVertexGlyphMap = vtkSmartPointer<vtkPolyDataMapper>::New(); spVertexGlyphMap->SetInputConnection(spVertexGlyphs->GetOutputPort()); // Case 1 : the filter is updated if the source is modified. This seems to works: the filter is updated if the source is modified. But, this does NOT work: the source is NOT modified (= updated in the VTK window) when the callback modify it (so the filter may OR NOT be updated accordingly ?!). I expected to be compelled to do: vtkSmartPointer<vtkDataSetMapper> spGridMap = vtkSmartPointer<vtkDataSetMapper>::New(); spGridMap->SetInputConnection(spGrid->GetOutputPort()); // Compilation KO because there is not SetInputConnection or GetOutputPort ??? So I'am compelled to do (found lots of examples that do that): spGridMap->SetInputData(spGrid); ... And I end up with a grid that does NOT update in the VTK window when call back modify the source. I found a way to update it: the callback modify the grid and, at the end of the callback, I added "spGrid->Modified()", this triggers the update of the source. So basically, I did what I need ... But: 1. Is the "spGrid->Modified()" a hack ? Or is it the "right" way to do ? If yes, why (as it seems to bypass the update process) ? 2. Why is there no SetInputConnection on spGridMap ? Why is there no GetOutputPort on vtkUnstructuredGrid ? I just would like to understand the logic behind.... Franck _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Search the list archives at: http://markmail.org/search/?q=vtk-developers Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/vtk-developers |
Free forum by Nabble | Edit this page |