Geoportal Extension for OpenLayers API Reference

Class: Editor

ol.style.Editor

Editor Styles MapBox...

new Editor(options)

OpenLayers/Controls/Editor.js, line 108
Name Type Description
options Object

options for function call.

Fires:
  • editor:layer:onclickvisibility
  • editor:layer:onclickclone
  • editor:layer:onclickremove
  • editor:style:oneditjson
  • editor:style:scale:onchangemin
  • editor:style:scale:onchangemax
  • editor:legend:onclickedition
  • editor:legend:onchangevalue
  • editor:filter:oneditjson
  • editor:themes:onclickimage
  • editor:themes:onclicktitle
  • editor:group:oncollapse
  • editor:onloaded
Example
var editor = new Editor ({
     target : "",
     style : "data/styles/layer.json",
     themes: {
         themesSummary : "",
         themes : [{
            "thumbnail": "data/images/layer0.png",
            "name": "standard0",
            "url": "data/styles/layer0.json",
            "description": "",
            "selected" : true
         },{
            "thumbnail": "data/images/layer1.png",
            "name": "standard1",
            "url": "data/styles/layer1.json",
            "description": ""
         }]
     },
     scope : this,
     events : {
         "editor:layer:onclickvisibility" : ...,
         "editor:layer:onclickclone" : ...,
         "editor:layer:onclickremove" : ...,
         "editor:style:oneditjson" : ...,
         "editor:style:scale:onchangemin" : ...,
         "editor:style:scale:onchangemax" : ...,
         "editor:filter:oneditjson" : ...,
         "editor:themes:onclickimage" : this._onClickEventImageTheme(),
         "editor:themes:onclicktitle" : function(e) {...}
     },
     tools : {
         // afficher/cacher les themes (par defaut) ou utiliser les options
         themes : true | false | {
             target : "...",
             tools : {
                 "thumbnails": true,
                 "button": { visible : true, type : "checkbox" }
             },
         },
         layers : true | false,     // afficher les couches (layers)
         style : true | false,      // afficher les styles (sous menu layers)
         filter : true | false,     // afficher les filtres (sous menu layers)
         legend : true | false,     // afficher les legendes (layers)
         group : true | false,      // grouper les couches (layers)
         sort : true | false,       // trier les couches (layers)
         title : true | false       // afficher les titres des rubriques,
         type : true | false,       // afficher le type de geometrie (layers)
         pin : true | false,        // afficher la puce pour chaque couche (layers)
         visibility : true | false, // afficher l'icone de visibilité (layers),
         icon : {                   // afficher l'icone "oeil" ou "checkbox" (layers),
             "image" : true,
             "anchor" : "start" // afficher l'icone au debut ou à la fin de la ligne
         },
         editable : true | false    // active l'edition de la legende (legendes)
     }
  });
  // create DOM
  editor.createElement()
    .then(() => {
      console.warn(editor.getID());
    })
    .catch(error => {});
  // possibility to add listeners with globale variable : eventbus
  eventbus.addEventListener("editor:style:scale:onchangemin", function (e) {...});

Methods

createElement(){Promise}

OpenLayers/Controls/Editor.js, line 726

Create Editor

display(display)

OpenLayers/Controls/Editor.js, line 795

Set display container (DOM)

Name Type Description
display Boolean

show/hidden container

getContainer(){DOMElement}

OpenLayers/Controls/Editor.js, line 811

Get container (DOM)

Returns:
element

getID(){Number}

OpenLayers/Controls/Editor.js, line 803

Get id editor

getLayer(i){Object}

OpenLayers/Controls/Editor.js, line 875

Get the layer object from a list sorted or not (see options.tools.sort)

Name Type Description
i Number

index

See:
Returns:
object

getLayerFromStyle(i){Object}

OpenLayers/Controls/Editor.js, line 847

Get layer object from json style

Name Type Description
i Number

index into style json

Returns:
MapBox of a layers

getLayers(){Array}

OpenLayers/Controls/Editor.js, line 865

Get a list of layer object sorted or not (see options.tools.sort)

See:
Returns:
of layer object

getStyle(){Object}

OpenLayers/Controls/Editor.js, line 819

Get Style (json)

Returns:
MapBox

getStyleLayer(i){Object}

OpenLayers/Controls/Editor.js, line 828

Get layer style (json)

Name Type Description
i Number

index

Returns:
MapBox of a layers