X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FcpPlugins%2FInterface%2FBaseMPRWidget.h;h=cd269f41e58f0560569d31f8ec4c585e825543c7;hb=00b54bc0344d74f31df8b93f7c28a07cfc8d6873;hp=9ed62ceb7ede51cc041dc0a89cba61f14889c2cb;hpb=a02d2e4b730e0a8c7709856c9c47eb7ad19edda0;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/BaseMPRWidget.h b/lib/cpPlugins/Interface/BaseMPRWidget.h index 9ed62ce..cd269f4 100644 --- a/lib/cpPlugins/Interface/BaseMPRWidget.h +++ b/lib/cpPlugins/Interface/BaseMPRWidget.h @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,9 @@ namespace cpPlugins { namespace Interface { + // Some forward declarations + class DataObject; + /** */ class cpPlugins_Interface_EXPORT BaseMPRWidget @@ -60,42 +64,34 @@ namespace cpPlugins 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, + // Data management + bool AddData( + DataObject* data, const std::string& name, const std::string& parent ); - bool ShowMesh( - vtkPolyData* mesh, + bool SetMainImage( const std::string& name ); + void DeleteData( const std::string& name ); + void DeleteAllData( ); + + // Some visualization accessors + void SetDataColor( const std::string& name, - const std::string& parent, const double& r, const double& g, const double& b ); - void ClearAll( ); + void ShowData( const std::string& name ); + void HideData( const std::string& name ); + + vtkRenderWindowInteractor* GetInteractor( unsigned int i ); // Visual objects accessors std::string GetSelectedData( ) const; protected: - QTreeWidgetItem* _FindItem( const std::string& name ) const; - QTreeWidgetItem* _UpdateItem( + QTreeWidgetItem* _FindItemInTree( const std::string& name ) const; + QTreeWidgetItem* _UpdateTreeItem( const std::string& name, const std::string& parent ); - - void _Add3DActor( vtkProp3D* prop ); private slots: void _SyncBottom( int a, int b ); @@ -104,22 +100,48 @@ namespace cpPlugins protected: Ui::BaseMPRWidget* m_UI; vtkSmartPointer< TMPRObjects > m_MPRObjects; + QVTKWidget* m_VTK[ 4 ]; struct PolyDataActor { - vtkSmartPointer< vtkPolyDataNormals > Normals; - vtkSmartPointer< vtkStripper > Stripper; - vtkSmartPointer< vtkPolyDataMapper > Mapper; - vtkSmartPointer< vtkQuadricLODActor > Actor; - - PolyDataActor( vtkPolyData* pd ); + vtkPolyData* Mesh; + vtkPolyDataNormals* Normals; + vtkStripper* Stripper; + vtkPolyDataMapper* Mapper; + vtkQuadricLODActor* Actor; + + PolyDataActor( ); + virtual ~PolyDataActor( ); + void Configure( vtkPolyData* pd ); }; - std::map< std::string, vtkImageData* > m_Images; - std::map< std::string, PolyDataActor* > m_Meshes; - std::map< std::string, std::string > m_Tree; + struct Data + { + enum { IMAGE, MESH } Tag; + DataObject* Source; + union + { + vtkImageData* Image; + PolyDataActor Mesh; + }; + + Data( ); + virtual ~Data( ); + + Data& operator=( const Data& data ); + + DataObject* GetSourceDataObject( ); + const DataObject* GetSourceDataObject( ) const; + void SetSourceDataObject( DataObject* dobj ); + + vtkImageData* GetImage( ); + vtkPolyData* GetMesh( ); + vtkProp* GetMeshActor( ); + }; - QVTKWidget* m_VTK[ 4 ]; + std::string m_MainImage; + std::map< std::string, Data > m_Data; + std::map< std::string, std::string > m_Tree; }; } // ecapseman