X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FBaseMPRWidget.h;h=cd269f41e58f0560569d31f8ec4c585e825543c7;hb=00b54bc0344d74f31df8b93f7c28a07cfc8d6873;hp=6cb89f305816a6c83270df8659d00a3fcef50736;hpb=24dc7fa44ff75dc9336d703b8243ce1e52ff3429;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/BaseMPRWidget.h b/lib/cpPlugins/Interface/BaseMPRWidget.h index 6cb89f3..cd269f4 100644 --- a/lib/cpPlugins/Interface/BaseMPRWidget.h +++ b/lib/cpPlugins/Interface/BaseMPRWidget.h @@ -34,6 +34,9 @@ namespace cpPlugins { namespace Interface { + // Some forward declarations + class DataObject; + /** */ class cpPlugins_Interface_EXPORT BaseMPRWidget @@ -62,70 +65,34 @@ namespace cpPlugins virtual ~BaseMPRWidget( ); // Data management - bool AddImage( - vtkImageData* image, - const std::string& name, - const std::string& parent = "" - ); - bool AddMesh( - vtkPolyData* mesh, - const std::string& name, + bool AddData( + DataObject* data, const std::string& name, const std::string& parent ); + bool SetMainImage( const std::string& name ); void DeleteData( const std::string& name ); void DeleteAllData( ); // Some visualization accessors void SetDataColor( const std::string& name, - const double& r, - const double& g, - const double& b + const double& r, const double& g, const double& b ); void ShowData( const std::string& name ); + void HideData( const std::string& name ); vtkRenderWindowInteractor* GetInteractor( unsigned int i ); - /* - 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( + QTreeWidgetItem* _FindItemInTree( const std::string& name ) const; + QTreeWidgetItem* _UpdateTreeItem( const std::string& name, const std::string& parent ); - /* TODO - void _Add3DActor( vtkProp3D* prop ); - */ - private slots: void _SyncBottom( int a, int b ); void _SyncTop( int a, int b ); @@ -151,46 +118,25 @@ namespace cpPlugins struct Data { enum { IMAGE, MESH } Tag; + DataObject* Source; union { vtkImageData* Image; PolyDataActor Mesh; }; - Data( ) { } - virtual ~Data( ) { } - - inline Data& operator=( const Data& data ) - { - this->Tag = data.Tag; - if( this->Tag == Data::IMAGE ) - this->Image = data.Image; - else if( this->Tag == Data::MESH ) - this->Mesh = data.Mesh; - return( *this ); - } - - inline vtkImageData* GetImage( ) - { - if( this->Tag == Data::IMAGE ) - return( this->Image ); - else - return( NULL ); - } - inline vtkPolyData* GetMesh( ) - { - if( this->Tag == Data::MESH ) - return( this->Mesh.Mesh ); - else - return( NULL ); - } - inline vtkProp* GetMeshActor( ) - { - if( this->Tag == Data::MESH ) - return( this->Mesh.Actor ); - else - return( NULL ); - } + Data( ); + virtual ~Data( ); + + Data& operator=( const Data& data ); + + DataObject* GetSourceDataObject( ); + const DataObject* GetSourceDataObject( ) const; + void SetSourceDataObject( DataObject* dobj ); + + vtkImageData* GetImage( ); + vtkPolyData* GetMesh( ); + vtkProp* GetMeshActor( ); }; std::string m_MainImage;