ImageMPR( QWidget* parent )
: QMainWindow( parent ),
m_UI( new Ui::ImageMPR ),
- m_Plugins( new TPlugins ),
- m_MainImage( NULL )
+ m_Plugins( new TPlugins )
{
this->m_UI->setupUi( this );
this->m_Plugins->SetWidget( this );
void ImageMPR::
_aOpenImage( )
{
- if( this->m_MainImage.IsNotNull( ) )
+ // Clear all, since we are loading the main image
+ if( this->m_Objects.size( ) > 0 )
+ {
this->m_UI->MPR->ClearAll( );
- if( this->m_Plugins->ReadImage( this->m_MainImage, true ) )
+ this->m_Objects.clear( );
+
+ } // fi
+
+ // Read and show image, if possible
+ TPlugins::TImage::Pointer image;
+ if( this->m_Plugins->ReadImage( image, true ) )
{
- vtkImageData* vimage = this->m_MainImage->GetVTK< vtkImageData >( );
+ vtkImageData* vimage = image->GetVTK< vtkImageData >( );
if( vimage == NULL )
QMessageBox::critical(
this,
)
);
else
- this->m_UI->MPR->ShowImage( vimage );
+ this->m_UI->MPR->ShowImage( vimage, image->GetName( ) );
+
+ // Keep a track on a local data tree
+ this->m_Objects[ image->GetName( ) ] =
+ TTreeNode( "", image.GetPointer( ) );
} // fi
}
void ImageMPR::
_aOpenDICOMSeries( )
{
- if( this->m_MainImage.IsNotNull( ) )
+ // Clear all, since we are loading the main image
+ if( this->m_Objects.size( ) > 0 )
+ {
this->m_UI->MPR->ClearAll( );
- if( this->m_Plugins->ReadDicomSeries( this->m_MainImage ) )
+ this->m_Objects.clear( );
+
+ } // fi
+
+ // Read and show image, if possible
+ TPlugins::TImage::Pointer image;
+ if( this->m_Plugins->ReadDicomSeries( image ) )
{
- vtkImageData* vimage = this->m_MainImage->GetVTK< vtkImageData >( );
+ vtkImageData* vimage = image->GetVTK< vtkImageData >( );
if( vimage == NULL )
QMessageBox::critical(
this,
)
);
else
- this->m_UI->MPR->ShowImage( vimage );
+ this->m_UI->MPR->ShowImage( vimage, image->GetName( ) );
+
+ // Keep a track on a local data tree
+ this->m_Objects[ image->GetName( ) ] =
+ TTreeNode( "", image.GetPointer( ) );
} // fi
}
void ImageMPR::
_aSaveImage( )
{
- if( this->m_MainImage.IsNotNull( ) )
+ /*
+ if( this->m_MainImage.IsNotNull( ) )
this->m_Plugins->WriteImage( this->m_MainImage, true );
+ */
}
// -------------------------------------------------------------------------
void ImageMPR::
_execPlugin( )
{
+ /*
+ typedef std::map< std::string, TPlugins::TImage::Pointer > _TImages;
+ typedef std::map< std::string, TPlugins::TMesh::Pointer > _TMeshes;
+
+ // Get selected data
+ // std::string data_name = this->m_UI->MPR->GetSelectedData( );
+
// Get filter name
QAction* action = dynamic_cast< QAction* >( this->sender( ) );
if( action == NULL )
QMenu* menu = dynamic_cast< QMenu* >( action->parentWidget( ) );
if( menu == NULL )
return;
- std::string cate = menu->title( ).toStdString( );
- std::string name = action->text( ).toStdString( );
- std::string err = "";
+ std::string filter_cate = menu->title( ).toStdString( );
+ std::string filter_name = action->text( ).toStdString( );
+ // Create filter
TPlugins::TProcessObject::Pointer filter;
- if( this->m_Plugins->CreateFilter( filter, name ) )
+ if( !( this->m_Plugins->CreateFilter( filter, filter_name ) ) )
+ {
+ QMessageBox::critical(
+ this,
+ tr( "Error creating filter" ),
+ tr( (
+ std::string( "No valid filter \"" ) +
+ filter_name +
+ std::string( "\"defined." )
+ ).c_str( ) )
+ );
+ return;
+
+ } // fi
+
+ // Assign inputs
+ std::vector< std::string > inputs_names = filter->GetInputsNames( );
+ if( inputs_names.size( ) == 1 )
+ {
+ std::string data_name = this->m_UI->MPR->GetSelectedData( );
+ _TImages::iterator iIt = this->m_Images.find( data_name );
+ _TImages::iterator mIt = this->m_Meshes.find( data_name );
+ filter->SetInput( inputs_names[ 0 ]);
+ }
+ else if( inputs_names.size( ) > 1 )
+ {
+ } // fi
+
+ // Get outputs
+ std::vector< std::string > outputs_names = filter->GetOutputsNames( );
+ */
+
+ /*
+
+ // Choose inputs
+ if( filter_cate == "ImageToMeshFilter" )
{
- if( cate == "ImageToMeshFilter" )
+ // Check inputs
+ _TImages::iterator iIt = this->m_Images.find( data_name );
+ if( iIt == this->m_Images.end( ) )
{
- if( filter->ExecConfigurationDialog( this ) )
- {
- filter->SetInput( "Input", this->m_MainImage );
- this->_Block( );
- err = filter->Update( );
- this->_Unblock( );
- TPlugins::TMesh::Pointer mesh =
- filter->GetOutput< TPlugins::TMesh >( "Output" );
- this->m_Meshes.push_back( mesh );
- mesh->CreateVTKActor( );
- vtkActor* actor = mesh->GetVTKActor( );
- if( actor != NULL )
- this->m_UI->MPR->Add3DActor( actor );
+ QMessageBox::critical(
+ this,
+ tr( "Error creating filter" ),
+ tr( "No valid input selected." )
+ );
+ return;
- } // fi
+ } // fi
+
+ // Execute configuration dialog
+ if( !( filter->ExecConfigurationDialog( this ) ) )
+ return;
+
+ // Execute filter
+ filter->SetInput( "Input", iIt->second );
+ this->_Block( );
+ std::string filter_err = filter->Update( );
+ this->_Unblock( );
+ if( filter_err != "" )
+ {
+ QMessageBox::critical(
+ this,
+ tr( "Error executing" ),
+ tr( filter_err.c_str( ) )
+ );
+ return;
} // fi
- }
- else
- QMessageBox::critical(
- this,
- tr( "Error creating filter" ),
- tr( "No valid filter defined." )
+
+ // Keep and show results
+ TPlugins::TMesh::Pointer mesh =
+ filter->GetOutput< TPlugins::TMesh >( "Output" );
+ this->m_Meshes[ filter_name ] = mesh;
+ this->_Block( );
+ this->m_UI->MPR->ShowMesh(
+ mesh->GetVTK< vtkPolyData >( ),
+ filter_name,
+ data_name
);
+ this->_Unblock( );
+ } // fi
+ */
+
+ /*
+ if( this->m_Plugins->CreateFilter( filter, name ) )
+ {
+ if( filter->ExecConfigurationDialog( this ) )
+ {
+ filter->SetInput( "Input", this->m_MainImage );
+ this->_Block( );
+ err = filter->Update( );
+ this->_Unblock( );
+ TPlugins::TMesh::Pointer mesh =
+ filter->GetOutput< TPlugins::TMesh >( "Output" );
+ this->m_Meshes.push_back( mesh );
+ mesh->CreateVTKActor( );
+ vtkActor* actor = mesh->GetVTKActor( );
+ if( actor != NULL )
+ this->m_UI->MPR->Add3DActor( actor );
+
+ } // fi
+
+ } // fi
+ }
+ else
+ QMessageBox::critical(
+ this,
+ tr( "Error creating filter" ),
+ tr( "No valid filter defined." )
+ );
+ */
/*
if( name == "cpPlugins::BasicFilters::FloodFillImageFilter" )
{
#ifndef __IMAGEMPR__H__
#define __IMAGEMPR__H__
+#include <map>
#include <vector>
// Qt stuff
TPlugins* m_Plugins;
// Objects
- TPlugins::TImage::Pointer m_MainImage;
- std::vector< TPlugins::TMesh::Pointer > m_Meshes;
+ typedef std::pair< std::string, TPlugins::TDataObject::Pointer > TTreeNode;
+ typedef std::map< std::string, TTreeNode > TTree;
+ TTree m_Objects;
// Plugins objects
/*
<widget class="QWidget" name="CentralWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
- <widget class="cpPlugins::Interface::BaseMPRWindow" name="MPR"/>
+ <widget class="cpPlugins::Interface::BaseMPRWidget" name="MPR" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>562</width>
+ <height>406</height>
+ </size>
+ </property>
+ </widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
- <class>cpPlugins::Interface::BaseMPRWindow</class>
- <extends>QFrame</extends>
- <header location="global">cpPlugins/Interface/BaseMPRWindow.h</header>
+ <class>cpPlugins::Interface::BaseMPRWidget</class>
+ <extends>QWidget</extends>
+ <header location="global">cpPlugins/Interface/BaseMPRWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
SET(
EXAMPLES_PROGRAMS_ONLY_EXTENSIONS
- #example_TestQuadSplitter
)
FOREACH(prog ${EXAMPLES_PROGRAMS_ONLY_EXTENSIONS})
+++ /dev/null
-#include <QApplication>
-#include <QTextEdit>
-#include <cpExtensions/QT/QuadSplitter.h>
-
-int main( int argc, char* argv[] )
-{
- int ret = 0;
-#ifdef cpExtensions_Interface_QT4
- QApplication app( argc, argv );
-
- QTextEdit* t1 = new QTextEdit;
- QTextEdit* t2 = new QTextEdit;
- QTextEdit* t3 = new QTextEdit;
- QTextEdit* t4 = new QTextEdit;
-
- cpExtensions::QT::QuadSplitter quadSplit;
- quadSplit.addWidgets( t1, t2, t3, t4 );
- quadSplit.show( );
- ret = app.exec( );
-#endif // cpExtensions_Interface_QT4
- return( ret );
-}
-
-// eof - $RCSfile$
Self::_TMouseButtonEvent::MaxDoubleClick = delay;
}
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddMouseMoveCommand( TMouseCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_MouseMoveCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddMouseClickCommand( TMouseCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_MouseClickCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddMouseDoubleClickCommand( TMouseCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_MouseDoubleClickCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddMouseWheelCommand( TMouseWheelCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_MouseWheelCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddKeyCommand( TKeyCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_KeyCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddExposeCommand( TVoidCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_ExposeCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddConfigureCommand( TVoidCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_ConfigureCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddEnterCommand( TVoidCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_EnterCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-AddLeaveCommand( TVoidCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_LeaveCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveMouseMoveCommand( TMouseCommand command )
-{
- auto i = this->m_MouseMoveCommands.find( command );
- if( i != this->m_MouseMoveCommands.end( ) )
- {
- this->m_MouseMoveCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveMouseClickCommand( TMouseCommand command )
-{
- auto i = this->m_MouseClickCommands.find( command );
- if( i != this->m_MouseClickCommands.end( ) )
- {
- this->m_MouseClickCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveMouseDoubleClickCommand( TMouseCommand command )
-{
- auto i = this->m_MouseDoubleClickCommands.find( command );
- if( i != this->m_MouseDoubleClickCommands.end( ) )
- {
- this->m_MouseDoubleClickCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveMouseWheelCommand( TMouseWheelCommand command )
-{
- auto i = this->m_MouseWheelCommands.find( command );
- if( i != this->m_MouseWheelCommands.end( ) )
- {
- this->m_MouseWheelCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveKeyCommand( TKeyCommand command )
-{
- auto i = this->m_KeyCommands.find( command );
- if( i != this->m_KeyCommands.end( ) )
- {
- this->m_KeyCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveExposeCommand( TVoidCommand command )
-{
- auto i = this->m_ExposeCommands.find( command );
- if( i != this->m_ExposeCommands.end( ) )
- {
- this->m_ExposeCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveConfigureCommand( TVoidCommand command )
-{
- auto i = this->m_ConfigureCommands.find( command );
- if( i != this->m_ConfigureCommands.end( ) )
- {
- this->m_ConfigureCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveEnterCommand( TVoidCommand command )
-{
- auto i = this->m_EnterCommands.find( command );
- if( i != this->m_EnterCommands.end( ) )
- {
- this->m_EnterCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-RemoveLeaveCommand( TVoidCommand command )
-{
- auto i = this->m_LeaveCommands.find( command );
- if( i != this->m_LeaveCommands.end( ) )
- {
- this->m_LeaveCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
// -------------------------------------------------------------------------
void cpExtensions::Interaction::BaseInteractorStyle::
DelegateTDxEvent( unsigned long event, void* calldata )
}
// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnLeftClick( )
-{
- // Get current position on the associated actors
- vtkRenderWindowInteractor* rwi = this->GetInteractor( );
- if( rwi == NULL )
- return;
-
- // Get mouse pointer position
- static int idx[ 2 ];
- static double pos[ 3 ];
- if( !( this->_PickPosition( idx, pos ) ) )
- return;
-
- // Invoke possible events
- auto i = this->m_MouseClickCommands.begin( );
- for( ; i != this->m_MouseClickCommands.end( ); ++i )
- i->first(
- i->second,
- Self::ButtonID_Left,
- idx, pos,
- rwi->GetAltKey( ) == 1,
- rwi->GetControlKey( ) == 1,
- rwi->GetShiftKey( ) == 1
- );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnLeftDoubleClick( )
-{
- // Get current position on the associated actors
- vtkRenderWindowInteractor* rwi = this->GetInteractor( );
- if( rwi == NULL )
- return;
-
- // Get mouse pointer position
- static int idx[ 2 ];
- static double pos[ 3 ];
- if( !( this->_PickPosition( idx, pos ) ) )
- return;
-
- // Invoke possible events
- auto i = this->m_MouseDoubleClickCommands.begin( );
- for( ; i != this->m_MouseDoubleClickCommands.end( ); ++i )
- i->first(
- i->second,
- Self::ButtonID_Left,
- idx, pos,
- rwi->GetAltKey( ) == 1,
- rwi->GetControlKey( ) == 1,
- rwi->GetShiftKey( ) == 1
- );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnMiddleClick( )
-{
- // Get current position on the associated actors
- vtkRenderWindowInteractor* rwi = this->GetInteractor( );
- if( rwi == NULL )
- return;
-
- // Get mouse pointer position
- static int idx[ 2 ];
- static double pos[ 3 ];
- if( !( this->_PickPosition( idx, pos ) ) )
- return;
-
- // Invoke possible events
- auto i = this->m_MouseClickCommands.begin( );
- for( ; i != this->m_MouseClickCommands.end( ); ++i )
- i->first(
- i->second,
- Self::ButtonID_Middle,
- idx, pos,
- rwi->GetAltKey( ) == 1,
- rwi->GetControlKey( ) == 1,
- rwi->GetShiftKey( ) == 1
- );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnMiddleDoubleClick( )
-{
- // Get current position on the associated actors
- vtkRenderWindowInteractor* rwi = this->GetInteractor( );
- if( rwi == NULL )
- return;
-
- // Get mouse pointer position
- static int idx[ 2 ];
- static double pos[ 3 ];
- if( !( this->_PickPosition( idx, pos ) ) )
- return;
-
- // Invoke possible events
- auto i = this->m_MouseDoubleClickCommands.begin( );
- for( ; i != this->m_MouseDoubleClickCommands.end( ); ++i )
- i->first(
- i->second,
- Self::ButtonID_Middle,
- idx, pos,
- rwi->GetAltKey( ) == 1,
- rwi->GetControlKey( ) == 1,
- rwi->GetShiftKey( ) == 1
- );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnRightClick( )
-{
- // Get current position on the associated actors
- vtkRenderWindowInteractor* rwi = this->GetInteractor( );
- if( rwi == NULL )
- return;
-
- // Get mouse pointer position
- static int idx[ 2 ];
- static double pos[ 3 ];
- if( !( this->_PickPosition( idx, pos ) ) )
- return;
-
- // Invoke possible events
- auto i = this->m_MouseClickCommands.begin( );
- for( ; i != this->m_MouseClickCommands.end( ); ++i )
- i->first(
- i->second,
- Self::ButtonID_Right,
- idx, pos,
- rwi->GetAltKey( ) == 1,
- rwi->GetControlKey( ) == 1,
- rwi->GetShiftKey( ) == 1
- );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnRightDoubleClick( )
-{
- // Get current position on the associated actors
- vtkRenderWindowInteractor* rwi = this->GetInteractor( );
- if( rwi == NULL )
- return;
-
- // Get mouse pointer position
- static int idx[ 2 ];
- static double pos[ 3 ];
- if( !( this->_PickPosition( idx, pos ) ) )
- return;
+#define cpExtensions_BaseInteractorStyle_Click( S, T ) \
+ void cpExtensions::Interaction::BaseInteractorStyle:: \
+ On##S##T( ) \
+ { \
+ vtkRenderWindowInteractor* rwi = this->GetInteractor( ); \
+ if( rwi == NULL ) \
+ return; \
+ static int idx[ 2 ]; \
+ static double pos[ 3 ]; \
+ if( !( this->_PickPosition( idx, pos ) ) ) \
+ return; \
+ auto i = this->m_Mouse##T##Commands.begin( ); \
+ for( ; i != this->m_Mouse##T##Commands.end( ); ++i ) \
+ i->first( \
+ i->second, \
+ Self::ButtonID_##S, \
+ idx, pos, \
+ rwi->GetAltKey( ) == 1, \
+ rwi->GetControlKey( ) == 1, \
+ rwi->GetShiftKey( ) == 1 \
+ ); \
+ }
- // Invoke possible events
- auto i = this->m_MouseDoubleClickCommands.begin( );
- for( ; i != this->m_MouseDoubleClickCommands.end( ); ++i )
- i->first(
- i->second,
- Self::ButtonID_Right,
- idx, pos,
- rwi->GetAltKey( ) == 1,
- rwi->GetControlKey( ) == 1,
- rwi->GetShiftKey( ) == 1
- );
-}
+cpExtensions_BaseInteractorStyle_Click( Left, Click );
+cpExtensions_BaseInteractorStyle_Click( Middle, Click );
+cpExtensions_BaseInteractorStyle_Click( Right, Click );
+cpExtensions_BaseInteractorStyle_Click( Left, DoubleClick );
+cpExtensions_BaseInteractorStyle_Click( Middle, DoubleClick );
+cpExtensions_BaseInteractorStyle_Click( Right, DoubleClick );
// -------------------------------------------------------------------------
void cpExtensions::Interaction::BaseInteractorStyle::
}
// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnKeyDown( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnKeyUp( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnKeyPress( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnKeyRelease( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnExpose( )
-{
- vtkRenderWindowInteractor* rwi = this->GetInteractor( );
- if( rwi == NULL )
- return;
-
- // Invoke possible events
- auto i = this->m_ExposeCommands.begin( );
- for( ; i != this->m_ExposeCommands.end( ); ++i )
- i->first( i->second );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnConfigure( )
-{
- vtkRenderWindowInteractor* rwi = this->GetInteractor( );
- if( rwi == NULL )
- return;
-
- // Invoke possible events
- auto i = this->m_ConfigureCommands.begin( );
- for( ; i != this->m_ConfigureCommands.end( ); ++i )
- i->first( i->second );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnEnter( )
-{
- vtkRenderWindowInteractor* rwi = this->GetInteractor( );
- if( rwi == NULL )
- return;
-
- // Invoke possible events
- auto i = this->m_EnterCommands.begin( );
- for( ; i != this->m_EnterCommands.end( ); ++i )
- i->first( i->second );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Interaction::BaseInteractorStyle::
-OnLeave( )
-{
- vtkRenderWindowInteractor* rwi = this->GetInteractor( );
- if( rwi == NULL )
- return;
+#define cpExtensions_BaseInteractorStyle_Global( N ) \
+ void cpExtensions::Interaction::BaseInteractorStyle:: \
+ On##N( ) \
+ { \
+ vtkRenderWindowInteractor* rwi = this->GetInteractor( ); \
+ if( rwi == NULL ) \
+ return; \
+ auto i = this->m_##N##Commands.begin( ); \
+ for( ; i != this->m_##N##Commands.end( ); ++i ) \
+ i->first( i->second ); \
+ }
- // Invoke possible events
- auto i = this->m_LeaveCommands.begin( );
- for( ; i != this->m_LeaveCommands.end( ); ++i )
- i->first( i->second );
-}
+cpExtensions_BaseInteractorStyle_Global( Expose );
+cpExtensions_BaseInteractorStyle_Global( Configure );
+cpExtensions_BaseInteractorStyle_Global( Enter );
+cpExtensions_BaseInteractorStyle_Global( Leave );
// -------------------------------------------------------------------------
void cpExtensions::Interaction::BaseInteractorStyle::
* =========================================================================
*/
+// -------------------------------------------------------------------------
+#define cpExtensions_BaseInteractorStyle_Commands( C ) \
+ protected: \
+ std::map< T##C##Command, void* > m_##C##Commands; \
+public: \
+ inline void Add##C##Command( T##C##Command c, void* d ) \
+ { \
+ if( c != NULL ) \
+ { \
+ this->m_##C##Commands[ c ] = d; \
+ this->Modified( ); \
+ } \
+ } \
+ inline void Remove##C##Command( T##C##Command c ) \
+ { \
+ std::map< T##C##Command, void* >::iterator i = \
+ this->m_##C##Commands.find( c ); \
+ if( i != this->m_##C##Commands.end( ) ) \
+ { \
+ this->m_##C##Commands.erase( i ); \
+ this->Modified( ); \
+ } \
+ }
+
// -------------------------------------------------------------------------
#define BaseInteractorStyle_DIFF_TIME \
std::chrono::duration_cast< std::chrono::milliseconds >( \
typedef void ( *TMouseWheelCommand )( void*, const int&, bool, bool, bool );
typedef void ( *TKeyCommand )( void*, const char& );
typedef void ( *TVoidCommand )( void* );
-
- public:
- static void SetSetDoubleClickDelay( long delay );
+ typedef TMouseCommand TMouseMoveCommand;
+ typedef TMouseCommand TMouseClickCommand;
+ typedef TMouseCommand TMouseDoubleClickCommand;
+ typedef TVoidCommand TExposeCommand;
+ typedef TVoidCommand TConfigureCommand;
+ typedef TVoidCommand TEnterCommand;
+ typedef TVoidCommand TLeaveCommand;
// Associate callbacks for each event
- void AddMouseMoveCommand( TMouseCommand command, void* data );
- void AddMouseClickCommand( TMouseCommand command, void* data );
- void AddMouseDoubleClickCommand( TMouseCommand command, void* data );
- void AddMouseWheelCommand( TMouseWheelCommand command, void* data );
- void AddKeyCommand( TKeyCommand command, void* data );
- void AddExposeCommand( TVoidCommand command, void* data );
- void AddConfigureCommand( TVoidCommand command, void* data );
- void AddEnterCommand( TVoidCommand command, void* data );
- void AddLeaveCommand( TVoidCommand command, void* data );
-
- void RemoveMouseMoveCommand( TMouseCommand command );
- void RemoveMouseClickCommand( TMouseCommand command );
- void RemoveMouseDoubleClickCommand( TMouseCommand command );
- void RemoveMouseWheelCommand( TMouseWheelCommand command );
- void RemoveKeyCommand( TKeyCommand command );
- void RemoveExposeCommand( TVoidCommand command );
- void RemoveConfigureCommand( TVoidCommand command );
- void RemoveEnterCommand( TVoidCommand command );
- void RemoveLeaveCommand( TVoidCommand command );
+ cpExtensions_BaseInteractorStyle_Commands( MouseMove );
+ cpExtensions_BaseInteractorStyle_Commands( MouseClick );
+ cpExtensions_BaseInteractorStyle_Commands( MouseDoubleClick );
+ cpExtensions_BaseInteractorStyle_Commands( MouseWheel );
+ cpExtensions_BaseInteractorStyle_Commands( Key );
+ cpExtensions_BaseInteractorStyle_Commands( Expose );
+ cpExtensions_BaseInteractorStyle_Commands( Configure );
+ cpExtensions_BaseInteractorStyle_Commands( Enter );
+ cpExtensions_BaseInteractorStyle_Commands( Leave );
+ public:
+ static void SetSetDoubleClickDelay( long delay );
void DelegateTDxEvent( unsigned long event, void* calldata );
// Possible mouse motion events
// Keyboard-related events
virtual void OnChar( );
- virtual void OnKeyDown( );
- virtual void OnKeyUp( );
- virtual void OnKeyPress( );
- virtual void OnKeyRelease( );
+ virtual void OnKeyDown( ) { }
+ virtual void OnKeyUp( ) { }
+ virtual void OnKeyPress( ) { }
+ virtual void OnKeyRelease( ) { }
// Other events
virtual void OnExpose( );
protected:
double m_MotionFactor;
- // Callbacks
- std::map< TMouseCommand, void* > m_MouseMoveCommands;
- std::map< TMouseCommand, void* > m_MouseClickCommands;
- std::map< TMouseCommand, void* > m_MouseDoubleClickCommands;
- std::map< TMouseWheelCommand, void* > m_MouseWheelCommands;
- std::map< TKeyCommand, void* > m_KeyCommands;
- std::map< TVoidCommand, void* > m_ExposeCommands;
- std::map< TVoidCommand, void* > m_ConfigureCommands;
- std::map< TVoidCommand, void* > m_EnterCommands;
- std::map< TVoidCommand, void* > m_LeaveCommands;
-
/**
* Button events
*/
typedef ImageInteractorStyle Self;
vtkTypeMacro( ImageInteractorStyle, BaseInteractorStyle );
+ // Callbacks types
+ typedef Superclass::TMouseCommand TMouseCommand;
+ typedef Superclass::TMouseWheelCommand TMouseWheelCommand;
+ typedef Superclass::TKeyCommand TKeyCommand;
+ typedef Superclass::TVoidCommand TVoidCommand;
+ typedef Superclass::TMouseMoveCommand TMouseMoveCommand;
+ typedef Superclass::TMouseClickCommand TMouseClickCommand;
+ typedef Superclass::TMouseDoubleClickCommand TMouseDoubleClickCommand;
+ typedef Superclass::TExposeCommand TExposeCommand;
+ typedef Superclass::TConfigureCommand TConfigureCommand;
+ typedef Superclass::TEnterCommand TEnterCommand;
+ typedef Superclass::TLeaveCommand TLeaveCommand;
+
public:
static Self* New( );
+++ /dev/null
-#include <cpExtensions/QT/QuadSplitter.h>
-
-#include <cpExtensions/Config.h>
-
-#ifdef cpExtensions_Interface_QT4
-
-/**
- * Inspired by:
- * https://forum.qt.io/topic/7144/quad-splitter-windows-an-implementation/2
- */
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::QuadSplitter::
-QuadSplitter( QWidget* parent )
- : QSplitter( parent )
-{
- this->setOrientation( Qt::Vertical );
- this->addWidget( &this->m_Upper );
- this->addWidget( &this->m_Bottom );
-
- QObject::connect(
- &( this->m_Upper ), SIGNAL( splitterMoved( int, int ) ),
- this, SLOT( _SyncBottom( int, int ) )
- );
- QObject::connect(
- &( this->m_Bottom ), SIGNAL( splitterMoved( int, int ) ),
- this, SLOT( _SyncUpper( int, int ) )
- );
-}
-
-// -------------------------------------------------------------------------
-cpExtensions::QT::QuadSplitter::
-~QuadSplitter( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::QuadSplitter::
-addWidgets( QWidget* a, QWidget* b, QWidget* c, QWidget* d )
-{
- this->m_Upper.addWidget( a );
- this->m_Upper.addWidget( b );
- this->m_Bottom.addWidget( c );
- this->m_Bottom.addWidget( d );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::QuadSplitter::
-_SyncBottom( int a, int b )
-{
- this->m_Bottom.setSizes( this->m_Upper.sizes( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::QT::QuadSplitter::
-_SyncUpper( int a, int b )
-{
- this->m_Upper.setSizes( this->m_Bottom.sizes( ) );
-}
-
-#endif // cpExtensions_Interface_QT4
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPEXTENSIONS__QT__QUADSPLITTER__H__
-#define __CPEXTENSIONS__QT__QUADSPLITTER__H__
-
-#include <cpExtensions/cpExtensions_Export.h>
-#include <cpExtensions/Config.h>
-
-#ifdef cpExtensions_Interface_QT4
-
-/**
- * Inspired by:
- * https://forum.qt.io/topic/7144/quad-splitter-windows-an-implementation/2
- */
-
-#include <QSplitter>
-
-namespace cpExtensions
-{
- namespace QT
- {
- /**
- */
- class cpExtensions_EXPORT QuadSplitter
- : public QSplitter
- {
- Q_OBJECT;
-
- public:
- QuadSplitter( QWidget* parent = 0 );
- virtual ~QuadSplitter( );
-
- void addWidgets( QWidget* a, QWidget* b, QWidget* c, QWidget* d );
-
- private slots:
- void _SyncBottom( int a, int b );
- void _SyncUpper( int a, int b );
-
- protected:
- QSplitter m_Bottom;
- QSplitter m_Upper;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // cpExtensions_Interface_QT4
-
-#endif // __CPEXTENSIONS__QT__QUADSPLITTER__H__
-
-// eof - $RCSfile$
return( new Self( ) );
}
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-AddSlicesCommand( TSlicesCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_SlicesCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-AddWindowLevelCommand( TWindowLevelCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_WindowLevelCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-AddRenderCommand( TVoidCommand command, void* data )
-{
- if( command != NULL )
- {
- this->m_RenderCommands[ command ] = data;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-RemoveSlicesCommand( TSlicesCommand command )
-{
- auto i = this->m_SlicesCommands.find( command );
- if( i != this->m_SlicesCommands.end( ) )
- {
- this->m_SlicesCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-RemoveWindowLevelCommand( TWindowLevelCommand command )
-{
- auto i = this->m_WindowLevelCommands.find( command );
- if( i != this->m_WindowLevelCommands.end( ) )
- {
- this->m_WindowLevelCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageSliceActors::
-RemoveRenderCommand( TVoidCommand command )
-{
- auto i = this->m_RenderCommands.find( command );
- if( i != this->m_RenderCommands.end( ) )
- {
- this->m_RenderCommands.erase( i );
- this->Modified( );
-
- } // fi
-}
-
// -------------------------------------------------------------------------
void cpExtensions::Visualization::ImageSliceActors::
AddInputConnection( vtkAlgorithmOutput* aout, int axis )
// -------------------------------------------------------------------------
void cpExtensions::Visualization::ImageSliceActors::
-Render( )
+Render( const double& t )
{
if( this->m_Window != NULL )
+ {
+ vtkRenderer* renderer =
+ this->m_Window->GetRenderers( )->GetFirstRenderer( );
+ if( renderer != NULL )
+ renderer->SetAllocatedRenderTime( t );
this->m_Window->Render( );
+
+ } // fi
}
// -------------------------------------------------------------------------
// Just show the pixel information
actors->SetCursor( pos );
actors->UpdateText( pos );
- actors->Render( );
+ actors->Render( 1e-3 );
}
else if( btn == TStyle::ButtonID_Left )
{
auto i = actors->m_SlicesCommands.begin( );
for( ; i != actors->m_SlicesCommands.end( ); ++i )
i->first( pos, actors->GetAxis( ), i->second );
- actors->Render( );
+ actors->Render( 1e-3 );
} // fi
}
dx += actors->m_StartWindowLevel[ 0 ];
dy += actors->m_StartWindowLevel[ 1 ];
actors->SetWindowLevel( dx, dy );
- actors->Render( );
+ actors->Render( 1e-3 );
// Associate objects
auto i = actors->m_WindowLevelCommands.begin( );
for( ; a != actors->m_AssociatedSlices.end( ); ++a )
{
( *a )->SetSliceNumber( slice );
- ( *a )->Render( );
+ ( *a )->Render( 1e-3 );
} // rof
- actors->Render( );
+ actors->Render( 1e-3 );
// Associate objects
auto i = actors->m_RenderCommands.begin( );
case 'r': case 'R':
{
actors->ResetCamera( );
- actors->Render( );
+ actors->Render( 1e-3 );
// Associate objects
auto i = actors->m_RenderCommands.begin( );
case 'w': case 'W':
{
actors->ResetWindowLevel( );
- actors->Render( );
+ actors->Render( 1e-3 );
// Associate objects
auto i = actors->m_RenderCommands.begin( );
actors->ResetCursor( );
actors->m_CursorActor->VisibilityOn( );
- actors->Render( );
+ actors->Render( 1e-3 );
}
// -------------------------------------------------------------------------
actors->ResetCursor( );
actors->m_CursorActor->VisibilityOff( );
- actors->Render( );
+ actors->Render( 1e-3 );
}
// eof - $RCSfile$
public:
typedef ImageSliceActors Self;
- typedef cpExtensions::Interaction::BaseInteractorStyle TBaseStyle;
typedef cpExtensions::Interaction::ImageInteractorStyle TStyle;
+ typedef TStyle::TMouseCommand TMouseCommand;
+ typedef TStyle::TMouseWheelCommand TMouseWheelCommand;
+ typedef TStyle::TKeyCommand TKeyCommand;
+ typedef TStyle::TVoidCommand TVoidCommand;
+ typedef TStyle::TMouseMoveCommand TMouseMoveCommand;
+ typedef TStyle::TMouseClickCommand TMouseClickCommand;
+ typedef TStyle::TMouseDoubleClickCommand TMouseDoubleClickCommand;
+ typedef TStyle::TExposeCommand TExposeCommand;
+ typedef TStyle::TConfigureCommand TConfigureCommand;
+ typedef TStyle::TEnterCommand TEnterCommand;
+ typedef TStyle::TLeaveCommand TLeaveCommand;
typedef void ( *TSlicesCommand )( double*, int, void* );
typedef void ( *TWindowLevelCommand )( double, double, void* );
- typedef TBaseStyle::TMouseCommand TMouseCommand;
- typedef TBaseStyle::TMouseWheelCommand TMouseWheelCommand;
- typedef TBaseStyle::TKeyCommand TKeyCommand;
- typedef TBaseStyle::TVoidCommand TVoidCommand;
+ typedef TVoidCommand TRenderCommand;
public:
vtkTypeMacro( ImageSliceActors, vtkPropCollection );
+ cpExtensions_BaseInteractorStyle_Commands( Slices );
+ cpExtensions_BaseInteractorStyle_Commands( WindowLevel );
+ cpExtensions_BaseInteractorStyle_Commands( Render );
+
public:
// Creation
static ImageSliceActors* New( );
- void AddSlicesCommand( TSlicesCommand command, void* data );
- void AddWindowLevelCommand( TWindowLevelCommand command, void* data );
- void AddRenderCommand( TVoidCommand command, void* data );
-
- void RemoveSlicesCommand( TSlicesCommand command );
- void RemoveWindowLevelCommand( TWindowLevelCommand command );
- void RemoveRenderCommand( TVoidCommand command );
-
void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 );
void AddInputData( vtkImageData* data, int axis = 2 );
void Clear( );
void UpdateText( double pos[ 3 ] );
void UpdateText( const double& w, const double& l );
- void Render( );
+ void Render( const double& t );
void ResetCamera( );
protected:
// Events
static void _MouseMoveCommand(
void* data,
- const TBaseStyle::ButtonID& btn,
+ const TStyle::ButtonID& btn,
int* idx, double* pos,
bool alt, bool ctr, bool sft
);
static void _MouseClickCommand(
void* data,
- const TBaseStyle::ButtonID& btn,
+ const TStyle::ButtonID& btn,
int* idx, double* pos,
bool alt, bool ctr, bool sft
);
double m_MinWindow, m_MaxWindow;
double m_MinLevel, m_MaxLevel;
- // Associated commands
- std::map< TSlicesCommand, void* > m_SlicesCommands;
- std::map< TWindowLevelCommand, void* > m_WindowLevelCommands;
- std::map< TVoidCommand, void* > m_RenderCommands;
-
// Unique objects
vtkSmartPointer< vtkPolyData > m_Cursor;
vtkSmartPointer< vtkPolyDataMapper > m_CursorMapper;
{
actors->Slices[ 0 ][ j ]->SetSlice( pos );
actors->Slices[ 1 ][ j ]->SetSlice( pos );
- actors->Slices[ 0 ][ j ]->Render( );
- actors->Slices[ 1 ][ j ]->Render( );
+ actors->Slices[ 0 ][ j ]->Render( 1e-3 );
+ actors->Slices[ 1 ][ j ]->Render( 1e-3 );
} // fi
MPRActors* actors = reinterpret_cast< MPRActors* >( data );
if( actors == NULL )
return;
- actors->Slices[ 0 ][ 0 ]->Render( );
- actors->Slices[ 0 ][ 1 ]->Render( );
- actors->Slices[ 0 ][ 2 ]->Render( );
- actors->Slices[ 1 ][ 0 ]->Render( );
- actors->Slices[ 1 ][ 1 ]->Render( );
- actors->Slices[ 1 ][ 2 ]->Render( );
+ actors->Slices[ 0 ][ 0 ]->Render( 1e-3 );
+ actors->Slices[ 0 ][ 1 ]->Render( 1e-3 );
+ actors->Slices[ 0 ][ 2 ]->Render( 1e-3 );
+ actors->Slices[ 1 ][ 0 ]->Render( 1e-3 );
+ actors->Slices[ 1 ][ 1 ]->Render( 1e-3 );
+ actors->Slices[ 1 ][ 2 ]->Render( 1e-3 );
}
// -------------------------------------------------------------------------
MPRActors* actors = reinterpret_cast< MPRActors* >( data );
if( actors == NULL )
return;
- actors->Slices[ 0 ][ 0 ]->Render( );
- actors->Slices[ 0 ][ 1 ]->Render( );
- actors->Slices[ 0 ][ 2 ]->Render( );
- actors->Slices[ 1 ][ 0 ]->Render( );
- actors->Slices[ 1 ][ 1 ]->Render( );
- actors->Slices[ 1 ][ 2 ]->Render( );
+ actors->Slices[ 0 ][ 0 ]->Render( 1e-3 );
+ actors->Slices[ 0 ][ 1 ]->Render( 1e-3 );
+ actors->Slices[ 0 ][ 2 ]->Render( 1e-3 );
+ actors->Slices[ 1 ][ 0 ]->Render( 1e-3 );
+ actors->Slices[ 1 ][ 1 ]->Render( 1e-3 );
+ actors->Slices[ 1 ][ 2 ]->Render( 1e-3 );
}
// eof - $RCSfile$
public:
typedef MPRActors Self;
- typedef ImageSliceActors::TBaseStyle TBaseStyle;
- typedef ImageSliceActors::TStyle TStyle;
- typedef ImageSliceActors::TSlicesCommand TSlicesCommand;
- typedef ImageSliceActors::TWindowLevelCommand TWindowLevelCommand;
- typedef ImageSliceActors::TMouseCommand TMouseCommand;
- typedef ImageSliceActors::TMouseWheelCommand TMouseWheelCommand;
- typedef ImageSliceActors::TKeyCommand TKeyCommand;
- typedef ImageSliceActors::TVoidCommand TVoidCommand;
+ typedef ImageSliceActors::TStyle TStyle;
+ typedef ImageSliceActors::TMouseCommand TMouseCommand;
+ typedef ImageSliceActors::TMouseWheelCommand TMouseWheelCommand;
+ typedef ImageSliceActors::TKeyCommand TKeyCommand;
+ typedef ImageSliceActors::TVoidCommand TVoidCommand;
+ typedef ImageSliceActors::TMouseMoveCommand TMouseMoveCommand;
+ typedef ImageSliceActors::TMouseClickCommand TMouseClickCommand;
+ typedef ImageSliceActors::TMouseDoubleClickCommand TMouseDoubleClickCommand;
+ typedef ImageSliceActors::TExposeCommand TExposeCommand;
+ typedef ImageSliceActors::TConfigureCommand TConfigureCommand;
+ typedef ImageSliceActors::TEnterCommand TEnterCommand;
+ typedef ImageSliceActors::TLeaveCommand TLeaveCommand;
public:
vtkTypeMacro( MPRActors, vtkPropCollection );
this->ResetCameras( );
} // fi
- this->RenderAll( );
+ this->RenderAll( 1e-3 );
}
// -------------------------------------------------------------------------
this->m_Windows[ 3 ]
);
this->ResetCameras( );
- this->RenderAll( );
+ this->RenderAll( 1e-3 );
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRObjects::
-Render( const int& id )
+Render( const int& id, const double& t )
{
if( id < 4 )
+ {
if( this->m_Windows[ id ] != NULL )
+ {
+ if( this->m_Renderers[ id ] != NULL )
+ this->m_Renderers[ id ]->SetAllocatedRenderTime( t );
this->m_Windows[ id ]->Render( );
+
+ } // fi
+
+ } // fi
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRObjects::
-RenderAll( )
+RenderAll( const double& t )
{
for( int i = 0; i < 4; ++i )
+ {
if( this->m_Windows[ i ] != NULL )
+ {
+ if( this->m_Renderers[ i ] != NULL )
+ this->m_Renderers[ i ]->SetAllocatedRenderTime( t );
this->m_Windows[ i ]->Render( );
+
+ } // fi
+
+ } // rof
}
// -------------------------------------------------------------------------
public:
typedef MPRObjects Self;
- typedef MPRActors::TBaseStyle TBaseStyle;
- typedef MPRActors::TStyle TStyle;
- typedef MPRActors::TSlicesCommand TSlicesCommand;
- typedef MPRActors::TWindowLevelCommand TWindowLevelCommand;
- typedef MPRActors::TMouseCommand TMouseCommand;
- typedef MPRActors::TMouseWheelCommand TMouseWheelCommand;
- typedef MPRActors::TKeyCommand TKeyCommand;
- typedef MPRActors::TVoidCommand TVoidCommand;
+ typedef MPRActors::TStyle TStyle;
+ typedef MPRActors::TMouseCommand TMouseCommand;
+ typedef MPRActors::TMouseWheelCommand TMouseWheelCommand;
+ typedef MPRActors::TKeyCommand TKeyCommand;
+ typedef MPRActors::TVoidCommand TVoidCommand;
+ typedef MPRActors::TMouseMoveCommand TMouseMoveCommand;
+ typedef MPRActors::TMouseClickCommand TMouseClickCommand;
+ typedef MPRActors::TMouseDoubleClickCommand TMouseDoubleClickCommand;
+ typedef MPRActors::TExposeCommand TExposeCommand;
+ typedef MPRActors::TConfigureCommand TConfigureCommand;
+ typedef MPRActors::TEnterCommand TEnterCommand;
+ typedef MPRActors::TLeaveCommand TLeaveCommand;
public:
vtkTypeMacro( MPRObjects, vtkObject );
void ResetCamera( const int& id );
void ResetCameras( );
- void Render( const int& id );
- void RenderAll( );
+ void Render( const int& id, const double& t );
+ void RenderAll( const double& t );
vtkRenderer* GetXRenderer( );
vtkRenderer* GetYRenderer( );
vtkRenderer* GetZRenderer( );
--- /dev/null
+#include <cpPlugins/Interface/BaseMPRWidget.h>
+
+#ifdef cpPlugins_Interface_QT4
+
+#include <cpPlugins/Interface/ui_BaseMPRWidget.h>
+#include <QTreeWidgetItem>
+#include <vtkRendererCollection.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::BaseMPRWidget::
+BaseMPRWidget( QWidget* parent )
+ : QWidget( parent ),
+ m_UI( new Ui::BaseMPRWidget )
+{
+ this->m_UI->setupUi( this );
+
+ // Configure VTK widgets
+ this->m_VTK[ 0 ] = this->m_UI->VTK01;
+ this->m_VTK[ 1 ] = this->m_UI->VTK00;
+ this->m_VTK[ 2 ] = this->m_UI->VTK10;
+ this->m_VTK[ 3 ] = this->m_UI->VTK11;
+
+ this->m_MPRObjects = vtkSmartPointer< TMPRObjects >::New( );
+ this->m_MPRObjects->SetRenderWindows(
+ this->m_VTK[ 0 ]->GetRenderWindow( ),
+ this->m_VTK[ 1 ]->GetRenderWindow( ),
+ this->m_VTK[ 2 ]->GetRenderWindow( ),
+ this->m_VTK[ 3 ]->GetRenderWindow( )
+ );
+
+ // Connect slots
+ QObject::connect(
+ this->m_UI->TopSplitter, SIGNAL( splitterMoved( int, int ) ),
+ this, SLOT( _SyncBottom( int, int ) )
+ );
+ QObject::connect(
+ this->m_UI->BottomSplitter, SIGNAL( splitterMoved( int, int ) ),
+ this, SLOT( _SyncTop( int, int ) )
+ );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::BaseMPRWidget::
+~BaseMPRWidget( )
+{
+ delete this->m_UI;
+
+ // Delete polydata actors
+ std::map< std::string, PolyDataActor* >::iterator mIt =
+ this->m_Meshes.begin( );
+ for( ; mIt != this->m_Meshes.end( ); ++mIt )
+ delete mIt->second;
+ this->m_Meshes.clear( );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWidget::
+ShowImage(
+ vtkImageData* image,
+ const std::string& name,
+ const std::string& parent
+ )
+{
+ // Update tree view
+ QTreeWidgetItem* new_item = this->_UpdateItem( name, parent );
+ if( new_item == NULL )
+ return( false );
+
+ // Associate new data
+ this->m_Images[ name ] = image;
+ this->m_Tree[ name ] = parent;
+
+ // Show image and return
+ this->m_MPRObjects->AddImage( image );
+ return( true );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWidget::
+ShowImage(
+ vtkImageData* image,
+ const std::string& name,
+ const std::string& parent,
+ const double& r, const double& g, const double& b
+ )
+{
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWidget::
+ShowMesh(
+ vtkPolyData* mesh,
+ const std::string& name,
+ const std::string& parent
+ )
+{
+ // Update tree view
+ QTreeWidgetItem* new_item = this->_UpdateItem( name, parent );
+ if( new_item == NULL )
+ return( false );
+
+ // Associate new data
+ PolyDataActor* actor = new PolyDataActor( mesh );
+ this->m_Meshes[ name ] = actor;
+ this->m_Tree[ name ] = parent;
+
+ // Show mesh
+ this->_Add3DActor( actor->Actor );
+ return( true );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWidget::
+ShowMesh(
+ vtkPolyData* mesh,
+ const std::string& name,
+ const std::string& parent,
+ const double& r, const double& g, const double& b
+ )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::BaseMPRWidget::
+ClearAll( )
+{
+ /*
+ this->m_MPRObjects->ClearAll( );
+ this->m_Images.clear( );
+ this->m_Meshes.clear( );
+ */
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Interface::BaseMPRWidget::
+GetSelectedData( ) const
+{
+ QTreeWidgetItem* item = this->m_UI->LoadedData->currentItem( );
+ if( item != NULL )
+ return( item->text( 0 ).toStdString( ) );
+ else
+ return( "" );
+}
+
+// -------------------------------------------------------------------------
+QTreeWidgetItem* cpPlugins::Interface::BaseMPRWidget::
+_FindItem( const std::string& name ) const
+{
+ QList< QTreeWidgetItem* > items =
+ this->m_UI->LoadedData->findItems( name.c_str( ), Qt::MatchExactly );
+ if( items.size( ) > 0 )
+ return( items[ 0 ] );
+ else
+ return( NULL );
+}
+
+// -------------------------------------------------------------------------
+QTreeWidgetItem* cpPlugins::Interface::BaseMPRWidget::
+_UpdateItem( const std::string& name, const std::string& parent )
+{
+ // Update tree view
+ QTreeWidgetItem* new_item = NULL;
+ if( parent != "" )
+ {
+ QTreeWidgetItem* parent_item = this->_FindItem( parent );
+ if( parent_item != NULL )
+ {
+ QTreeWidgetItem* old_item = this->_FindItem( name );
+ if( old_item == NULL )
+ {
+ new_item =
+ new QTreeWidgetItem( parent_item, QStringList( name.c_str( ) ) );
+ parent_item->setExpanded( true );
+
+ } // fi
+
+ } // fi
+ }
+ else
+ {
+ new_item = new QTreeWidgetItem(
+ ( QTreeWidgetItem* )( NULL ), QStringList( name.c_str( ) )
+ );
+ this->m_UI->LoadedData->addTopLevelItem( new_item );
+
+ } // fi
+ return( new_item );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::BaseMPRWidget::
+_Add3DActor( vtkProp3D* prop )
+{
+ vtkRenderer* ren =
+ this->m_VTK[ 3 ]->GetRenderWindow( )->GetRenderers( )->GetFirstRenderer( );
+ if( ren == NULL )
+ return;
+ ren->AddActor( prop );
+ this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::BaseMPRWidget::
+_SyncBottom( int a, int b )
+{
+ this->m_UI->BottomSplitter->setSizes( this->m_UI->TopSplitter->sizes( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::BaseMPRWidget::
+_SyncTop( int a, int b )
+{
+ this->m_UI->TopSplitter->setSizes( this->m_UI->BottomSplitter->sizes( ) );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::BaseMPRWidget::PolyDataActor::
+PolyDataActor( vtkPolyData* pd )
+{
+ if( pd == NULL )
+ return;
+
+ double range[ 2 ];
+ pd->GetScalarRange( range );
+
+ this->Normals = vtkSmartPointer< vtkPolyDataNormals >::New( );
+ this->Stripper = vtkSmartPointer< vtkStripper >::New( );
+ this->Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+ this->Actor = vtkSmartPointer< vtkQuadricLODActor >::New( );
+
+ this->Normals->SetInputData( pd );
+ this->Normals->SetFeatureAngle( 60.0 );
+ this->Stripper->SetInputConnection( this->Normals->GetOutputPort( ) );
+ this->Mapper->SetInputConnection( this->Stripper->GetOutputPort( ) );
+ this->Mapper->UseLookupTableScalarRangeOff( );
+ this->Mapper->SetScalarRange(
+ range[ 0 ], ( ( range[ 1 ] - range[ 0 ] ) * 0.75 ) + range[ 0 ]
+ );
+ this->Actor->SetMapper( this->Mapper );
+ this->Actor->DeferLODConstructionOff( );
+}
+
+#endif // cpPlugins_Interface_QT4
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__INTERFACE__BASEMPRWIDGET__H__
+#define __CPPLUGINS__INTERFACE__BASEMPRWIDGET__H__
+
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/Interface/Config.h>
+
+#ifdef cpPlugins_Interface_QT4
+
+#include <map>
+#include <string>
+
+#include <QWidget>
+
+#include <vtkSmartPointer.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyDataNormals.h>
+#include <vtkQuadricLODActor.h>
+#include <vtkStripper.h>
+
+#include <cpExtensions/Visualization/MPRObjects.h>
+
+// -------------------------------------------------------------------------
+class QTreeWidgetItem;
+class QVTKWidget;
+
+namespace Ui
+{
+ class BaseMPRWidget;
+}
+
+// -------------------------------------------------------------------------
+namespace cpPlugins
+{
+ namespace Interface
+ {
+ /**
+ */
+ class cpPlugins_Interface_EXPORT BaseMPRWidget
+ : public QWidget
+ {
+ Q_OBJECT;
+
+ public:
+ typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
+
+ typedef TMPRObjects::TStyle TStyle;
+ typedef TMPRObjects::TMouseCommand TMouseCommand;
+ typedef TMPRObjects::TMouseWheelCommand TMouseWheelCommand;
+ typedef TMPRObjects::TKeyCommand TKeyCommand;
+ typedef TMPRObjects::TVoidCommand TVoidCommand;
+ typedef TMPRObjects::TMouseMoveCommand TMouseMoveCommand;
+ typedef TMPRObjects::TMouseClickCommand TMouseClickCommand;
+ typedef TMPRObjects::TMouseDoubleClickCommand TMouseDoubleClickCommand;
+ typedef TMPRObjects::TExposeCommand TExposeCommand;
+ typedef TMPRObjects::TConfigureCommand TConfigureCommand;
+ typedef TMPRObjects::TEnterCommand TEnterCommand;
+ typedef TMPRObjects::TLeaveCommand TLeaveCommand;
+
+ public:
+ explicit BaseMPRWidget( QWidget* parent = 0 );
+ virtual ~BaseMPRWidget( );
+
+ // Some visualization accessors
+ bool ShowImage(
+ vtkImageData* image,
+ const std::string& name,
+ const std::string& parent = ""
+ );
+ bool ShowImage(
+ vtkImageData* image,
+ const std::string& name,
+ const std::string& parent,
+ const double& r, const double& g, const double& b
+ );
+ bool ShowMesh(
+ vtkPolyData* mesh,
+ const std::string& name,
+ const std::string& parent
+ );
+ bool ShowMesh(
+ vtkPolyData* mesh,
+ const std::string& name,
+ const std::string& parent,
+ const double& r, const double& g, const double& b
+ );
+ void ClearAll( );
+
+ // Visual objects accessors
+ std::string GetSelectedData( ) const;
+
+ protected:
+ QTreeWidgetItem* _FindItem( const std::string& name ) const;
+ QTreeWidgetItem* _UpdateItem(
+ const std::string& name,
+ const std::string& parent
+ );
+
+ void _Add3DActor( vtkProp3D* prop );
+
+ private slots:
+ void _SyncBottom( int a, int b );
+ void _SyncTop( int a, int b );
+
+ protected:
+ Ui::BaseMPRWidget* m_UI;
+ vtkSmartPointer< TMPRObjects > m_MPRObjects;
+
+ struct PolyDataActor
+ {
+ vtkSmartPointer< vtkPolyDataNormals > Normals;
+ vtkSmartPointer< vtkStripper > Stripper;
+ vtkSmartPointer< vtkPolyDataMapper > Mapper;
+ vtkSmartPointer< vtkQuadricLODActor > Actor;
+
+ PolyDataActor( vtkPolyData* pd );
+ };
+
+ std::map< std::string, vtkImageData* > m_Images;
+ std::map< std::string, PolyDataActor* > m_Meshes;
+ std::map< std::string, std::string > m_Tree;
+
+ QVTKWidget* m_VTK[ 4 ];
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // cpPlugins_Interface_QT4
+
+#endif // __CPPLUGINS__INTERFACE__BASEMPRWIDGET__H__
+
+// eof - $RCSfile$
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BaseMPRWidget</class>
+ <widget class="QWidget" name="BaseMPRWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>580</width>
+ <height>424</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QSplitter" name="MainSplitter">
+ <property name="minimumSize">
+ <size>
+ <width>562</width>
+ <height>406</height>
+ </size>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QTreeWidget" name="LoadedData">
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>406</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>500</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <column>
+ <property name="text">
+ <string>Data</string>
+ </property>
+ </column>
+ </widget>
+ <widget class="QSplitter" name="QuadSplitter">
+ <property name="minimumSize">
+ <size>
+ <width>406</width>
+ <height>406</height>
+ </size>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QSplitter" name="TopSplitter">
+ <property name="minimumSize">
+ <size>
+ <width>406</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QVTKWidget" name="VTK00" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QVTKWidget" name="VTK01" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QSplitter" name="BottomSplitter">
+ <property name="minimumSize">
+ <size>
+ <width>406</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QVTKWidget" name="VTK10" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QVTKWidget" name="VTK11" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>QVTKWidget</class>
+ <extends>QWidget</extends>
+ <header location="global">QVTKWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
+++ /dev/null
-#include <cpPlugins/Interface/BaseMPRWindow.h>
-
-#ifdef cpPlugins_Interface_QT4
-
-#include <vtkRendererCollection.h>
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::BaseMPRWindow::
-BaseMPRWindow( QWidget* parent )
- : cpExtensions::QT::QuadSplitter( parent )
-{
- // Configure splitter
- this->m_XVTK = new QVTKWidget( this );
- this->m_YVTK = new QVTKWidget( this );
- this->m_ZVTK = new QVTKWidget( this );
- this->m_WVTK = new QVTKWidget( this );
- this->addWidgets( this->m_YVTK, this->m_XVTK, this->m_ZVTK, this->m_WVTK );
-
- // Create and associate vtk renderers
- this->m_MPRObjects = vtkSmartPointer< TMPRObjects >::New( );
- this->m_MPRObjects->SetRenderWindows(
- this->m_XVTK->GetRenderWindow( ),
- this->m_YVTK->GetRenderWindow( ),
- this->m_ZVTK->GetRenderWindow( ),
- this->m_WVTK->GetRenderWindow( )
- );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::BaseMPRWindow::
-~BaseMPRWindow( )
-{
- if( this->m_WVTK != NULL ) delete this->m_WVTK;
- if( this->m_ZVTK != NULL ) delete this->m_ZVTK;
- if( this->m_YVTK != NULL ) delete this->m_YVTK;
- if( this->m_XVTK != NULL ) delete this->m_XVTK;
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::BaseMPRWindow::
-ShowImage( vtkImageData* image )
-{
- bool r = ( image != NULL );
- if( r )
- this->m_MPRObjects->AddImage( image );
- return( r );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::BaseMPRWindow::
-ShowImage( vtkImageData* image, double r, double g, double b )
-{
- return( false );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::BaseMPRWindow::
-ShowMesh( vtkPolyData* mesh )
-{
- return( false );
-}
-
-// -------------------------------------------------------------------------
-/*
- void cpPlugins::Interface::BaseMPRWindow::
- AddImage( const std::string& name, TImage* image )
- {
- this->m_Images[ name ] = image;
- vtkImageData* vtk_id =
- this->m_Images[ name ]->GetVTK< vtkImageData >( );
- if( vtk_id != NULL )
- this->m_MPRObjects->AddImage( vtk_id );
- }
-*/
-
-// -------------------------------------------------------------------------
-double cpPlugins::Interface::BaseMPRWindow::
-GetWindow( ) const
-{
- return( this->m_MPRObjects->GetWindow( ) );
-}
-
-// -------------------------------------------------------------------------
-double cpPlugins::Interface::BaseMPRWindow::
-GetLevel( ) const
-{
- return( this->m_MPRObjects->GetLevel( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::BaseMPRWindow::
-ClearAll( )
-{
- /*
- this->m_MPRObjects->ClearAll( );
- this->m_Images.clear( );
- this->m_Meshes.clear( );
- */
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::BaseMPRWindow::
-Add3DActor( vtkProp3D* prop )
-{
- vtkRenderer* ren =
- this->m_WVTK->GetRenderWindow( )->GetRenderers( )->GetFirstRenderer( );
- if( ren == NULL )
- return;
- ren->AddActor( prop );
- this->m_WVTK->GetRenderWindow( )->Render( );
-}
-
-#endif // cpPlugins_Interface_QT4
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
-#define __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/Config.h>
-
-#ifdef cpPlugins_Interface_QT4
-
-#include <QApplication>
-#include <QMenu>
-#include <QVTKWidget.h>
-
-#include <vtkSmartPointer.h>
-#include <cpExtensions/QT/QuadSplitter.h>
-#include <cpExtensions/Visualization/MPRObjects.h>
-
-namespace cpPlugins
-{
- namespace Interface
- {
- /**
- */
- class cpPlugins_Interface_EXPORT BaseMPRWindow
- : public cpExtensions::QT::QuadSplitter
- {
- Q_OBJECT;
-
- public:
- typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
-
- typedef TMPRObjects::TBaseStyle TBaseStyle;
- typedef TMPRObjects::TStyle TStyle;
- typedef TMPRObjects::TSlicesCommand TSlicesCommand;
- typedef TMPRObjects::TWindowLevelCommand TWindowLevelCommand;
- typedef TMPRObjects::TMouseCommand TMouseCommand;
- typedef TMPRObjects::TMouseWheelCommand TMouseWheelCommand;
- typedef TMPRObjects::TKeyCommand TKeyCommand;
- typedef TMPRObjects::TVoidCommand TVoidCommand;
-
- public:
- explicit BaseMPRWindow( QWidget* parent = 0 );
- virtual ~BaseMPRWindow( );
-
- // Some visualization accessors
- bool ShowImage( vtkImageData* image );
- bool ShowImage( vtkImageData* image, double r, double g, double b );
- bool ShowMesh( vtkPolyData* mesh );
- double GetWindow( ) const;
- double GetLevel( ) const;
- void ClearAll( );
-
- // Some more visualization (3D)
- void Add3DActor( vtkProp3D* prop );
-
- protected:
- vtkSmartPointer< TMPRObjects > m_MPRObjects;
-
- QVTKWidget* m_XVTK;
- QVTKWidget* m_YVTK;
- QVTKWidget* m_ZVTK;
- QVTKWidget* m_WVTK;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // cpPlugins_Interface_QT4
-
-#endif // __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
-
-// eof - $RCSfile$
IF(USE_QT4)
SET(
LIB_QT_UI
+ BaseMPRWidget.ui
ParametersListWidget.ui
)
SET(
LIB_QT_Headers
ParametersListWidget.h
ParametersQtDialog.h
- BaseMPRWindow.h
+ BaseMPRWidget.h
)
SET(
LIB_QT_Sources
ParametersListWidget.cxx
ParametersQtDialog.cxx
- BaseMPRWindow.cxx
+ BaseMPRWidget.cxx
)
SET(
LIB_QT_Resources
this->m_VTKObject = mesh;
else
this->m_VTKObject = NULL;
- this->m_Mapper = NULL;
- this->m_Actor = NULL;
this->Modified( );
}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Mesh::
-CreateVTKActor( )
-{
- vtkPolyData* pd = this->GetVTK< vtkPolyData >( );
- if(
- pd != NULL &&
- (
- this->m_Mapper.GetPointer( ) == NULL ||
- this->m_Actor.GetPointer( ) == NULL
- )
- )
- {
- double range[ 2 ];
- pd->GetScalarRange( range );
-
- this->m_Normals = vtkSmartPointer< vtkPolyDataNormals >::New( );
- this->m_Stripper = vtkSmartPointer< vtkStripper >::New( );
- this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
- this->m_Actor = vtkSmartPointer< vtkQuadricLODActor >::New( );
-
- this->m_Normals->SetInputData( pd );
- this->m_Normals->SetFeatureAngle( 60.0 );
- this->m_Stripper->SetInputConnection( this->m_Normals->GetOutputPort( ) );
- this->m_Mapper->SetInputConnection( this->m_Stripper->GetOutputPort( ) );
- this->m_Mapper->UseLookupTableScalarRangeOff( );
- this->m_Mapper->SetScalarRange(
- range[ 0 ], ( ( range[ 1 ] - range[ 0 ] ) * 0.75 ) + range[ 0 ]
- );
- this->m_Actor->SetMapper( this->m_Mapper );
- this->m_Actor->DeferLODConstructionOff( );
- this->Modified( );
-
- /*
- TODO: vtkQuadricLODActor : AllocatedRenderTime
- */
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-vtkActor* cpPlugins::Interface::Mesh::
-GetVTKActor( )
-{
- return( this->m_Actor );
-}
-
-// -------------------------------------------------------------------------
-const vtkActor* cpPlugins::Interface::Mesh::
-GetVTKActor( ) const
-{
- return( this->m_Actor );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::Mesh::
Mesh( )
- : Superclass( ),
- m_Mapper( NULL ),
- m_Actor( NULL )
+ : Superclass( )
{
}
#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <cpPlugins/Interface/DataObject.h>
-#include <vtkSmartPointer.h>
-#include <vtkQuadricLODActor.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkPolyDataNormals.h>
-#include <vtkStripper.h>
-
namespace cpPlugins
{
namespace Interface
virtual void SetVTK( vtkObject* mesh );
- virtual void CreateVTKActor( );
- virtual vtkActor* GetVTKActor( );
- virtual const vtkActor* GetVTKActor( ) const;
-
protected:
Mesh( );
virtual ~Mesh( );
// Purposely not implemented
Mesh( const Self& );
Self& operator=( const Self& );
-
- protected:
- vtkSmartPointer< vtkPolyDataNormals > m_Normals;
- vtkSmartPointer< vtkStripper > m_Stripper;
- vtkSmartPointer< vtkPolyDataMapper > m_Mapper;
- vtkSmartPointer< vtkQuadricLODActor > m_Actor;
};
} // ecapseman
cpPlugins::Interface::Plugins::
~Plugins( )
{
- this->m_Interface.UnloadAll( );
+ // TODO: this causes a segfault? this->m_Interface.UnloadAll( );
}
// -------------------------------------------------------------------------
return( this->m_Outputs.size( ) );
}
+// -------------------------------------------------------------------------
+std::vector< std::string > cpPlugins::Interface::ProcessObject::
+GetInputsNames( ) const
+{
+ std::vector< std::string > r;
+ auto dIt = this->m_Inputs.begin( );
+ for( ; dIt != this->m_Inputs.end( ); ++dIt )
+ r.push_back( dIt->first );
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+std::vector< std::string > cpPlugins::Interface::ProcessObject::
+GetOutputsNames( ) const
+{
+ std::vector< std::string > r;
+ auto dIt = this->m_Outputs.begin( );
+ for( ; dIt != this->m_Outputs.end( ); ++dIt )
+ r.push_back( dIt->first );
+ return( r );
+}
+
// -------------------------------------------------------------------------
void cpPlugins::Interface::ProcessObject::
SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj )
#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <map>
+#include <vector>
#include <cpPlugins/Interface/Config.h>
#include <cpPlugins/Interface/Object.h>
virtual unsigned int GetNumberOfInputs( ) const;
virtual unsigned int GetNumberOfOutputs( ) const;
+ virtual std::vector< std::string > GetInputsNames( ) const;
+ virtual std::vector< std::string > GetOutputsNames( ) const;
+
virtual void SetInput( const std::string& id, DataObject* dobj );
virtual std::string Update( );