#include <QMessageBox>
#ifdef _WIN32
+# define PLUGIN_PREFIX ""
# define PLUGIN_EXT "dll"
# define PLUGIN_REGEX "Plugins file (*.dll);;All files (*)"
#else
+# define PLUGIN_PREFIX "lib"
# define PLUGIN_EXT "so"
# define PLUGIN_REGEX "Plugins file (*.so);;All files (*)"
#endif // _WIN32
);
// Start: load all disponible plugins
- this->_triggered_actionOpenPlugins( );
+ this->_LoadPlugins(
+ std::string( PLUGIN_PREFIX ) +
+ std::string( "cpPlugins." ) +
+ std::string( PLUGIN_EXT )
+ );
}
// -------------------------------------------------------------------------
delete this->m_MPR;
}
+// -------------------------------------------------------------------------
+bool ImageMPR::
+_LoadPlugins( const std::string& filename )
+{
+ this->m_Plugins.UnloadAll( );
+ if( !( this->m_Plugins.Load( filename ) ) )
+ {
+ this->m_Plugins.UnloadAll( );
+ return( false );
+
+ } // fi
+ this->m_BaseClasses[ "ImageReader" ] = "cpPlugins::ImageReader";
+ this->m_BaseClasses[ "MeshReader" ] = "cpPlugins::MeshReader";
+ return( true );
+}
+
// -------------------------------------------------------------------------
void ImageMPR::
_triggered_actionOpenPlugins( )
return;
std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
- this->m_Plugins.UnloadAll( );
- if( !( this->m_Plugins.Load( fname ) ) )
- {
+ if( !( _LoadPlugins( fname ) ) )
QMessageBox::critical(
this,
tr( "Ignoring plugin" ),
tr( fname.c_str( ) )
);
- this->m_Plugins.UnloadAll( );
- return;
-
- } // fi
-
- this->m_BaseClasses[ "ImageReader" ] =
- "cpPlugins::Plugins::ImageReader";
- this->m_BaseClasses[ "PolyDataReader" ] =
- "cpPlugins::Plugins::PolyDataReader";
}
// -------------------------------------------------------------------------
this->m_InputImage = NULL;
// Get a reader from plugins
- TPlugin::Pointer reader =
+ TPluginFilter::Pointer reader =
this->m_Plugins.CreateProcessObject(
this->m_BaseClasses[ "ImageReader" ]
);
QStringList::const_iterator qIt = q_fnames.begin( );
for( ; qIt != q_fnames.end( ); ++qIt )
reader_params.AddValueToStringList( "FileNames", qIt->toStdString( ) );
-
- // Other parameters
- reader_params.SetValueAsString( "PixelType", "short" );
- reader_params.SetValueAsUint( "ImageDimension", 3 );
- reader_params.SetValueAsUint( "IsColorImage", 0 );
reader->SetParameters( reader_params );
// Execute and get error message, if any
std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
- this->m_InputPolyData = NULL;
+ this->m_InputMesh = NULL;
// Get a reader from plugins
- TPlugin::Pointer reader =
+ TPluginFilter::Pointer reader =
this->m_Plugins.CreateProcessObject(
- this->m_BaseClasses[ "PolyDataReader" ]
+ this->m_BaseClasses[ "MeshReader" ]
);
// Configure plugin
// Assign fresh image, if any
if( err == "" )
{
- this->m_InputPolyData =
- dynamic_cast< TPluginPolyData* >( reader->GetOutput( 0 ) );
+ this->m_InputMesh =
+ dynamic_cast< TPluginMesh* >( reader->GetOutput( 0 ) );
reader->DisconnectOutputs( );
- if( this->m_InputPolyData.IsNotNull( ) )
+ if( this->m_InputMesh.IsNotNull( ) )
{
- this->m_InputPolyData->GetActor( )->GetProperty( )->SetColor( 1, 0, 1 );
- this->m_MPR->Add3DActor( this->m_InputPolyData->GetActor( ) );
+ this->m_InputMeshMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+ this->m_InputMeshMapper->SetInputData( this->m_InputMesh->GetVTKPolyData( ) );
+ this->m_InputMeshActor = vtkSmartPointer< vtkActor >::New( );
+ this->m_InputMeshActor->SetMapper( this->m_InputMeshMapper );
+ this->m_MPR->Add3DActor( this->m_InputMeshActor );
} // fi
}