# Theory

## GraphRep

The class attribute GRAPHREP is of type LONGSTRING, hence the attribute value is a text that is interpreted as a script by the GRAPHREP interpreter.
The following types of elements are distinguished:
• Style elements
• Shape elements
• Variable assigning elements
• Context elements
• Control elements.
The representation characteristic for following shape elements is modified by style elements:
• PEN sets the characteristics of the outline pen for shape elements.
• FILL sets the characteristics of the fill-in brush for shape elements.
• STRETCH switches geometric stretching on or off.
• FONT sets the font for displayed texts and attribute values.
PEN determines in which manner the lines and curves are drawn, i.e. how strong, in which color and in which style (e.g. dashed line). For  shape elements which can be filled, only the outline of the shape is influenced by the current pen. The filling of shapes is controlled by the current fill-in brush, which can be set with BRUSH.

Shape elements which can not be filled are POINT, LINE, POLYLINE, ARC and CURVE. Fillable elements are RECTANGLE, POLYGON, ELLIPSE, PIE and COMPOUND. For shape elements coordinates (positions) have to be specified. Coordinates here are relative to the position of the particular object, i.e. they are added to the object's position.

Context elements just exist for relations. They specify whether the starting, the middle or the endpoint of the relation is being defined. Keyword "START" defines that the following description refers to the start point of the relation until the next context element START/MIDDLE/END is specified. A fourth context element (EDGE) triggers the drawing of a relation's edge. This is the line from the starting point via possible bendpoints to the end point of a relation.

For relations the starting, the middle and the end (point) can be defined. Positions then refer to one of these three points. However, the coordinate system is rotated depending on the direction of the relation instance. On defining a relation's GraphRep, you have to regard the relation as going horizontally from the left to the right. The coordinate system's origin then is the point of the relation for which the graphical representation currently is being defined, i.e. start, middle or end point.

On the x-axis the coordinate values increase from the left to the right, on the y-axis they increase from top to bottom (differing from mathematics). Arcs and pies are rotated counter-clockwise.

The unit of measure for positions and proportions (cm or pt) has to be specified in every case. Pixel values cannot be used.

On the drawing of an object, the elements are processed sequentially. However, the control elements make it possible to skip sections during the element processing depending on variables. For example, attribute values of the object to be represented may be assigned to such variables. A graphical representation depending on object attributes can thus be obtained using variable assignment elements combined with control elements. Additional possibilities are given from using variables in graphical element.

### GraphRep Coordinate System

A coordinate plane is used to provide an exact positioning of the GraphRep elements. It is composed of:
• The null coordinate is in the middle
• Positive values go to the right and down
• Negative values go to the left and up

GraphRep coordinates system

It is required to specify the Unit (cm or pt). Units in pixels are not possible.
The direction of rotation progresses counter-clockwise!

Graph Elements

Edge | Start | Middle | End |
Pen | Fill | Shadow | Stretch | Map | Font |
ClipRect | ClipRoundRect | ClipPoly | ClipEllipse | ClipOff |
Point | Line | PolyLine | Arc | Bezier | Curve |
Rectangle | RoundRect | Polygon | Ellipse | Pie |
BeginPath | MoveTo | LineTo | BezierTo | EndPath | DrawPath |
Compound | Bitmap | GradientRect | GradientTri | Text | Attr | Hotspot |
Set | Aval | Table | TextBox | AttrBox | BitmapInfo |
IfStatement | WhileStatement | ForNumStatement | ForTokenStytement | Execute

### Some GraphRep Commands

GRAPHREP
The GraphRep definition must start with this command to be valid. The parameter layer defines whether an object will be displayed above or below other objects. The parameter sizing specifies if the size can be changed.
Specifies if the class will have a shadow or if it should be drawn "flat".
PEN
Defines the pens width/color/style.
FILL
Defines the fill color/style and transparency.
ATTR
Shows an attribute value on the drawing area (e.g. object name).
POINT
Draws a point.
LINE / POLYLINE
Draws a single line (LINE) or several lines (POLYLINE).
CURVE / ARC
Draws a curve according to a mathematical function or an arc.
POLYGON
Draws a polygon consisting of several straight lines where each corner is defined as a single point.
RECTANGLE / ROUNDRECT / ELLIPSE / PIE
A rectangle, rectangle with rounded edges, an ellipse or a segment of an ellipse.
COMPOUND
A composite filled Form (from LINE, POLYLINE und CURVE-Elements).
TEXT
Allows to show a specific text on the drawing area (Letters, Symbols …).
FONT
Defines the font style/color for drawn text.
BITMAP
Allows to embed a picture (*.BMP-Format).
TABLE
Creates a table for structuring the attribute representation of an object.
SET
Sets a variable with a constant or the result of an expression, which in turn can contain variables.
AVAL
Sets variables with the values from an attribute of the instantiated object.
IF / ELSIF / ELSE / ENDIF
Allows to change the representation based on values.
BITMAPINFO
Reads the height and width of a bitmap file, allowing to properly represent it.
TEXTBOX / ATTRBOX
Similar to TEXT and ATTR. However instead of drawing the values it sets specific variables with the rectangle area they would need.