70 lines
1.9 KiB
C++
70 lines
1.9 KiB
C++
#ifndef ULIB_VTK_QVIEWPORT_H
|
|
#define ULIB_VTK_QVIEWPORT_H
|
|
|
|
#include <QWidget>
|
|
#include <QVTKOpenGLNativeWidget.h>
|
|
|
|
#include <vtkCornerAnnotation.h>
|
|
#include <vtkOrientationMarkerWidget.h>
|
|
#include <vtkRenderer.h>
|
|
#include <vtkRenderWindow.h>
|
|
#include <vtkSmartPointer.h>
|
|
|
|
#include "uLibVtkInterface.h"
|
|
|
|
class vtkProp;
|
|
class vtk3DWidget;
|
|
class vtkRenderWindowInteractor;
|
|
class vtkCameraOrientationWidget;
|
|
|
|
namespace uLib {
|
|
namespace Vtk {
|
|
|
|
/**
|
|
* QViewport is a self-contained Qt widget that embeds a VTK renderer
|
|
* directly into the Qt application (no separate VTK window).
|
|
* Puppets and actors are added to the embedded renderer.
|
|
*/
|
|
class QViewport : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit QViewport(QWidget* parent = nullptr);
|
|
virtual ~QViewport();
|
|
|
|
// Render scene
|
|
void Render();
|
|
void Reset();
|
|
void ZoomAuto();
|
|
|
|
// Puppet / prop management
|
|
void AddPuppet(Puppet &prop);
|
|
void RemovePuppet(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; }
|
|
vtkRenderWindow* GetRenderWindow();
|
|
vtkRenderWindowInteractor* GetInteractor();
|
|
vtkCornerAnnotation* GetAnnotation() { return m_Annotation; }
|
|
vtkCameraOrientationWidget* GetCameraWidget(){ return m_CameraWidget; }
|
|
QVTKOpenGLNativeWidget* GetWidget() { return m_VtkWidget; }
|
|
|
|
private:
|
|
void SetupPipeline();
|
|
|
|
QVTKOpenGLNativeWidget* m_VtkWidget;
|
|
vtkRenderer* m_Renderer;
|
|
vtkCornerAnnotation* m_Annotation;
|
|
vtkOrientationMarkerWidget* m_Marker;
|
|
vtkCameraOrientationWidget* m_CameraWidget;
|
|
};
|
|
|
|
} // namespace Vtk
|
|
} // namespace uLib
|
|
|
|
#endif // ULIB_VTK_QVIEWPORT_H
|