The graphical representation of a GraphElement is largely derived from the semantic model (see below) and not explicitly stored in the DI metamodel to avoid redundancy. For example, the knowledge of drawing a class as a rectangle is not stored in the DI metamodel. Note that its position and its size, if needed, are stored. A drawing tool and the XSL stylesheet must have the semantic knowledge of drawing these elements correctly.
LeafElements can be utilized to represent model elements with special optional representation, e.g., actors. If a GraphNode representing an actor has the presentation of the SemanticModelBridge set to UserDefined (see below), it must have a LeafElement as child. This LeafElement represents the user-defined visualization of the actor.
A LeafElement can be a TextElement to show a simple text, a GraphicPrimitive to show a simple drawing such as an ellipse or an Image to show an external resource.
Two basic specialized graphic primitives are part of this specification: Polyline and Ellipse. Other graphic primitives can be defined in an extra package and inherit from the class GraphicPrimitive or its subclasses. TextElements are employed to represent parts of attributes, operations, names, and other texts which are part of model elements. For example, the visibility of an attribute can be a text such as "public" or "+". This text is stored in the attribute text of the TextElement. The container GraphNode of this TextElement has a link to the semantic model in the form of a SimpleSemanticModelElement. This indicates the part of the attribute which is being referenced. The attribute typeInfo of the SimpleSemanticModelElement contains visibility in this example. Naming rules for the attribute typeInfo are described in section `additional semantic information' below. Figure 6 illustrates the relevant part of the objects involved. The SimpleSemanticModelElement of the GraphNode name is not shown in this figure.
If the visibility is to be represented by an icon, the TextElement is replaced by another LeafElement. If the icon is stored as an image in another file, the LeafElement is an Image referencing that file.
LeafElements which are used many times are only needed to be instantiated once. These LeafElements are directly contained by the Diagram. Every time such a LeafElement is used, a Reference referencing this LeafElement is instantiated instead of a copy of the LeafElement. The isIndividualRepresentation flag is set to true to distinguish this usage of the Reference from the usages described below. This avoids multiple copies of the same visual component.