DIRECTORY ChoiceButtons USING [EnumTypeRef], Containers USING [Container], Imager USING [Box, Rectangle, VEC], ImagerColor USING [RGB], ImagerFont USING [Font], Menus USING [Menu], Real USING [NonTrappingNaN], Rope USING [ROPE], TiogaOps USING [Ref], ViewerClasses USING [Viewer]; Graph: CEDAR DEFINITIONS = { NumberOfColors: INT = 16; LastEntityColor: INT = 12; NumberOfFonts: INT = 12; NullBox: Imager.Box = [0.0, 0.0, 0.0, 0.0]; NullRect: Imager.Rectangle = [0.0, 0.0, 0.0, 0.0]; NullVec: Imager.VEC = [0.0, 0.0]; UnitLineWidth: REAL = 1.0; NtNan: REAL = Real.NonTrappingNaN; Viewer: TYPE = ViewerClasses.Viewer; ROPE: TYPE = Rope.ROPE; ColorIndex: TYPE = INT[0..NumberOfColors); EntityColor: TYPE = ColorIndex[1..LastEntityColor]; FontIndex: TYPE = INT[0..NumberOfFonts); GraphColors: TYPE = REF GraphColorsArray; GraphColorsArray: TYPE = ARRAY ColorIndex OF ImagerColor.RGB; GraphFonts: TYPE = REF GraphFontsArray; GraphFontsArray: TYPE = ARRAY FontIndex OF GraphFont; GraphFont: TYPE = RECORD[ family: ROPE _ NIL, bold, italic: BOOL _ FALSE, vFontSize: INT _ 12, pFontScale: REAL _ 13.0 ]; Texts: TYPE = LIST OF Text; Text: TYPE = REF TextRec; TextRec: TYPE = RECORD[ text: ROPE _ NIL, place: Imager.VEC _ [0.0, 0.0], -- location relative to origion and size of curvebox fontIndex: FontIndex _ 0, colorIndex: ColorIndex _ 0, rotation: REAL _ 0.0, -- angle of rotation, ccw, in degrees. justifX: JustifX _ left, justifY: JustifY _ bottom, id: INT _ 0 -- must be unique among all texts. ]; JustifX: TYPE = {left, center, right}; JustifY: TYPE = {top, center, bottom}; EntityList: TYPE = LIST OF Entity; CurveList: TYPE = EntityList; Entity: TYPE = REF EntityRec; Curve: TYPE = Entity; EntityRec: TYPE = RECORD[ name, comment: ROPE _ NIL, colorIndex: ColorIndex _ 0, mark: Mark _ none, width: REAL _ UnitLineWidth, oldValues: ValueList _ NIL, group: EntityGroup _ NIL, parent: NestedEntities _ NIL, id: INT _ 0, -- unique among entities. segments: SegmentDataList _ NIL, -- nil iff entity not plotted. lastValue: ValueList _ NIL, lastSegment: SegmentDataList _ NIL ]; ValueList: TYPE = LIST OF REAL; Mark: TYPE = {none, round, square, diamond, cross, dollar, percent}; -- 013X$% SegmentDataList: TYPE = LIST OF SegmentData; SegmentData: TYPE = REF SegmentDataRec; SegmentDataRec: TYPE = RECORD [ok: BOOL _ FALSE, end, nx, ny, d0: REAL _ 0.0]; EntityGroup: TYPE = REF EntityGroupRec; EntityGroupRec: TYPE = RECORD [ x: Entity _ NIL, -- x is not in ys or children. ys: NestedEntities _ NIL, id, length: INT _ 0 ]; NestedEntitiesList: TYPE = LIST OF NestedEntities; NestedEntities: TYPE = REF NestedEntitiesRec; NestedEntitiesRec: TYPE = RECORD[ name, comment: ROPE _ NIL, entityList: EntityList _ NIL, parent: NestedEntities _ NIL, children: NestedEntitiesList _ NIL, node: TiogaOps.Ref _ NIL -- ** readonly for client. ]; GRAPH: TYPE = REF GraphRec; GraphRec: TYPE = RECORD [ entityList: EntityList _ NIL, texts: Texts _ NIL, bounds: Imager.Box _ NullBox, -- [xmin, ymin, xmax, ymax] fileName: ROPE _ NIL, -- suggested file name to save the graph. auto: ARRAY AutoType OF BOOL _ ALL[TRUE], -- true: on. division: ARRAY XY OF INT _ ALL[5], caret: ARRAY CaretIndex OF CaretSpec _ ALL[NIL], showSlope: BOOL _ FALSE, target: ARRAY XY OF TargetSpec _ ALL[NIL], grids: ARRAY XY OF BOOL _ ALL[FALSE], -- true: on. color: GraphColors _ NIL, font: GraphFonts _ NIL ]; CaretIndex: TYPE = {primary, secondary, text}; CaretSpec: TYPE = REF CaretSpecRec; CaretSpecRec: TYPE = RECORD[ place: Imager.VEC _ NullVec, on: BOOL _ FALSE ]; XY: TYPE = {x, y}; TargetSpec: TYPE = REF TargetSpecRec; TargetSpecRec: TYPE = RECORD[ value: REAL _ 0.0, width: REAL _ UnitLineWidth, colorIndex: ColorIndex _ 13, on: BOOL _ FALSE ]; AutoType: TYPE = {divisions, bounds}; GraphHandle: TYPE = REF GraphHandleRec; -- the root of everything GraphHandleRec: TYPE = RECORD[ allTexts: Texts _ NIL, entityGroupList: EntityGroupList _ NIL, entityHash: EntityHash _ NIL, controller: Controller _ NIL, -- nil iff no controller viewer. chart: Chart _ NIL, graph: Graph.GRAPH _ NIL, userEditAllowed: BOOL _ TRUE, mergingBounds: BOOL _ FALSE, boundsToMerge: Imager.Box _ NullBox, lastTextId, lastEntityId: INT _ -1, lastEntityColor: EntityColor _ LastEntityColor, imagerFonts: ARRAY OutputType OF Fonts _ ALL[NIL], zoomPt1, zoomPt2: RECORD[set: BOOL _ FALSE, x, y: REAL _ 0.0] _ [], backgroundIndex: BackgroundIndex _ gray, -- for display only. colorMap: ColorMap _ mine, colorMode: ColorMode _ color, realRect, axesRect: Imager.Rectangle _ NullRect, scale, step: ARRAY XY OF REAL _ ALL[0.0], normalLegend: BOOL _ TRUE, waitingGraph: BOOL _ FALSE, selectProcId: INT _ 0, selectProc: PROCESS _ NIL, locked: BOOL _ FALSE, unlocked: CONDITION ]; Chart: TYPE = REF ChartRec; -- graph viewer and its data ChartRec: TYPE = RECORD[ viewer: Viewer _ NIL, caretState: ARRAY CaretIndex OF CaretState _ ALL[NIL], dirty: BOOL _ FALSE, autoRepaint: BOOL _ TRUE, selectedText: Text _ NIL, selectedEntity: Entity _ NIL, selectedEntityGroup: EntityGroup _ NIL -- no use in this version. ]; CaretState: TYPE = REF CaretStateRec; CaretStateRec: TYPE = RECORD[ x, y: INTEGER _ 0, visible, toBlink: BOOL _ FALSE ]; Controller: TYPE = REF ControllerRec; -- controller viewer and its data ControllerRec: TYPE = RECORD[ viewer: Viewer _ NIL, menu: Menus.Menu _ NIL, spec, xys: Containers.Container _ NIL, rule, table: Viewer _ NIL, specVisible, xysVisible, tableVisible: BOOL _ FALSE, textsParent: TiogaOps.Ref _ NIL, swDivisions, divX, divY, swBounds, xmin, ymin, xmax, ymax: Viewer _ NIL, swCaret: ARRAY CaretIndex OF Viewer _ ALL[NIL], caretPlace: ARRAY CaretIndex OF ARRAY XY OF Viewer _ ALL[ALL[NIL]], swSlope, slope: Viewer _ NIL, swTarget, targetValue, targetWidth, targetColor: ARRAY XY OF Viewer _ ALL[NIL], swGrid: ARRAY XY OF Viewer _ ALL[NIL], colorIndex, red, green, blue, fontIndex, fontFamily, swBold, swItalic, vFontSize, pFontScale, textId, textContent, textPlaceX, textPlaceY, textColor, textFont, textRotation, entityId, entityName, entityCmt, entityColor, entityWidth, entityMark, --entityGroupId, --entityValues, xyLabel, idOfy, xsecLabel, xat, values, argument: Viewer _ NIL, justifXRef, justifYRef, markRef, operandRef, angleRef: ChoiceButtons.EnumTypeRef _ NIL, auto: ARRAY AutoType OF BOOL _ ALL[TRUE], caretOn: ARRAY CaretIndex OF BOOL _ ALL[FALSE], targetOn, gridOn: ARRAY XY OF BOOL _ ALL[FALSE], slopeOn, boldOn, italicOn: BOOL _ FALSE, justifX: JustifX _ center, justifY: JustifY _ bottom, mark: Mark _ none, operand: Operand _ y, angle: Angle _ radians ]; Fonts: TYPE = REF FontArray; FontArray: TYPE = ARRAY FontIndex OF ImagerFont.Font; EntityGroupList: TYPE = LIST OF EntityGroup; ControlAction: TYPE = {resume, update, remove, next, find, noop}; Operand: TYPE = {y, plottedYs, allX}; Angle: TYPE = {degrees, radians}; EntityHashSize: INT = 128; HashIndex: TYPE = INT[0..EntityHashSize); EntityHash: TYPE = REF EntityHashArray; EntityHashArray: TYPE = ARRAY HashIndex OF EntityList; BackgroundIndex: TYPE = {white, gray, darkGray, black, unknown}; ColorMode: TYPE = {color, bw}; ColorMap: TYPE = {mine, cedar, default, replace}; MaxStep: CARDINAL = 6; StepCount: TYPE = INTEGER[0..MaxStep); BWLineState: TYPE = REF LineStateRec; LineStateRec: TYPE = RECORD[ step: StepCount _ 0, progress: REAL _ 0.0 ]; PaintInfo: TYPE = REF PaintInfoRec; PaintInfoRec: TYPE = RECORD[ action: PaintAction _ paint, output: OutputType _ screen, data: SELECT item: PaintItem FROM all => [clear, updateDivBds: BOOL _ TRUE], -- clear: to clear screen or not allCurves => [clear: BOOL _ TRUE], rectangle => [ clear, updateDivBds: BOOL _ TRUE, rect: Imager.Rectangle _ NullRect], graphText => [text: Text _ NIL], graphEntity => [entity: Entity _ NIL], legend => [entity: Entity _ NIL, onlyOne: BOOL _ TRUE], tails => [ x1, x2: REAL _ 0.0, v1, v2: ValueList _ NIL, entities: EntityList _ NIL], target => [xy: XY _ x], grid => [xy: XY _ x, long: BOOL _ TRUE], ENDCASE ]; PaintAction: TYPE = {erase, paint}; OutputType: TYPE = {interpress, screen}; PaintItem: TYPE = {all, allCurves, rectangle, graphText, graphEntity, legend, tails, target, grid}; GraphProc: TYPE = PROC [handle: GraphHandle]; Error: SIGNAL[atom: ATOM, info: ROPE _ NIL]; }. CHANGE LOG. SChen, created at October 9, 1985 5:50:27 pm PDT. 4File: Graph.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last Edited: Sweetsun Chen, November 25, 1985 10:27:45 pm PST Pradeep Sindhu April 8, 1986 10:46:41 am PST constants types texts curves If not ok then the following is meaning less. where nx and ny are the components of the unit normal vector, i.e., (sinq, -cosq); d0 is the distance of the line (not the segment) to the origin; end is the value at the right end point of the segment; all in terms of real coordinates. id must be unique among entity groups, of no use for now; length is the number of values on each entity in the group. graph CrosshairState: TYPE = RECORD[size: CrossHairSize _ nil, place: Imager.VEC _ [0.0, 0.0]]; CrosshairSize: TYPE = {nil, small, big}; texts and entities vars useful for drawing paintInfo: PaintInfo _ NIL, All refer to the axes box. But realRect is for real data; and axesRect is for screen. scale = (d screen)/(d real); step is the step size betw ticks (for real data). meaningful to GraphEdit.SelectEntity and GraphEdit.ClosestEntity. lock "visible" here means that it can be seen on the chart at this moment. it may be termperarily false (disappear) due to blinking effect. blinking can be manifested only if graph.caret[index].visible is true. groupId, groupName, xId, yIds, curve hash table signal Κ ˜Jšœ™Jšœ Οmœ1™<šœ ™ Jšœ0™0Icode™,—J˜šΟk ˜ Jšœžœ˜"Jšœ žœ ˜Jšœžœžœ˜#Jšœ žœžœ˜Jšœ žœ˜Jšœžœ˜Jšœžœ˜Jšœžœžœ˜Jšœ žœ˜Jšœžœ ˜—J˜Jšœžœž œ˜J˜Jšœ ™ Jšœžœ˜Jšœžœ˜Jšœžœ˜Jšœ+˜+Jšœ2˜2Jšœžœ˜!Jšœžœ˜Jšœžœ˜"J˜Jšœ™Jšœžœ˜$Jšžœžœžœ˜Jšœ žœžœ˜*Jšœ žœ"˜3Jšœ žœžœ˜(Jšœ žœžœ˜)Jš œžœžœ žœ žœ˜=Jšœ žœžœ˜'Jšœžœžœ žœ ˜5šœ žœžœ˜Jšœžœžœ˜Jšœžœžœ˜Jšœ žœ˜Jšœ žœ˜J˜—J™J™Jšœžœžœžœ˜šœžœžœ ˜J˜šœ žœžœ˜Jšœžœžœ˜JšœžœΟc4˜TJšœ˜Jšœ˜Jšœ žœŸ&˜Jšœžœ˜Jšœ žœžœ˜J˜Jšœžœžœ˜Jšœžœžœ˜J˜$Jšœžœ˜#Jšœ/˜/Jš œ žœ žœ žœžœ˜2J˜Jšœ™Jš œžœžœžœžœ ˜CJšœ)Ÿ˜=Jšœ˜J˜Jšœžœ™šœ0˜0JšœU™U—š œ žœžœžœžœžœ˜)JšœN™N—Jšœžœžœ˜J˜Jšœžœžœ˜Jšœžœ˜šœ žœžœ˜JšœA™A—J™Jšœžœžœ˜Jšœ ž ˜J˜—J˜Jšœžœžœ Ÿ˜8šœ žœžœ˜Jšœžœ˜Jš œ žœ žœžœžœ˜6Jšœžœžœ˜Jšœ žœžœ˜Jšœžœ˜Jšœžœ˜Jšœ#žœŸ˜AJ˜J˜Jšœ žœžœ˜%šœžœžœ˜Jšœžœ˜Jšœžœž˜JšœE™EJ™@JšœF™FJ˜——J˜Jšœ žœžœŸ!˜Gšœžœžœ˜Jšœžœ˜Jšœžœ˜Jšœ"žœ˜&Jšœžœ˜J˜Jšœ'žœžœ˜4Jšœžœ˜ J˜Jšœ˜Jšœ+žœ˜/Jš œ žœ žœ žœžœ˜/Jšœ žœ žœžœžœžœ žœžœžœ˜CJšœžœ˜Jš œ1žœžœžœ žœžœ˜OJš œžœžœžœ žœžœ˜&Jšœ˜Jšœ?˜?JšœO˜OJšœGŸœ ˜gJšœ™J˜Jšœ'˜'Jšœžœ˜J˜JšœSžœ˜WJ˜Jš œžœ žœžœžœžœ˜)Jš œ žœ žœžœžœžœ˜/Jš œžœžœžœžœžœžœ˜0Jšœžœžœ˜(Jšœ˜Jšœ˜J˜Jšœ˜Jšœ˜J˜—J˜Jšœžœžœ ˜Jšœ žœžœ žœ˜5J˜Jšœžœžœžœ ˜,Jšœžœ.˜AJšœ žœ˜%Jšœžœ˜!J˜J™Jšœžœ˜Jšœ žœžœ˜)Jšœ žœžœ˜'Jšœžœžœ žœ ˜6J˜Jšœžœ+˜@Jšœ žœ˜Jšœ žœ#˜1Jšœ žœ˜Jšœ žœžœ ˜&Jšœ žœžœ˜%šœžœžœ˜Jšœ˜Jšœ žœ˜J˜—J™Jšœ žœžœ˜#šœžœžœ˜Jšœ˜J˜šœžœž˜!JšœžœžœŸ ˜KJšœžœžœ˜"˜Jšœžœžœ˜!Jšœ#˜#—Jšœžœ˜ Jšœ!žœ˜&Jšœžœ žœžœ˜7šœ ˜ Jšœžœ˜Jšœžœ˜Jšœžœ˜—Jšœžœ˜Jšœ žœ žœžœ˜(Jšž˜—˜J˜——Jšœ žœ˜#Jšœ žœ˜(Jšœ žœT˜cJ˜JšΟn œžœžœ˜-J™J™Jš œžœžœžœžœ˜,J™J˜J˜šžœžœ˜ Jšœ-žœ˜1——…— b3%