Exemple #1
0
void VtkPickCallback::Execute( vtkObject* caller, unsigned long vtkNotUsed(
                                       eventId), void* vtkNotUsed(callData) )
{
    auto* picker = static_cast<vtkCellPicker*>(caller);
    if (picker->GetCellId() < 0)
    {
        // Nothing is picked
    }
    else
    {
        vtkActor* actor = picker->GetActor();
        if (actor)
            emit actorPicked (actor);

        double* pos = picker->GetPickPosition();
        INFO("Picked cell id is: %d", picker->GetCellId());
        INFO("Picked position is: %f %f %f", pos[0], pos[1], pos[2]);
    }
}
Exemple #2
0
void VtkPickCallback::Execute( vtkObject* caller, unsigned long vtkNotUsed(
                                       eventId), void* vtkNotUsed(callData) )
{
	vtkCellPicker* picker = static_cast<vtkCellPicker*>(caller);
	if (picker->GetCellId() < 0)
	{
		// Nothing is picked
	}
	else
	{
		vtkActor* actor = picker->GetActor();
		if (actor)
			emit actorPicked (actor);

		double* pos = picker->GetPickPosition();
		std::cout << "Picked cell id is: " << picker->GetCellId() << std::endl;
		std::cout << "Picked position is: " << pos[0] << " " << pos[1] << " " << pos[2] <<
		std::endl;
	}
}