NShape Concepts
Layers

<< Click to Display Table of Contents >>

Navigation:  Concepts >

NShape Concepts
Layers

Previous pageReturn to chapter overviewNext page

When working with diagrams that contain many shapes, you usually don't need to see all shapes all the time. Quite the contrary, it's often useful to hide certain shapes to improve lucidity.
This is when layers come into play:

Each diagram has a Layers collection that is empty by default. Add some layers using code or the user interface, and you will be able to add shapes to these layers.

Shapes and Layers

Each shape can be assigned to one or more layers. For most cases, assigning the shape to a single layer should b enough, but there are scenarios where it's handy to assign multiple layers to a shape.

Layers can be switched between active/inactive and visible/invisible. Moreover, layers have a LowerZoomThreshold and an UpperZoomThreshold. If the display's zoom level is below the lower- or above the upper zoom threshold, the layer will be invisible automatically.

If the layer is invisible, all layers assigned to this layer will become invisible as long as they are not part of an other (visible) layer.
To put it into a nutshell: A shape becomes invisible if all its layers are switched to invisible.

Switching a layer to "active" means that all new shapes added by the user (via the user interface) will be added to this/these layer(s). The assignment of shapes to layers can also be modified using the commands provided by the display's context menu.

Combinable (green) and uncombinable (blue) layers in the LayerListbox

Combinable (green) and uncombinable (blue) layers in the LayerListbox

Layers in NShape versions older than NShape 2.3

Until version 2.2.1, there are 31 layers and all of there layers are combinable.

Layers in NShape versions since NShape 2.3

Since version 2.2.1, there is a new concept for layers that extends the number of available layers to Int32.MaxValue. The new layer concept is backwards compatible with the old concept, so you can open and save your existing repositories and nothing will change.

There are two types of layers now: Combinable layers and uncombinable layers. The combinable layers are exactly the same as the 'old' combinable layers but there are 32 now instead of 31. The uncombinable layers are - as the naming implies - not combinable and therefore cannot be used like the old ones.
Combinable layers can serve as both, HomeLayer and SupplementalLayers, uncombinable layers can be used as HomeLayer only.

Along with the new layer type, the Shape now has two layer properties: HomeLayer and SupplementalLayers. Both properties are now assignable in the PropertyEditor and via code.

Any layer can serve as HomeLayer

Any layer can serve as HomeLayer

 

Only combinable layers can serve as SupplementalLayers.

Only combinable layers can serve as SupplementalLayers.

Due to their combinable nature, any number of combinable layers can be switched to "active" but only one uncombinable layer can be switched to "active". An active uncombinable layer will automatically become the home layer of new shapes inserted into the diagram (using the standard user interface).

 

When creating layers, the first 32 layers will become combinable layers, all others will become uncombinable layers.

In case you need a huge amount of layers, you should make a plan on how many layers you need, which layers have to be shared between the shapes (SupplementalLayers) and which layers are used one time only (HomeLayer).