The BoxController allows the attachment of
one or more box controls to a canvas. Each box can be selected and moved by
the mouse. Each box may have either or both a vertical and horizontal line
attached to them. Thus the box controls can be used to define one or more
regions on the associated canvas. After specifiying the worldFrame, we can
determine the coordinates (and hence the associated regions) of the box
controls by invoking getXfor and getYfor upon the indices of the boxes of
interest.
addBox,
addConstraint,
autoBoxPlacement,
getXfor,
getYfor,
new,
placeBoxWorldX,
placeBoxWorldY,
refresh,
screenX2World,
screenY2World,
worldX2Screen,
worldY2Screen,
| [RW] |
:onMove |
onMove is a proc which if set will be executed everytime a box is moved.
|
| [RW] |
:onRefresh |
onRefresh is a proc which if set will be executed for each box whenever
refresh is called
|
| [RW] |
:worldFrame |
worldFrame is an array of length 4 consisting of x0 , y0, x1, y1
representing the world region to be displayed. For example, if the
horizontal axis is to represent the first formant, and the verical the
second formant we might be interested in values where the first formant is
between 200 and 900, and the second is between 800 and 2500. In this case,
our world frame would be
[200, 900, 800, 2500]
|
Constructs a BoxController. Takes one
argument, canvas, which is the TkCanvas on which the boxes are to reside. Binding
of mouse clicks is done here.
Adds a new box to the controller. Arguments are
- x
- The x screen coordinate of the new box
- y
- The y screen coordinate of the new box
- color
- The color of the new box
- vert
- A boolean, true if a vertical line is to be attached to the box, false
othewise
- horz
- A boolean, true if a horizontal line is to be attached to the box, false
othewise
A way of automatically creating a reasonable set of x,y coordinates for the
boxes on the canvas
Takes a block and adds it as a constraint on the placement of the boxes.
For example
{ y[0]<x[0] ; x[0]>50 ; x[0]<100; x[1]>x[0] }
Constrains the y coord of the first box to be less that the x coord of the
first box. Furthermore, the first box is confined to be between x=0 and
x=100. Finally the second box must be to the right of the first box
Draws all the boxes and associated lines on the canvas associated with this
control
Places the given box (identified by it's number boxId) on the screen at the
position corresponding to the horizontal world coordinate wx.
Places the given box (identified by it's number boxId) on the screen at the
position corresponding to the verticalworld coordinate wy.
Given the horizontal viewport coordinate (horizontal screen coordinate
relative to the associated canvas) returns the horizontal world frame
coordinate. For this to make any sense you must minimally have specifiedthe
horizontal portion of the world frame. This is accomplished by
| worldFrame = [x0,y0,x1,y1] |
Where x
0, x
1 represents the
horizontal range of the world frame
Given the vertical viewport coordinate ( vertical screen coordinate
relative to the associated canvas) returns the vertical world frame
coordinate. For this to make any sense you must have specified at the
minimum the vertical portion of the world frame. This is accomplished by
| worldFrame = [x0,y0,x1,y1] |
Where y
0, y
1 represents the
vertical range of the world frame
Given a horizontal world frame coordinate returns the horizontal viewport
coordinate (horizontal screen coordinate relative to the associated
canvas). For this to make any sense you minimally must have specified the
horizontal portion of the world frame. This is accomplished by
| worldFrame = [x0,y0,x1,y1] |
Where x
0, x
1 represents the
horizontal range of the world frame.
Given a vertical world frame coordinate returns the vertical viewport
coordinate (vertical screen coordinate relative to the associated canvas).
For this to make any sense you must minimally have specified vertical
portion of the world frame. This is accomplished by
| worldFrame = [x0,y0,x1,y1] |
Where y
0, y
1 represents the horizontal range of
the view port
Given the index a specified box, returns the x-value of that box(the
x-coordinate relative to the world frame) If presented more that one box
index, will return an array of corresponding x-values
Of course one needs to set the horizontal worldFrame prior to usage.
Given the index a specified box, returns the y-value of that box(the
y-coordinate relative to the world frame) If presented more that one box
index, will return an array of corresponding x-values
Of course one needs to set the vertical worldFrame prior to usage.