From 406ebd171557827b3fa0133073dd69780a6e3f6f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Wed, 8 Feb 2017 15:57:06 -0500 Subject: [PATCH] ... --- cmake/cpPluginsConfig.cmake.in | 1 + lib/cpInstances/DataObjects/Simple3DCurve.cxx | 10 +-- lib/cpInstances/DataObjects/Simple3DCurve.h | 80 ++++++++++--------- lib/cpPlugins/Interface/Workspace.cxx | 23 ++++-- lib/cpPlugins/Interface/Workspace.h | 4 + plugins/ITKSliceFilters/CPRImageFilter.cxx | 2 +- .../PolyLineParametricPathToSimple3DCurve.cxx | 2 +- 7 files changed, 71 insertions(+), 51 deletions(-) diff --git a/cmake/cpPluginsConfig.cmake.in b/cmake/cpPluginsConfig.cmake.in index 2a2315e..0a65b42 100644 --- a/cmake/cpPluginsConfig.cmake.in +++ b/cmake/cpPluginsConfig.cmake.in @@ -31,6 +31,7 @@ SET( ) IF(USE_QT4) LIST(APPEND _all_libs cpBaseQtApplication) + LIST(APPEND _all_libs cp_QCustomPlot) ENDIF(USE_QT4) SET(cpPlugins_Libraries ${_all_libs} CACHE STRING "cpPlugins base libraries") MARK_AS_ADVANCED(FORCE cpPlugins_Libraries) diff --git a/lib/cpInstances/DataObjects/Simple3DCurve.cxx b/lib/cpInstances/DataObjects/Simple3DCurve.cxx index 10165f7..659efff 100644 --- a/lib/cpInstances/DataObjects/Simple3DCurve.cxx +++ b/lib/cpInstances/DataObjects/Simple3DCurve.cxx @@ -3,27 +3,27 @@ #include // ------------------------------------------------------------------------- -void cpInstances::Simple3DCurve:: +void cpInstances::DataObjects::Simple3DCurve:: SetVTK( vtkObjectBase* o ) { // Do nothing } // ------------------------------------------------------------------------- -cpInstances::Simple3DCurve:: +cpInstances::DataObjects::Simple3DCurve:: Simple3DCurve( ) : Superclass( ) { } // ------------------------------------------------------------------------- -cpInstances::Simple3DCurve:: +cpInstances::DataObjects::Simple3DCurve:: ~Simple3DCurve( ) { } // ------------------------------------------------------------------------- -void cpInstances::Simple3DCurve:: +void cpInstances::DataObjects::Simple3DCurve:: _UpdateVTK( ) const { auto i = const_cast< itk::LightObject* >( this->m_ITK.GetPointer( ) ); @@ -37,7 +37,7 @@ _UpdateVTK( ) const // ------------------------------------------------------------------------- template< class _TCurve > -void cpInstances::Simple3DCurve:: +void cpInstances::DataObjects::Simple3DCurve:: _ITK_2_VTK( _TCurve* curve ) const { typedef diff --git a/lib/cpInstances/DataObjects/Simple3DCurve.h b/lib/cpInstances/DataObjects/Simple3DCurve.h index e53df26..5ea0047 100644 --- a/lib/cpInstances/DataObjects/Simple3DCurve.h +++ b/lib/cpInstances/DataObjects/Simple3DCurve.h @@ -1,5 +1,5 @@ -#ifndef __cpInstances__Simple3DCurve__h__ -#define __cpInstances__Simple3DCurve__h__ +#ifndef __cpInstances__DataObjects__Simple3DCurve__h__ +#define __cpInstances__DataObjects__Simple3DCurve__h__ #include #include @@ -13,43 +13,47 @@ class vtkPolyDataAlgorithm; // ------------------------------------------------------------------------- namespace cpInstances { - /** - */ - class cpPluginsDataObjects_EXPORT Simple3DCurve - : public cpPlugins::Pipeline::DataObject + namespace DataObjects { - public: - typedef Simple3DCurve Self; - typedef cpPlugins::Pipeline::DataObject Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - public: - itkNewMacro( Self ); - itkTypeMacro( Simple3DCurve, cpPlugins::Pipeline::DataObject ); - cpPlugins_Id_Macro( Simple3DCurve, Object ); - cpPlugins_Compatibility_Macro; - - public: - virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE; - - protected: - Simple3DCurve( ); - virtual ~Simple3DCurve( ); - - virtual void _UpdateVTK( ) const cpPlugins_OVERRIDE; - - template< class _TCurve > - inline void _ITK_2_VTK( _TCurve* curve ) const; - - private: - // Purposely not implemented - Simple3DCurve( const Self& ); - Self& operator=( const Self& ); - - protected: - vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK; - }; + /** + */ + class cpPluginsDataObjects_EXPORT Simple3DCurve + : public cpPlugins::Pipeline::DataObject + { + public: + typedef Simple3DCurve Self; + typedef cpPlugins::Pipeline::DataObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + public: + itkNewMacro( Self ); + itkTypeMacro( Simple3DCurve, cpPlugins::Pipeline::DataObject ); + cpPlugins_Id_Macro( Simple3DCurve, Object ); + cpPlugins_Compatibility_Macro; + + public: + virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE; + + protected: + Simple3DCurve( ); + virtual ~Simple3DCurve( ); + + virtual void _UpdateVTK( ) const cpPlugins_OVERRIDE; + + template< class _TCurve > + inline void _ITK_2_VTK( _TCurve* curve ) const; + + private: + // Purposely not implemented + Simple3DCurve( const Self& ); + Self& operator=( const Self& ); + + protected: + vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK; + }; + + } // ecapseman } // ecapseman diff --git a/lib/cpPlugins/Interface/Workspace.cxx b/lib/cpPlugins/Interface/Workspace.cxx index 3822969..4fbcb2b 100644 --- a/lib/cpPlugins/Interface/Workspace.cxx +++ b/lib/cpPlugins/Interface/Workspace.cxx @@ -78,7 +78,10 @@ HasWidget( const std::string& name ) const // ------------------------------------------------------------------------- cpPlugins::Interface::Workspace:: TFilter* cpPlugins::Interface::Workspace:: -CreateFilter( const std::string& category, const std::string& filter ) +CreateFilter( + const std::string& category, const std::string& filter, + const std::string& name + ) { typedef cpPlugins::Pipeline::Widget _TWidget; @@ -86,11 +89,11 @@ CreateFilter( const std::string& category, const std::string& filter ) if( o.IsNotNull( ) ) { // Choose a name - std::string name = filter; - while( this->GetFilter( name ) != NULL ) - name += std::string( "_" ); + std::string real_name = name; + while( this->GetFilter( real_name ) != NULL ) + real_name += std::string( "_" ); o->SetPrintExecution( this->m_PrintExecution ); - o->SetName( name ); + o->SetName( real_name ); // Interactors for( @@ -101,12 +104,20 @@ CreateFilter( const std::string& category, const std::string& filter ) o->AddInteractor( *i ); // Finish association - this->m_Filters[ name ] = o; + this->m_Filters[ real_name ] = o; } // fi return( o.GetPointer( ) ); } +// ------------------------------------------------------------------------- +cpPlugins::Interface::Workspace:: +TFilter* cpPlugins::Interface::Workspace:: +CreateFilter( const std::string& category, const std::string& filter ) +{ + return( this->CreateFilter( category, filter, filter ) ); +} + // ------------------------------------------------------------------------- bool cpPlugins::Interface::Workspace:: RenameFilter( const std::string& old_name, const std::string& new_name ) diff --git a/lib/cpPlugins/Interface/Workspace.h b/lib/cpPlugins/Interface/Workspace.h index 745bd98..fd9847b 100644 --- a/lib/cpPlugins/Interface/Workspace.h +++ b/lib/cpPlugins/Interface/Workspace.h @@ -57,6 +57,10 @@ namespace cpPlugins const TWidget* GetWidget( const std::string& name ) const; bool HasFilter( const std::string& name ) const; bool HasWidget( const std::string& name ) const; + TFilter* CreateFilter( + const std::string& category, const std::string& filter, + const std::string& name + ); TFilter* CreateFilter( const std::string& category, const std::string& filter ); diff --git a/plugins/ITKSliceFilters/CPRImageFilter.cxx b/plugins/ITKSliceFilters/CPRImageFilter.cxx index 60de5f5..9e6b8a8 100644 --- a/plugins/ITKSliceFilters/CPRImageFilter.cxx +++ b/plugins/ITKSliceFilters/CPRImageFilter.cxx @@ -13,7 +13,7 @@ CPRImageFilter( ) : Superclass( ) { typedef cpInstances::DataObjects::Image _TImage; - typedef cpInstances::Simple3DCurve _TCurve; + typedef cpInstances::DataObjects::Simple3DCurve _TCurve; this->_ConfigureInput< _TImage >( "Image", true, false ); this->_ConfigureInput< _TCurve >( "Curve", true, false ); this->_ConfigureOutput< _TImage >( "Output" ); diff --git a/plugins/cpExtensions/PolyLineParametricPathToSimple3DCurve.cxx b/plugins/cpExtensions/PolyLineParametricPathToSimple3DCurve.cxx index 21760ce..7b2b853 100644 --- a/plugins/cpExtensions/PolyLineParametricPathToSimple3DCurve.cxx +++ b/plugins/cpExtensions/PolyLineParametricPathToSimple3DCurve.cxx @@ -14,7 +14,7 @@ PolyLineParametricPathToSimple3DCurve( ) this->_ConfigureInput< cpInstances::PolyLineParametricPath >( "Input", true, false ); - this->_ConfigureOutput< cpInstances::Simple3DCurve >( "Output" ); + this->_ConfigureOutput< cpInstances::DataObjects::Simple3DCurve >( "Output" ); this->m_Parameters.ConfigureAsUint( "NumberOfSamples", 0 ); } -- 2.47.1