#ifndef ULIB_VTK_VIEWPORT_H #define ULIB_VTK_VIEWPORT_H #include "uLibVtkInterface.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class vtkProp; class vtk3DWidget; class vtkRenderWindow; class vtkRenderWindowInteractor; class vtkCamera; namespace uLib { namespace Vtk { class vtkHandlerWidget; /** * @class Viewport * @brief Base class for VTK viewports, providing core rendering and prop management. */ class Viewport { public: Viewport(); virtual ~Viewport(); // Render scene virtual void Render() = 0; void Reset(); void ZoomAuto(); void ZoomSelected(); // Puppet / prop management void AddPuppet(Puppet &prop); void RemovePuppet(Puppet &prop); void SelectPuppet(Puppet *prop); void addProp(vtkProp *prop); void RemoveProp(vtkProp *prop); // Widget integration void AddWidget(vtk3DWidget *widget); // Direct access to VTK internals vtkRenderer* GetRenderer() { return m_Renderer; } virtual vtkRenderWindow* GetRenderWindow() = 0; virtual vtkRenderWindowInteractor* GetInteractor() = 0; vtkCornerAnnotation* GetAnnotation() { return m_Annotation; } vtkCameraOrientationWidget* GetCameraWidget(){ return m_CameraWidget; } // Grid control void SetGridVisible(bool visible); bool GetGridVisible() const; enum Axis { X=0, Y, Z }; void SetGridAxis(Axis axis); Axis GetGridAxis() const { return m_GridAxis; } protected: void SetupPipeline(vtkRenderWindowInteractor* iren); void UpdateGrid(); vtkSmartPointer m_Renderer; vtkSmartPointer m_Annotation; vtkSmartPointer m_Marker; vtkSmartPointer m_CameraWidget; vtkSmartPointer m_GridSource; vtkSmartPointer m_GridActor; vtkSmartPointer m_OriginAxes; vtkSmartPointer m_OriginAxesActor; vtkSmartPointer m_Colors; Axis m_GridAxis; vtkSmartPointer m_HandlerWidget; std::vector m_Puppets; vtkSmartPointer m_Picker; }; } // namespace Vtk } // namespace uLib #endif // ULIB_VTK_VIEWPORT_H