GGOutline.mesa
Contents: Procedures to implement the Outline Slice Class in Gargoyle. Outlines consist of a list of Slices, many of which are often of class Traj.
Copyright Ó 1986, 1987, 1992 by Xerox Corporation. All rights reserved.
Pier, July 15, 1988 1:31:39 pm PDT
Bier, January 28, 1993 3:11 pm PST
DIRECTORY
GGBasicTypes, GGBoundBox, GGModelTypes, GGSegmentTypes, GGTrajTypes, Imager, ImagerTransformation, TextNode;
GGOutline: CEDAR DEFINITIONS = BEGIN
BoundBox: TYPE = GGBoundBox.BoundBox;
HistoryEvent: TYPE = GGModelTypes.HistoryEvent;
Joint: TYPE = GGSegmentTypes.Joint;
Point: TYPE = GGBasicTypes.Point;
RunProc: TYPE = GGTrajTypes.RunProc;
Scene: TYPE = GGModelTypes.Scene;
Segment: TYPE = GGSegmentTypes.Segment;
SelectionClass: TYPE = GGSegmentTypes.SelectionClass;
Sequence: TYPE = GGModelTypes.Sequence;
Slice: TYPE = GGModelTypes.Slice;
SliceClass: TYPE = GGModelTypes.SliceClass;
SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor;
SliceDescriptorGenerator: TYPE = GGModelTypes.SliceDescriptorGenerator;
SliceGenerator: TYPE = GGModelTypes.SliceGenerator;
SliceParts: TYPE = GGModelTypes.SliceParts;
SliceWalkProc: TYPE = GGModelTypes.SliceWalkProc;
Traj: TYPE = GGModelTypes.Traj;
TrajEnd: TYPE = GGModelTypes.TrajEnd;
TrajPartType: TYPE = GGModelTypes.TrajPartType;
fillColor: Imager.Color; -- calculated in GGOutlineImplA
OutlineData: TYPE = REF OutlineDataObj;
OutlineDataObj: TYPE = RECORD [
oddWrap: BOOL ¬ TRUE,
fillColor: Imager.Color,
fillText: TextNode.Ref,
screenStyle: BOOL ¬ TRUE, -- refers to format of fillText
children, ptr: LIST OF Slice,
prioritiesValid: BOOL ¬ FALSE,
ptrValid: BOOL ¬ FALSE,
subclassData: REF ANY
];
OutlineParts: TYPE = REF OutlinePartsObj;
OutlinePartsObj: TYPE = RECORD [
descriptors: LIST OF SliceDescriptor
];
OutlineHitData: TYPE = REF OutlineHitDataObj;
OutlineHitDataObj: TYPE = RECORD [
child: Slice,
childHitData: REF ANY
];
The Outline Slice Class
CreateOutline: PROC [child: Slice, fillColor: Imager.Color] RETURNS [outline: Slice];
CreateOutline creates a simple outline with a single child.
AddChild: PROC [outline: Slice, child: Slice] RETURNS [holier: Slice];
ReplaceFirstChild: PROC [outline: Slice, newChild: Slice] RETURNS [newOutline: Slice];
ReplaceChild: PROC [outline: Slice, oldChild, newChild: Slice] RETURNS [newOutline: Slice];
ReplaceRunsInOutline: PROC [outlineD: SliceDescriptor, runProc: RunProc, segmentsOnly: BOOL ¬ TRUE, selectNewRuns: BOOL ¬ FALSE] RETURNS [newOutline: Slice ¬ NIL];
SetWrapRule: PROC [outline: Slice, oddWrap: BOOL];
GetWrapRule: PROC [outline: Slice] RETURNS [oddWrap: BOOL];
SetFillText: PROC [slice: Slice, node: TextNode.Ref, screenStyle: BOOL ¬ FALSE, history: HistoryEvent];
sets fill and flows data into children. Restricted to outline with all children of type $Box.
DeleteControlPoints: PROC [outlineD: SliceDescriptor, scene: Scene] RETURNS [bBox: BoundBox];
Deletes selected control points and returns bounding box of area requiring refresh.
SaveSelectionsInOutlineAllClasses: PROC [outline: Slice];
UnpackHitData: PROC [hitData: REF ANY] RETURNS [child: Slice, hitType: TrajPartType, segNum, cpNum, jointNum: INT, hitPoint: Point];
hitType, segNum, cpNum, jointNum, hitPoint only valid if GetType[child]=$Traj
UnpackOneSegmentDescriptor: PROC [outlineD: SliceDescriptor] RETURNS [childDescriptor: SliceDescriptor, segNum: NAT];
segNum only valid if GetType[childDescriptor.slice]=$Traj
UnpackSimpleDescriptor: PROC [outlineD: SliceDescriptor] RETURNS [success: BOOL, hitType: TrajPartType, childDescriptor: SliceDescriptor, joint: Joint ¬ NIL, jointNum: NAT ¬ 999, cp: Point, cpNum: NAT ¬ 999, seg: Segment ¬ NIL, segNum: NAT ¬ 999];
partType, joint, jointNum, cp, cpNum, seg, segNum only valid if GetType[childDescriptor.slice]=$Traj
Queries about Outlines
<<FindChildInDescriptor: PUBLIC PROC [outlineD: SliceDescriptor, child: Slice] RETURNS [childD: SliceDescriptor]; -- used by MatchTool>>
FindTrajShapeInOutline: PROC [traj: Slice, outline: Slice] RETURNS [oldTrajs: LIST OF Slice];
Looks through the children of outline to see if any of the shapes match, control point for control point and coordinate for the coordinate, the traj entry. If so, return all such trajectories that match.
TrajsInOutline: PROC [outline: Slice] RETURNS [trajGen: SliceGenerator];
Returns a generator of those children of "outline" that are of class $Traj.
TrajectoriesOfOutline: PROC [outline: Slice] RETURNS [trajs: LIST OF Traj ¬ NIL];
Like TrajsInOutline but returns a list (used by MatchTool).
ListHoles: PROC [outline: Slice] RETURNS [holesList: LIST OF Slice];
HasHoles: PROC [outline: Slice] RETURNS [BOOL];
END.