I have a well-configured functionality for adding a LineWidget by hand and thanks to vtk support I also can add this widgets programmatically by simply calling the lineWidget.updateHandleVisibility(0) and lineWidget.updateHandleVisibility(1) for two handlers to do them visible and responsive. However, now I need to add the same functionality for EllipseWidget and the problem is that the ellipseWidget does not have an updateHandleVisibility method.
That is, there is no updateHandleVisibility method here. I would like to know if this happen by accident and actually updateHandleVisibility should be included in the ellipseWidget or if there is another special way to make the ellipseWidget visible after adding it not by hand, but by clicking on a button, for example.
If I remove the updateHandleVisibility calls, then the lineWidget's handles will be invisible, but this only applies to the lineWidget, and I have no problems with it. The problem arises with ellipseWidget, because this very life-saving updateHandleVisibility method is missing so the widget remains invisible. My question is how to make the ellipseWidget visible after it is created programmatically (not by hand, but by clicking a button).
Thank you very much for such an example! It works in my case, but there is one huge problem.
I use resliceCursorWidget and maybe it’s my mistake, but all my widgets are set for Axial plane. As far as I understand, it’s a problem of setting normal.
Usually I set origin and normal this way:
ellipseWidget
.getManipulator()
.setUserOrigin(measureEntityDB.position)
ellipseWidget
.getManipulator()
.setUserNormal(
resliceCursorWidget.getWidgetState().getPlanes()[
xyzToViewType[planeContext.xyzToViewType] // 0 or 1 or 2
].normal
)
But now it didn’t help and I decided to try to set origin and normal on the handle object by implementing it into your code:
It is important that when added manually everything works well. And when placing lineWidget programmatically (as in the my first question of this topic) there are also no problems with the normal and origin.
What do you think, is this an ellipseWidget problem or did I make a mistake somewhere?