diff --git a/Cxx/CompositeData/CMakeLists.txt b/Cxx/CompositeData/CMakeLists.txt index 5340171..707ae05 100644 --- a/Cxx/CompositeData/CMakeLists.txt +++ b/Cxx/CompositeData/CMakeLists.txt @@ -36,6 +36,8 @@ ADD_TEST(${KIT}-CompositePolyDataMapper ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KIT} TestCompositePolyDataMapper) ADD_TEST(${KIT}-MultiBlockDataSet ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KIT}CxxTests TestMultiBlockDataSet) +ADD_TEST(${KIT}-MultiBlockDataGroupFilter ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KIT}CxxTests + TestMultiBlockDataGroupFilter) INCLUDE(${WikiExamples_SOURCE_DIR}/CMake/ExamplesTesting.cmake) diff --git a/Cxx/CompositeData/MultiBlockDataGroupFilter.cxx b/Cxx/CompositeData/MultiBlockDataGroupFilter.cxx new file mode 100644 index 0000000..f4164c7 --- /dev/null +++ b/Cxx/CompositeData/MultiBlockDataGroupFilter.cxx @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main( int argc, char *argv[] ) +{ + vtkNew groupFilter; + // The vtkMultiBlockDataGroupFilter allows multiple inputs and adds + // each input as a block in its output multiblock dataset. + for (int i = 0; i < 5; ++i) + { + for (int j = 0; j < 5; ++j) + { + vtkNew sphere; + sphere->SetCenter(2 * i, 2 * j,0); + sphere->SetRadius((50 - (i * i) - (j * j)) / 52.4); + groupFilter->AddInputConnection(sphere->GetOutputPort()); + } + } + + vtkNew mapper; + mapper->SetInputConnection(groupFilter->GetOutputPort()); + + vtkNew actor; + actor->SetMapper(mapper.Get()); + + vtkNew renderer; + vtkNew renderWindow; + renderWindow->AddRenderer(renderer.Get()); + vtkNew renderWindowInteractor; + renderWindowInteractor->SetRenderWindow(renderWindow.Get()); + + renderer->AddActor(actor.Get()); + + renderWindow->Render(); + renderWindowInteractor->Start(); + + return EXIT_SUCCESS; +}