Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions

mitk::VtkPropRenderer Class Reference

VtkPropRenderer. More...

#include <mitkVtkPropRenderer.h>

Inheritance diagram for mitk::VtkPropRenderer:
Inheritance graph
[legend]
Collaboration diagram for mitk::VtkPropRenderer:
Collaboration graph
[legend]

List of all members.

Public Types

enum  RenderType { Opaque, Translucent, Overlay }
enum  PickingMode { WorldPointPicking, PointPicking }
typedef VtkPropRenderer Self
typedef BaseRenderer Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer
typedef std::map< int, Mapper * > MappersMapType

Public Member Functions

virtual const char * GetClassName () const
int Render (RenderType type)
 Called by the vtkMitkRenderProp in order to start MITK rendering process.
virtual void MakeCurrent ()
 Activates the current renderwindow.
virtual void SetDataStorage (mitk::DataStorage *storage)
 set the datastorage that will be used for rendering
virtual void InitRenderer (vtkRenderWindow *renderwindow)
 This method is called from the two Constructors.
virtual void Update (mitk::DataNode *datatreenode)
virtual void SetMapperID (const MapperSlotId mapperId)
 Set the MapperSlotId to use.
virtual void InitSize (int w, int h)
 Set the initial size. Called by RenderWindow after it has become visible for the first time.
virtual void Resize (int w, int h)
 Resize the OpenGL Window.
virtual void SetPickingMode (PickingMode _arg)
virtual PickingMode GetPickingMode ()
virtual void PickWorldPoint (const Point2D &displayPoint, Point3D &worldPoint) const
 Perform a picking: find the x,y,z world coordinate of a display x,y coordinate.
virtual mitk::DataNodePickObject (const Point2D &displayPosition, Point3D &worldPosition) const
 Determines the object (mitk::DataNode) closest to the current position by means of picking.
int WriteSimpleText (std::string text, double posX, double posY, double color1=0.0, double color2=1.0, double color3=0.0)
 Writes some 2D text as overlay. Function returns an unique int Text_ID for each call, which can be used via the GetTextLabelProperty(int text_id) function in order to get a vtkTextProperty. This property enables the setup of font, font size, etc.
vtkTextProperty * GetTextLabelProperty (int text_id)
 Can be used in order to get a vtkTextProperty for a specific text_id. This property enables the setup of font, font size, etc.
virtual bool SetWorldGeometryToDataStorageBounds ()
void InitPathTraversal ()
 Used by vtkPointPicker/vtkPicker. This will query a list of all objects in MITK and provide every vtk based mapper to the picker.
vtkAssemblyPath * GetNextPath ()
 Used by vtkPointPicker/vtkPicker. This will query a list of all objects in MITK and provide every vtk based mapper to the picker.
const vtkWorldPointPicker * GetWorldPointPicker () const
const vtkPointPicker * GetPointPicker () const
const vtkCellPicker * GetCellPicker () const
virtual void ReleaseGraphicsResources (vtkWindow *renWin)
 Release vtk-based graphics resources. Called by vtkMitkRenderProp::ReleaseGraphicsResources.

Static Public Member Functions

static Pointer New (const char *_arga, vtkRenderWindow *_argb, mitk::RenderingManager *_argc)
static bool useImmediateModeRendering ()

Protected Member Functions

 VtkPropRenderer (const char *name="VtkPropRenderer", vtkRenderWindow *renWin=NULL, mitk::RenderingManager *rm=NULL)
virtual ~VtkPropRenderer ()
 Destructs the VtkPropRenderer.
virtual void Update ()
 Call update of all mappers. To be implemented in subclasses.

Detailed Description

VtkPropRenderer.

VtkPropRenderer organizes the MITK rendering process. The MITK rendering process is completely integrated into the VTK rendering pipeline. The vtkMitkRenderProp is a custom vtkProp derived class, which implements the rendering interface between MITK and VTK. It redirects render() calls to the VtkPropRenderer, which is responsible for rendering of the datatreenodes. VtkPropRenderer replaces the old OpenGLRenderer.

See also:
rendering

Definition at line 58 of file mitkVtkPropRenderer.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::VtkPropRenderer::ConstPointer

Reimplemented from mitk::BaseRenderer.

Definition at line 69 of file mitkVtkPropRenderer.h.

Definition at line 70 of file mitkVtkPropRenderer.h.

typedef itk::SmartPointer<Self> mitk::VtkPropRenderer::Pointer

Reimplemented from mitk::BaseRenderer.

