CS476/576
Assignment #2
Due Midnight, Wednesday Oct 21, 2007
Use Curses/Xlib/Motif
to implement the
following program:
NAME
dcg – draw a complete graph
SYNOPSIS
dcg
DESCRIPTION
The program presents a Motif and a
Curses interfaces for drawing and displaying a complete
grap:
§ The Motif
interface has a drawing canvas to draw the complete graph using Xlib.
§ The Curses
interface displays the labels and coordinates of the graph vertices.
In a
complete graph, every vertex is connected to every other vertex with a line.
Thus
for a graph with n
vertices there are n(n-1)/2 lines.
The Motif interface has the
following buttons*:
1.
Draw Button: An nth
click on the Canvas at pixel position (x,y) draws a new vertex and (n-1)
lines connecting the vertex to the other n-1 vertices.
The Curses interface
displays the nth vertex with label “on(x,y) ” at line x
and column y.
Assume that each 10 pixels
of the Motif Canvas is equivalent to one line or column of the Curses interface.
2. Delete Button: A Click inside a vertex circle deletes the
vertex and all of its connecting lines.
In addition, the corresponding
vertex label is deleted from the Curses interface.
3. Erace Button: Clears both the Motif canvas and the Curses
interface with confirm/cancel choice.
4. Quit Button: Exits the programs with confirm/cancel choice.
Try running the sample implementation
under:
/home/cs476/public_html/fall09/assignments/a2/wahab/dcg
_________________________________
*The interaction with the buttons
follows a "modal"
interface –one that prevents you from doing anything else until you've
completed the current task.