It is possible to define a GraphRep which is used for drawing the background of the drawing area. Model attributes can be displayed on the drawing area Fields can be painted on the drawing area which may look like swimlanes but are not modeling objects.
To define a GraphRep for a model type, please follow the steps below:
Step 1: Prepare Class HierarchyIMPORTANT: The class __ModelTypeMetaData__ does not exist in the default library/empty library, it needs to be created manuallyas a sub-class of the __LibraryMetaData__.
Step 2: Define GraphRep AttributeAdd a class attribute of type STRING or LONGSTRING to the class "__ModelTypeMetaData__" of the dynamic library. This attribute will be used as GraphRep definition for the treated model type. You may choose any attribute name, e.g. "ModelTypeA model GraphRep" for a model type "ModelType A".
Step 3: Add a GraphRep Specification to ModelTypeAdd a graphrep specification to the model type defnition. The model type definition is contained in the library attribute "Modi". There you have to specify the name of the attribute which contains the GraphRep definition, e.g. graphrep:"ModelTypeA model GraphRep".
1MODELTYPE "ModelType A" ....graphrep:"ModelTypeA model GraphRep"
The model types's GraphRep is painted as first object in its layer. The layer index is specified at the GRPAHREP element in the model type's GraphRep. If a high layer index is specified at the model type's GraphRep, it is more a foreground than a background graphics. To draw a graphics which lies behind all objects, you have to specify the lowest index used at a modeling object's GraphRep. In the model type's GraphRep, model attributes can be accessed via ATTR and AVAL. This applies also for custom model attributes. (see custom model attributes
http://www.adoxx.org/live/en_GB/faq/-/message_boards/view_message/21615)
At a model type's GraphRep, the following variables are preset:
w -- the current drawing area width
h -- the current drawing area height
So the GraphRep may depened on the current drawing area size. That makes it possible to draw lanes across the whole width or height, or to place a text at the bottom of the drawing area.
Examples:Show the name, modeltype and count of objects and relations on the drawing area
1GRAPHREP layer:-1
2AVAL name:"Name" # model name
3AVAL type:"Type" # model type name
4AVAL count:"Number of objects and relations"
5SET y:0.5cm
6FONT "Verdana" h:24pt style:"outline" color:gray
7TEXT (name + " (" + type + ")") x:0.5cm y: (y) w:l h:t
8SET y: (y + 24pt + 0.3cm)
9FONT "Verdana" h:12pt color:gray
10TEXT ("Object count: " + count) x:0.5cm y: (y) w:l h:t
The following model type GraphRep displays the value of the attribute "Description" as headline and a copyright remark as footline. Also a vertical arrow is painted from the top to the bottom of the drawing area.
1GRAPHREP layer:-1
2SHADOW off
3# horizontal lane which is the description's background
4PEN color:$c0dd80
5FILL color:$e0ffa0
6RECTANGLE w: (w) h:2.5cm
7# description; width is drawing area width
8ATTR "Description" w: (w) h:2.5cm
9# vertical arrow
10PEN w:0.3cm color:$c0dd80
11LINE x1: (w - 2cm) y1:0.5cm x2: (w - 2cm) y2: (h - 0.5cm)
12POLYLINE 3 x1: (w - 3cm) y1: (h - 2cm)
13 x2: (w - 2cm) y2: (h - 0.5cm)
14 x3: (w - 1cm) y3: (h - 2cm)
15# copyright remark at the drawing area bottom
16FONT "Verdana" h:9pt color:$6060a0 italic
17TEXT "Creative Commons" x:0.2cm y: (h) h:b