GGAlign.mesa
Contents: Allows the client to build a set of trigger objects (joints, segments, and control points) which can be sent through a GGGravity filter to create a set alignment objects.
Pier, July 24, 1986 3:28:19 pm PDT
Bier, January 8, 1987 0:43:50 am PST
DIRECTORY
GGGravity,
GGBasicTypes,
GGModelTypes,
GGInterfaceTypes;
GGAlign: CEDAR DEFINITIONS =
BEGIN
Caret: TYPE = GGInterfaceTypes.Caret;
FeatureData: TYPE = GGGravity.FeatureData;
GargoyleData: TYPE = GGInterfaceTypes.GargoyleData;
Line: TYPE = GGBasicTypes.Line;
ObjectBag: TYPE = GGGravity.ObjectBag;
Outline: TYPE = GGModelTypes.Outline;
OutlineDescriptor: TYPE = GGModelTypes.OutlineDescriptor;
Point: TYPE = GGBasicTypes.Point;
Scene: TYPE = GGModelTypes.Scene;
SelectionClass: TYPE = GGInterfaceTypes.SelectionClass;
Sequence: TYPE = GGModelTypes.Sequence;
Slice: TYPE = GGModelTypes.Slice;
SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor;
Traj: TYPE = GGModelTypes.Traj;
TriggerBag: TYPE = REF TriggerBagObj;
TriggerBagObj: TYPE = GGInterfaceTypes.TriggerBagObj;
Vector: TYPE = GGBasicTypes.Vector;
FilterOutlineProc: TYPE = PROC [outlineD: OutlineDescriptor];
FilterSliceProc: TYPE = PROC [sliceD: SliceDescriptor];
PointFilterProc: TYPE = GGGravity.PointFilterProc;
SegmentFilterProc: TYPE = GGGravity.SegmentFilterProc;
Building a TriggerBag.
emptyTriggerBag: TriggerBag;
Use this as an (immutable) empty TriggerBag.
CreateTriggerBag: PROC [] RETURNS [triggerBag: TriggerBag];
CreateOutlineTrigger: PUBLIC PROC [outlineD: OutlineDescriptor, triggerBag: TriggerBag] RETURNS [feature: FeatureData];
Add outlineD to triggerBag and return the new feature which represents outlineD.
CreateSliceTrigger: PROC [sliceD: SliceDescriptor, triggerBag: TriggerBag] RETURNS [feature: FeatureData];
Add slice to triggerBag and return the new feature which represents slice.
CreateAnchorTrigger: PUBLIC PROC [anchor: Caret, triggerBag: TriggerBag] RETURNS [feature: FeatureData];
DeleteAnchorTrigger: PUBLIC PROC [triggerBag: TriggerBag];
Add anchor to triggerBag and return the new feature which represents anchor.
DeleteTriggers: PROC [seq: Sequence, triggerBag: TriggerBag];
AddTriggersFilter: PROC [triggerBag: TriggerBag, filterOutlineProc: FilterOutlineProc, filterSliceProc: FilterSliceProc, gargoyleData: GargoyleData];
When this procedure is called, all sequences in the scene are passed to AddFilterProc to see if they should be added (in all or in part). filterProc should return those parts which should be added (it returns them by leaving their selected bits TRUE in the sequence which it is passed). AddTriggersFilter adds these parts to triggerBag.
DeleteTriggersFilter: PROC [triggerBag: TriggerBag, filterOutlineProc: FilterOutlineProc, filterSliceProc: FilterSliceProc];
When this procedure is called, all sequences in triggerBag are passed to filterProc. filterProc should return those parts which should NOT be deleted (it returns them by leaving their selected bits TRUE in the sequence which it is passed), leaving the sequence unmodified, if all its parts should remain on the list.
CopyTriggerBag: PROC [triggerBag: TriggerBag] RETURNS [copy: TriggerBag];
Using a TriggerBag to make an ObjectBag.
All at once.
BuiltInFilters: PROC [triggerBag: TriggerBag, objectBag: ObjectBag, gargoyleData: GargoyleData];
AddAllMidpoints: PROC [sceneTriggers: TriggerBag, objectBag: ObjectBag, gargoyleData: GargoyleData];
Given a new trigger.
IncrementalFilters: PROC [trigger: FeatureData, objectBag: ObjectBag, gargoyleData: GargoyleData] RETURNS [alignObjects: LIST OF FeatureData];
Building Trigger Bags and Objects Bags at the Same Time
SetBagsForAction: PROC [gargoyleData: GargoyleData, atom: ATOM];
From scratch, build up the current trigger bag, the scene trigger bag, and the current object bag, using the current filters. atom can be $CaretPos or $Drag. The choice of atom determines which additonal heuristics will be used to add triggers to the trigger bag, and which objects will be removed because they are considered "moving".
UpdateBagsForAction: PROC [gargoyleData: GargoyleData, atom: ATOM] RETURNS [repaintNeeded: BOOL];
If we are about to do an Add or Drag, then we expect that the triggerBag is OK except that the moving trajectory's sequences are obsolete, the moving segment must be removed, and heuristic objects must be added. The sceneBag is OK except that moving objects must be removed. The objectBag should then be regenerated from the new triggerBag.
SetSceneBagForAction: PROC [gargoyleData: GargoyleData, atom: ATOM];
From scratch, build up the scene trigger. Leave the current trigger bag and current object bag alone. atom can be $CaretPos or $Drag. The choice of atom determines which objects will be removed because they are considered "moving".
RemakeBagsAfterSceneChange: PROC [gargoyleData: GargoyleData];
Some change in the scene has occurred. For instance, an object has been made hot or cold. A hot object has been deleted. A hot segment has changed its spline type. Remake the bags as appropriate. Use the current state of the bags to figure out which heuristics will be used to add triggers to the trigger bag.
RemakeObjectBag: PROC [gargoyleData: GargoyleData];
A new kind of alignment object has been selected or deselected. Different heuristics are now appropriate. Or perhaps the caller has added a new trigger manually. Make new object bags from the existing trigger bags.
ReplaceObsoleteOutlineTrigger: PROC [gargoyleData: GargoyleData, oldOutline: Outline, newOutline: Outline];
Used by GGMouseEventImplA.StartAdd to get the obsolete sequences out of the trigger bags before calling UpdateBagsForAction.
END.