Definition at line 69 of file mitkVtkPropRenderer.h.

Standard class typedefs.

Reimplemented from mitk::BaseRenderer.

Definition at line 69 of file mitkVtkPropRenderer.h.

Reimplemented from mitk::BaseRenderer.

Definition at line 69 of file mitkVtkPropRenderer.h.


Member Enumeration Documentation

Enumerator:
WorldPointPicking 
PointPicking 

Definition at line 97 of file mitkVtkPropRenderer.h.

Enumerator:
Opaque 
Translucent 
Overlay 

Definition at line 78 of file mitkVtkPropRenderer.h.


Constructor & Destructor Documentation

mitk::VtkPropRenderer::VtkPropRenderer ( const char *  name = "VtkPropRenderer",
vtkRenderWindow *  renWin = NULL,
mitk::RenderingManager rm = NULL 
) [protected]

Definition at line 65 of file mitkVtkPropRenderer.cpp.

References mitk::BaseRenderer::m_CurrentWorldGeometry2DNode, mitk::BaseRenderer::m_VtkRenderer, New(), and WorldPointPicking.

  : BaseRenderer(name,renWin, rm), 
  m_VtkMapperPresent(false), 
  m_NewRenderer(true)
{
  didCount=false;

  m_WorldPointPicker = vtkWorldPointPicker::New();

  m_PointPicker = vtkPointPicker::New();
  m_PointPicker->SetTolerance( 0.0025 );

  m_CellPicker = vtkCellPicker::New();
  m_CellPicker->SetTolerance( 0.0025 );

  mitk::Geometry2DDataVtkMapper3D::Pointer geometryMapper = mitk::Geometry2DDataVtkMapper3D::New();
  m_CurrentWorldGeometry2DMapper = geometryMapper;
  m_CurrentWorldGeometry2DNode->SetMapper(2, geometryMapper);

  m_LightKit = vtkLightKit::New();
  m_LightKit->AddLightsToRenderer(m_VtkRenderer);
  m_PickingMode = WorldPointPicking;

  m_TextRenderer = vtkRenderer::New();
  m_TextRenderer->SetRenderWindow(renWin);
  m_TextRenderer->SetInteractive(0);
  #if ( VTK_MAJOR_VERSION >= 5 )
    m_TextRenderer->SetErase(0);
  #endif
}
mitk::VtkPropRenderer::~VtkPropRenderer (  ) [protected, virtual]

Destructs the VtkPropRenderer.

Definition at line 99 of file mitkVtkPropRenderer.cpp.

{
  // Workaround for GLDisplayList Bug
  {
    m_MapperID=0;
    checkState();
  }

  if (m_LightKit != NULL)
    m_LightKit->Delete();

  if (m_VtkRenderer!=NULL)
  {
    m_CameraController = NULL;

    m_VtkRenderer->Delete();

    m_VtkRenderer = NULL;
  }
  else
    m_CameraController = NULL;

  if (m_WorldPointPicker != NULL)
    m_WorldPointPicker->Delete();
  if (m_PointPicker != NULL)
    m_PointPicker->Delete();
  if (m_CellPicker != NULL)
    m_CellPicker->Delete();
  if (m_TextRenderer != NULL)
    m_TextRenderer->Delete();
}

Member Function Documentation

const vtkCellPicker * mitk::VtkPropRenderer::GetCellPicker (  ) const

Definition at line 740 of file mitkVtkPropRenderer.cpp.

{
  return m_CellPicker;
}
virtual const char* mitk::VtkPropRenderer::GetClassName (  ) const [virtual]

Reimplemented from mitk::BaseRenderer.

vtkAssemblyPath * mitk::VtkPropRenderer::GetNextPath (  )

Used by vtkPointPicker/vtkPicker. This will query a list of all objects in MITK and provide every vtk based mapper to the picker.

Definition at line 653 of file mitkVtkPropRenderer.cpp.

References mitk::DataNode::GetMapper(), mitk::VtkMapper3D::GetVtkProp(), and mitk::BaseRenderer::Standard3D.

