File: Graph.mesa, Copyright © 1985 by Xerox Corporation. All rights reserved.
Last Edited:
Sweetsun Chen, October 23, 1985 6:43:41 pm PDT
DIRECTORY
Imager USING [Box, Rectangle, VEC],
ImagerColor USING [RGB],
Rope USING [ROPE],
TiogaOps USING [Ref],
ViewerClasses USING [Viewer];
Graph: CEDAR DEFINITIONS = {
constants
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;
types
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
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};
curves
EntityList: TYPE = LIST OF Entity;
Entity: TYPE = REF EntityRec;
EntityRec:
TYPE =
RECORD[
name: ROPE ← NIL,
colorIndex: ColorIndex ← 0,
mark: Mark ← none,
width: REAL ← UnitLineWidth,
oldValues: ValueList ← NIL,
group: EntityGroup ← NIL,
parent: NestedEntities ← NIL,
id: INT ← 0, -- id must be unique among entities.
** following field are readonly for client
segments: SegmentDataList ← NIL -- ** readonly for client. nil iff entity not plotted.
];
ValueList: TYPE = LIST OF REAL;
Mark: TYPE = {none, round, square, diamond, cross, dollar, percent}; -- Ë¡. $%
SegmentDataList: TYPE = LIST OF SegmentData;
SegmentData: TYPE = REF SegmentDataRec;
SegmentDataRec:
TYPE =
RECORD [end, nx, ny, d0:
REAL ← 0.0];
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.
EntityGroup:
TYPE =
REF EntityGroupRec;
EntityGroupRec:
TYPE =
RECORD [
x: Entity ← NIL, -- x is not in ys or children.
ys: NestedEntitiesList ← NIL,
id, length:
INT ← 0,
id must be unique among entity groups;
length is the number of values on each entity of the same nesting level
node: TiogaOps.Ref ← NIL -- ** readonly for client.
];
NestedEntitiesList: TYPE = LIST OF NestedEntities;
NestedEntities: TYPE = REF NestedEntitiesRec;
NestedEntitiesRec:
TYPE =
RECORD[
name: ROPE ← NIL,
entityList: EntityList ← NIL,
parent: NestedEntities ← NIL,
children: NestedEntitiesList ← NIL
];
graph
GRAPH:
TYPE =
REF GraphRec;
GraphRec:
TYPE =
RECORD [
entityList: EntityList ← NIL,
fileName: ROPE ← NIL, -- suggested file name to save the graph.
size: RECORD[w: REAL ← , h: REAL ← ] ← [],
texts: Texts ← NIL,
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.
division: ARRAY XY OF INT ← ALL[0],
bounds: Imager.Box ← NullBox, -- [xmin, ymin, xmax, ymax]
auto: ARRAY AutoType OF BOOL ← ALL[TRUE], -- true: on.
color: GraphColors,
font: GraphFonts
];
CaretIndex: TYPE = {primary, secondary, text};
CaretSpec: TYPE = REF CaretSpecRec;
CaretSpecRec:
TYPE =
RECORD[
place: Imager.VEC ← NullVec,
on: BOOL ← FALSE
];
CrosshairState: TYPE = RECORD[size: CrossHairSize ← nil, place: Imager.VEC ← [0.0, 0.0]];
CrosshairSize: TYPE = {nil, small, big};
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};
signals
Warning, Error: SIGNAL[atom: ATOM, info: ROPE ← NIL];
public vars
defaultColors: GraphColors;
defaultFonts: GraphFonts;
}.
CHANGE
LOG.
SChen, created at October 9, 1985 5:50:27 pm PDT.