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, May 8, 1987 4:39:02 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;
Point: TYPE = GGBasicTypes.Point;
Scene: TYPE = GGModelTypes.Scene;
Segment: TYPE = GGSegmentTypes.Segment;
SelectionClass: TYPE = GGInterfaceTypes.SelectionClass;
Sequence: TYPE = GGModelTypes.Sequence;
SliceParts: TYPE = GGModelTypes.SliceParts;
Slice: TYPE = GGModelTypes.Slice;
SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor;
Traj: TYPE = GGModelTypes.Traj;
TrajPartType: TYPE = GGModelTypes.TrajPartType;
TrajEnd: TYPE = GGModelTypes.TrajEnd;
TrajGenerator: TYPE = GGModelTypes.TrajGenerator;
HitType: TYPE = GGModelTypes.TrajPartType;
fillColor: Imager.Color;
The Outline Slice Class
OutlineData: TYPE = REF OutlineDataObj;
OutlineDataObj:
TYPE =
RECORD [
fillColor: Imager.Color,
children: LIST OF Traj
];
OutlineParts: TYPE = REF OutlinePartsObj;
OutlinePartsObj:
TYPE =
RECORD [
seqs: LIST OF Sequence
];
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]; -- use GGSlice
BuildOutlineSliceClass: PROC [] RETURNS [class: OutlineClass];
CreateOutline:
PROC [traj: Traj, fillColor: Imager.Color]
RETURNS [outline: Slice];
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: Slice, hole: Traj] RETURNS [holier: Slice];
ReplaceFence: PROC [outline: Slice, newFence: Traj] RETURNS [newOutline: Slice];
ReplaceHole: PROC [outline: Slice, oldHole, newHole: Traj] RETURNS [newOutline: Slice];
PartsFromSequence: PROC [outline: Slice, seq: Sequence] RETURNS [sliceParts: SliceParts];
DescriptorFromSequence: PROC [outline: Slice, seq: Sequence] RETURNS [sliceD: SliceDescriptor];
DescriptorFromParts: PROC [outline: Outline, sliceParts: SliceParts] RETURNS [sliceD: SliceDescriptor];
CopyParts: PROC [outline: Slice, parts: SliceParts] RETURNS [copy: SliceParts];
FindTrajInDescriptor:
PROC [outlineD: SliceDescriptor, traj: Traj]
RETURNS [seq: Sequence];
Needed by GGSelectImpl.FindSelectedSequence.
SaveSelectionsInOutline: PROC [outline: Slice, scene: Scene];
RemakeSelectionsFromOutline: PROC [outline: Slice, scene: Scene];
SequencesOfOutline: PROC [outlineD: OutlineDescriptor] RETURNS [seqList: LIST OF Sequence];
SequencesOfOutlineNew: PROC [sliceD: SliceDescriptor] RETURNS [seqList: LIST OF Sequence];
SequencesOfOutline: PROC [outlineD: SliceDescriptor] RETURNS [seqList: LIST OF Sequence];
RemoveTraj: PROC [outlineD: SliceDescriptor, traj: Traj] RETURNS [newD: SliceDescriptor];
UnpackOnePointDescriptorOld: PROC [outlineD: OutlineDescriptor] RETURNS [traj: Traj, isACP: BOOL, segNum, cpNum, jointNum: NAT];
UnpackOnePointDescriptor: PROC [outlineD: SliceDescriptor] RETURNS [traj: Traj, isACP: BOOL, segNum, cpNum, jointNum: NAT];
UnpackOneSegmentDescriptorOld: PROC [outlineD: OutlineDescriptor] RETURNS [traj: Traj, segNum: NAT];
UnpackOneSegmentDescriptor: PROC [outlineD: 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 [outlineD: 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: HitType, segNum, cpNum, jointNum:
INT, hitPoint: Point];
This will go away when the Caret machinery is revised.
UpdateDescriptorBoundBoxes: PROC [outlineD: SliceDescriptor];
Update the bound boxes of all contained sequences.
For use by GGTrajImpl only
UpdateBoundBox:
PROC [slice: Slice];
Used by GGSelect to do a DeselectTraj.
Queries about Trajectories
TrajectoriesOfOutline: PROC [outline: Slice] RETURNS [children: LIST OF Traj];
OutlineOfTraj: PROC [traj: Traj] RETURNS [outline: Slice];
OutlineOfTraj: PROC [traj: Traj] RETURNS [outline: Slice];
OutlineOfTrajNew: PROC [traj: Traj] RETURNS [outline: Slice];
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: Slice] RETURNS [BOOL];
FenceOfOutline: PROC [outline: Slice] RETURNS [fence: Traj];
HolesOfOutline: PROC [outline: Slice] RETURNS [trajGen: TrajGenerator];
TrajsInOutline:
PROC [outline: Slice]
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.