]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/ImageSliceMapper.cxx
Architecture updated.
[cpPlugins.git] / lib / cpExtensions / Visualization / ImageSliceMapper.cxx
1 #include <cpExtensions/Visualization/ImageSliceMapper.h>
2 #include <vtkActor.h>
3 #include <vtkCellArray.h>
4 #include <vtkNew.h>
5 #include <vtkOpenGLPolyDataMapper.h>
6 #include <vtkPolyData.h>
7
8 // -------------------------------------------------------------------------
9 cpExtensions::Visualization::ImageSliceMapper::
10 Self* cpExtensions::Visualization::ImageSliceMapper::
11 New( )
12 {
13   return( new Self( ) );
14 }
15
16 // -------------------------------------------------------------------------
17 cpExtensions::Visualization::ImageSliceMapper::
18 ImageSliceMapper( )
19   : Superclass( )
20 {
21   // Complete polydatas to avoid bizarre rendering errors (multi-thread)
22   vtkActor* a[ 3 ];
23   a[ 0 ] = this->PolyDataActor;
24   a[ 1 ] = this->BackingPolyDataActor;
25   a[ 2 ] = this->BackgroundPolyDataActor;
26   for( unsigned int i = 0; i < 3; ++i )
27   {
28     if( a[ i ] != NULL )
29     {
30       auto m =
31         dynamic_cast< vtkOpenGLPolyDataMapper* >( a[ i ]->GetMapper( ) );
32       if( m != NULL )
33       {
34         auto p = m->GetInput( );
35         if( p != NULL )
36         {
37           vtkNew< vtkCellArray > verts;
38           vtkNew< vtkCellArray > lines;
39           vtkNew< vtkCellArray > strips;
40           p->SetVerts( verts.Get( ) );
41           p->SetLines( lines.Get( ) );
42           p->SetStrips( strips.Get( ) );
43           p->Modified( );
44           m->Modified( );
45           a[ i ]->Modified( );
46
47         } // fi
48
49       } // fi
50
51     } // fi
52
53   } // rof
54 }
55
56 // -------------------------------------------------------------------------
57 cpExtensions::Visualization::ImageSliceMapper::
58 ~ImageSliceMapper( )
59 {
60 }
61
62 // eof - $RCSfile$