this->m_Workspace = new cpPlugins::Interface::Workspace( );
this->m_Workspace->SetPlugins( this->m_Plugins );
this->m_UI->Canvas->editor( )->setWorkspace( this->m_Workspace );
- this->m_Workspace->AddInteractor( this->m_UI->Viewer->GetInteractor( 0 ) );
- this->m_Workspace->AddInteractor( this->m_UI->Viewer->GetInteractor( 1 ) );
- this->m_Workspace->AddInteractor( this->m_UI->Viewer->GetInteractor( 2 ) );
- this->m_Workspace->AddInteractor( this->m_UI->Viewer->GetInteractor( 3 ) );
+ this->m_Workspace->SetMPRViewer( this->m_UI->Viewer );
// Connect actions to slots
App_cpPipelineEditor_ConnectButton( LoadPluginsFile );
delete this->m_Workspace;
this->m_Workspace = new cpPlugins::Interface::Workspace( );
this->m_Workspace->SetPlugins( this->m_Plugins );
- this->m_Workspace->AddInteractor( this->m_UI->Viewer->GetInteractor( 0 ) );
- this->m_Workspace->AddInteractor( this->m_UI->Viewer->GetInteractor( 1 ) );
- this->m_Workspace->AddInteractor( this->m_UI->Viewer->GetInteractor( 2 ) );
- this->m_Workspace->AddInteractor( this->m_UI->Viewer->GetInteractor( 3 ) );
+ this->m_Workspace->SetMPRViewer( this->m_UI->Viewer );
std::string err = this->m_Workspace->LoadWorkspace( fname );
if( err != "" )
{
#ifdef cpPlugins_Interface_QT4
#include <QApplication>
#include <cpPlugins/Interface/ParametersQtDialog.h>
+#include <cpPlugins/Interface/SimpleMPRWidget.h>
#endif // cpPlugins_Interface_QT4
#include <vtkRenderWindowInteractor.h>
}
// -------------------------------------------------------------------------
-const cpPlugins::Interface::ProcessObject::
-TInteractors& cpPlugins::Interface::ProcessObject::
-GetInteractors( ) const
+vtkRenderWindowInteractor* cpPlugins::Interface::ProcessObject::
+GetSingleInteractor( )
{
- return( this->m_Interactors );
+ return( this->m_SingleInteractor );
+}
+
+// -------------------------------------------------------------------------
+const vtkRenderWindowInteractor* cpPlugins::Interface::ProcessObject::
+GetSingleInteractor( ) const
+{
+ return( this->m_SingleInteractor );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::ProcessObject::
-AddInteractor( vtkRenderWindowInteractor* interactor )
+SetSingleInteractor( vtkRenderWindowInteractor* interactor )
{
- this->m_Interactors.insert( interactor );
-#ifdef cpPlugins_Interface_QT4
- this->m_ParametersDialog->addInteractor( interactor );
-#endif // cpPlugins_Interface_QT4
+ this->m_SingleInteractor = interactor;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::
+SimpleMPRWidget* cpPlugins::Interface::ProcessObject::
+GetMPRViewer( )
+{
+ return( this->m_MPRViewer );
+}
+
+// -------------------------------------------------------------------------
+const cpPlugins::Interface::
+SimpleMPRWidget* cpPlugins::Interface::ProcessObject::
+GetMPRViewer( ) const
+{
+ return( this->m_MPRViewer );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ProcessObject::
+SetMPRViewer( cpPlugins::Interface::SimpleMPRWidget* wdg )
+{
+ this->m_MPRViewer = wdg;
}
// -------------------------------------------------------------------------
cpPlugins::Interface::ProcessObject::
ProcessObject( )
: Superclass( ),
- m_ParametersDialog( NULL )
+ m_ParametersDialog( NULL ),
+ m_MPRViewer( NULL )
{
this->m_Parameters = TParameters::New( );
this->m_Parameters->SetProcessObject( this );
// Some forward declarations
#ifdef cpPlugins_Interface_QT4
class ParametersQtDialog;
+ class SimpleMPRWidget;
#else
typedef char ParametersQtDialog;
+ typedef char SimpleMPRWidget;
#endif // cpPlugins_Interface_QT4
/**
virtual std::string Update( );
virtual void DisconnectOutputs( );
- virtual const TInteractors& GetInteractors( ) const;
- virtual void AddInteractor( vtkRenderWindowInteractor* interactor );
+ // Widgets management
+ vtkRenderWindowInteractor* GetSingleInteractor( );
+ const vtkRenderWindowInteractor* GetSingleInteractor( ) const;
+ void SetSingleInteractor( vtkRenderWindowInteractor* interactor );
+ SimpleMPRWidget* GetMPRViewer( );
+ const SimpleMPRWidget* GetMPRViewer( ) const;
+ void SetMPRViewer( SimpleMPRWidget* wdg );
virtual bool ExecConfigurationDialog( QWidget* parent );
template< class T >
Parameters::Pointer m_Parameters;
ParametersQtDialog* m_ParametersDialog;
- TInteractors m_Interactors;
- bool m_Interactive;
+ vtkSmartPointer< vtkRenderWindowInteractor > m_SingleInteractor;
+ SimpleMPRWidget* m_MPRViewer;
+ bool m_Interactive;
typedef std::map< std::string, DataObject::Pointer > _TDataContainer;
_TDataContainer m_Inputs;
#include <cpPlugins/Interface/Image.h>
#include <cpPlugins/Interface/Mesh.h>
// TODO: #include <QTreeWidgetItem>
+
+#include <vtkProperty.h>
#include <vtkRendererCollection.h>
double cpPlugins::Interface::SimpleMPRWidget::
// Add new data
this->m_Data[ name ].SetSourceDataObject( data );
+ // Set color
+ auto iIt = this->m_Data.find( name );
+ if( iIt != this->m_Data.end( ) )
+ {
+ vtkActor* actor =
+ dynamic_cast< vtkActor* >( iIt->second.GetMeshActor( ) );
+ if( actor != NULL )
+ {
+ unsigned int idx = this->m_Data.size( ) % 8;
+ actor->GetProperty( )->SetColor(
+ Self::cm_Colors[ idx ][ 0 ],
+ Self::cm_Colors[ idx ][ 1 ],
+ Self::cm_Colors[ idx ][ 2 ]
+ );
+
+ } // fi
+
+ } // fi
+
// Add to tree view
// TODO: this->_UpdateTreeItem( name, parent );
return( true );
}
else if( iIt->second.Tag == Data::MESH )
{
- /* TODO
- vtkRenderer* ren =
- this->m_VTK[ 3 ]->GetRenderWindow( )->GetRenderers( )->GetFirstRenderer( );
- if( ren == NULL )
- return;
- ren->AddActor( iIt->second.GetMeshActor( ) );
- this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
- */
+ vtkRenderer* ren =
+ this->m_VTK[ 3 ]->GetRenderWindow( )->
+ GetRenderers( )->GetFirstRenderer( );
+ if( ren == NULL )
+ return;
+ ren->AddActor( iIt->second.GetMeshActor( ) );
+ this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
+
} // fi
}
#include <cpPlugins/Interface/Workspace.h>
+#include <cpPlugins/Interface/SimpleMPRWidget.h>
+#include <vtkRenderWindowInteractor.h>
// -------------------------------------------------------------------------
cpPlugins::Interface::Workspace::
Workspace( )
- : m_Plugins( NULL )
+ : m_Plugins( NULL ),
+ m_MPRViewer( NULL )
{
this->m_Graph = TGraph::New( );
}
if( f.IsNotNull( ) )
{
f->SetName( name );
- for(
- auto iIt = this->m_Interactors.begin( );
- iIt != this->m_Interactors.end( );
- ++iIt
- )
- f->AddInteractor( *iIt );
+ f->SetSingleInteractor( this->m_SingleInteractor );
+ f->SetMPRViewer( this->m_MPRViewer );
TObject::Pointer o = f.GetPointer( );
this->m_Graph->SetVertex( name, o );
}
// -------------------------------------------------------------------------
-const cpPlugins::Interface::Workspace::
-TInteractors& cpPlugins::Interface::Workspace::
-GetInteractors( ) const
+vtkRenderWindowInteractor* cpPlugins::Interface::Workspace::
+GetSingleInteractor( )
+{
+ return( this->m_SingleInteractor );
+}
+
+// -------------------------------------------------------------------------
+const vtkRenderWindowInteractor* cpPlugins::Interface::Workspace::
+GetSingleInteractor( ) const
+{
+ return( this->m_SingleInteractor );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Workspace::
+SetSingleInteractor( vtkRenderWindowInteractor* interactor )
+{
+ this->m_SingleInteractor = interactor;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::
+SimpleMPRWidget* cpPlugins::Interface::Workspace::
+GetMPRViewer( )
+{
+ return( this->m_MPRViewer );
+}
+
+// -------------------------------------------------------------------------
+const cpPlugins::Interface::
+SimpleMPRWidget* cpPlugins::Interface::Workspace::
+GetMPRViewer( ) const
{
- return( this->m_Interactors );
+ return( this->m_MPRViewer );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::Workspace::
-AddInteractor( vtkRenderWindowInteractor* interactor )
+SetMPRViewer( cpPlugins::Interface::SimpleMPRWidget* wdg )
{
- this->m_Interactors.insert( interactor );
+ this->m_MPRViewer = wdg;
}
// -------------------------------------------------------------------------
{
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
typedef std::set< std::string > TStringContainer;
typedef std::pair< std::string, std::string > TExposedPort;
typedef std::map< std::string, TExposedPort > TExposedPorts;
- typedef std::set< vtkRenderWindowInteractor* > TInteractors;
// Graph type
typedef std::pair< std::string, std::string > TConnection;
void RemoveFilter( const std::string& name );
// Widgets management
- virtual const TInteractors& GetInteractors( ) const;
- virtual void AddInteractor( vtkRenderWindowInteractor* interactor );
+ vtkRenderWindowInteractor* GetSingleInteractor( );
+ const vtkRenderWindowInteractor* GetSingleInteractor( ) const;
+ void SetSingleInteractor( vtkRenderWindowInteractor* interactor );
+
+ SimpleMPRWidget* GetMPRViewer( );
+ const SimpleMPRWidget* GetMPRViewer( ) const;
+ void SetMPRViewer( SimpleMPRWidget* wdg );
// Connection management
bool Connect(
TExposedPorts m_ExposedInputPorts;
TExposedPorts m_ExposedOutputPorts;
- TInteractors m_Interactors;
+ vtkSmartPointer< vtkRenderWindowInteractor > m_SingleInteractor;
+ SimpleMPRWidget* m_MPRViewer;
};
} // ecapseman
// Choose a valid 3D interactor
vtkRenderWindowInteractor* iren = NULL;
+ /* TODO
auto iIt = this->m_Interactors.begin( );
for( ; iIt != this->m_Interactors.end( ) && iren == NULL; ++iIt )
{
iren = *iIt;
} // rof
+ */
if( iren == NULL )
return( false );
#include <cpPlugins/Interface/Image.h>
#include <cpPlugins/Interface/PointList.h>
+#include <cpPlugins/Interface/SimpleMPRWidget.h>
#include <cpExtensions/Interaction/ImageInteractorStyle.h>
#include <vtkRenderWindowInteractor.h>
unsigned int dim = ( I::ImageDimension < 3 )? I::ImageDimension: 3;
out->Clear( );
+
+ // MPR
+ if( this->m_MPRViewer != NULL )
+ {
+ for( unsigned int i = 0; i < 4; ++i )
+ {
+ _S* s =
+ dynamic_cast< _S* >(
+ this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( )
+ );
+ if( s != NULL )
+ {
+ if( this->m_Configured )
+ {
+ for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
+ {
+ s->GetSeedAsPoint( i, aux_pnt );
+ typename I::PointType seed;
+ for( unsigned int d = 0; d < dim; ++d )
+ seed[ d ] = aux_pnt[ d ];
+ out->AddPoint( seed );
+
+ } // rof
+ }
+ else
+ s->SeedWidgetOn( );
+
+ } // fi
+
+ } // rof
+
+ } // fi
+
+ // Single interactor
+ _S* s = dynamic_cast< _S* >( this->m_SingleInteractor.GetPointer( ) );
+ if( s != NULL )
+ {
+ if( this->m_Configured )
+ {
+ for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
+ {
+ s->GetSeedAsPoint( i, aux_pnt );
+ typename I::PointType seed;
+ for( unsigned int d = 0; d < dim; ++d )
+ seed[ d ] = aux_pnt[ d ];
+ out->AddPoint( seed );
+
+ } // rof
+ }
+ else
+ s->SeedWidgetOn( );
+
+ } // fi
+
+ /* TODO
auto iIt = this->m_Interactors.begin( );
for( ; iIt != this->m_Interactors.end( ); ++iIt )
{
} // fi
} // rof
+ */
this->m_Configured = true;
return( "" );
}