GGTouch.mesa
Copyright c 1985 by Xerox Corporation. All rights reserved.
Last edited by Bier on May 28, 1986 6:38:48 pm PDT
Contents: Implements a data structures which remembers which trajectory is touching which other trajectory and where.
Pier, December 6, 1985 10:01:03 am PST
DIRECTORY
GGBasicTypes, GGInterfaceTypes, GGModelTypes, GGObjects, GGSegmentTypes, Imager, ImagerTransformation;
GGTouch: CEDAR DEFINITIONS =
BEGIN
Slice: TYPE = GGModelTypes.Slice;
GargoyleData: TYPE = GGInterfaceTypes.GargoyleData;
Joint: TYPE = GGModelTypes.Joint;
Outline: TYPE = GGModelTypes.Outline;
Point: TYPE = GGBasicTypes.Point;
Segment: TYPE = GGSegmentTypes.Segment;
Sequence: TYPE = GGModelTypes.Sequence;
Traj: TYPE = GGModelTypes.Traj;
TrajGenerator: TYPE = GGObjects.TrajGenerator;
TouchGroup: TYPE = GGSegmentTypes.TouchGroup;
TouchingPartType: TYPE = GGSegmentTypes.TouchingPartType;
TouchItem: TYPE = GGSegmentTypes.TouchItem;
TouchItemGenerator: TYPE = REF TouchItemGeneratorObj;
TouchItemGeneratorObj: TYPE = RECORD [
list: LIST OF TouchItem
];
Concerns
Two trajectories may remain touching during sets of operations which change either or both of them drastically (e.g. adding points, changing spline types on uninvolved curves. Hence, it is not adequate to remember merely a joint number or segment number. We store a pointer to the segment record itself. The touching package must be informed if these object are changed. In particular, any operation which moves a joint or a segment must check to see if the touching has been broken.
Intended Usage
Each joint (or segment) which is involved in a touching constraint should store a pointer to its own Touch Item in that group. The Touch Item keeps a pointer to the Touch Group, and the Touch Group has a list of pointers to all of the Touch Items. The system also keeps a list of all Touch Groups (for debugging).
After actions which move objects (e.g. dragging), the touching constraints are re-evaluated. The first object which is moved (call UpdateTouchGroup) updates the point value in the Touch Group. This first object checks to see which of the other touch items are moving with it. If any of them are not, they are removed from the Touch Group and a message is printed. A flag is set so subsequent update attempts are ignored. This means that the touching structures must be initialized, with InitializeTouching, when a Move is contemplated.
For now, objects are considered to "move with" each other if they are selected (normal selection -- see GGSelect).
When two objects have become touching.
CreateTouchGroup: PROC [gargoyleData: GargoyleData, point: Point] RETURNS [empty: TouchGroup];
AddJoint: PROC [traj: Traj, joint: Joint, touchGroup: TouchGroup] RETURNS [item: TouchItem];
AddSegment: PROC [traj: Traj, seg: Segment, segPoint: Point, touchGroup: TouchGroup] RETURNS [item: TouchItem];
MergeGroups: PROC [group1, group2: TouchGroup, gargoyleData: GargoyleData];
Updating when something has moved -- the basic routines.
InitializeTouching: PROC [gargoyleData: GargoyleData];
UpdateTouchGroup: PROC [item: TouchItem, point: Point, gargoyleData: GargoyleData];
Updating when something has moved -- convenience routines (which repeatedly call the basic routines for many joints and segments).
SequenceMoved: PROC [seq: Sequence, gargoyleData: GargoyleData, transform: ImagerTransformation.Transformation ← NIL];
TrajMoved: PROC [traj: Traj, gargoyleData: GargoyleData, transform: ImagerTransformation.Transformation ← NIL];
Updating when something has been deleted -- the basic routine.
DeleteTouchItem: PROC [touchItem: TouchItem, gargoyleData: GargoyleData];
Updating when something has been deleted -- convenience routines (which repeatedly call the basic routines for many joints and segments).
SequenceDeleted: PROC [seq: Sequence, gargoyleData: GargoyleData];
OutlineDeleted: PROC [outline: Outline, gargoyleData: GargoyleData];
SliceDeleted: PROC [slice: Slice, gargoyleData: GargoyleData];
Browsing.
TouchGroupOfItem: PROC [item: TouchItem] RETURNS [touchGroup: TouchGroup];
AllTouchItems: PROC [touchGroup: TouchGroup] RETURNS [touchItemGen: TouchItemGenerator];
NextTouchItem: PROC [touchItemGen: TouchItemGenerator] RETURNS [item: TouchItem];
Drawing.
DrawAllTouchPoints: PROC [dc: Imager.Context, gargoyleData: GargoyleData];
DescribeAllTouchPoints: PROC [gargoyleData: GargoyleData];
END.