]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface/Mesh.cxx
e179c8ed61e4b0e34b7fcd391b6c92d2cf73309c
[cpPlugins.git] / lib / cpPlugins / Interface / Mesh.cxx
1 #include <cpPlugins/Interface/Mesh.h>
2
3 #include <vtkPolyData.h>
4
5 // -------------------------------------------------------------------------
6 void cpPlugins::Interface::Mesh::
7 SetVTK( vtkObject* mesh )
8 {
9   if( dynamic_cast< vtkPolyData* >( mesh ) != NULL )
10     this->m_VTKObject = mesh;
11   else
12     this->m_VTKObject = NULL;
13   this->m_Mapper = NULL;
14   this->m_Actor = NULL;
15   this->Modified( );
16 }
17
18 // -------------------------------------------------------------------------
19 void cpPlugins::Interface::Mesh::
20 CreateVTKActor( )
21 {
22   vtkPolyData* pd = this->GetVTK< vtkPolyData >( );
23   if(
24     pd != NULL &&
25     (
26       this->m_Mapper.GetPointer( ) == NULL ||
27       this->m_Actor.GetPointer( ) == NULL
28       )
29     )
30   {
31     this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
32     this->m_Actor = vtkSmartPointer< vtkActor >::New( );
33     this->m_Mapper->SetInputData( pd );
34     this->m_Actor->SetMapper( this->m_Mapper );
35     this->Modified( );
36
37   } // fi
38 }
39
40 // -------------------------------------------------------------------------
41 vtkActor* cpPlugins::Interface::Mesh::
42 GetVTKActor( )
43 {
44   return( this->m_Actor );
45 }
46
47 // -------------------------------------------------------------------------
48 const vtkActor* cpPlugins::Interface::Mesh::
49 GetVTKActor( ) const
50 {
51   return( this->m_Actor );
52 }
53
54 // -------------------------------------------------------------------------
55 cpPlugins::Interface::Mesh::
56 Mesh( )
57   : Superclass( ),
58     m_Mapper( NULL ),
59     m_Actor( NULL )
60 {
61   this->m_ClassName = "cpPlugins::Interface::Mesh";
62   this->m_ClassCategory = "BasicObject";
63 }
64
65 // -------------------------------------------------------------------------
66 cpPlugins::Interface::Mesh::
67 ~Mesh( )
68 {
69 }
70
71 // eof - $RCSfile$