#include <cpPipelineEditor/BaseQtMainWindow.h>
#include <cpExtensions/QT/SimpleMPRWidget.h>
+#include <cpPlugins/ActorPropertiesQtDialog.h>
#include <cpPipelineEditor/Editor.h>
+#include <vtkRenderer.h>
#include <QApplication>
+#include <QColorDialog>
#include <QDir>
#include <QFileDialog>
#include <QFileInfo>
m_Application( app ),
m_PluginsPath( "." ),
m_TreeWidget( NULL ),
- m_Editor( NULL )
+ m_Editor( NULL ),
+ m_MPR( NULL )
{
this->m_Interface.GuessAccesiblePlugins( );
this->m_Editor->setWorkspace( &( this->m_Workspace ) );
if( mpr != NULL )
this->m_Workspace.SetMPRViewer( mpr );
+ this->m_MPR = mpr;
}
// -------------------------------------------------------------------------
);
}
+// -------------------------------------------------------------------------
+void cpPipelineEditor::BaseQtMainWindow::
+_ShowData( const std::string& filter_name, const std::string& output_name )
+{
+ if( this->m_MPR == NULL )
+ return;
+ auto output = this->m_Workspace.GetOutput( filter_name, output_name );
+ if( output != NULL )
+ {
+ this->_Block( );
+ auto actor = output->GetVTKActor( );
+ if( actor != NULL )
+ {
+ this->m_MPR->AddActor(
+ actor, output_name + std::string( "@" ) + filter_name
+ );
+ this->_UnBlock( );
+ }
+ else
+ {
+ this->_UnBlock( );
+ QMessageBox::critical(
+ this,
+ QMessageBox::tr( "Error showing data" ),
+ QMessageBox::tr( "Unknown VTK conversion." )
+ );
+
+ } // fi
+ }
+ else
+ QMessageBox::critical(
+ this,
+ QMessageBox::tr( "Error showing data" ),
+ QMessageBox::tr( "Unknown port name." )
+ );
+}
+
+// -------------------------------------------------------------------------
+void cpPipelineEditor::BaseQtMainWindow::
+_HideData( const std::string& filter, const std::string& output )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPipelineEditor::BaseQtMainWindow::
+_DataProperties(
+ const std::string& filter_name, const std::string& output_name
+ )
+{
+ if( this->m_MPR == NULL )
+ return;
+ auto output = this->m_Workspace.GetOutput( filter_name, output_name );
+ if( output != NULL )
+ {
+ this->_Block( );
+ auto actors = this->m_MPR->GetActors(
+ output_name + std::string( "@" ) + filter_name
+ );
+ auto dlg = new cpPlugins::ActorPropertiesQtDialog( NULL );
+ for( auto i = actors.begin( ); i != actors.end( ); ++i )
+ dlg->addActor( *i );
+ dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 0 ) );
+ dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 1 ) );
+ dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 2 ) );
+ dlg->addRenderWindow( this->m_MPR->GetRenderWindow( 3 ) );
+ this->_UnBlock( );
+ dlg->exec( );
+ }
+ else
+ QMessageBox::critical(
+ this,
+ QMessageBox::tr( "Error showing data" ),
+ QMessageBox::tr( "Unknown port name." )
+ );
+}
+
+// -------------------------------------------------------------------------
+void cpPipelineEditor::BaseQtMainWindow::
+_BackgroundProperties( unsigned int i )
+{
+ QColor color =
+ QColorDialog::getColor(
+ QColor( 0, 0, 0 ),
+ this,
+ "Select Color",
+ QColorDialog::DontUseNativeDialog
+ );
+ if( color.isValid( ) )
+ {
+ double r = double( color.red( ) ) / double( 255 );
+ double g = double( color.green( ) ) / double( 255 );
+ double b = double( color.blue( ) ) / double( 255 );
+ if( i >= 4 )
+ {
+ unsigned int maxId = ( i == 4 )? 3: 4;
+ for( unsigned int j = 0; j < maxId; ++j )
+ {
+ auto ren = this->m_MPR->GetRenderer( j );
+ if( ren != NULL )
+ {
+ ren->SetBackground( r, g, b );
+ ren->Render( );
+
+ } // fi
+
+ } // rof
+ }
+ else
+ {
+ auto ren = this->m_MPR->GetRenderer( i );
+ if( ren != NULL )
+ {
+ ren->SetBackground( r, g, b );
+ ren->Render( );
+
+ } // fi
+
+ } // fi
+
+ } // fi
+}
+
// -------------------------------------------------------------------------
void cpPipelineEditor::BaseQtMainWindow::
_InteractiveLoadPlugins( )