// Some forward declarations
class QWidget;
+class vtkRenderWindowInteractor;
namespace cpPlugins
{
namespace Interface
{
- /**
+ // Some forward declarations
+#ifdef cpPlugins_Interface_QT4
+ class SimpleMPRWidget;
+#else // cpPlugins_Interface_QT4
+ typedef char SimpleMPRWidget;
+#endif // cpPlugins_Interface_QT4
+
+ /** \brief A complex pipeline
*/
class cpPlugins_Interface_EXPORT Workspace
{
public:
- typedef cpPlugins::Interface::Interface TInterface;
+ typedef cpPlugins::Interface::Interface TPlugins;
typedef cpPlugins::Interface::Object TObject;
typedef cpPlugins::Interface::ProcessObject TFilter;
typedef cpPlugins::Interface::DataObject TData;
typedef TFilter::TParameters TParameters;
// Various types
- typedef std::set< std::string > TStringContainer;
+ typedef std::set< std::string > TStringContainer;
+ typedef std::pair< std::string, std::string > TExposedPort;
+ typedef std::map< std::string, TExposedPort > TExposedPorts;
// Graph type
typedef std::pair< std::string, std::string > TConnection;
virtual ~Workspace( );
// Plugins management
- bool LoadPluginsPath( const std::string& path, bool r = false );
- bool LoadPlugins( const std::string& fname );
- const TStringContainer& GetLoadedPlugins( ) const;
- void GetLoadedPluginCategories( TStringContainer& categories ) const;
- void GetLoadedPluginFilters( TStringContainer& filters ) const;
- const TStringContainer& GetLoadedPluginFilters(
- const std::string& category
- ) const;
+ TPlugins* GetPlugins( );
+ const TPlugins* GetPlugins( ) const;
+ void SetPlugins( TPlugins* i );
// Workspace IO
std::string LoadWorkspace( const std::string& fname );
std::string SaveWorkspace( const std::string& fname ) const;
// Graph management
- void Clear( );
TGraph* GetGraph( );
const TGraph* GetGraph( ) const;
- bool CreateFilter( const std::string& filter, const std::string& name );
- bool Connect(
- const std::string& orig_filter, const std::string& dest_filter,
- const std::string& output_name,
- const std::string& input_name
- );
- TParameters* GetParameters( const std::string& name );
- const TParameters* GetParameters( const std::string& name ) const;
+
+ void Clear( );
+ void ClearConnections( );
+
+ // Filter management
TFilter* GetFilter( const std::string& name );
const TFilter* GetFilter( const std::string& name ) const;
bool HasFilter( const std::string& name ) const;
+ TFilter* CreateFilter(
+ const std::string& filter, const std::string& name
+ );
+ bool RenameFilter(
+ const std::string& old_name, const std::string& new_name
+ );
+ void RemoveFilter( const std::string& name );
+
+ // Widgets management
+ vtkRenderWindowInteractor* GetSingleInteractor( );
+ const vtkRenderWindowInteractor* GetSingleInteractor( ) const;
+ void SetSingleInteractor( vtkRenderWindowInteractor* interactor );
+
+ SimpleMPRWidget* GetMPRViewer( );
+ const SimpleMPRWidget* GetMPRViewer( ) const;
+ void SetMPRViewer( SimpleMPRWidget* wdg );
+
+ // Connection management
+ bool Connect(
+ const std::string& orig_filter, const std::string& dest_filter,
+ const std::string& output_name, const std::string& input_name
+ );
+ bool Connect(
+ TData::Pointer* input_object, const std::string& exposed_port
+ );
+ void RemoveConnection(
+ const std::string& dest_filter, const std::string& input_name
+ );
+ void RemoveConnection( const std::string& exposed_port );
+ void RemoveConnections( const std::string& dest_filter );
// Graph reduction
bool Reduce( const std::string& name );
+ void ExposeInputPort(
+ const std::string& name,
+ const std::string& filter, const std::string& filter_input
+ );
+ void ExposeOutputPort(
+ const std::string& name,
+ const std::string& filter, const std::string& filter_output
+ );
+ void HideInputPort( const std::string& name );
+ void HideOutputPort( const std::string& name );
+
+ bool RenameExposedInputPort(
+ const std::string& old_name,
+ const std::string& new_name
+ );
+ bool RenameExposedOutputPort(
+ const std::string& old_name,
+ const std::string& new_name
+ );
+
+ const TExposedPorts& GetExposedInputPorts( ) const;
+ const TExposedPorts& GetExposedOutputPorts( ) const;
+
+ TData* GetExposedInput( const std::string& name );
+ const TData* GetExposedInput( const std::string& name ) const;
+ TData* GetExposedOutput( const std::string& name );
+ const TData* GetExposedOutput( const std::string& name ) const;
// Pipeline execution
std::string Execute( );
- std::string Execute( const std::string& name, QWidget* p = NULL );
-
- protected:
- void _UpdateLoadedPluginsInformation( );
+ std::string Execute( const std::string& name );
protected:
// Plugins interface
- TInterface m_Interface;
- std::string m_LastLoadedPlugin;
- TStringContainer m_LoadedPlugins;
- std::map< std::string, TStringContainer > m_LoadedFilters;
+ TPlugins* m_Plugins;
// Processing graph
- typename TGraph::Pointer m_Graph;
+ TGraph::Pointer m_Graph;
+ TExposedPorts m_ExposedInputPorts;
+ TExposedPorts m_ExposedOutputPorts;
+
+ vtkSmartPointer< vtkRenderWindowInteractor > m_SingleInteractor;
+ SimpleMPRWidget* m_MPRViewer;
};
} // ecapseman