+++ /dev/null
-#include <cpExtensions/QT/RendererWidget.h>
-#include <vtkAxesActor.h>
-#include <vtkCamera.h>
-#include <vtkImageProperty.h>
-#include <vtkInteractorStyle.h>
-#include <vtkOrientationMarkerWidget.h>
-#include <vtkProperty.h>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <cpExtensions/Visualization/LUTImageActor.h>
-#include <cpExtensions/Visualization/WindowLevelImageActor.h>
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::RendererWidget::
-RendererWidget( QWidget* parent, Qt::WindowFlags f )
- : Superclass( parent, f ),
- Superclass2( )
-{
- this->m_Renderer = vtkSmartPointer< vtkRenderer >::New( );
- this->GetRenderWindow( )->AddRenderer( this->m_Renderer );
-
- vtkAxesActor* axes = vtkAxesActor::New( );
- axes->AxisLabelsOff( );
- this->m_Marker = vtkSmartPointer< vtkOrientationMarkerWidget >::New( );
- this->m_Marker->SetOutlineColor( 1, 1, 1 );
- this->m_Marker->SetOrientationMarker( axes );
- this->m_Marker->SetInteractor( this->GetRenderWindow( )->GetInteractor( ) );
- this->m_Marker->EnabledOn( );
- this->m_Marker->InteractiveOff( );
- axes->Delete( );
- this->SetQuadrant( 0 );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::RendererWidget::
-~RendererWidget( )
-{
-}
-
-// -------------------------------------------------------------------------
-int cpExtensions::QT::RendererWidget::
-GetQuadrant( ) const
-{
- return( this->m_Quadrant );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetQuadrant( int q )
-{
- this->m_Quadrant = ( q - 1 ) % 4;
- if( this->m_Quadrant == 0 )
- this->m_Marker->SetViewport( 0.85, 0.00, 1.00, 0.15 );
- else if( this->m_Quadrant == 1 )
- this->m_Marker->SetViewport( 0.00, 0.00, 0.15, 0.15 );
- else if( this->m_Quadrant == 2 )
- this->m_Marker->SetViewport( 0.00, 0.85, 0.15, 1.00 );
- else if( this->m_Quadrant == 3 )
- this->m_Marker->SetViewport( 0.85, 0.85, 1.00, 1.00 );
-}
-
-// -------------------------------------------------------------------------
-vtkRenderer* cpExtensions::QT::RendererWidget::
-GetRenderer( )
-{
- return( this->m_Renderer );
-}
-
-// -------------------------------------------------------------------------
-const vtkRenderer* cpExtensions::QT::RendererWidget::
-GetRenderer( ) const
-{
- return( this->m_Renderer );
-}
-
-// -------------------------------------------------------------------------
-vtkInteractorStyle* cpExtensions::QT::RendererWidget::
-GetStyle( )
-{
- auto iren = this->GetInteractor( );
- if( iren != NULL )
- return(
- dynamic_cast< vtkInteractorStyle* >( iren->GetInteractorStyle( ) )
- );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const vtkInteractorStyle* cpExtensions::QT::RendererWidget::
-GetStyle( ) const
-{
- // Ugly, but necessary :-(
- Self* self = const_cast< Self* >( this );
- if( self != NULL )
- {
- auto iren = self->GetInteractor( );
- if( iren != NULL )
- return(
- dynamic_cast< const vtkInteractorStyle* >(
- iren->GetInteractorStyle( )
- )
- );
- else
- return( NULL );
- }
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetStyle( vtkInteractorStyle* style )
-{
- this->GetInteractor( )->SetInteractorStyle( style );
-}
-
-// -------------------------------------------------------------------------
-vtkCamera* cpExtensions::QT::RendererWidget::
-GetActiveCamera( )
-{
- return( this->m_Renderer->GetActiveCamera( ) );
-}
-
-// -------------------------------------------------------------------------
-const vtkCamera* cpExtensions::QT::RendererWidget::
-GetActiveCamera( ) const
-{
- return( this->m_Renderer->GetActiveCamera( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-AddViewProp( vtkProp* prop, const std::string& name )
-{
- if( prop != NULL )
- {
- auto i = this->m_ViewProps.find( name );
- if( i == this->m_ViewProps.end( ) )
- i =
- this->m_ViewProps.insert(
- TPropCollection::value_type( name, TProps( ) )
- ).first;
- i->second.insert( prop );
- this->m_Renderer->AddViewProp( prop );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-AddViewProps( vtkPropCollection* props, const std::string& name )
-{
- if( props != NULL )
- {
- auto i = this->m_ViewProps.find( name );
- if( i == this->m_ViewProps.end( ) )
- i =
- this->m_ViewProps.insert(
- TPropCollection::value_type( name, TProps( ) )
- ).first;
- props->InitTraversal( );
- while( vtkProp* prop = props->GetNextProp( ) )
- {
- i->second.insert( prop );
- this->m_Renderer->AddViewProp( prop );
-
- } // elihw
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-AddAuxViewProp( vtkProp* prop, const std::string& name )
-{
- if( prop != NULL )
- {
- auto i = this->m_AuxViewProps.find( name );
- if( i == this->m_AuxViewProps.end( ) )
- i =
- this->m_AuxViewProps.insert(
- TPropCollection::value_type( name, TProps( ) )
- ).first;
- i->second.insert( prop );
- this->m_Renderer->AddViewProp( prop );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-AddAuxViewProps( vtkPropCollection* props, const std::string& name )
-{
- if( props != NULL )
- {
- auto i = this->m_AuxViewProps.find( name );
- if( i == this->m_AuxViewProps.end( ) )
- i =
- this->m_AuxViewProps.insert(
- TPropCollection::value_type( name, TProps( ) )
- ).first;
- props->InitTraversal( );
- while( vtkProp* prop = props->GetNextProp( ) )
- {
- i->second.insert( prop );
- this->m_Renderer->AddViewProp( prop );
-
- } // elhiw
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::RendererWidget::
-TProps& cpExtensions::QT::RendererWidget::
-GetViewProps( const std::string& name )
-{
- static TProps zero;
- auto i = this->m_ViewProps.find( name );
- if( i == this->m_ViewProps.end( ) )
- {
- zero.clear( );
- return( zero );
- }
- else
- return( i->second );
-}
-
-// -------------------------------------------------------------------------
-const cpExtensions::QT::RendererWidget::
-TProps& cpExtensions::QT::RendererWidget::
-GetViewProps( const std::string& name ) const
-{
- static const TProps zero;
- auto i = this->m_ViewProps.find( name );
- if( i == this->m_ViewProps.end( ) )
- return( zero );
- else
- return( i->second );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::RendererWidget::
-TProps& cpExtensions::QT::RendererWidget::
-GetAuxViewProps( const std::string& name )
-{
- static TProps zero;
- auto i = this->m_AuxViewProps.find( name );
- if( i == this->m_AuxViewProps.end( ) )
- {
- zero.clear( );
- return( zero );
- }
- else
- return( i->second );
-}
-
-// -------------------------------------------------------------------------
-const cpExtensions::QT::RendererWidget::
-TProps& cpExtensions::QT::RendererWidget::
-GetAuxViewProps( const std::string& name ) const
-{
- static const TProps zero;
- auto i = this->m_AuxViewProps.find( name );
- if( i == this->m_AuxViewProps.end( ) )
- return( zero );
- else
- return( i->second );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-RemoveViewProps( const std::string& name )
-{
- auto i = this->m_ViewProps.find( name );
- if( i != this->m_ViewProps.end( ) )
- {
- for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
- this->m_Renderer->RemoveViewProp( *p );
- this->m_ViewProps.erase( i );
-
- } // fi
-
- i = this->m_AuxViewProps.find( name );
- if( i != this->m_AuxViewProps.end( ) )
- {
- for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
- this->m_Renderer->RemoveViewProp( *p );
- this->m_AuxViewProps.erase( i );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-RemoveViewProps( )
-{
- this->m_Renderer->RemoveAllViewProps( );
- this->m_ViewProps.clear( );
- this->m_AuxViewProps.clear( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-HideViewProps( const std::string& name )
-{
- auto i = this->m_ViewProps.find( name );
- if( i != this->m_ViewProps.end( ) )
- for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
- ( *p )->VisibilityOff( );
- i = this->m_AuxViewProps.find( name );
- if( i != this->m_AuxViewProps.end( ) )
- for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
- ( *p )->VisibilityOff( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-ShowViewProps( const std::string& name )
-{
- auto i = this->m_ViewProps.find( name );
- if( i != this->m_ViewProps.end( ) )
- for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
- ( *p )->VisibilityOn( );
- i = this->m_AuxViewProps.find( name );
- if( i != this->m_AuxViewProps.end( ) )
- for( auto p = i->second.begin( ); p != i->second.end( ); ++p )
- ( *p )->VisibilityOn( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-ResetCamera( )
-{
- this->m_Renderer->ResetCamera( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-Render( )
-{
- this->GetRenderWindow( )->Render( );
-}
-
-// -------------------------------------------------------------------------
-std::set< vtkRenderWindowInteractor* > cpExtensions::QT::RendererWidget::
-GetInteractors( ) const
-{
- Self* self = const_cast< Self* >( this );
- std::set< vtkRenderWindowInteractor* > ret;
- ret.insert( self->GetRenderWindow( )->GetInteractor( ) );
- return( ret );
-}
-
-// -------------------------------------------------------------------------
-std::set< std::string > cpExtensions::QT::RendererWidget::
-GetActorsNames( ) const
-{
- std::set< std::string > names;
- for(
- auto p = this->m_ViewProps.begin( );
- p != this->m_ViewProps.end( );
- ++p
- )
- names.insert( p->first );
- return( names );
-}
-
-// -------------------------------------------------------------------------
-bool cpExtensions::QT::RendererWidget::
-IsWindowLevelImageActor( const std::string& name ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto a = it->second.begin( );
- if( a != it->second.end( ) )
- return( dynamic_cast< TWLActor* >( a->GetPointer( ) ) != NULL );
- else
- return( false );
- }
- else
- return( false );
-}
-
-// -------------------------------------------------------------------------
-bool cpExtensions::QT::RendererWidget::
-IsLUTImageActor( const std::string& name ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto a = it->second.begin( );
- if( a != it->second.end( ) )
- return( dynamic_cast< TLUTActor* >( a->GetPointer( ) ) != NULL );
- else
- return( false );
- }
- else
- return( false );
-}
-
-// -------------------------------------------------------------------------
-bool cpExtensions::QT::RendererWidget::
-Is3DActor( const std::string& name ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto a = it->second.begin( );
- if( a != it->second.end( ) )
- return( dynamic_cast< vtkActor* >( a->GetPointer( ) ) != NULL );
- else
- return( false );
- }
- else
- return( false );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-GetScalarRange( const std::string& name, double r[ 2 ] ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto p = it->second.begin( );
- TWLActor* a = NULL;
- while( a == NULL && p != it->second.end( ) )
- {
- a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
- p++;
-
- } // elihw
- if( a != NULL )
- a->GetRange( r );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-GetWindowLevel( const std::string& name, double wl[ 2 ] ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto p = it->second.begin( );
- TWLActor* a = NULL;
- while( a == NULL && p != it->second.end( ) )
- {
- a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
- p++;
-
- } // elihw
- if( a != NULL )
- a->GetWindowLevel( wl );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::QT::RendererWidget::
-GetWindow( const std::string& name ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto p = it->second.begin( );
- TWLActor* a = NULL;
- while( a == NULL && p != it->second.end( ) )
- {
- a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
- p++;
-
- } // elihw
- if( a != NULL )
- return( a->GetWindow( ) );
- else
- return( 0 );
- }
- else
- return( 0 );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::QT::RendererWidget::
-GetLevel( const std::string& name ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto p = it->second.begin( );
- TWLActor* a = NULL;
- while( a == NULL && p != it->second.end( ) )
- {
- a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
- p++;
-
- } // elihw
- if( a != NULL )
- return( a->GetLevel( ) );
- else
- return( 0 );
- }
- else
- return( 0 );
-}
-
-// -------------------------------------------------------------------------
-char cpExtensions::QT::RendererWidget::
-GetImageInterpolation( const std::string& name ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto p = it->second.begin( );
- TWLActor* a = NULL;
- while( a == NULL && p != it->second.end( ) )
- {
- a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
- p++;
-
- } // elihw
- if( a != NULL )
- {
- int int_type = a->GetProperty( )->GetInterpolationType( );
- char ret = 0;
- switch( int_type )
- {
- case VTK_NEAREST_INTERPOLATION: ret = 'N'; break;
- case VTK_LINEAR_INTERPOLATION: ret = 'L'; break;
- case VTK_CUBIC_INTERPOLATION: ret = 'C'; break;
- default: ret = 0; break;
- } // hctiws
- return( ret );
- }
- else
- return( 0 );
- }
- else
- return( 0 );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-GetColor( const std::string& name, double& r, double& g, double& b ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto p = it->second.begin( );
- vtkActor* a = NULL;
- while( a == NULL && p != it->second.end( ) )
- {
- a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- p++;
-
- } // elihw
- if( a != NULL )
- return( a->GetProperty( )->GetColor( r, g, b ) );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::QT::RendererWidget::
-GetOpacity( const std::string& name ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto p = it->second.begin( );
- vtkActor* a = NULL;
- vtkImageSlice* s = NULL;
- while( a == NULL && s == NULL && p != it->second.end( ) )
- {
- a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- s = dynamic_cast< vtkImageSlice* >( p->GetPointer( ) );
- p++;
-
- } // elihw
- if( a != NULL )
- return( a->GetProperty( )->GetOpacity( ) );
- else if( s != NULL )
- return( s->GetProperty( )->GetOpacity( ) );
- else
- return( 0 );
- }
- return( 0 );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::QT::RendererWidget::
-GetPointSize( const std::string& name ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto p = it->second.begin( );
- vtkActor* a = NULL;
- while( a == NULL && p != it->second.end( ) )
- {
- a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- p++;
-
- } // elihw
- if( a != NULL )
- return( a->GetProperty( )->GetPointSize( ) );
- else
- return( 0 );
- }
- return( 0 );
-}
-
-// -------------------------------------------------------------------------
-double cpExtensions::QT::RendererWidget::
-GetLineWidth( const std::string& name ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto p = it->second.begin( );
- vtkActor* a = NULL;
- while( a == NULL && p != it->second.end( ) )
- {
- a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- p++;
-
- } // elihw
- if( a != NULL )
- return( a->GetProperty( )->GetLineWidth( ) );
- else
- return( 0 );
- }
- return( 0 );
-}
-
-// -------------------------------------------------------------------------
-int cpExtensions::QT::RendererWidget::
-GetRepresentation( const std::string& name ) const
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- auto p = it->second.begin( );
- vtkActor* a = NULL;
- while( a == NULL && p != it->second.end( ) )
- {
- a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- p++;
-
- } // elihw
- if( a != NULL )
- return( a->GetProperty( )->GetRepresentation( ) );
- else
- return( -1 );
- }
- return( -1 );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetScalarRange( const std::string& name, double r[ 2 ] )
-{
- this->SetScalarRange( name, r[ 0 ], r[ 1 ] );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetScalarRange( const std::string& name, double min, double max )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->SetRange( min, max );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetWindowLevel( const std::string& name, double wl[ 2 ] )
-{
- this->SetWindowLevel( name, wl[ 0 ], wl[ 1 ] );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetWindowLevel( const std::string& name, double w, double l )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->SetWindowLevel( w, l );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetWindow( const std::string& name, double w )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->SetWindow( w );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetLevel( const std::string& name, double l )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->SetLevel( l );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetImageInterpolation( const std::string& name, char i )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- TWLActor* a = dynamic_cast< TWLActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- int int_type = VTK_NEAREST_INTERPOLATION;
- switch( i )
- {
- case 'L': int_type = VTK_LINEAR_INTERPOLATION; break;
- case 'C': int_type = VTK_CUBIC_INTERPOLATION; break;
- default: int_type = VTK_NEAREST_INTERPOLATION; break;
- } // hctiws
- a->GetProperty( )->SetInterpolationType( int_type );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetColor( const std::string& name, double r, double g, double b )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->GetProperty( )->SetColor( r, g, b );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetOpacity( const std::string& name, double o )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- vtkImageSlice* s = dynamic_cast< vtkImageSlice* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->GetProperty( )->SetOpacity( o );
- }
- else if( s != NULL )
- {
- render = true;
- s->GetProperty( )->SetOpacity( o );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetPointSize( const std::string& name, double s )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->GetProperty( )->SetPointSize( s );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetLineWidth( const std::string& name, double w )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->GetProperty( )->SetLineWidth( w );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetRepresentationToPoints( const std::string& name )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->GetProperty( )->SetRepresentationToPoints( );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetRepresentationToSurface( const std::string& name )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->GetProperty( )->SetRepresentationToSurface( );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::RendererWidget::
-SetRepresentationToWireframe( const std::string& name )
-{
- auto it = this->m_ViewProps.find( name );
- if( it != this->m_ViewProps.end( ) )
- {
- bool render = false;
- for( auto p = it->second.begin( ); p != it->second.end( ); ++p )
- {
- vtkActor* a = dynamic_cast< vtkActor* >( p->GetPointer( ) );
- if( a != NULL )
- {
- render = true;
- a->GetProperty( )->SetRepresentationToWireframe( );
-
- } // fi
-
- } // rof
- if( render )
- this->Render( );
-
- } // fi
-}
-
-// eof - $RCSfile$