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

mitk::VtkMapper3D Class Reference
[Mapper Classes]

Base class of all vtk-based 3D-Mappers. More...

#include <mitkVtkMapper3D.h>

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

List of all members.

Public Types

typedef VtkMapper3D Self
typedef Mapper3D Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
virtual vtkProp * GetVtkProp (mitk::BaseRenderer *renderer)=0
virtual void MitkRenderOpaqueGeometry (mitk::BaseRenderer *renderer)
virtual void MitkRenderTranslucentGeometry (mitk::BaseRenderer *renderer)
virtual void MitkRenderOverlay (mitk::BaseRenderer *renderer)
virtual void UpdateVtkTransform (mitk::BaseRenderer *renderer)
 Set the vtkTransform of the m_Prop3D for the current time step of renderer.
virtual void ApplyProperties (vtkActor *actor, mitk::BaseRenderer *renderer)
 Apply color and opacity read from the PropertyList.
virtual void ReleaseGraphicsResources (vtkWindow *renWin)
 Release vtk-based graphics resources. Must be overwritten in subclasses if vtkProps additional to m_Prop3D are used.
virtual bool HasVtkProp (const vtkProp *prop, BaseRenderer *renderer)
 Returns true if this mapper owns the specified vtkProp for the given BaseRenderer.
virtual Geometry3DGetGeometry ()
virtual void SetGeometry (Geometry3D *_arg)

Static Public Member Functions

static void SetVtkMapperImmediateModeRendering (vtkMapper *mapper)

Protected Member Functions

 VtkMapper3D ()
virtual ~VtkMapper3D ()

Protected Attributes

Geometry3D::Pointer m_Geometry
LevelWindow m_LevelWindow

Detailed Description

Base class of all vtk-based 3D-Mappers.

GetProp() returns m_Prop3D, which should be initialized by sub-classes (e.g., by setting it to an vtkActor).

Definition at line 42 of file mitkVtkMapper3D.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::VtkMapper3D::ConstPointer
typedef itk::SmartPointer<Self> mitk::VtkMapper3D::Pointer

Constructor & Destructor Documentation

mitk::VtkMapper3D::VtkMapper3D (  ) [protected]

Definition at line 41 of file mitkVtkMapper3D.cpp.

{
}
mitk::VtkMapper3D::~VtkMapper3D (  ) [protected, virtual]

Definition at line 46 of file mitkVtkMapper3D.cpp.

{
}

Member Function Documentation

void mitk::VtkMapper3D::ApplyProperties ( vtkActor *  actor,
mitk::BaseRenderer renderer 
) [virtual]

Apply color and opacity read from the PropertyList.

Reimplemented in mitk::SurfaceVtkMapper3D, mitk::VolumeDataVtkMapper3D, mitk::GPUVolumeMapper3D, and mitk::UnstructuredGridVtkMapper3D.

Definition at line 148 of file mitkVtkMapper3D.cpp.

References mitk::Mapper::GetColor(), and mitk::Mapper::GetOpacity().

{
  float rgba[4]={1.0f,1.0f,1.0f,1.0f};
  // check for color prop and use it for rendering if it exists
  this->GetColor(rgba, renderer);
  // check for opacity prop and use it for rendering if it exists
  this->GetOpacity(rgba[3], renderer);

#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
  double drgba[4]={rgba[0],rgba[1],rgba[2],rgba[3]};
  actor->GetProperty()->SetColor(drgba);
  actor->GetProperty()->SetOpacity(drgba[3]);
#else
  actor->GetProperty()->SetColor(rgba);
  actor->GetProperty()->SetOpacity(rgba[3]);
#endif


  // Add annotations to assembly, if any (camera (renderer) must be present)
  if ( renderer != NULL )
  {
    // Check whether one or more AnnotationProperty objects have been defined for
    // this node. Check both renderer specific and global property lists, since
    // properties in both should be considered.
    //const PropertyList::PropertyMap *rendererProperties = this->GetDataNode()->GetPropertyList( renderer )->GetMap();
    //const PropertyList::PropertyMap *globalProperties = this->GetDataNode()->GetPropertyList( NULL )->GetMap();

    // Add clipping planes (if any)
/*
    m_LabelActorCollection->RemoveAllItems();

    PropertyList::PropertyMap::const_iterator it;
    for ( it = rendererProperties->begin(); it != rendererProperties->end(); ++it )
    {
      this->CheckForAnnotationProperty( (*it).second.first.GetPointer(), renderer );
    }

    for ( it = globalProperties->begin(); it != globalProperties->end(); ++it )
    {
      this->CheckForAnnotationProperty( (*it).second.first.GetPointer(), renderer );
    }
    */
  } 
}
virtual const char* mitk::VtkMapper3D::GetClassName (  ) const [virtual]
virtual Geometry3D* mitk::VtkMapper3D::GetGeometry (  ) [virtual]

Checks whether the specified property is a AnnotationProperty and if yes, adds it to m_LabelActorCollection (internal method).

virtual vtkProp* mitk::VtkMapper3D::GetVtkProp ( mitk::BaseRenderer renderer ) [pure virtual]
bool mitk::VtkMapper3D::HasVtkProp ( const vtkProp *  prop,
BaseRenderer renderer 
) [virtual]

Returns true if this mapper owns the specified vtkProp for the given BaseRenderer.

Note: returns false by default; should be implemented for VTK-based Mapper subclasses.

Reimplemented from mitk::Mapper.

Definition at line 240 of file mitkVtkMapper3D.cpp.

