#include <vtkPolyData.h>
#include <vtkPolyDataReader.h>
+#ifdef cpPlugins_Interface_QT4
+#include <QFileDialog>
+#endif // cpPlugins_Interface_QT4
+
+// -------------------------------------------------------------------------
+bool cpPlugins::IO::MeshReader::
+ExecConfigurationDialog( QWidget* parent )
+{
+ bool r = false;
+
+#ifdef cpPlugins_Interface_QT4
+
+ // Show dialog and check if it was accepted
+ QFileDialog dialog( parent );
+ dialog.setFileMode( QFileDialog::ExistingFile );
+ dialog.setDirectory( QFileDialog::tr( "." ) );
+ dialog.setNameFilter( QFileDialog::tr( "All files (*)" ) );
+ if( dialog.exec( ) )
+ {
+ this->m_Parameters = this->m_DefaultParameters;
+ QStringList names = dialog.selectedFiles( );
+ this->m_Parameters.AddValueToStringList(
+ "FileNames", names[ 0 ].toStdString( )
+ );
+
+ /* TODO
+ this->m_Parameters.SetValueAsString( "PixelType", "float" );
+ this->m_Parameters.SetValueAsUint( "Dimension", 3 );
+ */
+
+ r = true;
+
+ } // fi
+
+#endif // cpPlugins_Interface_QT4
+
+ return( r );
+}
+
// -------------------------------------------------------------------------
cpPlugins::IO::MeshReader::
MeshReader( )
- : Superclass( ),
- m_Reader( NULL )
+ : Superclass( )
{
this->m_ClassName = "cpPlugins::IO::MeshReader";
this->m_ClassCategory = "MeshReader";
cpPlugins::IO::MeshReader::
~MeshReader( )
{
- if( this->m_Reader != NULL )
- this->m_Reader = NULL;
}
// -------------------------------------------------------------------------
Parameters::TString fname =
this->m_Parameters.GetValueAsString( "FileName" );
- if( this->m_Reader != NULL )
- this->m_Reader->Delete( );
-
- vtkPolyDataReader* pdr = vtkPolyDataReader::New( );
- this->m_Reader = pdr;
+ vtkPolyDataReader* pdr = this->_CreateVTK< vtkPolyDataReader >( );
pdr->SetFileName( fname.c_str( ) );
pdr->Update( );
cpPlugins::Interface::Mesh* out =
this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
if( out != NULL )
- out->SetVTKMesh( pdr->GetOutput( ) );
+ out->SetVTK( pdr->GetOutput( ) );
else
return( "MeshReader: output not correctly created." );
return( "" );