<< JunoImage.mesa>> << Last Hacked by: Jorge Stolfi June 4, 1984 11:57:29 pm PDT>> << Procedures to manipulate and traverse the current Juno image. >> DIRECTORY JunoStorage USING [Point, Coords, Action, Constr, IntCoords], JunoOldSolver USING [Outcome]; JunoImage: DEFINITIONS = BEGIN OPEN Stor: JunoStorage, Solv: JunoOldSolver; << - - - - IMPORTED TYPES>> Point: TYPE = Stor.Point; Coords: TYPE = Stor.Coords; IntCoords: TYPE = Stor.IntCoords; Action: TYPE = Stor.Action; Constr: TYPE = Stor.Constr; << - - - - THE CURRENT IMAGE>> << The current image consists of a list of points, and a list of constraints and a list of actions involving those points. >> PurgeImage: PROC; <> << - - - - IMAGE POINTS >> AddPoint: PROC [p: Point]; <> RemovePoint: PROC [p: Point]; <> <> SortPoints: PUBLIC PROC; <> <> << - - - - CONSTRAINTS>> AddConstr: PROC [c: Constr]; <> << - - - - ACTIONS >> AddAction: PROC [a: Action]; <> <> << - - - - ELEMENT ENUMERATION >> EnumPoints: PROC [Proc: PointVisitProc]; <> <> PointVisitProc: TYPE = PROC [p: Point]; ReplacePoints: PROC [Proc: PointReplaceProc]; <> <> <> PointReplaceProc: TYPE = PROC [p: Point] RETURNS [pNew: Point]; EnumConstrs: PROC [Proc: ConstrVisitProc]; <> <> ConstrVisitProc: TYPE = PROC [c: Constr]; EnumConstrPoints: PROC [c: Constr, Proc: PointVisitProc]; <> <> ReplaceConstrPoints: PROC [c: Constr, Proc: PointReplaceProc]; <> <> <> EnumActions: PROC [Proc: ActionVisitProc]; <> <> ActionVisitProc: TYPE = PROC [a: Action]; EnumActionPoints: PROC [a: Action, Proc: PointVisitProc]; <> <> ReplaceActionPoints: PROC [a: Action, Proc: PointReplaceProc]; <> <> <> << - - - - POINT LOCATION >> FindPoint: PROC [coords: Coords, wound: BOOL _ FALSE] RETURNS [champ: Point]; <> <> << - - - - BALOON SELECTION >> BaloonSelect: PROC [start: IntCoords, NextPoint: NextPointProc]; <> <> NextPointProc: TYPE = PROC RETURNS [coords: IntCoords, lastPoint: BOOL]; AnyWoundPoints: PROC RETURNS [BOOL]; <> ConstrIsWound: PROC [c: Constr] RETURNS [wound: BOOL]; <> ActionIsWound: PROC [a: Action] RETURNS [wound: BOOL]; <> UnwindAllPoints: PROC; <> << - - - - OPERATIONS ON BALOON-SELECTED POINTS >> DeleteWoundItems: PROC; <> <> <> DuplicateWoundItems: PROC; <> <> <> << - - - - POINT IDENTIFICATION >> IdentifyPoints: PROC; <> << Also sets p.copy _ NIL for all points p in the image>> << - - - - CONSTRAINT SOLVING >> SolveImage: PROC [eps: REAL] RETURNS [outcome: Solv.Outcome]; << Solves the image constraints for all image points that have p.fixed=FALSE.>> << Reorders the points according to their new coordinates.>> << Does NOT refresh the image on the screen.>> END. << - - - - JUNK >> AddNewVer: PROC [i,j: Point]; AddNewPara: PROC [i,j,k,l: Point]; AddNewPerp: PROC [i,j,k,l: Point]; AddNewCong: PROC [i,j,k,l: Point]; AddNewAt: PROC [p: Point, x, y: REAL]; AddNewCcw: PROC [i,j,k: Point]; ConstrPtr: TYPE = REF ConstrRec; -- to some kind of constraint record ConstrList: TYPE = REF ConstrPtr; -- linked by link field. NewHor: PROC [i,j: Point] RETURNS [ap: ApplPtr]; NewVer: PROC [i,j: Point] RETURNS [ap: ApplPtr]; NewPara: PROC [i,j,k,l: Point] RETURNS [ap: ApplPtr]; NewPerp: PROC [i,j,k,l: Point] RETURNS [ap: ApplPtr]; NewCong: PROC [i,j,k,l: Point] RETURNS [ap: ApplPtr]; NewAt: PROC [p: Point, x, y: REAL] RETURNS [ap: ApplPtr]; NewCcw: PROC [i,j,k: Point] RETURNS [ap: ApplPtr]; DeleteConstr: PROC [c, cAnt: ConstrPtr, list: ConstrList] RETURNS [newList: ConstrList]; <> InsertConstr: PROC [c, cAnt: ConstrPtr, list: ConstrList] RETURNS [newList: ConstrList]; <> GcConstr: PROC[pf, pl: ConstrList]; <> ActionPtr: TYPE = REF ActionRec; -- to some kind of action record ActionList: TYPE = RECORD [first, last: ActionPtr]; -- linked by link field in chronological (painting) order.; ActionRec: TYPE = RECORD [link: ActionPtr, op: ATOM, -- operation (usually atom, the function name) larg, rarg: Alg.Value _ NIL -- left- and right-arguments ]; NewAction: PROC [op: Alg.Se, arg: Alg.Value] RETURNS [ap: ActionPtr]; DeleteAction: PROC [a, aAnt: ActionPtr, list: ActionList] RETURNS [newList: ActionList]; <> InsertAction: PROC [a, aAnt: ActionPtr, list: ActionList] RETURNS [newList: ActionList]; <> GcAction: PROC[af, al: ActionPtr]; <>