Chapter 5. Display

Table of Contents
The Graph Area and the general draw strategy
Display Hierarchy Diagram
Graph_Window_Display
Graph_Window_Model
Quad_Tree_Component
Object_Display
Layouts
Workbench
Masters
Example
Cursors
Dialogs
Context Menus
Tables

The Graph Area and the general draw strategy

The Graph Area visualizes the part of the graph which is visible.

Motivation

  • To have the possibility to visiualize a graph.

  • To have the possibility to manipulate directly nodes and edges.

  • To display a huge amount of nodes and edges and manage them rationally.

General structure of the Graph Area

The Graph Area lies in the Graph Window and shows the nodes and edges of the graph. Each node will be represented by a pixmap and each edge will be represented by a line with an arrow head. The name of the nodes will be shown under its pixmaps.

Each node is represented by a pixmap which consists of two overlaying-pixmaps. The lower pixmap shows the type of the node and its state and the upper pixmap consists of the attributs which should be shown. The type of an edge is shown by the color of its representation.

To avoid a huge use of memory for the pixmaps we get the needed pixmaps from the Pixmap_Table which will build the required pixmap on the fly and will cache it.

The Graph Area gets its node and edge data from the Graph_Window_Display. First OpenCAGE draws the lines of the edges and in the second step OpenCAGE draws the node pixmaps with its names on the Graph Area.

Moving selected nodes

If the user wants to move a set of selected nodes in the Graph Area from one position to another, OpenCAGE uses the double buffering technique to realize a non-flickering Graph Area. In the first step OpenCAGE creates a new pixmap of the reserved area of the selected nodes without their edges. In the second step OpenCAGE copies this pixmap over the old content of the Graph Area. The next new position of the selected nodes will be shown by erasing the the Graph Area and copying the old content and the pixmap with the selected nodes at the new position.

With this technique OpenCAGE has a minimum of work to update the Graph Area. This update process will be necessary with every new position of the moving node. Finally the user release the button of the mouse the selected nodes and their edges will be removed from the Quad-Tree and insert at their new position. Afterwards the whole Graph Area will be redrawn and the moved nodes and edges will be shown at their new position. We avoid to draw the edges during the movment so we can speed-up the drawing of the moving selection.

Selecting with a scope

The user can select objects with a scope by clicking on the background and moving the mouse. The scope will be drawn on the old content of the Graph Area and each new size of the scope requires the following steps:

  • Erasing the Graph Area

  • Copying the old content without the scope in the Graph Area

  • Drawing the new scope in the Graph Area

For each new position OpenCAGE looks for the delta of the new part of the covered area in the Quad-Tree if there are any nodes. If there are any they will be set as selected respectively unselected and the nodes will notify their observers. Therewith the nodes will get a new pixmap and they will be drawn on the Graph Area. OpenCAGE does not erase the updated nodes before redrawing them on the Graph Area to improve performance. Therefore the pixmap for the different states should cover themself exactly to guaranty a correct display.

Sensitive border

The user can move with a selection or with the scope over the border of the Graph Area an the content of the Graph Area will scroll in this direction. So the user has nearly as much place as he wants.

To achieve this functionality there is a sensitive area at the inside of the borders of the Graph Area. If the user drags the scope or a selection in this region the scrollbars will be updated and so the content of the Graph Area scrolls.

Scrolling

If the content of the Graph Area requires a greater area than it can be shown in the Graph Area the scrollbars will be adapted. So the user can scroll the content of the Graph Area.

To achieve a runny scrolling OpenCAGE copies the old part of the content which is shown after the scrolling to its new position and only redraws the part which is new in comparison to the old content.

Drawing only the visible part of the content of a Graph Area

To update the display as fast as possible OpenCAGE only redraws the current visible part of the content.

This is achieved by a preselection done by the Quad-Tree. You can hand over the necessary area and the Quad-Tree marks all visible objects. In the second step OpenCAGE uses the Cohen-Sutherland clipping algorithm to draw only the visible part.

With the preselection by the Quad-Tree OpenCAGE is more independent of the amount of nodes. It is very valuable if the content consists of a huge amount of nodes and only a few of them are visible.

This technique is also used to update the new parts while scrolling.