{
  if (m_DataStorage.IsNull() )
  {
    return NULL;
  }

  if ( m_PickingObjectsIterator == m_PickingObjects->end() )
  {
    return NULL;
  }

  vtkAssemblyPath* returnPath = vtkAssemblyPath::New();
  //returnPath->Register(NULL);

  bool success = false;
 
  while (!success)
  {
    // loop until AddNode can be called successfully
    const DataNode* node = *m_PickingObjectsIterator;
    if (node)
    {
      Mapper* mapper = node->GetMapper( BaseRenderer::Standard3D );
      if (mapper)
      {
        VtkMapper3D* vtkmapper = dynamic_cast<VtkMapper3D*>( mapper );
        if (vtkmapper)
        {
          vtkProp* prop = vtkmapper->GetVtkProp(this);
          if ( prop && prop->GetVisibility() )
          {
            // add to assembly path
            returnPath->AddNode( prop, prop->GetMatrix() );
            success = true;
          }
        }
      }
    }

    ++m_PickingObjectsIterator;

    if ( m_PickingObjectsIterator == m_PickingObjects->end() ) break;
  }

  if ( success )
  {
    return returnPath;
  }
  else
  {
    return NULL;
  }
}
virtual PickingMode mitk::VtkPropRenderer::GetPickingMode (  ) [virtual]
const vtkPointPicker * mitk::VtkPropRenderer::GetPointPicker (  ) const

Definition at line 734 of file mitkVtkPropRenderer.cpp.

{
  return m_PointPicker;
}
vtkTextProperty * mitk::VtkPropRenderer::GetTextLabelProperty ( int  text_id )

Can be used in order to get a vtkTextProperty for a specific text_id. This property enables the setup of font, font size, etc.

Definition at line 637 of file mitkVtkPropRenderer.cpp.

{
  return this->m_TextCollection[text_id]->GetTextProperty();
}
const vtkWorldPointPicker * mitk::VtkPropRenderer::GetWorldPointPicker (  ) const

Definition at line 728 of file mitkVtkPropRenderer.cpp.

{
  return m_WorldPointPicker;
}
void mitk::VtkPropRenderer::InitPathTraversal (  )

Used by vtkPointPicker/vtkPicker. This will query a list of all objects in MITK and provide every vtk based mapper to the picker.

Definition at line 643 of file mitkVtkPropRenderer.cpp.

{
  if (m_DataStorage.IsNotNull())
  {
    m_PickingObjects = m_DataStorage->GetAll();
    m_PickingObjectsIterator = m_PickingObjects->begin();
  }
}
void mitk::VtkPropRenderer::InitRenderer ( vtkRenderWindow *  renderwindow ) [virtual]

This method is called from the two Constructors.

Reimplemented from mitk::BaseRenderer.

Definition at line 407 of file mitkVtkPropRenderer.cpp.

References mitk::BaseRenderer::InitRenderer().

{
  BaseRenderer::InitRenderer(renderWindow);

  if(renderWindow == NULL)
  {
    m_InitNeeded = false;
    m_ResizeNeeded = false;
    return;
  }

  m_InitNeeded = true;
  m_ResizeNeeded = true;

  m_LastUpdateTime = 0;

}
void mitk::VtkPropRenderer::InitSize ( int  w,
int  h 
) [virtual]

Set the initial size. Called by RenderWindow after it has become visible for the first time.

Reimplemented from mitk::BaseRenderer.

Definition at line 437 of file mitkVtkPropRenderer.cpp.

{
  m_RenderWindow->SetSize(w,h);
  Superclass::InitSize(w, h);
  Modified();
  Update();
  if(m_VtkRenderer!=NULL)
  {
    int w=vtkObject::GetGlobalWarningDisplay();
    vtkObject::GlobalWarningDisplayOff();
    m_VtkRenderer->ResetCamera();
    vtkObject::SetGlobalWarningDisplay(w);
  }
}
void mitk::VtkPropRenderer::MakeCurrent (  ) [virtual]

Activates the current renderwindow.

Definition at line 466 of file mitkVtkPropRenderer.cpp.

{
  if(m_RenderWindow!=NULL)
     m_RenderWindow->MakeCurrent();
}
static Pointer mitk::VtkPropRenderer::New ( const char *  _arga,
vtkRenderWindow *  _argb,
mitk::RenderingManager _argc 
) [inline, static]
mitk::DataNode * mitk::VtkPropRenderer::PickObject ( const Point2D &  ,
Point3D &   
) const [virtual]

Determines the object (mitk::DataNode) closest to the current position by means of picking.

Warning:
Implementation currently empty for 2D rendering; intended to be implemented for 3D renderers

Reimplemented from mitk::BaseRenderer.

Definition at line 535 of file mitkVtkPropRenderer.cpp.

References mitk::DataNode::GetBoolProperty(), mitk::DataNode::GetMapper(), and mitk::VtkMapper3D::GetVtkProp().

