A simple Example and Tutorial

In this example, we create a class diagram with 3 classes (class1, class2, class3), and a LayersStack with 3 layers (layer2, layer1, bottom). The bottom layer control the 3 classes and all the available properties. The layer1 control Class1 and Class2. The layer2 control Class2 and Class3.

This example is also a tutorial, if you follow it step by step.

Create a new Class Diagram

Start by creating a Papyrus Class Diagram with 3 classes:

You should have a diagram and model explorer like in the following figure:

Open the LayersExplorer

To open the LayersExplorer:

Attach a LayersStack to your diagram

To attach a LayersStack to your diagram:

Create a new Layer in the LayersStack

We need now to create a layer in the stack.

To create a new Layer in the LayersStack:

Attach Classes to the Layer

Attaching some classes (also called views) to a layer means that this layer will partially control the value of some properties for this attached classes. Here, we attach the 3 classes. To Attach the classes to the Layer:

Attach some properties to the layer

A layer is used to control some properties of the attached views. It is necessary to attach the properties controled by the layer. Once attached, it is possible to modify the values of this properties.

To attach some properties to the layer:

Add more layers

Now, add a new Layer in the Top Layer Operator:

Change the value of an attached property

You can change the value of the fill property color for the layer.

Add the 3rd layer

Disabling a Layer

It is possible to disable a layer without deleting it. A disabled layer do not participate in layer stack.

To disable a layer, select it in the LayersExplorer.

Layer Operators

Layer Operators are a kind of layer that can contain other Layers.

A layer operator is called like this because it is used to apply an 'operator' on its nested layers. The operator compute the property values for attached layers.

It is not possible to attach directly views or properties to a layer operator. But a layer operator still have a set of attached views and a set of attached properties. The values of these properties are the results of applying the operator on the properties of the nested layers. The set of the attached views is generally the union of the views attached to the nested layers.

There is different kind of 'layer operators', each one proposing a different way of computing the property values.

Top Layer Operator

The 'Top Layer Operator' contains layers that are ordered from top to bottom. It is called 'Top Layer Operator' because it return the top most value for a particular (view, property type) couple.

When computing the property value for a specified (view, property type), the Top Layer Operator return the first value found for this couple. It start from the top layer, and stop as soon as a layer as a value set for the specified (view, property type).