]> Creatis software - cpPlugins.git/blob - lib/cpInstances/Simple3DCurve.cxx
42035b20d557622df0330e6e4888b14d3f3c35e7
[cpPlugins.git] / lib / cpInstances / Simple3DCurve.cxx
1 #include <cpInstances/Simple3DCurve.h>
2 #include <cpExtensions/DataStructures/Simple3DCurve.h>
3 #include <cpExtensions/Visualization/Simple3DCurveToPolyData.h>
4
5 // -------------------------------------------------------------------------
6 void cpInstances::Simple3DCurve::
7 SetVTK( vtkObjectBase* o )
8 {
9   // Do nothing
10 }
11
12 // -------------------------------------------------------------------------
13 cpInstances::Simple3DCurve::
14 Simple3DCurve( )
15   : Superclass( )
16 {
17 }
18
19 // -------------------------------------------------------------------------
20 cpInstances::Simple3DCurve::
21 ~Simple3DCurve( )
22 {
23 }
24
25 // -------------------------------------------------------------------------
26 void cpInstances::Simple3DCurve::
27 _UpdateVTK( ) const
28 {
29   auto i = const_cast< itk::LightObject* >( this->m_ITK.GetPointer( ) );
30   auto v = const_cast< vtkObjectBase* >( this->m_VTK.GetPointer( ) );
31   if( i != NULL && v == NULL )
32   {
33     cpPlugins_Demangle_Simple3DCurve_All_1( i, _ITK_2_VTK );
34
35   } // fi
36 }
37
38 // -------------------------------------------------------------------------
39 template< class _TCurve >
40 void cpInstances::Simple3DCurve::
41 _ITK_2_VTK( _TCurve* curve ) const
42 {
43   typedef
44     cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >
45     _TFilter;
46
47   Self* self = const_cast< Self* >( this );
48   _TFilter* f = dynamic_cast< _TFilter* >( self->m_ITKvVTK.GetPointer( ) );
49   if( f == NULL )
50   {
51     _TFilter* nf = _TFilter::New( );
52     self->m_ITKvVTK = nf;
53     f = nf;
54
55   } // fi
56   f->SetInput( curve );
57   f->Update( );
58
59   // Keep object track
60   self->m_ITK = curve;
61   self->m_VTK = f->GetOutput( );
62 }
63
64 // eof - $RCSfile$