Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkSimulationService.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 
17 #include "mitkSimulationService.h"
18 #include <sofa/core/visual/VisualParams.h>
19 
21 {
22  if (activeSimulation.IsNull())
23  {
24  sofa::simulation::setSimulation(NULL);
25  sofa::core::visual::VisualParams::defaultInstance()->drawTool() = NULL;
26  }
27  else
28  {
29  sofa::simulation::Simulation::SPtr sofaSimulation = activeSimulation->GetSOFASimulation();
30 
31  if (sofaSimulation != sofa::simulation::getSimulation())
32  {
33  sofa::simulation::setSimulation(sofaSimulation.get());
34  sofa::core::visual::VisualParams::defaultInstance()->drawTool() = activeSimulation->GetDrawTool();
35  }
36  }
37 }
38 
40  : m_Scheduler(SchedulingAlgorithm::WeightedRoundRobin)
41 {
42 }
43 
45 {
46 }
47 
49 {
50  return m_ActiveSimulation;
51 }
52 
54 {
55  SwitchSimuluationContext(activeSimulation);
56  m_ActiveSimulation = activeSimulation;
57 }
58 
60 {
61  return &m_Scheduler;
62 }
Simulation::Pointer GetActiveSimulation() const override
void SetActiveSimulation(Simulation::Pointer activeSimulation) override
Scheduler * GetScheduler() override
static void SwitchSimuluationContext(mitk::Simulation::Pointer activeSimulation)