{
  if ( m_VtkMapperPresent )
  {
    m_CellPicker->InitializePickList();

    // Iterate over all DataStorage objects to determine all vtkProps intended
    // for picking
    DataStorage::SetOfObjects::ConstPointer allObjects = m_DataStorage->GetAll();
    for ( DataStorage::SetOfObjects::ConstIterator it = allObjects->Begin();
          it != allObjects->End(); 
          ++it )
    {
      DataNode *node = it->Value();
      if ( node == NULL )
        continue;

      bool pickable = false;
      node->GetBoolProperty( "pickable", pickable );
      if ( !pickable )
        continue;

      VtkMapper3D *mapper = dynamic_cast< VtkMapper3D * >
        ( node->GetMapper( m_MapperID ) );
      if ( mapper == NULL )
        continue;

      vtkProp *prop = mapper->GetVtkProp( (mitk::BaseRenderer *)this );
      if ( prop == NULL )
        continue;

      m_CellPicker->AddPickList( prop );
    }  


    // Do the picking and retrieve the picked vtkProp (if any)
    m_CellPicker->PickFromListOn();
    m_CellPicker->Pick( displayPosition[0], displayPosition[1], 0.0, m_VtkRenderer );
    m_CellPicker->PickFromListOff();

    vtk2itk( m_CellPicker->GetPickPosition(), worldPosition );
    vtkProp *prop = m_CellPicker->GetViewProp();
  
    if ( prop == NULL )
    {
      return NULL;
    }

    // Iterate over all DataStorage objects to determine if the retrieved
    // vtkProp is owned by any associated mapper.
    for ( DataStorage::SetOfObjects::ConstIterator it = allObjects->Begin();
          it != allObjects->End(); 
          ++it)
    {
      DataNode::Pointer node = it->Value();
      if ( node.IsNull() )
        continue;

      mitk::Mapper::Pointer mapper = node->GetMapper( m_MapperID );
      if ( mapper.IsNull() )
        continue;

      if ( mapper->HasVtkProp( prop, const_cast< mitk::VtkPropRenderer * >( this ) ) )
      {
        return node;
      }
    }  

    return NULL;
  }
  else
  {
    return Superclass::PickObject( displayPosition, worldPosition ); 
  }
};
virtual void mitk::VtkPropRenderer::PickWorldPoint ( const Point2D &  diplayPosition,
Point3D &  worldPosition 
) const [virtual]

Perform a picking: find the x,y,z world coordinate of a display x,y coordinate.

Warning:
Has to be overwritten in subclasses for the 3D-case.

Implemented here only for 2D-rendering by using m_DisplayGeometry

Reimplemented from mitk::BaseRenderer.

void mitk::VtkPropRenderer::ReleaseGraphicsResources ( vtkWindow *  renWin ) [virtual]

Release vtk-based graphics resources. Called by vtkMitkRenderProp::ReleaseGraphicsResources.

Definition at line 709 of file mitkVtkPropRenderer.cpp.

{
  if( m_DataStorage.IsNull() )
    return;

  DataStorage::SetOfObjects::ConstPointer allObjects = m_DataStorage->GetAll();
  for (DataStorage::SetOfObjects::const_iterator iter = allObjects->begin(); iter != allObjects->end(); ++iter)
  {
    DataNode::Pointer node = *iter;
    if ( node.IsNull() )
      continue;

    Mapper::Pointer mapper = node->GetMapper(m_MapperID);
    if(mapper.IsNotNull())
      mapper->ReleaseGraphicsResources(renWin);
  } 
}
int mitk::VtkPropRenderer::Render ( RenderType  type )

Called by the vtkMitkRenderProp in order to start MITK rendering process.

Definition at line 171 of file mitkVtkPropRenderer.cpp.

References mitk::VtkMapper3D::GetVtkProp(), mitk::Mapper::IsVtkBased(), mitk::Mapper::MitkRenderOpaqueGeometry(), mitk::Mapper::MitkRenderOverlay(), mitk::Mapper::MitkRenderTranslucentGeometry(), Opaque, Overlay, and Translucent.

