<> <> <> <> <> <<>> DIRECTORY Atom, AtomButtonsTypes, Feedback, GGBasicTypes, GGBoundBox, GGInterfaceTypes, GGModelTypes, GGSegment, GGSegmentTypes, GGSequence, GGOutline, GGParseIn, GGParseOut, GGShapes, GGSlice, GGTransform, GGUtility, Imager, ImagerTransformation, IO, Lines2d, NodeStyle, Rope, Vectors2d, ViewerClasses; GGSliceImplA: CEDAR PROGRAM IMPORTS Atom, Feedback, GGBoundBox, GGOutline, GGParseIn, GGParseOut, GGSegment, GGSequence, GGShapes, GGSlice, GGTransform, Imager, ImagerTransformation, IO, Lines2d, Rope, Vectors2d EXPORTS GGSlice = BEGIN BoundBox: TYPE = GGModelTypes.BoundBox; CameraData: TYPE = GGInterfaceTypes.CameraData; Circle: TYPE = GGBasicTypes.Circle; Color: TYPE = Imager.Color; Corner: TYPE = GGSlice.Corner; DefaultData: TYPE = GGInterfaceTypes.DefaultData; Edge: TYPE = GGBasicTypes.Edge; EntityGenerator: TYPE = GGModelTypes.EntityGenerator; ExtendMode: TYPE = GGModelTypes.ExtendMode; FactoredTransformation: TYPE = ImagerTransformation.FactoredTransformation; FeedbackData: TYPE = AtomButtonsTypes.FeedbackData; Line: TYPE = GGBasicTypes.Line; Object: TYPE = Imager.Object; OutlineParts: TYPE = GGOutline.OutlineParts; Point: TYPE = GGBasicTypes.Point; PointGenerator: TYPE = GGModelTypes.PointGenerator; PointGeneratorObj: TYPE = GGModelTypes.PointGeneratorObj; PointPairGenerator: TYPE = GGModelTypes.PointPairGenerator; PointPairGeneratorObj: TYPE = GGModelTypes.PointPairGeneratorObj; Scene: TYPE = GGModelTypes.Scene; Segment: TYPE = GGSegmentTypes.Segment; SegmentGenerator: TYPE = GGModelTypes.SegmentGenerator; SegmentGeneratorObj: TYPE = GGModelTypes.SegmentGeneratorObj; SelectedObjectData: TYPE = GGModelTypes.SelectedObjectData; SelectionClass: TYPE = GGInterfaceTypes.SelectionClass; SelectMode: TYPE = GGModelTypes.SelectMode; Sequence: TYPE = GGModelTypes.Sequence; SequenceOfReal: TYPE = GGBasicTypes.SequenceOfReal; Slice: TYPE = GGModelTypes.Slice; SliceClass: TYPE = GGModelTypes.SliceClass; SliceClassObj: TYPE = GGModelTypes.SliceClassObj; SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor; SliceDescriptorObj: TYPE = GGModelTypes.SliceDescriptorObj; SliceObj: TYPE = GGModelTypes.SliceObj; SliceParts: TYPE = GGModelTypes.SliceParts; StrokeEnd: TYPE = Imager.StrokeEnd; Transformation: TYPE = ImagerTransformation.Transformation; Vector: TYPE = GGBasicTypes.Vector; Viewer: TYPE = ViewerClasses.Viewer; WalkProc: TYPE = GGModelTypes.WalkProc; SliceClassDef: TYPE = REF SliceClassDefObj; SliceClassDefObj: TYPE = RECORD[type: ATOM, class: SliceClass]; <> BoxData: TYPE = REF BoxDataObj; BoxDataObj: TYPE = RECORD [ box: BoundBox, -- this is not used as a bounding box. It is a representation of the shape. tightBox: BoundBox, -- a Manhattan aligned box, that contains this box. tightBox does NOT allow for stroke width or control points. transform: ImagerTransformation.Transformation, inverse: ImagerTransformation.Transformation, -- inverse of transform inverseScale: Vector, -- cached value of ImagerTransformation.Factor[inverse].s fillColor: Color, segments: ARRAY [0..4) OF Segment -- in order left, top, right, bottom ]; CornerArray: TYPE = ARRAY [0..4) OF BOOL; -- ll, ul, ur, lr. Clockwise order of corners. EdgeArray: TYPE = ARRAY [0..4) OF BOOL; -- left, top, right, bottom. Clockwise order of edges. BoxParts: TYPE = REF BoxPartsObj; BoxPartsObj: TYPE = RECORD [ corners: CornerArray, -- which corners of box are selected. edges: EdgeArray, -- which edges of box are selected. center: BOOL -- is the middle joint selected? ]; BoxHitData: TYPE = REF BoxHitDataObj; BoxHitDataObj: TYPE = RECORD [ corner: [-1..3], edge: [-1..3], center: [-1..0], hitPoint: Point ]; Problem: SIGNAL [msg: Rope.ROPE] = Feedback.Problem; BuildBoxSliceClass: PUBLIC PROC [] RETURNS [class: SliceClass] = { OPEN GGSlice; class _ NEW[SliceClassObj _ [ type: $Box, <> getBoundBox: BoxGetBoundBox, getTightBox: BoxGetTightBox, copy: BoxCopy, <> drawParts: BoxDrawParts, drawTransform: BoxDrawTransform, drawSelectionFeedback: BoxDrawSelectionFeedback, drawAttractorFeedback: NoOpDrawAttractorFeedback, <> transform: BoxTransform, <> describe: BoxDescribe, describeHit: BoxDescribeHit, fileout: BoxFileout, filein: BoxFilein, <> isEmptyParts: BoxIsEmptyParts, isCompleteParts: BoxIsCompleteParts, newParts: BoxNewParts, unionParts: BoxUnionParts, differenceParts: BoxDiffParts, movingParts: BoxMovingParts, augmentParts: BoxAugmentParts, setSelectedFields: NoOpSetSelectedFields, <> pointsInDescriptor: BoxPointsInDescriptor, pointPairsInDescriptor: BoxPointPairsInDescriptor, segmentsInDescriptor: BoxSegmentsInDescriptor, walkSegments: BoxWalkSegments, nextPoint: BoxNextPoint, nextPointPair: BoxNextPointPair, nextSegment: BoxNextSegment, <> closestPoint: BoxClosestPoint, closestJointToHitData: NoOpClosestJointToHitData, closestPointAndTangent: NoOpClosestPointAndTangent, closestSegment: BoxClosestSegment, lineIntersection: BoxLineIntersection, circleIntersection: NoOpCircleIntersection, hitDataAsSimpleCurve: BoxHitDataAsSimpleCurve, <