DIRECTORY Imager USING [Context, Color], Complex USING [Vec], FitBasic USING [Handle], FitStateUtils USING [SampleProc], IO USING [STREAM]; FitIO: CEDAR DEFINITIONS = { Handle: TYPE = FitBasic.Handle; Context: TYPE = REF ContextRec; ContextRec: TYPE = RECORD[ imager: Imager.Context, magnify: REAL, position: Complex.Vec, feedback: Feedback, logActions: BOOLEAN _ TRUE, log: IO.STREAM ]; Feedback: TYPE = REF FeedbackRec; FeedbackRec: TYPE=RECORD [ color: Imager.Color, sampleSize: REAL _ 1, jointSize: REAL _ 2, nodeLength: REAL _ 2, nodeLineWidth: REAL _ 0, lineWidth: REAL _ 0 --for DrawSamples and DrawContour ]; GetContext: PROC RETURNS [Context]; SetContext: PROC[context: Context]; TTY: PROC RETURNS[IO.STREAM] = INLINE {RETURN[GetContext[].log]}; SetFeedback: PROC[feedback: Feedback]; DrawSamples: PROC [handle: Handle, all: BOOLEAN _ FALSE, fill: BOOLEAN _ FALSE]; MarkSamples: PROC [handle: Handle, all: BOOLEAN _ FALSE]; MarkNodes: PROC [handle: Handle, all: BOOLEAN _ FALSE]; MarkJoints: PROC [handle: Handle, all: BOOLEAN _ FALSE]; --joints between the cubic pieces DrawContour: PROC [handle: Handle, all: BOOLEAN _ FALSE, fill: BOOLEAN _ FALSE]; MarkNode: FitStateUtils.SampleProc; --actual procedures used by MarkSamples and MarkNodes MarkSample: FitStateUtils.SampleProc; NoLog: SIGNAL; StartLog: PROC [stream: IO.STREAM _ NIL]; StopLog: PROC[close: BOOLEAN _ TRUE]; MagnifyData: PROC[scale: REAL]; PositionData: PROC[trans: Complex.Vec]; MagnifyPoint: PROC [p: Complex.Vec] RETURNS[Complex.Vec]; --magnify and position UnMagnifyPoint: PROC [p: Complex.Vec] RETURNS[Complex.Vec]; --undo magnify and position }. PFitIO.mesa Maureen Stone June 25, 1984 4:47:01 pm PDT Marks: For samples and joints the mark is a dot For nodes the mark is a line normal to the tangent direction or an X if the tangent is (0,0) For sizes, 0 is as small as possible for current device Samples, Nodes and Contours: Samples are the list of input datapoints. Contours are the computed curves. The handle contains a list of Sample, Contour pairs. The all flag controls whether you want to apply the procedure to the current pair or all the pairs. Some samples are also marked as nodes, or potential knots for the spline fitting calculations Logs: Data is stored by logging the actions used to draw it. Format is suitable for driving JaM interface and includes the semantics of marks, not their feedback. SetFeedBack command is recorded. Magnify and Position apply to logs Procedures work on the current context. May automatically log actions treat samples as vertices of a polygon or a broken line IF stream=NIL uses previous stream. Otherwise, closes previous stream (if any) and sets current output stream to stream. If there is no previous stream SIGNALS NoLog IF close=FALSE just disables logging. Views of the data: It may be interesting to view the data at a different size or position. However, transforming the Imager Context would affect the mark and linewidth sizes. For many cases the right thing to do is actually modify the data using the procedures in FitState. These are the procedures for when it is inconvenient to change the data. scales the view of the data but not the marks, linewidth or distance from data to the origin This is an absolute number with respect to the data. Reset the magnify by MagnifyData[1]; Positions the data with respect to the origin of the context. This is an absolute with respect to the Imager client coordinates. Reset by PositionData[0,0]; Ê#˜Jšœ ™ Jšœ*™*šÏk ˜ Jšœœ˜Jšœœ˜Jšœ œ ˜Jšœœ˜!Jšœœœ˜J˜—Jšœœ˜Jšœœ˜Jšœ œ ˜šœ œœ˜Jšœ˜Jšœ œ˜Jšœ˜J˜Jšœ œœ˜Jšœœ˜Jšœ˜J˜—Jšœ œœ ˜!šœ œœ˜J˜Jšœ œ˜Jšœ œ˜Jšœ œ˜Jšœœ˜Jšœ œÏc!˜5J˜J˜—JšÏn œœœ ˜#JšŸ œœ˜#JšÐbkœœœœœœœ˜AJ˜J™™J™(J™\Jšž7™7—™J™LJ™™J™]—™J™6J™ªJ™—JšœF™FJšŸ œœ˜&š Ÿ œœœœœœ˜PJšž7™7—JšŸ œœœœ˜9JšŸ œœœœ˜7Jš Ÿ œœœœž!˜ZJš Ÿ œœœœœœ˜PJšŸœž5˜ZJšŸ œ˜%Jšœœ˜š Ÿœœ œœœ˜)Jšœœœ™©—šŸœœœœ˜%J™%—J˜™J™Ê—šŸ œœœ˜Jšž\™\J™Z—šŸ œœ˜'Jšž=™=J™BJ™—JšŸ œœœž˜QJšŸœœœž˜XJš˜—…—fÙ