DIRECTORY Imager, ConvexCombiner; CombinePoly: CEDAR DEFINITIONS = BEGIN DBID: TYPE = ConvexCombiner.Vertex; PolyID: TYPE = ConvexCombiner.Vertex; Point: TYPE = ARRAY [1..2] OF REAL; PointGenerator: TYPE = REF PointGeneratorObj; PointGeneratorObj: TYPE; RegionGenerator: TYPE = REF RegionGeneratorObj; RegionGeneratorObj: TYPE; RegionOverlapProc: TYPE = ConvexCombiner.ClientDataCombiner; RegionGlueProc: TYPE = ConvexCombiner.ClientDataEqual; IsAProc: TYPE = ConvexCombiner.IsAProc; CreateDatabase: PROC [] RETURNS [dbid: DBID _ NIL] ~ INLINE {}; CreatePolygon: PROC [point1, point2: Point, clientData: REF] RETURNS [polyID: PolyID]; AddPointToPolygon: PROC [point: Point, polyid: PolyID]; PolygonIntoDatabase: PROC [polyID: PolyID, dbid: DBID, overlapHandler: RegionOverlapProc, glueHandler: RegionGlueProc] RETURNS[newDbid: DBID]; MaximalRegions: PROC [dbid: DBID, isA: IsAProc] RETURNS [regionGen: RegionGenerator]; PointAndDone: TYPE = REF PointAndDoneRec; PointAndDoneRec: TYPE = RECORD [ point: Point, done: BOOL ]; NextPoint: PROC [pointGen: PointGenerator] RETURNS [pointAndDone: PointAndDone]; OutlineHolesDataAndDone: TYPE = REF OutlineHolesDataAndDoneRec; OutlineHolesDataAndDoneRec: TYPE = RECORD [ outline: PointGenerator, holes: RegionGenerator, data: REF, done: BOOL ]; NextRegion: PROC [regionGen: RegionGenerator] RETURNS [outlineHolesDataAndDone: OutlineHolesDataAndDone]; END. CombinePoly.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Last edited by Bier on February 6, 1986 1:55:17 pm PST Contents: Client interface for the Arnon and Greene Combiners. ConvexCombiner.ClientDataCombiner: TYPE = PROC[currentClientdata, inputClientdata: REF] RETURNS [resultClientData: REF]; This procedure is called whenever a new polygon overlaps a region already in the database. resultData becomes the client data for intersection region. The order of arguments is important: currentRegionData is the client data for the region already in the database, newRegionData is the data for the new region coming in. If either arg is NIL, then return the other unchanged. This procedure is called whenever the combiner would like to glue two adjacent regions together to form a single region (either for garbage collection regions or in order to handle a client request for maximally sized regions). If gluing is not allowed, the proc should return NIL. The client must provide one such procedure for each query of the database. For instance, if the client wants maximally sized regions which are blue, the client should pass in an IsAProc which returns TRUE if clientData belongs to a blue region and FALSE otherwise. [point1, point2] is the initial edge of a polygon whose interior lies to the left of vector [point1, point2], and has associated clientData. Currently it is assumed that the points added to a polygon are the counterclockwise-ordered vertices of a convex polygon Called by the client when all the points have been added to the polygon which are going to be added. The polygon pointed to by polyID must have at least three vertices. It is added to the database pointed to by dbid. Currently polygons must be closed (i.e. represent a finite area); open polygons (representing a path of edges) are not allowed. Self-intersecting polygons currently not allowed. Returns points on a region outline in counterclockwise order with respect to region interior. Regions returned in no particular order. ΚΔ˜Jšœ™Icodešœ Οmœ1™