#ifndef __CPPLUGINS__INTERFACE__PLUGINS__H__
#define __CPPLUGINS__INTERFACE__PLUGINS__H__
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/DataObject.h>
+#include <cpPlugins/Interface/ProcessObject.h>
#include <map>
#include <set>
#include <string>
+#include <vector>
-#include <cpPlugins/Interface/Interface.h>
-#include <cpPlugins/Interface/ProcessObject.h>
-#include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Interface/Mesh.h>
-
-class QObject;
-class QMenu;
-class QWidget;
+// Some forward declarations
class vtkRenderWindowInteractor;
+#ifdef cpPlugins_Interface_QT4
+class QWidget;
+#else
+typedef char QWidget;
+#endif // cpPlugins_Interface_QT4
namespace cpPlugins
{
namespace Interface
{
- class BasePluginsApplication;
+ // Some forward declarations
+ class BaseApplication;
/**
*/
typedef cpPlugins::Interface::Interface TInterface;
typedef cpPlugins::Interface::ProcessObject TProcessObject;
typedef cpPlugins::Interface::DataObject TDataObject;
- typedef cpPlugins::Interface::Image TImage;
- typedef cpPlugins::Interface::Mesh TMesh;
typedef TProcessObject::TParameters TParameters;
- typedef std::set< std::string > TOrderedStringContainer;
- typedef std::map< std::string, std::set< std::string > > TFilters;
- typedef std::pair< std::string, TDataObject::Pointer > TTreeNode;
- typedef std::map< std::string, TTreeNode > TTree;
+ typedef std::set< std::string > TStringContainer;
public:
- Plugins( QWidget* widget = NULL );
+ Plugins( );
virtual ~Plugins( );
+ // Qt oriented methods
QWidget* GetWidget( );
const QWidget* GetWidget( ) const;
void SetWidget( QWidget* widget );
void BlockWidget( );
void UnblockWidget( );
void DialogLoadPlugins( );
- void AssociatePluginsToMenu(
- QMenu* menu, QObject* obj, const char* slot
- );
- BasePluginsApplication* GetApplication( );
- const BasePluginsApplication* GetApplication( ) const;
- void SetApplication( BasePluginsApplication* a );
+ // Connection to main application
+ BaseApplication* GetApplication( );
+ const BaseApplication* GetApplication( ) const;
+ void SetApplication( BaseApplication* a );
- bool LoadPlugins( );
+ // Plugins management
+ bool LoadPluginsPath( const std::string& path, bool r = false );
bool LoadPlugins( const std::string& fname );
bool LoadPluginsConfigurationFile( const std::string& fname );
+ const TStringContainer& GetLoadedPlugins( ) const;
+ void GetLoadedCategories( TStringContainer& categories ) const;
+ void GetLoadedFilters( TStringContainer& filters ) const;
+ const TStringContainer& GetLoadedFilters(
+ const std::string& category
+ ) const;
// Interactors
void AddInteractor( vtkRenderWindowInteractor* interactor );
);
std::string ReadMesh( const std::string& parent );
- bool WriteImage( const std::string& fname, const std::string& name );
- bool WriteImage( const std::string& name );
- bool WriteMesh( const std::string& fname, const std::string& name );
- bool WriteMesh( const std::string& name );
+ bool WriteDataObject(
+ const std::string& fname, const std::string& name
+ );
+ bool WriteDataObject( const std::string& name );
// Data objects
void ClearDataObjects( );
void DeleteDataObject( const std::string& name );
+ void GetDataObjects( TStringContainer& names );
std::string GetParent( const std::string& name ) const;
- const TTree& GetDataObjects( ) const;
- TDataObject* GetDataObject( const std::string& name );
- const TDataObject* GetDataObject( const std::string& name ) const;
- TImage* GetImage( const std::string& name );
- const TImage* GetImage( const std::string& name ) const;
- TMesh* GetMesh( const std::string& name );
- const TMesh* GetMesh( const std::string& name ) const;
+ void GetChildren(
+ TStringContainer& names, const std::string& name
+ ) const;
+ void GetRoots( TStringContainer& names ) const;
+
+ template< class T >
+ inline T* GetData( const std::string& name );
+
+ template< class T >
+ inline const T* GetData( const std::string& name ) const;
// Filter acces
bool ActivateFilter( const std::string& name );
void DeactivateFilter( );
bool HasActiveFilter( ) const;
bool IsActiveFilterInteractive( ) const;
- unsigned int GetNumberOfInputsInActiveFilter( ) const;
- unsigned int GetNumberOfOutputsInActiveFilter( ) const;
- std::vector< std::string > GetActiveFilterInputsNames( ) const;
- std::vector< std::string > GetActiveFilterOutputsNames( ) const;
- void ConnectInputInActiveFilter(
- const std::string& object_name, const std::string& input
+ void GetActiveFilterInputsNames( TStringContainer& names ) const;
+ void GetActiveFilterOutputsNames( TStringContainer& names ) const;
+ bool ConnectInputInActiveFilter(
+ const std::string& object_name, const std::string& input_name
);
- void SetOutputNameInActiveFilter(
- const std::string& new_name, const std::string& output
+ bool SetOutputNameInActiveFilter(
+ const std::string& new_object_name, const std::string& output_name
);
TParameters* GetActiveFilterParameters( );
const TParameters* GetActiveFilterParameters( ) const;
TProcessObject::DialogResult ConfigureActiveFilter( );
- std::string UpdateActiveFilter( std::vector< std::string >& outputs );
+ bool UpdateActiveFilter(
+ TStringContainer& outputs,
+ const std::string& parent
+ );
protected:
void _UpdateLoadedPluginsInformation( );
+ bool _ActivateIOFilter( const std::string& filter );
+ std::string _ReadData( const std::string& parent );
+ bool _WriteData( const std::string& name );
bool _InsertNewData( TDataObject* dobj, const std::string& parent );
protected:
- QWidget* m_Widget;
- BasePluginsApplication* m_Application;
+ // MVC objects
+ QWidget* m_Widget;
+ BaseApplication* m_Application;
- TInterface m_Interface;
- TOrderedStringContainer m_LoadedPlugins;
- std::string m_LastLoadedPlugin;
+ // Plugins interface
+ TInterface m_Interface;
+ TStringContainer m_LoadedPlugins;
+ std::string m_LastLoadedPlugin;
+ std::map< std::string, TStringContainer > m_LoadedFilters;
- TProcessObject::Pointer m_ImageReader;
- TProcessObject::Pointer m_ImageWriter;
- TProcessObject::Pointer m_MeshReader;
- TProcessObject::Pointer m_MeshWriter;
- TProcessObject::Pointer m_DicomSeriesReader;
- TProcessObject::Pointer m_ActiveFilter;
- std::map< std::string, std::string > m_ActiveFilterOutputs;
- TFilters m_Filters;
+ // Loaded filters
+ std::map< std::string, TProcessObject::Pointer > m_IOFilters;
+ TProcessObject::Pointer m_ActiveFilter;
- // Loaded objects
- TTree m_Objects;
+ // Loaded data objects
+ typedef std::pair< std::string, TDataObject::Pointer > _TTreeNode;
+ std::map< std::string, _TTreeNode > m_DataObjects;
// Associated interactors
std::set< vtkRenderWindowInteractor* > m_Interactors;
} // ecapseman
+#include <cpPlugins/Interface/Plugins.hxx>
+
#endif // __CPPLUGINS__INTERFACE__PLUGINS__H__
// eof - $RCSfile$