GGScene.mesa
Contents: The procedural interface to the Gargoyle object modeler.
Copyright Ó 1985, 1988, 1992 by Xerox Corporation. All rights reserved.
Stone, August 5, 1985 1:01:40 pm PDT
Pier, October 27, 1988 4:59:59 pm PDT
Eisenman, September 28, 1987 5:39:46 pm PDT
Bier, February 5, 1993 1:59 pm PST
DIRECTORY
BasicTime, GGBasicTypes, GGModelTypes, GGSegmentTypes, Imager, ImagerTransformation, Rope;
GGScene: CEDAR DEFINITIONS = BEGIN
BoundBox: TYPE = GGModelTypes.BoundBox;
BoundBoxGenerator: TYPE = GGModelTypes.BoundBoxGenerator;
Camera: TYPE = GGModelTypes.Camera;
Color: TYPE = Imager.Color;
Joint: TYPE = GGModelTypes.Joint;
Point: TYPE = GGBasicTypes.Point;
Scene: TYPE = GGModelTypes.Scene;
Segment: TYPE = GGSegmentTypes.Segment;
SelectionClass: TYPE = GGSegmentTypes.SelectionClass;
Slice: TYPE = GGModelTypes.Slice;
SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor;
SliceDescriptorWalkProc: TYPE = GGModelTypes.SliceDescriptorWalkProc;
SliceGenerator: TYPE = GGModelTypes.SliceGenerator;
SliceWalkProc: TYPE = GGModelTypes.SliceWalkProc;
Traj: TYPE = GGModelTypes.Traj;
TrajEnd: TYPE = GGModelTypes.TrajEnd; -- {lo, hi}
Vector: TYPE = GGBasicTypes.Vector;
WalkLevel: TYPE = GGModelTypes.WalkLevel;
Creating Scenes and Cameras
CreateScene: PROC [entities: LIST OF Slice ¬ NIL] RETURNS [scene: Scene];
CreateDefaultCamera: PROC [] RETURNS [camera: Camera];
Creates a camera with displayStyle = print (and, in fact, all fields set to the default values given in GGModelTypes).
MergeScenes: PROC [back: Scene, front: Scene] RETURNS [combined: Scene];
SetScene: PROC [from: Scene, to: Scene]; -- transfers the entity list "from" to "to"
MakeSceneGarbage: PROC [scene: Scene];
Unlink a scene so the Cedar gargbage collector can sweep up.
Former Undelete procs
Modifying Scenes
AddSlice: PROC [scene: Scene, slice: Slice, priority: INT ¬ -1];
Add the given slice to the scene with the given priority (the higher the priority number, the closer the slice is to the front of the scene). If priority is 0, the slice will be the back-most entity. If priority is -1, the slice will be the front-most entity. If the priority given is too high, we proceed as if priority = -1.
AddSlices: PROC [scene: Scene, slices: LIST OF Slice, priority: INT ¬ -1];
Adds the slices, assumed to be in back to front order, to the scene. If priority is 0, the slices will be the back-most entities. If priority = -1, they become the frontmost entities. Otherwise, the specified priority becomes the priority of the first entity in the list, if possible. If the priority given is too high, we proceed as if priority = -1.
AddHole: PROC [outline: Slice, hole: Traj, scene: Scene] RETURNS [holier: Slice];
AppendHoles: PROC [outline: Slice, holes: LIST OF Slice]; -- CAREFUL
DeleteSlice: PROC [scene: Scene, slice: Slice];
Deselects the slice from all selection classes and removes it from the scene.
RemoveSlice: PROC [scene: Scene, slice: Slice];
Removes the slice from the scene, but leaves it selections alone. Presumably, the caller is about to put the slice back into the scene at a different priority.
DeleteSequence: PROC [seq: SliceDescriptor, scene: Scene] RETURNS [oldOutline: Slice, newOutlines: LIST OF Slice];
Deletes some parts of an outline from the scene. The result can be multiple outlines if the original outline is broken up into pieces. The effect is as follows:
Takes the trajectory of which seq is a part. What is the role of this trajectory?
If role = hole, then create a new outline (and new trajectories), identical to seq.traj.outline, but without the hole. Make separate outlines corresponding to those parts of the hole which were not deleted. The old outline (and all of its parts) is now obsolete.
If role = fence, then create new outlines and new trajectories for all of the parts of seq.traj.outline which remain. The old outline (and all of its parts) is now obsolete.
If role = open, then create new outlines and new trajectories for all of the parts of seq.traj which remain. The old outline is obsolete.
SetBackgroundColor: PROC [scene: Scene, color: Color];
GetBackgroundColor: PROC [scene: Scene] RETURNS [color: Color];
SetLastEditedTime: PROC [scene: Scene, time: BasicTime.ExtendedGMT];
GetLastEditedTime: PROC [scene: Scene] RETURNS [time: BasicTime.ExtendedGMT];
Manipulations on Multiple Scenes
CopySelectedParts: PROC [fromScene: Scene, toScene: Scene] RETURNS [newSlices: LIST OF Slice];
Copy all parts that are current selected in "from" and place the copies in "to" at the frontmost priority. Returns newSlices in case the caller wants to see what they are.
Priority order
GetPriority: PROC [scene: Scene, slice: Slice] RETURNS [priority: INT];
Priority is the position in the scene. If priority is 0, the slice is the back-most entity.
TopPriority: PROC [scene: Scene] RETURNS [priority: INT];
Returns the priority of the frontmost position in the scene.
UpOne: PROC [scene: Scene, slice: Slice];
Moves the named entity one step closer to the front in the priority order.
PutInFront: PROC [scene: Scene, slice: Slice, slices: LIST OF Slice];
Puts back-to-front slices in front of slice.
If slice or slices is NIL, does nothing.
DownOne: PROC [scene: Scene, slice: Slice];
Moves the named entity one step closer to the back in the priority order.
PutBehind: PROC [scene: Scene, slice: Slice, slices: LIST OF Slice];
Puts back-to-front slices behind slice.
If slice or slices is NIL, does nothing.
ReplaceSlice: PROC [scene: Scene, slice: Slice, slices: LIST OF Slice];
Removes slice from scene and puts back-to-front slices in its place.
If slice or slices is NIL, does nothing.
PutAtPriority: PROC [scene: Scene, slice: Slice, priority: INT];
If priority is 0, the slice will be the back-most entity. If priority is -1, the slice will be the front-most entity. If the priority given is too high, we proceed as if priority = -1.
GetAtPriority: PROC [scene: Scene, priority: INT] RETURNS [slice: Slice];
Returns the slice at priority. If priority= -1 or no such priority is occupied, returns the frontmost slice.
DeleteAtPriority: PROC [scene: Scene, priority: INT] RETURNS [deleted: Slice];
Deletes and returns the slice at priority. If priority= -1 or no such priority is occupied, deletes and returns the frontmost slice.
Browsing the Scene Hierarchy
WalkSlices: PROC [scene: Scene, level: WalkLevel, walkProc: SliceWalkProc, classType: ATOM ¬ NIL] RETURNS [aborted: BOOL ¬ FALSE];
Built-in classes include: $Cluster, $Outline, $Traj, $Box, $Circle, $Text, and $IP. This routine finds all such slices, even within clusters. class=NIL => all classes. Use level=all to walk every slice of a given class.
WalkSelectedSlices: PROC [scene: Scene, level: WalkLevel, walkProc: SliceDescriptorWalkProc, selectClass: SelectionClass, classType: ATOM ¬ NIL] RETURNS [aborted: BOOL ¬ FALSE];
ListSlices: PROC [scene: Scene, level: WalkLevel, classType: ATOM ¬ NIL] RETURNS [sliceList: LIST OF Slice];
Built-in classes include: $Cluster, $Outline, $Traj, $Box, $Circle, $Text, and $IP. This routine finds all such slices, even within clusters. class=NIL => all classes. Use level=all to list every slice of a given class. level=all => depth-first ordered list.
ListSelectedSlices: PROC [scene: Scene, level: WalkLevel, selectClass: SelectionClass, classType: ATOM ¬ NIL] RETURNS [selectedList: LIST OF SliceDescriptor];
CountSlices: PROC [scene: Scene, level: WalkLevel, classType: ATOM ¬ NIL] RETURNS [count: INT ¬ 0];
CountSelectedSlices: PROC [scene: Scene, level: WalkLevel, selectClass: SelectionClass, classType: ATOM ¬ NIL] RETURNS [count: CARD ¬ 0];
FirstSelectedSlice: PROC [scene: Scene, level: WalkLevel, selectClass: SelectionClass, classType: ATOM ¬ NIL] RETURNS [sliceD: SliceDescriptor];
LastSelectedSlice: PROC [scene: Scene, level: WalkLevel, selectClass: SelectionClass, classType: ATOM ¬ NIL] RETURNS [sliceD: SliceDescriptor];
IsTopLevel: PROC [slice: Slice] RETURNS [BOOL];
Bounding Boxes
BoundBoxesInScene: PROC [scene: Scene] RETURNS [bBoxGen: BoundBoxGenerator];
The bounding boxes of the top level entities, allowing for control points and stroke widths.
TightBoxesInScene: PROC [scene: Scene] RETURNS [bBoxGen: BoundBoxGenerator];
The bounding boxes of the top level entities, NOT allowing for control points and stroke widths.
NextBox: PROC [g: BoundBoxGenerator] RETURNS [next: BoundBox];
BoundBoxOfScene: PROC [scene: Scene] RETURNS [bBox: BoundBox];
The bounding box of the entire scene, allowing for control points and stroke widths.
TightBoxOfScene: PROC [scene: Scene] RETURNS [bBox: BoundBox];
Used by GGAlign to compute hit testing boxes before invoking gravity.
BoundBoxOfSelected: PROC [scene: Scene, selectClass: SelectionClass ¬ normal, sliceLevel: BOOL ¬ FALSE] RETURNS [bigBox: BoundBox];
Returns the composite bound box for all selected parts, or all selected slices if sliceLevel=TRUE.
TightBoxOfSelected: PROC [scene: Scene, selectClass: SelectionClass ¬ normal, sliceLevel: BOOL ¬ FALSE] RETURNS [bigBox: BoundBox];
Returns the composite tight box for all selected parts, or all selected slices if sliceLevel=TRUE.
SelectionBoxOfSelected: PROC [scene: Scene, selectClass: SelectionClass ¬ normal, full: BOOL ¬ FALSE] RETURNS [bigBox: BoundBox];
Returns a composite bound box, intended for selection feedback, for all selected parts, or all selected slices if full=TRUE.
BoundBoxOfMoving: PROC [scene: Scene, editConstraints: GGModelTypes.EditConstraints, bezierDrag: GGModelTypes.BezierDragRecord, selectClass: SelectionClass ¬ normal] RETURNS [bigBox: BoundBox];
Selections
DeleteAllSelected: PROC [scene: Scene] RETURNS [bBox: BoundBox];
SaveSelections: PROC [scene: Scene];
RestoreSelections: PROC [scene: Scene];
SelectInBox: PROC [scene: Scene, box: BoundBox, selectClass: SelectionClass ¬ normal];
Select all slices that are completely contained within or on the edge of box.
SelectPartsInBox: PROC [scene: Scene, box: BoundBox, selectClass: SelectionClass ¬ normal];
END.