CDPolygonsImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, March 30, 1985 12:19:40 pm PST
last edited by Christian Jacobi, March 25, 1986 1:34:14 pm PST
Last Edited by: Jacobi June 19, 1986 12:22:55 pm PDT
DIRECTORY
CDInstances,
CDPolygons,
CDTexts,
CD,
CDCurves,
CDIO,
TokenIO;
CDPolygonsImpl: CEDAR PROGRAM
IMPORTS CD, CDIO, CDCurves, TokenIO
EXPORTS CDPolygons =
BEGIN
polygonClass: PUBLIC CD.ObjectClass ← CD.RegisterObjectClass[$Polygon, [
internalRead: ReadPolygon,
description: "old kind of polygon"
]];
CreatePolygon: PUBLIC PROC [points: LIST OF CD.Position, lev: CD.Layer] RETURNS [ob: CD.Object←NIL, offset: CD.Position←[0, 0]] =
BEGIN
[ob: ob, offset: offset] ← CDCurves.CreatePolygon[points, lev];
END;
ReadPolygon: CD.InternalReadProc --PROC [] RETURNS [Object]-- =
BEGIN
ob: CD.Object;
lev: CD.Layer = CDIO.ReadLayer[];
leng: INT = TokenIO.ReadInt[];
points: LIST OF CD.Position ← NIL;
FOR i: INT IN [1..leng] DO
points ← CONS[CDIO.ReadPos[], points];
ENDLOOP;
--reorder??
ob ← CreatePolygon[points, lev].ob;
RETURN [ob]
END;
END.