Document Viewer

« Back

HandsOn: Visualisation - Attribute Dependent Notation

Hands On: Visualisation - Attribute Dependent Graphical Notation

The following snipplet shows how to configure the GraphRep of a class to enable attribute dependent-graphical notation. The value of the attribute "Type" is used to show different representation using a switch statement implemented as an IF ELSIF ELSE construct.

GRAPHREP layer:-1 sizing:asymmetrical
# select type for color
AVAL atype:"Type-Selection" 
# set default color
SET f:"white"
IF (atype = "type-1")
   SET f:"blue"               # if type 1 selected => color is blue
ELSIF (atype = "type-2")
   SET f:"yellow"             # if type 2 selected => color is yellow
ELSIF (atype = "type-3")
   SET f:"red"                # if type 3 selected => color is red
FILL color:(f)                # set color with variable
# drawing main box
RECTANGLE x:-3cm y:-3cm w:6cm h:6cm
ATTR "V-Text" x:-0cm y:-2.5cm w:c:5.5cm h:t:5cm  # type text from atribute "V-Text"