#include <cpPlugins/Interface/DataObject.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::DataObject::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::DataObject" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::DataObject::
-GetClassType( ) const
-{
- return( "DataObject" );
-}
-
-// -------------------------------------------------------------------------
-itk::DataObject* cpPlugins::Interface::DataObject::
-GetRealDataObject( ) const
-{
- return( this->m_RealDataObject );
-}
+#include <cpPlugins/Interface/ProcessObject.h>
+#include <itkDataObject.h>
+#include <vtkImageData.h>
+#include <vtkPolyData.h>
// -------------------------------------------------------------------------
-void cpPlugins::Interface::DataObject::
-SetRealDataObject( itk::DataObject* dobj )
-{
- this->m_RealDataObject = dobj;
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Object* cpPlugins::Interface::DataObject::
+cpPlugins::Interface::ProcessObject* cpPlugins::Interface::DataObject::
GetSource( )
{
- return( this->m_Source );
+ auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+ return( ptr->GetPointer( ) );
}
// -------------------------------------------------------------------------
-const cpPlugins::Interface::Object* cpPlugins::Interface::DataObject::
+const cpPlugins::Interface::ProcessObject* cpPlugins::Interface::DataObject::
GetSource( ) const
{
- return( this->m_Source );
+ auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+ return( ptr->GetPointer( ) );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::DataObject::
-SetSource( cpPlugins::Interface::Object* src )
+SetSource( cpPlugins::Interface::ProcessObject* src )
{
- this->m_Source = src;
+ auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+ if( ptr->GetPointer( ) != src )
+ {
+ *ptr = src;
+ this->Modified( );
+
+ } // fi
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::DataObject::
-DisconnectPipeline( )
+DisconnectFromPipeline( )
{
- if( this->m_RealDataObject.IsNotNull( ) )
+ // Disconnect input pipelines (ITK)
+ itk::DataObject* itk_obj = this->GetITK< itk::DataObject >( );
+ if( itk_obj != NULL )
+ itk_obj->DisconnectPipeline( );
+
+ // Disconnect input pipelines (VTK)
+ vtkImageData* vtk_image = this->GetVTK< vtkImageData >( );
+ vtkPolyData* vtk_pd = this->GetVTK< vtkPolyData >( );
+ if( vtk_image != NULL )
{
- this->m_RealDataObject->DisconnectPipeline( );
- if( this->m_Source.IsNotNull( ) )
- this->m_Source->Delete( );
- this->Register( );
+ vtkSmartPointer< vtkImageData > d =
+ vtkSmartPointer< vtkImageData >::New( );
+ d->ShallowCopy( vtk_image );
+ this->m_VTKObject = d;
+ }
+ else if( vtk_pd != NULL )
+ {
+ vtkSmartPointer< vtkPolyData > d =
+ vtkSmartPointer< vtkPolyData >::New( );
+ d->ShallowCopy( vtk_pd );
+ this->m_VTKObject = d;
} // fi
+
+ // Unbind source
+ auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+ *ptr = NULL;
+ this->Modified( );
}
// -------------------------------------------------------------------------
DataObject( )
: Superclass( )
{
+ this->m_Source = new ProcessObject::Pointer( );
}
// -------------------------------------------------------------------------
cpPlugins::Interface::DataObject::
~DataObject( )
{
+ /* TODO
+ auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
+ delete ptr;
+ */
}
// eof - $RCSfile$