]> Creatis software - cpPlugins.git/blobdiff - lib/cpInstances/DataObjects/Simple3DCurve.cxx
yet another refactoring
[cpPlugins.git] / lib / cpInstances / DataObjects / Simple3DCurve.cxx
diff --git a/lib/cpInstances/DataObjects/Simple3DCurve.cxx b/lib/cpInstances/DataObjects/Simple3DCurve.cxx
new file mode 100644 (file)
index 0000000..10165f7
--- /dev/null
@@ -0,0 +1,64 @@
+#include <cpInstances/DataObjects/Simple3DCurve.h>
+#include <cpExtensions/DataStructures/Simple3DCurve.h>
+#include <cpExtensions/Visualization/Simple3DCurveToPolyData.h>
+
+// -------------------------------------------------------------------------
+void cpInstances::Simple3DCurve::
+SetVTK( vtkObjectBase* o )
+{
+  // Do nothing
+}
+
+// -------------------------------------------------------------------------
+cpInstances::Simple3DCurve::
+Simple3DCurve( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+cpInstances::Simple3DCurve::
+~Simple3DCurve( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpInstances::Simple3DCurve::
+_UpdateVTK( ) const
+{
+  auto i = const_cast< itk::LightObject* >( this->m_ITK.GetPointer( ) );
+  auto v = const_cast< vtkObjectBase* >( this->m_VTK.GetPointer( ) );
+  if( i != NULL && v == NULL )
+  {
+    cpPlugins_Demangle_Simple3DCurve_All_1( i, _ITK_2_VTK );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TCurve >
+void cpInstances::Simple3DCurve::
+_ITK_2_VTK( _TCurve* curve ) const
+{
+  typedef
+    cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >
+    _TFilter;
+
+  Self* self = const_cast< Self* >( this );
+  _TFilter* f = dynamic_cast< _TFilter* >( self->m_ITKvVTK.GetPointer( ) );
+  if( f == NULL )
+  {
+    _TFilter* nf = _TFilter::New( );
+    self->m_ITKvVTK = nf;
+    f = nf;
+
+  } // fi
+  f->SetInput( curve );
+  f->Update( );
+
+  // Keep object track
+  self->m_ITK = curve;
+  self->m_VTK = f->GetOutput( );
+}
+
+// eof - $RCSfile$