layer[]
Every graphic window has a number of graphic layers associated with it. Some are system layers, others are application-created vector layers displaying graphic primitives delineated by group.
The window.layers[] array gives access to these layers, enabling rendering order and other characteristics to be modified. When a graphic window is repainted the layers are rendered in the order of this array.
There are various types of layer available:
Type
Creation
Contents
Access
background
Automatic on window creation
The background color or fillstyle.
cloth
Automatic, resulting from a wcloth command
A set of image files defined as a backcloth.
vector
By direct correspondence with window.group_order
Graphic primitives which are members of an entity group.
pre_vector
Automatic, resulting from the presence of a window.redraw callback
Any manually drawn graphics invoked during execution of the callback.
post_vector
Automatic, resulting from the presence of a window.post_redraw callback
Any manually drawn graphics invoked during execution of the callback.
annotation
Automatic on window creation
Autotext annotation.
grid Automatic, resulting from a grid -on command
A grid of polylines.
scalebar Automatic, resulting from a scalebar -on command
An annotated measured scalebar symbol
vane Automatic, resulting from a vane -on command
A direction vane symbol.
A new graphic window initially has 3 layers, a background layer, a default vector layer associated with the all group of entities, and an annotation layer. This is no change from earlier Fire versions, but merely provides a default layering system. The background layer is merely for the convenience of accessing and controlling the background color and possibly a background image.
Layers other than vector layers (known as system layers) are added to (or removed from) a window's layer list automatically when other graphic features are enabled (or disabled) for the window, e.g. cloth, autogrid, autovane, pre-vector and post-vector, as listed under Creation in the above table.
Different layer types can be referenced by type as well as by index into the window.layers array, as listed under Access in the above table. Consult these topics for more details.
Vector layers can be created by one of 2 methods:
by adding the group of entities which constitute the layer to the window.group_order array, e.g.
group buildings gwin.group_order = <all, buildings>or by extending the window.layers array and then assigning a group to the new array element, e.g.
group buildings gwin.layers[3] := null;# Add an undefined layer gwin.layers[3].group = buildings;# Make the layer a vector layer
The layer draw order can be changed merely by re-ordering the window.layers array, although some layers (e.g. the background layer) have a fixed position in the redraw hierarchy and cannot be repositioned elsewhere order. The swap operator is particularly useful for layer re-ordering, e.g.
gwin.layers[3] <=> gwin.layers[4]
Commands: |
|
Structures: |