Files: gui/visualisation.h, gui/visualisation.c
The Visualisation is an interface between the VRR kernel and VCL. There is one instance of Visualisation in each view and is responsible for displaying GOs and control objects. It consists of a VCL canvas, several VCL nodes (mainly a lazy expanding area) and some additional data. A LE-area is used for displaying all GOs. Callbacks from the LE-area are translated to questions for kernel and hooks received from kernel are translated to notifications for the LE-area. Zoom and scrolling are implemented using an affinity node before the LE-area.
There are three coordinate systems in the Visualisation. Pixel
coordinates of GDK window are clear. The view coordinates (vcoords
)
are centered in the center of the View, with the x-axis parallel to window borders, y-axis
flipped (in comparision to pixels) and distance one is exactly one
millimeter (this is the coordinate space of the root VCL node). The image
coordinates (coords
) are coordinates in which GOs which are displayed
– so they are vcoords
after application of the chosen zoom and
rotation. There are several functions for conversion between
coordinate spaces (for example visualisation_coords_to_vcoords()
).
There are three three groups of functions for manipulation with the
Visualisation. The first group is for manipulating with several control
objects, the second group is for manipulation with the transformation between
coords
and vcoords
and the third group contains the aforesaid
functions for conversion between coordinate spaces.
Control objecs are usually some crosses or rectangles which are used to implement several gui tools, like the transformation tool. There are the following functions for manipulation with the control objects of the transform tool:
visualisation_set_gadget_visible()
for enabling/disabling,
visualisation_set_center_gadget()
,
visualisation_set_xaxis_gadget()
, and
visualisation_set_yaxis_gadget()
for setting their position –
the position of the rest is defined by the bounding box of selection),
visualisation_set_tf_move()
,
visualisation_set_tf_resize()
,
visualisation_set_tf_rotate()
,
visualisation_set_tf_skew()
,
visualisation_unset_tf_move()
,
visualisation_unset_tf_second()
, and
visualisation_unset_tf_skew()
) for the Santiago's transform tool,
visualisation_set_grid()
and
visualisation_unset_grid()
for grid – the t
argument
is used to specify the grid arrangement
visualisation_gui_rectangle_update()
and
visualisation_gui_rectangle_destroy()
) for the rectangular selection
rectangle
visualisation_set_snap()
and
visualisation_unset_snap()
– unused functions for the Fifi
visualisation_gui_fifi_update()
and
visualisation_gui_fifi_destroy()
– used Fifi functions.
The implementation of anchor/hanger control objects is important and less trivial.
It is done using another LE-area, which does not have any
affinity node associated, so anchor and hanger coordinates have to be
recomputed to vcoords
. After any transformation change
(scrolling) this LE-area must be flushed. The associated functions are
visualisation_set_show_anchors_mode()
and
visualisation_set_show_hangers_mode()
, their
mode
argument can be set to VIS_SHOW_NONE
, VIS_SHOW_ALL
,
VIS_SHOW_SELECTED
or VIS_SHOW_SPECIFIC
based on the request
for no A/H, all A/H, A/H of selected GOs or A/H of a specific go (the next
argument).
Functions for manipulation with the transformation can be divided to absolute:
visualisation_set_orientation()
visualisation_move()
visualisation_scale()
visualisation_rotate()
visualisation_transform()
visualisation_absolut_move()
visualisation_center()