# I may have discovered a bug about vtkAngeWidget

**URL:** <https://discourse.vtk.org/t/i-may-have-discovered-a-bug-about-vtkangewidget/11757>\
**Category:** Development\
**Tags:** code\
**Created:** [June 19, 2023, 2:33am UTC](https://discourse.vtk.org/t/i-may-have-discovered-a-bug-about-vtkangewidget/11757 "2023-06-19T02:33:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marlon.ma](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marlon.ma/32/6091_2.png) [@marlon.ma](https://discourse.vtk.org/u/marlon.ma)\
**Post date:** [June 19, 2023, 2:33am UTC](https://discourse.vtk.org/t/i-may-have-discovered-a-bug-about-vtkangewidget/11757/1 "2023-06-19T02:33:35Z")

</div>

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](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

```auto
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();
}

```

---

<div class="post-metadata">

**Author:** ![marlon.ma](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marlon.ma/32/6091_2.png) [@marlon.ma](https://discourse.vtk.org/u/marlon.ma)\
**Post date:** [July 3, 2023, 5:46am UTC](https://discourse.vtk.org/t/i-may-have-discovered-a-bug-about-vtkangewidget/11757/2 "2023-07-03T05:46:35Z")

</div>

Doesn’t anyone care about this issue？
