Orientation Handler
The Orientation Handler is a Zinc handler for controlling the orientation of surface graphics within a Zinc Scene.
The Orientation handler extends the KeyActivatedHandler class. Any Python code creating an Orientation handler instance should
specify a Qt key constant identifying which keyboard key will activate the handler.
To be able to use the Orientation 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 current rotation point and surface normal, 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 Orientation handler will allow the user to rotate the surface graphic specified by the model around a rotation point -
by clicking and dragging the mouse within the scene viewer. The rotation point is indicated by a blue sphere. Generally, this point will be
positioned in the centre of the surface by default, but will depend on the model’s get_rotation_point implementation.
Fig. 120 Orientation handler with rotation point in the centre of the surface graphic.
It is also possible for the user to re-position the rotation point by selecting and dragging it to a new position on the surface.
Fig. 121 Orientation handler with custom rotation point.
API
- class cmlibs.widgets.handlers.orientation.Orientation(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_plane,get_plane_region. Theget_planemethod should return a ZincPlane. Theget_plane_regionmethod should return the Zinc region associated with the surface graphic.plane_nodes_coordinatesshould 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 surface definition.