]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/ImageSliceMapper.cxx
Windows compilation: 3/3
[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 #ifdef cpPlugins_OpenGL_BackEnd_OpenGL2
22   // Complete polydatas to avoid bizarre rendering errors (multi-thread)
23   vtkActor* a[ 3 ];
24   a[ 0 ] = this->PolyDataActor;
25   a[ 1 ] = this->BackingPolyDataActor;
26   a[ 2 ] = this->BackgroundPolyDataActor;
27   for( unsigned int i = 0; i < 3; ++i )
28   {
29     if( a[ i ] != NULL )
30     {
31       auto m =
32         dynamic_cast< vtkOpenGLPolyDataMapper* >( a[ i ]->GetMapper( ) );
33       if( m != NULL )
34       {
35         auto p = m->GetInput( );
36         if( p != NULL )
37         {
38           vtkNew< vtkCellArray > verts;
39           vtkNew< vtkCellArray > lines;
40           vtkNew< vtkCellArray > strips;
41           p->SetVerts( verts.Get( ) );
42           p->SetLines( lines.Get( ) );
43           p->SetStrips( strips.Get( ) );
44           p->Modified( );
45           m->Modified( );
46           a[ i ]->Modified( );
47
48         } // fi
49
50       } // fi
51
52     } // fi
53
54   } // rof
55 #endif // cpPlugins_OpenGL_BackEnd_OpenGL2
56 }
57
58 // -------------------------------------------------------------------------
59 cpExtensions::Visualization::ImageSliceMapper::
60 ~ImageSliceMapper( )
61 {
62 }
63
64 // eof - $RCSfile$