Shapes and aspects

The Slate gives every item a set of aspects -- that is, named points on the item. The aspects of an item depends on its shape, and you can query the Slate for the shape of an item:

  set slate [::tycho::Slate::demoslate]
  set f [$slate create Frame 120 120 150 140 -borderwidth 4 -color green]
  set l [$slate create line 30 30 30 50 50 50 50 70 -arrow last]
  set s [$slate create Solid 100 20 120 20 120 10 140 30 120 50 120 40 100 40]
  $slate shape $s
The "shape" of an item is one of the following: point, line, rectangle, oval, line, or polygon. For each shape, there is a default set of aspects; for example, the "rectangle" shape has the aspects c or center, and the eight compass points: n, s, e, w, ne, nw, se, and sw. An item with "line" shape has aspects start, end, and one aspect of the form vertex-n of each vertex.

To query an item for an aspect, just use the aspect method:

$slate aspect $f nw
More than one aspect can be given:
$slate aspect $l vertex-0 vertex-1

If no aspects are given, this method return a list of all aspects of the item:

$slate aspect $l
An item can be moved so that one of its aspects is at a specified coordinate:
$slate moveto $l 2 2 start
(For lines, the aspect vertex-0 is the same as the aspect start.)

An item can be reshaped by specifying an aspect and the distance to move it (click multiple times):

$slate reshape $f 10 10 se

More than one aspect can be moved if it makes sense to do so (click multiple times):

$slate reshape $l 10 0 vertex-2 vertex-3

An item can also be reshaped by specifying an absolute location for one of its aspects:

$slate reshapeto $l 100 100 end

Next
Back up
Tycho Home Page


Copyright © 1996-1998, The Regents of the University of California. All rights reserved.
Last updated: 05/19/98, comments to: johnr@eecs.berkeley.edu