Note: The coordinate system begins at the upper left corner
with (0,0).
Primitive Objects
circle -
name - string uniquely identifying this object
x - x coordinate (int)
y - y coordinate (int)
diameter - (int)
color - color of circle drawn
bkgrd - color indicating background
Example: circle c1 20 20 30 black transparent
This creates a circle with the upper left corner at coordinate
20, 20, with a diameter of 20 and with the circle black and the
interior transparent.
line -
name - string uniquely identifying this object
x1 - starting x coordinate (int)
y1 - starting y coordinate (int)
x2 - ending x coordinate (int)
y2 - ending y coordinate (int)
color - color of line drawn
Example: line l1 20 20 40 40 black
This will create a black line extending from 20,20 to 40,40
text -
name - quoted string uniquely identifying this object
x - x coordinate (int)
y - y coordinate (int)
text - string of text, in quotes
color - color of text
Example: text t1 40 40 "HELLO" red
This will write the string "HELLO" at 40,40 in red.
rectangle -
name - string uniquely identifying this object
x1 - top-left x coordinate (int)
y1 - top-left y coordinate (int)
width - width of the rectangle (int)
height - height of the rectangle (int)
color - color of rectangle drawn
bkgrd - background color
Example: rectangle r1 10 20 100 120 black red
This will create a rectangle with its upper left corner at 10,20
and lower right corner at 100,120. It will be outlined in black
and red in the interior.
polygon -
name - string uniquely identifying this object
length - number of points in coordinate list
x1, y1 ... xn, yn - list of coordinates connected by lines
to form the polygon
color - color of polygon drawn
bkgrd - color of polygon background
Example: polygon p1 3 15,10 30,5 40,20 yellow blue
This will create a triangle with vertices at (15,10), (30,5),
and (40,20). The edge will be yellow with blue on the interior.
tree -
name - string uniquely identifying this object
x - x coordinate of root node(int)
y - y coordinate of root node(int)
width - (int)
(startNode, endNode) ... (startNode, endNode)
- list of connections between nodes. The startNode
must have already been mentioned as an endNode or
must be the root node.
Example: tree t1 20 20 300 (1,2) (1,3) (2,4)
This will create a tree with width 300 at 20,20 with the
connections described
addNode -
name - name of tree
(startNode, endNode) - connection to add to tree
Example: addNode t1 (3,5)
This will add the connection (3,5) to tree t1.
Example:
After the above tree is created, a marker can be moved from
node 1 to node 2 with the command:
moveMarker m1 1 2 1-2 black red
node -
name - string uniquely identifying this object
x - x coordinate (int)
y - y coordinate (int)
diameter - int
color - color of circle drawn
color - color indicating background
Example: node n1 40 30 20 black transparent
This will create a node at 40,30 with diameter 20 using a black
outline and a transparent interior.
connectNodes -
name - string uniquely identifying this object
node1 - string name of the node arc is coming from
node2 - string name of the node arc is going to
color - color of arc
animateDraw - ``true'' or ``false'' indicating whether to
animate the arc draw
Example: connectNodes a1 2 3 black true
This command will animate the connection of node 2 to node 3.
marker -
name - string uniquely identifying this object
nodeName - node where marker starts
diameter - radius of marker (int)
color - color of marker edge
color - color of background
Example: marker m1 2 10 black red
This will create a black marker with red interior located at
node 2.
moveMarker -
name - string uniquely identifying this object
node1 - string identifying the node to leave
node2 - string identifying the node to go to
connectionName - string identifying the edge to follow
color - color of marker edge
bkgrd - color of background
Example: moveMarker m1 2 3 a1 black blue
This will animate the movement of the marker from node 2 to node
3 along connection "a1".
graph -
name - name of graph to create
x - x coordinate of upper left corner of graph
y - y coordinate of upper left corner of graph
type - string indicating drawing style, can be "CIRCLE" or "NORMAL"
width - width of graph
(startNode, endNode) ... (startNode, endNode) -
list of connections that make up the graph
Example: graph g1 1 1 NORMAL 300 (1,2) (1, 6) (6, 2) (6,3) (2,3) (5, 1)
Creates a normal graph at 1,1 with width 300 using the listed
connections to build the connections. As with trees, the
connections created are named with the form: "startNode"-"endNode".
Note that NORMAL graphs must be connected, while CIRCLE graphs
can have unconnected nodes.
addNode -
name - name of graph
node - name of node to add
Example: addNode g1 10
Adds node 10 to graph g1. Note that this command can only be
used with graphs of type CIRCLE.
addEdge -
name - name of graph
(startNode, endNode) - connection between two nodes
Example: addNode g1 (10,11)
Adds a connection between nodes 10 and 11. Note that if used
with a CIRCLE graph neither node must already be in the graph, but when
used with NORMAL graph one of the nodes must already be in the graph.
array -
name - name of array
x - x coordinate
y - y coordinate
length - number of cells in array
value1 ... valueN - list of cell values
orientation - can be "horz" or "vert"
color - color of array outline
bkgrd - color of background
Example: array 20 30 3 4d " " hello horz black red
Creates a horizontal array at 20,30 with 3 cells. This first
cell contains "4d", the second is blank, and the third contains
"hello".
All cells in arrays can be accessed individually as rectangles. After
creating an array called ``a1'' we could access the fourth cell by referring
to an object called ``a1[3]''. For example if we wanted to change the color
of this cell to blue we would use the command:
changeParam a1[3] bkgrd blue
To change the value of an array cell:
changeParam b[6] text "cow"
stack -
name - name of stack
x - x coordinate
y - y coordinate
length - length of stack contents
value1 ... valueN - list of stack values, beginning with top item
color - color of stack
Example: stack s1 30 40 3 1 fred 56 black
Creates a stack with the elements 1, "fred", and 56.
push -
name - name of stack to push on
value - value to push on stack
Example: push s1 34
Pushes the value "34" on stack s1.
pop -
name - name of stack to pop from
Example: pop s1
Pops the top item off stack s1.
queue -
name - name of queue
x - x coordinate
y - y coordinate
length - current length of queue contents
value1 ... valueN - list of queue values,
beginning with first item
color - color of queue
bkgrd - color of items in queue
Example: queue q1 30 40 3 1 fred 56 black red
Creates a queue with the elements 1, "fred", and 56.
enqueue -
name - name of queue to push on
value - value to put on the queue
Example: enqeue q1 34
Puts the value "34" on the end of queue q1.
dequeue -
name - name of queue to dequeue
Example: deqeue q1
Removes the first value of queue q1.
delay -
length - int indicating length of pause in milliseconds
Example: delay 100
This will delay the animation for 1/10 a second
changeParam -
name - string indicating which object will be altered
ParamName - name of parameter to change
NewValue - new value of parameter
Example: changeParam c1 color red
This will change the color of c1's outline to red.
Example: changeParam c1 bkgrd blue
This will change the color of c1's interior to blue.
Example: changeParam t1 text "HELLO"
The text object t1 will now display "HELLO".
moveRelative -
name - object to move
x - amount to add to x position
y - amount to add to y position
animateDraw - ``true'' or ``false'' indicating whether to
animate the move
Example: moveRelative r1 30 -40 true
This will animate the movement of r1 to a point above and to the
left of its current position.
groupObjects-
name - name of aggregate of several objects
length - number of objects in group (int)
name1 ... nameN - list of objects to group together
Example: groupObjects group1 c1 r1 b2
This will create a new object that contains the objects c1, r1,
and b2 which can then be treated as one object. For example,
they could be moved together.
delete -
name - name of object to delete
Example: delete g1
This will remove g1 from the animation.