]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/ImageOutlineActor.cxx
yet another refactoring
[cpPlugins.git] / lib / cpExtensions / Visualization / ImageOutlineActor.cxx
1 #include <cpExtensions/Visualization/ImageOutlineActor.h>
2 #include <cpExtensions/Visualization/ImageOutlineSource.h>
3 #include <vtkPolyDataMapper.h>
4 #include <vtkProperty.h>
5
6 // -------------------------------------------------------------------------
7 double cpExtensions::Visualization::ImageOutlineActor::Colors[ 3 ][ 3 ] =
8 {
9   { 1, 0, 0 },
10   { 0, 1, 0 },
11   { 0, 0, 1 }
12 };
13
14 // -------------------------------------------------------------------------
15 cpExtensions::Visualization::ImageOutlineActor::
16 Self* cpExtensions::Visualization::ImageOutlineActor::
17 New( )
18 {
19   return( new Self( ) );
20 }
21
22 // -------------------------------------------------------------------------
23 void cpExtensions::Visualization::ImageOutlineActor::
24 Modified( )
25 {
26   this->m_Outline->Modified( );
27   this->m_Mapper->Modified( );
28   this->Superclass::Modified( );
29 }
30
31 // -------------------------------------------------------------------------
32 void cpExtensions::Visualization::ImageOutlineActor::
33 SetBounds( int orientation, double step, double* bounds )
34 {
35   // Update geometry
36   this->m_Outline->SetBounds( orientation, step, bounds );
37
38   // Update visualization properties
39   int o = orientation % 3;
40   this->GetProperty( )->SetLineWidth( 1.5 );
41   this->GetProperty( )->SetColor(
42     Self::Colors[ o ][ 0 ],
43     Self::Colors[ o ][ 1 ],
44     Self::Colors[ o ][ 2 ]
45     );
46   this->Modified( );
47 }
48
49 // -------------------------------------------------------------------------
50 cpExtensions::Visualization::ImageOutlineActor::
51 ImageOutlineActor( )
52   : Superclass( )
53 {
54   this->m_Outline = vtkSmartPointer< ImageOutlineSource >::New( );
55   this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
56   this->m_Mapper->SetInputConnection( this->m_Outline->GetOutputPort( ) );
57   this->SetMapper( this->m_Mapper );
58
59   this->UseBoundsOff( );
60 }
61
62 // -------------------------------------------------------------------------
63 cpExtensions::Visualization::ImageOutlineActor::
64 ~ImageOutlineActor( )
65 {
66 }
67
68 // eof - $RCSfile$