Medical Imaging Interaction Toolkit  2018.4.99-eed36131
Medical Imaging Interaction Toolkit
mitkGLMapper.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkGLMapper.h"
14 #include "mitkGL.h"
15 
17 {
18 }
19 
21 {
22 }
23 
25 {
26  bool visible = true;
27 
28  GetDataNode()->GetVisibility(visible, renderer, "visible");
29 
30  if (!visible)
31  return;
32 
33  // the if-condition ensures that Paint(renderer) is only called once, otherwise it will be called four times
34  // it does not mean that OpenGL renders only an opaque scene
36  Paint(renderer);
37 }
38 
40 {
41  return false;
42 }
43 
45 {
46  float rgba[4] = {1.0f, 1.0f, 1.0f, 1.0f};
47  // check for color prop and use it for rendering if it exists
48  GetDataNode()->GetColor(rgba, renderer, "color");
49  // check for opacity prop and use it for rendering if it exists
50  GetDataNode()->GetOpacity(rgba[3], renderer, "opacity");
51 
52  glColor4fv(rgba);
53 }
virtual DataNode * GetDataNode() const
Get the DataNode containing the data to map. Method only returns valid DataNode Pointer if the mapper...
Definition: mitkMapper.cpp:31
Organizes the rendering process.
bool GetOpacity(float &opacity, const mitk::BaseRenderer *renderer, const char *propertyKey="opacity") const
Convenience access method for opacity properties (instances of FloatProperty)
void MitkRender(mitk::BaseRenderer *renderer, mitk::VtkPropRenderer::RenderType type) override
Checks visibility and calls the paint method.
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty)
void ApplyColorAndOpacityProperties(mitk::BaseRenderer *renderer, vtkActor *actor=nullptr) override
Apply color and opacity properties read from the PropertyList. The actor is not used in the GLMappers...
bool GetVisibility(bool &visible, const mitk::BaseRenderer *renderer, const char *propertyKey="visible") const
Convenience access method for visibility properties (instances of BoolProperty with property-key "vis...
Definition: mitkDataNode.h:421
GLMapper()
Returns whether this mapper allows picking in the renderwindow virtual bool IsPickable() const { retu...
~GLMapper() override
virtual void Paint(mitk::BaseRenderer *renderer)=0
Do the painting into the renderer.
virtual bool IsVtkBased() const override
Returns whether this is a vtk-based mapper.