Is it possible to change the labels of vtkCameraOrientationWidget from X,Y,Z to U,V,N?

For vtkAxesActor,there is a bunch of methods like:SetXAxisLabelText can be used to change the text.Is there any counterpart for vtkCameraOrientationWidget to do same thing?

Hi, Alex,

Possible it is. But it’s not easy.

The six handle labels are defined as hardcoded const char* strings in vtkCameraOrientationRepresentation (https://gitlab.kitware.com/vtk/vtk/-/blob/master/Interaction/Widgets/vtkCameraOrientationRepresentation.h - see member AxisLabelsText at line 320) and there is no way to change them via a setter method. So, you’ll likely need to subclass vtkCameraOrientationRepresentation to add a constructor that is able to set custom labels.

But this is not over yet. vtkCameraOrientationWidget inherits a SetWidgetRepresentation(vtkCameraOrientationRepresentation*) which is protected, so it is not public API. Hence, you will also need to subclass vtkCameraOrientationWidget to either add a constructor able to set your custom vtkCameraOrientationRepresentation subclass or a setter method to change it.

I hope this helps to get you started,

Paulo

Hi Alex,

As @Paulo_Carvalho mentioned, the API does not exist yet, but is trivial. It looks like a simple MR.

I’ll extend vtkCameraOrientationRepresentation with these methods…
SetXAxisLabelText(const char*)
SetYAxisLabelText(const char*)
SetZAxisLabelText(const char*)

I just opened a maintenance MR for the widget and representation. The next MR shall take care of these conveniences.

1 Like

Hi @jaswantp this would be really be nice to have.