next up previous contents index
Next: Selection Mechanism Up: Implementation of the Previous: Confirmer

Graphic

 

The graphic module consists of three levels: The first level is responsible for drawing the network as a whole. The middle level draws or delets single network elements. This level uses graphic primitives of the lowest level, which make up the X graphic interface, as well as basic Xlib output functions for graphics and text.

  The file ui_netUpdate.c contains the functions for drawing the whole net (prefix ui_net_). All routines in this module determine in which of the open displays to draw. Iconified or frozen displays are ignored. Depending upon parameters, the function ui_net_updateWholeNet() draws either all links or all units. For a complete update of the net use the function ui_net_completeRefresh(). This function first clears the window, then draws the links and finally the units.

The file ui_netGraph.c contains the functions for drawing network elements ( ui_drawUnit(), ui_drawLink()). Two switches are important, one to determine whether to draw or delete the element ( UI_ERASE or UI_DRAW), and one to determine whether to do the output globally ( UI_GLOBAL) or only in the current window ( UI_LOCAL). Units are drawn if the subnet number is the same as in the window, at least one layer of the unit is activated in the window, and the display is neither frozen nor iconified. Links are drawn if the corresponding units are visible, have the same subnet number, and have a weight that exceeds the threshold set by the trigger sliders in the setup panel.

  Functions to compute grid coordinates from pixel coordinates and vice versa are located in the file ui_utilProcs.c. Normalizing   functions are also located here. Normalization of edges of a rectangle here means exchanging the coordinates, if necessary, to place the first edge to the left and above the second ( ui_normalize_rect()). A normalization with ui_normalize_coord() only puts the first coordinate left of the second.

All functions which call X graphic routines are kept in the file ui_xGraphic.c. Among them is a function for drawing an arrow ( ui_xDrawArrow()), a function for drawing a box ( ui_xDrawBox()),as well as a function to delete a black or white rectangle ( ui_xDeleteRect()). To generate an arrow head, a triangle is rotated appropriately (see also the algorithm in [Har83]).



next up previous contents index
Next: Selection Mechanism Up: Implementation of the Previous: Confirmer



Niels Mache
Wed May 17 11:23:58 MET DST 1995