Geoportal Extension for OpenLayers
API Reference

Class: Legends

ol.control.Legends

Legends button

new Legends(options)

Controls/Legends/Legends.js, line 37
Name Type Description
options Object

options for function call.

Fires:
  • legends:add
  • legends:remove
  • legends:modify
Example
var legends = new ol.control.Legends();
map.addControl(legends);

Extends

  • ol.control.Control

Members

auto

{Boolean} specify if control add layers auto

collapsed

{Boolean} specify if control is collapsed (true) or not (false)

draggable

{Boolean} specify if control is draggable (true) or not (false)

Methods

add(layer){Boolean}

Controls/Legends/Legends.js, line 200

Add a legend from a layer

Name Type Description
layer *

...

adds(layers)

Controls/Legends/Legends.js, line 184

Add legends from layers

Name Type Description
layers *

...

exist(dom){Boolean}

Controls/Legends/Legends.js, line 250

Has already a DOM legend

Name Type Description
dom *

...

getContainer(){DOMElement}

Controls/Legends/Legends.js, line 138

Get container

getMetaInformations(layer){*}

Controls/Legends/Legends.js, line 162

Get all meta informations of a IGN's layer

Name Type Description
layer *

layer

Example
getLegends() :
"legends" : [
        {
            "format" : "image/jpeg",
            "url" : "https:*data.geopf.fr/annexes/ressources/legendes/LEGEND.jpg",
            "minScaleDenominator" : "200"
        }
    ],

onShowLegendsClick(e)

Controls/Legends/Legends.js, line 475

...

Name Type Description
e *

...

remove(layer){Boolean}

Controls/Legends/Legends.js, line 224

Remove a legend from a layer

Name Type Description
layer *

...

setMap(map)

Controls/Legends/Legends.js, line 84

Overwrite OpenLayers setMap method

Name Type Description
map ol.Map

Map.