TreeGrapher.mesa
Copyright Ó 1990, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, July 13, 1990 4:37 pm PDT
DIRECTORY
ImagerBox USING [Box],
Vector2 USING [VEC];
TreeGrapher: CEDAR DEFINITIONS
~ BEGIN OPEN ImagerBox, Vector2;
Node: TYPE = REF NodeRep;
NodeRep: TYPE = RECORD [
data: REF,
class: REF ClassRep,
children: LIST OF Node,
layout: REF LayoutRep ¬ NIL
];
Direction: TYPE = { N, E, S, W }; -- compass directions
ClassRep: TYPE = RECORD [
classData: REF,
bounds: PROC [self: Node] RETURNS [Box],
attachmentPoint: PROC [self: Node, direction: Direction] RETURNS [VEC]
];
LayoutRep: TYPE = RECORD [
origin: VEC,
bounds: Box, -- cached value returned by self.class.bounds[self]
treeBox: Box -- Absolute, once processing is complete
];
LayoutParameters: TYPE = REF LayoutParametersRep;
LayoutParametersRep: TYPE = RECORD [
descendantPad: REAL ¬ 10.0,
descendantDirection: Direction ¬ $E,
siblingPad: REAL ¬ 6.0,
siblingDirection: Direction ¬ $N,
ext: REF
];
DoLayout: PROC [root: Node, lp: LayoutParameters];
Resolve: PROC [root: Node, p: VEC] RETURNS [Node];
DefaultAttachmentPoint: PROC [self: Node, direction: Direction] RETURNS [VEC];
END.