1 #ifndef __CPPLUGINS__INTERFACE__BASEMPRWIDGET__H__
2 #define __CPPLUGINS__INTERFACE__BASEMPRWIDGET__H__
4 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
5 #include <cpPlugins/Interface/Config.h>
7 #ifdef cpPlugins_Interface_QT4
14 #include <vtkSmartPointer.h>
15 #include <vtkImageData.h>
16 #include <vtkPolyDataMapper.h>
17 #include <vtkPolyDataNormals.h>
18 #include <vtkQuadricLODActor.h>
19 #include <vtkStripper.h>
21 #include <cpExtensions/Visualization/MPRObjects.h>
23 // -------------------------------------------------------------------------
24 class QTreeWidgetItem;
32 // -------------------------------------------------------------------------
39 class cpPlugins_Interface_EXPORT BaseMPRWidget
45 typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
47 typedef TMPRObjects::TStyle TStyle;
48 typedef TMPRObjects::TMouseCommand TMouseCommand;
49 typedef TMPRObjects::TMouseWheelCommand TMouseWheelCommand;
50 typedef TMPRObjects::TKeyCommand TKeyCommand;
51 typedef TMPRObjects::TVoidCommand TVoidCommand;
52 typedef TMPRObjects::TMouseMoveCommand TMouseMoveCommand;
53 typedef TMPRObjects::TMouseClickCommand TMouseClickCommand;
54 typedef TMPRObjects::TMouseDoubleClickCommand TMouseDoubleClickCommand;
55 typedef TMPRObjects::TExposeCommand TExposeCommand;
56 typedef TMPRObjects::TConfigureCommand TConfigureCommand;
57 typedef TMPRObjects::TEnterCommand TEnterCommand;
58 typedef TMPRObjects::TLeaveCommand TLeaveCommand;
61 explicit BaseMPRWidget( QWidget* parent = 0 );
62 virtual ~BaseMPRWidget( );
67 const std::string& name,
68 const std::string& parent = ""
72 const std::string& name,
73 const std::string& parent
75 void DeleteData( const std::string& name );
76 void DeleteAllData( );
78 // Some visualization accessors
80 const std::string& name,
85 void ShowData( const std::string& name );
87 vtkRenderWindowInteractor* GetInteractor( unsigned int i );
92 const std::string& name,
93 const std::string& parent = ""
97 const std::string& name,
98 const std::string& parent,
99 const double& r, const double& g, const double& b
103 const std::string& name,
104 const std::string& parent
108 const std::string& name,
109 const std::string& parent,
110 const double& r, const double& g, const double& b
115 // Visual objects accessors
116 std::string GetSelectedData( ) const;
119 QTreeWidgetItem* _FindItem( const std::string& name ) const;
120 QTreeWidgetItem* _UpdateItem(
121 const std::string& name,
122 const std::string& parent
126 void _Add3DActor( vtkProp3D* prop );
130 void _SyncBottom( int a, int b );
131 void _SyncTop( int a, int b );
134 Ui::BaseMPRWidget* m_UI;
135 vtkSmartPointer< TMPRObjects > m_MPRObjects;
136 QVTKWidget* m_VTK[ 4 ];
141 vtkPolyDataNormals* Normals;
142 vtkStripper* Stripper;
143 vtkPolyDataMapper* Mapper;
144 vtkQuadricLODActor* Actor;
147 virtual ~PolyDataActor( );
148 void Configure( vtkPolyData* pd );
153 enum { IMAGE, MESH } Tag;
163 inline Data& operator=( const Data& data )
165 this->Tag = data.Tag;
166 if( this->Tag == Data::IMAGE )
167 this->Image = data.Image;
168 else if( this->Tag == Data::MESH )
169 this->Mesh = data.Mesh;
173 inline vtkImageData* GetImage( )
175 if( this->Tag == Data::IMAGE )
176 return( this->Image );
180 inline vtkPolyData* GetMesh( )
182 if( this->Tag == Data::MESH )
183 return( this->Mesh.Mesh );
187 inline vtkProp* GetMeshActor( )
189 if( this->Tag == Data::MESH )
190 return( this->Mesh.Actor );
196 std::string m_MainImage;
197 std::map< std::string, Data > m_Data;
198 std::map< std::string, std::string > m_Tree;
205 #endif // cpPlugins_Interface_QT4
207 #endif // __CPPLUGINS__INTERFACE__BASEMPRWIDGET__H__