GGOutline.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last edited by Bier on April 6, 1987 8:07:57 pm PDT
Contents: Procedures to implement the Outline Slice Class in Gargoyle. Outlines consist of Trajectories which in turn consist of Segments. Outline is the most important slice class.
Pier, April 24, 1987 3:03:39 pm PDT
DIRECTORY
GGBasicTypes, GGInterfaceTypes, GGModelTypes, GGSegmentTypes, Imager, ImagerTransformation;
GGOutline: CEDAR DEFINITIONS = BEGIN
GGData: TYPE = GGInterfaceTypes.GGData;
Joint: TYPE = GGSegmentTypes.Joint;
Outline: TYPE = GGModelTypes.Outline;
OutlineClass: TYPE = GGModelTypes.OutlineClass;
OutlineDescriptor: TYPE = GGModelTypes.OutlineDescriptor;
TrajPartType: TYPE = GGModelTypes.TrajPartType;
Point: TYPE = GGBasicTypes.Point;
Scene: TYPE = GGModelTypes.Scene;
Segment: TYPE = GGSegmentTypes.Segment;
SelectionClass: TYPE = GGInterfaceTypes.SelectionClass;
Sequence: TYPE = GGModelTypes.Sequence;
SliceParts: TYPE = GGModelTypes.SliceParts;
SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor;
Traj: TYPE = GGModelTypes.Traj;
TrajEnd: TYPE = GGModelTypes.TrajEnd;
TrajGenerator: TYPE = GGModelTypes.TrajGenerator;
fillColor: Imager.Color;
The Outline Slice Class
OutlineParts: TYPE = REF OutlinePartsObj;
OutlinePartsObj: TYPE = RECORD [
seqs: LIST OF Sequence
];
HitType: TYPE = GGModelTypes.TrajPartType;
OutlineHitData: TYPE = REF OutlineHitDataObj;
OutlineHitDataObj: TYPE = RECORD [
traj: Traj,
hitType: HitType,
segNum: INT,
cpNum: INT,
jointNum: INT,
hitPoint: Point
];
FetchSliceClass: PROC [name: ATOM] RETURNS [class: OutlineClass];
CreateOutline: PROC [traj: Traj, fillColor: Imager.Color] RETURNS [outline: Outline];
CreateOutline creates a simple outline with a single trajectory. The lineEnds of an open outline, or the fill color of closed outline are stored in the outline record.
AddHole: PROC [outline: Outline, hole: Traj] RETURNS [holier: Outline];
ReplaceFence: PROC [outline: Outline, newFence: Traj] RETURNS [newOutline: Outline];
ReplaceHole: PROC [outline: Outline, oldHole, newHole: Traj] RETURNS [newOutline: Outline];
PartsFromSequence: PROC [outline: Outline, seq: Sequence] RETURNS [sliceParts: SliceParts];
DescriptorFromSequence: PROC [outline: Outline, seq: Sequence] RETURNS [sliceD: OutlineDescriptor];
DescriptorFromParts: PROC [outline: Outline, sliceParts: SliceParts] RETURNS [sliceD: OutlineDescriptor];
CopyParts: PROC [outline: Outline, parts: SliceParts] RETURNS [copy: SliceParts];
FindTrajInDescriptor: PROC [outlineD: OutlineDescriptor, traj: Traj] RETURNS [seq: Sequence];
Needed by GGSelectImpl.FindSelectedSequence.
SaveSelectionsInOutline: PROC [outline: Outline, scene: Scene];
RemakeSelectionsFromOutline: PROC [outline: Outline, scene: Scene];
SequencesOfOutline: PROC [outlineD: OutlineDescriptor] RETURNS [seqList: LIST OF Sequence];
RemoveTraj: PROC [outlineD: OutlineDescriptor, traj: Traj] RETURNS [newD: OutlineDescriptor];
UnpackOnePointDescriptorOld: PROC [outlineD: OutlineDescriptor] RETURNS [traj: Traj, isACP: BOOL, segNum, cpNum, jointNum: NAT];
UnpackOnePointDescriptor: PROC [sliceD: SliceDescriptor] RETURNS [traj: Traj, isACP: BOOL, segNum, cpNum, jointNum: NAT];
UnpackOneSegmentDescriptorOld: PROC [outlineD: OutlineDescriptor] RETURNS [traj: Traj, segNum: NAT];
UnpackOneSegmentDescriptor: PROC [sliceD: SliceDescriptor] RETURNS [traj: Traj, segNum: NAT];
UnpackSimpleDescriptorOld: PROC [outlineD: OutlineDescriptor] RETURNS [success: BOOL, partType: TrajPartType, traj: Traj, joint: Joint ← NIL, jointNum: NAT ← 999, cp: Point, cpNum: NAT ← 999, seg: Segment ← NIL, segNum: NAT ← 999];
UnpackSimpleDescriptor: PROC [sliceD: SliceDescriptor] RETURNS [success: BOOL, partType: TrajPartType, traj: Traj, joint: Joint ← NIL, jointNum: NAT ← 999, cp: Point, cpNum: NAT ← 999, seg: Segment ← NIL, segNum: NAT ← 999];
NearestJointToHitData: PROC [hitData: REF ANY] RETURNS [jointNum: NAT, traj: Traj];
UnpackHitData: PROC [hitData: REF ANY] RETURNS [traj: Traj, hitType: GGModelTypes.TrajPartType, segNum, cpNum, jointNum: INT, hitPoint: Point];
This will go away when the Caret machinery is revised.
UpdateDescriptorBoundBoxes: PROC [outlineD: OutlineDescriptor];
Update the bound boxes of all contained sequences.
For use by GGTrajImpl only
UpdateBoundBox: PROC [slice: Outline];
Used by GGSelect to do a DeselectTraj.
Queries about Trajectories
OutlineOfTraj: PROC [traj: Traj] RETURNS [outline: Outline];
Up one level (traj -> outline). Finds the unique outline to which traj belongs.
Queries about Outlines.
UniformFills: PROC [scene: Scene, selectClass: SelectionClass] RETURNS [color: Imager.Color];
Returns a "typical" color if all the selected outlines in the scene have equivalent fill color. Returns NIL if their are non-uniform fill colors selected.
HasHoles: PROC [outline: Outline] RETURNS [BOOL];
FenceOfOutline: PROC [outline: Outline] RETURNS [fence: Traj];
HolesOfOutline: PROC [outline: Outline] RETURNS [trajGen: TrajGenerator];
TrajsInOutline: PROC [outline: Outline] RETURNS [trajGen: TrajGenerator];
Generates all of the holes of outline.
Private procs shared by the Implementations
AppendTrajList: PROC [list1, list2: LIST OF Traj] RETURNS [result: LIST OF Traj];
SetSegmentField: PROC [seg: Segment, selected: BOOL, selectClass: SelectionClass];
SetControlPointField: PROC [seg: Segment, cpNum: NAT, selected: BOOL, selectClass: SelectionClass];
SetJointField: PROC [joint: Joint, selected: BOOL, selectClass: SelectionClass];
GetSegmentField: PROC [seg: Segment, selectClass: SelectionClass] RETURNS [selected: BOOL];
GetControlPointField: PROC [seg: Segment, cpNum: NAT, selectClass: SelectionClass] RETURNS [selected: BOOL];
GetJointField: PROC [joint: Joint, selectClass: SelectionClass] RETURNS [selected: BOOL];
END.