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

Members

staticol.style.editor.Legend.PROPERTIES

List of supported properties

Methods

add(){Object}

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

Add element into target DOM

Returns:
instance

display(display){Boolean}

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

Set display container or get

Name Type Description
display Boolean

show/hidden container or get status

getContainer(){DOMElement}

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

Get container (DOM)

Returns:
element

getRenderContainer(){DOMElement}

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

Get container Legend Render (DOM)

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

getToolsContainer(){DOMElement}

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

Get container Legend Tools (DOM)

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

isEditable(){Boolean}

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

Is editable