dia-installer.de / Documentation / Manual

Chapter 10. Managing Layers

10.1. Introduction to Layers

In Dia, diagrams consist of the canvas object, layer objects, and diagramming element objects. The layer object can be likened to that of a sheet that sits on top of a canvas. Each sheet can then have diagramming elements added to it to make up a diagram. Each diagram consists of at least one layer and each diagram can consist of as many layers as required by the diagramming author.

As a general purpose, layers aim at being a shortcut for grouping related objects within a diagram. They allow you to isolate the different parts of a diagram, in the way which you can decide to show only certain parts of it and not some others will stay hidden even when exporting or printing the diagram.

[Tip]Tip

Use the --show-layers command line switch to control which layers are visible when batch exporting.

Inside a layer, any operation you would like to perform on objects are possible through the Main Popup Menu, then you can act on objects just the way you use to.

[Tip]Tip

Only objects present in the current layer can be selected. If an object doesn't want to be selected, you should check if it is laying in the current layer or not.

Each new diagram comes with the default layer labeled "Background". Of course you can change its name and settings to customize it to your needs as you can do with any other layer.

You can use layers to create overlay slide show by drawing each incremental slide in a layer and manipulating which layers are visible. If you want to automate post processing such slide show, you can use --show-layers command line switch. For example: dia --show-layers=Background,Slide3 --filter=eps-builtin --export=foo.eps foo.dia will export the Background and Slide3 layers, i.e. the eps output has only these two layers and none others. You would then repeat the export for each combination of layers you need to produce your slides. Using this switch and a shell script or Makefile you can automate the export process quite well.

10.2. Managing Layers Basics

The Layers dialog is used to manage the order and visibility of each layer in a diagram.

10.2.1. Create a New Layer

Creating a new layer is possible by clicking on the New Layer button at the bottom left of the dialog. Since the Layers dialog is not diagram specific but application specific, you will have to choose in which diagram the new layer must go in. To do so, at the top of the Layers dialog, select the diagram you wanted to receive the new layer and then add this new layer to the selected diagram.

The newly created layer will be placed on top of the stack and will become the current layer of the selected diagram.

Then it's possible to edit any new object of your choice, copy and paste from any other layer or diagram as you could do it in single layer diagram.

10.2.2. Selecting Layers

A layer is said as being activated when it is selected in the Layers dialog. To select a layer simply click on its name in the dialog. The selected layer will then become highlighted. Changes to the diagram are made to the currently selected layer only.

[Note]Note

Only one layer can be selected at a time. That way you can do anything you like in this selected layer without affecting other layers on your diagram.

10.2.3. Ordering Layers

Next to the New Layer button at the bottom of the Layers dialog, are two useful buttons which allow you to set the stack order of each layer you created.

Those two buttons are used to raise and lower layers in the hierarchy of layers. The button with the up arrow is used to raise the active layer while the other is for lower the position within the hierarchy.

Ordering layers can be useful when you want hide some parts of an object with another one.

10.2.4. Deleting Layers

When a layer is not required you can delete it. When deleting a layer, it and all of the objects contained in the layer are removed from the canvas. Layers are deleted by clicking on the Delete Layer button. Of course this will only affect the currently selected layer.

Doing so on regular basis is the better way to keep your diagram clean and light for when you want to export it to another format other than the native Dia format.

10.2.5. Renaming Layers

Layers can be renamed to express the part of the diagram they represent, giving them the ability to be rapidly located among others. Most importantly, layers can be shown or hidden depending on what part of the diagram you would like to show.

Double-clicking on the name of the layer opens the Edit Layer Attributes dialog, which displays the current name of the layer in a textbox. Enter a new name for the layer in the textbox. To confirm the changes, depress the OK button. Selecting the Cancel button will close the Edit Layer Attributes dialog without making any changes.

[Tip]Tip

Naming layers that describe the purpose of the layer is a useful way to remember what it is for. Don't hesitate to create many different layers in your diagram, Dia doesn't constrain you on the number of layers you've created, so feel free to adjust the hierarchy of the diagram to your own needs.

10.3. Viewing Layers

Now that you've seen what are the basics of manipulating layers, you will more easily understand why layers are such a powerful tool when you are building and maintaining diagrams with Dia.

Understanding what layers are for can dramatically improve the quality and the visual effect your diagrams will produce.

For instance, imagine you are building a diagram with lots of objects in it, like an Electrical or UML diagram, if you drop all of your objects in the same layer, meaning the background, after a while you will get a huge unmanageable draft you won't be able to do anything with it. It will be a pain to change anything in it, you will waste time trying to remember what object is connected to that object which seems to take all the space in the middle of the mixed up objects you already put there.

Since Dia is a Structured Diagram Builder, all the diagrams you will build with it will be naturally structured and broken down to many little pieces. Using a layered approach better manages lots of pieces with more ease and efficiency than you could do with a single monolithic block of objects.

[Note]Note

By definition, a diagram should be structured. So breaking it down into several logical parts should be an easy process. That's where layers become a very useful and important tool for the management of the content of diagrams. They allow you to isolate each of these parts in separated slides, so it becomes a real pleasure to manipulate them in any way you like.

The Eye Icon to the left of the layer name is what make layers so useful. It allows you to show or hide the corresponding layer. Meaning if for any reason you decided to not show a particular layer, simply click on the Eye Icon and the layer and everything it contains will disappear from the Canvas. If you hold down the Shift key and click Eye Icon you can hide all the other layers except for the current layer, and if you click again while still holding the Shift key all Layers will be shown again.

Viewing only certain layers is really useful when you want manipulate a small part of your diagram without affecting the rest. Some users create separate layers to hold all their text objects and use different layers to hold translations into other languages. You can also work that way if you want to print your diagram on different pages or testing different settings which can affect the layout of that part. Again, feel free to experiment with layers, if set up properly they can make your diagram look much better.

[Note]Note

In Dia, Layers creation and manipulation are as common as drawing or selecting objects in the diagram. You must get your hands on them, because you will probably have to use them anytime you will want to create a new diagram.

dia-installer.de / Documentation / Manual

Imprint | Privacy Policy