OGS
VtkPickCallback.cpp
Go to the documentation of this file.
1
15// ** INCLUDES **
16#include "VtkPickCallback.h"
17
18#include <vtkActor.h>
19#include <vtkCellPicker.h>
20
21#include "BaseLib/Logging.h"
22
27
28void VtkPickCallback::Execute(vtkObject* caller,
29 unsigned long vtkNotUsed(eventId) /*eventId*/,
30 void* vtkNotUsed(callData) /*callData*/)
31{
32 auto* picker = static_cast<vtkCellPicker*>(caller);
33 if (picker->GetCellId() < 0)
34 {
35 // Nothing is picked
36 }
37 else
38 {
39 vtkActor* actor = picker->GetActor();
40 if (actor)
41 {
42 emit actorPicked(actor);
43 }
44
45 double* pos = picker->GetPickPosition();
46 INFO("Picked cell id is: {:d}", picker->GetCellId());
47 INFO("Picked position is: {:f} {:f} {:f}", pos[0], pos[1], pos[2]);
48 }
49}
50
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
Definition of the VtkPickCallback class.
void actorPicked(vtkProp3D *actor)
Is emitted when an vtkActor was picked.
static VtkPickCallback * New()
void Execute(vtkObject *caller, unsigned long eventId, void *callData) override