attach a widget (not working well yet)

This commit is contained in:
AndreaRigoni
2026-03-08 09:42:28 +00:00
parent 32a1104769
commit 2548582036
6 changed files with 309 additions and 169 deletions

View File

@@ -27,26 +27,17 @@
#define VTK_DETECTOR_CHAMBER_H
#include <vtkActor.h>
#include <vtkAppendPolyData.h>
#include <vtkLineSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkSmartPointer.h>
#include <vtkSphereSource.h>
#include <vtk3DWidget.h>
#include <vtkBoxWidget.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkCommand.h>
#include <vtkSmartPointer.h>
#include <vtkTransform.h>
#include "Math/Dense.h"
#include "HEP/Detectors/DetectorChamber.h"
#include "Math/Dense.h"
#include "Vtk/uLibVtkInterface.h"
#include "Vtk/vtkContainerBox.h"
class vtkBoxWidget;
namespace uLib {
namespace Vtk {
@@ -59,12 +50,39 @@ public:
Content *GetContent();
void Update();
void ConnectInteractor(vtkRenderWindowInteractor *interactor) override;
void PrintSelf(std::ostream &o) const;
private:
void InstallPipe();
protected:
void InstallPipe() override;
vtkDetectorChamber::Content *content;
private:
class vtkWidgetCallback : public vtkCommand {
public:
static vtkWidgetCallback *New() { return new vtkWidgetCallback; }
void SetChamber(uLib::Vtk::vtkDetectorChamber *ch) { this->chamber = ch; }
virtual void Execute(vtkObject *caller, unsigned long, void *) override;
private:
uLib::Vtk::vtkDetectorChamber *chamber;
};
class vtkSelectionCallback : public vtkCommand {
public:
static vtkSelectionCallback *New() { return new vtkSelectionCallback; }
void SetChamber(uLib::Vtk::vtkDetectorChamber *ch) { this->chamber = ch; }
virtual void Execute(vtkObject *caller, unsigned long, void *) override;
private:
uLib::Vtk::vtkDetectorChamber *chamber;
};
vtkBoxWidget *m_Widget;
vtkWidgetCallback *m_Callback;
vtkSelectionCallback *m_PickerCallback;
};
} // namespace Vtk