{
   // Do we have objects to render?
  if ( this->GetEmptyWorldGeometry()) 
    return 0;

  if ( m_DataStorage.IsNull())
    return 0;

  // Update mappers and prepare mapper queue
  if (type == VtkPropRenderer::Opaque)
    this->PrepareMapperQueue();
  
  //go through the generated list and let the sorted mappers paint
  bool lastVtkBased = true;
  bool sthVtkBased = false;
  
  for(MappersMapType::iterator it = m_MappersMap.begin(); it != m_MappersMap.end(); it++)
  {
    Mapper * mapper = (*it).second;
    if((mapper->IsVtkBased() == true) )
    {
      sthVtkBased = true;
      mitk::VtkMapper3D::Pointer vtkMapper = dynamic_cast<mitk::VtkMapper3D*>(mapper);
      if(vtkMapper)
      {
         vtkMapper->GetVtkProp(this)->SetAllocatedRenderTime(5000,GetVtkRenderer()); //B/ ToDo: rendering time calculation
         //vtkMapper->GetVtkProp(this)->PokeMatrix(NULL); //B/ ToDo ??: VtkUserTransform
      }
      if(lastVtkBased == false)
      {
        Disable2DOpenGL();
        lastVtkBased = true;
      }
    }
    else
    if((mapper->IsVtkBased() == false) && (lastVtkBased == true))
    {
      Enable2DOpenGL();
      lastVtkBased = false;
    }

    switch(type)
    {
      case mitk::VtkPropRenderer::Opaque:        mapper->MitkRenderOpaqueGeometry(this); break;
      case mitk::VtkPropRenderer::Translucent:   mapper->MitkRenderTranslucentGeometry(this); break;
      case mitk::VtkPropRenderer::Overlay:       mapper->MitkRenderOverlay(this); break;
        //BUG (#1551) changed VTK_MINOR_VERSION FROM 3 to 2 cause RenderTranslucentGeometry was changed in minor version 2
      #if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2)  )
      case mitk::VtkPropRenderer::Volumetric:    mapper->MitkRenderVolumetricGeometry(this); break;
      #endif
    }
  }
  
  if (lastVtkBased == false)
    Disable2DOpenGL();
  
  //fix for bug 1177. In 2D rendering the camera is not needed, but nevertheless it is used by 
  //the vtk rendering mechanism to determine what is seen (and therefore has to be rendered)
  //by using the bounds of the vtkMitkRenderProp
  if (sthVtkBased == false)
    this->GetVtkRenderer()->ResetCamera();

  // Render text
  if (type == VtkPropRenderer::Overlay)
  {
    if (m_TextCollection.size() > 0)
    {
      for (TextMapType::iterator it = m_TextCollection.begin(); it != m_TextCollection.end() ; it++)
        m_TextRenderer->AddViewProp((*it).second);
      m_TextRenderer->Render();
    }
  }
  return 1;
}
void mitk::VtkPropRenderer::Resize ( int  w,
int  h 
) [virtual]

Resize the OpenGL Window.

Reimplemented from mitk::BaseRenderer.

Definition at line 429 of file mitkVtkPropRenderer.cpp.

References mitk::BaseRenderer::Resize().

void mitk::VtkPropRenderer::SetDataStorage ( mitk::DataStorage storage ) [virtual]

set the datastorage that will be used for rendering

Reimplemented from mitk::BaseRenderer.

Examples:
Step1.cpp, Step10.cpp, Step2.cpp, Step3.cpp, Step4.cpp, Step5.cpp, and Step6.cpp.

Definition at line 132 of file mitkVtkPropRenderer.cpp.

References mitk::BaseRenderer::SetDataStorage().

Referenced by main(), QmitkSliceWidget::SetData(), and Step6::SetupWidgets().

{
  if ( storage == NULL )
    return;

  BaseRenderer::SetDataStorage(storage);

  static_cast<mitk::Geometry2DDataVtkMapper3D*>(m_CurrentWorldGeometry2DMapper.GetPointer())->SetDataStorageForTexture( m_DataStorage.GetPointer() );

  // Compute the geometry from the current data tree bounds and set it as world geometry  
  this->SetWorldGeometryToDataStorageBounds();
}
void mitk::VtkPropRenderer::SetMapperID ( const MapperSlotId  _arg ) [virtual]

Set the MapperSlotId to use.

Reimplemented from mitk::BaseRenderer.

Examples:
Step10.cpp, Step3.cpp, Step4.cpp, Step5.cpp, Step6.cpp, and Step8.cpp.

Definition at line 453 of file mitkVtkPropRenderer.cpp.

Referenced by QmitkStdMultiWidgetEditor::CreateQtPartControl(), main(), Step8::SetupWidgets(), and Step6::SetupWidgets().

