Geoportal Extension for OpenLayers
API Reference

Class: Legend

ol.style.editor.Legend

MapBox Legend management

new Legend(options)

Controls/Editor/Legend.js, line 54
Name Type Description
options Object

options for function call.

Name Type Default Description
target Object null optional

...

position Number 0 optional

...

id Number null optional

(internal) ...

sprites Object null optional

...

Name Type Description
url String optional

...

size Object optional

{h:, w:} ...

json Object optional

...

obj Object

...

Name Type Default Description
title String optional

...

editable Boolean true optional

...

paint Object

...

layout Object

...

Example
var legend = new Legend ({
     target : ...,
     position : 1, // identifiant de position (unique !)
     sprites : {
         url : "http://localhost/sprites.png",
         size : { w : 450, h : 550 },
         json : {
             icon-1 : {x:,y:,height:,width:,pixelRatio:},
             icon-2 : {x:,y:,height:,width:,pixelRatio:}
         }
     },
     obj : {
         title : "",
         editable : true, // tag non standard issue du style json dédié à l'edition
         paint : {"fill-color": "#2BB3E1"},
         layout : {visibility:"none"}
     }
  });
 legend.add();
 legend.display(true);
 legend.isEditable();
 legend.getRenderContainer();
 legend.getToolsContainer();
 legend.getContainer();

Members

staticol.style.editor.Legend.PROPERTIES

List of supported properties

Methods

add(){Object}

Controls/Editor/Legend.js, line 877

Add element into target DOM

Returns:
instance

display(display){Boolean}

Controls/Editor/Legend.js, line 901

Set display container or get

Name Type Description
display Boolean

show/hidden container or get status

getContainer(){DOMElement}

Controls/Editor/Legend.js, line 947

Get container (DOM)

Returns:
element

getRenderContainer(){DOMElement}

Controls/Editor/Legend.js, line 926

Get container Legend Render (DOM)

See:
  • Layer.prototype.slotLegend()
Returns:
element
Example

getToolsContainer(){DOMElement}

Controls/Editor/Legend.js, line 938

Get container Legend Tools (DOM)

See:
  • Layer.prototype.slotLegend()
Returns:
element
Example
...

isEditable(){Boolean}

Controls/Editor/Legend.js, line 914

Is editable