<> <> <> <> <> <> <> <<>> DIRECTORY Feedback, FeedbackTypes, FunctionCache, GGBasicTypes, GGBoundBox, GGCircles, GGCoreOps, GGCoreTypes, GGHistoryTypes, GGInterfaceTypes, GGModelTypes, GGMUserProfile, GGParseIn, GGParseOut, GGProps, GGSegment, GGSegmentTypes, GGShapes, GGSlice, GGSliceOps, GGUtility, Imager, ImagerColor, ImagerPath, ImagerTransformation, IO, Lines2d, NodeStyle, RealFns, Rope, Vectors2d; GGSliceImplC: CEDAR PROGRAM IMPORTS Feedback, FunctionCache, GGBoundBox, GGCircles, GGCoreOps, GGMUserProfile, GGParseIn, GGParseOut, GGProps, GGSegment, GGShapes, GGSlice, GGSliceOps, GGUtility, Imager, ImagerPath, ImagerTransformation, IO, Lines2d, RealFns, Rope, Vectors2d EXPORTS GGSlice = BEGIN BoundBox: TYPE = REF BoundBoxObj; BoundBoxObj: TYPE = GGCoreTypes.BoundBoxObj; Camera: TYPE = GGModelTypes.Camera; Circle: TYPE = GGModelTypes.Circle; Color: TYPE = Imager.Color; DefaultData: TYPE = GGModelTypes.DefaultData; EditConstraints: TYPE = GGModelTypes.EditConstraints; MsgRouter: TYPE = FeedbackTypes.MsgRouter; HistoryEvent: TYPE = GGHistoryTypes.HistoryEvent; Line: TYPE = GGCoreTypes.Line; Object: TYPE = Imager.Object; Orientation: TYPE = GGModelTypes.Orientation; Point: TYPE = GGModelTypes.Point; PointAndDone: TYPE = GGModelTypes.PointAndDone; PointPairAndDone: TYPE = GGModelTypes.PointPairAndDone; PointGenerator: TYPE = GGModelTypes.PointGenerator; PointPairGenerator: TYPE = GGModelTypes.PointPairGenerator; PointGeneratorObj: TYPE = GGModelTypes.PointGeneratorObj; PointWalkProc: TYPE = GGModelTypes.PointWalkProc; Scene: TYPE = GGModelTypes.Scene; Segment: TYPE = GGModelTypes.Segment; SegmentGenerator: TYPE = GGModelTypes.SegmentGenerator; SegmentGeneratorObj: TYPE = GGModelTypes.SegmentGeneratorObj; SelectedObjectData: TYPE = GGModelTypes.SelectedObjectData; SelectionClass: TYPE = GGModelTypes.SelectionClass; SelectMode: TYPE = GGModelTypes.SelectMode; SequenceOfReal: TYPE = GGCoreTypes.SequenceOfReal; Slice: TYPE = GGModelTypes.Slice; SliceBoundBoxProc: TYPE = GGModelTypes.SliceBoundBoxProc; SliceClass: TYPE = GGModelTypes.SliceClass; SliceClassObj: TYPE = GGModelTypes.SliceClassObj; SliceObj: TYPE = GGModelTypes.SliceObj; SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor; SliceParts: TYPE = GGModelTypes.SliceParts; StrokeEnd: TYPE = GGModelTypes.StrokeEnd; Transformation: TYPE = GGModelTypes.Transformation; Vector: TYPE = GGModelTypes.Vector; WalkProc: TYPE = GGModelTypes.WalkProc; MoveToProc: TYPE = ImagerPath.MoveToProc; LineToProc: TYPE = ImagerPath.LineToProc; CurveToProc: TYPE = ImagerPath.CurveToProc; ConicToProc: TYPE = ImagerPath.ConicToProc; ArcToProc: TYPE = ImagerPath.ArcToProc; Problem: PUBLIC SIGNAL [msg: Rope.ROPE] = Feedback.Problem; <> CircleData: TYPE = REF CircleDataObj; CircleDataObj: TYPE = RECORD [ <> circle: Circle, -- a representation of a unit circle (for the convenience of GGCircles.LineMeetsCircle) transform: Transformation, scale: Vector, -- cached value of ImagerTransformation.Factor[transform].s evenScaling: BOOL, simpleCircle: Circle, -- for CircleHitDataAsSimpleCurve inverse: Transformation, inverseScale: Vector, -- cached value of ImagerTransformation.Factor[inverse].s startPoint: Point, -- original point on circumference when circle was created fillColor: Color, forward: BOOL _ TRUE, -- that is, should be traversed in the normal cw order savedPointSelections: ARRAY CirclePoints OF SelectedObjectData, -- in order, origin, left, top, right, bottom seg: Segment ]; maxCirclePoints: INTEGER = 5; CirclePoints: TYPE = [0..maxCirclePoints); -- origin, left, top, right, bottom CircleParts: TYPE = REF CirclePartsObj; CirclePartsObj: TYPE = RECORD [ cpArray: ARRAY CirclePoints OF BOOL, -- used when origin or CPs are selected <> outline: BOOL -- TRUE if outline itself is in parts ]; CircleHitData: TYPE = REF CircleHitDataObj; CircleHitDataObj: TYPE = RECORD [ index: [-1..maxCirclePoints), -- records index of which origin or CP is hit. -1 => no hit hitPoint: Point, outline: BOOL -- TRUE if outline itself is hit ]; Props: TYPE = REF PropsRec; PropsRec: TYPE = RECORD [ localView: Transformation, strokeWidth: REAL _ 0.0, strokeEnd: StrokeEnd _ round, dashed: BOOL _ FALSE, -- dashed stroke properties pattern: SequenceOfReal, offset: REAL _ 0.0, length: REAL _ 0.0, color: Imager.Color, fillColor: Imager.Color, fillIsSampled: BOOL _ FALSE, fillLocal: Transformation ]; BuildCircleSliceClass: PUBLIC PROC [] RETURNS [class: SliceClass] = { OPEN GGSlice; class _ NEW[SliceClassObj _ [ type: $Circle, unlink: GGSlice.UnlinkSlice, -- circle data doesn't have links <> getBoundBox: CircleGetBoundBox, getTransformedBoundBox: GGSlice.GenericTransformedBoundBox, getTightBox: CircleGetTightBox, copy: CircleCopy, restore: CircleRestore, <> buildPath: CircleBuildPath, drawBorder: CircleDrawBorder, drawParts: CircleDrawParts, drawTransform: CircleDrawTransform, drawSelectionFeedback: CircleDrawSelectionFeedback, drawAttractorFeedback: CircleDrawAttractorFeedback, saveSelections: CircleSaveSelections, remakeSelections: CircleRemakeSelections, <> transform: CircleTransform, <> describe: CircleDescribe, describeHit: CircleDescribeHit, fileout: CircleFileout, filein: CircleFilein, <> isEmptyParts: CircleIsEmptyParts, isCompleteParts: CircleIsCompleteParts, newParts: CircleNewParts, unionParts: CircleUnionParts, differenceParts: CircleDiffParts, movingParts: CircleMovingParts, augmentParts: CircleAugmentParts, alterParts: CircleAlterParts, setSelectedFields: NoOpSetSelectedFields, <> pointsInDescriptor: CirclePointsInDescriptor, walkPointsInDescriptor: CircleWalkPointsInDescriptor, pointPairsInDescriptor: NoOpPointPairsInDescriptor, segmentsInDescriptor: CircleSegmentsInDescriptor, walkSegments: CircleWalkSegments, nextPoint: CircleNextPoint, nextPointPair: NoOpNextPointPair, nextSegment: CircleNextSegment, <> closestPoint: CircleClosestPoint, closestJointToHitData: CircleClosestJointToHitData, closestPointAndTangent: NoOpClosestPointAndTangent, closestSegment: CircleClosestSegment, filledPathsUnderPoint: CircleFilledPathsUnderPoint, lineIntersection: CircleLineIntersection, circleIntersection: NoOpCircleIntersection, hitDataAsSimpleCurve: CircleHitDataAsSimpleCurve, <