Geoportal Extension for OpenLayers API Reference

Class: Legend

ol.style.editor.Legend

MapBox Legend management

new Legend(options)

OpenLayers/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();

Methods

add(){Object}

OpenLayers/Controls/Editor/Legend.js, line 888

Add element into target DOM

Returns:
instance

display(display){Boolean}

OpenLayers/Controls/Editor/Legend.js, line 912

Set display container or get

Name Type Description
display Boolean

show/hidden container or get status

getContainer(){DOMElement}

OpenLayers/Controls/Editor/Legend.js, line 958

Get container (DOM)

Returns:
element

getRenderContainer(){DOMElement}

OpenLayers/Controls/Editor/Legend.js, line 937

Get container Legend Render (DOM)

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

getToolsContainer(){DOMElement}

OpenLayers/Controls/Editor/Legend.js, line 949

Get container Legend Tools (DOM)

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

isEditable(){Boolean}

OpenLayers/Controls/Editor/Legend.js, line 925

Is editable