38 if (!m_ForegroundRenderer[renderer])
41 vtkRenderer *rendererVtk = m_ForegroundRenderer[renderer];
42 rendererVtk->SetActiveCamera(renderer->GetVtkRenderer()->GetActiveCamera());
44 rendererVtk->SetInteractive(
false);
46 std::pair<BaseRendererSet::iterator, bool> inSet;
47 inSet = m_BaseRendererSet.insert(renderer);
50 OverlaySet::const_iterator it;
51 for (it = m_OverlaySet.cbegin(); it != m_OverlaySet.cend(); ++it)
53 if ((*it)->IsForceInForeground())
54 (*it)->AddToRenderer(renderer, m_ForegroundRenderer[renderer]);
56 (*it)->AddToBaseRenderer(renderer);
66 vtkRenderer *forgroundRenderer = m_ForegroundRenderer[renderer];
67 OverlaySet::const_iterator it;
68 for (it = m_OverlaySet.cbegin(); it != m_OverlaySet.cend(); ++it)
70 (*it)->RemoveFromBaseRenderer(renderer);
71 if (forgroundRenderer)
72 (*it)->RemoveFromRenderer(renderer, forgroundRenderer);
75 BaseRendererSet::const_iterator i = m_BaseRendererSet.find(renderer);
76 if (i == m_BaseRendererSet.cend())
79 m_BaseRendererSet.erase(i);
81 m_ForegroundRenderer[renderer] = NULL;
86 BaseRendererSet::const_iterator it;
87 for (it = m_BaseRendererSet.cbegin(); it != m_BaseRendererSet.cend(); ++it)
97 for (
auto renderwindow : renderwindows)
108 std::pair<OverlaySet::iterator, bool> inSet;
109 inSet = m_OverlaySet.insert(overlay);
112 BaseRendererSet::const_iterator it;
113 for (it = m_BaseRendererSet.cbegin(); it != m_BaseRendererSet.cend(); ++it)
115 if (ForceInForeground)
117 vtkRenderer *forgroundRenderer = m_ForegroundRenderer[*it];
118 overlay->AddToRenderer(*it, forgroundRenderer);
121 overlay->AddToBaseRenderer(*it);
122 this->InvokeEvent(OverlayAddEvent());
129 std::pair<OverlaySet::iterator, bool> inSet;
130 inSet = m_OverlaySet.insert(overlay);
133 if (ForceInForeground)
135 vtkRenderer *forgroundRenderer = m_ForegroundRenderer[renderer];
136 overlay->AddToRenderer(renderer, forgroundRenderer);
139 overlay->AddToBaseRenderer(renderer);
140 this->InvokeEvent(OverlayAddEvent());
146 OverlaySet::const_iterator overlayIt = m_OverlaySet.find(overlay);
147 if (overlayIt == m_OverlaySet.cend())
150 BaseRendererSet::const_iterator it;
151 for (it = m_BaseRendererSet.cbegin(); it != m_BaseRendererSet.cend(); ++it)
153 overlay->RemoveFromBaseRenderer(*it);
154 vtkRenderer *forgroundRenderer = m_ForegroundRenderer[*it];
155 if (forgroundRenderer)
156 overlay->RemoveFromRenderer(*it, forgroundRenderer);
159 m_OverlaySet.erase(overlayIt);
160 this->InvokeEvent(OverlayAddEvent());
165 while (!m_OverlaySet.empty())
171 OverlaySet::const_iterator it;
172 for (it = m_OverlaySet.cbegin(); it != m_OverlaySet.cend(); ++it)
174 (*it)->Update(baseRenderer);
184 if (layouter.IsNull())
186 MITK_WARN <<
"Layouter " << identifier <<
" cannot be found or created!";
191 layouter->AddOverlay(overlay);
198 const LayouterMap layouters = m_LayouterMap[renderer];
199 LayouterMap::const_iterator it;
200 for (it = layouters.cbegin(); it != layouters.cend(); ++it)
202 (it->second)->PrepareLayout();
214 if (layouter.IsNotNull())
217 m_LayouterMap[layouter->GetBaseRenderer()][layouter->GetIdentifier()];
218 if (oldLayouter.IsNotNull() && oldLayouter.GetPointer() != layouter.GetPointer())
220 MITK_WARN <<
"Layouter " << layouter->GetIdentifier() <<
" does already exist!";
222 else if (oldLayouter.IsNull())
224 m_LayouterMap[layouter->GetBaseRenderer()][layouter->GetIdentifier()] = layouter;
itk::SmartPointer< Self > Pointer
itkEventMacroDefinition(OverlayAddEvent, itk::AnyEvent) OverlayManager
void AddLayouter(const AbstractOverlayLayouter::Pointer &layouter)
Add a layouter to provide it with the use of the SetLayouter method.
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
static OverlayManager * GetInstance()
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
std::set< Overlay::Pointer > OverlaySet
AbstractOverlayLayouter::Pointer GetLayouter(BaseRenderer *renderer, const std::string &identifier)
Returns the Layouter specified by renderer and the identifier.
static VtkLayerController * GetInstance(vtkSmartPointer< vtkRenderWindow > renWin)
void RemoveOverlay(const Overlay::Pointer &overlay)
void RemoveAllBaseRenderers()
static RenderingManager * GetInstance()
void SetLayouter(Overlay *overlay, const std::string &identifier, BaseRenderer *renderer)
Adds the overlay to the layouter specified by identifier and renderer.
void RemoveBaseRenderer(mitk::BaseRenderer *renderer)
itk::SmartPointer< OverlayManager > GetOverlayManager()
Get the OverlayManager registered with this renderer if none was set, it will be created at this poin...
void AddBaseRenderer(BaseRenderer *renderer)
std::map< const std::string, AbstractOverlayLayouter::Pointer > LayouterMap
Base class for all overlays.
void UpdateLayouts(BaseRenderer *renderer)
Calls all layouters to update the position and size of the registered Overlays.
void AddOverlay(const Overlay::Pointer &overlay, bool ForceInForeground=true)
void UpdateOverlays(BaseRenderer *baseRenderer)
The layout of each Overlay will be prepared and the properties of each Overlay is updated...
void RemoveAllOverlays()
Clears the manager of all Overlays.
const RenderWindowVector & GetAllRegisteredRenderWindows()
const OverlaySet & GetAllOverlays()
The OverlayManager updates and manages Overlays and the respective Layouters.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.