#ifdef cpExtensions_QT4
#include <cpExtensions/ui_SimpleMPRWidget.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
-#include <vtkProperty.h>
-#include <vtkRendererCollection.h>
+// -------------------------------------------------------------------------
+cpExtensions::QT::SimpleMPRWidget::_3DInteractorStyle*
+cpExtensions::QT::SimpleMPRWidget::_3DInteractorStyle::
+New( )
+{
+ return( new _3DInteractorStyle( ) );
+}
-double cpExtensions::QT::SimpleMPRWidget::
-cm_Colors[ 8 ][ 3 ] =
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::_3DInteractorStyle::
+OnKeyPress( )
{
- { 1.0, 0.0, 0.0 },
- { 0.0, 1.0, 0.0 },
- { 0.0, 0.0, 1.0 },
- { 0.0, 1.0, 1.0 },
- { 1.0, 0.0, 1.0 },
- { 1.0, 1.0, 0.0 },
- { 1.0, 0.5, 0.0 },
- { 1.0, 0.0, 0.5 }
-};
+ vtkRenderWindowInteractor* i = this->Interactor;
+ std::string key = i->GetKeySym( );
+ if( key == "r" || key == "R" )
+ {
+ this->CurrentRenderer->ResetCamera( );
+ i->Render( );
+
+ } // fi
+}
// -------------------------------------------------------------------------
cpExtensions::QT::SimpleMPRWidget::
SimpleMPRWidget( QWidget* parent )
: QWidget( parent ),
- m_UI( new Ui::SimpleMPRWidget ),
- m_MainImage( "" )
+ m_UI( new Ui::SimpleMPRWidget )
{
this->m_UI->setupUi( this );
// Configure VTK widgets
- this->m_VTK[ 0 ] = this->m_UI->VTK01;
- this->m_VTK[ 1 ] = this->m_UI->VTK00;
- this->m_VTK[ 2 ] = this->m_UI->VTK10;
- this->m_VTK[ 3 ] = this->m_UI->VTK11;
-
- this->m_MPRObjects = vtkSmartPointer< TMPRObjects >::New( );
- this->m_MPRObjects->SetRenderWindows(
- this->m_VTK[ 0 ]->GetRenderWindow( ),
- this->m_VTK[ 1 ]->GetRenderWindow( ),
- this->m_VTK[ 2 ]->GetRenderWindow( ),
- this->m_VTK[ 3 ]->GetRenderWindow( )
- );
+ this->m_VTK[ 0 ] = this->m_UI->VTK_X;
+ this->m_VTK[ 1 ] = this->m_UI->VTK_Y;
+ this->m_VTK[ 2 ] = this->m_UI->VTK_Z;
+ this->m_VTK[ 3 ] = this->m_UI->VTK_3D;
+ for( unsigned int i = 0; i < 4; ++i )
+ {
+ this->m_Renderers[ i ] = vtkSmartPointer< vtkRenderer >::New( );
+ this->m_VTK[ i ]->GetRenderWindow( )->
+ AddRenderer( this->m_Renderers[ i ] );
+
+ } // rof
+ vtkSmartPointer< _3DInteractorStyle > style =
+ vtkSmartPointer< _3DInteractorStyle >::New( );
+ this->m_VTK[ 3 ]->GetRenderWindow( )->
+ GetInteractor( )->SetInteractorStyle( style );
+ style->SetCurrentRenderer( this->m_Renderers[ 3 ] );
// Connect slots
QObject::connect(
cpExtensions::QT::SimpleMPRWidget::
~SimpleMPRWidget( )
{
+ this->Clear( );
delete this->m_UI;
}
// -------------------------------------------------------------------------
-unsigned int cpExtensions::QT::SimpleMPRWidget::
-GetNumberOfData( ) const
+void cpExtensions::QT::SimpleMPRWidget::
+Clear( )
{
- return( this->m_Data.size( ) );
+ for( unsigned int i = 0; i < 4; ++i )
+ this->m_Renderers[ i ]->RemoveAllViewProps( );
+ for( unsigned int i = 0; i < 3; ++i )
+ {
+ if( this->m_2DSlices[ i ].GetPointer( ) != NULL )
+ this->m_2DSlices[ i ]->Clear( );
+ if( this->m_3DSlices[ i ].GetPointer( ) != NULL )
+ this->m_3DSlices[ i ]->Clear( );
+
+ } // rof
+ this->m_NamedActors.clear( );
}
// -------------------------------------------------------------------------
-bool cpExtensions::QT::SimpleMPRWidget::
-AddData(
- vtkImageData* data, const std::string& name,
- const std::string& parent
- )
+void cpExtensions::QT::SimpleMPRWidget::
+SetMainImage( vtkImageData* image, const std::string& name )
{
- if( name == "" )
- return( false );
-
- auto iIt = this->m_Data.find( name );
- if( iIt == this->m_Data.end( ) )
+ this->Clear( );
+ for( unsigned int i = 0; i < 3; ++i )
{
- if( parent != "" )
- {
- auto pIt = this->m_Data.find( parent );
- if( pIt == this->m_Data.end( ) )
- return( false );
+ this->m_2DSlices[ i ] = vtkSmartPointer< TSliceActors >::New( );
+ this->m_2DSlices[ i ]->SetInputData( image, i );
+ this->m_2DSlices[ i ]->PushInto( this->m_Renderers[ i ] );
+ this->m_VTK[ i ]->GetRenderWindow( )->GetInteractor( )->
+ SetInteractorStyle( this->m_2DSlices[ i ]->GetStyle( ) );
+
+ this->m_3DSlices[ i ] = vtkSmartPointer< TSliceActors >::New( );
+ this->m_3DSlices[ i ]->SetInputData( image, i );
+ this->m_3DSlices[ i ]->PushInto( this->m_Renderers[ 3 ] );
+ this->m_3DSlices[ i ]->SetStyle(
+ dynamic_cast< vtkInteractorStyle* >(
+ this->m_Renderers[ 3 ]->GetRenderWindow( )->
+ GetInteractor( )->GetInteractorStyle( )
+ )
+ );
- } // fi
+ this->m_NamedActors[ name ].insert(
+ this->m_2DSlices[ i ]->GetImageActor( )
+ );
+ this->m_NamedActors[ name ].insert(
+ this->m_3DSlices[ i ]->GetImageActor( )
+ );
- // Add new data
- this->m_Data[ name ].SetImageData( data );
+ } // rof
+ this->_AssociateSlices( );
+}
- // Set color
- auto iIt = this->m_Data.find( name );
- if( iIt != this->m_Data.end( ) )
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+SetMainActor( vtkImageActor* actor, const std::string& name )
+{
+ this->Clear( );
+ vtkImageData* image = NULL;
+ for( unsigned int i = 0; i < 3; ++i )
+ {
+ this->m_2DSlices[ i ] = vtkSmartPointer< TSliceActors >::New( );
+ if( i == 0 )
{
- vtkActor* actor =
- dynamic_cast< vtkActor* >( iIt->second.GetMeshActor( ) );
- if( actor != NULL )
- {
- unsigned int idx = this->m_Data.size( ) % 8;
- actor->GetProperty( )->SetColor(
- Self::cm_Colors[ idx ][ 0 ],
- Self::cm_Colors[ idx ][ 1 ],
- Self::cm_Colors[ idx ][ 2 ]
- );
-
- } // fi
+ this->m_2DSlices[ i ]->SetInputActor( actor, i );
+ image = this->m_2DSlices[ i ]->GetInputData( );
+ }
+ else
+ this->m_2DSlices[ i ]->SetInputData( image, i );
+ this->m_2DSlices[ i ]->PushInto( this->m_Renderers[ i ] );
+ this->m_VTK[ i ]->GetRenderWindow( )->GetInteractor( )->
+ SetInteractorStyle( this->m_2DSlices[ i ]->GetStyle( ) );
+
+ this->m_3DSlices[ i ] = vtkSmartPointer< TSliceActors >::New( );
+ this->m_3DSlices[ i ]->SetInputData( image, i );
+ this->m_3DSlices[ i ]->PushInto( this->m_Renderers[ 3 ] );
+ this->m_3DSlices[ i ]->SetStyle(
+ dynamic_cast< vtkInteractorStyle* >(
+ this->m_Renderers[ 3 ]->GetRenderWindow( )->
+ GetInteractor( )->GetInteractorStyle( )
+ )
+ );
- } // fi
+ this->m_NamedActors[ name ].insert(
+ this->m_2DSlices[ i ]->GetImageActor( )
+ );
+ this->m_NamedActors[ name ].insert(
+ this->m_3DSlices[ i ]->GetImageActor( )
+ );
- // Add to tree view
- // TODO: this->_UpdateTreeItem( name, parent );
- return( true );
- }
- else
- return( false );
+ } // rof
+ this->_AssociateSlices( );
}
// -------------------------------------------------------------------------
-bool cpExtensions::QT::SimpleMPRWidget::
-AddData( vtkPolyData* data, const std::string& name )
+void cpExtensions::QT::SimpleMPRWidget::
+AddImage( vtkImageData* image, const std::string& name )
{
- if( name == "" )
- return( false );
+ std::cerr << "SimpleMPR: adding image" << std::endl;
+ std::exit( 1 );
+}
- auto iIt = this->m_Data.find( name );
- if( iIt == this->m_Data.end( ) )
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+AddImageActor( vtkImageActor* actor, const std::string& name )
+{
+ unsigned int i = 0;
+ bool cont = true;
+ while( i < 3 && cont )
{
- // Add new data
- this->m_Data[ name ].SetPolyData( data );
-
- // Set color
- auto iIt = this->m_Data.find( name );
- if( iIt != this->m_Data.end( ) )
+ if( this->m_2DSlices[ i ].GetPointer( ) != NULL )
{
- vtkActor* actor =
- dynamic_cast< vtkActor* >( iIt->second.GetMeshActor( ) );
- if( actor != NULL )
+ if( this->m_2DSlices[ i ]->GetImageActor( ) != NULL )
{
- unsigned int idx = this->m_Data.size( ) % 8;
- actor->GetProperty( )->SetColor(
- Self::cm_Colors[ idx ][ 0 ],
- Self::cm_Colors[ idx ][ 1 ],
- Self::cm_Colors[ idx ][ 2 ]
- );
-
- } // fi
+ // TODO: add image actor
+ }
+ else
+ cont = false;
} // fi
+ i++;
- // Add to tree view
- // TODO: this->_UpdateTreeItem( name, parent );
- return( true );
- }
- else
- return( false );
-}
+ } // rof
-// -------------------------------------------------------------------------
-const std::string& cpExtensions::QT::SimpleMPRWidget::
-GetMainImage( ) const
-{
- return( this->m_MainImage );
+ // Add if no actors were found
+ if( cont )
+ this->SetMainActor( actor, name );
}
// -------------------------------------------------------------------------
-bool cpExtensions::QT::SimpleMPRWidget::
-SetMainImage( const std::string& name )
+void cpExtensions::QT::SimpleMPRWidget::
+AddMesh( vtkPolyData* mesh, const std::string& name )
{
- auto iIt = this->m_Data.find( name );
- if( iIt != this->m_Data.end( ) )
- {
- if( iIt->second.Tag == Data::IMAGE )
- {
- this->m_MainImage = name;
- return( true );
- }
- else
- return( false );
- }
- else
- return( false );
+ std::cerr << "SimpleMPR: adding mesh" << std::endl;
+ std::exit( 1 );
+ /* TODO
+ PolyDataActor a;
+ a.Configure( mesh );
+ this->m_PolyDatas[ mesh ] = a;
+ this->m_Renderers[ 3 ]->AddViewProp( a.Actor );
+
+ bool has_main_image = false;
+ for( unsigned int i = 0; i < 3; ++i )
+ {
+ if( this->m_2DSlices[ i ].GetPointer( ) != NULL )
+ {
+ if( this->m_2DSlices[ i ]->GetInputData( ) != NULL )
+ {
+ has_main_image = true;
+ this->m_2DSlices[ i ]->AddMesh( mesh );
+ this->m_2DSlices[ i ]->Render( );
+
+ } // fi
+
+ } // fi
+
+ } // rof
+ if( !has_main_image )
+ this->m_Renderers[ 3 ]->ResetCamera( );
+ this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
+ */
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-DeleteData( const std::string& name )
+AddMeshActor( vtkProp3D* actor, const std::string& name )
{
- auto iIt = this->m_Data.find( name );
- if( iIt != this->m_Data.end( ) )
+ if( actor != NULL )
{
- this->m_Data.erase( iIt );
-
- // Get children
- std::vector< std::string > to_erase;
- auto tIt = this->m_Tree.begin( );
- for( ; tIt != this->m_Tree.end( ); ++tIt )
- if( tIt->second == name )
- to_erase.push_back( tIt->first );
-
- // Delete from tree
- tIt = this->m_Tree.find( name );
- if( tIt != this->m_Tree.end( ) )
- this->m_Tree.erase( tIt );
-
- // Recursive erase
- auto dIt = to_erase.begin( );
- for( ; dIt != to_erase.end( ); ++dIt )
- this->DeleteData( *dIt );
-
- // Delete from tree widget
- /* TODO
- QTreeWidgetItem* item = this->_FindItemInTree( name );
- if( item != NULL )
- this->m_UI->LoadedData->removeItemWidget( item, 0 );
- */
-
- // Reset main image, just in case
- if( this->m_Data.size( ) == 0 )
- this->m_MainImage = "";
+ std::cout << name << " " << actor << std::endl;
+
+ this->m_Renderers[ 3 ]->AddViewProp( actor );
+ this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
+ this->m_NamedActors[ name ].insert( actor );
+ std::cout << "Size: " << this->m_NamedActors.size( ) << " " << this->m_NamedActors[ name ].size( ) << std::endl;
+
+
+ double bounds[ 6 ];
+ this->m_Renderers[ 3 ]->ComputeVisiblePropBounds( bounds );
+ std::cout
+ << bounds[ 0 ] << " " << bounds[ 1 ] << " "
+ << bounds[ 2 ] << " " << bounds[ 3 ] << " "
+ << bounds[ 4 ] << " " << bounds[ 5 ] << std::endl;
} // fi
}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
-DeleteAllData( )
+AddActor( vtkProp* actor, const std::string& name )
{
- this->m_MPRObjects->Clear( );
- this->m_Data.clear( );
- this->m_Tree.clear( );
- // TODO: this->m_UI->LoadedData->clear( );
- this->m_MainImage = "";
+ auto ia = dynamic_cast< vtkImageActor* >( actor );
+ if( ia == NULL )
+ {
+ auto ma = dynamic_cast< vtkProp3D* >( actor );
+ if( ma != NULL )
+ this->AddMeshActor( ma, name );
+ }
+ else
+ this->AddImageActor( ia, name );
}
// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::
-SetDataColor(
- const std::string& name, const double& r, const double& g, const double& b
- )
+const cpExtensions::QT::SimpleMPRWidget::
+TActors& cpExtensions::QT::SimpleMPRWidget::
+GetActors( const std::string& name ) const
{
- /*
- auto iIt = this->m_Data.find( name );
- if( iIt == this->m_Data.end( ) )
- return;
-
- if( iIt->second.Tag == Data::IMAGE )
- {
- }
- else if( iIt->second.Tag == Data::MESH )
- {
- } // fi
- */
+ static const TActors empty;
+ auto i = this->m_NamedActors.find( name );
+ if( i != this->m_NamedActors.end( ) )
+ return( i->second );
+ else
+ return( empty );
}
// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::
-ShowData( const std::string& name )
+vtkRenderWindowInteractor* cpExtensions::QT::SimpleMPRWidget::
+GetInteractor( unsigned int i )
{
- auto iIt = this->m_Data.find( name );
- if( iIt == this->m_Data.end( ) )
- return;
-
- if( iIt->second.Tag == Data::IMAGE )
- {
- if( name == this->m_MainImage )
- this->m_MPRObjects->SetInputImage( iIt->second.Image );
- else
- {
- unsigned int i = ( this->m_MPRObjects->GetNumberOfImages( ) - 1 ) % 8;
- this->m_MPRObjects->AddBinaryImage(
- iIt->second.Image,
- Self::cm_Colors[ i ][ 0 ],
- Self::cm_Colors[ i ][ 1 ],
- Self::cm_Colors[ i ][ 2 ]
- );
- }
- this->m_MPRObjects->Show( );
- }
- else if( iIt->second.Tag == Data::MESH )
- {
- vtkRenderer* ren =
- this->m_VTK[ 3 ]->GetRenderWindow( )->
- GetRenderers( )->GetFirstRenderer( );
- if( ren == NULL )
- return;
- ren->AddActor( iIt->second.GetMeshActor( ) );
- this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
-
- } // fi
+ if( i < 4 )
+ return( this->m_VTK[ i ]->GetRenderWindow( )->GetInteractor( ) );
+ else
+ return( NULL );
}
// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::
-HideData( const std::string& name )
+vtkRenderer* cpExtensions::QT::SimpleMPRWidget::
+GetRenderer( unsigned int i )
{
+ if( i < 4 )
+ return( this->m_Renderers[ i ] );
+ else
+ return( NULL );
}
// -------------------------------------------------------------------------
-vtkRenderWindowInteractor* cpExtensions::QT::SimpleMPRWidget::
-GetInteractor( unsigned int i )
+vtkRenderWindow* cpExtensions::QT::SimpleMPRWidget::
+GetRenderWindow( unsigned int i )
{
if( i < 4 )
{
- if( this->m_VTK[ i ] != NULL )
- return( this->m_VTK[ i ]->GetInteractor( ) );
+ if( this->m_Renderers[ i ].GetPointer( ) != NULL )
+ return( this->m_Renderers[ i ]->GetRenderWindow( ) );
else
return( NULL );
}
}
// -------------------------------------------------------------------------
-/*
- bool cpExtensions::QT::SimpleMPRWidget::
- ShowImage(
- vtkImageData* image,
- const std::string& name,
- const std::string& parent
- )
- {
- // Update tree view
- QTreeWidgetItem* new_item = this->_UpdateTreeItem( name, parent );
- if( new_item == NULL )
- return( false );
-
- // Associate new data
- this->m_Images[ name ] = image;
- this->m_Tree[ name ] = parent;
-
- // Show image and return
- this->m_MPRObjects->AddImage( image );
- return( true );
- }
-
- // -------------------------------------------------------------------------
- bool cpExtensions::QT::SimpleMPRWidget::
- ShowImage(
- vtkImageData* image,
- const std::string& name,
- const std::string& parent,
- const double& r, const double& g, const double& b
- )
- {
- // Update tree view
- QTreeWidgetItem* new_item = this->_UpdateTreeItem( name, parent );
- if( new_item == NULL )
- return( false );
-
- // Associate new data
- this->m_Images[ name ] = image;
- this->m_Tree[ name ] = parent;
-
- // Show image and return
- this->m_MPRObjects->AddImage( image );
- return( true );
- }
-
- // -------------------------------------------------------------------------
- bool cpExtensions::QT::SimpleMPRWidget::
- ShowMesh(
- vtkPolyData* mesh,
- const std::string& name,
- const std::string& parent
- )
- {
- // Update tree view
- QTreeWidgetItem* new_item = this->_UpdateTreeItem( name, parent );
- if( new_item == NULL )
- return( false );
-
- // Associate new data
- PolyDataActor* actor = new PolyDataActor( mesh );
- this->m_Meshes[ name ] = actor;
- this->m_Tree[ name ] = parent;
-
- // Show mesh
- this->_Add3DActor( actor->Actor );
- return( true );
- }
-
- // -------------------------------------------------------------------------
- bool cpExtensions::QT::SimpleMPRWidget::
- ShowMesh(
- vtkPolyData* mesh,
- const std::string& name,
- const std::string& parent,
- const double& r, const double& g, const double& b
- )
- {
- return false;
- }
-
- // -------------------------------------------------------------------------
- void cpExtensions::QT::SimpleMPRWidget::
- ClearAll( )
- {
- this->m_MPRObjects->ClearAll( );
- this->m_Images.clear( );
- this->m_Meshes.clear( );
- }
+/* TODO
+ std::vector< std::pair< vtkImageActor*, vtkRenderer* > >
+ cpExtensions::QT::SimpleMPRWidget::
+ GetMainImageActors( )
+ {
+ std::vector< std::pair< vtkImageActor*, vtkRenderer* > > actors;
+ for( unsigned int i = 0; i < 3; ++i )
+ {
+ actors.push_back(
+ std::pair< vtkImageActor*, vtkRenderer* >(
+ this->m_2DSlices[ i ]->GetImageActor( ),
+ this->m_Renderers[ i ]
+ )
+ );
+ actors.push_back(
+ std::pair< vtkImageActor*, vtkRenderer* >(
+ this->m_3DSlices[ i ]->GetImageActor( ),
+ this->m_Renderers[ 3 ]
+ )
+ );
+
+ } // rof
+ return( actors );
+ }
*/
-// -------------------------------------------------------------------------
-std::string cpExtensions::QT::SimpleMPRWidget::
-GetSelectedData( ) const
-{
- /* TODO
- QTreeWidgetItem* item = this->m_UI->LoadedData->currentItem( );
- if( item != NULL )
- return( item->text( 0 ).toStdString( ) );
- else
- */
- return( "" );
-}
-
// -------------------------------------------------------------------------
/* TODO
-QTreeWidgetItem* cpExtensions::QT::SimpleMPRWidget::
-_FindItemInTree( const std::string& name ) const
-{
- QList< QTreeWidgetItem* > items =
- this->m_UI->LoadedData->findItems(
- name.c_str( ), Qt::MatchExactly | Qt::MatchRecursive
- );
- if( items.size( ) > 0 )
- return( items[ 0 ] );
- else
- return( NULL );
-}
+ vtkActor* cpExtensions::QT::SimpleMPRWidget::
+ GetActor( vtkPolyData* mesh )
+ {
+ auto i = this->m_PolyDatas.find( mesh );
+ if( i != this->m_PolyDatas.end( ) )
+ return( i->second.Actor.GetPointer( ) );
+ else
+ return( NULL );
+ }
+*/
// -------------------------------------------------------------------------
-QTreeWidgetItem* cpExtensions::QT::SimpleMPRWidget::
-_UpdateTreeItem( const std::string& name, const std::string& parent )
+void cpExtensions::QT::SimpleMPRWidget::
+_AssociateSlices( )
{
- // Update tree view
- QTreeWidgetItem* new_item = NULL;
- if( parent != "" )
+ for( unsigned int i = 0; i < 3; ++i )
{
- QTreeWidgetItem* parent_item = this->_FindItemInTree( parent );
- if( parent_item != NULL )
+ for( unsigned int j = 0; j < 3; ++j )
{
- QTreeWidgetItem* old_item = this->_FindItemInTree( name );
- if( old_item == NULL )
- {
- new_item =
- new QTreeWidgetItem( parent_item, QStringList( name.c_str( ) ) );
- parent_item->setExpanded( true );
+ if( i != j )
+ this->m_2DSlices[ i ]->AssociateSlice( this->m_2DSlices[ j ] );
+ this->m_2DSlices[ i ]->AssociateSlice( this->m_3DSlices[ j ] );
- } // fi
+ } // rof
- } // fi
- }
- else
+ } // rof
+ for( unsigned int i = 0; i < 3; ++i )
{
- new_item = new QTreeWidgetItem(
- ( QTreeWidgetItem* )( NULL ), QStringList( name.c_str( ) )
- );
- this->m_UI->LoadedData->addTopLevelItem( new_item );
+ this->m_2DSlices[ i ]->GetStyle( )->
+ SetCurrentRenderer( this->m_Renderers[ i ] );
+ this->m_Renderers[ i ]->ResetCamera( );
+ this->m_VTK[ i ]->GetRenderWindow( )->Render( );
- } // fi
- return( new_item );
-}
-*/
-
-// -------------------------------------------------------------------------
-/*
- void cpExtensions::QT::SimpleMPRWidget::
- _Add3DActor( vtkProp3D* prop )
- {
- vtkRenderer* ren =
- this->m_VTK[ 3 ]->GetRenderWindow( )->GetRenderers( )->GetFirstRenderer( );
- if( ren == NULL )
- return;
- ren->AddActor( prop );
+ } // rof
+ this->m_Renderers[ 3 ]->ResetCamera( );
this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
- }
-*/
+}
// -------------------------------------------------------------------------
void cpExtensions::QT::SimpleMPRWidget::
this->m_UI->TopSplitter->setSizes( this->m_UI->BottomSplitter->sizes( ) );
}
-// -------------------------------------------------------------------------
-cpExtensions::QT::SimpleMPRWidget::PolyDataActor::
-PolyDataActor( )
- : Mesh( NULL ),
- Normals( NULL ),
- Stripper( NULL ),
- Mapper( NULL ),
- Actor( NULL )
-{
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::SimpleMPRWidget::PolyDataActor::
-~PolyDataActor( )
-{
- if( this->Actor != NULL ) this->Actor->Delete( );
- if( this->Mapper != NULL ) this->Mapper->Delete( );
- if( this->Stripper != NULL ) this->Stripper->Delete( );
- if( this->Normals != NULL ) this->Normals->Delete( );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::PolyDataActor::
-Configure( vtkPolyData* pd )
-{
- if( pd == NULL )
- return;
-
- double range[ 2 ];
- pd->GetScalarRange( range );
-
- this->Normals = vtkPolyDataNormals::New( );
- this->Stripper = vtkStripper::New( );
- this->Mapper = vtkPolyDataMapper::New( );
- this->Actor = vtkQuadricLODActor::New( );
-
- this->Mesh = pd;
- this->Normals->SetInputData( pd );
- this->Normals->SetFeatureAngle( 60.0 );
- this->Stripper->SetInputConnection( this->Normals->GetOutputPort( ) );
- this->Mapper->SetInputConnection( this->Stripper->GetOutputPort( ) );
- this->Mapper->UseLookupTableScalarRangeOff( );
- this->Mapper->SetScalarRange(
- range[ 0 ], ( ( range[ 1 ] - range[ 0 ] ) * 0.75 ) + range[ 0 ]
- );
- this->Actor->SetMapper( this->Mapper );
- this->Actor->DeferLODConstructionOff( );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::SimpleMPRWidget::Data::
-Data( )
-{
- this->Tag = Data::IMAGE;
- this->Image = NULL;
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::SimpleMPRWidget::Data::
-~Data( )
-{
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::SimpleMPRWidget::
-Data& cpExtensions::QT::SimpleMPRWidget::Data::
-operator=( const Data& data )
-{
- this->Tag = data.Tag;
- if( this->Tag == Data::IMAGE )
- this->Image = data.Image;
- else if( this->Tag == Data::MESH )
- this->Mesh = data.Mesh;
- return( *this );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::Data::
-SetImageData( vtkImageData* data )
-{
- this->Tag = Data::IMAGE;
- this->Image = data;
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::SimpleMPRWidget::Data::
-SetPolyData( vtkPolyData* data )
-{
- this->Tag = Data::MESH;
- this->Mesh.Configure( data );
-}
-
-// -------------------------------------------------------------------------
-vtkImageData* cpExtensions::QT::SimpleMPRWidget::Data::
-GetImage( )
-{
- if( this->Tag == Data::IMAGE )
- return( this->Image );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-vtkPolyData* cpExtensions::QT::SimpleMPRWidget::Data::
-GetMesh( )
-{
- if( this->Tag == Data::MESH )
- return( this->Mesh.Mesh );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-vtkProp* cpExtensions::QT::SimpleMPRWidget::Data::
-GetMeshActor( )
-{
- if( this->Tag == Data::MESH )
- return( this->Mesh.Actor );
- else
- return( NULL );
-}
-
#endif // cpExtensions_QT4
// eof - $RCSfile$