Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkSetVtkRendererVisitor.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 #include "mitkVtkModel.h"
19 
20 mitk::SetVtkRendererVisitor::SetVtkRendererVisitor(vtkRenderer* renderer, const sofa::core::ExecParams* params)
21  : Visitor(params),
22  m_VtkRenderer(renderer)
23 {
24 }
25 
27 {
28 }
29 
30 sofa::simulation::Visitor::Result mitk::SetVtkRendererVisitor::processNodeTopDown(sofa::simulation::Node* node)
31 {
32  for_each(this, node, node->visualModel, &SetVtkRendererVisitor::processVisualModel);
33  return RESULT_CONTINUE;
34 }
35 
36 void mitk::SetVtkRendererVisitor::processVisualModel(sofa::simulation::Node*, sofa::core::visual::VisualModel* visualModel)
37 {
38  VtkModel* vtkModel = dynamic_cast<VtkModel*>(visualModel);
39 
40  if (vtkModel != nullptr)
41  vtkModel->SetVtkRenderer(m_VtkRenderer);
42 }
Result processNodeTopDown(sofa::simulation::Node *node) override
void SetVtkRenderer(vtkRenderer *renderer)
SetVtkRendererVisitor(vtkRenderer *renderer, const sofa::core::ExecParams *params=sofa::core::ExecParams::defaultInstance())