Fixed Axis Translation Handler

The Fixed Axis Translation Handler is a Zinc handler for controlling the position of surface graphics within a Zinc Scene.

The FixedAxisTranslation handler extends the KeyActivatedHandler class. Any Python code creating a FixedAxisTranslation handler instance should specify a Qt key constant identifying which keyboard key will activate the handler.

To be able to use the Fixed Axis Translation handler with a Zinc Scene, the code must also set a model for the handler using its set_model method. The handler’s model keeps track of the surface normal and surface vertices, and should provide methods for the handler to get and set these attributes. For more information on what the handler requires of a model please read the API section below.

While active, the Fixed Axis Translation handler will allow the user to reposition the surface graphics within the scene viewer. A set of translation arrows will be displayed in the centre of the surface graphic, with two arrows for each Cartesian axis. These arrows can be clicked and dragged to translate the surface graphic in the direction they specify.

Fixed Axis Translation handler.

Fig. 93 Fixed Axis Translation handler with translation arrows at surface centre.

Note

Currently only square surface graphics are supported, due to limitations with the translation vector calculations.

API

class cmlibs.widgets.handlers.fixedaxistranslation.FixedAxisTranslation(key_code)
set_model(model)

Set the model required by the handler. The model is in charge of tracking the rotation-point and surface-normal attributes and must provide the following methods required by the handler: get_projection_plane_region, set_rotation_point, get_plane_normal, plane_nodes_coordinates. The get_projection_plane_region method should return the Zinc region associated with the surface graphic. The rotation point is a 3D list of coordinates. The plane normal is a direction vector in 3D list format. plane_nodes_coordinates should return a list of lists, specifying the coordinates of the four corners of the plane segment (currently only square plane segments are supported).

Parameters:

model – Model providing Zinc plane definition.