Lesson 6 - Graphical Attributes and Layers
The visual appearance of the components is controlled by graphical attributes
like e.g. color, line pattern and line width. Components can be assigned to layers.
In this lesson the graphical attributes and the drawing layers are presented.
In order to set the visual appearance of a
component CADEMIA provides 6 graphical attributes.
Each attribute has a DEFAULT value.
-
Line width: Describes the dash thickness of a component. DEFAULT
is 0.25 mm.

-
Line pattern: Describes the dash pattern of a component. DEFAULT
is solid.

-
Draw paint: Defines which paint (normally a
color) to use when drawing the component. DEFAULT is black.

-
Fill paint: Defines the paint which is used to
fill the enclosed area of a component (e.g. circle). The fill paint can
be a solid color (e.g. red, blue or black) or a hatch pattern
(e.g. cross hatch). DEFAULT is an empty fill paint.

-
Font family: The font used for rendering texts depends on
the fonts available on the operating system. Usually the font families
Serif, SansSerif, Monospaced and
Dialog are available on all Java supporting platforms. DEFAULT
is SansSerif.

-
Text size: Describes the height of text characters. DEFAULT is
3.5 mm.

Predefined attributes can be added by executing the
AddDINAttributes command.
All attributes can be identified via a unique name. This name is specified when
defining an attribute.
Line width:
In order to define a new line width attribute run the command
DefLineWidth. The line width
is defined in paper units [mm].
Line pattern:
In order to define a new line pattern attribute run the command
DefLinePattern.
The line pattern is described by a repetitive list of length specifications that
represent a 'dash-gap-dash-gap' chain. The length numbers need to be defined in
paper units [mm] (e.g. chain line '5.0 1.0 0.0 1.0' means 5 mm dash, then 1 mm
gap, then a dot, then a 1 mm gap and started over).
Draw paint:
In order to define a new draw paint attribute run the command
DefDrawPaint. A draw color
is described by its RGB (red green blue) value. The color dialog supports the
selection of a new draw color.
Fill paint:
In order to define a new fill paint attribute run the command
DefFillPaint. A fill color
is described by its RGB (red green blue) value. The color dialog supports the
selection of a new fill color.
Font family:
In order to define a new font attribute run the command
DefFontFamily.
Text size:
In order to define a new text size attribute run the command
DefTextSize. The height of the
text characters is defined in paper units [mm].
Example:
Lets define a new dashed line pattern and a turquoise draw paint. Therefore we
run the command
DefLinePattern, enter the name "dashed" and the pattern "5.0 5.0"
in the Command line. Subsequently, we run the command
DefDrawPaint, enter the
name "turquoise" in the Command line and choose the turquoise color
from the color dialog.
Once the line pattern and the draw paint are defined they can be
selected from the respective list boxes in the Toolbar.
6.1.2 Work with attributes
A set of all 6 attributes is assigned to each component
when the component is added to the drawing. These attributes are called the
default attributes. There are 6 list boxes in the Toolbar that show the
current values of the default attributes. In order to change a default attribute
select a different one using the list boxes.
Example:
Lets set our dashed line pattern and the turquoise draw paint as default
attributes.
If we now draw a simple line it
will be dashed and turquoise.
6.2 Layers
Layers structure the drawing. Each component is
assigned to a layer. A layer is described by a name, a description (semantics)
and a set of the 6 attributes. Usually, the components have the same attributes
as the layer they are assigned to. The NullLayer is always available and can't
be deleted.
6.2.1 Defining Layers
Predefined layers can be added by executing the
AddDINLayers command.
In order to define a new layer run the command
AddLayer. A dialog supports
entering its name, its semantics and its attributes. The attributes have
to be defined in advance (see Define
attributes).
Example:
Lets add a layer named "Dashed lines" with semantics "This layer contains dashed
lines.". We assign our dashed line pattern and the turquoise draw paint to
our new layer.
6.2.2 Work with layers
A layer is assigned to each component when the component
is added to the drawing. This layer is called the default layer. There is a list box
in the Toolbar that shows the current default layer. In order to change
the default layer select a different one using the list boxes.
6.3 Exercise
Draw the shapes presented below. Add a different layer for each type of
component and assign it respectively. Add and use suitable line widths,
line patterns, draw paints, fill paints, font families and text sizes. Save
the drawing.