*****************************************************************************
* PROGRAM: DRAW *
* *
* Author: Andrej Mrvar *
* Faculty of Social Sciences *
* University of Ljubljana *
* E-mail: andrej.mrvar@uni-lj.si *
* july 1994 - januar 1995 *
*****************************************************************************
Command line : DRAW GRAPH_File[.NET] POSITIONS_File[.POS]
Program draws network specified in file GRAPH_File (default extension is
.NET) on the screen, enables movings of vertices and exports PostScript
description of this network.
Coordinates of vertices can be written by hand. They can also be obtained
using the program itself by moving vertices on the screen or using
programs COORD and ENERG2. If the second parameter (POSITIONS_File) is
specified too, all feasible positions for vertices are displayed on the
screen. These positions are generated using program COORD.
If the second parameter is PS (or EPS) the PostScript (or EPS) file
will be generated without displaying the graph picture on the screen
(in this way the program can be used in batch procedures).
DEFINITION OF NETWORK ON INPUT ASCII FILE
A kind of standardized language is used for describing networks.
The following reserved words are used:
1. *Vertices n - definition of vertices follows.
n is number of vertices. Each vertex is described using
following description line:
vertex_num label x y shape [changes of default parameters]
vertex_num - vertex number (1, 2, 3...)
label - if label starts with character A..Z or 0..9 first blank
determines end of label (example: vertex1), labels consisting
of more words must be enclosed in pair of special characters
(example: "vertex 1")
x, y - coordinates of vertex (between 0 and 1)
shape - shape of object which represents vertex. Shapes are defined
in file SHAPES.CFG (or in file specified in file DRAW.INI)
(ellipse, box, diamond, cross, empty)
Meaning of parameters in this file:
SHAPE s - s is external name of vertex (used for descriptions)
sh - sh can be ellipse, box, diamond, cross, empty
This is the name of PostScript procedure for
drawing object
s_size - default size
x_fact - magnification in x direction
y_fact - magnification in y direction
phi - rotation in degrees of object in + direction (0..360)
r - parameter used for rectangle and diamond for describing
radius of angles (r=0 rectangle, r>0 roundangle)
q - parameter used for diamond - length of top (bottom)
side of hexagon (q=0 - romb)
ic - interior color of vertex
bc - boundary color of vertex
bw - boundary width of vertex
lc - label color
la - label angle in degrees (0..360)
lr - distance of beginning of vertex label from vertex center
(radius - first polar parameter)
lphi - position of label in degrees (0..360)
(angle phi - second polar parameter)
fos - font size
font - font used for writing labels (Helvetica, Courier, ...)
HOOKS - positions where edges can join the object
according to s_size
CART - x y - positions in cartesian coordinates (x,y)
POLAR - r phi - positions in polar coordinates
phi is positive angle (0..360)
CIRC - r phi1 - iteration of positions in polar
coordinates r - radius, phi=k*phi1
k=1,2,..; k*phi1 <= 360
Above default values can be changed for each vertex in definition line,
example: 1 "vertex one" 0.3456 0.1234 box ic White fos 20.
List of colors (names are case sensitive) can be found in file crayola.ps.
2. *Arcs - definition of arcs, format:
v1 v2 value [additional parameters]
v1 - first vertex
v2 - second vertex
value - value of arc v1 to v2
These three parameters must always be present. If no other parameter is
specified, the default arc will be black, straight, solid arc with
following exceptions:
- if value is negative, dotted line will be used instead of solid,
- if loop (arc to itself) is found loop will be drawn,
- if arcs in both directions are found two curved arcs will be drawn.
Arrow will be drawn at the end of the edge (at second vertex).
Additional parameters:
h1 - hook at v1 (0 - center, -1 the best (the closest), 1, 2.. user defined)
h2 - hook at v2
w - width of line
c - color of line
p - pattern of line (Solid, Dots, Dashed)
a - type (shape) of arrow (A or B)
s - size of arrow
a1 - angle at vertex 1
k1 - velocity at vertex 1
a2 - angle at vertex 2
k2 - velocity at vertex 2
ap - position of arrow
pos = 0 - arrow at second vertex
0 < pos < 1 - proportional distance from second vertex
(according to line length)
pos > 1 - absolute distance (unit is 1/100 of distance
of the connected vertices in graph that are the most
far away from each other)
l - edge label (look at description of label format at shapes)
lp - label position (look at ap)
lr - label radius (position of center text from point on edge )
lphi - label radius (angle of center text according to point on edge )
(lr and lphi are polar coordinates)
lc - label color
la - label angle (0360 - absolute angle)
fos - font size of label
font - font used for writing labels (Helvetica, Courier, ...)
Special shapes of lines can be defined using combinations of
alpha1, k1, alpha2, k2:
alpha1=alpha2=0, k1>=0, k2>=0 - straight line
alpha1=alpha2=0, k1=-1, k2>0 - oval edge with radius k2 (measure
of radius is absolute as explained above)
alpha1=alpha2=0, k1=-1, k2<0 - second possible oval edge with radius -k2
alpha1=alpha2=0, k1=-2, k2>0 - circular arc with radius k2 in positive
direction
alpha1=alpha2=0, k1=-2, k2<0 - second possible circular arc with radius -k2
in positive direction
alpha1=alpha2=0, k1=-3, k2>0 - circular arc with radius k2 in negative
direction
alpha1=alpha2=0, k1=-3, k2<0 - second possible circular arc with radius -k2
in negative direction
alpha1 or alpha2 <> 0, k1>0, k2>0 - Bezier curve
(if angle1 and angle2 have different signs - line goes from one to
another side of straight line connecting both vertices,
if angle1 and angle2 have the same sign - line stays on the same side
of straight line connecting both vertices)
3. *Edges - definition of edges.
Everything is the same, just type(a), size(s) and position(ap) of arrow
must be left off. Format of line:
Commands in program:
V - select vertex and vertex menu. Commands from vertex menu:
PgUp, PgDn, Home, End - movings of vertex in bigger steps
Up, Down, Left, Right - movings in smaller steps
R - refresh screen
X - allign x coordinate of selected vertex to x coordinate
of other vertex
Y - align y coordinate in the same way
A - align to grid - if feasible positions are specified as second
parameter when you run program, this command will move selected
vertex to the closest feasible position (represented by a dot).
Ctrl x - direct positioning coordinate x of vertex
Ctrl y - direct positioning coordinate y of vertex
S - define step for moving vertices
Esc - return to main menu
Main menu:
+ - toggle magnify
L - toggle labels/numbers
S - save graph to the same file as you start program (GRAPH_File).
Old file is renamed to oldfile.net.
P - export into file with PostScript description (.PS).
You have to insert file DRAWNET.PRO in the beginning of
postscript file.
E - export into file with Encapsulated PostScript description (.EPS).
DRAWNET.PRO is already inserted in the beggining.
(This is the only difference between PS and EPS files).