References GetVtkProp().

{
  vtkProp *myProp = this->GetVtkProp( renderer );
  
  // TODO: check if myProp is a vtkAssembly and if so, check if prop is contained in its leafs
  return ( prop == myProp );
}
void mitk::VtkMapper3D::MitkRenderOpaqueGeometry ( mitk::BaseRenderer renderer ) [virtual]

Implements mitk::Mapper.

Definition at line 67 of file mitkVtkMapper3D.cpp.

References mitk::Mapper::GetVisibility(), GetVtkProp(), mitk::BaseRenderer::GetVtkRenderer(), and mitk::Mapper::IsVisible().

{
  if ( this->IsVisible( renderer )==false ) 
    return;
  
  if ( this->GetVtkProp(renderer)->GetVisibility() )
  {
    this->GetVtkProp(renderer)->RenderOpaqueGeometry( renderer->GetVtkRenderer() );
  }
}
void mitk::VtkMapper3D::MitkRenderOverlay ( mitk::BaseRenderer renderer ) [virtual]

Implements mitk::Mapper.

Definition at line 124 of file mitkVtkMapper3D.cpp.

References mitk::Mapper::GetVisibility(), GetVtkProp(), mitk::BaseRenderer::GetVtkRenderer(), and mitk::Mapper::IsVisible().

{
  if ( this->IsVisible(renderer)==false ) 
    return;
  
  if ( this->GetVtkProp(renderer)->GetVisibility() )
  {
    this->GetVtkProp(renderer)->RenderOverlay(renderer->GetVtkRenderer());
  }

  // Render annotations as overlay
/*
  m_LabelActorCollection->InitTraversal();
  vtkProp3D *labelActor;
  for ( m_LabelActorCollection->InitTraversal(); 
        (labelActor = m_LabelActorCollection->GetNextProp3D()); )
  {
    if ( labelActor->GetVisibility() )
      labelActor->RenderOpaqueGeometry( renderer->GetVtkRenderer() );
  }
  */
}
void mitk::VtkMapper3D::MitkRenderTranslucentGeometry ( mitk::BaseRenderer renderer ) [virtual]

Implements mitk::Mapper.

Definition at line 78 of file mitkVtkMapper3D.cpp.

References mitk::Mapper::GetVisibility(), GetVtkProp(), mitk::BaseRenderer::GetVtkRenderer(), and mitk::Mapper::IsVisible().

{
  if ( this->IsVisible(renderer)==false ) 
    return;
  
 /* if(dynamic_cast<vtkLODProp3D*>(m_Prop3D) != NULL)
  {
    if(  dynamic_cast<BoolProperty*>(GetDataNode()->
                                           GetProperty("volumerendering",renderer).GetPointer())==NULL ||  
         dynamic_cast<BoolProperty*>(GetDataNode()->
                                           GetProperty("volumerendering",renderer).GetPointer())->GetValue() == false)    
       return;
  }*/
  
  if ( this->GetVtkProp(renderer)->GetVisibility() )
//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)  )
    this->GetVtkProp(renderer)->RenderTranslucentPolygonalGeometry(renderer->GetVtkRenderer());
#else
    this->GetVtkProp(renderer)->RenderTranslucentGeometry(renderer->GetVtkRenderer());
#endif

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

Release vtk-based graphics resources. Must be overwritten in subclasses if vtkProps additional to m_Prop3D are used.

Reimplemented from mitk::Mapper.

Reimplemented in mitk::PointSetVtkMapper3D, and mitk::EnhancedPointSetVtkMapper3D.

Definition at line 231 of file mitkVtkMapper3D.cpp.

{
/*
  if(m_Prop3D)
    m_Prop3D->ReleaseGraphicsResources(renWin);
*/
}
virtual void mitk::VtkMapper3D::SetGeometry ( Geometry3D _arg ) [virtual]
void mitk::VtkMapper3D::SetVtkMapperImmediateModeRendering ( vtkMapper *  mapper ) [static]

Definition at line 50 of file mitkVtkMapper3D.cpp.

References mitk::VtkPropRenderer::useImmediateModeRendering().

{
  if(mapper)
    mapper->SetImmediateModeRendering(mitk::VtkPropRenderer::useImmediateModeRendering());
}
void mitk::VtkMapper3D::UpdateVtkTransform ( mitk::BaseRenderer renderer ) [virtual]

Set the vtkTransform of the m_Prop3D for the current time step of renderer.

Called by mitk::VtkPropRenderer::Update before rendering

Reimplemented in mitk::Geometry2DDataVtkMapper3D, mitk::PointSetVtkMapper3D, mitk::EnhancedPointSetVtkMapper3D, mitk::MeshVtkMapper3D, and mitk::SplineVtkMapper3D.

Definition at line 57 of file mitkVtkMapper3D.cpp.

References mitk::Mapper::GetDataNode(), mitk::Mapper::GetTimestep(), GetVtkProp(), and mitk::DataNode::GetVtkTransform().

Referenced by mitk::VtkPropRenderer::Update().

{
  vtkLinearTransform * vtktransform = GetDataNode()->GetVtkTransform(this->GetTimestep());
  
  vtkProp3D *prop = dynamic_cast<vtkProp3D*>( GetVtkProp(renderer) );
  if(prop)
    prop->SetUserTransform(vtktransform);
}

Member Data Documentation

Definition at line 97 of file mitkVtkMapper3D.h.

Definition at line 101 of file mitkVtkMapper3D.h.


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