Next: , Previous: The Command Structure, Up: GUI



7.4 The Visualisation

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:

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:

relative: and special: