<> <> <> <> <> <<>> DIRECTORY GGBasicTypes, GGBoxSlice, GGBoundBox, GGSlice, GGLines, GGInterfaceTypes, GGModelTypes, GGShapes, GGParseIn, GGParseOut, GGTransform, Imager, ImagerTransformation, IO, Rope; GGBoxSliceImpl: CEDAR PROGRAM IMPORTS GGBoundBox, GGSlice, GGLines, GGShapes, GGParseIn, GGParseOut, GGTransform, Imager, ImagerTransformation, IO EXPORTS GGBoxSlice = BEGIN Point: TYPE = GGBasicTypes.Point; PointGenerator: TYPE = REF PointGeneratorObj; PointGeneratorObj: TYPE = GGModelTypes.PointGeneratorObj; PointPairGenerator: TYPE = REF PointPairGeneratorObj; PointPairGeneratorObj: TYPE = GGModelTypes.PointPairGeneratorObj; Slice: TYPE = GGModelTypes.Slice; SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor; SliceDescriptorObj: TYPE = GGModelTypes.SliceDescriptorObj; SliceParts: TYPE = GGModelTypes.SliceParts; SliceObj: TYPE = GGModelTypes.SliceObj; SliceClass: TYPE = GGModelTypes.SliceClass; SliceClassObj: TYPE = GGModelTypes.SliceClassObj; BoundBox: TYPE = GGModelTypes.BoundBox; SelectMode: TYPE = GGModelTypes.SelectMode; ExtendMode: TYPE = GGModelTypes.ExtendMode; Corner: TYPE = GGBoxSlice.Corner; Edge: TYPE = GGBoxSlice.Edge; BoxData: TYPE = REF BoxDataObj; BoxDataObj: TYPE = RECORD [ box: BoundBox, <> transform: ImagerTransformation.Transformation, strokeWidths: ARRAY [1..4] OF REAL -- in order left, top, right, bottom ]; BoxParts: TYPE = REF BoxPartsObj; BoxPartsObj: TYPE = RECORD [ entire: BOOL, -- means entire box is selected (traj or topLevel) corners: LIST OF Corner, -- which corners of box are selected. edges: LIST OF Edge -- which edges of box are selected. ]; BoxHitData: TYPE = REF BoxHitDataObj; BoxHitDataObj: TYPE = RECORD [ corner: Corner, -- which corner of box is hit. Filled in by BoxClosestPoint, BoxClosestSegment edge: Edge -- which edge of box is hit. Filled in by BoxClosestPoint, BoxClosestSegment ]; Problem: PUBLIC SIGNAL [msg: Rope.ROPE] = CODE; BuildBoxSliceClass: PUBLIC PROC [] RETURNS [class: SliceClass] = { class _ NEW[SliceClassObj _ [ type: $Box, boundBox: BoxBoundBox, copy: BoxCopy, draw: BoxDraw, drawTransform: BoxDrawTransform, drawSelectionFeedback: BoxDrawSelectionFeedback, transform: BoxTransform, emptyParts: BoxEmptyParts, newParts: BoxNewParts, addParts: BoxAddParts, removeParts: BoxRemoveParts, pointsInDescriptor: BoxPointsInDescriptor, pointPairsInDescriptor: BoxPointPairsInDescriptor, nextPoint: BoxNextPoint, nextPointPair: BoxNextPointPair, closestPoint: BoxClosestPoint, closestPointAndTangent: NIL, closestSegment: BoxClosestSegment, fileout: BoxFileout, filein: BoxFilein, setStrokeWidth: BoxSetStrokeWidth, setStrokeColor: BoxSetStrokeColor, setFillColor: BoxSetFillColor ]]; }; <> <> <> <> <> <> <<};>> <<>> BoxPointsInDescriptor: PROC [sliceD: SliceDescriptor] RETURNS [pointGen: PointGenerator] = { parts: BoxParts _ NARROW[sliceD.parts]; pointGen _ NEW[PointGeneratorObj _ [sliceD, 0, 0, NIL] ]; -- toGo and index now used IF parts.entire THEN pointGen.toGo _ 4 ELSE FOR corner: LIST OF Corner _ parts.corners, corner.rest UNTIL corner = NIL DO pointGen.toGo _ pointGen.toGo + 1; ENDLOOP; }; BoxPointPairsInDescriptor: PROC [sliceD: SliceDescriptor] RETURNS [pointPairGen: PointPairGenerator] = { parts: BoxParts _ NARROW[sliceD.parts]; pointPairGen _ NEW[PointPairGeneratorObj _ [sliceD, 0, 0, NIL] ]; -- toGo and index now used IF parts.entire THEN pointPairGen.toGo _ 4 ELSE FOR edge: LIST OF Edge _ parts.edges, edge.rest UNTIL edge = NIL DO pointPairGen.toGo _ pointPairGen.toGo + 1; ENDLOOP; }; <> <> <> <> <> <> <> <<}>> <> <> <