Applications
Applications using the API
When there is a need to create or edit a graph, users should use
an external
graph editor application
to do this interactively based on the visualization of a graph.
The graph editor is an external
program that communicates with uDraw(Graph); using the
API
(application programming interface). The editor or any other
uDraw(Graph) application is responsible for controlling and
manipulating the structure of a graph.
Applications can be connected to the API with the
File menu
or with
command line options.
At start time the editor adds some menus and icon buttons to
uDraw(Graph)'s user interface to enable inserting or deleting nodes
and edges or changing their attributes.
Application menus
can be attached to the
Edit menu,
but there is no built-in function behind these menus in uDraw(Graph).
Instead, the API sends menu events to the graph editor application
to inform about user interactions.
For example, when the user selects a node (1. event) and chooses
the previously attached menu 'Edit/Delete Node' (2. event), then
the editor knows by these two events that the user would like to
remove the specified node.
The editor has an own graph data structure which has to be modified
in order to reflect the events.
After modification, the editor sends the actual graph back to
uDraw(Graph) to update the visualization.
This principle can be used by any application program that is
connected to uDraw(Graph)'s API.
Note that the application is exclusively responsible for controlling
the graph structure.
uDraw(Graph) is unable to modify the graph on its own.
This is important when uDraw(Graph) is the graph user interface on
top of an arbitrary application program.
On the other side, by separating the representation layer
(uDraw(Graph)) from the control layer (application connected to the API),
the application programmer is relieved from dealing with graph layout
algorithms and computer graphics.
Next:
Graph Layout.
|