{
  if(m_MapperID != mapperId)
    Superclass::SetMapperID(mapperId);

  // Workaround for GL Displaylist Bug
  checkState();
}
virtual void mitk::VtkPropRenderer::SetPickingMode ( PickingMode  _arg ) [virtual]
bool mitk::VtkPropRenderer::SetWorldGeometryToDataStorageBounds (  ) [virtual]

This method calculates the bounds of the DataStorage (if it contains any valid data), creates a geometry from these bounds and sets it as world geometry of the renderer.

Call this method to re-initialize the renderer to the current DataStorage (e.g. after loading an additional dataset), to ensure that the view is aligned correctly.

Reimplemented from mitk::BaseRenderer.

Definition at line 146 of file mitkVtkPropRenderer.cpp.

{
  if ( m_DataStorage.IsNull() )
    return false;

  //initialize world geometry
  mitk::TimeSlicedGeometry::Pointer geometry = m_DataStorage->ComputeVisibleBoundingGeometry3D( NULL, "includeInBoundingBox" );

  if ( geometry.IsNull() )
    return false;

  this->SetWorldGeometry(geometry);
  //this->GetDisplayGeometry()->SetSizeInDisplayUnits( this->m_TextRenderer->GetRenderWindow()->GetSize()[0], this->m_TextRenderer->GetRenderWindow()->GetSize()[1] );
  this->GetDisplayGeometry()->Fit();
  this->GetVtkRenderer()->ResetCamera();
  this->Modified();
  return true;
}
void mitk::VtkPropRenderer::Update ( mitk::DataNode datatreenode ) [virtual]

Definition at line 350 of file mitkVtkPropRenderer.cpp.

References mitk::DataNode::GetMapper(), mitk::Mapper::Update(), and mitk::VtkMapper3D::UpdateVtkTransform().

{
  if(datatreenode!=NULL)
  {
    mitk::Mapper::Pointer mapper = datatreenode->GetMapper(m_MapperID);
    if(mapper.IsNotNull())
    {
      Mapper2D* mapper2d=dynamic_cast<Mapper2D*>(mapper.GetPointer());
      if(mapper2d != NULL)
      {
        if(GetDisplayGeometry()->IsValid())
        {
          VtkMapper2D* vtkmapper2d=dynamic_cast<VtkMapper2D*>(mapper.GetPointer());
          if(vtkmapper2d != NULL)
          {
            vtkmapper2d->Update(this);
            m_VtkMapperPresent=true;
          }
          else
            mapper2d->Update(this);
        }
      }
      else
      {
        VtkMapper3D* vtkmapper3d=dynamic_cast<VtkMapper3D*>(mapper.GetPointer());
        if(vtkmapper3d != NULL)
        {
          vtkmapper3d->Update(this);
          vtkmapper3d->UpdateVtkTransform(this);
          m_VtkMapperPresent=true;
        }
      }
    }
  }
}
void mitk::VtkPropRenderer::Update (  ) [protected, virtual]

Call update of all mappers. To be implemented in subclasses.

Implements mitk::BaseRenderer.

Definition at line 387 of file mitkVtkPropRenderer.cpp.

{
  if( m_DataStorage.IsNull() )
    return;

  m_VtkMapperPresent = false;
  mitk::DataStorage::SetOfObjects::ConstPointer all = m_DataStorage->GetAll();
  for (mitk::DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
    Update(it->Value());

  Modified();
  m_LastUpdateTime = GetMTime();
}
bool mitk::VtkPropRenderer::useImmediateModeRendering (  ) [static]
int mitk::VtkPropRenderer::WriteSimpleText ( std::string  text,
double  posX,
double  posY,
double  color1 = 0.0,
double  color2 = 1.0,
double  color3 = 0.0 
)

Writes some 2D text as overlay. Function returns an unique int Text_ID for each call, which can be used via the GetTextLabelProperty(int text_id) function in order to get a vtkTextProperty. This property enables the setup of font, font size, etc.

Definition at line 617 of file mitkVtkPropRenderer.cpp.

Referenced by mitk::PointSetGLMapper2D::Paint(), mitk::PlanarFigureMapper2D::Paint(), and mitk::ImageMapperGL2D::Paint().

{
 if(text.size() > 0)
  {
    vtkTextActor* textActor = vtkTextActor::New();

    textActor->SetPosition(posX,posY);
    textActor->SetInput(text.c_str());
    textActor->GetTextProperty()->SetColor(color1, color2, color3); //TODO: Read color from node property
    int text_id = m_TextCollection.size();
    m_TextCollection.insert(TextMapType::value_type(text_id,textActor));
    return text_id;
  }
  return -1;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines