Visualizer Advanced configuration - nikonovd/megalib GitHub Wiki

Advanced configuration

The visualizer provides different export types to visualize MegaL models. For instance, there exist graphviz and yed implementations, although using the yed implementation result in an erroneous behavior as it is not yet implemented and only exists for demonstration purposes.

However any export type provided to the visualizer project is allowed to use advanced configuration techniques, e.g. to create a different style sheet. For concrete configuration options, see the following.

Graphviz/DOT configuration

The graphviz visualizer adapter provides capabilites to modify the color and the shape of the resulting graph nodes. The configuration is provided using a properties file that has to be placed in the same directory as the visualizer binary and its name shall be graphviz.properties

The properties file stores key value pairs in the following syntax:

Entity.color=red
Entity.shape=polygon

In an abstract view, the configuration allows you to define shape and color properties for every type of MegaL entities. For instance, the graphviz adapter uses a hierarchical configuration style, it determines the concrete style sheet for every node in the following way:

Node name -> Node type -> type's supertype* -> default style sheet

Using this hierarchical structure one could define the following style sheet configuration:

?aNode.color=blue
?aNode.shape=oval
Artifact.color=red
Artifact.shape=...
Entity.color=...
Entity.shape=...

In this example, if a MegaL model defines an Artifact named ?aNode, its hierarchical configuration determination process would do the following lookup:

?aNode -> Artifact -> Entity -> default style sheet

This lookup is executed for every Node within the resulting graph.

Note: Function defintions and their corresponding applications are of type FunctionDefinition and FunctionApplication.

By this structure, one is able to define a default style sheet for a concrete supertype and be more specific in the subtype tree.

The default style sheet for graphviz is color=black and shape=oval

An example configuration file is to be looked up here.