Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MITKVtkPropRenderer_H_HEADER_INCLUDED_C1C29F6D
00020 #define MITKVtkPropRenderer_H_HEADER_INCLUDED_C1C29F6D
00021
00022 #include "mitkCommon.h"
00023 #include "mitkBaseRenderer.h"
00024 #include "mitkDataStorage.h"
00025 #include "mitkRenderingManager.h"
00026
00027 #include <itkCommand.h>
00028
00029 #include <map>
00030 #include <utility>
00031
00032 class vtkRenderWindow;
00033 class vtkLight;
00034 class vtkLightKit;
00035 class vtkWorldPointPicker;
00036 class vtkPointPicker;
00037 class vtkCellPicker;
00038 class vtkTextActor;
00039 class vtkTextProperty;
00040 class vtkAssemblyPath;
00041
00042
00043 namespace mitk
00044 {
00045
00046 class Mapper;
00047
00058 class MITK_CORE_EXPORT VtkPropRenderer : public BaseRenderer
00059 {
00060
00061 private:
00062 bool didCount;
00063 void checkState();
00064
00065
00066
00067 public:
00068
00069 mitkClassMacro(VtkPropRenderer,BaseRenderer);
00070 mitkNewMacro3Param(VtkPropRenderer, const char*, vtkRenderWindow *, mitk::RenderingManager* );
00071
00072 typedef std::map<int,Mapper*> MappersMapType;
00073
00074
00075 #if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2) )
00076 enum RenderType{Opaque,Translucent,Overlay,Volumetric};
00077 #else
00078 enum RenderType{Opaque,Translucent,Overlay};
00079 #endif
00080
00081 int Render(RenderType type);
00082
00083
00084 virtual void MakeCurrent();
00085
00086 virtual void SetDataStorage( mitk::DataStorage* storage );
00087
00088 virtual void InitRenderer(vtkRenderWindow* renderwindow);
00089 virtual void Update(mitk::DataNode* datatreenode);
00090 virtual void SetMapperID(const MapperSlotId mapperId);
00091
00092
00093 virtual void InitSize(int w, int h);
00094 virtual void Resize(int w, int h);
00095
00096
00097 enum PickingMode{ WorldPointPicking, PointPicking };
00098 itkSetMacro( PickingMode, PickingMode );
00099 itkGetMacro( PickingMode, PickingMode );
00100
00101 virtual void PickWorldPoint(const Point2D& displayPoint, Point3D& worldPoint) const;
00102 virtual mitk::DataNode *PickObject( const Point2D &displayPosition, Point3D &worldPosition ) const;
00103
00104
00105 int WriteSimpleText(std::string text, double posX, double posY, double color1 = 0.0, double color2 = 1.0, double color3 = 0.0);
00106 vtkTextProperty * GetTextLabelProperty(int text_id);
00107
00108
00109
00118 virtual bool SetWorldGeometryToDataStorageBounds();
00119
00124 void InitPathTraversal();
00125
00130 vtkAssemblyPath* GetNextPath();
00131
00132 const vtkWorldPointPicker *GetWorldPointPicker() const;
00133 const vtkPointPicker *GetPointPicker() const;
00134 const vtkCellPicker *GetCellPicker() const;
00135
00140 virtual void ReleaseGraphicsResources(vtkWindow *renWin);
00141
00142 #if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2) )
00143 MappersMapType GetMappersMap() const;
00144 #endif
00145
00146 static bool useImmediateModeRendering();
00147
00148 protected:
00149 VtkPropRenderer( const char* name = "VtkPropRenderer", vtkRenderWindow * renWin = NULL, mitk::RenderingManager* rm = NULL );
00150 virtual ~VtkPropRenderer();
00151 virtual void Update();
00152
00153 private:
00154
00155
00156 void Enable2DOpenGL();
00157 void Disable2DOpenGL();
00158
00159
00160 void PrepareMapperQueue();
00161
00162 bool m_InitNeeded;
00163 bool m_ResizeNeeded;
00164 bool m_VtkMapperPresent;
00165 bool m_NewRenderer;
00166
00167
00168 vtkWorldPointPicker * m_WorldPointPicker;
00169 vtkPointPicker * m_PointPicker;
00170 vtkCellPicker * m_CellPicker;
00171
00172 PickingMode m_PickingMode;
00173
00174
00175 itk::SmartPointer< mitk::Mapper > m_CurrentWorldGeometry2DMapper;
00176
00177 vtkLightKit* m_LightKit;
00178
00179
00180 MappersMapType m_MappersMap;
00181
00182
00183 vtkRenderer * m_TextRenderer;
00184 typedef std::map<unsigned int,vtkTextActor*> TextMapType;
00185 TextMapType m_TextCollection;
00186
00187 DataStorage::SetOfObjects::ConstPointer m_PickingObjects;
00188 DataStorage::SetOfObjects::const_iterator m_PickingObjectsIterator;
00189 };
00190
00191 }
00192
00193 #endif