#ifndef __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__ #define __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__ #include #ifdef cpExtensions_QT4 #include #include #include #include #include #include #include #include #include #include // ------------------------------------------------------------------------- class QTreeWidgetItem; class QVTKWidget; namespace Ui { class SimpleMPRWidget; } // ------------------------------------------------------------------------- namespace cpExtensions { namespace QT { /** */ class cpExtensions_EXPORT SimpleMPRWidget : public QWidget { Q_OBJECT; public: typedef SimpleMPRWidget Self; typedef cpExtensions::Visualization::MPRObjects TMPRObjects; typedef TMPRObjects::TStyle TStyle; typedef TMPRObjects::TMouseCommand TMouseCommand; typedef TMPRObjects::TMouseWheelCommand TMouseWheelCommand; typedef TMPRObjects::TKeyCommand TKeyCommand; typedef TMPRObjects::TVoidCommand TVoidCommand; typedef TMPRObjects::TMouseMoveCommand TMouseMoveCommand; typedef TMPRObjects::TMouseClickCommand TMouseClickCommand; typedef TMPRObjects::TMouseDoubleClickCommand TMouseDoubleClickCommand; typedef TMPRObjects::TExposeCommand TExposeCommand; typedef TMPRObjects::TConfigureCommand TConfigureCommand; typedef TMPRObjects::TEnterCommand TEnterCommand; typedef TMPRObjects::TLeaveCommand TLeaveCommand; public: explicit SimpleMPRWidget( QWidget* parent = 0 ); virtual ~SimpleMPRWidget( ); // Data management unsigned int GetNumberOfData( ) const; bool AddData( vtkImageData* data, const std::string& name, const std::string& parent ); bool AddData( vtkPolyData* data, const std::string& name ); const std::string& GetMainImage( ) const; bool SetMainImage( const std::string& name ); void DeleteData( const std::string& name ); void DeleteAllData( ); // Some qt accessors void SetDataColor( const std::string& name, const double& r, const double& g, const double& b ); void ShowData( const std::string& name ); void HideData( const std::string& name ); void SetWindowLevel( const double& w, const double& l ); double GetWindow( ) const; double GetLevel( ) const; vtkRenderWindowInteractor* GetInteractor( unsigned int i ); // Visual objects accessors std::string GetSelectedData( ) const; private slots: void _SyncBottom( int a, int b ); void _SyncTop( int a, int b ); protected: static double cm_Colors[ 8 ][ 3 ]; Ui::SimpleMPRWidget* m_UI; vtkSmartPointer< TMPRObjects > m_MPRObjects; QVTKWidget* m_VTK[ 4 ]; struct PolyDataActor { vtkPolyData* Mesh; vtkPolyDataNormals* Normals; vtkStripper* Stripper; vtkPolyDataMapper* Mapper; vtkQuadricLODActor* Actor; PolyDataActor( ); virtual ~PolyDataActor( ); void Configure( vtkPolyData* pd ); }; struct Data { enum { IMAGE, MESH } Tag; vtkImageData* Image; PolyDataActor Mesh; Data( ); virtual ~Data( ); Data& operator=( const Data& data ); void SetImageData( vtkImageData* data ); void SetPolyData( vtkPolyData* data ); vtkImageData* GetImage( ); vtkPolyData* GetMesh( ); vtkProp* GetMeshActor( ); }; std::string m_MainImage; std::map< std::string, Data > m_Data; std::map< std::string, std::string > m_Tree; }; } // ecapseman } // ecapseman #endif // cpExtensions_QT4 #endif // __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__ // eof - $RCSfile$