I have recently been developing the placement of multiple vtkAngleWidgets in the vtkRestricterImageViewer, but I have found that when placing multiple vtkAngleWidgets, there will be some situations where the haldles cannot be picked randomly. I am https://gitlab.kitware.com/vtk/vtk/-/blob/v9.2.0/Examples/GUI/Qt/FourPaneViewer/QtVTKRenderWindows.cxx This problem can be reproduced in the program, and I have made these changes
void QtVTKRenderWindows::AddDistanceMeasurementToView(int i)
{
auto DistanceWidget = vtkSmartPointer<vtkAngleWidget>::New();
DistanceWidget->SetInteractor(this->riw[i]->GetResliceCursorWidget()->GetInteractor());
// Set a priority higher than our reslice cursor widget
DistanceWidget->SetPriority(this->riw[i]->GetResliceCursorWidget()->GetPriority() + 0.01);
vtkSmartPointer<vtkPointHandleRepresentation2D> handleRep =
vtkSmartPointer<vtkPointHandleRepresentation2D>::New();
vtkSmartPointer<vtkAngleRepresentation2D> distanceRep =
vtkSmartPointer<vtkAngleRepresentation2D>::New();
distanceRep->SetHandleRepresentation(handleRep);
DistanceWidget->SetRepresentation(distanceRep);
distanceRep->InstantiateHandleRepresentation();
distanceRep->GetPoint1Representation()->SetPointPlacer(riw[i]->GetPointPlacer());
distanceRep->GetPoint2Representation()->SetPointPlacer(riw[i]->GetPointPlacer());
// Add the distance to the list of widgets whose visibility is managed based
// on the reslice plane by the ResliceImageViewerMeasurements class
this->riw[i]->GetMeasurements()->AddItem(DistanceWidget);
DistanceWidget->CreateDefaultRepresentation();
DistanceWidget->EnabledOn();
}