- Extends
-
- xtype
- gx_vectorlegend
-
class GeoExt.VectorLegend(config)
- Create a vector legend.
Config Options
Configuration properties in addition to
those listed for Ext.Container.
-
bodyBorder
- Boolean
Show a border around the legend panel. Default is false.
-
clickableSymbol
- Boolean
Set cursor style to “pointer” for symbolizers. Register for
the symbolclick event to handle clicks. Note that click events
are fired regardless of this value. If false, no cursor style will
be set. Default is false.
-
clickableTitle
- Boolean
Set cursor style to “pointer” for rule titles. Register for
the titleclick event to handle clicks. Note that click events
are fired regardless of this value. If false, no cursor style will
be set. Default is false.
-
enableDD
- Boolean
Allow drag and drop of rules. Default is false.
-
labelCls
- String
Optional css class to use for the layer title labels.
-
layer
- OpenLayers.Layer.Vector
The layer that this legend will be based on. One of layer,
rules, or layerRecord must be specified in the config.
-
layerRecord
- GeoExt.data.LayerRecord
The record containing a vector layer that this legend will be based on.
One of layerRecord, layer, or rules must be specified in
the config.
-
legendTitle
- String
Optional title to be displayed instead of the layer title. If this is
set, the value of showTitle will be ignored (assumed to be true).
-
rules
- Array(OpenLayers.Rule)
- List of rules. One of rules, layer, or layerRecord must be
specified in the config. The symbolType property must also be
provided if only rules are given in the config.
-
selectOnClick
- Boolean
Set to true if a rule should be selected by clicking on the
symbol or title. Selection will trigger the ruleselected event, and
a click on a selected rule will unselect it and trigger the
ruleunselected event. Default is false.
-
showTitle
- Boolean
Whether or not to show the title of a layer. This can be overridden
on the LayerStore record using the hideTitle property.
-
symbolType
- String
The symbol type for legend swatches. Must be one of "Point",
"Line", or "Polygon". If not provided, the layer or
layerRecord config property must be specified, and the geometry type
of the first feature found on the layer will be used. If a rule does
not have a symbolizer for symbolType, we look at the symbolizers
for the rule, and see if it has a "Point", "Line" or
"Polygon" symbolizer, which we use for rendering a swatch of the
respective geometry type.
-
untitledPrefix
- String
The prefix to use as a title for rules with no title or
name. Default is "Untitled ". Prefix will be appended with a
number that corresponds to the index of the rule (1 for first rule).
Public Methods
Public methods in addition to those
listed for Ext.Container.
-
VectorLegend.setCurrentScaleDenominator()
Parameter: | scale – Number The scale denominator. |
Set the current scale denominator. This will hide entries for any
rules that don’t apply at the current scale.
-
VectorLegend.update()
- Update rule titles and symbolizers.
Events
Events in addition to those
listed for Ext.Container.
-
ruleclick
Fires when a rule entry is clicked (fired with symbolizer or
title click).
Listener arguments:
- comp - GeoExt.VectorLegend` This component.
- rule - OpenLayers.Rule The rule that was clicked.
-
rulemoved
Fires when a rule is moved.
Listener arguments:
- comp - GeoExt.VectorLegend` This component.
- rule - OpenLayers.Rule The rule that was moved.
-
ruleselected
Fires when a rule is clicked and selectOnClick is set to
true.
Listener arguments:
- comp - GeoExt.VectorLegend` This component.
- rule - OpenLayers.Rule The rule that was selected.
-
ruleunselected
Fires when the selected rule is clicked and selectOnClick
is set to true, or when a rule is unselected by selecting a
different one.
Listener arguments:
- comp - GeoExt.VectorLegend` This component.
- rule - OpenLayers.Rule The rule that was unselected.
-
symbolclick
Fires when a rule symbolizer is clicked.
Listener arguments:
- comp - GeoExt.VectorLegend` This component.
- rule - OpenLayers.Rule The rule whose symbol was clicked.
-
titleclick
Fires when a rule title is clicked.
Listener arguments:
- comp - GeoExt.VectorLegend` This component.
- rule - OpenLayers.Rule The rule whose title was clicked.