Class ria.legend.LegendMapOrchestrator

A LegendMapOrchestrator populates a LegendControl and connects it to an OpenLayers map so that overlay toggle events change the visibility of the corresponding OpenLayers layers. The LegendControl is only populated with legend data for layers of the type OpenLayers.Layer.MappingServiceLayer. Data for any other layers has to be added during the ria.legend.LegendControl#event:onPreRenderData event, if desired. To initialise the orchestration between a LegendControl and a map call #init(). To free up any resources once the LegendControl or map is taken out of service, call #destroy().

Method Summary
Method Attributes Method Name and Description
Unlinks the LegendControl by releasing all event listeners.
init()
Populates the legend with the overlays from the map passed to the constructor and wires the respective overlays to the LegendControl's onOverlayToggled events.
Constructor Detail
ria.legend.LegendMapOrchestrator(map, legendControl, legendService)
Creates a new uninitialised LegendMapOrchestrator.
Parameters:
{OpenLayers.Map} map
OpenLayers map to populate the LegendControl from.
{ria.legend.LegendControl} legendControl
Legend control to populate and wire up with the OpenLayers map.
{ria.legend.LegendService} legendService
Legend service to retrieve the legend data from.
Method Detail
destroy()
Unlinks the LegendControl by releasing all event listeners. In order to avoid resource leaks, this method should be called before taking either the LegendControl or the map passed to the constructor out of service.

init()
Populates the legend with the overlays from the map passed to the constructor and wires the respective overlays to the LegendControl's onOverlayToggled events.