The legend indicates to the user how various features are represented on map. The legend indicates the current state of layer: visibility, out of ranges, out of zoom. It allows to control layers and renderers visibility. The layer or renderer entry in legend may be hidden permanently or temporarily.
The legend appearance defined both in layout and project file. In layout file it is declared by object with type="legend"
Note on attribute name. Applet may have several legends with the different list of layers. Name allows to distribute layers among legends. See "legend" attribute for layer.
Besides backcolor and forecolor attributes which describe colours for background and text, the layout entry for legend may have the following attributes:
ATTRIBUTE
DESRIPTION
select_clr
heighlight colour for active layer
disabled_clr
disabled layer
err_color
layer that can't be loaded
net_color
heighlight colour for layer that is downloading
separator
defines whether layers in legend will be separated with thin line
selection
whether to use select_clr for active layer
font_bold
font for layer labels
font_plain
font for other labels
The attributes below refers to images which describes the state of layer.
image_clock
layer is out of time ranges
image_zoomin
current map's zoom is less than layer's min zoom range
image_zoomout
current map's zoom is more than layer's max zoom range
image_network
layer data is downloading
image_outext
current map extent is out of layer's extent
image_key
password for layer is not resolved
The objects in project file: layer; renderer and symbol have the attributes which describe their behavior in the legend. All of them have:
showlegend - determines the visibility of object in legend
label - label in legend. If it is not defined, name is utilized. Name is unique object identifier, in contrast to label. Label may be diffretent for different languages.
....
ATTRIBUTE
DESRIPTION
legend
the name of legend component this layer is represented. Applet may have several legends with the different list of layers
legendexpanded
whether to expanded the item on map startup
hidelegend_zoom
whether to hide the layer item if layer is out of zoom ranges
WrapLayerTitles
whether to wrap labels in legend
legendsymbolshape
list of coordinates that allows to define your own shape for legend icon
legtype
type of shape 1 - point, 2- line, 3- polyogon
Besides, if layer's attribute alwaysvisible is true, the checkbox in legend which allows to set layer's visibility will be hidden.
The renderer object may have the attribute AllowOnOffInLegend. It enables the visibility of checkbox for renderer as well as for layer.