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3B,MAAO,CAAC,IAAK,IAAK,EAAG,GACrB,MAAO,MAET,KAAM,IAAI,GAAG,MAAM,KAAK,CACtB,MAAO,CAAC,IAAK,EAAG,IAAK,QAGzB,OAAO,SAAS,EAAS,GAQvB,OAPI,EAAa,GAAI,EAAM,UAAU,QAAQ,wBACxC,EAAM,UAAU,QAAQ,wBACzB,EAAQ,QACV,EAAM,UAAU,QAAQ,EAAQ,IAAI,WAAY,KAAM,EAAQ,IAAI,WAAW,IAAI,QAAQ,MAAM,KAE/F,EAAM,UAAU,SAAS,EAAQ,IAAI,WAAW,IAAI,QAAQ,MAAM,KAE7D,CACT,CACF,CA4EiE,CAAS,GACtE,QAEE,MAAI,YAAY,KAAK,IACnB,EAAQ,KAAO,EAAS,QAAQ,gBAAgB,MAhCxD,SAA0B,GACxB,OAAO,SAAS,GACd,IAAI,EAAO,EAAQ,IAAI,QAAQ,EAAQ,MACnC,EAAQ,EAAM,OAAO,GACzB,IAAK,EAAO,CACV,IAAI,EAAQ,EAAU,GAAM,MAAM,QAClC,EAAM,GAAK,EAAQ,SAAW,EAC9B,EAAQ,EAAM,OAAO,GAAQ,IAAI,GAAG,MAAM,MAAM,CAC9C,KAAM,IAAI,GAAG,MAAM,KAAK,CACtB,MAAO,GAAS,CAAC,IAAI,IAAI,IAAI,OAGnC,CACA,OAAO,CACT,CACF,CAkBe,CAAiB,KAGxB,QAAQ,KAAK,yDAA2D,GACjE,GAAG,MAAM,MAAM,gBAI9B,EAEA,GAAG,MAAM,gBAAgB,UAAY,KAAK,MAAM,KAAK,UAAU,GAC9D,CAvTD","file":"/npm/ol-ext@3.2.19/dist/ol-ext.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/ol-ext@3.2.19/dist/ol-ext.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\r\n * ol-ext - A set of cool extensions for OpenLayers (ol) in node modules structure\r\n * @description ol3,openlayers,popup,menu,symbol,renderer,filter,canvas,interaction,split,statistic,charts,pie,LayerSwitcher,toolbar,animation\r\n * @version v3.2.19\r\n * @author Jean-Marc Viglino\r\n * @see https://github.com/Viglino/ol-ext#,\r\n * @license BSD-3-Clause\r\n */\r\n/** @namespace  ol.ext\r\n */\r\n/*global ol*/\r\nif (window.ol && !ol.ext) {\r\n  ol.ext = {};\r\n}\r\n/** Inherit the prototype methods from one constructor into another.\r\n * replace deprecated ol method\r\n *\r\n * @param {!Function} childCtor Child constructor.\r\n * @param {!Function} parentCtor Parent constructor.\r\n * @function module:ol.inherits\r\n * @api\r\n */\r\nol.ext.inherits = function(child,parent) {\r\n  child.prototype = Object.create(parent.prototype);\r\n  child.prototype.constructor = child;\r\n};\r\n// Compatibilty with ol > 5 to be removed when v6 is out\r\nif (window.ol) {\r\n  if (!ol.inherits) ol.inherits = ol.ext.inherits;\r\n}\r\n/* IE Polyfill */\r\n// NodeList.forEach\r\nif (window.NodeList && !NodeList.prototype.forEach) {\r\n  NodeList.prototype.forEach = Array.prototype.forEach;\r\n}\r\n// Element.remove\r\nif (window.Element && !Element.prototype.remove) {\r\n  Element.prototype.remove = function() {\r\n    if (this.parentNode) this.parentNode.removeChild(this);\r\n  }\r\n}\r\n/* End Polyfill */\r\n\r\n/** Ajax request\r\n * @fires success\r\n * @fires error\r\n * @param {*} options\r\n *  @param {string} options.auth Authorisation as btoa(\"username:password\");\r\n *  @param {string} options.dataType The type of data that you're expecting back from the server, default JSON\r\n */\r\nol.ext.Ajax = function(options) {\r\n  options = options || {};\r\n  ol.Object.call(this);\r\n  this._auth = options.auth;\r\n  this.set('dataType', options.dataType || 'JSON');\r\n};\r\nol.ext.inherits(ol.ext.Ajax, ol.Object);\r\n/** Helper for get\r\n * @param {*} options\r\n *  @param {string} options.url\r\n *  @param {string} options.auth Authorisation as btoa(\"username:password\");\r\n *  @param {string} options.dataType The type of data that you're expecting back from the server, default JSON\r\n *  @param {string} options.success\r\n *  @param {string} options.error\r\n *  @param {*} options.options get options\r\n */\r\nol.ext.Ajax.get = function(options) {\r\n  var ajax = new ol.ext.Ajax(options);\r\n  if (options.success) ajax.on('success', function(e) { options.success(e.response, e); } );\r\n  if (options.error) ajax.on('error', function(e) { options.error(e); } );\r\n  ajax.send(options.url, options.data, options.options);\r\n};\r\n/** Helper to get cors header\r\n * @param {string} url\r\n * @param {string} callback\r\n */\r\nol.ext.Ajax.getCORS = function(url, callback) {\r\n  var request = new XMLHttpRequest();\r\n  request.open('GET', url, true);\r\n  request.send();\r\n  request.onreadystatechange = function() {\r\n    if (this.readyState == this.HEADERS_RECEIVED) {\r\n      callback(request.getResponseHeader('Access-Control-Allow-Origin'));\r\n    }\r\n  }\r\n};\r\n/** Send an ajax request (GET)\r\n * @fires success\r\n * @fires error\r\n * @param {string} url\r\n * @param {*} data Data to send to the server as key / value\r\n * @param {*} options a set of options that are returned in the \r\n *  @param {boolean} options.abort false to prevent aborting the current request, default true\r\n */\r\nol.ext.Ajax.prototype.send = function (url, data, options){\r\n  options = options || {};\r\n  var self = this;\r\n  // Url\r\n  var encode = (options.encode !== false) \r\n  if (encode) url = encodeURI(url);\r\n  // Parameters\r\n  var parameters = '';\r\n  for (var index in data) {\r\n    if (data.hasOwnProperty(index) && data[index]!==undefined) {\r\n      parameters += (parameters ? '&' : '?') + index + '=' + (encode ? encodeURIComponent(data[index]) : data[index]);\r\n    }\r\n  }\r\n  // Abort previous request\r\n  if (this._request && options.abort!==false) {\r\n    this._request.abort();\r\n  }\r\n  // New request\r\n  var ajax = this._request = new XMLHttpRequest();\r\n  ajax.open('GET', url + parameters, true);\r\n  if (options.timeout) ajax.timeout = options.timeout;\r\n  if (this._auth) {\r\n    ajax.setRequestHeader(\"Authorization\", \"Basic \" + this._auth);\r\n  }\r\n  // Load complete\r\n  this.dispatchEvent ({ type: 'loadstart' });\r\n  ajax.onload = function() {\r\n    self._request = null;\r\n    self.dispatchEvent ({ type: 'loadend' });\r\n    if (this.status >= 200 && this.status < 400) {\r\n      var response;\r\n      // Decode response\r\n      try {\r\n        switch (self.get('dataType')) {\r\n          case 'JSON': {\r\n            response = JSON.parse(this.response);\r\n            break;\r\n          }\r\n          default: {\r\n            response = this.response;\r\n          }\r\n        }\r\n      } catch(e) {\r\n        // Error\r\n        self.dispatchEvent ({ \r\n          type: 'error',\r\n          status: 0,\r\n          statusText: 'parsererror',\r\n          error: e,\r\n          options: options,\r\n          jqXHR: this\r\n        });\r\n        return;\r\n      }\r\n      // Success\r\n      //console.log('response',response)\r\n      self.dispatchEvent ({ \r\n        type: 'success',\r\n        response: response,\r\n        status: this.status,\r\n        statusText: this.statusText,\r\n        options: options,\r\n        jqXHR: this\r\n      });\r\n    } else {\r\n      self.dispatchEvent ({ \r\n        type: 'error',\r\n        status: this.status,\r\n        statusText: this.statusText,\r\n        options: options,\r\n        jqXHR: this\r\n      });\r\n    }\r\n  };\r\n  // Oops\r\n  ajax.ontimeout = function() {\r\n    self._request = null;\r\n    self.dispatchEvent ({ type: 'loadend' });\r\n    self.dispatchEvent ({ \r\n      type: 'error',\r\n      status: this.status,\r\n      statusText: 'Timeout',\r\n      options: options,\r\n      jqXHR: this\r\n    });\r\n  };\r\n  ajax.onerror = function() {\r\n    self._request = null;\r\n    self.dispatchEvent ({ type: 'loadend' });\r\n    self.dispatchEvent ({ \r\n      type: 'error',\r\n      status: this.status,\r\n      statusText: this.statusText,\r\n      options: options,\r\n      jqXHR: this\r\n    });\r\n  };\r\n  // GO!\r\n  ajax.send();\r\n};\r\n\r\n/** SVG filter \r\n * @param {*} options\r\n *  @param {ol.ext.SVGOperation} option.operation\r\n *  @param {string} option.id filter id, only to use if you want to adress the filter directly or var the lib create one, if none create a unique id\r\n *  @param {string} option.color color interpolation filters, linear or sRGB\r\n */\r\nol.ext.SVGFilter = function(options) {\r\n  options = options || {};\r\n  ol.Object.call(this);\r\n  if (!ol.ext.SVGFilter.prototype.svg) {\r\n    ol.ext.SVGFilter.prototype.svg = document.createElementNS( this.NS, 'svg' );\r\n    ol.ext.SVGFilter.prototype.svg.setAttribute('version','1.1');\r\n    ol.ext.SVGFilter.prototype.svg.setAttribute('width',0);\r\n    ol.ext.SVGFilter.prototype.svg.setAttribute('height',0);\r\n    ol.ext.SVGFilter.prototype.svg.style.position = 'absolute';\r\n    /* Firefox doesn't process hidden svg\r\n    ol.ext.SVGFilter.prototype.svg.style.display = 'none';\r\n    */\r\n    document.body.appendChild( ol.ext.SVGFilter.prototype.svg );\r\n  }\r\n  this.element = document.createElementNS( this.NS, 'filter' );\r\n  this._id = options.id || '_ol_SVGFilter_' + (ol.ext.SVGFilter.prototype._id++);\r\n  this.element.setAttribute( 'id', this._id );\r\n  if (options.color) this.element.setAttribute( 'color-interpolation-filters', options.color );\r\n  if (options.operation) this.addOperation(options.operation);\r\n  ol.ext.SVGFilter.prototype.svg.appendChild( this.element );\r\n};\r\nol.ext.inherits(ol.ext.SVGFilter, ol.Object);\r\nol.ext.SVGFilter.prototype.NS = \"http://www.w3.org/2000/svg\";\r\nol.ext.SVGFilter.prototype.svg = null;\r\nol.ext.SVGFilter.prototype._id = 0;\r\n/** Get filter ID\r\n * @return {string}\r\n */\r\nol.ext.SVGFilter.prototype.getId = function() {\r\n  return this._id;\r\n};\r\n/** Remove from DOM\r\n */\r\nol.ext.SVGFilter.prototype.remove = function() {\r\n  this.element.remove();\r\n};\r\n/** Add a new operation\r\n * @param {ol.ext.SVGOperation} operation\r\n */\r\nol.ext.SVGFilter.prototype.addOperation = function(operation) {\r\n  if (operation instanceof Array) {\r\n    operation.forEach(function(o) { this.addOperation(o) }.bind(this));\r\n  } else {\r\n    if (!(operation instanceof ol.ext.SVGOperation)) operation = new ol.ext.SVGOperation(operation);\r\n    this.element.appendChild( operation.geElement() );\r\n  }\r\n};\r\n/** Add a grayscale operation\r\n * @param {number} value\r\n */\r\nol.ext.SVGFilter.prototype.grayscale = function(value) {\r\n  this.addOperation({\r\n    feoperation: 'feColorMatrix',\r\n    type: 'saturate',\r\n    values: value || 0\r\n  });\r\n};\r\n/** Add a luminanceToAlpha operation\r\n * @param {*} options\r\n *  @param {number} options.gamma enhance gamma, default 0\r\n */\r\nol.ext.SVGFilter.prototype.luminanceToAlpha = function(options) {\r\n  options = options || {};\r\n  this.addOperation({\r\n    feoperation: 'feColorMatrix',\r\n    type: 'luminanceToAlpha'\r\n  });\r\n  if (options.gamma) {\r\n    this.addOperation({\r\n      feoperation: 'feComponentTransfer',\r\n      operations: [{\r\n        feoperation: 'feFuncA',\r\n        type: 'gamma', \r\n        amplitude: options.gamma,\r\n        exponent: 1,\r\n        offset: 0\r\n      }]\r\n    });\r\n  }\r\n};\r\nol.ext.SVGFilter.prototype.applyTo = function(img) {\r\n  var canvas = document.createElement('CANVAS');\r\n  canvas.width = img.naturalWidth || img.width;\r\n  canvas.height = img.naturalHeight || img.height;\r\n  canvas.getContext('2d').filter = 'url(#'+this.getId()+')';\r\n  canvas.getContext('2d').drawImage(img, 0, 0);\r\n  return canvas;\r\n};\r\n\r\n/** SVG filter \r\n * @param {string | *} attributes a list of attributes or fe operation\r\n *  @param {string} attributes.feoperation filter primitive tag name\r\n */\r\nol.ext.SVGOperation = function(attributes) {\r\n  if (typeof(attributes)==='string') attributes = { feoperation: attributes };\r\n  if (!attributes || !attributes.feoperation) {\r\n    console.error('[SVGOperation]: no operation defined.')\r\n    return;\r\n  }\r\n  ol.Object.call(this);\r\n  this._name = attributes.feoperation;\r\n  this.element = document.createElementNS( this.NS, this._name );\r\n  this.setProperties(attributes);\r\n  if (attributes.operations instanceof Array) this.appendChild(attributes.operations);\r\n};\r\nol.ext.inherits(ol.ext.SVGOperation, ol.Object);\r\nol.ext.SVGOperation.prototype.NS = \"http://www.w3.org/2000/svg\";\r\n/** Get filter name\r\n * @return {string}\r\n */\r\nol.ext.SVGOperation.prototype.getName = function() {\r\n  return this._name;\r\n};\r\n/** Set Filter attribute\r\n * @param {*} attributes\r\n */\r\nol.ext.SVGOperation.prototype.set = function(k, val) {\r\n  if (!/^feoperation$|^operations$/.test(k)) {\r\n    ol.Object.prototype.set.call(this, k, val);\r\n    this.element.setAttribute( k, val );\r\n  }\r\n};\r\n/** Set Filter attributes\r\n * @param {*} attributes\r\n */\r\nol.ext.SVGOperation.prototype.setProperties = function(attributes) {\r\n  attributes = attributes || {};\r\n  for (var k in attributes) {\r\n    this.set(k, attributes[k])\r\n  }\r\n};\r\n/** Get SVG  element\r\n * @return {Element}\r\n */\r\nol.ext.SVGOperation.prototype.geElement = function() {\r\n  return this.element;\r\n};\r\n/** Append a new operation\r\n * @param {ol.ext.SVGOperation} operation\r\n */\r\nol.ext.SVGOperation.prototype.appendChild = function(operation) {\r\n  if (operation instanceof Array) {\r\n    operation.forEach(function(o) { this.appendChild(o) }.bind(this));\r\n  } else {\r\n    if (!(operation instanceof ol.ext.SVGOperation)) operation = new ol.ext.SVGOperation(operation);\r\n    this.element.appendChild( operation.geElement() );\r\n  }\r\n};\r\n\r\n// Prevent overwrite\r\nif (ol.View.prototype.flyTo)  {\r\n  console.warn('[OL-EXT] ol/View~View.flyTo redefinition')\r\n}\r\n/** Destination\r\n * @typedef {Object} viewTourDestinations\r\n *  @property {string} [type=flyto] animation type (flyTo, moveTo), default flyTo\r\n *  @property {number} [duration=2000] animation duration\r\n *  @property {ol.coordinate} [center=] destination coordinate, default current center\r\n *  @property {number} [zoom] destination zoom, default current zoom\r\n *  @property {number} [zoomAt=-2] zoom to fly to, default min (current zoom, zoom) -2\r\n *  @property {function} [easing] easing function used during the animation, defaults ol/easing~inAndOut\r\n *  @property {number} [rotation] The rotation of the view at the end of the animation\r\n *  @property {anchor} [anchor] Optional anchor to remain fixed during a rotation or resolution animation.\r\n */\r\n/** FlyTo animation\r\n * @param {viewTourDestinations} options\r\n * @param {function} done callback function called at the end of an animation, called with true if the animation completed\r\n */\r\nol.View.prototype.flyTo = function(options, done) {\r\n  options = options || {};\r\n  // Start new anim\r\n  this.cancelAnimations();\r\n  var callback = (typeof(done) === 'function' ? done : function(){});\r\n  // Fly to destination\r\n  var duration = options.duration || 2000;\r\n  var zoomAt = options.zoomAt || (Math.min(options.zoom||100, this.getZoom())-2);\r\n  var zoomTo = options.zoom || this.getZoom();\r\n  var coord = options.center || this.getCenter();\r\n  // Move to\r\n  this.animate ({\r\n    center: coord,\r\n    duration: duration,\r\n    easing: options.easing,\r\n    anchor: options.anchor,\r\n    rotation: options.rotation\r\n  });\r\n  // Zoom to\r\n  this.animate ({\r\n    zoom: zoomAt,\r\n    duration: duration/2,\r\n    easing: options.easing,\r\n    anchor: options.anchor\r\n  },{\r\n    zoom: zoomTo,\r\n    duration: duration/2,\r\n    easing: options.easing,\r\n    anchor: options.anchor\r\n  },\r\n  callback);\r\n};\r\n/** Start a tour on the map\r\n * @param {Array<viewTourDestinations>|Array<Array>} destinations an array of destinations or an array of [x,y,zoom,destinationType]\r\n * @param {Object} options \r\n *  @param {number} [options.delay=750] delay between 2 destination\r\n *  @param {string} [options.type] animation type (flyTo, moveTo) to use if not defined in destinations\r\n *  @param {function} [options.easing] easing function used during the animation if not defined in destinations\r\n *  @param {function} [options.done] callback function called at the end of an animation, called with true if the tour completed\r\n *  @param {function} [options.step] callback function called when a destination is reached with the step index as param\r\n */\r\nol.View.prototype.takeTour = function(destinations, options) {\r\n  options = options || {};\r\n  var index = -1;\r\n  var next = function(more) {\r\n    if (more) {\r\n      var dest = destinations[++index];\r\n      if (typeof(options.step) === 'function') options.step(index, destinations);\r\n      if (dest) {\r\n        if (dest instanceof Array) dest = { center: [dest[0],dest[1]], zoom: dest[2], type: dest[3] };\r\n        var delay = index === 0 ? 0 : (options.delay || 750);\r\n        if (!dest.easing) dest.easing = options.easing;\r\n        if (!dest.type) dest.type = options.type;\r\n        setTimeout(function () {\r\n          switch(dest.type) {\r\n            case 'moveTo': {\r\n              this.animate(dest, next);\r\n              break;\r\n            }\r\n            case 'flightTo': \r\n            default: {\r\n              this.flyTo(dest, next);\r\n              break;\r\n            }\r\n          }\r\n        }.bind(this), delay);\r\n      } else {\r\n        if (typeof(options.done)==='function') options.done(true);\r\n      }\r\n    } else {\r\n      if (typeof(options.done)==='function') options.done(false);\r\n    }\r\n  }.bind(this)\r\n  next(true);\r\n};\r\n\r\n/** Converts an RGB color value to HSL.\r\n * returns hsl as array h:[0,360], s:[0,100], l:[0,100]\r\n * @param {ol/color~Color|string} rgb\r\n * @param {number} [round=100]\r\n * @returns {Array<number>} hsl as h:[0,360], s:[0,100], l:[0,100]\r\n */\r\nol.color.toHSL = function(rgb, round) {\r\n  if (round===undefined) round = 100;\r\n  if (!Array.isArray(rgb)) rgb = ol.color.asArray(rgb);\r\n  var r = rgb[0] / 255;\r\n  var g = rgb[1] / 255;\r\n  var b = rgb[2] / 255;\r\n  var max = Math.max(r, g, b);\r\n  var min = Math.min(r, g, b);\r\n  var h, s, l = (max + min) / 2;\r\n  if (max === min) {\r\n    h = s = 0; // achromatic\r\n  } else {\r\n    var d = max - min;\r\n    s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\r\n    switch (max) {\r\n      case r: h = (g - b) / d + (g < b ? 6 : 0); break;\r\n      case g: h = (b - r) / d + 2; break;\r\n      case b: h = (r - g) / d + 4; break;\r\n    }\r\n  }\r\n  var hsl = [ \r\n    Math.round(h*60*round)/round, \r\n    Math.round(s*100*round)/round, \r\n    Math.round(l*100*round)/round\r\n  ];\r\n  if (rgb.length>3) hsl[3] = rgb[3];\r\n  return hsl;\r\n}\r\n/** Converts an HSL color value to RGB.\r\n * @param {Array<number>} hsl as h:[0,360], s:[0,100], l:[0,100]\r\n * @param {number} [round=1000]\r\n * @returns {Array<number>} rgb\r\n */\r\nol.color.fromHSL = function(hsl, round) {\r\n  if (round===undefined) round = 1000\r\n  var h = hsl[0] / 360;\r\n  var s = hsl[1] / 100;\r\n  var l = hsl[2] / 100;\r\n  var r, g, b;\r\n  if (s == 0) {\r\n    r = g = b = l; // achromatic\r\n  } else {\r\n    var hue2rgb = function(p, q, t) {\r\n      if (t < 0) t += 1;\r\n      if (t > 1) t -= 1;\r\n      if (t < 1/6) return p + (q - p) * 6 * t;\r\n      if (t < 1/2) return q;\r\n      if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;\r\n      return p;\r\n    }\r\n    var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\r\n    var p = 2 * l - q;\r\n    r = hue2rgb(p, q, h + 1/3);\r\n    g = hue2rgb(p, q, h);\r\n    b = hue2rgb(p, q, h - 1/3);\r\n  }\r\n  var rgb = [ \r\n    Math.round(r * 255*round) / round, \r\n    Math.round(g * 255*round) / round, \r\n    Math.round(b * 255*round) / round\r\n  ];\r\n  if (hsl.length>3) rgb[3] = hsl[3];\r\n  return rgb;\r\n}\r\n/** Converts an HSL color value to RGB.\r\n * @param {ol/color~Color|string} rgb\r\n * @param {number} [round=100]\r\n * @returns {Array<number>} hsl as h:[0,360], s:[0,100], l:[0,100]\r\n */\r\nol.color.toHSV = function(rgb, round) {\r\n  if (round===undefined) round = 100;\r\n  if (!Array.isArray(rgb)) rgb = ol.color.asArray(rgb);\r\n  var r = rgb[0] / 255;\r\n  var g = rgb[1] / 255;\r\n  var b = rgb[2] / 255;\r\n  var max = Math.max(r, g, b);\r\n  var min = Math.min(r, g, b);\r\n  var h, s, v = max;\r\n  var d = max - min;\r\n  s = max == 0 ? 0 : d / max;\r\n  if (max == min) {\r\n    h = 0; // achromatic\r\n  } else {\r\n    switch (max) {\r\n      case r: h = (g - b) / d + (g < b ? 6 : 0); break;\r\n      case g: h = (b - r) / d + 2; break;\r\n      case b: h = (r - g) / d + 4; break;\r\n    }\r\n  }\r\n  var hsv = [ \r\n    Math.round(h*60*round)/round, \r\n    Math.round(s*100*round)/round, \r\n    Math.round(v*100*round)/round\r\n  ];\r\n  if (rgb.length>3) hsv[3] = rgb[3];\r\n  return hsv;\r\n}\r\n/** Converts an HSV color value to RGB.\r\n * @param {Array<number>} hsl as h:[0,360], s:[0,100], l:[0,100]\r\n * @param {number} [round=1000]\r\n * @returns {Array<number>} rgb\r\n */\r\nol.color.fromHSV = function(hsv, round) {\r\n  if (round===undefined) round = 1000\r\n  var h = hsv[0] / 360;\r\n  var s = hsv[1] / 100;\r\n  var v = hsv[2] / 100;\r\n  var r, g, b;\r\n  var i = Math.floor(h * 6);\r\n  var f = h * 6 - i;\r\n  var p = v * (1 - s);\r\n  var q = v * (1 - f * s);\r\n  var t = v * (1 - (1 - f) * s);\r\n  switch (i % 6) {\r\n    case 0: r = v, g = t, b = p; break;\r\n    case 1: r = q, g = v, b = p; break;\r\n    case 2: r = p, g = v, b = t; break;\r\n    case 3: r = p, g = q, b = v; break;\r\n    case 4: r = t, g = p, b = v; break;\r\n    case 5: r = v, g = p, b = q; break;\r\n  }\r\n  var rgb = [ \r\n    Math.round(r * 255*round) / round, \r\n    Math.round(g * 255*round) / round, \r\n    Math.round(b * 255*round) / round\r\n  ];\r\n  if (hsv.length>3) rgb[3] = hsv[3];\r\n  return rgb;\r\n}\r\n/** Converts an HSL color value to RGB.\r\n * @param {ol/color~Color|string} rgb\r\n * @returns {string} \r\n */\r\nol.color.toHexa = function(rgb) {\r\n  return '#' + ((1 << 24) + (rgb[0] << 16) + (rgb[1] << 8) + rgb[2]).toString(16).slice(1);\r\n}\r\n\r\n/** Vanilla JS helper to manipulate DOM without jQuery\r\n * @see https://github.com/nefe/You-Dont-Need-jQuery\r\n * @see https://plainjs.com/javascript/\r\n * @see http://youmightnotneedjquery.com/\r\n */\r\n/** @namespace ol.ext.element */\r\nol.ext.element = {};\r\n/**\r\n * Create an element\r\n * @param {string} tagName The element tag, use 'TEXT' to create a text node\r\n * @param {*} options\r\n *  @param {string} options.className className The element class name \r\n *  @param {Element} options.parent Parent to append the element as child\r\n *  @param {Element|string} options.html Content of the element\r\n *  @param {Element|string} [options.options] when tagName = SELECT a list of options as key:value to add to the select\r\n *  @param {string} options.* Any other attribut to add to the element\r\n */\r\nol.ext.element.create = function (tagName, options) {\r\n  options = options || {};\r\n  var elt;\r\n  // Create text node\r\n  if (tagName === 'TEXT') {\r\n    elt = document.createTextNode(options.html||'');\r\n    if (options.parent) options.parent.appendChild(elt);\r\n  } else {\r\n    // Other element\r\n    elt = document.createElement(tagName);\r\n    if (/button/i.test(tagName)) elt.setAttribute('type', 'button');\r\n    for (var attr in options) {\r\n      switch (attr) {\r\n        case 'className': {\r\n          if (options.className && options.className.trim) elt.setAttribute('class', options.className.trim());\r\n          break;\r\n        }\r\n        case 'html': {\r\n          if (options.html instanceof Element) elt.appendChild(options.html)\r\n          else if (options.html!==undefined) elt.innerHTML = options.html;\r\n          break;\r\n        }\r\n        case 'parent': {\r\n          if (options.parent) options.parent.appendChild(elt);\r\n          break;\r\n        }\r\n        case 'options': {\r\n          if (/select/i.test(tagName)) {\r\n            for (var i in options.options) {\r\n              ol.ext.element.create('OPTION', {\r\n                html: i,\r\n                value: options.options[i],\r\n                parent: elt          \r\n              })\r\n            }\r\n          }\r\n          break;\r\n        }\r\n        case 'style': {\r\n          this.setStyle(elt, options.style);\r\n          break;\r\n        }\r\n        case 'change':\r\n        case 'click': {\r\n          ol.ext.element.addListener(elt, attr, options[attr]);\r\n          break;\r\n        }\r\n        case 'on': {\r\n          for (var e in options.on) {\r\n            ol.ext.element.addListener(elt, e, options.on[e]);\r\n          }\r\n          break;\r\n        }\r\n        case 'checked': {\r\n          elt.checked = !!options.checked;\r\n          break;\r\n        }\r\n        default: {\r\n          elt.setAttribute(attr, options[attr]);\r\n          break;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  return elt;\r\n};\r\n/** Create a toggle switch input\r\n * @param {*} options\r\n *  @param {string|Element} options.html\r\n *  @param {string|Element} options.after\r\n *  @param {boolean} options.checked\r\n *  @param {*} [options.on] a list of actions\r\n *  @param {function} [options.click]\r\n *  @param {function} [options.change]\r\n *  @param {Element} options.parent\r\n */\r\nol.ext.element.createSwitch = function (options) {\r\n  var input = ol.ext.element.create('INPUT', {\r\n    type: 'checkbox',\r\n    on: options.on,\r\n    click: options.click,\r\n    change: options.change,\r\n    parent: options.parent\r\n  });\r\n  var opt = Object.assign ({ input: input }, options || {});\r\n  new ol.ext.input.Switch(opt);\r\n  return input;\r\n};\r\n/** Create a toggle switch input\r\n * @param {*} options\r\n *  @param {string|Element} options.html\r\n *  @param {string|Element} options.after\r\n *  @param {string} [options.name] input name\r\n *  @param {string} [options.type=checkbox] input type: radio or checkbox\r\n *  @param {string} options.value input value\r\n *  @param {*} [options.on] a list of actions\r\n *  @param {function} [options.click]\r\n *  @param {function} [options.change]\r\n *  @param {Element} options.parent\r\n */\r\nol.ext.element.createCheck = function (options) {\r\n  var input = ol.ext.element.create('INPUT', {\r\n    name: options.name,\r\n    type: (options.type==='radio' ? 'radio' : 'checkbox'),\r\n    on: options.on,\r\n    parent: options.parent\r\n  });\r\n  console.log(input)\r\n  var opt = Object.assign ({ input: input }, options || {});\r\n  if (options.type === 'radio') {\r\n    new ol.ext.input.Radio(opt);\r\n  } else {\r\n    new ol.ext.input.Checkbox(opt);\r\n  }\r\n  return input;\r\n};\r\n/** Set inner html or append a child element to an element\r\n * @param {Element} element\r\n * @param {Element|string} html Content of the element\r\n */\r\nol.ext.element.setHTML = function(element, html) {\r\n  if (html instanceof Element) element.appendChild(html)\r\n  else if (html!==undefined) element.innerHTML = html;\r\n};\r\n/** Append text into an elemnt\r\n * @param {Element} element\r\n * @param {string} text text content\r\n */\r\nol.ext.element.appendText = function(element, text) {\r\n  element.appendChild(document.createTextNode(text||''));\r\n};\r\n/**\r\n * Add a set of event listener to an element\r\n * @param {Element} element\r\n * @param {string|Array<string>} eventType\r\n * @param {function} fn\r\n */\r\nol.ext.element.addListener = function (element, eventType, fn, useCapture ) {\r\n  if (typeof eventType === 'string') eventType = eventType.split(' ');\r\n  eventType.forEach(function(e) {\r\n    element.addEventListener(e, fn, useCapture);\r\n  });\r\n};\r\n/**\r\n * Add a set of event listener to an element\r\n * @param {Element} element\r\n * @param {string|Array<string>} eventType\r\n * @param {function} fn\r\n */\r\nol.ext.element.removeListener = function (element, eventType, fn) {\r\n  if (typeof eventType === 'string') eventType = eventType.split(' ');\r\n  eventType.forEach(function(e) {\r\n    element.removeEventListener(e, fn);\r\n  });\r\n};\r\n/**\r\n * Show an element\r\n * @param {Element} element\r\n */\r\nol.ext.element.show = function (element) {\r\n  element.style.display = '';\r\n};\r\n/**\r\n * Hide an element\r\n * @param {Element} element\r\n */\r\nol.ext.element.hide = function (element) {\r\n  element.style.display = 'none';\r\n};\r\n/**\r\n * Test if an element is hihdden\r\n * @param {Element} element\r\n * @return {boolean}\r\n */\r\nol.ext.element.hidden = function (element) {\r\n  return ol.ext.element.getStyle(element, 'display') === 'none';\r\n};\r\n/**\r\n * Toggle an element\r\n * @param {Element} element\r\n */\r\nol.ext.element.toggle = function (element) {\r\n  element.style.display = (element.style.display==='none' ? '' : 'none');\r\n};\r\n/** Set style of an element\r\n * @param {DOMElement} el the element\r\n * @param {*} st list of style\r\n */\r\nol.ext.element.setStyle = function(el, st) {\r\n  for (var s in st) {\r\n    switch (s) {\r\n      case 'top':\r\n      case 'left':\r\n      case 'bottom':\r\n      case 'right':\r\n      case 'minWidth':\r\n      case 'maxWidth':\r\n      case 'width':\r\n      case 'height': {\r\n        if (typeof(st[s]) === 'number') {\r\n          el.style[s] = st[s]+'px';\r\n        } else {\r\n          el.style[s] = st[s];\r\n        }\r\n        break;\r\n      }\r\n      default: {\r\n        el.style[s] = st[s];\r\n      }\r\n    }\r\n  }\r\n};\r\n/**\r\n * Get style propertie of an element\r\n * @param {DOMElement} el the element\r\n * @param {string} styleProp Propertie name\r\n * @return {*} style value\r\n */\r\nol.ext.element.getStyle = function(el, styleProp) {\r\n  var value, defaultView = (el.ownerDocument || document).defaultView;\r\n  // W3C standard way:\r\n  if (defaultView && defaultView.getComputedStyle) {\r\n    // sanitize property name to css notation\r\n    // (hypen separated words eg. font-Size)\r\n    styleProp = styleProp.replace(/([A-Z])/g, \"-$1\").toLowerCase();\r\n    value = defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);\r\n  } else if (el.currentStyle) { // IE\r\n    // sanitize property name to camelCase\r\n    styleProp = styleProp.replace(/-(\\w)/g, function(str, letter) {\r\n      return letter.toUpperCase();\r\n    });\r\n    value = el.currentStyle[styleProp];\r\n    // convert other units to pixels on IE\r\n    if (/^\\d+(em|pt|%|ex)?$/i.test(value)) { \r\n      return (function(value) {\r\n        var oldLeft = el.style.left, oldRsLeft = el.runtimeStyle.left;\r\n        el.runtimeStyle.left = el.currentStyle.left;\r\n        el.style.left = value || 0;\r\n        value = el.style.pixelLeft + \"px\";\r\n        el.style.left = oldLeft;\r\n        el.runtimeStyle.left = oldRsLeft;\r\n        return value;\r\n      })(value);\r\n    }\r\n  }\r\n  if (/px$/.test(value)) return parseInt(value);\r\n  return value;\r\n};\r\n/** Get outerHeight of an elemen\r\n * @param {DOMElement} elt\r\n * @return {number}\r\n */\r\nol.ext.element.outerHeight = function(elt) {\r\n  return elt.offsetHeight + ol.ext.element.getStyle(elt, 'marginBottom')\r\n};\r\n/** Get outerWidth of an elemen\r\n * @param {DOMElement} elt\r\n * @return {number}\r\n */\r\nol.ext.element.outerWidth = function(elt) {\r\n  return elt.offsetWidth + ol.ext.element.getStyle(elt, 'marginLeft')\r\n};\r\n/** Get element offset rect\r\n * @param {DOMElement} elt\r\n * @return {*} \r\n */\r\nol.ext.element.offsetRect = function(elt) {\r\n  var rect = elt.getBoundingClientRect();\r\n  return {\r\n    top: rect.top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0),\r\n    left: rect.left + (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0),\r\n    height: rect.height || (rect.bottom - rect.top),\r\n    width: rect.width || (rect.right - rect.left)\r\n  }\r\n};\r\n/** Get element offset \r\n * @param {ELement} elt\r\n * @returns {Object} top/left offset\r\n */\r\nol.ext.element.getFixedOffset = function(elt) {\r\n  var offset = {\r\n    left:0,\r\n    top:0\r\n  };\r\n  var getOffset = function(parent) {\r\n    if (!parent) return offset;\r\n    if (ol.ext.element.getStyle(parent, 'position') === 'absolute') {\r\n      var r = parent.getBoundingClientRect();\r\n      offset.left += r.left; \r\n      offset.top += r.top; \r\n      return offset;\r\n    }\r\n    console.log(parent, offset)\r\n    return getOffset(parent.offsetParent)\r\n  }\r\n  return getOffset(elt.offsetParent)\r\n};\r\n/** Get element offset rect\r\n * @param {DOMElement} elt\r\n * @param {boolean} fixed get fixed position\r\n * @return {Object} \r\n */\r\nol.ext.element.positionRect = function(elt, fixed) {\r\n  var gleft = 0;\r\n  var gtop = 0;\r\n  var getRect = function( parent ) {\r\n    if (parent) {\r\n      gleft += parent.offsetLeft;\r\n      gtop += parent.offsetTop;\r\n      return getRect(parent.offsetParent);\r\n    } else {\r\n      var r = {\r\n        top: elt.offsetTop + gtop,\r\n        left: elt.offsetLeft + gleft\r\n      };\r\n      if (fixed) {\r\n        r.top -= (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0);\r\n        r.left -= (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0);\r\n      }\r\n      r.bottom = r.top + elt.offsetHeight;\r\n      r.right = r.top + elt.offsetWidth;\r\n      return r;\r\n    }\r\n  }; \r\n  return getRect(elt.offsetParent);\r\n}\r\n/** Make a div scrollable without scrollbar.\r\n * On touch devices the default behavior is preserved\r\n * @param {DOMElement} elt\r\n * @param {*} options\r\n *  @param {function} [options.onmove] a function that takes a boolean indicating that the div is scrolling\r\n *  @param {boolean} [options.vertical=false] \r\n *  @param {boolean} [options.animate=true] add kinetic to scroll\r\n *  @param {boolean} [options.mousewheel=false] enable mousewheel to scroll\r\n *  @param {boolean} [options.minibar=false] add a mini scrollbar to the parent element (only vertical scrolling)\r\n * @returns {Object} an object with a refresh function\r\n */\r\nol.ext.element.scrollDiv = function(elt, options) {\r\n  options = options || {};\r\n  var pos = false;\r\n  var speed = 0;\r\n  var d, dt = 0;\r\n  var onmove = (typeof(options.onmove) === 'function' ? options.onmove : function(){});\r\n  //var page = options.vertical ? 'pageY' : 'pageX';\r\n  var page = options.vertical ? 'screenY' : 'screenX';\r\n  var scroll = options.vertical ? 'scrollTop' : 'scrollLeft';\r\n  var moving = false;\r\n  // Factor scale content / container\r\n  var scale, isbar;\r\n  // Update the minibar\r\n  var updateCounter = 0;\r\n  var updateMinibar = function() {\r\n    if (scrollbar) {\r\n      updateCounter++;\r\n      setTimeout(updateMinibarDelay);\r\n    }\r\n  }\r\n  var updateMinibarDelay = function() {\r\n    if (scrollbar) {\r\n      updateCounter--;\r\n      // Prevent multi call\r\n      if (updateCounter) return;\r\n      // Container height\r\n      var pheight = elt.clientHeight;\r\n      // Content height\r\n      var height = elt.scrollHeight;\r\n      // Set scrollbar value\r\n      scale = pheight / height;\r\n      scrollbar.style.height = scale * 100 + '%';\r\n      scrollbar.style.top = (elt.scrollTop / height * 100) + '%';\r\n      scrollContainer.style.height = pheight + 'px';\r\n      // No scroll\r\n      if (pheight > height - .5) scrollContainer.classList.add('ol-100pc');\r\n      else scrollContainer.classList.remove('ol-100pc');\r\n    }\r\n  }\r\n  // Handle pointer down\r\n  var onPointerDown = function(e) {\r\n    // Prevent scroll\r\n    if (e.target.classList.contains('ol-noscroll')) return;\r\n    // Start scrolling\r\n    moving = false;\r\n    pos = e[page];\r\n    dt = new Date();\r\n    elt.classList.add('ol-move');\r\n    // Prevent elt dragging\r\n    e.preventDefault();\r\n    // Listen scroll\r\n    window.addEventListener('pointermove', onPointerMove);\r\n    ol.ext.element.addListener(window, ['pointerup','pointercancel'], onPointerUp);\r\n  }\r\n  // Register scroll\r\n  var onPointerMove = function(e) {\r\n    moving = true;\r\n    if (pos !== false) {\r\n      var delta = (isbar ? -1/scale : 1) * (pos - e[page]);\r\n      elt[scroll] += delta;\r\n      d = new Date();\r\n      if (d-dt) {\r\n        speed = (speed + delta / (d - dt))/2;\r\n      }\r\n      pos = e[page];\r\n      dt = d;\r\n      // Tell we are moving\r\n      if (delta) onmove(true);\r\n    }\r\n  };\r\n  // Animate scroll\r\n  var animate = function(to) {\r\n    var step = (to>0) ? Math.min(100, to/2) : Math.max(-100, to/2);\r\n    to -= step;\r\n    elt[scroll] += step;\r\n    if (-1 < to && to < 1) {\r\n      if (moving) setTimeout(function() { elt.classList.remove('ol-move'); });\r\n      else elt.classList.remove('ol-move');\r\n      moving = false;\r\n      onmove(false);\r\n    } else {\r\n      setTimeout(function() {\r\n        animate(to);\r\n      }, 40);\r\n    }\r\n  }\r\n  // Initialize scroll container for minibar\r\n  var scrollContainer, scrollbar;\r\n  if (options.vertical && options.minibar) {\r\n    var init = function(b) {\r\n      // only once\r\n      elt.removeEventListener('pointermove', init);\r\n      elt.parentNode.classList.add('ol-miniscroll');\r\n      scrollbar = ol.ext.element.create('DIV');\r\n      scrollContainer = ol.ext.element.create('DIV', {\r\n        className: 'ol-scroll',\r\n        html: scrollbar\r\n      });\r\n      elt.parentNode.insertBefore(scrollContainer, elt);\r\n      // Move scrollbar\r\n      scrollbar.addEventListener('pointerdown', function(e) {\r\n        isbar = true;\r\n        onPointerDown(e)\r\n      });\r\n      // Handle mousewheel\r\n      if (options.mousewheel) {\r\n        ol.ext.element.addListener(scrollContainer, \r\n          ['mousewheel', 'DOMMouseScroll', 'onmousewheel'], \r\n          function(e) { onMouseWheel(e) }\r\n        );\r\n        ol.ext.element.addListener(scrollbar, \r\n          ['mousewheel', 'DOMMouseScroll', 'onmousewheel'], \r\n          function(e) { onMouseWheel(e) }\r\n        );\r\n      }\r\n      // Update on enter\r\n      elt.parentNode.addEventListener('pointerenter', updateMinibar);\r\n      // Update on resize\r\n      window.addEventListener('resize', updateMinibar);\r\n      // Update\r\n      if (b!==false) updateMinibar();\r\n    };\r\n    // Allready inserted in the DOM\r\n    if (elt.parentNode) init(false);\r\n    // or wait when ready\r\n    else elt.addEventListener('pointermove', init);\r\n    // Update on scroll\r\n    elt.addEventListener('scroll', function() {\r\n      updateMinibar();\r\n    });\r\n  }\r\n  // Enable scroll\r\n  elt.style['touch-action'] = 'none';\r\n  elt.style['overflow'] = 'hidden';\r\n  elt.classList.add('ol-scrolldiv');\r\n  // Start scrolling\r\n  ol.ext.element.addListener(elt, ['pointerdown'], function(e) {\r\n    isbar = false;\r\n    onPointerDown(e)\r\n  });\r\n  // Prevet click when moving...\r\n  elt.addEventListener('click', function(e) {\r\n    if (elt.classList.contains('ol-move')) {\r\n      e.preventDefault();\r\n      e.stopPropagation();\r\n    }\r\n  }, true);\r\n  // Stop scrolling\r\n  var onPointerUp = function(e) {\r\n    dt = new Date() - dt;\r\n    if (dt>100 || isbar) {\r\n      // User stop: no speed\r\n      speed = 0;\r\n    } else if (dt>0) {\r\n      // Calculate new speed\r\n      speed = ((speed||0) + (pos - e[page]) / dt) / 2;\r\n    }\r\n    animate(options.animate===false ? 0 : speed*200);\r\n    pos = false;\r\n    speed = 0;\r\n    dt = 0;\r\n    // Add class to handle click (on iframe / double-click)\r\n    if (!elt.classList.contains('ol-move')) {\r\n      elt.classList.add('ol-hasClick')\r\n      setTimeout(function() { elt.classList.remove('ol-hasClick'); }, 500);\r\n    } else {\r\n      elt.classList.remove('ol-hasClick');\r\n    }\r\n    isbar = false;\r\n    window.removeEventListener('pointermove', onPointerMove)\r\n    ol.ext.element.removeListener(window, ['pointerup','pointercancel'], onPointerUp);\r\n  };\r\n  // Handle mousewheel\r\n  var onMouseWheel = function(e) {\r\n    var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));\r\n    elt.classList.add('ol-move');\r\n    elt[scroll] -= delta*30;\r\n    elt.classList.remove('ol-move');\r\n    return false;\r\n  }\r\n  if (options.mousewheel) { // && !elt.classList.contains('ol-touch')) {\r\n    ol.ext.element.addListener(elt, \r\n      ['mousewheel', 'DOMMouseScroll', 'onmousewheel'], \r\n      onMouseWheel\r\n    );\r\n  }\r\n  return { \r\n    refresh: updateMinibar\r\n  }\r\n};\r\n/** Dispatch an event to an Element \r\n * @param {string} eventName\r\n * @param {Element} element\r\n */\r\nol.ext.element.dispatchEvent = function (eventName, element) {\r\n  var event;\r\n  try {\r\n    event = new CustomEvent(eventName);\r\n  } catch(e) {\r\n    // Try customevent on IE\r\n    event = document.createEvent(\"CustomEvent\");\r\n    event.initCustomEvent(eventName, true, true, {});\r\n  }\r\n  element.dispatchEvent(event);\r\n};\r\n\r\n/** Get a canvas overlay for a map (non rotated, on top of the map)\r\n * @param {ol.Map} map\r\n * @return {canvas}\r\n */\r\nol.ext.getMapCanvas = function(map) {\r\n  if (!map) return null;\r\n  var canvas = map.getViewport().getElementsByClassName('ol-fixedoverlay')[0];\r\n  if (!canvas) {\r\n    if (map.getViewport().querySelector('.ol-layers')) {\r\n      // Add a fixed canvas layer on top of the map\r\n      canvas = document.createElement('canvas');\r\n      canvas.className = 'ol-fixedoverlay';\r\n      map.getViewport().querySelector('.ol-layers').after(canvas);\r\n      // Clear before new compose\r\n      map.on('precompose', function (e){\r\n        canvas.width = map.getSize()[0] * e.frameState.pixelRatio;\r\n        canvas.height = map.getSize()[1] * e.frameState.pixelRatio;\r\n      });\r\n    } else {\r\n      canvas = map.getViewport().querySelector('canvas');\r\n    }\r\n  }\r\n  return canvas;\r\n};\r\n  \r\n/** @namespace ol.ext.imageLoader\r\n */\r\nif (window.ol) window.ol.ext.imageLoader = {};\r\n/** Helper for loading BIL-32 (Band Interleaved by Line) image\r\n * @param {string} src\r\n * @param {function} onload a function that takes a Float32Array and a ol.size.Size (array size)\r\n * @param {function} onerror\r\n * @private\r\n */\r\nol.ext.imageLoader.loadBILImage = function(src, onload, onerror) {\r\n  var size = [\r\n    parseInt(src.replace(/.*WIDTH=(\\d*).*/i,'$1')), \r\n    parseInt(src.replace(/.*HEIGHT=(\\d*).*/i,'$1'))\r\n  ];\r\n  var xhr = new XMLHttpRequest();\r\n  xhr.responseType = 'blob';\r\n  xhr.addEventListener('loadend', function () {\r\n    var resp = this.response;\r\n    if (resp !== undefined) {\r\n      var reader = new FileReader();\r\n      // Get as array\r\n      reader.addEventListener('loadend', (e) => {\r\n        var data = new Float32Array(e.target.result);\r\n        onload(data, size);\r\n      });\r\n      // Start reading the blob\r\n      reader.readAsArrayBuffer(resp);\r\n      // tile.getImage().src = URL.createObjectURL(blob);\r\n    } else {\r\n      onerror();\r\n    }\r\n  });\r\n  xhr.addEventListener('error', function () {\r\n    onerror();\r\n  });\r\n  xhr.open('GET', src);\r\n  xhr.send();\r\n};\r\n/** Helper for loading image\r\n * @param {string} src\r\n * @param {function} onload a function that takes a an image and a ol.size.Size\r\n * @param {function} onerror\r\n * @private\r\n */\r\nol.ext.imageLoader.loadImage = function(src, onload, onerror) {\r\n  var xhr = new XMLHttpRequest();\r\n  xhr.responseType = 'blob';\r\n  xhr.addEventListener('loadend', function () {\r\n    var resp = this.response;\r\n    if (resp !== undefined) {\r\n      var img = new Image();\r\n      img.onload = function() {\r\n        onload(img, [img.naturalWidth, img.naturalHeight]);\r\n      }\r\n      img.src = URL.createObjectURL(resp);\r\n    } else {\r\n      onerror();\r\n    }\r\n  });\r\n  xhr.addEventListener('error', function () {\r\n    onerror();\r\n  });\r\n  xhr.open('GET', src);\r\n  xhr.send();\r\n};\r\n/** Get a TileLoadFunction to transform tiles images\r\n * @param {function} setPixel a function that takes a Uint8ClampedArray and the pixel position to transform\r\n * @returns {function} an ol/Tile~LoadFunction\r\n */\r\nol.ext.imageLoader.pixelTransform = function(setPixel) {\r\n  return function(tile, src) {\r\n    ol.ext.imageLoader.loadImage(\r\n      src, \r\n      function(img, size) {\r\n        var canvas = document.createElement('canvas');\r\n        canvas.width = size[0];\r\n        canvas.height = size[1];\r\n        var ctx = canvas.getContext('2d');\r\n        ctx.drawImage(img, 0, 0);\r\n        var imgData = ctx.getImageData(0, 0, size[0], size[1]);\r\n        var pixels = imgData.data;\r\n        for (var i = 0; i < pixels.length; i += 4) {\r\n          setPixel(pixels, i, size);\r\n        }\r\n        ctx.putImageData(imgData, 0, 0);\r\n        tile.setImage(canvas);\r\n      },\r\n      function() {\r\n        tile.setState(3);\r\n      }\r\n    );\r\n  }\r\n};\r\n/** Get a TileLoadFunction to transform tiles into grayscale images\r\n * @returns {function} an ol/Tile~LoadFunction\r\n */\r\nol.ext.imageLoader.grayscale = function() {\r\n  return ol.ext.imageLoader.pixelTransform(function(pixels, i) {\r\n    pixels[i] = pixels[i + 1] = pixels[i + 2] = parseInt(3*pixels[i] + 4*pixels[i + 1] + pixels[i + 2] >>> 3);\r\n  })\r\n};\r\n/** Get a TileLoadFunction to turn color or a color range transparent\r\n * @param {ol.color.Color|Array<ol.color.Color>} colors color or color range to turn transparent\r\n * @returns {function} an ol/Tile~LoadFunction\r\n */\r\nol.ext.imageLoader.transparent = function(colors) {\r\n  var color1, color2;\r\n  if (colors instanceof Array) {\r\n    color1 = colors[0];\r\n    color2 = colors[1];\r\n  }\r\n  var color = color1 = ol.color.asArray(color1);\r\n  if (!color2) {\r\n    return ol.ext.imageLoader.pixelTransform(function(pixels, i) {\r\n      if (pixels[i]===color[0] && pixels[i+1]===color[1] && pixels[i+2]===color[2]) {\r\n        pixels[i+3] = 0;\r\n      }\r\n    })\r\n  } else {\r\n    color2 = ol.color.asArray(color2);\r\n    color = [Math.min(color1[0], color2[0]), Math.min(color1[1], color2[1]), Math.min(color1[2], color2[2])];\r\n    color2 = [Math.max(color1[0], color2[0]), Math.max(color1[1], color2[1]), Math.max(color1[2], color2[2])];\r\n    return ol.ext.imageLoader.pixelTransform(function(pixels, i) {\r\n      if (pixels[i]>=color1[0] && pixels[i]<=color2[0] \r\n        && pixels[i+1]>=color[1] && pixels[i+1]<=color2[1] \r\n        && pixels[i+2]>=color[2] && pixels[i+2]<=color2[2]) {\r\n        pixels[i+3] = 0;\r\n      }\r\n    })\r\n  }\r\n};\r\n/** Returns an Imageloader function to load an x-bil-32 image as sea level map \r\n * to use as a ol/Tile~LoadFunction or ol/Image~LoadFunction\r\n * @param { number } level\r\n * @param {*} options\r\n *  @param { ol.Color } [options.color] fill color\r\n *  @param { boolean } [options.opacity=true] smooth color on border\r\n *  @param { number } [options.minValue=-Infinity] minimum level value\r\n * @returns {function} an ol/Tile~LoadFunction\r\n */\r\nol.ext.imageLoader.seaLevelMap = function(level, options) {\r\n  options = options || {};\r\n  var h0 = Math.max(level + .01, .01);\r\n  var c = options.color ? ol.color.asArray(options.color) : [135,203,249];\r\n  var min = typeof(options.minValue) === 'number' ? options.minValue : -Infinity;\r\n  var opacity = options.opacity!==false;\r\n  return ol.ext.imageLoader.elevationMap(function(h) {\r\n    if (h < h0 && h > min) {\r\n      return [c[0], c[1], c[2], opacity ? 255 * (h0-h) / h0 : 255];\r\n    } else {\r\n      return [0,0,0,0];\r\n    }\r\n  })\r\n};\r\n/** Shaded relief ? not/bad working yet...\r\n * @returns {function} an ol/Tile~LoadFunction\r\n * @private\r\n */\r\nol.ext.imageLoader.shadedRelief = function() {\r\n  var sunElev = Math.PI / 4;\r\n  var sunAzimuth = 2*Math.PI - Math.PI / 4;\r\n  return function (tile, src) {\r\n    ol.ext.imageLoader.loadBILImage(\r\n      src,\r\n      function(data, size) {\r\n        var canvas = document.createElement('canvas');\r\n        var ctx = canvas.getContext('2d');\r\n        var width = canvas.width = size[0];\r\n        var height = canvas.height = size[1];\r\n        var imgData = ctx.getImageData(0, 0, width, height);\r\n        var pixels = imgData.data;\r\n        function getIndexForCoordinates(x, y) {\r\n          return x + y*width;\r\n        }\r\n        for (var x=0; x<width; x++) for(var y=0; y<height; y++) {\r\n          var top = getIndexForCoordinates(x,Math.max(0,y-1))\r\n          var left = getIndexForCoordinates(Math.max(0,x-1),y);\r\n          var right = getIndexForCoordinates(Math.min(width-1,x+1),y);\r\n          var bottom = getIndexForCoordinates(x,Math.min(height,y+1))\r\n          // get slope values\r\n          var topValue = data[top];\r\n          var leftValue = data[left];\r\n          var rightValue = data[right];\r\n          var bottomValue = data[bottom];\r\n          var slx = (rightValue - leftValue)/3;\r\n          var sly = ( bottomValue - topValue )/3;\r\n          var sl0 = Math.sqrt( slx*slx + sly*sly );\r\n          // get aspect\r\n          var phi = Math.acos( slx/sl0 );\r\n          if ( sl0 == 0 ) {\r\n            phi = 0;\r\n          }\r\n          var azimuth = 0;\r\n          if ( slx > 0 ) {\r\n            if ( sly > 0 ) azimuth = phi + 1.5*Math.PI;\r\n            else if ( sly < 0 ) azimuth = 1.5*Math.PI - phi;\r\n            else phi = 1.5*Math.PI;\r\n          } else if ( slx < 0 ){\r\n            if ( sly < 0 ) azimuth = phi + .5*Math.PI;\r\n            else if ( sly > 0 ) azimuth = .5*Math.PI - phi;\r\n            else azimuth = .5*Math.PI;\r\n          } else {\r\n            if ( sly < 0 ) azimuth = Math.PI;\r\n            else if ( sly > 0 ) azimuth = 0;\r\n          }\r\n          // get luminance\r\n          var lum = Math.cos( azimuth - sunAzimuth )*Math.cos( Math.PI*.5 - Math.atan(sl0) )*Math.cos( sunElev ) +  Math.sin( Math.PI*.5 - Math.atan(sl0) )*Math.sin( sunElev );\r\n          if (lum<0) lum = 0;\r\n          lum = Math.sqrt(lum*.8 + .5);\r\n          var p = getIndexForCoordinates(x,y) * 4;\r\n          pixels[p] = pixels[p+1] = pixels[p+2] = 0;\r\n          pixels[p+3] = 255 - lum*255;\r\n        }\r\n        ctx.putImageData(imgData, 0, 0);\r\n        tile.setImage(canvas);\r\n      },\r\n      function () {\r\n        tile.setState(3);\r\n      }\r\n    )\r\n  };\r\n};\r\n/** Get a TileLoadFunction to load an x-bil-32 image as elevation map (ie. pixels colors codes elevations as terrain-RGB)\r\n * If getPixelColor is not define pixel store elevation as rgb, use {@link ol.ext.getElevationFromPixel} to get elevation from pixel\r\n * @param {function} [getPixelColor] a function that taket an elevation and return a color array [r,g,b,a], default store elevation as terrain-RGB\r\n * @returns {function} an ol/Tile~LoadFunction\r\n */\r\nol.ext.imageLoader.elevationMap = function(getPixelColor) {\r\n  if (typeof(getPixelColor) !== 'function') getPixelColor = ol.ext.getPixelFromElevation;\r\n  return function (tile, src) {\r\n    ol.ext.imageLoader.loadBILImage(\r\n      src,\r\n      function(data, size) {\r\n        var canvas = document.createElement('canvas');\r\n        var ctx = canvas.getContext('2d');\r\n        canvas.width = size[0];\r\n        canvas.height = size[1];\r\n        var imgData = ctx.getImageData(0, 0, size[0], size[1]);\r\n        var pixels = imgData.data;\r\n        for (var i=0; i<data.length; i++) {\r\n          var p = getPixelColor(data[i]);\r\n          pixels[4*i] = p[0];\r\n          pixels[4*i+1] = p[1];\r\n          pixels[4*i+2] = p[2];\r\n          pixels[4*i+3] = p[3];\r\n        }\r\n        ctx.putImageData(imgData, 0, 0);\r\n        tile.setImage(canvas);\r\n      },\r\n      function () {\r\n        tile.setState(3);\r\n      }\r\n    )\r\n  };\r\n};\r\n/** Convert elevation to pixel as terrain-RGB\r\n * Encode elevation data in raster tiles\r\n * - max deep watter trench min > -12000 m\r\n * - 2 digits (0.01 m)\r\n * @param {number} height elevation\r\n * @returns {Array<number>} pixel value\r\n */\r\nol.ext.getPixelFromElevation =  function(height) {\r\n  var h = Math.round(height*100 + 1200000);\r\n  var pixel = [\r\n    h >> 16, \r\n    (h % 65536) >> 8, \r\n    h % 256, \r\n    255\r\n  ];\r\n  return pixel;\r\n};\r\n/** Convert pixel (terrain-RGB) to elevation \r\n * @see ol.ext.getPixelFromElevation\r\n * @param {Array<number>} pixel the pixel value\r\n * @returns {number} elevation\r\n */\r\nol.ext.getElevationFromPixel = function(pixel) {\r\n  // return -10000 + (pixel[0] * 65536 + pixel[1] * 256 + pixel[2]) * 0.01;\r\n  return -12000 + ((pixel[0] << 16) + (pixel[1] << 8) + pixel[2]) * 0.01;\r\n};\r\n\r\n/* See \r\nhttps://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Matrix_math_for_the_web\r\nhttps://evanw.github.io/lightgl.js/docs/matrix.html \r\nhttps://github.com/jlmakes/rematrix\r\nhttps://jsfiddle.net/2znLxda2/\r\n*/\r\n/** Matrix3D; a set of functions to handle matrix3D\r\n */\r\nol.matrix3D = {};\r\n/** Get transform matrix3D of an element\r\n * @param {Element} ele\r\n * @return {Array<Array<number>>}\r\n */\r\nol.matrix3D.getTransform = function(ele) {\r\n  var style = window.getComputedStyle(ele, null);\r\n  var tr = style.getPropertyValue(\"-webkit-transform\") \r\n    || style.getPropertyValue(\"-moz-transform\") \r\n    || style.getPropertyValue(\"-ms-transform\") \r\n    || style.getPropertyValue(\"-o-transform\") \r\n    || style.getPropertyValue(\"transform\");\r\n  var values = tr.split('(')[1].split(')')[0].split(',');\r\n  var mx = [ [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1] ];    \r\n  var i, j;\r\n  if (values.length === 16) {\r\n    for (i = 0; i < 4; ++i) {\r\n      for (j = 0; j < 4; ++j) {\r\n        mx[j][i] = +values[i * 4 + j];\r\n      }\r\n    }\r\n  } else {\r\n    for (i = 0; i < 3; ++i) {\r\n      for (j = 0; j < 2; ++j) {\r\n        mx[j][i] = +values[i * 2 + j];\r\n      }\r\n    }\r\n  }\r\n  return mx;\r\n};\r\n/** Get transform matrix3D of an element\r\n * @param {Element} ele\r\n * @return {Array<number>}\r\n */\r\nol.matrix3D.getTransformOrigin = function (ele) {\r\n  var style = window.getComputedStyle(ele, null);\r\n  var tr = style.getPropertyValue(\"-webkit-transform-origin\") \r\n    || style.getPropertyValue(\"-moz-transform-origin\") \r\n    || style.getPropertyValue(\"-ms-transform-origin\") \r\n    || style.getPropertyValue(\"-o-transform-origin\") \r\n    || style.getPropertyValue(\"transform-origin\");\r\n  var values = tr.split(' ');\r\n  var mx = [ 0, 0, 0, 1 ];\r\n  for (var i = 0; i < values.length; ++i) {\r\n    mx[i] = parseInt(values[i]);\r\n  }\r\n  return mx;\r\n};\r\n/** Compute translate matrix\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {number} z\r\n * @return {Array<Array<number>>}\r\n */\r\nol.matrix3D.translateMatrix = function(x, y, z) {\r\n  return [\r\n    [1, 0, 0, x],\r\n    [0, 1, 0, y],\r\n    [0, 0, 1, z],\r\n    [0, 0, 0, 1]\r\n  ];\r\n};\r\n/** Identity matrix\r\n * @return {Array<Array<number>>}\r\n */\r\nol.matrix3D.identity = function() {\r\n  return [\r\n    [1, 0, 0, 0],\r\n    [0, 1, 0, 0],\r\n    [0, 0, 1, 0],\r\n    [0, 0, 0, 1]\r\n  ];\r\n};\r\n/** Round matrix\r\n * @param {Array<Array<number>>} mx\r\n * @param {number} round Rounding value, default 1E-10\r\n */\r\nol.matrix3D.roundTo = function(mx, round) {\r\n  if (!round) round = 1E-10;\r\n  var m = [[],[],[],[]];\r\n  for (var i=0; i<4; i++) {\r\n    for (var j=0; j<4; j++) {\r\n      m[i][j] = Math.round(mx[i][j] / round) * round;\r\n    }\r\n  }\r\n  return m;\r\n};\r\n/** Multiply matrix3D \r\n * @param {Array<Array<number>>} mx1\r\n * @param {Array<Array<number>>} mx2\r\n * @return {Array<Array<number>>} \r\n */\r\nol.matrix3D.multiply = function (mx1, mx2) {\r\n  var mx = [ [], [], [], [] ];\r\n  for (var i = 0; i < 4; ++i) {\r\n    for (var j = 0; j < 4; ++j) {\r\n      var sum = 0;\r\n      for (var k = 0; k < 4; ++k) {\r\n          sum += (mx1[k][i] * mx2[j][k]);\r\n      }\r\n      mx[j][i] = sum;\r\n    }\r\n  }\r\n  return mx;\r\n};\r\n/** Compute the full transform that is applied to the transformed parent: -origin o tx o origin\r\n * @param {Array<Array<number>>} tx transform matrix\r\n * @param {Array<Array<number>>} origin transform origin\r\n * @return {Array<Array<number>>} \r\n */\r\nol.matrix3D.computeTransformMatrix = function(tx, origin) {\r\n  var preTx = ol.matrix3D.translateMatrix(-origin[0], -origin[1], -origin[2]);\r\n  var postTx = ol.matrix3D.translateMatrix(origin[0], origin[1], origin[2]);\r\n  var temp1 = ol.matrix3D.multiply(preTx, tx);\r\n  return ol.matrix3D.multiply(temp1, postTx);\r\n};\r\n/** Apply transform to a coordinate\r\n * @param {Array<Array<number>>} tx\r\n * @param {ol.pixel} px\r\n */\r\nol.matrix3D.transformVertex = function(tx, px) {\r\n  var vert = [px[0], px[1], 0, 1]\r\n  var mx = [ ];\r\n  for (var i = 0; i < 4; ++i) {\r\n    mx[i] = 0;\r\n    for (var j = 0; j < 4; ++j) {\r\n      mx[i] += +tx[i][j] * vert[j];\r\n    }\r\n  }\r\n  return mx;\r\n}\r\n/** Perform the homogeneous divide to apply perspective to the points (divide x,y,z by the w component).\r\n * @param {Array<number>} vert\r\n * @return {Array<number>}\r\n */\r\nol.matrix3D.projectVertex = function(vert) {\r\n  var out = [ ];\r\n  for (var i = 0; i < 4; ++i) {\r\n    out[i] = vert[i] / vert[3];\r\n  }\r\n  return out;\r\n};\r\n/** Inverse a matrix3D \r\n * @return {Array<Array<number>>} m matrix to transform\r\n * @return {Array<Array<number>>}\r\n */\r\nol.matrix3D.inverse = function(m) {\r\n  var s0 = m[0][0] * m[1][1] - m[1][0] * m[0][1]\r\n  var s1 = m[0][0] * m[1][2] - m[1][0] * m[0][2]\r\n  var s2 = m[0][0] * m[1][3] - m[1][0] * m[0][3]\r\n  var s3 = m[0][1] * m[1][2] - m[1][1] * m[0][2]\r\n  var s4 = m[0][1] * m[1][3] - m[1][1] * m[0][3]\r\n  var s5 = m[0][2] * m[1][3] - m[1][2] * m[0][3]\r\n  var c5 = m[2][2] * m[3][3] - m[3][2] * m[2][3]\r\n  var c4 = m[2][1] * m[3][3] - m[3][1] * m[2][3]\r\n  var c3 = m[2][1] * m[3][2] - m[3][1] * m[2][2]\r\n  var c2 = m[2][0] * m[3][3] - m[3][0] * m[2][3]\r\n  var c1 = m[2][0] * m[3][2] - m[3][0] * m[2][2]\r\n  var c0 = m[2][0] * m[3][1] - m[3][0] * m[2][1]\r\n  var determinant = 1 / (s0 * c5 - s1 * c4 + s2 * c3 + s3 * c2 - s4 * c1 + s5 * c0)\r\n  if (isNaN(determinant) || determinant === Infinity) {\r\n    throw new Error('Inverse determinant attempted to divide by zero.')\r\n  }\r\n  return [\r\n    [\r\n      (m[1][1] * c5 - m[1][2] * c4 + m[1][3] * c3) * determinant,\r\n      (-m[0][1] * c5 + m[0][2] * c4 - m[0][3] * c3) * determinant,\r\n      (m[3][1] * s5 - m[3][2] * s4 + m[3][3] * s3) * determinant,\r\n      (-m[2][1] * s5 + m[2][2] * s4 - m[2][3] * s3) * determinant\r\n    ],[\r\n      (-m[1][0] * c5 + m[1][2] * c2 - m[1][3] * c1) * determinant,\r\n      (m[0][0] * c5 - m[0][2] * c2 + m[0][3] * c1) * determinant,\r\n      (-m[3][0] * s5 + m[3][2] * s2 - m[3][3] * s1) * determinant,\r\n      (m[2][0] * s5 - m[2][2] * s2 + m[2][3] * s1) * determinant\r\n    ],[\r\n      (m[1][0] * c4 - m[1][1] * c2 + m[1][3] * c0) * determinant,\r\n      (-m[0][0] * c4 + m[0][1] * c2 - m[0][3] * c0) * determinant,\r\n      (m[3][0] * s4 - m[3][1] * s2 + m[3][3] * s0) * determinant,\r\n      (-m[2][0] * s4 + m[2][1] * s2 - m[2][3] * s0) * determinant\r\n    ],[\r\n      (-m[1][0] * c3 + m[1][1] * c1 - m[1][2] * c0) * determinant,\r\n      (m[0][0] * c3 - m[0][1] * c1 + m[0][2] * c0) * determinant,\r\n      (-m[3][0] * s3 + m[3][1] * s1 - m[3][2] * s0) * determinant,\r\n      (m[2][0] * s3 - m[2][1] * s1 + m[2][2] * s0) * determinant\r\n    ]\r\n  ]\r\n};\r\n\r\n/* global ol */\r\n/* Create ol.sphere for backward compatibility with ol < 5.0\r\n * To use with Openlayers package\r\n */\r\nif (window.ol && !ol.sphere) {\r\n  ol.sphere = {};\r\n  ol.sphere.getDistance = function (c1, c2, radius) {\r\n    var sphere = new ol.Sphere(radius || 6371008.8);\r\n    return sphere.haversineDistance(c1, c2);\r\n  }\r\n  ol.sphere.getArea = ol.Sphere.getArea;\r\n  ol.sphere.getLength = ol.Sphere.getLength;\r\n}\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A simple filter to detect edges on images\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.ext.SVGFilter}\r\n * @param {*} options\r\n *  @param {number} options.neighbours nb of neighbour (4 or 8), default 8\r\n *  @param {boolean} options.grayscale get grayscale image, default false,\r\n *  @param {boolean} options.alpha get alpha channel, default false\r\n */\r\nol.ext.SVGFilter.Laplacian = function(options) {\r\n  options = options || {};\r\n  ol.ext.SVGFilter.call(this, { id: options.id });\r\n  var operation = {\r\n    feoperation: 'feConvolveMatrix',\r\n    in: 'SourceGraphic',\r\n    preserveAlpha: true,\r\n    result: 'C1'\r\n  };\r\n  if (options.neighbours===4) {\r\n    operation.kernelMatrix = [\r\n       0, -1,  0, \r\n      -1,  4, -1, \r\n       0, -1,  0\r\n    ];\r\n  } else {\r\n    operation.kernelMatrix = [\r\n      -1, -1, -1, \r\n      -1,  8, -1, \r\n      -1, -1, -1\r\n    ];\r\n  }\r\n  this.addOperation(operation);\r\n  if (options.grayscale) this.grayscale();\r\n  else if (options.alpha) this.luminanceToAlpha({ gamma: options.gamma });\r\n};\r\nol.ext.inherits(ol.ext.SVGFilter.Laplacian, ol.ext.SVGFilter);\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Apply a Prewitt filter on an image\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.ext.SVGFilter}\r\n * @param {*} options\r\n *  @param {boolean} options.grayscale get grayscale image, default false,\r\n *  @param {boolean} options.alpha get alpha channel, default false\r\n */\r\nol.ext.SVGFilter.Prewitt = function(options) {\r\n  options = options || {};\r\n  ol.ext.SVGFilter.call(this, { id: options.id, color: 'sRGB' });\r\n  var operation = {\r\n    feoperation: 'feConvolveMatrix',\r\n    in: 'SourceGraphic',\r\n    preserveAlpha: true,\r\n    order: 3\r\n  };\r\n  // Vertical\r\n  operation.kernelMatrix = [\r\n    -1, -1, -1, \r\n     0,  0,  0,\r\n     1,  1,  1\r\n  ];\r\n  operation.result = 'V1';\r\n  this.addOperation(operation);\r\n  operation.kernelMatrix = [\r\n     1,  1,  1, \r\n     0,  0,  0,\r\n    -1, -1, -1\r\n  ];\r\n  operation.result = 'V2';\r\n  this.addOperation(operation);\r\n  // Horizontal\r\n  operation.kernelMatrix = [\r\n    -1,  0,  1, \r\n    -1,  0,  1,\r\n    -1,  0,  1\r\n  ];\r\n  operation.result = 'H1';\r\n  this.addOperation(operation);\r\n  operation.kernelMatrix = [\r\n     1, -0, -1, \r\n     1,  0, -1,\r\n     1,  0, -1\r\n  ];\r\n  operation.result = 'H2';\r\n  this.addOperation(operation);\r\n  // Compose V\r\n  this.addOperation({\r\n    feoperation: 'feComposite',\r\n    operator: 'arithmetic',\r\n    in: 'V1',\r\n    in2: 'V2',\r\n    k2: 1,\r\n    k3: 1,\r\n    result: 'V'\r\n  });\r\n  // Compose H\r\n  this.addOperation({\r\n    feoperation: 'feComposite',\r\n    operator: 'arithmetic',\r\n    in: 'H1',\r\n    in2: 'H2',\r\n    k2: 1,\r\n    k3: 1,\r\n    result: 'H'\r\n  });\r\n  // Merge\r\n  this.addOperation({\r\n    feoperation: 'feBlend',\r\n    mode: 'lighten',\r\n    in: 'H',\r\n    in2: 'V'\r\n  });\r\n  if (options.grayscale) this.grayscale();\r\n  else if (options.alpha) this.luminanceToAlpha();\r\n};\r\nol.ext.inherits(ol.ext.SVGFilter.Prewitt, ol.ext.SVGFilter);\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Apply a Roberts filter on an image\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.ext.SVGFilter}\r\n * @param {*} options\r\n *  @param {boolean} options.grayscale get grayscale image, default false,\r\n *  @param {boolean} options.alpha get alpha channel, default false\r\n */\r\nol.ext.SVGFilter.Roberts = function(options) {\r\n  options = options || {};\r\n  ol.ext.SVGFilter.call(this, { id: options.id, color: 'sRGB' });\r\n  var operation = {\r\n    feoperation: 'feConvolveMatrix',\r\n    in: 'SourceGraphic',\r\n    preserveAlpha: true,\r\n    order: 3\r\n  };\r\n  // Vertical\r\n  operation.kernelMatrix = [\r\n    -1,  0,  0, \r\n     0,  0,  0,\r\n    0,   0,  1\r\n  ];\r\n  operation.result = 'V1';\r\n  this.addOperation(operation);\r\n  operation.kernelMatrix = [\r\n     1,  0,  0, \r\n     0,  0,  0,\r\n     0,  0, -1\r\n  ];\r\n  operation.result = 'V2';\r\n  this.addOperation(operation);\r\n  // Horizontal\r\n  operation.kernelMatrix = [\r\n     0,  0,  1, \r\n     0,  0,  0,\r\n    -1,  0,  0\r\n  ];\r\n  operation.result = 'H1';\r\n  this.addOperation(operation);\r\n  operation.kernelMatrix = [\r\n     0, -0, -1, \r\n     0,  0,  0,\r\n     1,  0,  0\r\n  ];\r\n  operation.result = 'H2';\r\n  this.addOperation(operation);\r\n  // Compose V\r\n  this.addOperation({\r\n    feoperation: 'feComposite',\r\n    operator: 'arithmetic',\r\n    in: 'V1',\r\n    in2: 'V2',\r\n    k2: 1,\r\n    k3: 1,\r\n    result: 'V'\r\n  });\r\n  // Compose H\r\n  this.addOperation({\r\n    feoperation: 'feComposite',\r\n    operator: 'arithmetic',\r\n    in: 'H1',\r\n    in2: 'H2',\r\n    k2: 1,\r\n    k3: 1,\r\n    result: 'H'\r\n  });\r\n  // Merge\r\n  this.addOperation({\r\n    feoperation: 'feBlend',\r\n    mode: 'lighten',\r\n    in: 'H',\r\n    in2: 'V'\r\n  });\r\n  if (options.grayscale) this.grayscale();\r\n  else if (options.alpha) this.luminanceToAlpha();\r\n};\r\nol.ext.inherits(ol.ext.SVGFilter.Roberts, ol.ext.SVGFilter);\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Apply a sobel filter on an image\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.ext.SVGFilter}\r\n * @param {*} options\r\n *  @param {boolean} options.grayscale get grayscale image, default false,\r\n *  @param {boolean} options.alpha get alpha channel, default false\r\n */\r\nol.ext.SVGFilter.Sobel = function(options) {\r\n  options = options || {};\r\n  ol.ext.SVGFilter.call(this, { id: options.id, color: 'sRGB' });\r\n  var operation = {\r\n    feoperation: 'feConvolveMatrix',\r\n    in: 'SourceGraphic',\r\n    preserveAlpha: true,\r\n    order: 3\r\n  };\r\n  // Vertical\r\n  operation.kernelMatrix = [\r\n    -1, -2, -1, \r\n     0,  0,  0,\r\n     1,  2,  1\r\n  ];\r\n  operation.result = 'V1';\r\n  this.addOperation(operation);\r\n  operation.kernelMatrix = [\r\n     1,  2,  1, \r\n     0,  0,  0,\r\n    -1, -2, -1\r\n  ];\r\n  operation.result = 'V2';\r\n  this.addOperation(operation);\r\n  // Horizontal\r\n  operation.kernelMatrix = [\r\n    -1,  0,  1, \r\n    -2,  0,  2,\r\n    -1,  0,  1\r\n  ];\r\n  operation.result = 'H1';\r\n  this.addOperation(operation);\r\n  operation.kernelMatrix = [\r\n     1, -0, -1, \r\n     2,  0, -2,\r\n     1,  0, -1\r\n  ];\r\n  operation.result = 'H2';\r\n  this.addOperation(operation);\r\n  // Compose V\r\n  this.addOperation({\r\n    feoperation: 'feComposite',\r\n    operator: 'arithmetic',\r\n    in: 'V1',\r\n    in2: 'V2',\r\n    k2: 1,\r\n    k3: 1,\r\n    result: 'V'\r\n  });\r\n  // Compose H\r\n  this.addOperation({\r\n    feoperation: 'feComposite',\r\n    operator: 'arithmetic',\r\n    in: 'H1',\r\n    in2: 'H2',\r\n    k2: 1,\r\n    k3: 1,\r\n    result: 'H'\r\n  });\r\n  // Merge\r\n  this.addOperation({\r\n    feoperation: 'feBlend',\r\n    mode: 'lighten',\r\n    in: 'H',\r\n    in2: 'V'\r\n  });\r\n  if (options.grayscale) this.grayscale();\r\n  else if (options.alpha) this.luminanceToAlpha({ gamma: options.gamma });\r\n};\r\nol.ext.inherits(ol.ext.SVGFilter.Sobel, ol.ext.SVGFilter);\r\n\r\n/** Vanilla JS geographic inputs\r\n * color, size, width, font, symboles, dash, arrow, pattern\r\n */\r\n/** @namespace  ol.ext.input\r\n */\r\n/*global ol*/\r\nif (window.ol) {\r\n  ol.ext.input = {};\r\n}\r\n/** Abstract base class; normally only used for creating subclasses and not instantiated in apps.    \r\n * @constructor\r\n * @extends {ol.Object}\r\n * @param {*} options\r\n *  @param {Element} [options.input] input element, if non create one\r\n *  @param {string} [options.type] input type, if no input\r\n *  @param {number} [options.min] input min, if no input\r\n *  @param {number} [options.max] input max, if no input\r\n *  @param {number} [options.step] input step, if no input\r\n *  @param {string|number} [options.val] input value\r\n *  @param {boolean} [options.checked] check input\r\n *  @param {boolean} [options.hidden] the input is display:none\r\n *  @param {boolean} [options.disabled] disable input\r\n *  @param {Element} [options.parent] parent element, if no input\r\n */\r\nol.ext.input.Base = function(options) {\r\n  options = options || {};\r\n  ol.Object.call(this);\r\n  var input = this.input = options.input;\r\n  if (!input) {\r\n    input = this.input = document.createElement('INPUT');\r\n    if (options.type) input.setAttribute('type', options.type);\r\n    if (options.min !== undefined) input.setAttribute('min', options.min);\r\n    if (options.max !== undefined) input.setAttribute('max', options.max);\r\n    if (options.step !== undefined) input.setAttribute('step', options.step);\r\n    if (options.parent) options.parent.appendChild(input);\r\n  } \r\n  if (options.disabled) input.disabled = true;\r\n  if (options.checked !== undefined) input.checked = !!options.checked;\r\n  if (options.val !== undefined) input.value = options.val;\r\n  if (options.hidden) input.style.display = 'none';\r\n};\r\nol.ext.inherits(ol.ext.input.Base, ol.Object);\r\n/** Listen to drag event\r\n * @param {Element} elt \r\n * @param {function} cback when draggin on the element\r\n * @private\r\n */\r\nol.ext.input.Base.prototype._listenDrag = function(elt, cback) {\r\n  var handle = function(e) {\r\n    this.moving = true;\r\n    var listen = function(e) {\r\n      if (e.type==='pointerup') {\r\n        document.removeEventListener('pointermove', listen);\r\n        document.removeEventListener('pointerup', listen);\r\n        document.removeEventListener('pointercancel', listen);\r\n        setTimeout(function() {\r\n          this.moving = false;\r\n        }.bind(this));\r\n      }\r\n      if (e.target === elt) cback(e);\r\n      e.stopPropagation();\r\n      e.preventDefault();\r\n    }.bind(this);\r\n    document.addEventListener('pointermove', listen, false);\r\n    document.addEventListener('pointerup', listen, false);\r\n    document.addEventListener('pointercancel', listen, false);\r\n    e.stopPropagation();\r\n    e.preventDefault();\r\n  }.bind(this)\r\n  elt.addEventListener('mousedown', handle, false);\r\n  elt.addEventListener('touchstart', handle, false);\r\n};\r\n/** Set the current value\r\n */\r\n ol.ext.input.Base.prototype.setValue = function(v) {\r\n  if (v !== undefined) this.input.value = v;\r\n  this.input.dispatchEvent(new Event('change'));\r\n};\r\n/** Get the current getValue\r\n * @returns {string}\r\n */\r\nol.ext.input.Base.prototype.getValue = function() {\r\n  return this.input.value;\r\n};\r\n/** Get the input element\r\n * @returns {Element}\r\n */\r\nol.ext.input.Base.prototype.getInputElement = function() {\r\n  return this.input;\r\n};\r\n\r\n/** Checkbox input\r\n * @constructor\r\n * @extends {ol.ext.input.Base}\r\n * @param {*} options\r\n *  @param {string} [options.className]\r\n *  @param {Element} [options.input] input element, if non create one\r\n *  @param {Element} [options.parent] parent element, if create an input\r\n *  @param {string} [options.align=left] align popup left/right\r\n *  @param {string} [options.type] a slide type as 'size'\r\n *  @param {number} [options.min] min value, default use input min\r\n *  @param {number} [options.max] max value, default use input max\r\n *  @param {number} [options.step] step value, default use input step\r\n *  @param {boolean} [options.overflow=false] enable values over min/max\r\n *  @param {string|Element} [options.before] an element to add before the slider\r\n *  @param {string|Element} [options.after] an element to add after the slider\r\n *  @param {boolean} [options.fixed=false] no pupop\r\n */\r\nol.ext.input.Slider = function(options) {\r\n  options = options || {};\r\n  ol.ext.input.Base.call(this, options);\r\n  this.set('overflow', !!options.overflow);\r\n  this.element = ol.ext.element.create('DIV', {\r\n    className: 'ol-input-slider' \r\n      + (options.type ? ' ol-' + options.type : '')\r\n      + (options.className ? ' ' + options.className : '')\r\n  });\r\n  if (options.fixed) this.element.classList.add('ol-fixed');\r\n  var input = this.input;\r\n  if (input.parentNode) input.parentNode.insertBefore(this.element, input);\r\n  this.element.appendChild(input);\r\n  if (options.align==='right') this.element.classList.add('ol-right');\r\n  var popup = ol.ext.element.create('DIV', {\r\n    className: 'ol-popup',\r\n    parent: this.element\r\n  })\r\n  // Before  element\r\n  if (options.before) {\r\n    ol.ext.element.create('DIV', {\r\n      className: 'ol-before',\r\n      html: options.before,\r\n      parent: popup\r\n    });\r\n  }\r\n  // Slider\r\n  var slider = this.slider = ol.ext.element.create('DIV', {\r\n    className: 'ol-slider',\r\n    parent: popup\r\n  });\r\n  ol.ext.element.create('DIV', {\r\n    className: 'ol-back',\r\n    parent: this.slider\r\n  })\r\n  // Cursor\r\n  var cursor = ol.ext.element.create('DIV', {\r\n    className: 'ol-cursor',\r\n    parent: slider\r\n  })\r\n  // After element\r\n  if (options.after) {\r\n    ol.ext.element.create('DIV', {\r\n      className: 'ol-after',\r\n      html: options.after,\r\n      parent: popup\r\n    });\r\n  }\r\n  var min = (options.min !== undefined) ? options.min : parseFloat(input.min) || 0;\r\n  var max = (options.max !== undefined) ? options.max : parseFloat(input.max) || 1;\r\n  var step = (options.step !== undefined) ? options.step : parseFloat(input.step) || 1;\r\n  // Handle popup drag\r\n  this._listenDrag(slider, function(e) {\r\n    var tx = Math.max(0, Math.min(e.offsetX / slider.clientWidth, 1));\r\n    cursor.style.left = Math.max(0, Math.min(100, Math.round(tx*100) )) + '%';\r\n    var v = input.value = Math.round((tx * (max - min) + min) / step) * step;\r\n    this.dispatchEvent({ type: 'change:value', value: v });\r\n  }.bind(this));\r\n  // Set value\r\n  var setValue = function() {\r\n    var v = parseFloat(input.value) || 0;\r\n    if (!this.get('overflow')) v = Math.max(min, Math.min(max, v));\r\n    if (v != input.value) input.value = v;\r\n    var tx = (v - min) / (max - min);\r\n    cursor.style.left = Math.max(0, Math.min(100, Math.round(tx*100) )) + '%';\r\n    this.dispatchEvent({ type: 'change:value', value: v });\r\n  }.bind(this);\r\n  input.addEventListener('change', setValue);\r\n  setValue();\r\n};\r\nol.ext.inherits(ol.ext.input.Slider, ol.ext.input.Base);\r\n\r\n/** Base class for input popup\r\n * @constructor\r\n * @extends {ol.ext.input.Base}\r\n * @fires change:color\r\n * @fires color\r\n * @param {*} options\r\n *  @param {string} [options.className]\r\n *  @param {ol.colorLike} [options.color] default color\r\n *  @param {Element} [options.input] input element, if non create one\r\n *  @param {Element} [options.parent] parent element, if create an input\r\n *  @param {string} [options.position='popup'] fixed | static | popup | inline (no popup)\r\n *  @param {boolean} [options.autoClose=true] close when click on color\r\n *  @param {boolean} [options.hidden=false] display the input\r\n */\r\nol.ext.input.PopupBase = function(options) {\r\n  options = options || {};\r\n  options.hidden = options.hidden!==false;\r\n  ol.ext.input.Base.call(this, options);\r\n  this.set('autoClose', options.autoClose !== false);\r\n  this.element = ol.ext.element.create('DIV', {\r\n    className: ('ol-ext-popup-input '  + (options.className || '')).trim(),\r\n  });\r\n  switch (options.position) {\r\n    case 'inline': break;\r\n    case 'static':\r\n    case 'fixed': {\r\n      this.element.classList.add('ol-popup');\r\n      this.element.classList.add('ol-popup-fixed');\r\n      this._fixed = (options.position === 'fixed');\r\n      break;\r\n    }\r\n    default: {\r\n      this.element.classList.add('ol-popup');\r\n      break;\r\n    }\r\n  }\r\n  var input = this.input;\r\n  if (input.parentNode) input.parentNode.insertBefore(this.element, input);\r\n  // Show on element click\r\n  this.element.addEventListener('click', function() {\r\n    if (this.isCollapsed()) setTimeout( function() { this.collapse(false); }.bind(this) );\r\n  }.bind(this));\r\n  // Hide on click outside\r\n  document.addEventListener('click', function() {\r\n    if (!this.moving) this.collapse(true);\r\n  }.bind(this));\r\n  // Hide on window resize\r\n  window.addEventListener('resize', function() {\r\n    this.collapse(true);\r\n  }.bind(this));\r\n  this._elt = {};\r\n  // Popup container\r\n  this._elt.popup = ol.ext.element.create('DIV', { className: 'ol-popup', parent: this.element });\r\n  this._elt.popup.addEventListener('click', function(e) { e.stopPropagation(); });\r\n};\r\nol.ext.inherits(ol.ext.input.PopupBase, ol.ext.input.Base);\r\n/** show/hide color picker\r\n * @param {boolean} [b=false]\r\n */\r\nol.ext.input.PopupBase.prototype.collapse = function(b) {\r\n  if (b != this.isCollapsed()) {\r\n    this.dispatchEvent({\r\n      type: 'change:visible', \r\n      visible: !this.isCollapsed()\r\n    });\r\n  }\r\n  this.dispatchEvent({\r\n    type: 'collapse', \r\n    visible: !b\r\n  });\r\n  if (b) {\r\n    this._elt.popup.classList.remove('ol-visible');\r\n  } else {\r\n    this._elt.popup.classList.add('ol-visible');\r\n    if (this._fixed) {\r\n      // Get fixed position\r\n      var pos = this.element.getBoundingClientRect();\r\n      var offset = ol.ext.element.getFixedOffset(this.element);\r\n      pos = {\r\n        bottom: pos.bottom - offset.top,\r\n        left: pos.left - offset.left\r\n      }\r\n      // Test window overflow + recenter\r\n      var dh = pos.bottom + this._elt.popup.offsetHeight + offset.top;\r\n      if (dh > document.documentElement.clientHeight) {\r\n        this._elt.popup.style.top = Math.max(document.documentElement.clientHeight - this._elt.popup.offsetHeight - offset.top, 0) + 'px';\r\n      } else {\r\n        this._elt.popup.style.top = pos.bottom + 'px';\r\n      }\r\n      var dw = pos.left + this._elt.popup.offsetWidth + offset.left;\r\n      if (dw > document.documentElement.clientWidth) {\r\n        this._elt.popup.style.left = Math.max(document.documentElement.clientWidth - this._elt.popup.offsetWidth - offset.left, 0) + 'px';\r\n      } else {\r\n        this._elt.popup.style.left = pos.left + 'px';\r\n      }\r\n    }\r\n  }\r\n};\r\n/** Is the popup collapsed ?\r\n * @returns {boolean}\r\n */\r\nol.ext.input.PopupBase.prototype.isCollapsed = function() {\r\n  return !this._elt.popup.classList.contains('ol-visible');\r\n};\r\n/** Toggle the popup\r\n */\r\nol.ext.input.PopupBase.prototype.toggle = function() {\r\n  this.collapse(!this.isCollapsed());\r\n};\r\n\r\n/** Checkbox input\r\n * @constructor\r\n * @extends {ol.ext.input.Base}\r\n * @fires check\r\n * @param {*} options\r\n *  @param {string} [options.className]\r\n *  @param {Element|string} [options.html] label content\r\n *  @param {string} [options.after] label garnish (placed after)\r\n *  @param {Element} [options.input] input element, if non create one\r\n *  @param {Element} [options.parent] parent element, if create an input\r\n *  @param {boolean} [options.autoClose=true]\r\n *  @param {boolean} [options.visible=false] display the input\r\n */\r\nol.ext.input.Checkbox = function(options) {\r\n  options = options || {};\r\n  ol.ext.input.Base.call(this, options);\r\n  var label = this.element = document.createElement('LABEL');\r\n  if (options.html instanceof Element) label.appendChild(options.html)\r\n  else if (options.html !== undefined) label.innerHTML = options.html;\r\n  label.className = ('ol-ext-check ol-ext-checkbox'  + (options.className || '')).trim();\r\n  if (this.input.parentNode) this.input.parentNode.insertBefore(label, this.input);\r\n  label.appendChild(this.input);\r\n  label.appendChild(document.createElement('SPAN'));\r\n  if (options.after) {\r\n    label.appendChild(document.createTextNode(options.after));\r\n  }\r\n  // Handle change\r\n  this.input.addEventListener('change', function() {\r\n    this.dispatchEvent({ type: 'check', checked: this.input.checked, value: this.input.value });\r\n  }.bind(this));\r\n};\r\nol.ext.inherits(ol.ext.input.Checkbox, ol.ext.input.Base);\r\nol.ext.input.Checkbox.prototype.isChecked = function () {\r\n  return this.input.checked;\r\n};\r\n\r\n/** A list element synchronize with a Collection. \r\n * Element in the list can be reordered interactively and the associated Collection is kept up to date.\r\n * @constructor\r\n * @fires item:select\r\n * @fires item:dblclick\r\n * @fires item:order\r\n * @extends {ol.Object}\r\n * @param {*} options\r\n *  @param {Element} [options.target] \r\n *  @param {Collection} [options.collection]  the collection to display in the list\r\n *  @param {function} [options.getTitle] a function that takes a collection item and returns an Element or a string\r\n */\r\nol.ext.input.Collection = function(options) {\r\n  ol.Object.call(this);\r\n  this.element = ol.ext.element.create('UL', {\r\n    className: ('ol-collection-list '+(options.className||'')).trim(),\r\n    parent: options.target\r\n  })\r\n  this.collection = options.collection;\r\n  this._title = (typeof(options.getTitle) === 'function' ? options.getTitle : function(elt) { return elt.title });\r\n  this.refresh();\r\n  this.collection.on('change:length', function() { \r\n    if (!this._reorder) {\r\n      this.refresh();\r\n      var pos = this.getSelectPosition();\r\n      if (pos < 0) {\r\n        this.dispatchEvent({ type: 'item:select', position: -1, item: null });\r\n      } else {\r\n        this.dispatchEvent({ type: 'item:order', position: pos, item: this._currentItem });\r\n      }\r\n    }\r\n  }.bind(this));\r\n};\r\nol.ext.inherits(ol.ext.input.Collection, ol.Object);\r\n/** Select an item\r\n * @param {*} item\r\n */\r\nol.ext.input.Collection.prototype.select = function(item) {\r\n  if (item === this._currentItem) return;\r\n  var pos = -1;\r\n  this._listElt.forEach(function (l, i) {\r\n    if (l.item !== item) {\r\n      l.li.classList.remove('ol-select');\r\n    } else {\r\n      l.li.classList.add('ol-select');\r\n      pos = i;\r\n    }\r\n  })\r\n  this._currentItem = (pos >= 0 ? item : null);\r\n  this.dispatchEvent({ type: 'item:select', position: pos, item: this._currentItem });\r\n};\r\n/** Select an item at\r\n * @param {number} n\r\n */\r\nol.ext.input.Collection.prototype.selectAt = function(n) {\r\n  this.select(this.collection.item(n));\r\n};\r\n/** Get current selection\r\n * @returns {*}\r\n */\r\nol.ext.input.Collection.prototype.getSelect = function() {\r\n  return this._currentItem;\r\n};\r\n/** Get current selection\r\n * @returns {number}\r\n */\r\nol.ext.input.Collection.prototype.getSelectPosition = function() {\r\n  return this.collection.getArray().indexOf(this._currentItem);\r\n};\r\n/** Redraw the list\r\n */\r\nol.ext.input.Collection.prototype.refresh = function() {\r\n  this.element.innerHTML = '';\r\n  this._listElt = [];\r\n  this.collection.forEach((item, pos) => {\r\n    var li = ol.ext.element.create('LI', {\r\n      html: this._title(item),\r\n      className: this._currentItem === item ? 'ol-select' : '',\r\n      'data-position': pos,\r\n      on: {\r\n        click: function() {\r\n          this.select(item);\r\n        }.bind(this),\r\n        dblclick: function() {\r\n          this.dispatchEvent({ type: 'item:dblclick', position: pos, item: item });\r\n        }.bind(this),\r\n      },\r\n      parent: this.element\r\n    });\r\n    this._listElt.push({ li: li, item: item });\r\n    var order = ol.ext.element.create('DIV', {\r\n      className: 'ol-noscroll ol-order',\r\n      parent: li\r\n    });\r\n    var current = pos;\r\n    var move = function(e) {\r\n      // Get target\r\n      var target = e.pointerType==='touch' ? document.elementFromPoint(e.clientX, e.clientY) : e.target;\r\n      while (target && target.parentNode !== this.element) {\r\n        target = target.parentNode;\r\n      }\r\n      if (target && target !== li) {\r\n        var over = parseInt(target.getAttribute('data-position'));\r\n        if (target.getAttribute('data-position') < current) {\r\n          target.insertAdjacentElement('beforebegin', li);\r\n          current = over;\r\n        } else {\r\n          target.insertAdjacentElement('afterend', li);\r\n          current = over+1;\r\n        }\r\n      }\r\n    }.bind(this);\r\n    var stop = function() {\r\n      document.removeEventListener('pointermove', move);\r\n      document.removeEventListener('pointerup', stop);\r\n      document.removeEventListener('pointercancel', stop);\r\n      if (current !== pos) {\r\n        this._reorder = true;\r\n        this.collection.removeAt(pos);\r\n        this.collection.insertAt(current>pos ? current-1 : current, item);\r\n        this._reorder = false;\r\n        this.dispatchEvent({ type: 'item:order', position: current>pos ? current-1 : current, oldPosition: pos, item: item })\r\n        this.refresh();\r\n      }\r\n    }.bind(this);\r\n    order.addEventListener('pointerdown', function() {\r\n      this.select(item)\r\n      document.addEventListener('pointermove', move);\r\n      document.addEventListener('pointerup', stop)\r\n      document.addEventListener('pointercancel', stop)\r\n    }.bind(this));\r\n  });\r\n}\r\n\r\n/** Color picker\r\n * @constructor\r\n * @extends {ol.ext.input.PopupBase}\r\n * @fires change:color\r\n * @fires color\r\n * @param {*} options\r\n *  @param {string} [options.className]\r\n *  @param {ol.colorLike} [options.color] default color\r\n *  @param {Element} [options.input] input element, if non create one\r\n *  @param {Element} [options.parent] parent element, if create an input\r\n *  @param {boolean} [options.hastab=false] use tabs for palette / picker\r\n *  @param {string} [options.paletteLabel=\"palette\"] label for the palette tab\r\n *  @param {string} [options.pickerLabel=\"picker\"] label for the picker tab\r\n *  @param {string} [options.position='popup'] fixed | static | popup | inline (no popup)\r\n *  @param {boolean} [options.opacity=true] enable opacity\r\n *  @param {boolean} [options.autoClose=true] close when click on color\r\n *  @param {boolean} [options.hidden=true] display the input\r\n */\r\nol.ext.input.Color = function(options) {\r\n  options = options || {};\r\n  options.hidden = options.hidden!==false;\r\n  options.className = ('ol-ext-colorpicker ' + (options.hastab ? 'ol-tab ' : '') + (options.className || '')).trim();\r\n  ol.ext.input.PopupBase.call(this, options);\r\n  if (options.opacity===false) {\r\n    this.element.classList.add('ol-nopacity');\r\n  }\r\n  this._cursor = {};\r\n  var hsv = this._hsv = {};\r\n  // Vignet\r\n  this._elt.vignet = ol.ext.element.create('DIV', { className: 'ol-vignet', parent: this.element });\r\n  // Bar \r\n  var bar = ol.ext.element.create('DIV', { className: 'ol-tabbar', parent: this._elt.popup });\r\n  ol.ext.element.create('DIV', { \r\n    className: 'ol-tab', \r\n    html: options.paletteLabel || 'palette',\r\n    click: function() {\r\n      this.element.classList.remove('ol-picker-tab');\r\n    }.bind(this),\r\n    parent: bar\r\n  });\r\n  ol.ext.element.create('DIV', { \r\n    className: 'ol-tab', \r\n    html: options.pickerLabel || 'picker',\r\n    click: function() {\r\n      this.element.classList.add('ol-picker-tab');\r\n    }.bind(this),\r\n    parent: bar\r\n  });\r\n  // Popup container\r\n  var container = ol.ext.element.create('DIV', { className: 'ol-container', parent: this._elt.popup });\r\n  // Color picker\r\n  var picker = this._elt.picker = ol.ext.element.create('DIV', { className: 'ol-picker', parent: container });\r\n  var pickerCursor = this._cursor.picker = ol.ext.element.create('DIV', { className: 'ol-cursor', parent: picker });\r\n  this._listenDrag(picker, function(e) {\r\n    var tx = Math.max(0, Math.min(e.offsetX / picker.clientWidth, 1));\r\n    var ty = Math.max(0, Math.min(e.offsetY / picker.clientHeight, 1));\r\n    pickerCursor.style.left = Math.round(tx*100) + '%';\r\n    pickerCursor.style.top = Math.round(ty*100) + '%';\r\n    hsv.s = tx * 100;\r\n    hsv.v = 100 - ty * 100;\r\n    this.setColor();\r\n  }.bind(this));\r\n  // Opacity cursor\r\n  var slider = ol.ext.element.create('DIV', { className: 'ol-slider', parent: container });\r\n  this._elt.slider = ol.ext.element.create('DIV', { parent: slider });\r\n  var sliderCursor = this._cursor.slide = ol.ext.element.create('DIV', { className: 'ol-cursor', parent: slider });\r\n  this._listenDrag(slider, function(e) {\r\n    var t = Math.max(0, Math.min(e.offsetX / slider.clientWidth, 1));\r\n    hsv.a = t*100;\r\n    sliderCursor.style.left = Math.round(t*100) + '%';\r\n    this.setColor();\r\n  }.bind(this));\r\n  // Tint cursor\r\n  var tint = ol.ext.element.create('DIV', { className: 'ol-tint', parent: container });\r\n  var tintCursor = this._cursor.tint = ol.ext.element.create('DIV', { className: 'ol-cursor', parent: tint });\r\n  this._listenDrag(tint, function(e) {\r\n    var t = Math.max(0, Math.min(e.offsetY / tint.clientHeight, 1));\r\n    hsv.h = t*360;\r\n    tintCursor.style.top = Math.round(t*100) + '%';\r\n    this.setColor();\r\n  }.bind(this));\r\n  // Clear button\r\n  ol.ext.element.create('DIV', { \r\n    className: 'ol-clear', \r\n    click: function() {\r\n      this.setColor([0,0,0,0]);\r\n    }.bind(this),\r\n    parent: container\r\n  });\r\n  // RVB input\r\n  var rgb = ol.ext.element.create('DIV', { \r\n    className: 'ol-rgb', \r\n    parent: container\r\n  });\r\n  var changergb = function() {\r\n    var r = Math.max(0, Math.min(255, parseInt(this._elt.r.value)));\r\n    var g = Math.max(0, Math.min(255, parseInt(this._elt.g.value)));\r\n    var b = Math.max(0, Math.min(255, parseInt(this._elt.b.value)));\r\n    var a = Math.max(0, Math.min(1, parseFloat(this._elt.a.value)));\r\n    this.setColor([r, g, b, a]);\r\n  }.bind(this);\r\n  this._elt.r = ol.ext.element.create('INPUT', { type: 'number', lang:'en-GB', change: changergb, min:0, max:255, parent: rgb });\r\n  this._elt.g = ol.ext.element.create('INPUT', { type: 'number', lang:'en-GB', change: changergb, min:0, max:255, parent: rgb });\r\n  this._elt.b = ol.ext.element.create('INPUT', { type: 'number', lang:'en-GB', change: changergb, min:0, max:255, parent: rgb });\r\n  this._elt.a = ol.ext.element.create('INPUT', { type: 'number', lang:'en-GB', change: changergb, min:0, max:1, step:.1, parent: rgb });\r\n  // Text color input\r\n  this._elt.txtColor = ol.ext.element.create('INPUT', { \r\n    type: 'text', \r\n    className: 'ol-txt-color',\r\n    change: function(){\r\n      var color;\r\n      this._elt.txtColor.classList.remove('ol-error')\r\n      try {\r\n        color = ol.color.asArray(this._elt.txtColor.value);\r\n      } catch(e) {\r\n        this._elt.txtColor.classList.add('ol-error');\r\n      }\r\n      if (color) this.setColor(color)\r\n    }.bind(this), \r\n    parent: container\r\n  });\r\n  ol.ext.element.create('BUTTON', { \r\n    html: 'OK',\r\n    click: function() {\r\n      this._addCustomColor(this.getColor());\r\n      this.collapse(true);\r\n    }.bind(this),\r\n    parent: container\r\n  });\r\n  var i;\r\n  // Color palette\r\n  this._paletteColor = {};\r\n  this._elt.palette = ol.ext.element.create('DIV', {\r\n    className: 'ol-palette',\r\n    parent: this._elt.popup\r\n  })\r\n  for (i=0; i<8; i++) {\r\n    var c = Math.round(255 - 255*i/7);\r\n    this.addPaletteColor([c,c,c], c);//ol.color.toHexa([c,c,c]));\r\n  }\r\n  var colors = ['#f00', '#f90', '#ff0', '#0f0', '#0ff', '#48e', '#00f', '#f0f']\r\n  colors.forEach(function(c){\r\n    this.addPaletteColor(c, ol.color.toHexa(ol.color.asArray(c)));\r\n  }.bind(this));\r\n  for (i=0; i<5; i++) {\r\n    colors.forEach(function(c){\r\n      c = ol.color.toHSV(ol.color.asArray(c));\r\n      c = [c[0], i/4*80+20, 100 - i/4*60];\r\n      c = ol.color.fromHSV(c,1)\r\n      this.addPaletteColor(c, ol.color.toHexa(c));\r\n    }.bind(this));\r\n  }\r\n  // Custom colors\r\n  ol.ext.element.create('HR', { parent: this._elt.palette });\r\n  // Create custom color list\r\n  if (!ol.ext.input.Color.customColorList) {\r\n    ol.ext.input.Color.customColorList = new ol.Collection();\r\n    var ccolor = JSON.parse(localStorage.getItem('ol-ext@colorpicker') || '[]');\r\n    ccolor.forEach(function(c) {\r\n      ol.ext.input.Color.customColorList.push(c);\r\n    })\r\n    ol.ext.input.Color.customColorList.on(['add','remove'], function(){\r\n      localStorage.setItem('ol-ext@colorpicker', JSON.stringify(ol.ext.input.Color.customColorList.getArray()));\r\n    });\r\n  }\r\n  // Handle custom color\r\n  ol.ext.input.Color.customColorList.on('add', function(e) {\r\n    this.addPaletteColor(this.getColorFromID(e.element));\r\n  }.bind(this));\r\n  ol.ext.input.Color.customColorList.on('remove', function(e) {\r\n    if (this._paletteColor[e.element]) this._paletteColor[e.element].element.remove();\r\n    delete this._paletteColor[e.element];\r\n  }.bind(this));\r\n  // Add new one\r\n  ol.ext.input.Color.customColorList.forEach(function(c) {\r\n    this._addCustomColor(this.getColorFromID(c));\r\n  }.bind(this));\r\n  // Current color\r\n  this.setColor(options.color || [0,0,0,0]);\r\n  this._currentColor = this.getColorID(this.getColor());\r\n  // Add new palette color\r\n  this.on('color', function() {\r\n    this._addCustomColor(this.getColor());\r\n    this._currentColor = this.getColorID(this.getColor());\r\n    this.setColor();\r\n  }.bind(this));\r\n  // Update color on hide\r\n  this.on('collapse', function(e) {\r\n    if (!e.visible) {\r\n      var c = this.getColor();\r\n      if (this._currentColor !== this.getColorID(c)) {\r\n        this.dispatchEvent({ type: 'color', color: c });\r\n      }\r\n    } else {\r\n      this._currentColor = this.getColorID(this.getColor());\r\n    }\r\n  }.bind(this));\r\n};\r\nol.ext.inherits(ol.ext.input.Color, ol.ext.input.PopupBase);\r\n/** Custom color list\r\n * @private\r\n */\r\nol.ext.input.Color.customColorList = null;\r\n/** Add color to palette\r\n * @param {ol.colorLike} color\r\n * @param {string} title\r\n * @param {boolean} select\r\n */\r\nol.ext.input.Color.prototype.addPaletteColor = function(color, title, select) {\r\n  // Get color id\r\n  try {\r\n    color = ol.color.asArray(color);\r\n  } catch(e) {\r\n    return;\r\n  }\r\n  var id = this.getColorID(color);\r\n  // Add new one\r\n  if (!this._paletteColor[id] && color[3]) {\r\n    this._paletteColor[id] = {\r\n      color: color,\r\n      element: ol.ext.element.create('DIV', {\r\n        title: title || '',\r\n        className: (color[3]<1 ? 'ol-alpha' : ''),\r\n        style: {\r\n          color: 'rgb('+(color.join(','))+')'\r\n        },\r\n        click: function() {\r\n          this.setColor(color);\r\n          if (this.get('autoClose')) this.collapse(true);\r\n        }.bind(this),\r\n        parent: this._elt.palette\r\n      })\r\n    }\r\n  }\r\n  if (select) {\r\n    this._selectPalette(color);\r\n  }\r\n};\r\n/** Show palette or picker tab\r\n * @param {string} what palette or picker\r\n */\r\nol.ext.input.Color.prototype.showTab = function(what) {\r\n  if (what==='palette') this.element.classList.remove('ol-picker-tab');\r\n  else this.element.classList.add('ol-picker-tab');\r\n};\r\n/** Show palette or picker tab\r\n * @returns {string} palette or picker\r\n */\r\nol.ext.input.Color.prototype.getTab = function() {\r\n  return this.element.classList.contains('ol-picker-tab') ? 'picker' : 'palette';\r\n};\r\n/** Select a color in the palette\r\n * @private\r\n */\r\nol.ext.input.Color.prototype._selectPalette = function(color) {\r\n  var id = this.getColorID(color);\r\n  Object.keys(this._paletteColor).forEach(function(c) {\r\n    this._paletteColor[c].element.classList.remove('ol-select')\r\n  }.bind(this))\r\n  if (this._paletteColor[id]) {\r\n    this._paletteColor[id].element.classList.add('ol-select');\r\n  }\r\n}\r\n/** Set Color \r\n * @param { Array<number> }\r\n */\r\nol.ext.input.Color.prototype.setColor = function(color) {\r\n  var hsv = this._hsv;\r\n  if (color) {\r\n    color = ol.color.asArray(color);\r\n    var hsv2 = ol.color.toHSV(color);\r\n    hsv.h = hsv2[0];\r\n    hsv.s = hsv2[1];\r\n    hsv.v = hsv2[2];\r\n    if (hsv2.length > 3) hsv.a = hsv2[3]*100;\r\n    else hsv.a = 100;\r\n    this._cursor.picker.style.left = hsv.s + '%';\r\n    this._cursor.picker.style.top = (100-hsv.v) + '%';\r\n    this._cursor.tint.style.top = (hsv.h / 360 * 100) + '%';\r\n    this._cursor.slide.style.left = hsv.a + '%';\r\n    if (this.isCollapsed()) {\r\n      this.dispatchEvent({ type: 'color', color: color });\r\n    }\r\n  } else {\r\n    /*\r\n    hsv.h = Math.round(hsv.h) % 360;\r\n    hsv.s = Math.round(hsv.s);\r\n    hsv.v = Math.round(hsv.v);\r\n    */\r\n    hsv.a = Math.round(hsv.a);\r\n    color = this.getColor();\r\n  }\r\n  var val = 'rgba('+color.join(', ')+')';\r\n  // Show color\r\n  this._elt.picker.style.color = 'hsl(' + hsv.h + ', 100%, 50%)';\r\n  this._elt.slider.style.backgroundImage = 'linear-gradient(45deg, transparent, rgba('+this.getColor(false).join(',')+'))';\r\n  this._elt.vignet.style.color = val;\r\n  // RGB\r\n  this._elt.r.value = color[0];\r\n  this._elt.g.value = color[1];\r\n  this._elt.b.value = color[2];\r\n  this._elt.a.value = color[3];\r\n  // Txt color\r\n  this._elt.txtColor.classList.remove('ol-error')\r\n  if (color[3]===1) {\r\n    this._elt.txtColor.value = ol.color.toHexa(color);\r\n  } else {\r\n    this._elt.txtColor.value = val;\r\n  }\r\n  this._selectPalette(color);\r\n  // Set input value\r\n  if (this.input.value !== val) {\r\n    this.input.value = val;\r\n    this.input.dispatchEvent(new Event('change'));\r\n  }\r\n};\r\n/** Get current color\r\n * @param {boolean} [opacity=true]\r\n * @return {Array<number>}\r\n */\r\nol.ext.input.Color.prototype.getColor = function(opacity) {\r\n  return ol.color.fromHSV([this._hsv.h, this._hsv.s, this._hsv.v, (opacity !== false) ? this._hsv.a/100 : 1], 1);\r\n}\r\n/** \r\n * @private\r\n */\r\nol.ext.input.Color.prototype._addCustomColor = function(color) {\r\n  var id = this.getColorID(color);\r\n  if (this._paletteColor[id]) return;\r\n  if (!color[3]) return;\r\n  if (ol.ext.input.Color.customColorList.getArray().indexOf(id) < 0) {\r\n    ol.ext.input.Color.customColorList.push(id);\r\n    if (ol.ext.input.Color.customColorList.getLength() > 24) {\r\n      ol.ext.input.Color.customColorList.removeAt(0)\r\n    }\r\n  }\r\n  this.addPaletteColor(color);\r\n};\r\nol.ext.input.Color.prototype.clearCustomColor = function() {\r\n  ol.ext.input.Color.customColorList.clear();\r\n};\r\n/** Convert color to id\r\n * @param {ol.colorLike} Color\r\n * @returns {number}\r\n */\r\nol.ext.input.Color.prototype.getColorID = function(color) {\r\n  color = ol.color.asArray(color);\r\n  if (color[3]===undefined) color[3] = 1;\r\n  return color.join('-');\r\n};\r\n/** Convert color to id\r\n * @param {number} id\r\n * @returns {Array<number>} Color\r\n */\r\n ol.ext.input.Color.prototype.getColorFromID = function(id) {\r\n  var c = id.split('-');\r\n  return ([parseFloat(c[0]), parseFloat(c[1]), parseFloat(c[2]), parseFloat(c[3])]);\r\n};\r\n\r\n/** Checkbox input\r\n * @constructor\r\n * @extends {ol.ext.input.Base}\r\n * @param {*} options\r\n *  @param {string} [options.className]\r\n *  @param {Array<Object>} options.options an array of options to place in the popup { html:, title:, value: }\r\n *  @param {Element} [options.input] input element, if non create one\r\n *  @param {Element} [options.parent] parent element, if create an input\r\n *  @param {boolean} [options.fixed=false] don't use a popup, default use a popup\r\n *  @param {string} [options.align=left] align popup left/right/middle\r\n *  @param {boolean} [options.fixed=false] no popup\r\n */\r\nol.ext.input.List = function(options) {\r\n  options = options || {};\r\n  ol.ext.input.Base.call(this, options);\r\n  this._content = ol.ext.element.create('DIV');\r\n  this.element = ol.ext.element.create('DIV', {\r\n    html: this._content,\r\n    className: 'ol-input-popup'\r\n  });\r\n  this.set('hideOnClick', options.hideOnClick !== false);\r\n  if (options.className) this.element.classList.add(options.className);\r\n  if (options.fixed) {\r\n    this.element.classList.add('ol-fixed');\r\n    this.set('hideOnClick', false);\r\n  }\r\n  switch (options.align) {\r\n    case 'middle':\r\n      this.set('hideOnClick', false);\r\n    // fall through\r\n    case 'rigth':\r\n      this.element.classList.add('ol-' + options.align);\r\n      break;\r\n    default: \r\n      break;\r\n  }\r\n  var input = this.input;\r\n  if (input.parentNode) input.parentNode.insertBefore(this.element, input);\r\n  this.element.appendChild(input);\r\n  var popup = this.popup = ol.ext.element.create('UL', {\r\n    className: 'ol-popup',\r\n    parent: this.element\r\n  });\r\n  var opts = [];\r\n  options.options.forEach(option => {\r\n    opts.push({\r\n      value: option.value,\r\n      element: ol.ext.element.create('LI', {\r\n        html: option.html,\r\n        title: option.title || option.value,\r\n        className: 'ol-option',\r\n        click: function() {\r\n          this.setValue(option.value);\r\n          if (this.get('hideOnClick')) {\r\n            popup.style.display = 'none';\r\n            setTimeout(function() { popup.style.display = ''; }, 200);\r\n          }\r\n        }.bind(this),\r\n        parent: this.popup\r\n      })\r\n    })\r\n  });\r\n  this.input.addEventListener('change', function() {\r\n    var v = this.input.value;\r\n    var val;\r\n    opts.forEach(function(o) {\r\n      if (o.value == v) {\r\n        o.element.classList.add('ol-selected');\r\n        val = o.element;\r\n      } else {\r\n        o.element.classList.remove('ol-selected');\r\n      }\r\n    });\r\n    this.dispatchEvent({ type: 'change:value', value: this.getValue() });\r\n    this._content.innerHTML = val ? val.innerHTML : '';\r\n  }.bind(this));\r\n  // Initial value\r\n  var event = new Event('change');\r\n  setTimeout(function() { this.input.dispatchEvent(event); }.bind(this));\r\n};\r\nol.ext.inherits(ol.ext.input.List, ol.ext.input.Base);\r\n\r\n/** Switch input\r\n * @constructor\r\n * @extends {ol.ext.input.Checkbox}\r\n * @fires check\r\n * @param {*} options\r\n *  @param {string} [options.className]\r\n *  @param {Element} [options.input] input element, if non create one\r\n *  @param {Element} [options.parent] parent element, if create an input\r\n */\r\nol.ext.input.Radio = function(input, options) {\r\n  options = options || {};\r\n  ol.ext.input.Checkbox.call(this, input, options);\r\n  this.element.className = ('ol-ext-check ol-ext-radio' + (options.className || '')).trim();\r\n};\r\nol.ext.inherits(ol.ext.input.Radio, ol.ext.input.Checkbox);\r\n\r\n/** Checkbox input\r\n * @constructor\r\n * @extends {ol.ext.input.Slider}\r\n * @param {*} options\r\n *  @param {string} [options.className]\r\n *  @param {Element} [options.input] input element, if non create one\r\n *  @param {Element} [options.parent] parent element, if create an input\r\n *  @param {Array<number>} [options.size] a list of size (default 0,2,3,5,8,13,21,34,55)\r\n */\r\nol.ext.input.Size = function(options) {\r\n  options = options || {};\r\n  options.options = [];\r\n  (options.size || [0,2,3,5,8,13,21,34,55]).forEach(function(i) {\r\n    options.options.push({\r\n      value: i,\r\n      html: ol.ext.element.create('DIV', {\r\n        className: 'ol-option-'+i,\r\n        style: {\r\n          fontSize: i ? i+'px' : undefined\r\n        }\r\n      })\r\n    })\r\n  })\r\n  ol.ext.input.List.call(this, options);\r\n  this._content.remove();\r\n  this.element.classList.add('ol-size');\r\n};\r\nol.ext.inherits(ol.ext.input.Size, ol.ext.input.List);\r\n/** Get the current value\r\n * @returns {number}\r\n */\r\nol.ext.input.Size.prototype.getValue = function() {\r\n  return parseFloat(ol.ext.input.List.prototype.getValue.call(this));\r\n};\r\n\r\n/** Switch input\r\n * @constructor\r\n * @extends {ol.ext.input.Checkbox}\r\n * @fires check\r\n * @param {*} options\r\n *  @param {string} [options.className]\r\n *  @param {Element} [options.input] input element, if non create one\r\n *  @param {Element} [options.parent] parent element, if create an input\r\n */\r\nol.ext.input.Switch = function(options) {\r\n  options = options || {};\r\n  ol.ext.input.Checkbox.call(this, options);\r\n  this.element.className = ('ol-ext-toggle-switch ' + (options.className || '')).trim();\r\n};\r\nol.ext.inherits(ol.ext.input.Switch, ol.ext.input.Checkbox);\r\n\r\n/** Checkbox input\r\n * @constructor\r\n * @extends {ol.ext.input.Slider}\r\n * @param {*} options\r\n *  @param {string} [options.className]\r\n *  @param {Element} [options.input] input element, if non create one\r\n *  @param {Element} [options.parent] parent element, if create an input\r\n *  @param {Array<number>} [options.size] a list of size (default 0,1,2,3,5,10,15,20)\r\n */\r\nol.ext.input.Width = function(options) {\r\n  options = options || {};\r\n  options.options = [];\r\n  (options.size || [0,1,2,3,5,10,15,20]).forEach(function(i) {\r\n    options.options.push({\r\n      value: i,\r\n      html: ol.ext.element.create('DIV', {\r\n        className: 'ol-option-'+i,\r\n        style: {\r\n          height: i || undefined\r\n        }\r\n      })\r\n    })\r\n  });\r\n  ol.ext.input.List.call(this, options);\r\n  this._content.remove();\r\n  this.element.classList.add('ol-width');\r\n};\r\nol.ext.inherits(ol.ext.input.Width, ol.ext.input.List);\r\n/** Get the current value\r\n * @returns {number}\r\n */\r\nol.ext.input.Width.prototype.getValue = function() {\r\n  return parseFloat(ol.ext.input.List.prototype.getValue.call(this));\r\n}\r\n\r\n/** @namespace  ol.legend\r\n */\r\n/*global ol*/\r\nif (window.ol && !ol.legend) {\r\n  ol.legend = {};\r\n}\r\n/** Legend class to draw features in a legend element\r\n * @constructor\r\n * @fires select\r\n * @fires refresh\r\n * @param {*} options\r\n *  @param {String} options.title Legend title\r\n *  @param {ol.size | undefined} options.size Size of the symboles in the legend, default [40, 25]\r\n *  @param {number | undefined} options.margin Size of the symbole's margin, default 10\r\n *  @param { ol.style.Text | undefined } options.textStyle a text style for the legend, default 16px sans-serif\r\n *  @param { ol.style.Text | undefined } options.titleStyle a text style for the legend title, default textStyle + bold\r\n *  @param { ol.style.Style | Array<ol.style.Style> | ol.StyleFunction | undefined\t} options.style a style or a style function to use with features\r\n */\r\nol.legend.Legend = function(options) {\r\n  options = options || {};\r\n  ol.Object.call(this);\r\n  this._items = new ol.Collection();\r\n  var listeners = [];\r\n  var tout;\r\n  this._items.on('add', function(e) {\r\n    listeners.push({\r\n      item: e.element,\r\n      on: e.element.on('change', function() {\r\n        this.refresh();\r\n      }.bind(this))\r\n    });\r\n    if (tout) {\r\n      clearTimeout(tout);\r\n      tout = null;\r\n    }\r\n    tout = setTimeout(function() { this.refresh(); }.bind(this), 0);\r\n  }.bind(this));\r\n  this._items.on('remove', function(e) {\r\n    for (var i=0; i<listeners; i++) {\r\n      if (e.element === listeners[i].item) {\r\n        ol.Observable.unByKey(listeners[i].on);\r\n        listeners.splice(i, 1);\r\n        break;\r\n      }\r\n    }\r\n    if (tout) {\r\n      clearTimeout(tout);\r\n      tout = null;\r\n    }\r\n    tout = setTimeout(function() { this.refresh(); }.bind(this), 0);\r\n  }.bind(this));\r\n  this._listElement = ol.ext.element.create('UL', {\r\n    className: 'ol-legend'\r\n  });\r\n  this._canvas = document.createElement('canvas');\r\n  this.set('size', options.size || [40, 25], true);\r\n  this.set('margin', options.margin===0 ? 0 : options.margin || 10, true);\r\n  this._textStyle = options.textStyle || new ol.style.Text({ \r\n    font: '16px sans-serif',\r\n    fill: new ol.style.Fill({\r\n      color: '#333'\r\n    }),\r\n    backgroundFill: new ol.style.Fill({\r\n      color: 'rgba(255,255,255,.8)'\r\n    })\r\n  });\r\n  this._title = new ol.legend.Item({ title: options.title || '', className: 'ol-title' });\r\n  if (options.titleStyle) {\r\n    this._titleStyle = options.titleStyle;\r\n  } else {\r\n    this._titleStyle = this._textStyle.clone();\r\n    this._titleStyle.setFont('bold '+this._titleStyle.getFont());\r\n  }\r\n  this.setStyle(options.style);\r\n  if (options.items instanceof Array) {\r\n    options.items.forEach(function(item){\r\n      this.addItem(item);\r\n    }.bind(this));\r\n  }\r\n  this.refresh();\r\n};\r\nol.ext.inherits(ol.legend.Legend, ol.Object);\r\n/** Set legend title\r\n * @param {string} title\r\n */\r\nol.legend.Legend.prototype.setTitle = function(title) {\r\n  this._title.setTitle(title);\r\n  this.refresh();\r\n};\r\n/** Get legend title\r\n * @returns {string}\r\n */\r\nol.legend.Legend.prototype.getTitle = function() {\r\n  return this._title.get('title');\r\n};\r\n/** Get text Style\r\n * @returns {ol.style.Text}\r\n */\r\nol.legend.Legend.prototype.getTextStyle = function() {\r\n  return this._textStyle;\r\n};\r\n/** Set legend size\r\n * @param {ol.size} size\r\n */\r\n ol.legend.Legend.prototype.set = function(key, value, opt_silent) {\r\n  ol.Object.prototype.set.call(this, key, value, opt_silent);\r\n  if (!opt_silent) this.refresh();\r\n};\r\n/** Get legend list element\r\n * @returns {Element}\r\n */\r\nol.legend.Legend.prototype.getListElement = function() {\r\n  return this._listElement;\r\n};\r\n/** Get legend canvas\r\n * @returns {HTMLCanvasElement}\r\n */\r\nol.legend.Legend.prototype.getCanvas = function() {\r\n  return this._canvas;\r\n};\r\n/** Set the style\r\n * @param { ol.style.Style | Array<ol.style.Style> | ol.StyleFunction | undefined\t} style a style or a style function to use with features\r\n */\r\nol.legend.Legend.prototype.setStyle = function(style) {\r\n  this._style = style;\r\n  this.refresh();\r\n};\r\n/** Add a new item to the legend\r\n * @param {olLegendItemOptions|ol.legend.Item} item \r\n */\r\nol.legend.Legend.prototype.addItem = function(item) {\r\n  if (item instanceof ol.legend.Item) {\r\n    this._items.push(item);\r\n  } else {\r\n    this._items.push(new ol.legend.Item(item));\r\n  }\r\n};\r\n/** Get item collection\r\n * @param {ol.Collection} \r\n */\r\nol.legend.Legend.prototype.getItems = function() {\r\n  return this._items;\r\n};\r\n/** Draw legend text\r\n * @private\r\n */\r\nol.legend.Legend.prototype._drawText = function(ctx, text, x, y) {\r\n  ctx.save();\r\n    ctx.scale(ol.has.DEVICE_PIXEL_RATIO, ol.has.DEVICE_PIXEL_RATIO);\r\n    text = text || '';\r\n    var txt = text.split('\\n');\r\n    if (txt.length===1) {\r\n      ctx.fillText(text, x, y);\r\n    } else {\r\n      ctx.textBaseline = 'bottom';\r\n      ctx.fillText(txt[0], x, y);\r\n      ctx.textBaseline = 'top';\r\n      ctx.fillText(txt[1], x, y);\r\n    }\r\n  ctx.restore();\r\n};\r\n/** Draw legend text \r\n * @private\r\n */\r\nol.legend.Legend.prototype._measureText = function(ctx, text) {\r\n  var txt = (text || '').split('\\n');\r\n  if (txt.length===1) {\r\n    return ctx.measureText(text);\r\n  } else {\r\n    var m1 = ctx.measureText(txt[0]);\r\n    var m2 = ctx.measureText(txt[1]);\r\n    return { width: Math.max(m1.width, m2.width), height: m1.height + m2.height }\r\n  }\r\n};\r\n/** Refresh the legend\r\n */\r\nol.legend.Legend.prototype.refresh = function() {\r\n  var table = this._listElement;\r\n  table.innerHTML = '';\r\n  var margin = this.get('margin');\r\n  var width = this.get('size')[0] + 2 * margin;\r\n  var height = this.get('lineHeight') || this.get('size')[1] + 2 * margin;\r\n  var canvas = this.getCanvas();\r\n  var ctx = canvas.getContext('2d');\r\n  ctx.textAlign = 'left';\r\n  ctx.textBaseline = 'middle';\r\n  var ratio = ol.has.DEVICE_PIXEL_RATIO;\r\n  // Calculate width\r\n  ctx.font = this._titleStyle.getFont();\r\n  var textWidth = this._measureText(ctx, this.getTitle('title')).width;\r\n  this._items.forEach(function(r) {\r\n    if (r.get('feature') || r.get('typeGeom') ) {\r\n      ctx.font = r.get('textStyle') ? r.get('textStyle').getFont() : this._textStyle.getFont();\r\n      textWidth = Math.max(textWidth, this._measureText(ctx, r.get('title')).width + width);\r\n    } else {\r\n      ctx.font = r.get('textStyle') ? r.get('textStyle').getFont() : this._titleStyle.getFont();\r\n      textWidth = Math.max(textWidth, this._measureText(ctx, r.get('title')).width);\r\n    }\r\n  }.bind(this));\r\n  canvas.width = (textWidth + 2*margin) * ratio;\r\n  canvas.height = (this._items.getLength()+1) * height * ratio;\r\n  canvas.style.height = ((this._items.getLength()+1) * height) + 'px';\r\n  ctx.textBaseline = 'middle';\r\n  ctx.fillStyle = ol.color.asString(this._textStyle.getFill().getColor());\r\n  // Add Title\r\n  if (this.getTitle()) {\r\n    table.appendChild(this._title.getElement([width, height], function(b) {\r\n      this.dispatchEvent({\r\n        type: 'select', \r\n        index: -1,\r\n        symbol: b,\r\n        item: this._title\r\n      });\r\n    }.bind(this)));\r\n    ctx.font = this._titleStyle.getFont();\r\n    ctx.textAlign = 'center';\r\n    this._drawText(ctx, this.getTitle(), canvas.width/ratio/2, height/2);\r\n  }\r\n  // Add items\r\n  this._items.forEach(function(r,i) {\r\n    var index = i + (this.getTitle() ? 1 : 0);\r\n    table.appendChild(r.getElement([width, height], function(b) {\r\n      this.dispatchEvent({\r\n        type: 'select', \r\n        index: i,\r\n        symbol: b,\r\n        item: r\r\n      });\r\n    }.bind(this)));\r\n    var item = r.getProperties();\r\n    ctx.textAlign = 'left';\r\n    if (item.feature || item.typeGeom) {\r\n      canvas = this.getLegendImage(item, canvas, index);\r\n      ctx.font = r.get('textStyle') ? r.get('textStyle').getFont() : this._textStyle.getFont();\r\n      this._drawText(ctx, r.get('title'), width + margin, (i+1.5)*height);\r\n    } else {\r\n      ctx.font = r.get('textStyle') ? r.get('textStyle').getFont() : this._titleStyle.getFont();\r\n      if (/\\bcenter\\b/.test(item.className)) {\r\n        ctx.textAlign = 'center';\r\n        this._drawText(ctx, r.get('title'), canvas.width/ratio/2, (i+1.5)*height);\r\n      } else {\r\n        this._drawText(ctx, r.get('title'), margin, (i+1.5)*height);\r\n      }\r\n    }\r\n  }.bind(this));\r\n  // Done\r\n  this.dispatchEvent({\r\n    type: 'refresh',\r\n    width: width,\r\n    height: (this._items.length+1)*height\r\n  });\r\n};\r\n/** Get the image for a style \r\n * @param {olLegendItemOptions} item \r\n * @param {Canvas|undefined} canvas a canvas to draw in, if none creat one\r\n * @param {int|undefined} row row number to draw in canvas, default 0\r\n * @return {CanvasElement}\r\n */\r\nol.legend.Legend.prototype.getLegendImage = function(options, canvas, row) {\r\n  options = options || {};\r\n  return ol.legend.Legend.getLegendImage({\r\n    className: options.className,\r\n    feature: options.feature,\r\n    typeGeom: options.typeGeom,\r\n    style: options.style || this._style,\r\n    properties: options.properties,\r\n    margin: options.margin || this.get('margin'),\r\n    size: options.size || this.get('size'),\r\n    lineHeight: options.lineHeight || this.get('lineHeight'),\r\n    onload: function() {\r\n      // Force refresh\r\n      this.refresh();\r\n    }.bind(this)\r\n  }, canvas, row);\r\n};\r\n/** Get a symbol image for a given legend item\r\n * @param {olLegendItemOptions} item \r\n * @param {Canvas|undefined} canvas a canvas to draw in, if none creat one\r\n * @param {int|undefined} row row number to draw in canvas, default 0\r\n */\r\nol.legend.Legend.getLegendImage = function(item, canvas, row) {\r\n  item = item || {};\r\n  if (typeof(item.margin) === 'undefined') item.margin = 10;\r\n  var size = item.size || [40,25];\r\n  item.onload = item.onload || function() {\r\n    setTimeout(function() { \r\n      ol.legend.Legend.getLegendImage(item, canvas, row);\r\n    }, 100);\r\n  };\r\n  var width = size[0] + 2 * item.margin;\r\n  var height = item.lineHeight || (size[1] + 2 * item.margin);\r\n  var ratio = ol.has.DEVICE_PIXEL_RATIO;\r\n  if (!canvas) {\r\n    row = 0;\r\n    canvas = document.createElement('canvas');\r\n    canvas.width = width * ratio;\r\n    canvas.height = height * ratio;\r\n  }\r\n  var ctx = canvas.getContext('2d');\r\n  ctx.save();\r\n  var vectorContext = ol.render.toContext(ctx, { pixelRatio: ratio });\r\n  var typeGeom = item.typeGeom;\r\n  var style;\r\n  var feature = item.feature;\r\n  if (!feature && typeGeom) {\r\n    if (/Point/.test(typeGeom)) feature = new ol.Feature(new ol.geom.Point([0,0]));\r\n    else if (/LineString/.test(typeGeom)) feature = new ol.Feature(new ol.geom.LineString([0,0]));\r\n    else feature = new ol.Feature(new ol.geom.Polygon([[0,0]]));\r\n    if (item.properties) feature.setProperties(item.properties);\r\n  }\r\n  if (feature) {\r\n    style = feature.getStyle();\r\n    if (typeof(style)==='function') style = style(feature);\r\n    if (!style) {\r\n      style = typeof(item.style) === 'function' ? item.style(feature) : item.style || [];\r\n    }\r\n    typeGeom = feature.getGeometry().getType();\r\n  } else {\r\n    style = [];\r\n  }\r\n  if (!(style instanceof Array)) style = [style];\r\n  var cx = width/2;\r\n  var cy = height/2;\r\n  var sx = size[0]/2;\r\n  var sy = size[1]/2;\r\n  var i, s;\r\n  // Get point offset\r\n  if (typeGeom === 'Point') {\r\n    var extent = null;\r\n    for (i=0; s= style[i]; i++) {\r\n      var img = s.getImage();\r\n      // Refresh legend on image load\r\n      if (img) {\r\n        var imgElt = img.getImage();\r\n        // Check image is loaded\r\n        if (imgElt && imgElt.complete && !imgElt.naturalWidth) {\r\n          if (typeof(item.onload) === 'function') {\r\n            imgElt.addEventListener('load', function() {\r\n              setTimeout(function() { \r\n                item.onload()\r\n              }, 100);\r\n            });\r\n          }\r\n          img.load();\r\n        }\r\n        // Check anchor to center the image\r\n        if (img.getAnchor) {\r\n          var anchor = img.getAnchor();\r\n          if (anchor) {\r\n            var si = img.getSize();\r\n            var dx = anchor[0] - si[0];\r\n            var dy = anchor[1] - si[1];\r\n            if (!extent) {\r\n              extent = [dx, dy, dx+si[0], dy+si[1]];\r\n            } else {\r\n              ol.extent.extend(extent, [dx, dy, dx+si[0], dy+si[1]]);\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n    if (extent) {\r\n      cx = cx + (extent[2] + extent[0])/2;\r\n      cy = cy + (extent[3] + extent[1])/2;\r\n    }\r\n  }\r\n  // Draw image\r\n  cy += (row*height) || 0;\r\n  for (i=0; s= style[i]; i++) {\r\n    vectorContext.setStyle(s);\r\n    switch (typeGeom) {\r\n      case ol.geom.Point:\r\n      case 'Point':\r\n      case 'MultiPoint':\r\n        vectorContext.drawGeometry(new ol.geom.Point([cx, cy]));\r\n        break;\r\n      case ol.geom.LineString:\r\n      case 'LineString':\r\n      case 'MultiLineString': \r\n        ctx.save();\r\n          ctx.rect(item.margin * ratio, 0, size[0] *  ratio, canvas.height);\r\n          ctx.clip();\r\n          vectorContext.drawGeometry(new ol.geom.LineString([[cx-sx, cy], [cx+sx, cy]]));\r\n        ctx.restore();\r\n        break;\r\n      case ol.geom.Polygon:\r\n      case 'Polygon':\r\n      case 'MultiPolygon': \r\n        vectorContext.drawGeometry(new ol.geom.Polygon([[[cx-sx, cy-sy], [cx+sx, cy-sy], [cx+sx, cy+sy], [cx-sx, cy+sy], [cx-sx, cy-sy]]]));\r\n        break;\r\n    }\r\n  }\r\n  ctx.restore();\r\n  return canvas;\r\n};\r\n\r\n/** ol/legend/Item options\r\n * @typedef {Object} olLegendItemOptions\r\n *  @property {string} title row title\r\n *  @property {className} className\r\n *  @property {ol.Feature} feature a feature to draw on the legend\r\n *  @property {string} typeGeom type geom to draw with the style or the properties if no feature is provided\r\n *  @property {Object} properties a set of properties to use with a style function\r\n *  @property {ol.style.Style.styleLike} style a style or a style function to use to draw the legend symbol\r\n *  @property {ol.style.Text} textStyle a text style to draw the item title in the legend\r\n *  @property {ol.size|undefined} size\r\n *  @property {number|undefined} margin\r\n */\r\n/** A class for legend items\r\n * @constructor\r\n * @fires select\r\n * @param {olLegendItemOptions} options\r\n */\r\nol.legend.Item = function(options) {\r\n  options = options || {};\r\n  ol.Object.call(this, options);\r\n  if (options.feature) this.set('feature', options.feature.clone());\r\n};\r\nol.ext.inherits(ol.legend.Item, ol.Object);\r\n/** Set the legend title\r\n * @param {string} title\r\n */\r\nol.legend.Item.prototype.setTitle = function(title) {\r\n  this.set('title', title || '');\r\n  this.changed();\r\n};\r\n/** Get element\r\n * @param {ol.size} size symbol size\r\n */\r\nol.legend.Item.prototype.getElement = function(size, onclick) {\r\n  var element = ol.ext.element.create('LI', {\r\n    className : this.get('className'),\r\n    click: function(e) {\r\n      onclick(false);\r\n      e.stopPropagation();\r\n    },\r\n    style: { height: size[1] + 'px' },\r\n    'aria-label': this.get('title')\r\n  });\r\n  ol.ext.element.create ('DIV', {\r\n    click: function(e) {\r\n      onclick(true);\r\n      e.stopPropagation();\r\n    },\r\n    style: {\r\n      width: size[0] + 'px',\r\n      height: size[1] + 'px'\r\n    },\r\n    parent: element\r\n  });\r\n  return element;\r\n};\r\n\r\n/**\r\n * @classdesc \r\n *   Attribution Control integrated in the canvas (for jpeg/png \r\n * @see http://www.kreidefossilien.de/webgis/dokumentation/beispiele/export-map-to-png-with-scale\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options extend the ol.control options. \r\n *  @param {ol.style.Style} options.style style used to draw the title.\r\n */\r\nol.control.CanvasBase = function(options) {\r\n  if (!options) options = {};\r\n  // Define a style to draw on the canvas\r\n  this.setStyle(options.style);\r\n  ol.control.Control.call(this, options);\r\n}\r\nol.ext.inherits(ol.control.CanvasBase, ol.control.Control);\r\n/**\r\n * Remove the control from its current map and attach it to the new map.\r\n * Subclasses may set up event handlers to get notified about changes to\r\n * the map here.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.control.CanvasBase.prototype.setMap = function (map) {\r\n  this.getCanvas(map);\r\n  var oldmap = this.getMap();\r\n  if (this._listener) {\r\n    ol.Observable.unByKey(this._listener);\r\n    this._listener = null;\r\n  }\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  if (oldmap) {\r\n    try { oldmap.renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n  if (map) {\r\n    this._listener = map.on('postcompose', this._draw.bind(this));\r\n    // Get a canvas layer on top of the map\r\n  }\r\n};\r\n/** Get canvas overlay\r\n */\r\nol.control.CanvasBase.prototype.getCanvas = function(map) {\r\n  return ol.ext.getMapCanvas(map);\r\n};\r\n/** Get map Canvas\r\n * @private\r\n */\r\nol.control.CanvasBase.prototype.getContext = function(e) {\r\n  var ctx = e.context;\r\n  if (!ctx && this.getMap()) {\r\n    var c = this.getMap().getViewport().getElementsByClassName('ol-fixedoverlay')[0];\r\n    ctx = c ? c.getContext('2d') : null;\r\n  }\r\n  return ctx;\r\n};\r\n/** Set Style\r\n * @api\r\n */\r\nol.control.CanvasBase.prototype.setStyle = function(style) {\r\n  this._style = style ||  new ol.style.Style ({});\r\n};\r\n/** Get style\r\n * @api\r\n */\r\nol.control.CanvasBase.prototype.getStyle = function() {\r\n  return this._style;\r\n};\r\n/** Get stroke\r\n * @api\r\n */\r\nol.control.CanvasBase.prototype.getStroke = function() {\r\n  var t = this._style.getStroke();\r\n  if (!t) this._style.setStroke(new ol.style.Stroke ({ color:'#000', width:1.25 }));\r\n  return this._style.getStroke();\r\n};\r\n/** Get fill\r\n * @api\r\n */\r\nol.control.CanvasBase.prototype.getFill = function() {\r\n  var t = this._style.getFill();\r\n  if (!t) this._style.setFill(new ol.style.Fill ({ color:'#fff' }));\r\n  return this._style.getFill();\r\n};\r\n/** Get stroke\r\n * @api\r\n */\r\nol.control.CanvasBase.prototype.getTextStroke = function() {\r\n  var t = this._style.getText();\r\n  if (!t) t = new ol.style.Text({});\r\n  if (!t.getStroke()) t.setStroke(new ol.style.Stroke ({ color:'#fff', width:3 }));\r\n  return t.getStroke();\r\n};\r\n/** Get text fill\r\n * @api\r\n */\r\nol.control.CanvasBase.prototype.getTextFill = function() {\r\n  var t = this._style.getText();\r\n  if (!t) t = new ol.style.Text({});\r\n  if (!t.getFill()) t.setFill(new ol.style.Fill ({ color:'#fff' }));\r\n  return t.getFill();\r\n};\r\n/** Get text font\r\n * @api\r\n */\r\nol.control.CanvasBase.prototype.getTextFont = function() {\r\n  var t = this._style.getText();\r\n  if (!t) t = new ol.style.Text({});\r\n  if (!t.getFont()) t.setFont('12px sans-serif');\r\n  return t.getFont();\r\n};\r\n/** Draw the control on canvas\r\n * @protected\r\n */\r\nol.control.CanvasBase.prototype._draw = function(/* e */) {\r\n  console.warn('[CanvasBase] draw function not implemented.');\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * This is the base class for Select controls on attributes values. \r\n * Abstract base class; \r\n * normally only used for creating subclasses and not instantiated in apps. \r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fires select\r\n * @param {Object=} options\r\n *  @param {string} options.className control class name\r\n *  @param {Element | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {ol.Collection<ol.Feature>} options.features a collection of feature to search in, the collection will be kept in date while selection\r\n *  @param {ol.source.Vector | Array<ol.source.Vector>} options.source the source to search in if no features set\r\n */\r\nol.control.SelectBase = function(options) {\r\n  if (!options) options = {};\r\n  this._features = this.setFeatures(options.features);\r\n  var element;\r\n  if (options.target) {\r\n    element = document.createElement(\"div\");\r\n  } else {\r\n    element = document.createElement(\"div\");\r\n    element.className = 'ol-select ol-unselectable ol-control ol-collapsed';\r\n    ol.ext.element.create('BUTTON', {\r\n      type: 'button',\r\n      on: {\r\n        'click touchstart': function(e) {\r\n          element.classList.toggle('ol-collapsed');\r\n          e.preventDefault();\r\n        }\r\n      },\r\n      parent: element\r\n    });\r\n  }\r\n  if (options.className) element.classList.add(options.className);\r\n  element.appendChild(options.content);\r\n  // OK button\r\n  ol.ext.element.create('BUTTON', {\r\n    html: options.btInfo || 'OK',\r\n    className: 'ol-ok',\r\n    on: { 'click touchstart': this.doSelect.bind(this) },\r\n    parent: options.content\r\n  });\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.setSources(options.source);\r\n};\r\nol.ext.inherits(ol.control.SelectBase, ol.control.Control);\r\n/** Set the current sources\r\n * @param {ol.source.Vector|Array<ol.source.Vector>|undefined} source\r\n */\r\nol.control.SelectBase.prototype.setSources = function (source) {\r\n  if (source) {\r\n    this.set ('source', (source instanceof Array) ? source : [source]);\r\n  } else {\r\n    this.unset('source');\r\n  }  \r\n};\r\n/** Set feature collection to search in\r\n * @param {ol.Collection<ol.Feature>} features\r\n */\r\nol.control.SelectBase.prototype.setFeatures = function (features) {\r\n  if (features instanceof ol.Collection) this._features = features;\r\n  else this._features = null;\r\n};\r\n/** Get feature collection to search in\r\n * @return {ol.Collection<ol.Feature>}\r\n */\r\nol.control.SelectBase.prototype.getFeatures = function () {\r\n  return this._features;\r\n};\r\n/** List of operators / translation\r\n * @api\r\n */\r\nol.control.SelectBase.prototype.operationsList = {\r\n  '=': '=',\r\n  '!=': '≠',\r\n  '<': '<',\r\n  '<=': '≤',\r\n  '>=': '≥',\r\n  '>': '>',\r\n  'contain': '⊂', // ∈\r\n  '!contain': '⊄',\t// ∉\r\n  'regexp': '≃',\r\n  '!regexp': '≄'\r\n};\r\n/** Escape string for regexp\r\n * @param {string} search\r\n * @return {string}\r\n */\r\nol.control.SelectBase.prototype._escape = function (s) {\r\n  return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\r\n};\r\n/**\r\n * Test if a feature check aconditino\r\n * @param {ol.Feature} f the feature to check condition\r\n * @param {Object} condition an object to use for test\r\n *  @param {string} condition.attr attribute name\r\n *  @param {string} condition.op operator\r\n *  @param {any} condition.val value to test\r\n * @param {boolean} usecase use case or not when testing strings\r\n * @return {boolean}\r\n * @private\r\n */\r\nol.control.SelectBase.prototype._checkCondition = function (f, condition, usecase) {\r\n  if (!condition.attr) return true;\r\n  var val = f.get(condition.attr);\r\n  // Try to test numeric values\r\n  var isNumber = (Number(val) == val && Number(condition.val) == condition.val);\r\n  if (isNumber) val = Number(val);\r\n  // Check\r\n  var rex;\r\n  switch (condition.op) {\r\n    case '=':\r\n      if (isNumber) {\r\n        return val == condition.val;\r\n      } else {\r\n        rex = new RegExp('^'+this._escape(condition.val)+'$', usecase ? '' : 'i');\r\n        return rex.test(val);\r\n      }\r\n    case '!=':\r\n      if (isNumber) {\r\n        return val != condition.val;\r\n      } else {\r\n        rex = new RegExp('^'+this._escape(condition.val)+'$', usecase ? '' : 'i');\r\n        return !rex.test(val);\r\n      }\r\n    case '<':\r\n      return val < condition.val;\r\n    case '<=':\r\n      return val <= condition.val;\r\n    case '>':\r\n      return val > condition.val;\r\n    case '>=':\r\n      return val >= condition.val;\r\n    case 'contain':\r\n      rex = new RegExp(this._escape(condition.val), usecase ? '' : 'i');\r\n      return rex.test(val);\r\n    case '!contain':\r\n      rex = new RegExp(this._escape(condition.val), usecase ? '' : 'i');\r\n      return !rex.test(val);\r\n    case 'regexp':\r\n      rex = new RegExp(condition.val, usecase ? '' : 'i');\r\n      return rex.test(val);\r\n    case '!regexp':\r\n      rex = new RegExp(condition.val, usecase ? '' : 'i');\r\n      return !rex.test(val);\r\n    default:\r\n      return false;\r\n  }\r\n};\r\n/** Selection features in a list of features\r\n * @param {Array<ol.Feature>} result the current list of features\r\n * @param {Array<ol.Feature>} features to test in\r\n * @param {Object} condition \r\n *  @param {string} condition.attr attribute name\r\n *  @param {string} condition.op operator\r\n *  @param {any} condition.val value to test\r\n * @param {boolean} all all conditions must be valid\r\n * @param {boolean} usecase use case or not when testing strings\r\n */\r\nol.control.SelectBase.prototype._selectFeatures = function (result, features, conditions, all, usecase) {\r\n  conditions = conditions || [];\r\n  var f;\r\n  for (var i=features.length-1; f=features[i]; i--) {\r\n    var isok = all;\r\n    for (var k=0, c; c=conditions[k]; k++) {\r\n      if (c.attr) {\r\n        if (all) {\r\n          isok = isok && this._checkCondition(f,c,usecase);\r\n        }\r\n        else {\r\n          isok = isok || this._checkCondition(f,c,usecase);\r\n        }\r\n      }\r\n    }\r\n    if (isok) {\r\n      result.push(f);\r\n    } else if (this._features) {\r\n      this._features.removeAt(i);\r\n    }\r\n  }\r\n  return result;\r\n};\r\n/** Get vector source\r\n * @return {Array<ol.source.Vector>}\r\n */\r\nol.control.SelectBase.prototype.getSources = function () {\r\n  if (this.get('source')) return this.get('source');\r\n  var sources = [];\r\n  function getSources(layers) {\r\n    layers.forEach(function(l){\r\n      if (l.getLayers) {\r\n        getSources(l.getLayers());\r\n      } else if (l.getSource && l.getSource() instanceof ol.source.Vector) {\r\n        sources.push(l.getSource());\r\n      }\r\n    });\r\n  }\r\n  if (this.getMap()) {\r\n    getSources(this.getMap().getLayers());\r\n  }\r\n  return sources;\r\n};\r\n/** Select features by attributes\r\n * @param {*} options\r\n *  @param {Array<ol.source.Vector>|undefined} options.sources source to apply rules, default the select sources\r\n *  @param {bool} options.useCase case sensitive, default false\r\n *  @param {bool} options.matchAll match all conditions, default false\r\n *  @param {Array<conditions>} options.conditions array of conditions\r\n * @return {Array<ol.Feature>}\r\n * @fires select\r\n */\r\nol.control.SelectBase.prototype.doSelect = function (options) {\r\n  options = options || {};\r\n  var features = [];\r\n  if (options.features) {\r\n    this._selectFeatures(features, options.features, options.conditions, options.matchAll, options.useCase);\r\n  } else if (this._features) {\r\n    this._selectFeatures(features, this._features.getArray(), options.conditions, options.matchAll, options.useCase);\r\n  } else {\r\n    var sources = options.sources || this.getSources();\r\n    sources.forEach(function(s) {\r\n      this._selectFeatures(features, s.getFeatures(), options.conditions, options.matchAll, options.useCase);\r\n    }.bind(this));\r\n  }\r\n  this.dispatchEvent({ type:\"select\", features: features });\r\n  return features;\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A simple push button control\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n *  @param {String} options.className class of the control\r\n *  @param {String} options.title title of the control\r\n *  @param {String} options.name an optional name, default none\r\n *  @param {String} options.html html to insert in the control\r\n *  @param {function} options.handleClick callback when control is clicked (or use change:active event)\r\n */\r\nol.control.Button = function(options){\r\n  options = options || {};\r\n  var element = document.createElement(\"div\");\r\n  element.className = (options.className || '') + \" ol-button ol-unselectable ol-control\";\r\n  var self = this;\r\n  var bt = this.button_ = document.createElement(/ol-text-button/.test(options.className) ? \"div\": \"button\");\r\n  bt.type = \"button\";\r\n  if (options.title) bt.title = options.title;\r\n  if (options.name) bt.name = options.name;\r\n  if (options.html instanceof Element) bt.appendChild(options.html)\r\n  else bt.innerHTML = options.html || \"\";\r\n  var evtFunction = function(e) {\r\n    if (e && e.preventDefault) {\r\n      e.preventDefault();\r\n      e.stopPropagation();\r\n    }\r\n    if (options.handleClick) {\r\n      options.handleClick.call(self, e);\r\n    }\r\n  };\r\n  bt.addEventListener(\"click\", evtFunction);\r\n  bt.addEventListener(\"touchstart\", evtFunction);\r\n  element.appendChild(bt);\r\n  // Try to get a title in the button content\r\n  if (!options.title && bt.firstElementChild) {\r\n    bt.title = bt.firstElementChild.title;\r\n  }\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  if (options.title) {\r\n    this.set(\"title\", options.title);\r\n  }\r\n  if (options.title) this.set(\"title\", options.title);\r\n  if (options.name) this.set(\"name\", options.name);\r\n};\r\nol.ext.inherits(ol.control.Button, ol.control.Control);\r\n/** Set the control visibility\r\n* @param {boolean} b \r\n*/\r\nol.control.Button.prototype.setVisible = function (val) {\r\n  if (val) ol.ext.element.show(this.element);\r\n  else ol.ext.element.hide(this.element);\r\n};\r\n/**\r\n * Set the button title\r\n * @param {string} title\r\n */\r\nol.control.Button.prototype.setTitle = function(title) {\r\n  this.button_.setAttribute('title', title);\r\n};\r\n/**\r\n * Set the button html\r\n * @param {string} html\r\n */\r\nol.control.Button.prototype.setHtml = function(html) {\r\n  ol.ext.element.setHTML (this.button_, html);\r\n};\r\n/**\r\n * Get the button element\r\n * @returns {Element}\r\n */\r\nol.control.Button.prototype.getButtonElement = function() {\r\n  return this.button_;\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A simple toggle control\r\n * The control can be created with an interaction to control its activation.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Button}\r\n * @fires change:active, change:disable\r\n * @param {Object=} options Control options.\r\n *  @param {String} options.className class of the control\r\n *  @param {String} options.title title of the control\r\n *  @param {String} options.html html to insert in the control\r\n *  @param {ol.interaction} options.interaction interaction associated with the control\r\n *  @param {bool} options.active the control is created active, default false\r\n *  @param {bool} options.disable the control is created disabled, default false\r\n *  @param {ol.control.Bar} options.bar a subbar associated with the control (drawn when active if control is nested in a ol.control.Bar)\r\n *  @param {bool} options.autoActive the control will activate when shown in an ol.control.Bar, default false\r\n *  @param {function} options.onToggle callback when control is clicked (or use change:active event)\r\n */\r\nol.control.Toggle = function(options) {\r\n  options = options || {};\r\n  var self = this;\r\n  this.interaction_ = options.interaction;\r\n  if (this.interaction_) {\r\n    this.interaction_.setActive(options.active);\r\n    this.interaction_.on(\"change:active\", function() {\r\n      self.setActive(self.interaction_.getActive());\r\n    });\r\n  }\r\n  if (options.toggleFn) options.onToggle = options.toggleFn; // compat old version\r\n  options.handleClick = function() {\r\n    self.toggle();\r\n    if (options.onToggle) options.onToggle.call(self, self.getActive());\r\n  };\r\n  options.className = (options.className||\"\") + \" ol-toggle\";\r\n  ol.control.Button.call(this, options);\r\n  this.set(\"title\", options.title);\r\n  this.set (\"autoActivate\", options.autoActivate);\r\n  if (options.bar) this.setSubBar(options.bar);\r\n  this.setActive (options.active);\r\n  this.setDisable (options.disable);\r\n};\r\nol.ext.inherits(ol.control.Toggle, ol.control.Button);\r\n/**\r\n * Set the map instance the control is associated with\r\n * and add interaction attached to it to this map.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.control.Toggle.prototype.setMap = function(map) {\r\n  if (!map && this.getMap()) {\r\n    if (this.interaction_) {\r\n      this.getMap().removeInteraction (this.interaction_);\r\n    }\r\n    if (this.subbar_) this.getMap().removeControl (this.subbar_);\r\n  }\r\n  ol.control.Button.prototype.setMap.call(this, map);\r\n  if (map) {\r\n    if (this.interaction_) map.addInteraction (this.interaction_);\r\n    if (this.subbar_) map.addControl (this.subbar_);\r\n  }\r\n};\r\n/** Get the subbar associated with a control\r\n * @return {ol.control.Bar}\r\n */\r\nol.control.Toggle.prototype.getSubBar = function () {\r\n  return this.subbar_;\r\n};\r\n/** Set the subbar associated with a control\r\n * @param {ol.control.Bar} [bar] a subbar if none remove the current subbar\r\n */\r\nol.control.Toggle.prototype.setSubBar = function (bar) {\r\n  var map = this.getMap();\r\n  if (map && this.subbar_) map.removeControl (this.subbar_);\r\n  this.subbar_ = bar;\r\n  if (bar) {\r\n    this.subbar_.setTarget(this.element);\r\n    this.subbar_.element.classList.add(\"ol-option-bar\");\r\n    if (map) map.addControl (this.subbar_);\r\n  }\r\n};\r\n/**\r\n * Test if the control is disabled.\r\n * @return {bool}.\r\n * @api stable\r\n */\r\nol.control.Toggle.prototype.getDisable = function() {\r\n  var button = this.element.querySelector(\"button\");\r\n  return button && button.disabled;\r\n};\r\n/** Disable the control. If disable, the control will be deactivated too.\r\n* @param {bool} b disable (or enable) the control, default false (enable)\r\n*/\r\nol.control.Toggle.prototype.setDisable = function(b) {\r\n  if (this.getDisable()==b) return;\r\n  this.element.querySelector(\"button\").disabled = b;\r\n  if (b && this.getActive()) this.setActive(false);\r\n  this.dispatchEvent({ type:'change:disable', key:'disable', oldValue:!b, disable:b });\r\n};\r\n/**\r\n * Test if the control is active.\r\n * @return {bool}.\r\n * @api stable\r\n */\r\nol.control.Toggle.prototype.getActive = function() {\r\n  return this.element.classList.contains(\"ol-active\");\r\n};\r\n/** Toggle control state active/deactive\r\n */\r\nol.control.Toggle.prototype.toggle = function() {\r\n  if (this.getActive()) this.setActive(false);\r\n  else this.setActive(true);\r\n};\r\n/** Change control state\r\n * @param {bool} b activate or deactivate the control, default false\r\n */\r\nol.control.Toggle.prototype.setActive = function(b) {\r\n  if (this.interaction_) this.interaction_.setActive (b);\r\n  if (this.subbar_) this.subbar_.setActive(b);\r\n  if (this.getActive()===b) return;\r\n  if (b) this.element.classList.add(\"ol-active\");\r\n  else this.element.classList.remove(\"ol-active\");\r\n  this.dispatchEvent({ type:'change:active', key:'active', oldValue:!b, active:b });\r\n};\r\n/** Set the control interaction\r\n* @param {_ol_interaction_} i interaction to associate with the control\r\n*/\r\nol.control.Toggle.prototype.setInteraction = function(i) {\r\n  this.interaction_ = i;\r\n};\r\n/** Get the control interaction\r\n* @return {_ol_interaction_} interaction associated with the control\r\n*/\r\nol.control.Toggle.prototype.getInteraction = function() {\r\n  return this.interaction_;\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Search Control.\r\n * This is the base class for search controls. You can use it for simple custom search or as base to new class.\r\n * @see ol.control.SearchFeature\r\n * @see ol.control.SearchPhoton\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fires select\r\n * @fires change:input\r\n * @param {Object=} options\r\n *  @param {string} options.className control class name\r\n *  @param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {string | undefined} options.title Title to use for the search button tooltip, default \"Search\"\r\n *  @param {string | undefined} options.reverseTitle Title to use for the reverse geocoding button tooltip, default \"Click on the map...\"\r\n *  @param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *  @param {boolean | undefined} options.reverse enable reverse geocoding, default false\r\n *  @param {string | undefined} options.inputLabel label for the input, default none\r\n *  @param {string | undefined} options.collapsed search is collapsed on start, default true\r\n *  @param {string | undefined} options.noCollapse prevent collapsing on input blur, default false\r\n *  @param {number | undefined} options.typing a delay on each typing to start searching (ms) use -1 to prevent autocompletion, default 300.\r\n *  @param {integer | undefined} options.minLength minimum length to start searching, default 1\r\n *  @param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *  @param {integer | undefined} options.maxHistory maximum number of items to display in history. Set -1 if you don't want history, default maxItems\r\n *  @param {function} options.getTitle a function that takes a feature and return the name to display in the index.\r\n *  @param {function} options.autocomplete a function that take a search string and callback function to send an array\r\n *  @param {function} options.onselect a function called when a search is selected\r\n *  @param {boolean} options.centerOnSelect center map on search, default false\r\n *  @param {number|boolean} options.zoomOnSelect center map on search and zoom to value if zoom < value, default false\r\n */\r\nol.control.Search = function(options) {\r\n  var self = this;\r\n  if (!options) options = {};\r\n  if (options.typing == undefined) options.typing = 300;\r\n  // Class name for history\r\n  this._classname = options.className || 'search';\r\n  var classNames = (options.className||'')+ ' ol-search'\r\n    + (options.target ? '' : ' ol-unselectable ol-control');\r\n  var element = ol.ext.element.create('DIV',{\r\n    className: classNames \r\n  })\r\n  if (options.collapsed!==false) element.classList.add('ol-collapsed');\r\n  if (!options.target) {\r\n    this.button = document.createElement('BUTTON');\r\n    this.button.setAttribute('type', 'button');\r\n    this.button.setAttribute('title', options.title || options.label || 'Search');\r\n    this.button.addEventListener('click', function() {\r\n      element.classList.toggle('ol-collapsed');\r\n      if (!element.classList.contains('ol-collapsed')) {\r\n        element.querySelector('input.search').focus();\r\n        var listElements = element.querySelectorAll('li');\r\n        for (var i = 0; i < listElements.length; i++) {\r\n          listElements[i].classList.remove('select');\r\n        }\r\n        // Display history\r\n        if (!input.value) {\r\n          self.drawList_();\r\n        }\r\n      }\r\n    });\r\n    element.appendChild(this.button);\r\n  }\r\n  // Input label\r\n  if (options.inputLabel) {\r\n    var label = document.createElement(\"LABEL\");\r\n    label.innerText = options.inputLabel;\r\n    element.appendChild(label);\r\n  }\r\n  // Search input\r\n  var tout, cur=\"\";\r\n  var input = this._input = document.createElement(\"INPUT\");\r\n  input.setAttribute(\"type\", \"search\");\r\n  input.setAttribute(\"class\", \"search\");\r\n  input.setAttribute(\"autocomplete\", \"off\");\r\n  input.setAttribute(\"placeholder\", options.placeholder||\"Search...\");\r\n  input.addEventListener(\"change\", function(e) {\r\n    self.dispatchEvent({ type:\"change:input\", input:e, value:input.value });\r\n  });\r\n  var doSearch = function(e) {\r\n    // console.log(e.type+\" \"+e.key)'\r\n    var li  = element.querySelector(\"ul.autocomplete li.select\");\r\n    var\tval = input.value;\r\n    // move up/down\r\n    if (e.key=='ArrowDown' || e.key=='ArrowUp' || e.key=='Down' || e.key=='Up') {\r\n      if (li) {\r\n        li.classList.remove(\"select\");\r\n        li = (/Down/.test(e.key)) ? li.nextElementSibling : li.previousElementSibling;\r\n        if (li) li.classList.add(\"select\");\r\n      }\r\n      else element.querySelector(\"ul.autocomplete li\").classList.add(\"select\");\r\n    }\r\n    // Clear input\r\n    else if (e.type=='input' && !val) {\r\n      setTimeout(function(){\r\n        self.drawList_();\r\n      }, 200);\r\n    }\r\n    // Select in the list\r\n    else if (li && (e.type==\"search\" || e.key ==\"Enter\")) {\r\n      if (element.classList.contains(\"ol-control\")) input.blur();\r\n      li.classList.remove(\"select\");\r\n      cur = val;\r\n      self._handleSelect(self._list[li.getAttribute(\"data-search\")]);\r\n    }\r\n    // Search / autocomplete\r\n    else if ( (e.type==\"search\" || e.key =='Enter')\r\n      || (cur!=val && options.typing>=0)) {\r\n      // current search\r\n      cur = val;\r\n      if (cur) {\r\n        // prevent searching on each typing\r\n        if (tout) clearTimeout(tout);\r\n        var minLength = self.get(\"minLength\");\r\n        tout = setTimeout(function() {\r\n          if (cur.length >= minLength) {\r\n            var s = self.autocomplete (cur, function(auto) { self.drawList_(auto); });\r\n            if (s) self.drawList_(s);\r\n          }\r\n          else self.drawList_();\r\n        }, options.typing);\r\n      }\r\n      else self.drawList_();\r\n    }\r\n    // Clear list selection\r\n    else {\r\n      li = element.querySelector(\"ul.autocomplete li\");\r\n      if (li) li.classList.remove('select');\r\n    }\r\n  };\r\n  input.addEventListener(\"keyup\", doSearch);\r\n  input.addEventListener(\"search\", doSearch);\r\n  input.addEventListener(\"cut\", doSearch);\r\n  input.addEventListener(\"paste\", doSearch);\r\n  input.addEventListener(\"input\", doSearch);\r\n  if (!options.noCollapse) {\r\n    input.addEventListener('blur', function() {\r\n      setTimeout(function(){ \r\n        if (input !== document.activeElement) {\r\n          element.classList.add('ol-collapsed');\r\n          this.set('reverse', false);\r\n          element.classList.remove('ol-revers');\r\n        }\r\n      }.bind(this), 200);\r\n    }.bind(this));\r\n    input.addEventListener('focus', function() {\r\n      if (!this.get('reverse')) {\r\n        element.classList.remove('ol-collapsed');\r\n        element.classList.remove('ol-revers');\r\n      }\r\n    }.bind(this));\r\n  }\r\n  element.appendChild(input);\r\n  // Reverse geocode\r\n  if (options.reverse) {\r\n    var reverse = ol.ext.element.create('BUTTON', {\r\n      type: 'button',\r\n      class: 'ol-revers',\r\n      title: options.reverseTitle || 'click on the map',\r\n      click: function() {\r\n        if (!this.get('reverse')) {\r\n          this.set('reverse', !this.get('reverse'));\r\n          input.focus();\r\n          element.classList.add('ol-revers');\r\n        } else {\r\n          this.set('reverse', false);\r\n        }\r\n      }.bind(this)\r\n    });\r\n    element.appendChild(reverse);\r\n  }\r\n  // Autocomplete list\r\n  var ul = document.createElement('UL');\r\n  ul.classList.add('autocomplete');\r\n  element.appendChild(ul);\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  if (typeof (options.getTitle)=='function') this.getTitle = options.getTitle;\r\n  if (typeof (options.autocomplete)=='function') this.autocomplete = options.autocomplete;\r\n  // Options\r\n  this.set('copy', options.copy);\r\n  this.set('minLength', options.minLength || 1);\r\n  this.set('maxItems', options.maxItems || 10);\r\n  this.set('maxHistory', options.maxHistory || options.maxItems || 10);\r\n  // Select\r\n  if (options.onselect) this.on('select', options.onselect);\r\n  // Center on select\r\n  if (options.centerOnSelect) this.on('select', function(e) {\r\n    var map = this.getMap();\r\n    if (map) {\r\n      map.getView().setCenter(e.coordinate);\r\n    }\r\n  }.bind(this));\r\n  // Zoom on select\r\n  if (options.zoomOnSelect) this.on('select', function(e) {\r\n    var map = this.getMap();\r\n    if (map) {\r\n      map.getView().setCenter(e.coordinate);\r\n      if (map.getView().getZoom() < options.zoomOnSelect) map.getView().setZoom(options.zoomOnSelect);\r\n    }\r\n  }.bind(this));\r\n  // History\r\n  this.restoreHistory();\r\n  this.drawList_();\r\n};\r\nol.ext.inherits(ol.control.Search, ol.control.Control);\r\n/**\r\n * Remove the control from its current map and attach it to the new map.\r\n * Subclasses may set up event handlers to get notified about changes to\r\n * the map here.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.control.Search.prototype.setMap = function (map) {\r\n  if (this._listener) ol.Observable.unByKey(this._listener);\r\n\tthis._listener = null;\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  if (map) {\r\n\t\tthis._listener = map.on('click', this._handleClick.bind(this));\r\n\t}\r\n};\r\n/** Collapse the search\r\n * @param {boolean} [b=true]\r\n * @api\r\n */\r\nol.control.Search.prototype.collapse = function (b) {\r\n  if (b===false) this.element.classList.remove('ol-collapsed')\r\n  else this.element.classList.add('ol-collapsed')\r\n};\r\n/** Get the input field\r\n*\t@return {Element} \r\n*\t@api\r\n*/\r\nol.control.Search.prototype.getInputField = function () {\r\n  return this._input;\r\n};\r\n/** Returns the text to be displayed in the menu\r\n *\t@param {any} f feature to be displayed\r\n *\t@return {string} the text to be displayed in the index, default f.name\r\n *\t@api\r\n */\r\nol.control.Search.prototype.getTitle = function (f) {\r\n  return f.name || \"No title\";\r\n};\r\n/** Returns title as text\r\n *\t@param {any} f feature to be displayed\r\n *\t@return {string} \r\n *\t@api\r\n */\r\nol.control.Search.prototype._getTitleTxt = function (f) {\r\n  return ol.ext.element.create('DIV', {\r\n    html: this.getTitle(f)\r\n  }).innerText;\r\n};\r\n/** Force search to refresh\r\n */\r\nol.control.Search.prototype.search = function () {\r\n  var search = this.element.querySelector(\"input.search\");\r\n  this._triggerCustomEvent('search', search);\r\n};\r\n/** Reverse geocode\r\n * @param {Object} event\r\n *  @param {ol.coordinate} event.coordinate\r\n * @private\r\n */\r\nol.control.Search.prototype._handleClick = function (e) {\r\n  if (this.get('reverse')) {\r\n    document.activeElement.blur();\r\n    this.reverseGeocode(e.coordinate);\r\n  }\r\n};\r\n/** Reverse geocode\r\n * @param {ol.coordinate} coord\r\n * @param {function | undefined} cback a callback function, default trigger a select event\r\n * @api\r\n */\r\nol.control.Search.prototype.reverseGeocode = function (/*coord, cback*/) {\r\n  // this._handleSelect(f);\r\n};\r\n/** Trigger custom event on elemebt\r\n * @param {*} eventName \r\n * @param {*} element \r\n * @private\r\n */\r\nol.control.Search.prototype._triggerCustomEvent = function (eventName, element) {\r\n  ol.ext.element.dispatchEvent(eventName, element);\r\n};\r\n/** Set the input value in the form (for initialisation purpose)\r\n*\t@param {string} value\r\n*\t@param {boolean} search to start a search\r\n*\t@api\r\n*/\r\nol.control.Search.prototype.setInput = function (value, search) {\r\n  var input = this.element.querySelector(\"input.search\");\r\n  input.value = value;\r\n  if (search) this._triggerCustomEvent(\"keyup\", input);\r\n};\r\n/** A line has been clicked in the menu > dispatch event\r\n * @param {any} f the feature, as passed in the autocomplete\r\n * @param {boolean} reverse true if reverse geocode\r\n * @param {ol.coordinate} coord\r\n * @param {*} options options passed to the event\r\n *\t@api\r\n */\r\nol.control.Search.prototype.select = function (f, reverse, coord, options) {\r\n  var event = { type:\"select\", search:f, reverse: !!reverse, coordinate: coord };\r\n  if (options) {\r\n    for (var i in options) {\r\n      event[i] = options[i];\r\n    }\r\n  }\r\n  this.dispatchEvent(event);\r\n};\r\n/**\r\n * Save history and select\r\n * @param {*} f \r\n * @param {boolean} reverse true if reverse geocode\r\n * @param {*} options options send in the event \r\n * @private\r\n */\r\nol.control.Search.prototype._handleSelect = function (f, reverse, options) {\r\n  if (!f) return;\r\n  // Save input in history\r\n  var hist = this.get('history');\r\n  // Prevent error on stringify\r\n  var i;\r\n  try {\r\n    var fstr = JSON.stringify(f);\r\n    for (i=hist.length-1; i>=0; i--) {\r\n      if (!hist[i] || JSON.stringify(hist[i]) === fstr) {\r\n        hist.splice(i,1);\r\n      }\r\n    }\r\n  } catch (e) {\r\n    for (i=hist.length-1; i>=0; i--) {\r\n      if (hist[i] === f) {\r\n        hist.splice(i,1);\r\n      }\r\n    }\r\n  }\r\n  hist.unshift(f);\r\n  var size = Math.max(0, this.get('maxHistory')||10) || 0;\r\n  while (hist.length > size) {\r\n    hist.pop();\r\n  } \r\n  this.saveHistory();\r\n  // Select feature\r\n  this.select(f, reverse, null, options);\r\n  if (reverse) {\r\n    this.setInput(this._getTitleTxt(f));\r\n    this.drawList_();\r\n    setTimeout(function() { this.collapse(false); }.bind(this), 300);\r\n  }\r\n};\r\n/** Current history */\r\nol.control.Search.prototype._history = {};\r\n/** Save history (in the localstorage)\r\n */\r\nol.control.Search.prototype.saveHistory = function () {\r\n  try {\r\n    if (this.get('maxHistory')>=0) {\r\n      localStorage[\"ol@search-\"+this._classname] = JSON.stringify(this.get('history'));\r\n    } else {\r\n      localStorage.removeItem(\"ol@search-\"+this._classname);\r\n    }\r\n  } catch(e) { console.warn('Failed to access localStorage...'); }\r\n};\r\n/** Restore history (from the localstorage) \r\n */\r\nol.control.Search.prototype.restoreHistory = function () {\r\n  if (this._history[this._classname]) {\r\n    this.set('history', this._history[this._classname]);\r\n  } else {\r\n    try {\r\n      this._history[this._classname] = JSON.parse(localStorage[\"ol@search-\"+this._classname]);\r\n      this.set('history', this._history[this._classname]);\r\n    } catch(e) {\r\n      this.set('history', []);\r\n    }\r\n  }\r\n};\r\n/**\r\n * Remove previous history\r\n */\r\nol.control.Search.prototype.clearHistory = function () {\r\n  this.set('history', []);\r\n  this.saveHistory();\r\n  this.drawList_();\r\n};\r\n/**\r\n * Get history table\r\n */\r\nol.control.Search.prototype.getHistory = function () {\r\n  return this.get('history');\r\n};\r\n/** Autocomplete function\r\n* @param {string} s search string\r\n* @param {function} cback a callback function that takes an array to display in the autocomplete field (for asynchronous search)\r\n* @return {Array|false} an array of search solutions or false if the array is send with the cback argument (asnchronous)\r\n* @api\r\n*/\r\nol.control.Search.prototype.autocomplete = function (s, cback) {\r\n  cback ([]);\r\n  return false;\r\n  // or just return [];\r\n};\r\n/** Draw the list\r\n* @param {Array} auto an array of search result\r\n* @private\r\n*/\r\nol.control.Search.prototype.drawList_ = function (auto) {\r\n  var self = this;\r\n  var ul = this.element.querySelector(\"ul.autocomplete\");\r\n  ul.innerHTML = '';\r\n  this._list = [];\r\n  if (!auto) {\r\n    var input = this.element.querySelector(\"input.search\");\r\n    var value = input.value;\r\n    if (!value) {\r\n      auto = this.get('history');\r\n    } else {\r\n      return;\r\n    }\r\n    ul.setAttribute('class', 'autocomplete history');\r\n  } else {\r\n    ul.setAttribute('class', 'autocomplete');\r\n  }\r\n  var li, max = Math.min (self.get(\"maxItems\"),auto.length);\r\n  for (var i=0; i<max; i++) {\t\r\n    if (auto[i]) {\r\n      if (!i || !self.equalFeatures(auto[i], auto[i-1])) {\r\n        li = document.createElement(\"LI\");\r\n        li.setAttribute(\"data-search\", this._list.length);\r\n        this._list.push(auto[i]);\r\n        li.addEventListener(\"click\", function(e) {\r\n          self._handleSelect(self._list[e.currentTarget.getAttribute(\"data-search\")]);\r\n        });\r\n        var title = self.getTitle(auto[i]);\r\n        if (title instanceof Element) li.appendChild(title);\r\n        else li.innerHTML = title;\r\n        ul.appendChild(li);\r\n      }\r\n    }\r\n  }\r\n  if (max && this.get(\"copy\")) {\r\n    li = document.createElement(\"LI\");\r\n    li.classList.add(\"copy\");\r\n    li.innerHTML = this.get(\"copy\");\r\n    ul.appendChild(li);\r\n  }\r\n};\r\n/** Test if 2 features are equal\r\n * @param {any} f1\r\n * @param {any} f2\r\n * @return {boolean}\r\n */\r\nol.control.Search.prototype.equalFeatures = function (/* f1, f2 */) {\r\n  return false;\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * This is the base class for search controls that use a json service to search features.\r\n * You can use it for simple custom search or as base to new class.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Search}\r\n * @fires select\r\n * @param {any} options extend ol.control.Search options\r\n *  @param {string} options.className control class name\r\n *  @param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {string | undefined} options.title Title to use for the search button tooltip, default \"Search\"\r\n *  @param {string | undefined} options.reverseTitle Title to use for the reverse geocoding button tooltip, default \"Click on the map...\"\r\n *  @param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *  @param {number | undefined} options.typing a delay on each typing to start searching (ms), default 1000.\r\n *  @param {integer | undefined} options.minLength minimum length to start searching, default 3\r\n *  @param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *  @param {function | undefined} options.handleResponse Handle server response to pass the features array to the list\r\n *\r\n *  @param {string|undefined} options.url Url of the search api\r\n *  @param {string | undefined} options.authentication: basic authentication for the search API as btoa(\"login:pwd\")\r\n */\r\nol.control.SearchJSON = function(options) {\r\n  options = options || {};\r\n  options.className = options.className || 'JSON';\r\n  delete options.autocomplete;\r\n  options.minLength = options.minLength || 3;\r\n  options.typing = options.typing || 800;\r\n  ol.control.Search.call(this, options);\r\n  // Handle Mix Content Warning\r\n  // If the current connection is an https connection all other connections must be https either\r\n  var url = options.url || \"\";\r\n  if (window.location.protocol === \"https:\") {\r\n    var parser = document.createElement('a');\r\n    parser.href = url;\r\n    parser.protocol = window.location.protocol;\r\n    url = parser.href;\r\n  }\r\n  this.set('url', url);\r\n  this._ajax = new ol.ext.Ajax({ dataType:'JSON', auth: options.authentication });\r\n  this._ajax.on('success', function (resp) {\r\n    if (resp.status >= 200 && resp.status < 400) {\r\n      if (typeof(this._callback) === 'function') this._callback(resp.response);\r\n    } else {\r\n      if (typeof(this._callback) === 'function') this._callback(false, 'error');\r\n      console.log('AJAX ERROR', arguments);\r\n    }\r\n  }.bind(this));\r\n  this._ajax.on('error', function() {\r\n    if (typeof(this._callback) === 'function') this._callback(false, 'error');\r\n    console.log('AJAX ERROR', arguments);\r\n  }.bind(this));\r\n  // Handle searchin\r\n  this._ajax.on('loadstart', function() {\r\n    this.element.classList.add('searching');\r\n  }.bind(this));\r\n  this._ajax.on('loadend', function() {\r\n    this.element.classList.remove('searching');\r\n  }.bind(this));\r\n  // Overwrite handleResponse\r\n  if (typeof(options.handleResponse)==='function') this.handleResponse = options.handleResponse;\r\n};\r\nol.ext.inherits(ol.control.SearchJSON, ol.control.Search);\r\n/** Send ajax request\r\n * @param {string} url\r\n * @param {*} data\r\n * @param {function} cback a callback function that takes an array of {name, feature} to display in the autocomplete field\r\n */\r\nol.control.SearchJSON.prototype.ajax = function (url, data, cback, options) {\r\n  options = options || {};\r\n  this._callback = cback;\r\n  this._ajax.set('dataType', options.dataType || 'JSON');\r\n  this._ajax.send(url, data, options);\r\n};\r\n/** Autocomplete function (ajax request to the server)\r\n * @param {string} s search string\r\n * @param {function} cback a callback function that takes an array of {name, feature} to display in the autocomplete field\r\n */\r\nol.control.SearchJSON.prototype.autocomplete = function (s, cback) {\r\n  var data = this.requestData(s);\r\n  var url = encodeURI(this.get('url'));\r\n  this.ajax(url, data, function(resp) {\r\n    if (typeof(cback) === 'function') cback(this.handleResponse(resp));\r\n  });\r\n};\r\n/**\r\n * @param {string} s the search string\r\n * @return {Object} request data (as key:value)\r\n * @api\r\n */\r\nol.control.SearchJSON.prototype.requestData = function (s){\r\n  return { q: s };\r\n};\r\n/**\r\n * Handle server response to pass the features array to the display list\r\n * @param {any} response server response\r\n * @return {Array<any>} an array of feature\r\n * @api\r\n */\r\nol.control.SearchJSON.prototype.handleResponse = function (response) {\r\n  return response;\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Search places using the photon API.\r\n *\r\n * @constructor\r\n * @extends {ol.control.SearchJSON}\r\n * @fires select\r\n * @param {Object=} Control options.\r\n *  @param {string} options.className control class name\r\n *  @param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {string | undefined} options.title Title to use for the search button tooltip, default \"Search\"\r\n *  @param {string | undefined} options.reverseTitle Title to use for the reverse geocoding button tooltip, default \"Click on the map...\"\r\n *  @param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *  @param {number | undefined} options.typing a delay on each typing to start searching (ms), default 1000.\r\n *  @param {integer | undefined} options.minLength minimum length to start searching, default 3\r\n *  @param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *  @param {function | undefined} options.handleResponse Handle server response to pass the features array to the list\r\n * \r\n *  @param {string|undefined} options.url Url to photon api, default \"http://photon.komoot.de/api/\"\r\n *  @param {string|undefined} options.lang Force preferred language, default none\r\n *  @param {boolean} options.position Search, with priority to geo position, default false\r\n *  @param {function} options.getTitle a function that takes a feature and return the name to display in the index, default return street + name + contry\r\n */\r\nol.control.SearchPhoton = function(options) {\r\n  options = options || {};\r\n  options.className = options.className || 'photon';\r\n  options.url = options.url || 'https://photon.komoot.io/api/';\r\n  options.copy = options.copy || '<a href=\"http://www.openstreetmap.org/copyright\" target=\"new\">&copy; OpenStreetMap contributors</a>';\r\n  ol.control.SearchJSON.call(this, options);\r\n  this.set('lang', options.lang);\r\n  this.set('position', options.position);\r\n};\r\nol.ext.inherits(ol.control.SearchPhoton, ol.control.SearchJSON);\r\n/** Returns the text to be displayed in the menu\r\n*\t@param {ol.Feature} f the feature\r\n*\t@return {string} the text to be displayed in the index\r\n*\t@api\r\n*/\r\nol.control.SearchPhoton.prototype.getTitle = function (f) {\r\n  var p = f.properties;\r\n  return (p.housenumber||\"\")\r\n    + \" \"+(p.street || p.name || \"\")\r\n    + \"<i>\"\r\n    + \" \"+(p.postcode||\"\")\r\n    + \" \"+(p.city||\"\")\r\n    + \" (\"+p.country\r\n    + \")</i>\";\r\n};\r\n/** \r\n * @param {string} s the search string\r\n * @return {Object} request data (as key:value)\r\n * @api\r\n */\r\nol.control.SearchPhoton.prototype.requestData = function (s) {\r\n  var data = {\r\n    q: s,\r\n    lang: this.get('lang'),\r\n    limit: this.get('maxItems')\r\n  }\r\n  // Handle position proirity\r\n  if (this.get('position')) {\r\n    var view = this.getMap().getView();\r\n    var pt = new ol.geom.Point(view.getCenter());\r\n    pt = (pt.transform (view.getProjection(), \"EPSG:4326\")).getCoordinates();\r\n    data.lon = pt[0];\r\n    data.lat = pt[1];\r\n  }\r\n  return data;\r\n};\r\n/**\r\n * Handle server response to pass the features array to the list\r\n * @param {any} response server response\r\n * @return {Array<any>} an array of feature\r\n */\r\nol.control.SearchPhoton.prototype.handleResponse = function (response) {\r\n  return response.features;\r\n};\r\n/** Prevent same feature to be drawn twice: test equality\r\n * @param {} f1 First feature to compare\r\n * @param {} f2 Second feature to compare\r\n * @return {boolean}\r\n * @api\r\n */\r\nol.control.SearchPhoton.prototype.equalFeatures = function (f1, f2) {\r\n  return (this.getTitle(f1) === this.getTitle(f2)\r\n    && f1.geometry.coordinates[0] === f2.geometry.coordinates[0]\r\n    && f1.geometry.coordinates[1] === f2.geometry.coordinates[1]);\r\n};\r\n/** A ligne has been clicked in the menu > dispatch event\r\n*\t@param {any} f the feature, as passed in the autocomplete\r\n*\t@api\r\n*/\r\nol.control.SearchPhoton.prototype.select = function (f) {\r\n  var c = f.geometry.coordinates;\r\n  // Add coordinate to the event\r\n  try {\r\n    c = ol.proj.transform (f.geometry.coordinates, 'EPSG:4326', this.getMap().getView().getProjection());\r\n  } catch(e) { /* ok */ }\r\n  this.dispatchEvent({ type:\"select\", search:f, coordinate: c });\r\n};\r\n/** Get data for reverse geocode \r\n * @param {ol.coordinate} coord\r\n */\r\nol.control.SearchPhoton.prototype.reverseData = function (coord) {\r\n  var lonlat = ol.proj.transform (coord, this.getMap().getView().getProjection(), 'EPSG:4326');\r\n  return { lon: lonlat[0], lat: lonlat[1] };\r\n};\r\n/** Reverse geocode\r\n * @param {ol.coordinate} coord\r\n * @api\r\n */\r\nol.control.SearchPhoton.prototype.reverseGeocode = function (coord, cback) {\r\n  this.ajax(\r\n    this.get('url').replace('/api/', '/reverse/').replace('/search/', '/reverse/'),\r\n    this.reverseData(coord),\r\n    function(resp) {\r\n      if (resp.features) resp = resp.features;\r\n      if (!(resp instanceof Array)) resp = [resp];\r\n      if (cback) {\r\n        cback.call(this, resp);\r\n      } else {\r\n        this._handleSelect(resp[0], true);\r\n        // this.setInput('', true);\r\n      }\r\n    }.bind(this)\r\n  );\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Search places using the French National Base Address (BAN) API.\r\n *\r\n * @constructor\r\n * @extends {ol.control.SearchJSON}\r\n * @fires select\r\n * @param {any} options extend ol.control.SearchJSON options\r\n *\t@param {string} options.className control class name\r\n *\t@param {string | undefined} [options.apiKey] the service api key.\r\n *\t@param {string | undefined} options.authentication: basic authentication for the service API as btoa(\"login:pwd\")\r\n *\t@param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *\t@param {string | undefined} options.label Text label to use for the search button, default \"search\"\r\n *\t@param {boolean | undefined} options.reverse enable reverse geocoding, default false\r\n *\t@param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *\t@param {number | undefined} options.typing a delay on each typing to start searching (ms), default 500.\r\n *\t@param {integer | undefined} options.minLength minimum length to start searching, default 3\r\n *\t@param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *\r\n *\t@param {StreetAddress|PositionOfInterest|CadastralParcel|Commune} options.type type of search. Using Commune will return the INSEE code, default StreetAddress,PositionOfInterest\r\n * @see {@link https://geoservices.ign.fr/documentation/geoservices/geocodage.html}\r\n */\r\nol.control.SearchGeoportail = function(options) {\r\n  options = options || {};\r\n  options.className = options.className || 'IGNF';\r\n  options.typing = options.typing || 500;\r\n  options.url = 'https://wxs.ign.fr/' + (options.apiKey || 'essentiels') + '/ols/apis/completion';\r\n  options.copy = '<a href=\"https://www.geoportail.gouv.fr/\" target=\"new\">&copy; IGN-Géoportail</a>';\r\n  ol.control.SearchJSON.call(this, options);\r\n  this.set('type', options.type || 'StreetAddress,PositionOfInterest');\r\n  this.set('timeout', options.timeout || 2000);\r\n  // Authentication\r\n  // this._auth = options.authentication;\r\n};\r\nol.ext.inherits(ol.control.SearchGeoportail, ol.control.SearchJSON);\r\n/** Reverse geocode\r\n * @param {ol.coordinate} coord\r\n * @param {function|*} options callback function called when revers located or options passed to the select event\r\n * @api\r\n */\r\nol.control.SearchGeoportail.prototype.reverseGeocode = function (coord, options) {\r\n  var lonlat = ol.proj.transform(coord, this.getMap().getView().getProjection(), 'EPSG:4326');\r\n  this._handleSelect({ \r\n    x: lonlat[0], \r\n    y: lonlat[1], \r\n    fulltext: lonlat[0].toFixed(6) + ',' + lonlat[1].toFixed(6) \r\n  }, true, options);\r\n  // Search type\r\n  var type = this.get('type')==='Commune' ? 'PositionOfInterest' : this.get('type') || 'StreetAddress';\r\n  if (/,/.test(type)) type = 'StreetAddress';\r\n  // request\r\n  var request = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\r\n    +'<XLS xmlns:xls=\"http://www.opengis.net/xls\" xmlns:gml=\"http://www.opengis.net/gml\" xmlns=\"http://www.opengis.net/xls\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.2\" xsi:schemaLocation=\"http://www.opengis.net/xls http://schemas.opengis.net/ols/1.2/olsAll.xsd\">'\r\n    +' <Request requestID=\"1\" version=\"1.2\" methodName=\"ReverseGeocodeRequest\" maximumResponses=\"1\" >'\r\n    +'  <ReverseGeocodeRequest>'\r\n    +'   <ReverseGeocodePreference>'+type+'</ReverseGeocodePreference>'\r\n    +'   <Position>'\r\n    +'    <gml:Point><gml:pos>'+lonlat[1]+' '+lonlat[0]+'</gml:pos></gml:Point>'\r\n    +'   </Position>'\r\n    +'  </ReverseGeocodeRequest>'\r\n    +' </Request>'\r\n    +'</XLS>';\r\n  this.ajax (this.get('url').replace('ols/apis/completion','geoportail/ols'), \r\n    { xls: request },\r\n    function(xml) {\r\n      var f = {};\r\n      if (!xml) {\r\n        f = { x: lonlat[0], y: lonlat[1], fulltext: lonlat[0].toFixed(6) + ',' + lonlat[1].toFixed(6) }\r\n      } else {\r\n        xml = xml.replace(/\\n|\\r/g,'');\r\n        var p = (xml.replace(/.*<gml:pos>(.*)<\\/gml:pos>.*/, \"$1\")).split(' ');\r\n        if (!Number(p[1]) && !Number(p[0])) {\r\n          f = { x: lonlat[0], y: lonlat[1], fulltext: lonlat[0].toFixed(6) + ',' + lonlat[1].toFixed(6) }\r\n        } else {\r\n          f.x = lonlat[0];\r\n          f.y = lonlat[1];\r\n          f.city = (xml.replace(/.*<Place type=\"Municipality\">([^<]*)<\\/Place>.*/, \"$1\"));\r\n          f.insee = (xml.replace(/.*<Place type=\"INSEE\">([^<]*)<\\/Place>.*/, \"$1\"));\r\n          f.zipcode = (xml.replace(/.*<PostalCode>([^<]*)<\\/PostalCode>.*/, \"$1\"));\r\n          if (/<Street>/.test(xml)) {\r\n            f.kind = '';\r\n            f.country = 'StreetAddress';\r\n            f.street = (xml.replace(/.*<Street>([^<]*)<\\/Street>.*/, \"$1\"));\r\n            var number = (xml.replace(/.*<Building number=\"([^\"]*).*/, \"$1\"));\r\n            f.fulltext = number+' '+f.street+', '+f.zipcode+' '+f.city;\r\n          } else {\r\n            f.kind = (xml.replace(/.*<Place type=\"Nature\">([^<]*)<\\/Place>.*/, \"$1\"));\r\n            f.country = 'PositionOfInterest';\r\n            f.street = '';\r\n            f.fulltext = f.zipcode+' '+f.city;\r\n          }\r\n        }\r\n      }\r\n      if (typeof(options)==='function') {\r\n        options.call(this, [f]);\r\n      } else {\r\n        this.getHistory().shift();\r\n        this._handleSelect(f, true, options);\r\n        // this.setInput('', true);\r\n        // this.drawList_();\r\n      }\r\n    }.bind(this), {\r\n      timeout: this.get('timeout'),\r\n      dataType: 'XML'\r\n    }\r\n  );\r\n};\r\n/** Returns the text to be displayed in the menu\r\n *\t@param {ol.Feature} f the feature\r\n *\t@return {string} the text to be displayed in the index\r\n *\t@api\r\n */\r\nol.control.SearchGeoportail.prototype.getTitle = function (f) {\r\n  return (f.fulltext);\r\n};\r\n/** \r\n * @param {string} s the search string\r\n * @return {Object} request data (as key:value)\r\n * @api\r\n */\r\nol.control.SearchGeoportail.prototype.requestData = function (s) {\r\n\treturn { \r\n    text: s, \r\n    type: this.get('type')==='Commune' ? 'PositionOfInterest' : this.get('type') || 'StreetAddress,PositionOfInterest', \r\n    maximumResponses: this.get('maxItems')\r\n  };\r\n};\r\n/**\r\n * Handle server response to pass the features array to the display list\r\n * @param {any} response server response\r\n * @return {Array<any>} an array of feature\r\n * @api\r\n */\r\nol.control.SearchGeoportail.prototype.handleResponse = function (response) {\r\n  var features = response.results;\r\n  if (this.get('type') === 'Commune') {\r\n    for (var i=features.length-1; i>=0; i--) {\r\n      if ( features[i].kind \r\n        && (features[i].classification>5 || features[i].kind==\"Département\") ) {\r\n          features.splice(i,1);\r\n      }\r\n    }\r\n\t}\r\n\treturn features;\r\n};\r\n/** A ligne has been clicked in the menu > dispatch event\r\n * @param {any} f the feature, as passed in the autocomplete\r\n * @param {boolean} reverse true if reverse geocode\r\n * @param {ol.coordinate} coord\r\n * @param {*} options options passed to the event\r\n *\t@api\r\n */\r\nol.control.SearchGeoportail.prototype.select = function (f, reverse, coord, options){\r\n  if (f.x || f.y) {\r\n    var c = [Number(f.x), Number(f.y)];\r\n    // Add coordinate to the event\r\n    try {\r\n        c = ol.proj.transform (c, 'EPSG:4326', this.getMap().getView().getProjection());\r\n    } catch(e) { /* ok */}\r\n    // Get insee commune ?\r\n    if (this.get('type')==='Commune') {\r\n      this.searchCommune(f, function () {\r\n        ol.control.Search.prototype.select.call(this, f, reverse, c, options);\r\n        //this.dispatchEvent({ type:\"select\", search:f, coordinate: c, revers: reverse, options: options });\r\n      });\r\n    } else {\r\n        ol.control.Search.prototype.select.call(this, f, reverse, c, options);\r\n        //this.dispatchEvent({ type:\"select\", search:f, coordinate: c, revers: reverse, options: options });\r\n    }\r\n  } else {\r\n    this.searchCommune(f);\r\n  }\r\n};\r\n/** Search if no position and get the INSEE code\r\n * @param {string} s le nom de la commune\r\n */\r\nol.control.SearchGeoportail.prototype.searchCommune = function (f, cback) {\r\n  var request = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\r\n\t+'<XLS xmlns:xls=\"http://www.opengis.net/xls\" xmlns:gml=\"http://www.opengis.net/gml\" xmlns=\"http://www.opengis.net/xls\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.2\" xsi:schemaLocation=\"http://www.opengis.net/xls http://schemas.opengis.net/ols/1.2/olsAll.xsd\">'\r\n\t\t+'<RequestHeader/>'\r\n\t\t+'<Request requestID=\"1\" version=\"1.2\" methodName=\"LocationUtilityService\">'\r\n\t\t\t+'<GeocodeRequest returnFreeForm=\"false\">'\r\n\t\t\t\t+'<Address countryCode=\"PositionOfInterest\">'\r\n\t\t\t\t+'<freeFormAddress>'+f.zipcode+' '+f.city+'+</freeFormAddress>'\r\n\t\t\t\t+'</Address>'\r\n\t\t\t+'</GeocodeRequest>'\r\n\t\t+'</Request>'\r\n\t+'</XLS>'\r\n  // Search \r\n  this.ajax (this.get('url').replace('ols/apis/completion','geoportail/ols'),\r\n    { 'xls': request }, \r\n    function(xml) {\r\n      if (xml) {\r\n        // XML to JSON\r\n        var parser = new DOMParser();\r\n        var xmlDoc = parser.parseFromString(xml,\"text/xml\");\r\n        var com = xmlDoc.getElementsByTagName('GeocodedAddress')[0];\r\n        var coord = com.getElementsByTagName('gml:Point')[0].textContent.trim().split(' ');\r\n        f.x = Number(coord[1]);\r\n        f.y = Number(coord[0]);\r\n        var place = com.getElementsByTagName('Place');\r\n        for (var i=0; i<place.length; i++) {\r\n          switch (place[i].attributes.type.value) {\r\n            case 'Nature': \r\n              f.kind = place[i].textContent;\r\n              break;\r\n            case 'INSEE': \r\n              f.insee = place[i].textContent;\r\n              break;\r\n          }\r\n        }\r\n        if (f.x || f.y) {\r\n          if (cback) cback.call(this, [f]);\r\n          else this._handleSelect(f);\r\n        }\r\n      }\r\n    }.bind(this),\r\n    { dataType: 'XML' }\r\n  );\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n// ol < 6 compatibility VectorImage is not defined\r\n// \r\n/** Layer Switcher Control.\r\n * @fires select\r\n * @fires drawlist\r\n * @fires toggle\r\n * @fires reorder-start\r\n * @fires reorder-end\r\n * @fires layer:visible\r\n * @fires layer:opacity\r\n * \r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options\r\n *  @param {boolean} options.selection enable layer selection when click on the title\r\n *  @param {function} options.displayInLayerSwitcher function that takes a layer and return a boolean if the layer is displayed in the switcher, default test the displayInLayerSwitcher layer attribute\r\n *  @param {boolean} options.show_progress show a progress bar on tile layers, default false\r\n *  @param {boolean} options.mouseover show the panel on mouseover, default false\r\n *  @param {boolean} options.reordering allow layer reordering, default true\r\n *  @param {boolean} options.trash add a trash button to delete the layer, default false\r\n *  @param {function} options.oninfo callback on click on info button, if none no info button is shown DEPRECATED: use on(info) instead\r\n *  @param {boolean} options.extent add an extent button to zoom to the extent of the layer\r\n *  @param {function} options.onextent callback when click on extent, default fits view to extent\r\n *  @param {number} options.drawDelay delay in ms to redraw the layer (usefull to prevent flickering when manipulating the layers)\r\n *  @param {boolean} options.collapsed collapse the layerswitcher at beginning, default true\r\n *  @param {ol.layer.Group} options.layerGroup a layer group to display in the switcher, default display all layers of the map\r\n *  @param {boolean} options.noScroll prevent handle scrolling, default false\r\n *\r\n * Layers attributes that control the switcher\r\n *\t- allwaysOnTop {boolean} true to force layer stay on top of the others while reordering, default false\r\n *\t- displayInLayerSwitcher {boolean} display the layer in switcher, default true\r\n *\t- noSwitcherDelete {boolean} to prevent layer deletion (w. trash option = true), default false\r\n */\r\nol.control.LayerSwitcher = function(options) {\r\n  options = options || {};\r\n  var self = this;\r\n  this.dcount = 0;\r\n  this.show_progress = options.show_progress;\r\n  this.oninfo = (typeof (options.oninfo) == \"function\" ? options.oninfo: null);\r\n  this.onextent = (typeof (options.onextent) == \"function\" ? options.onextent: null);\r\n  this.hasextent = options.extent || options.onextent;\r\n  this.hastrash = options.trash;\r\n  this.reordering = (options.reordering!==false);\r\n  this._layers = [];\r\n  this._layerGroup = (options.layerGroup && options.layerGroup.getLayers) ? options.layerGroup : null;\r\n  // displayInLayerSwitcher\r\n  if (typeof(options.displayInLayerSwitcher) === 'function') {\r\n    this.displayInLayerSwitcher = options.displayInLayerSwitcher;\r\n  }\r\n  var element;\r\n  if (options.target) {\r\n    element = ol.ext.element.create('DIV', {\r\n      className: options.switcherClass || \"ol-layerswitcher\"\r\n    });\r\n  } else {\r\n    element = ol.ext.element.create('DIV', {\r\n      className: (options.switcherClass || \"ol-layerswitcher\") +' ol-unselectable ol-control'\r\n    });\r\n    if (options.collapsed !== false) element.classList.add('ol-collapsed'); \r\n    else element.classList.add('ol-forceopen'); \r\n    this.button = ol.ext.element.create('BUTTON', {\r\n      type: 'button',\r\n      parent: element\r\n    });\r\n    this.button.addEventListener('touchstart', function(e){\r\n      element.classList.toggle('ol-forceopen');\r\n      element.classList.add('ol-collapsed');\r\n      self.dispatchEvent({ type: 'toggle', collapsed: element.classList.contains('ol-collapsed') });\r\n      e.preventDefault(); \r\n      self.overflow();\r\n    });\r\n    this.button.addEventListener('click', function() {\r\n      element.classList.toggle('ol-forceopen');\r\n      element.classList.add('ol-collapsed'); \r\n      self.dispatchEvent({ type: 'toggle', collapsed: !element.classList.contains('ol-forceopen') });\r\n      self.overflow();\r\n    });\r\n    if (options.mouseover) {\r\n      element.addEventListener ('mouseleave', function(){ \r\n        element.classList.add(\"ol-collapsed\"); \r\n        self.dispatchEvent({ type: 'toggle', collapsed: true });\r\n      });\r\n      element.addEventListener ('mouseover', function(){ \r\n        element.classList.remove(\"ol-collapsed\"); \r\n        self.dispatchEvent({ type: 'toggle', collapsed: false });\r\n      });\r\n    }\r\n    if (options.minibar) options.noScroll = true;\r\n    if (!options.noScroll) {\r\n      this.topv = ol.ext.element.create('DIV', {\r\n        className: 'ol-switchertopdiv',\r\n        parent: element,\r\n        click: function() {\r\n          self.overflow(\"+50%\");\r\n        }\r\n      });\r\n      this.botv = ol.ext.element.create('DIV', {\r\n        className: 'ol-switcherbottomdiv',\r\n        parent: element,\r\n        click: function() {\r\n          self.overflow(\"-50%\");\r\n        }\r\n      });\r\n    }\r\n    this._noScroll = options.noScroll;\r\n  }\r\n  this.panel_ = ol.ext.element.create ('UL', {\r\n    className: 'panel',\r\n  });\r\n  this.panelContainer_ = ol.ext.element.create ('DIV', {\r\n    className: 'panel-container',\r\n    html: this.panel_,\r\n    parent: element\r\n  });\r\n  // Handle mousewheel\r\n  if (!options.target && !options.noScroll) {\r\n    ol.ext.element.addListener (this.panel_, 'mousewheel DOMMouseScroll onmousewheel', function(e) {\r\n      if (self.overflow(Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))))) {\r\n        e.stopPropagation();\r\n        e.preventDefault();\r\n      }\r\n    });\r\n  }\r\n  this.header_ = ol.ext.element.create('LI', {\r\n    className: 'ol-header',\r\n    parent: this.panel_\r\n  });\r\n  ol.control.Control.call (this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.set('drawDelay',options.drawDelay||0);\r\n  this.set('selection', options.selection);\r\n  if (options.minibar) {\r\n    // Wait init complete (for child classes)\r\n    setTimeout(function() {\r\n      var mbar = ol.ext.element.scrollDiv(this.panelContainer_, {\r\n        mousewheel: true, \r\n        vertical: true, \r\n        minibar: true\r\n      });\r\n      this.on(['drawlist', 'toggle'], function() {\r\n        mbar.refresh();\r\n      })\r\n    }.bind(this));\r\n  }\r\n};\r\nol.ext.inherits(ol.control.LayerSwitcher, ol.control.Control);\r\n/** List of tips for internationalization purposes\r\n*/\r\nol.control.LayerSwitcher.prototype.tip = {\r\n  up: \"up/down\",\r\n  down: \"down\",\r\n  info: \"informations...\",\r\n  extent: \"zoom to extent\",\r\n  trash: \"remove layer\",\r\n  plus: \"expand/shrink\"\r\n};\r\n/** Test if a layer should be displayed in the switcher\r\n * @param {ol.layer} layer\r\n * @return {boolean} true if the layer is displayed\r\n */\r\nol.control.LayerSwitcher.prototype.displayInLayerSwitcher = function(layer) {\r\n  return (layer.get('displayInLayerSwitcher')!==false);\r\n};\r\n/**\r\n * Set the map instance the control is associated with.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.control.LayerSwitcher.prototype.setMap = function(map) {\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  this.drawPanel();\r\n  if (this._listener) {\r\n    for (var i in this._listener) ol.Observable.unByKey(this._listener[i]);\r\n  }\r\n  this._listener = null;\r\n  // Get change (new layer added or removed)\r\n  if (map) {\r\n    this._listener = {\r\n      moveend: map.on('moveend', this.viewChange.bind(this)),\r\n      size: map.on('change:size', this.overflow.bind(this))\r\n    }\r\n    // Listen to a layer group\r\n    if (this._layerGroup) {\r\n      this._listener.change = this._layerGroup.getLayers().on('change:length', this.drawPanel.bind(this));\r\n    } else  {\r\n      //Listen to all layers\r\n      this._listener.change = map.getLayerGroup().getLayers().on('change:length', this.drawPanel.bind(this));\r\n    }\r\n  }\r\n};\r\n/** Show control\r\n */\r\nol.control.LayerSwitcher.prototype.show = function() {\r\n  this.element.classList.add('ol-forceopen');\r\n  this.overflow();\r\n  self.dispatchEvent({ type: 'toggle', collapsed: false });\r\n};\r\n/** Hide control\r\n */\r\nol.control.LayerSwitcher.prototype.hide = function() {\r\n  this.element.classList.remove('ol-forceopen');\r\n  this.overflow();\r\n  self.dispatchEvent({ type: 'toggle', collapsed: true });\r\n};\r\n/** Toggle control\r\n */\r\nol.control.LayerSwitcher.prototype.toggle = function() {\r\n  this.element.classList.toggle(\"ol-forceopen\");\r\n  this.overflow();\r\n};\r\n/** Is control open\r\n * @return {boolean}\r\n */\r\nol.control.LayerSwitcher.prototype.isOpen = function() {\r\n  return this.element.classList.contains(\"ol-forceopen\");\r\n};\r\n/** Add a custom header\r\n * @param {Element|string} html content html\r\n */\r\nol.control.LayerSwitcher.prototype.setHeader = function(html) {\r\n  ol.ext.element.setHTML(this.header_, html);\r\n};\r\n/** Calculate overflow and add scrolls\r\n * @param {Number} dir scroll direction -1|0|1|'+50%'|'-50%'\r\n * @private\r\n */\r\nol.control.LayerSwitcher.prototype.overflow = function(dir) {\t\r\n  if (this.button && !this._noScroll) {\r\n    // Nothing to show\r\n    if (ol.ext.element.hidden(this.panel_)) {\r\n      ol.ext.element.setStyle(this.element, { height: 'auto' });\r\n      return;\r\n    }\r\n    // Calculate offset\r\n    var h = ol.ext.element.outerHeight(this.element);\r\n    var hp = ol.ext.element.outerHeight(this.panel_);\r\n    var dh = this.button.offsetTop + ol.ext.element.outerHeight(this.button);\r\n    //var dh = this.button.position().top + this.button.outerHeight(true);\r\n    var top = this.panel_.offsetTop - dh;\r\n    if (hp > h-dh) {\r\n      // Bug IE: need to have an height defined\r\n      ol.ext.element.setStyle(this.element, { height: '100%' });\r\n      var li = this.panel_.querySelectorAll('li.visible .li-content')[0];\r\n      var lh = li ? 2 * ol.ext.element.getStyle(li, 'height') : 0;\r\n      switch (dir) {\r\n        case 1: top += lh; break;\r\n        case -1: top -= lh; break;\r\n        case \"+50%\": top += Math.round(h/2); break;\r\n        case \"-50%\": top -= Math.round(h/2); break;\r\n        default: break;\r\n      }\r\n      // Scroll div\r\n      if (top+hp <= h-3*dh/2) {\r\n        top = h-3*dh/2-hp;\r\n        ol.ext.element.hide(this.botv);\r\n      } else {\r\n        ol.ext.element.show(this.botv);\r\n      }\r\n      if (top >= 0) {\r\n        top = 0;\r\n        ol.ext.element.hide(this.topv);\r\n      } else {\r\n        ol.ext.element.show(this.topv);\r\n      }\r\n      // Scroll ?\r\n      ol.ext.element.setStyle(this.panel_, { top: top+\"px\" });\r\n      return true;\r\n    } else {\r\n      ol.ext.element.setStyle(this.element, { height: \"auto\" });\r\n      ol.ext.element.setStyle(this.panel_, { top: 0 });\r\n      ol.ext.element.hide(this.botv);\r\n      ol.ext.element.hide(this.topv);\r\n      return false;\r\n    }\r\n  }\r\n  else return false;\r\n};\r\n/** Set the layer associated with a li\r\n * @param {Element} li\r\n * @param {ol.layer} layer\r\n * @private\r\n */\r\nol.control.LayerSwitcher.prototype._setLayerForLI = function(li, layer) {\r\n  var listeners = [];\r\n  if (layer.getLayers) {\r\n    listeners.push(layer.getLayers().on('change:length', this.drawPanel.bind(this)));\r\n  }\r\n  if (li) {\r\n    // Handle opacity change\r\n    listeners.push(layer.on('change:opacity', (function() {\r\n      this.setLayerOpacity(layer, li);\r\n    }).bind(this)));\r\n    // Handle visibility chage\r\n    listeners.push(layer.on('change:visible', (function() {\r\n      this.setLayerVisibility(layer, li);\r\n    }).bind(this)));\r\n  }\r\n  // Other properties\r\n  listeners.push(layer.on('propertychange', (function(e) {\r\n    if (e.key === 'displayInLayerSwitcher'\r\n      || e.key === 'openInLayerSwitcher') {\r\n      this.drawPanel(e);\r\n    }\r\n  }).bind(this)));\r\n  this._layers.push({ li:li, layer:layer, listeners: listeners });\r\n};\r\n/** Set opacity for a layer\r\n * @param {ol.layer.Layer} layer\r\n * @param {Element} li the list element\r\n * @private\r\n */\r\nol.control.LayerSwitcher.prototype.setLayerOpacity = function(layer, li) {\r\n  var i = li.querySelector('.layerswitcher-opacity-cursor')\r\n  if (i) i.style.left = (layer.getOpacity()*100)+\"%\"\r\n  this.dispatchEvent({ type: 'layer:opacity', layer: layer });\r\n};\r\n/** Set visibility for a layer\r\n * @param {ol.layer.Layer} layer\r\n * @param {Element} li the list element\r\n * @api\r\n */\r\nol.control.LayerSwitcher.prototype.setLayerVisibility = function(layer, li) {\r\n  var i = li.querySelector('.ol-visibility');\r\n  if (i) i.checked = layer.getVisible();\r\n  if (layer.getVisible()) li.classList.add('ol-visible');\r\n  else li.classList.remove('ol-visible');\r\n  this.dispatchEvent({ type: 'layer:visible', layer: layer });\r\n};\r\n/** Clear layers associated with li\r\n * @private\r\n */\r\nol.control.LayerSwitcher.prototype._clearLayerForLI = function() {\r\n  this._layers.forEach(function (li) {\r\n    li.listeners.forEach(function(l) {\r\n      ol.Observable.unByKey(l);\r\n    });\r\n  })\r\n  this._layers = [];\r\n};\r\n/** Get the layer associated with a li\r\n * @param {Element} li\r\n * @return {ol.layer}\r\n * @private\r\n */\r\nol.control.LayerSwitcher.prototype._getLayerForLI = function(li) {\r\n  for (var i=0, l; l=this._layers[i]; i++) {\r\n    if (l.li===li) return l.layer;\r\n  }\r\n  return null;\r\n};\r\n/**\r\n * On view change hide layer depending on resolution / extent\r\n * @private\r\n */\r\nol.control.LayerSwitcher.prototype.viewChange = function() {\r\n  this.panel_.querySelectorAll('li').forEach( function(li) {\r\n    var l = this._getLayerForLI(li);\r\n    if (l) {\r\n      if (this.testLayerVisibility(l)) li.classList.remove('ol-layer-hidden');\r\n      else li.classList.add('ol-layer-hidden');\r\n    }\r\n  }.bind(this));\r\n};\r\n/** Get control panel\r\n * @api\r\n */\r\nol.control.LayerSwitcher.prototype.getPanel = function() {\r\n  return this.panelContainer_;\r\n};\r\n/** Draw the panel control (prevent multiple draw due to layers manipulation on the map with a delay function)\r\n * @api\r\n */\r\nol.control.LayerSwitcher.prototype.drawPanel = function() {\r\n  if (!this.getMap()) return;\r\n  var self = this;\r\n  // Multiple event simultaneously / draw once => put drawing in the event queue\r\n  this.dcount++;\r\n  setTimeout (function(){ self.drawPanel_(); }, this.get('drawDelay') || 0);\r\n};\r\n/** Delayed draw panel control \r\n * @private\r\n */\r\nol.control.LayerSwitcher.prototype.drawPanel_ = function() {\r\n  if (--this.dcount || this.dragging_) return;\r\n  var scrollTop = this.panelContainer_.scrollTop;\r\n  // Remove existing layers\r\n  this._clearLayerForLI();\r\n  this.panel_.querySelectorAll('li').forEach (function(li) {\r\n    if (!li.classList.contains('ol-header')) li.remove();\r\n  }.bind(this));\r\n  // Draw list\r\n  if (this._layerGroup) this.drawList (this.panel_, this._layerGroup.getLayers());\r\n  else if (this.getMap()) this.drawList (this.panel_, this.getMap().getLayers());\r\n  // Reset scrolltop\r\n  this.panelContainer_.scrollTop = scrollTop;\r\n};\r\n/** Change layer visibility according to the baselayer option\r\n * @param {ol.layer}\r\n * @param {Array<ol.layer>} related layers\r\n * @private\r\n */\r\nol.control.LayerSwitcher.prototype.switchLayerVisibility = function(l, layers) {\r\n  if (!l.get('baseLayer')) {\r\n    l.setVisible(!l.getVisible());\r\n  } else {\r\n    if (!l.getVisible()) l.setVisible(true);\r\n    layers.forEach(function(li) {\r\n      if (l!==li && li.get('baseLayer') && li.getVisible()) li.setVisible(false);\r\n    });\r\n  }\r\n};\r\n/** Check if layer is on the map (depending on resolution / zoom and extent)\r\n * @param {ol.layer}\r\n * @return {boolean}\r\n * @private\r\n */\r\nol.control.LayerSwitcher.prototype.testLayerVisibility = function(layer) {\r\n  if (!this.getMap()) return true;\r\n  var res = this.getMap().getView().getResolution();\r\n  var zoom = this.getMap().getView().getZoom();\r\n  // Calculate visibility on resolution or zoom\r\n  if (layer.getMaxResolution()<=res || layer.getMinResolution()>=res) {\r\n    return false;\r\n  } else if (layer.getMinZoom && (layer.getMinZoom()>=zoom || layer.getMaxZoom()<zoom)) {\r\n    return false;\r\n  } else {\r\n    // Check extent\r\n    var ex0 = layer.getExtent();\r\n    if (ex0) {\r\n      var ex = this.getMap().getView().calculateExtent(this.getMap().getSize());\r\n      return ol.extent.intersects(ex, ex0);\r\n    }\r\n    return true;\r\n  }\r\n};\r\n/** Start ordering the list\r\n*\t@param {event} e drag event\r\n*\t@private\r\n*/\r\nol.control.LayerSwitcher.prototype.dragOrdering_ = function(e) {\r\n  e.stopPropagation();\r\n  e.preventDefault();\r\n  // Get params\r\n  var self = this;\r\n  var elt = e.currentTarget.parentNode.parentNode;\r\n  var start = true;\r\n  var panel = this.panel_; \r\n  var pageY;\r\n  var pageY0 = e.pageY \r\n    || (e.touches && e.touches.length && e.touches[0].pageY) \r\n    || (e.changedTouches && e.changedTouches.length && e.changedTouches[0].pageY);\r\n  var target, dragElt;\r\n  var layer, group;\r\n  elt.parentNode.classList.add('drag');\r\n  // Stop ordering\r\n  function stop() {\r\n    if (target) {\r\n      // Get drag on parent\r\n      var drop = layer;\r\n      var isSelected = self.getSelection() === drop;\r\n      if (drop && target) {\r\n        var collection ;\r\n        if (group) collection = group.getLayers();\r\n        else collection = self._layerGroup ?  self._layerGroup.getLayers() : self.getMap().getLayers();\r\n        var layers = collection.getArray();\r\n        // Switch layers\r\n        for (var i=0; i<layers.length; i++) {\r\n          if (layers[i]==drop) {\r\n            collection.removeAt (i);\r\n            break;\r\n          }\r\n        }\r\n        for (var j=0; j<layers.length; j++) {\r\n          if (layers[j] === target) {\r\n            if (i>j) collection.insertAt (j,drop);\r\n            else collection.insertAt (j+1,drop);\r\n            break;\r\n          }\r\n        }\r\n      }\r\n      if (isSelected) self.selectLayer(drop);\r\n      self.dispatchEvent({ type: \"reorder-end\", layer: drop, group: group });\r\n    }\r\n    elt.parentNode.querySelectorAll('li').forEach(function(li){\r\n      li.classList.remove('dropover');\r\n      li.classList.remove('dropover-after');\r\n      li.classList.remove('dropover-before');\r\n    });\r\n    elt.classList.remove(\"drag\");\r\n    elt.parentNode.classList.remove(\"drag\");\r\n    self.element.classList.remove('drag');\r\n    if (dragElt) dragElt.remove();\r\n    ol.ext.element.removeListener(document, 'mousemove touchmove', move);\r\n    ol.ext.element.removeListener(document, 'mouseup touchend touchcancel', stop);\r\n  }\r\n  // Ordering\r\n  function move(e) {\r\n    // First drag (more than 2 px) => show drag element (ghost)\r\n    pageY = e.pageY \r\n        || (e.touches && e.touches.length && e.touches[0].pageY) \r\n        || (e.changedTouches && e.changedTouches.length && e.changedTouches[0].pageY);\r\n    if (start && Math.abs(pageY0 - pageY) > 2) {\r\n      start = false;\r\n      elt.classList.add(\"drag\");\r\n      layer = self._getLayerForLI(elt);\r\n      target = false;\r\n      group = self._getLayerForLI(elt.parentNode.parentNode);\r\n      // Ghost div\r\n      dragElt = ol.ext.element.create('LI', { \r\n        className: 'ol-dragover',\r\n        html: elt.innerHTML,\r\n        style: { \r\n          position: \"absolute\", \r\n          \"z-index\": 10000, \r\n          left: elt.offsetLeft, \r\n          opacity: 0.5,\r\n          width: ol.ext.element.outerWidth(elt),\r\n          height: ol.ext.element.getStyle(elt,'height'),\r\n        },\r\n        parent: panel \r\n      });\r\n      self.element.classList.add('drag');\r\n      self.dispatchEvent({ type: \"reorder-start\", layer: layer, group: group });\r\n    }\r\n    // Start a new drag sequence\r\n    if (!start) {\r\n      e.preventDefault();\r\n      e.stopPropagation();\r\n      // Ghost div\r\n      ol.ext.element.setStyle(dragElt, { top: pageY - ol.ext.element.offsetRect(panel).top + panel.scrollTop +5 });\r\n      var li;\r\n      if (!e.touches) {\r\n        li = e.target;\r\n      } else {\r\n        li = document.elementFromPoint(e.touches[0].clientX, e.touches[0].clientY);\r\n      }\r\n      if (li.classList.contains(\"ol-switcherbottomdiv\")) {\r\n        self.overflow(-1);\r\n      } else if (li.classList.contains(\"ol-switchertopdiv\")) {\r\n        self.overflow(1);\r\n      }\r\n      // Get associated li\r\n      while (li && li.tagName!=='LI') {\r\n        li = li.parentNode;\r\n      }\r\n      if (!li || !li.classList.contains('dropover')) {\r\n        elt.parentNode.querySelectorAll('li').forEach(function(li) {\r\n          li.classList.remove('dropover');\r\n          li.classList.remove('dropover-after');\r\n          li.classList.remove('dropover-before');\r\n        });\r\n      }\r\n      if (li && li.parentNode.classList.contains('drag') && li !== elt) {\r\n        target = self._getLayerForLI(li);\r\n        // Don't mix layer level\r\n        if (target && !target.get('allwaysOnTop') == !layer.get('allwaysOnTop')) {\r\n          li.classList.add(\"dropover\");\r\n          li.classList.add((elt.offsetTop < li.offsetTop) ? 'dropover-after' : 'dropover-before');\r\n        } else {\r\n          target = false;\r\n        }\r\n        ol.ext.element.show(dragElt);\r\n      } else {\r\n        target = false;\r\n        if (li===elt) ol.ext.element.hide(dragElt);\r\n        else ol.ext.element.show(dragElt);\r\n      }\r\n      if (!target) dragElt.classList.add(\"forbidden\");\r\n      else dragElt.classList.remove(\"forbidden\");\r\n    }\r\n  }\r\n  // Start ordering\r\n  ol.ext.element.addListener(document, 'mousemove touchmove', move);\r\n  ol.ext.element.addListener(document, 'mouseup touchend touchcancel', stop);\r\n};\r\n/** Change opacity on drag \r\n*\t@param {event} e drag event\r\n*\t@private\r\n*/\r\nol.control.LayerSwitcher.prototype.dragOpacity_ = function(e) {\r\n  e.stopPropagation();\r\n  e.preventDefault();\r\n  var self = this\r\n  // Register start params\r\n  var elt = e.target;\r\n  var layer = this._getLayerForLI(elt.parentNode.parentNode.parentNode);\r\n  if (!layer) return;\r\n  var x = e.pageX \r\n    || (e.touches && e.touches.length && e.touches[0].pageX) \r\n    || (e.changedTouches && e.changedTouches.length && e.changedTouches[0].pageX);\r\n  var start = ol.ext.element.getStyle (elt, 'left') - x;\r\n  self.dragging_ = true;\r\n  // stop dragging\r\n  function stop() {\r\n    ol.ext.element.removeListener(document, \"mouseup touchend touchcancel\", stop);\r\n    ol.ext.element.removeListener(document, \"mousemove touchmove\", move);\r\n    self.dragging_ = false;\r\n  }\r\n  // On draggin\r\n  function move(e) {\r\n    var x = e.pageX \r\n      || (e.touches && e.touches.length && e.touches[0].pageX) \r\n      || (e.changedTouches && e.changedTouches.length && e.changedTouches[0].pageX);\r\n    var delta = (start + x) / ol.ext.element.getStyle(elt.parentNode, 'width');\r\n    var opacity = Math.max (0, Math.min(1, delta));\r\n    ol.ext.element.setStyle (elt, { left: (opacity*100) + \"%\" });\r\n    elt.parentNode.nextElementSibling.innerHTML = Math.round(opacity*100);\r\n    layer.setOpacity(opacity);\r\n  }\r\n  // Register move\r\n  ol.ext.element.addListener(document, \"mouseup touchend touchcancel\", stop);\r\n  ol.ext.element.addListener(document, \"mousemove touchmove\", move);\r\n};\r\n/** Render a list of layer\r\n * @param {Elemen} element to render\r\n * @layers {Array{ol.layer}} list of layer to show\r\n * @api stable\r\n * @private\r\n */\r\nol.control.LayerSwitcher.prototype.drawList = function(ul, collection) {\r\n  var self = this;\r\n  var layers = collection.getArray();\r\n  // Change layer visibility\r\n  var setVisibility = function(e) {\r\n    e.stopPropagation();\r\n    e.preventDefault();\r\n    var l = self._getLayerForLI(this.parentNode.parentNode);\r\n    self.switchLayerVisibility(l, collection);\r\n    if (self.get('selection') && l.getVisible()) {\r\n      self.selectLayer(l);\r\n    }\r\n  };\r\n  // Info button click\r\n  function onInfo(e) {\r\n    e.stopPropagation();\r\n    e.preventDefault(); \r\n    var l = self._getLayerForLI(this.parentNode.parentNode);\r\n    self.oninfo(l); \r\n    self.dispatchEvent({ type: \"info\", layer: l });\r\n  }\r\n  // Zoom to extent button\r\n  function zoomExtent(e) {\r\n    e.stopPropagation();\r\n    e.preventDefault(); \r\n    var l = self._getLayerForLI(this.parentNode.parentNode);\r\n    if (self.onextent) self.onextent(l); \r\n    else self.getMap().getView().fit (l.getExtent(), self.getMap().getSize()); \r\n    self.dispatchEvent({ type: \"extent\", layer: l });\r\n  }\r\n  // Remove a layer on trash click\r\n  function removeLayer(e) {\r\n    e.stopPropagation();\r\n    e.preventDefault();\r\n    var li = this.parentNode.parentNode.parentNode.parentNode;\r\n    var layer, group = self._getLayerForLI(li);\r\n    // Remove the layer from a group or from a map\r\n    if (group) {\r\n      layer = self._getLayerForLI(this.parentNode.parentNode);\r\n      group.getLayers().remove(layer);\r\n      if (group.getLayers().getLength()==0 && !group.get('noSwitcherDelete')) {\r\n        removeLayer.call(li.querySelectorAll('.layerTrash')[0], e);\r\n      }\r\n    } else {\r\n      li = this.parentNode.parentNode;\r\n      self.getMap().removeLayer(self._getLayerForLI(li));\r\n    }\r\n  }\r\n  // Create a list for a layer\r\n  function createLi(layer) {\r\n    if (!this.displayInLayerSwitcher(layer)) {\r\n      this._setLayerForLI(null, layer);\r\n      return;\r\n    } \r\n    var li = ol.ext.element.create('LI', {\r\n      className: (layer.getVisible()?\"visible \":\" \")+(layer.get('baseLayer')?\"baselayer\":\"\"),\r\n      parent: ul\r\n    });\r\n    this._setLayerForLI(li, layer);\r\n    if (this._selectedLayer === layer) {\r\n      li.classList.add('ol-layer-select');\r\n    }\r\n    var layer_buttons = ol.ext.element.create('DIV', {\r\n      className: 'ol-layerswitcher-buttons',\r\n      parent: li\r\n    });\r\n    // Content div\r\n    var d = ol.ext.element.create('DIV', {\r\n      className: 'li-content',// + (this.testLayerVisibility(layer) ? '' : ' ol-layer-hidden'),\r\n      parent: li\r\n    });\r\n    // Visibility\r\n    ol.ext.element.create('INPUT', {\r\n      type: layer.get('baseLayer') ? 'radio' : 'checkbox',\r\n      className: 'ol-visibility',\r\n      checked: layer.getVisible(),\r\n      click: setVisibility,\r\n      parent: d\r\n    });\r\n    // Label\r\n    var label = ol.ext.element.create('LABEL', {\r\n      title: layer.get('title') || layer.get('name'),\r\n      click: setVisibility,\r\n      unselectable: 'on',\r\n      style: {\r\n        userSelect: 'none'\r\n      },\r\n      parent: d\r\n    });\r\n    label.addEventListener('selectstart', function(){ return false; });\r\n    ol.ext.element.create('SPAN', {\r\n      html: layer.get('title') || layer.get('name'),\r\n      click: function(e) {\r\n        if (this.get('selection')) {\r\n          e.stopPropagation();\r\n          this.selectLayer(layer);\r\n        }\r\n      }.bind(this),\r\n      parent: label\r\n    });\r\n    //  up/down\r\n    if (this.reordering) {\r\n      if ( (i<layers.length-1 && (layer.get(\"allwaysOnTop\") || !layers[i+1].get(\"allwaysOnTop\")) )\r\n      || (i>0 && (!layer.get(\"allwaysOnTop\") || layers[i-1].get(\"allwaysOnTop\")) ) ) {\r\n        ol.ext.element.create('DIV', {\r\n          className: 'layerup ol-noscroll',\r\n          title: this.tip.up,\r\n          on: { 'mousedown touchstart': function(e) { self.dragOrdering_(e) } },\r\n          parent: layer_buttons\r\n        });\r\n      }\r\n    }\r\n    // Show/hide sub layers\r\n    if (layer.getLayers) {\r\n      var nb = 0;\r\n      layer.getLayers().forEach(function(l) {\r\n        if (self.displayInLayerSwitcher(l)) nb++;\r\n      });\r\n      if (nb) {\r\n        ol.ext.element.create('DIV', {\r\n          className: layer.get(\"openInLayerSwitcher\") ? \"collapse-layers\" : \"expend-layers\",\r\n          title: this.tip.plus,\r\n          click: function() {\r\n            var l = self._getLayerForLI(this.parentNode.parentNode);\r\n            l.set(\"openInLayerSwitcher\", !l.get(\"openInLayerSwitcher\") )\r\n          },\r\n          parent: layer_buttons\r\n        });\r\n      }\r\n    }\r\n    // Info button\r\n    if (this.oninfo) {\r\n      ol.ext.element.create('DIV', {\r\n        className: 'layerInfo',\r\n        title: this.tip.info,\r\n        click: onInfo,\r\n        parent: layer_buttons\r\n      });\r\n    }\r\n    // Layer remove\r\n    if (this.hastrash && !layer.get(\"noSwitcherDelete\")) {\r\n      ol.ext.element.create('DIV', {\r\n        className: 'layerTrash',\r\n        title: this.tip.trash,\r\n        click: removeLayer,\r\n        parent: layer_buttons\r\n      });\r\n    }\r\n    // Layer extent\r\n    if (this.hasextent && layers[i].getExtent()) {\r\n      var ex = layers[i].getExtent();\r\n      if (ex.length==4 && ex[0]<ex[2] && ex[1]<ex[3]) {\r\n        ol.ext.element.create('DIV', {\r\n          className: 'layerExtent',\r\n          title: this.tip.extent,\r\n          click: zoomExtent,\r\n          parent: layer_buttons  \r\n        });\r\n      }\r\n    }\r\n    // Progress\r\n    if (this.show_progress && layer instanceof ol.layer.Tile) {\r\n      var p = ol.ext.element.create('DIV', {\r\n        className: 'layerswitcher-progress',\r\n        parent: d\r\n      });\r\n      this.setprogress_(layer);\r\n      layer.layerswitcher_progress = ol.ext.element.create('DIV', { parent: p });\r\n    }\r\n    // Opacity\r\n    var opacity = ol.ext.element.create('DIV', {\r\n      className: 'layerswitcher-opacity',\r\n      // Click on the opacity line\r\n      click: function(e){\r\n        if (e.target !== this) return;\r\n        e.stopPropagation();\r\n        e.preventDefault();\r\n        var op = Math.max ( 0, Math.min( 1, e.offsetX / ol.ext.element.getStyle(this, 'width')));\r\n        self._getLayerForLI(this.parentNode.parentNode).setOpacity(op);\r\n      },\r\n      parent: d\r\n    });\r\n    // Start dragging\r\n    ol.ext.element.create('DIV', {\r\n      className: 'layerswitcher-opacity-cursor ol-noscroll',\r\n      style: { left: (layer.getOpacity()*100)+\"%\" },\r\n      on: {\r\n        'mousedown touchstart': function(e) { self.dragOpacity_ (e); }\r\n      },\r\n      parent: opacity\r\n    });\r\n    // Percent\r\n    ol.ext.element.create('DIV', {\r\n      className: 'layerswitcher-opacity-label',\r\n      html: Math.round(layer.getOpacity()*100),\r\n      parent: d\r\n    });\r\n    // Layer group\r\n    if (layer.getLayers) {\r\n      li.classList.add('ol-layer-group');\r\n      if (layer.get(\"openInLayerSwitcher\") === true) {\r\n        var ul2 = ol.ext.element.create('UL', {\r\n          parent: li\r\n        });\r\n        this.drawList (ul2, layer.getLayers());\r\n      }\r\n    }\r\n    li.classList.add(this.getLayerClass(layer));\r\n    // Dispatch a dralist event to allow customisation\r\n    this.dispatchEvent({ type:'drawlist', layer:layer, li:li });\r\n  }\r\n  // Add the layer list\r\n  for (var i=layers.length-1; i>=0; i--) { \r\n    createLi.call(this, layers[i]); \r\n  }\r\n  this.viewChange();\r\n  if (ul === this.panel_) this.overflow();\r\n};\r\n/** Select a layer\r\n * @param {ol.layer.Layer} layer\r\n * @returns {string} the layer classname\r\n * @api\r\n */\r\nol.control.LayerSwitcher.prototype.getLayerClass = function(layer) {\r\n  if (!layer) return 'none';\r\n  if (layer.getLayers) return 'ol-layer-group';\r\n  if (layer instanceof ol.layer.Vector) return 'ol-layer-vector';\r\n  if (layer instanceof ol.layer.VectorTile) return 'ol-layer-vectortile';\r\n  if (layer instanceof ol.layer.Tile) return 'ol-layer-tile';\r\n  if (layer instanceof ol.layer.Image) return 'ol-layer-image';\r\n  if (layer instanceof ol.layer.Heatmap) return 'ol-layer-heatmap';\r\n  /* ol < 6 compatibility VectorImage is not defined */\r\n  // if (layer instanceof ol.layer.VectorImage) return 'ol-layer-vectorimage';\r\n  if (layer.getFeatures) return 'ol-layer-vectorimage';\r\n  /* */\r\n  return 'unknown';\r\n};\r\n/** Select a layer\r\n * @param {ol.layer.Layer} layer\r\n * @api\r\n */\r\nol.control.LayerSwitcher.prototype.selectLayer = function(layer, silent) {\r\n  if (!layer) {\r\n    if (!this.getMap()) return;\r\n    layer = this.getMap().getLayers().item(this.getMap().getLayers().getLength()-1)\r\n  }\r\n  this._selectedLayer = layer;\r\n  this.drawPanel();\r\n  if (!silent) this.dispatchEvent({ type: 'select', layer: layer });\r\n};\r\n/** Get selected layer\r\n * @returns {ol.layer.Layer}\r\n */\r\nol.control.LayerSwitcher.prototype.getSelection = function() {\r\n  return this._selectedLayer;\r\n};\r\n/** Handle progress bar for a layer\r\n*\t@private\r\n*/\r\nol.control.LayerSwitcher.prototype.setprogress_ = function(layer) {\r\n  if (!layer.layerswitcher_progress) {\r\n    var loaded = 0;\r\n    var loading = 0;\r\n    var draw = function() {\r\n      if (loading === loaded) {\r\n        loading = loaded = 0;\r\n        ol.ext.element.setStyle(layer.layerswitcher_progress, { width: 0 });// layer.layerswitcher_progress.width(0);\r\n      } else {\r\n        ol.ext.element.setStyle(layer.layerswitcher_progress, { width: (loaded / loading * 100).toFixed(1) + '%' });// layer.layerswitcher_progress.css('width', (loaded / loading * 100).toFixed(1) + '%');\r\n      }\r\n    }\r\n    layer.getSource().on('tileloadstart', function() {\r\n      loading++;\r\n      draw();\r\n    });\r\n    layer.getSource().on('tileloadend', function() {\r\n      loaded++;\r\n      draw();\r\n    });\r\n    layer.getSource().on('tileloaderror', function() {\r\n      loaded++;\r\n      draw();\r\n    });\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Control bar for OL3\r\n * The control bar is a container for other controls. It can be used to create toolbars.\r\n * Control bars can be nested and combined with ol.control.Toggle to handle activate/deactivate.\r\n * @class\r\n * @constructor\r\n * @extends ol.control.Control\r\n * @param {Object=} options Control options.\r\n *  @param {String} options.className class of the control\r\n *  @param {boolean} options.group is a group, default false\r\n *  @param {boolean} options.toggleOne only one toggle control is active at a time, default false\r\n *  @param {boolean} options.autoDeactivate used with subbar to deactivate all control when top level control deactivate, default false\r\n *  @param {Array<ol.control.Control> } options.controls a list of control to add to the bar\r\n */\r\nol.control.Bar = function(options) {\r\n  if (!options) options={};\r\n  var element = document.createElement(\"div\");\r\n      element.classList.add('ol-unselectable', 'ol-control', 'ol-bar');\r\n  if (options.className) {\r\n    var classes = options.className.split(' ').filter(function(className) {\r\n      return className.length > 0;\r\n    });\r\n    element.classList.add.apply(element.classList, classes)\r\n  }\r\n  if (options.group) element.classList.add('ol-group');\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.set('toggleOne', options.toggleOne);\r\n  this.set('autoDeactivate', options.autoDeactivate);\r\n  this.controls_ = [];\r\n  if (options.controls instanceof Array) {\r\n    for (var i=0; i<options.controls.length; i++) {\r\n      this.addControl(options.controls[i]);\r\n    }\r\n  }\r\n};\r\nol.ext.inherits(ol.control.Bar, ol.control.Control);\r\n/** Set the control visibility\r\n * @param {boolean} val\r\n */\r\nol.control.Bar.prototype.setVisible = function (val) {\r\n  if (val) this.element.style.display = '';\r\n  else this.element.style.display = 'none';\r\n}\r\n/** Get the control visibility\r\n * @return {boolean} b\r\n */\r\nol.control.Bar.prototype.getVisible = function () {\r\n  return this.element.style.display != 'none';\r\n}\r\n/**\r\n * Set the map instance the control is associated with\r\n * and add its controls associated to this map.\r\n * @param {ol.Map} map The map instance.\r\n */\r\nol.control.Bar.prototype.setMap = function (map) {\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  for (var i=0; i<this.controls_.length; i++) {\r\n    var c = this.controls_[i];\r\n    // map.addControl(c);\r\n    c.setMap(map);\r\n  }\r\n};\r\n/** Get controls in the panel\r\n *\t@param {Array<ol.control.Control>}\r\n */\r\nol.control.Bar.prototype.getControls = function () {\r\n  return this.controls_;\r\n};\r\n/** Set tool bar position\r\n * @param {string} pos a combinaison of top|left|bottom|right\r\n */\r\nol.control.Bar.prototype.setPosition = function (pos) {\r\n  this.element.classList.remove('ol-left', 'ol-top', 'ol-bottom', 'ol-right');\r\n  pos = pos.split ('-');\r\n  for (var i=0; i<pos.length; i++) {\r\n    switch (pos[i]) {\r\n      case 'top':\r\n      case 'left':\r\n      case 'bottom':\r\n      case 'right':\r\n        this.element.classList.add(\"ol-\"+pos[i]);\r\n        break;\r\n      default: break;\r\n    }\r\n  }\r\n};\r\n/** Add a control to the bar\r\n *\t@param {ol.control.Control} c control to add\r\n */\r\nol.control.Bar.prototype.addControl = function (c) {\r\n  this.controls_.push(c);\r\n  c.setTarget(this.element);\r\n  if (this.getMap()) {\r\n    this.getMap().addControl(c);\r\n  }\r\n  // Activate and toogleOne\r\n  c.on ('change:active', function(e) { this.onActivateControl_(e, c); }.bind(this));\r\n  if (c.getActive) {\r\n    // c.dispatchEvent({ type:'change:active', key:'active', oldValue:false, active:true });\r\n    this.onActivateControl_({ target: c, active: c.getActive() }, c);\r\n  }\r\n};\r\n/** Deativate all controls in a bar\r\n * @param {ol.control.Control} [except] a control\r\n */\r\nol.control.Bar.prototype.deactivateControls = function (except) {\r\n  for (var i=0; i<this.controls_.length; i++) {\r\n  if (this.controls_[i] !== except && this.controls_[i].setActive) {\r\n      this.controls_[i].setActive(false);\r\n    }\r\n  }\r\n};\r\n/** Get active control in the bar\r\n * @returns {Array<ol.control.Control>}\r\n */\r\nol.control.Bar.prototype.getActiveControls = function () {\r\n  var active = [];\r\n  for (var i=0, c; c=this.controls_[i]; i++) {\r\n    if (c.getActive && c.getActive()) active.push(c);\r\n  }\r\n  return active;\r\n}\r\n/** Auto activate/deactivate controls in the bar\r\n * @param {boolean} b activate/deactivate\r\n */\r\nol.control.Bar.prototype.setActive = function (b) {\r\n  if (!b && this.get(\"autoDeactivate\")) {\r\n    this.deactivateControls();\r\n  }\r\n  if (b) {\r\n    var ctrls = this.getControls();\r\n    for (var i=0, sb; (sb = ctrls[i]); i++) {\r\n      if (sb.get(\"autoActivate\")) sb.setActive(true);\r\n    }\r\n  }\r\n}\r\n/** Post-process an activated/deactivated control\r\n *\t@param {ol.event} e :an object with a target {_ol_control_} and active flag {bool}\r\n */\r\nol.control.Bar.prototype.onActivateControl_ = function (e, ctrl) {\r\n  if (this.get('toggleOne')) {\r\n    if (e.active) {\r\n      var n;\r\n      //var ctrl = e.target;\r\n      for (n=0; n<this.controls_.length; n++) {\r\n        if (this.controls_[n]===ctrl) break;\r\n      }\r\n      // Not here!\r\n      if (n==this.controls_.length) return;\r\n      this.deactivateControls (this.controls_[n]);\r\n    } else {\r\n      // No one active > test auto activate\r\n      if (!this.getActiveControls().length) {\r\n        for (var i=0, c; c=this.controls_[i]; i++) {\r\n          if (c.get(\"autoActivate\")) {\r\n            c.setActive(true);\r\n            break;\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n};\r\n/**\r\n * @param {string} name of the control to search\r\n * @return {ol.control.Control}\r\n */\r\nol.control.Bar.prototype.getControlsByName = function(name) {\r\n  var controls = this.getControls();\r\n  return controls.filter(\r\n    function(control) {\r\n      return (control.get('name') === name);\r\n    }\r\n  );\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc \r\n *   OpenLayers 3 Attribution Control integrated in the canvas (for jpeg/png \r\n * @see http://www.kreidefossilien.de/webgis/dokumentation/beispiele/export-map-to-png-with-scale\r\n *\r\n * @constructor\r\n * @extends ol.control.Attribution\r\n * @param {Object=} options extend the ol.control.Attribution options.\r\n * \t@param {ol.style.Style} options.style  option is usesd to draw the text.\r\n *  @paream {boolean} [options.canvas=false] draw on canvas\r\n */\r\nol.control.CanvasAttribution = function(options) {\r\n  if (!options) options = {};\r\n  ol.control.Attribution.call(this, options);\r\n  this.element.classList.add('ol-canvas-control');\r\n  // Draw in canvas\r\n  this.setCanvas(!!options.canvas);\r\n  // Get style options\r\n  if (!options) options={};\r\n  if (!options.style) options.style = new ol.style.Style();\r\n  this.setStyle (options.style);\r\n}\r\nol.ext.inherits(ol.control.CanvasAttribution, ol.control.Attribution);\r\n/**\r\n * Draw attribution on canvas\r\n * @param {boolean} b draw the attribution on canvas.\r\n */\r\nol.control.CanvasAttribution.prototype.setCanvas = function (b) {\r\n  this.isCanvas_ = b;\r\n  if (b) this.setCollapsed(false);\r\n  this.element.style.visibility = b ? \"hidden\":\"visible\";\r\n  if (this.getMap()) {\r\n    try {\r\n      this.getMap().renderSync();\r\n    } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** Get map Canvas\r\n * @private\r\n */\r\nol.control.CanvasAttribution.prototype.getContext = ol.control.CanvasBase.prototype.getContext;\r\n/**\r\n * Change the control style\r\n * @param {ol.style.Style} style\r\n */\r\nol.control.CanvasAttribution.prototype.setStyle = function (style) {\r\n  var text = style.getText();\r\n  this.font_ = text ? text.getFont() : \"10px sans-serif\";\r\n  var stroke = text ? text.getStroke() : null;\r\n  var fill = text ? text.getFill() : null;\r\n  this.fontStrokeStyle_ = stroke ? ol.color.asString(stroke.getColor()) : \"#fff\";\r\n  this.fontFillStyle_ = fill ? ol.color.asString(fill.getColor()) : \"#000\";\r\n  this.fontStrokeWidth_ = stroke ? stroke.getWidth() : 3;\r\n  if (this.getMap()) this.getMap().render();\r\n};\r\n/**\r\n * Remove the control from its current map and attach it to the new map.\r\n * Subclasses may set up event handlers to get notified about changes to\r\n * the map here.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.control.CanvasAttribution.prototype.setMap = function (map) {\r\n  ol.control.CanvasBase.prototype.getCanvas.call(this, map);\r\n  var oldmap = this.getMap();\r\n  if (this._listener) ol.Observable.unByKey(this._listener);\r\n  this._listener = null;\r\n  ol.control.Attribution.prototype.setMap.call(this, map);\r\n  if (oldmap) {\r\n    try { oldmap.renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n  // Get change (new layer added or removed)\r\n  if (map) {\r\n    this._listener = map.on('postcompose', this.drawAttribution_.bind(this));\r\n  }\r\n  this.setCanvas (this.isCanvas_);\r\n};\r\n/** \r\n * Draw attribution in the final canvas\r\n * @private\r\n */\r\nol.control.CanvasAttribution.prototype.drawAttribution_ = function(e) {\r\n  if (!this.isCanvas_) return;\r\n  var ctx = this.getContext(e);\r\n  if (!ctx) return;\r\n  var text = \"\";\r\n  Array.prototype.slice.call(this.element.querySelectorAll('li'))\r\n    .filter(function(el) {\r\n      return el.style.display !== \"none\";\r\n    })\r\n    .map(function(el) {\r\n      text += (text ? \" - \":\"\") + el.textContent;\r\n    });\r\n  // Retina device\r\n  var ratio = e.frameState.pixelRatio;\r\n  ctx.save();\r\n  ctx.scale(ratio,ratio);\r\n  // Position\r\n  var eltRect = this.element.getBoundingClientRect();\r\n  var mapRect = this.getMap().getViewport().getBoundingClientRect();\r\n  var sc = this.getMap().getSize()[0] / mapRect.width;\r\n  ctx.translate((eltRect.left-mapRect.left)*sc, (eltRect.top-mapRect.top)*sc);\r\n  var h = this.element.clientHeight;\r\n  var w = this.element.clientWidth;\r\n  var textAlign = ol.ext.element.getStyle(this.element, 'textAlign') || 'center';\r\n  var left;\r\n  switch(textAlign) {\r\n    case 'left': {\r\n      left = 0;\r\n      break;\r\n    }\r\n    case 'right': {\r\n      left = w;\r\n      break;\r\n    }\r\n    default: {\r\n      left = w/2;\r\n      break;\r\n    }\r\n  }\r\n  // Draw scale text\r\n  ctx.beginPath();\r\n    ctx.strokeStyle = this.fontStrokeStyle_;\r\n    ctx.fillStyle = this.fontFillStyle_;\r\n    ctx.lineWidth = this.fontStrokeWidth_;\r\n    ctx.textAlign = textAlign;\r\n    ctx.textBaseline = 'middle';\r\n    ctx.font = this.font_;\r\n    ctx.strokeText(text, left, h/2);\r\n    ctx.fillText(text, left, h/2);\r\n  ctx.closePath();\r\n  ctx.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc \r\n *    OpenLayers Scale Line Control integrated in the canvas (for jpeg/png \r\n * @see http://www.kreidefossilien.de/webgis/dokumentation/beispiele/export-map-to-png-with-scale\r\n *\r\n * @constructor\r\n * @extends {ol.control.ScaleLine}\r\n * @param {Object=} options extend the ol.control.ScaleLine options.\r\n * \t@param {ol.style.Style} options.style used to draw the scale line (default is black/white, 10px Arial).\r\n */\r\nol.control.CanvasScaleLine = function(options) {\r\n  ol.control.ScaleLine.call(this, options);\r\n  this.element.classList.add('ol-canvas-control');\r\n  this.scaleHeight_ = 6;\r\n  // Get style options\r\n  if (!options) options={};\r\n  if (!options.style) options.style = new ol.style.Style();\r\n  this.setStyle(options.style);\r\n}\r\nol.ext.inherits(ol.control.CanvasScaleLine, ol.control.ScaleLine);\r\n/** Get map Canvas\r\n * @private\r\n */\r\nol.control.CanvasScaleLine.prototype.getContext = ol.control.CanvasBase.prototype.getContext;\r\n/**\r\n * Remove the control from its current map and attach it to the new map.\r\n * Subclasses may set up event handlers to get notified about changes to\r\n * the map here.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.control.CanvasScaleLine.prototype.setMap = function (map) {\t\r\n  ol.control.CanvasBase.prototype.getCanvas.call(this, map);\r\n  var oldmap = this.getMap();\r\n  if (this._listener) ol.Observable.unByKey(this._listener);\r\n  this._listener = null;\r\n  ol.control.ScaleLine.prototype.setMap.call(this, map);\r\n  if (oldmap) {\r\n    try { oldmap.renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n  // Add postcompose on the map\r\n  if (map) {\r\n    this._listener = map.on('postcompose', this.drawScale_.bind(this));\r\n  } \r\n  // Hide the default DOM element\r\n  this.element.style.visibility = 'hidden';\r\n  this.olscale = this.element.querySelector(\".ol-scale-line-inner\");\r\n}\r\n/**\r\n * Change the control style\r\n * @param {ol.style.Style} style\r\n */\r\nol.control.CanvasScaleLine.prototype.setStyle = function (style) {\r\n  var stroke = style.getStroke();\r\n  this.strokeStyle_ = stroke ? ol.color.asString(stroke.getColor()) : \"#000\";\r\n  this.strokeWidth_ = stroke ? stroke.getWidth() : 2;\r\n  var fill = style.getFill();\r\n  this.fillStyle_ = fill ? ol.color.asString(fill.getColor()) : \"#fff\";\r\n  var text = style.getText();\r\n  this.font_ = text ? text.getFont() : \"10px Arial\";\r\n  stroke = text ? text.getStroke() : null;\r\n  fill = text ? text.getFill() : null;\r\n  this.fontStrokeStyle_ = stroke ? ol.color.asString(stroke.getColor()) : this.fillStyle_;\r\n  this.fontStrokeWidth_ = stroke ? stroke.getWidth() : 3;\r\n  this.fontFillStyle_ = fill ? ol.color.asString(fill.getColor()) : this.strokeStyle_;\r\n  // refresh\r\n  if (this.getMap()) this.getMap().render();\r\n}\r\n/** \r\n * Draw attribution in the final canvas\r\n * @param {ol.render.Event} e\r\n * @private\r\n */\r\nol.control.CanvasScaleLine.prototype.drawScale_ = function(e) {\r\n  if ( this.element.style.visibility !== 'hidden' || ol.ext.element.getStyle(this.element, 'display') === 'none' ) return;\r\n  var ctx = this.getContext(e);\r\n  if (!ctx) return;\r\n  // Get size of the scale div\r\n  var scalewidth = parseInt(this.olscale.style.width);\r\n  if (!scalewidth) return;\r\n  var text = this.olscale.textContent;\r\n  var position = {left: this.element.offsetLeft, top: this.element.offsetTop};\r\n  // Retina device\r\n  var ratio = e.frameState.pixelRatio;\r\n  ctx.save();\r\n  ctx.scale(ratio,ratio);\r\n  // On top\r\n  position.top += this.element.clientHeight - this.scaleHeight_;\r\n  // Draw scale text\r\n  ctx.beginPath();\r\n    ctx.strokeStyle = this.fontStrokeStyle_;\r\n    ctx.fillStyle = this.fontFillStyle_;\r\n    ctx.lineWidth = this.fontStrokeWidth_;\r\n    ctx.textAlign = \"center\";\r\n  ctx.textBaseline =\"bottom\";\r\n    ctx.font = this.font_;\r\n  ctx.strokeText(text, position.left+scalewidth/2, position.top);\r\n    ctx.fillText(text, position.left+scalewidth/2, position.top);\r\n  ctx.closePath();\r\n  // Draw scale bar\r\n  position.top += 2;\r\n  ctx.lineWidth = this.strokeWidth_;\r\n  ctx.strokeStyle = this.strokeStyle_;\r\n  var max = 4;\r\n  var n = parseInt(text);\r\n  while (n%10 === 0) n/=10;\r\n  if (n%5 === 0) max = 5;\r\n  for (var i=0; i<max; i++) {\r\n    ctx.beginPath();\r\n    ctx.fillStyle = i%2 ? this.fillStyle_ : this.strokeStyle_;\r\n    ctx.rect(position.left+i*scalewidth/max, position.top, scalewidth/max, this.scaleHeight_);\r\n    ctx.stroke();\r\n    ctx.fill();\r\n    ctx.closePath();\r\n  }\r\n  ctx.restore();\r\n}\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * A title Control integrated in the canvas (for jpeg/png \r\n *\r\n * @constructor\r\n * @extends {ol.control.CanvasBase}\r\n * @param {Object=} options extend the ol.control options. \r\n *  @param {string} options.title the title, default 'Title'\r\n *  @param {ol.style.Style} options.style style used to draw the title.\r\n */\r\nol.control.CanvasTitle = function(options) {\r\n  if (!options) options = {};\r\n  var elt = ol.ext.element.create('DIV', {\r\n    className: (options.className || '') + ' ol-control-title ol-unselectable',\r\n    style: {\r\n      display: 'block',\r\n      visibility: 'hidden'\r\n    }\r\n  });\r\n  ol.control.CanvasBase.call(this, {\r\n    element: elt,\r\n    style: options.style\r\n  });\r\n  this.setTitle(options.title || '');\r\n  this.setVisible(options.visible);\r\n  this.element.style.font = this.getTextFont();\r\n};\r\nol.ext.inherits(ol.control.CanvasTitle, ol.control.CanvasBase);\r\n/**\r\n * Change the control style\r\n * @param {ol.style.Style} style\r\n */\r\nol.control.CanvasTitle.prototype.setStyle = function (style) {\r\n  ol.control.CanvasBase.prototype.setStyle.call(this, style);\r\n  // Element style\r\n  if (this.element) {\r\n    this.element.style.font = this.getTextFont();\r\n  }\r\n  // refresh\r\n  if (this.getMap()) this.getMap().render();\r\n};\r\n/**\r\n * Set the map title \r\n * @param {string} map title.\r\n * @api stable\r\n */\r\nol.control.CanvasTitle.prototype.setTitle = function (title) {\r\n  this.element.textContent = title;\r\n  this.set('title', title);\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/**\r\n * Get the map title \r\n * @param {string} map title.\r\n * @api stable\r\n */\r\nol.control.CanvasTitle.prototype.getTitle = function () {\r\n  return this.get('title');\r\n};\r\n/**\r\n * Set control visibility\r\n * @param {bool} b\r\n * @api stable\r\n */\r\nol.control.CanvasTitle.prototype.setVisible = function (b) {\r\n  this.element.style.display = (b ? 'block' : 'none');\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/**\r\n * Get control visibility\r\n * @return {bool} \r\n * @api stable\r\n */\r\nol.control.CanvasTitle.prototype.getVisible = function () {\r\n  return this.element.style.display !== 'none';\r\n};\r\n/** Draw title in the final canvas\r\n * @private\r\n*/\r\nol.control.CanvasTitle.prototype._draw = function(e) {\r\n  if (!this.getVisible()) return;\r\n  var ctx = this.getContext(e);\r\n\tif (!ctx) return;\r\n  // Retina device\r\n  var ratio = e.frameState.pixelRatio;\r\n  ctx.save();\r\n  ctx.scale(ratio,ratio);\r\n  // Position\r\n  var eltRect = this.element.getBoundingClientRect();\r\n  var mapRect = this.getMap().getViewport().getBoundingClientRect();\r\n  var sc = this.getMap().getSize()[0] / mapRect.width;\r\n  ctx.translate(\r\n    Math.round((eltRect.left-mapRect.left)*sc), \r\n    Math.round((eltRect.top-mapRect.top)*sc)\r\n  );\r\n  var h = this.element.clientHeight;\r\n  var w = this.element.clientWidth;\r\n  var left = w/2;\r\n  ctx.beginPath();\r\n  ctx.fillStyle = ol.color.asString(this.getFill().getColor());\r\n  ctx.rect(0,0, w, h);\r\n  ctx.fill();\r\n  ctx.closePath();\r\n  ctx.beginPath();\r\n  ctx.fillStyle = ol.color.asString(this.getTextFill().getColor());\r\n  ctx.strokeStyle = ol.color.asString(this.getTextStroke().getColor());\r\n  ctx.lineWidth = this.getTextStroke().getWidth();\r\n  ctx.textAlign = 'center';\r\n  ctx.textBaseline = 'middle';\r\n  ctx.font = this.getTextFont();\r\n  if (ctx.lineWidth) ctx.strokeText(this.getTitle(), left, h/2);\r\n  ctx.fillText(this.getTitle(), left, h/2);\r\n  ctx.closePath();\r\n  ctx.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * A Control to display map center coordinates on the canvas.\r\n *\r\n * @constructor\r\n * @extends {ol.control.CanvasBase}\r\n * @param {Object=} options extend the ol.control options. \r\n *  @param {string} options.className CSS class name\r\n *  @param {ol.style.Style} options.style style used to draw in the canvas\r\n *  @param {ol.proj.ProjectionLike} options.projection\tProjection. Default is the view projection.\r\n *  @param {ol.coordinate.CoordinateFormat} options.coordinateFormat A function that takes a ol.Coordinate and transforms it into a string.\r\n *  @param {boolean} options.canvas true to draw in the canvas\r\n */\r\nol.control.CenterPosition = function(options) {\r\n  if (!options) options = {};\r\n  var elt = ol.ext.element.create('DIV', {\r\n    className: (options.className || '') + ' ol-center-position ol-unselectable',\r\n    style: {\r\n      display: 'block',\r\n      visibility: 'hidden'\r\n    }\r\n  });\r\n  ol.control.CanvasBase.call(this, {\r\n    element: elt,\r\n    style: options.style\r\n  });\r\n  this.element.style.font = this.getTextFont();\r\n  this.set('projection', options.projection);\r\n  this.setCanvas(options.canvas);\r\n  this._format = (typeof options.coordinateFormat === 'function') ? options.coordinateFormat : ol.coordinate.toStringXY; \r\n};\r\nol.ext.inherits(ol.control.CenterPosition, ol.control.CanvasBase);\r\n/**\r\n * Change the control style\r\n * @param {ol.style.Style} style\r\n */\r\nol.control.CenterPosition.prototype.setStyle = function (style) {\r\n  ol.control.CanvasBase.prototype.setStyle.call(this, style);\r\n  // Element style\r\n  if (this.element) {\r\n    this.element.style.font = this.getTextFont();\r\n  }\r\n  // refresh\r\n  if (this.getMap()) this.getMap().render();\r\n};\r\n/**\r\n * Draw on canvas\r\n * @param {boolean} b draw the attribution on canvas.\r\n */\r\nol.control.CenterPosition.prototype.setCanvas = function (b) {\r\n  this.set('canvas', b);\r\n\tthis.element.style.visibility = b ? \"hidden\":\"visible\";\r\n\tif (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/**\r\n * Set control visibility\r\n * @param {bool} b\r\n * @api stable\r\n */\r\nol.control.CenterPosition.prototype.setVisible = function (b) {\r\n  this.element.style.display = (b ? '' : 'none');\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/**\r\n * Get control visibility\r\n * @return {bool} \r\n * @api stable\r\n */\r\nol.control.CenterPosition.prototype.getVisible = function () {\r\n  return this.element.style.display !== 'none';\r\n};\r\n/** Draw position in the final canvas\r\n * @private\r\n*/\r\nol.control.CenterPosition.prototype._draw = function(e) {\r\n  if (!this.getVisible() || !this.getMap()) return;\r\n  // Coordinate\r\n  var coord = this.getMap().getView().getCenter();\r\n  if (this.get('projection')) coord = ol.proj.transform (coord, this.getMap().getView().getProjection(), this.get('projection'));\r\n  coord  = this._format(coord);\r\n  this.element.textContent = coord;\r\n  if (!this.get('canvas')) return;\r\n  var ctx = this.getContext(e);\r\n\tif (!ctx) return;\r\n  // Retina device\r\n  var ratio = e.frameState.pixelRatio;\r\n  ctx.save();\r\n  ctx.scale(ratio,ratio);\r\n  // Position\r\n  var eltRect = this.element.getBoundingClientRect();\r\n  var mapRect = this.getMap().getViewport().getBoundingClientRect();\r\n  var sc = this.getMap().getSize()[0] / mapRect.width;\r\n  ctx.translate((eltRect.left-mapRect.left)*sc, (eltRect.top-mapRect.top)*sc);\r\n  var h = this.element.clientHeight;\r\n  var w = this.element.clientWidth;\r\n  ctx.beginPath();\r\n  ctx.fillStyle = ol.color.asString(this.getTextFill().getColor());\r\n  ctx.strokeStyle = ol.color.asString(this.getTextStroke().getColor());\r\n  ctx.lineWidth = this.getTextStroke().getWidth();\r\n  ctx.textAlign = 'center';\r\n  ctx.textBaseline = 'middle';\r\n  ctx.font = this.getTextFont();\r\n  if (ctx.lineWidth) ctx.strokeText(coord, w/2, h/2);\r\n  ctx.fillText(coord, w/2, h/2);\r\n  ctx.closePath();\r\n  ctx.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Draw a compass on the map. The position/size of the control is defined in the css.\r\n *\r\n * @constructor\r\n * @extends {ol.control.CanvasBase}\r\n * @param {Object=} options Control options. The style {_ol_style_Stroke_} option is usesd to draw the text.\r\n *  @param {string} options.className class name for the control\r\n *  @param {boolean} [options.visible=true]\r\n *  @param {Image} options.image an image, default use the src option or a default image\r\n *  @param {string} options.src image src or 'default' or 'compact', default use the image option or a default image\r\n *  @param {boolean} options.rotateVithView rotate vith view (false to show watermark), default true\r\n *  @param {ol.style.Stroke} options.style style to draw the lines, default draw no lines\r\n */\r\nol.control.Compass = function(options) {\r\n  if (!options) options = {};\r\n  // Initialize parent\r\n  var elt = document.createElement(\"div\");\r\n  elt.className = \"ol-control ol-compassctrl ol-unselectable ol-hidden\" + (options.className ? \" \"+options.className : \"\");\r\n  elt.style.position = \"absolute\";\r\n  elt.style.visibility = \"hidden\";\r\n  var style = (options.style instanceof ol.style.Stroke) ? new ol.style.Style({stroke: options.style}) : options.style;\r\n  if (!options.style) {\r\n    style = new ol.style.Style({stroke: new ol.style.Stroke({width:0}) });\r\n  }\r\n  ol.control.CanvasBase.call(this, { \r\n    element: elt,\r\n    style: style\r\n  });\r\n  this.set('rotateVithView', options.rotateWithView!==false);\r\n  this.setVisible(options.visible!==false);\r\n  this.setImage(options.image || options.src);\r\n};\r\nol.ext.inherits(ol.control.Compass, ol.control.CanvasBase);\r\n/** Set compass image\r\n * @param {Image|string} [img=default] the image or an url or 'compact' or 'default'\r\n */\r\nol.control.Compass.prototype.setImage = function (img) {\r\n  // The image\r\n  if (img instanceof Image) {\r\n    this.img_ = img;\r\n    this.img_.onload = function(){ \r\n      if (this.getMap()) {\r\n        try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n      }\r\n    }.bind(this);\r\n  } else if (typeof(img) === 'string') {\r\n    // Load source\r\n    switch (img) {\r\n      case 'compact': {\r\n        this.img_ = this.compactCompass_(this.element.clientWidth, this.getStroke().getColor());\r\n        break;\r\n      }\r\n      case 'default': {\r\n        this.img_ = this.defaultCompass_(this.element.clientWidth, this.getStroke().getColor());\r\n        break;\r\n      }\r\n      default: {\r\n        this.img_ = new Image();\r\n        this.img_.onload = function(){ \r\n          if (this.getMap()) {\r\n            try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n          }\r\n        }.bind(this);\r\n        this.img_.src = img;\r\n        break;\r\n      }\r\n    }\r\n  } else {\r\n    this.img_ = this.defaultCompass_(this.element.clientWidth, this.getStroke().getColor());\r\n  }  \r\n}  \r\n/** Create a default image.\r\n * @param {number} s the size of the compass\r\n * @private\r\n */\r\nol.control.Compass.prototype.compactCompass_ = function (s, color) {\r\n  var canvas = document.createElement('canvas');\r\n  var ctx = canvas.getContext(\"2d\");\r\n  s = canvas.width = canvas.height = s || 150;\r\n  var r = s/2;\r\n  ctx.translate(r,r);\r\n  ctx.fillStyle = color || '#963';\r\n  ctx.lineWidth = 5;\r\n  ctx.lineJoin = ctx.lineCap = 'round';\r\n  ctx.font = 'bold '+(r*0.4)+'px sans-serif';\r\n  ctx.textBaseline = 'bottom';\r\n  ctx.textAlign = 'center';\r\n  ctx.strokeStyle = '#fff';\r\n  ctx.globalAlpha = .75;\r\n  ctx.strokeText('N', 0,-r/2);\r\n  ctx.globalAlpha = 1;\r\n  ctx.fillText('N', 0,-r/2);\r\n  ctx.beginPath();\r\n    ctx.moveTo(0,r/4);\r\n    ctx.lineTo(r/3,r/2);\r\n    ctx.lineTo(0,-r/2);\r\n    ctx.lineTo(-r/3,r/2);\r\n    ctx.lineTo(0,r/4);\r\n  ctx.lineWidth = 12;\r\n  ctx.fillStyle = \"#fff\";\r\n  ctx.globalAlpha = .75;\r\n  ctx.fill();\r\n  ctx.stroke();\r\n  ctx.globalAlpha = 1;\r\n  ctx.fillStyle = ctx.strokeStyle = color || '#963';\r\n  ctx.lineWidth = 5;\r\n  ctx.beginPath();\r\n  ctx.moveTo(0,r/4);\r\n  ctx.lineTo(0,-r/2);\r\n  ctx.lineTo(r/3,r/2);\r\n  ctx.lineTo(0,r/4);\r\n  ctx.fill();\r\n  ctx.stroke();\r\n  ctx.beginPath();\r\n  ctx.moveTo(0,r/4);\r\n  ctx.lineTo(0,-r/2);\r\n  ctx.lineTo(-r/3,r/2);\r\n  ctx.lineTo(0,r/4);\r\n  ctx.stroke();\r\n  return canvas;\r\n};\r\n/** Create a default image.\r\n * @param {number} s the size of the compass\r\n * @private\r\n */\r\nol.control.Compass.prototype.defaultCompass_ = function (s, color) {\r\n  var canvas = document.createElement('canvas');\r\n  var ctx = canvas.getContext(\"2d\");\r\n  s = canvas.width = canvas.height = s || 150;\r\n  var r = s/2;\r\n  var r2 = 0.22*r;\r\n  function draw (r, r2) {\r\n    ctx.fillStyle = color ||\"#963\";\r\n    ctx.beginPath();\r\n    ctx.moveTo (0,0); \r\n    ctx.lineTo (r,0); ctx.lineTo (r2,r2); ctx.moveTo (0,0);\r\n    ctx.lineTo (-r,0); ctx.lineTo (-r2,-r2); ctx.moveTo (0,0);\r\n    ctx.lineTo (0,r); ctx.lineTo (-r2,r2); ctx.moveTo (0,0);\r\n    ctx.lineTo (0,-r); ctx.lineTo (r2,-r2); ctx.moveTo (0,0);\r\n    ctx.fill();\r\n    ctx.stroke();\r\n  }\r\n  function draw2 (r, r2) {\r\n    ctx.globalCompositeOperation = \"destination-out\";\r\n    ctx.fillStyle = \"#fff\";\r\n    ctx.beginPath();\r\n    ctx.moveTo (0,0); \r\n    ctx.lineTo (r,0); ctx.lineTo (r2,-r2); ctx.moveTo (0,0);\r\n    ctx.lineTo (-r,0); ctx.lineTo (-r2,r2); ctx.moveTo (0,0);\r\n    ctx.lineTo (0,r); ctx.lineTo (r2,r2); ctx.moveTo (0,0);\r\n    ctx.lineTo (0,-r); ctx.lineTo (-r2,-r2); ctx.moveTo (0,0);\r\n    ctx.fill();\r\n    ctx.globalCompositeOperation=\"source-over\";\r\n    ctx.beginPath();\r\n    ctx.moveTo (0,0); \r\n    ctx.lineTo (r,0); ctx.lineTo (r2,-r2); ctx.moveTo (0,0);\r\n    ctx.lineTo (-r,0); ctx.lineTo (-r2,r2); ctx.moveTo (0,0);\r\n    ctx.lineTo (0,r); ctx.lineTo (r2,r2); ctx.moveTo (0,0);\r\n    ctx.lineTo (0,-r); ctx.lineTo (-r2,-r2); ctx.moveTo (0,0);\r\n    ctx.stroke();\r\n  }\r\n  ctx.translate(r,r);\r\n  ctx.strokeStyle = color || \"#963\";\r\n  ctx.lineWidth = 1.5;\r\n  ctx.beginPath();\r\n  ctx.arc (0,0, s*0.41, 0, 2*Math.PI);\r\n  ctx.arc (0,0, s*0.44, 0, 2*Math.PI);\r\n  ctx.stroke();\r\n  ctx.rotate(Math.PI/4)\r\n  draw (r*0.9, r2*0.8);\r\n  draw2 (r*0.9, r2*0.8);\r\n  ctx.rotate(-Math.PI/4)\r\n  draw (r, r2);\r\n  draw2 (r, r2);\r\n  return canvas;\r\n};\r\n/** Get control visibility\r\n * @return {boolean}\r\n */\r\nol.control.Compass.prototype.getVisible = function() {\r\n  return ol.ext.element.getStyle(this.element, 'display') === 'block';\r\n};\r\n/** Set visibility\r\n * @param {boolean} b\r\n */\r\nol.control.Compass.prototype.setVisible = function(b) {\r\n  if (b) this.element.classList.add('ol-visible');\r\n  else this.element.classList.remove('ol-visible');\r\n  if (this.getMap()) this.getMap().render();\r\n};\r\n/** Draw compass\r\n* @param {ol.event} e postcompose event\r\n* @private\r\n*/\r\nol.control.Compass.prototype._draw = function(e) {\r\n  var ctx = this.getContext(e);\r\n  if (!ctx || !this.getVisible()) return;\r\n  var canvas = ctx.canvas;\r\n  // 8 angles\r\n  var i, da = [];\r\n  for (i=0; i<8; i++) da[i] = [ Math.cos(Math.PI*i/8), Math.sin(Math.PI*i/8) ];\r\n  // Retina device\r\n  var ratio = e.frameState.pixelRatio;\r\n  ctx.save();\r\n  ctx.scale(ratio,ratio);\r\n  var w = this.element.clientWidth;\r\n  var h = this.element.clientHeight;\r\n  var pos = {left: this.element.offsetLeft, top: this.element.offsetTop};\r\n  var compass = this.img_;\r\n  var rot = e.frameState.viewState.rotation;\r\n  ctx.beginPath();\r\n    ctx.translate(pos.left+w/2, pos.top+h/2);\r\n    if (this.get('rotateVithView')) ctx.rotate(rot);\r\n    if (this.getStroke().getWidth()) {\r\n      ctx.beginPath();\r\n        ctx.strokeStyle = this.getStroke().getColor();\r\n        ctx.lineWidth = this.getStroke().getWidth();\r\n        var m = Math.max(canvas.width, canvas.height);\r\n        for (i=0; i<8; i++) {\r\n          ctx.moveTo (-da[i][0]*m, -da[i][1]*m);\r\n          ctx.lineTo (da[i][0]*m, da[i][1]*m);\r\n        }\r\n      ctx.stroke();\r\n    }\r\n    if (compass.width) {\r\n      ctx.drawImage (compass, -w/2, -h/2, w, h);\r\n    }\r\n  ctx.closePath();\r\n  ctx.restore();\r\n};\r\n\r\n/** \r\n * @classdesc\r\n * Application dialog\r\n * @extends {ol.control.Control}\r\n * @constructor\r\n * @param {*} options\r\n *  @param {string} options.className\r\n *  @param {ol.Map} options.map the map to place the dialog inside\r\n *  @param {Element} options.target target to place the dialog\r\n *  @param {boolean} options.fullscreen view dialog fullscreen (same as options.target = document.body)\r\n *  @param {boolean} options.zoom add a zoom effect\r\n *  @param {boolean} options.closeBox add a close button\r\n *  @param {number} options.max if not null add a progress bar to the dialog, default null\r\n *  @param {boolean} options.hideOnClick close dialog when click\r\n *  @param {boolean} options.hideOnBack close dialog when click the background\r\n *  @param {boolean} options.closeOnSubmit Prevent closing the dialog on submit\r\n */\r\nol.control.Dialog = function(options) {\r\n  options = options || {};\r\n  if (options.fullscreen) options.target = document.body;\r\n  // Constructor\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: ((options.className || '') + (options.zoom ? ' ol-zoom':'') + ' ol-ext-dialog').trim(),\r\n    click: function(e) {\r\n      if (this.get('hideOnBack') && e.target===element) this.close();\r\n      if (this.get('hideOnClick')) this.close();\r\n    }.bind(this)\r\n  });\r\n  // form\r\n  var form = ol.ext.element.create('FORM', {\r\n    on: {\r\n      submit: this._onButton('submit')\r\n    },\r\n    parent: element\r\n  });\r\n  // Title\r\n  ol.ext.element.create('H2', {\r\n    parent: form\r\n  });\r\n  // Close box\r\n  ol.ext.element.create('DIV', {\r\n    className: 'ol-closebox',\r\n    click: this._onButton('cancel'),\r\n    parent: form\r\n  });\r\n  // Content\r\n  ol.ext.element.create('DIV', {\r\n    className: 'ol-content',\r\n    parent: form\r\n  });\r\n  // Progress\r\n  this._progress = ol.ext.element.create('DIV', {\r\n    className: 'ol-progress-bar',\r\n    style: { display: 'none' },\r\n    parent: form\r\n  });\r\n  this._progressbar = ol.ext.element.create('DIV', {\r\n    parent: this._progress\r\n  });\r\n  // Buttons\r\n  ol.ext.element.create('DIV', {\r\n    className: 'ol-buttons',\r\n    parent: form\r\n  });\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.set('closeBox', options.closeBox !== false);\r\n  this.set('zoom', !!options.zoom);\r\n  this.set('hideOnClick', !!options.hideOnClick);\r\n  this.set('hideOnBack', !!options.hideOnBack);\r\n  this.set('className', element.className);\r\n  this.set('closeOnSubmit', options.closeOnSubmit);\r\n  this.set('buttons', options.buttons);\r\n  this.setContent(options)\r\n};\r\nol.ext.inherits(ol.control.Dialog, ol.control.Control);\r\n/** Show a new dialog \r\n * @param { * | Element | string } options options or a content to show\r\n *  @param {Element | String} options.content dialog content\r\n *  @param {string} options.title title of the dialog\r\n *  @param {string} options.className dialog class name\r\n *  @param {number} options.autoclose a delay in ms before auto close\r\n *  @param {boolean} options.hideOnBack close dialog when click the background\r\n *  @param {number} options.max if not null add a progress bar to the dialog\r\n *  @param {number} options.progress set the progress bar value\r\n *  @param {Object} options.buttons a key/value list of button to show \r\n *  @param {function} [options.onButton] a function that takes the button id and a list of input by className\r\n */\r\nol.control.Dialog.prototype.show = function(options) {\r\n  if (options) {\r\n    if (options instanceof Element || typeof(options) === 'string') {\r\n      options = { content: options };\r\n    }\r\n    this.setContent(options);\r\n  }\r\n  this.element.classList.add('ol-visible');\r\n  var input = this.element.querySelector('input[type=\"text\"],input[type=\"search\"],input[type=\"number\"]');\r\n  if (input) input.focus();\r\n  this.dispatchEvent ({ type: 'show' });\r\n  if (options) {\r\n    // Auto close\r\n    if (options.autoclose) {\r\n      var listener = setTimeout(function() { this.hide() }.bind(this), options.autoclose);\r\n      this.once('hide', function(){ \r\n        clearTimeout(listener); \r\n      });\r\n    }\r\n    // hideOnBack\r\n    if (options.hideOnBack) {\r\n      // save value\r\n      var value = this.get('hideOnBack');\r\n      this.set('hideOnBack', true);\r\n      this.once('hide', function() {\r\n        this.set('hideOnBack', value);\r\n      }.bind(this));\r\n    }\r\n  }\r\n};\r\n/** Open the dialog\r\n */\r\nol.control.Dialog.prototype.open = function() {\r\n  this.show();\r\n};\r\n/** Set the dialog content\r\n * @param {*} options\r\n *  @param {Element | String} options.content dialog content\r\n *  @param {string} options.title title of the dialog\r\n *  @param {string} options.className dialog class name\r\n *  @param {number} options.max if not null add a progress bar to the dialog\r\n *  @param {number} options.progress set the progress bar value\r\n *  @param {Object} options.buttons a key/value list of button to show \r\n *  @param {function} [options.onButton] a function that takes the button id and a list of input by className\r\n */\r\nol.control.Dialog.prototype.setContent = function(options) {\r\n  if (!options) return;\r\n  this.element.className = this.get('className');\r\n  if (typeof(options) === 'string') options = { content: options };\r\n  options = options || {};\r\n  if (options.max) this.setProgress(0, options.max);\r\n  if (options.progress !== undefined) this.setProgress(options.progress);\r\n  //this.element.className = 'ol-ext-dialog' + (this.get('zoom') ? ' ol-zoom' : '');\r\n  if (this.get('zoom')) this.element.classList.add('ol-zoom');\r\n  else this.element.classList.remove('ol-zoom');\r\n  if (options.className) {\r\n    options.className.split(' ').forEach(function() {\r\n      this.element.classList.add(options.className);\r\n    }.bind(this));\r\n  }\r\n  var form = this.element.querySelector('form');\r\n  // Content\r\n  if (options.content !== undefined) {\r\n    if (options.content instanceof Element) ol.ext.element.setHTML(form.querySelector('.ol-content'), '');\r\n    ol.ext.element.setHTML(form.querySelector('.ol-content'), options.content || '');\r\n  }\r\n  // Title\r\n  form.querySelector('h2').innerText = options.title || '';\r\n  if (options.title) {\r\n    form.classList.add('ol-title');\r\n  } else {\r\n    form.classList.remove('ol-title');\r\n  }\r\n  // Closebox\r\n  if (options.closeBox || (this.get('closeBox') && options.closeBox !== false)) {\r\n    form.classList.add('ol-closebox');\r\n  } else {\r\n    form.classList.remove('ol-closebox');\r\n  }\r\n  // Buttons\r\n  var buttons = this.element.querySelector('.ol-buttons');\r\n  buttons.innerHTML = '';\r\n  var btn = options.buttons || this.get('buttons');\r\n  if (btn) {\r\n    form.classList.add('ol-button');\r\n    for (var i in btn) {\r\n      ol.ext.element.create ('INPUT', {\r\n        type: (i==='submit' ? 'submit':'button'),\r\n        value: btn[i],\r\n        click: this._onButton(i, options.onButton),\r\n        parent: buttons\r\n      });\r\n    }\r\n  } else {\r\n    form.classList.remove('ol-button');\r\n  }\r\n};\r\n/** Get dialog content element \r\n * @returns {Element}\r\n */\r\nol.control.Dialog.prototype.getContentElement = function() {\r\n  return this.element.querySelector('form .ol-content')\r\n};\r\n/** Set progress\r\n * @param {number} val\r\n * @param {number} max\r\n */\r\nol.control.Dialog.prototype.setProgress = function(val, max) {\r\n  if (max > 0) {\r\n    this.set('max', Number(max));\r\n  } else {\r\n    max = this.get('max');\r\n  }\r\n  if (!max) {\r\n    ol.ext.element.setStyle(this._progress, { display: 'none' })\r\n  } else {\r\n    var p = Math.round(val / max * 100);\r\n    ol.ext.element.setStyle(this._progress, { display: '' })\r\n    this._progressbar.className = p ? '' : 'notransition';\r\n    ol.ext.element.setStyle(this._progressbar, { width: p+'%' })\r\n  }\r\n};\r\n/** Returns a function to do something on button click\r\n * @param {strnig} button button id\r\n * @param {function} callback\r\n * @returns {function}\r\n * @private\r\n */\r\nol.control.Dialog.prototype._onButton = function(button, callback) {\r\n  // Dispatch a button event\r\n  var fn = function(e) {\r\n    e.preventDefault();\r\n    if (button!=='submit' || this.get('closeOnSubmit')!==false) this.hide();\r\n    var inputs = {};\r\n    this.element.querySelectorAll('form input').forEach (function(input) {\r\n      if (input.className) inputs[input.className] = input;\r\n    });\r\n    this.dispatchEvent ({ type: 'button', button: button, inputs: inputs });\r\n    if (typeof(callback) === 'function') callback(button, inputs);\r\n  }.bind(this);\r\n  return fn;\r\n};\r\n/** Close the dialog \r\n */\r\nol.control.Dialog.prototype.hide = function() {\r\n  this.element.classList.remove('ol-visible');\r\n  this.dispatchEvent ({ type: 'hide' });\r\n};\r\n/** Close the dialog \r\n * @method Dialog.close\r\n * @return {bool} true if a dialog is closed\r\n */\r\nol.control.Dialog.prototype.close = ol.control.Dialog.prototype.hide;\r\n/** The dialog is shown\r\n * @return {bool} true if a dialog is open\r\n */\r\nol.control.Dialog.prototype.isOpen = function() {\r\n  return (this.element.classList.contains('ol-visible'));\r\n};\r\n\r\n/** A simple control to disable all actions on the map.\r\n * The control will create an invisible div over the map.\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n *\t\t@param {String} options.class class of the control\r\n *\t\t@param {String} options.html html code to insert in the control\r\n *\t\t@param {bool} options.on the control is on\r\n *\t\t@param {function} options.toggleFn callback when control is clicked \r\n */\r\nol.control.Disable = function(options)\r\n{\toptions = options||{};\r\n\tvar element = document.createElement(\"div\");\r\n\t\t\telement.className = (options.className||\"\"+' ol-disable ol-unselectable ol-control').trim();\r\n\tvar stylesOptions = { top:\"0px\", left:\"0px\", right:\"0px\", bottom:\"0px\", \"zIndex\":10000, background:\"none\", display:\"none\" };\r\n\tObject.keys(stylesOptions).forEach(function(styleKey) {\r\n\t\telement.style[styleKey] = stylesOptions[styleKey];\r\n\t});\r\n\tol.control.Control.call(this,\r\n\t{\telement: element\r\n\t});\r\n}\r\nol.ext.inherits(ol.control.Disable, ol.control.Control);\r\n/** Test if the control is on\r\n * @return {bool}\r\n * @api stable\r\n */\r\nol.control.Disable.prototype.isOn = function()\r\n{\treturn this.element.classList.contains(\"ol-disable\");\r\n}\r\n/** Disable all action on the map\r\n * @param {bool} b, default false\r\n * @api stable\r\n */\r\nol.control.Disable.prototype.disableMap = function(b)\r\n{\tif (b) \r\n\t{\tthis.element.classList.add(\"ol-enable\").show();\r\n\t}\r\n\telse \r\n\t{\tthis.element.classList.remove(\"ol-enable\").hide();\r\n\t}\r\n}\r\n\r\n/** Control bar for editing in a layer\r\n * @constructor\r\n * @extends {ol.control.Bar}\r\n * @fires info\r\n * @param {Object=} options Control options.\r\n *\t@param {String} options.className class of the control\r\n *\t@param {String} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *\t@param {boolean} options.edition false to remove the edition tools, default true\r\n *\t@param {Object} options.interactions List of interactions to add to the bar \r\n *    ie. Select, Delete, Info, DrawPoint, DrawLine, DrawPolygon\r\n *    Each interaction can be an interaction or true (to get the default one) or false to remove it from bar\r\n *\t@param {ol.source.Vector} options.source Source for the drawn features. \r\n */\r\nol.control.EditBar = function(options) {\r\n  options = options || {};\r\n  options.interactions = options.interactions || {};\r\n  // New bar\r\n\tol.control.Bar.call(this, {\r\n    className: (options.className ? options.className+' ': '') + 'ol-editbar',\r\n    toggleOne: true,\r\n\t\ttarget: options.target\r\n  });\r\n  this._source = options.source;\r\n  // Add buttons / interaction\r\n  this._interactions = {};\r\n  this._setSelectInteraction(options);\r\n  if (options.edition!==false) this._setEditInteraction(options);\r\n  this._setModifyInteraction(options);\r\n};\r\nol.ext.inherits(ol.control.EditBar, ol.control.Bar);\r\n/**\r\n * Set the map instance the control is associated with\r\n * and add its controls associated to this map.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.control.EditBar.prototype.setMap = function (map) {\r\n  if (this.getMap()) {\r\n    if (this._interactions.Delete) this.getMap().removeInteraction(this._interactions.Delete);\r\n    if (this._interactions.ModifySelect) this.getMap().removeInteraction(this._interactions.ModifySelect);\r\n  }\r\n  ol.control.Bar.prototype.setMap.call(this, map);\r\n  if (this.getMap()) {\r\n    if (this._interactions.Delete) this.getMap().addInteraction(this._interactions.Delete);\r\n    if (this._interactions.ModifySelect) this.getMap().addInteraction(this._interactions.ModifySelect);\r\n  }\r\n};\r\n/** Get an interaction associated with the bar\r\n * @param {string} name \r\n */\r\nol.control.EditBar.prototype.getInteraction = function (name) {\r\n  return this._interactions[name];\r\n};\r\n/** Get the option title */\r\nol.control.EditBar.prototype._getTitle = function (option) {\r\n  if (option) {\r\n    if (option.get) return option.get('title');\r\n    else if (typeof(option) === 'string') return option;\r\n    else return option.title;\r\n  } \r\n};\r\n/** Add selection tool:\r\n * 1. a toggle control with a select interaction\r\n * 2. an option bar to delete / get information on the selected feature\r\n * @private\r\n */\r\nol.control.EditBar.prototype._setSelectInteraction = function (options) {\r\n  var self = this;\r\n  // Sub bar\r\n  var sbar = new ol.control.Bar();\r\n  var selectCtrl;\r\n  // Delete button\r\n  if (options.interactions.Delete !== false) {\r\n    if (options.interactions.Delete instanceof ol.interaction.Delete) {\r\n      this._interactions.Delete = options.interactions.Delete; \r\n    } else {\r\n      this._interactions.Delete = new ol.interaction.Delete();\r\n    }\r\n    var del = this._interactions.Delete;\r\n    del.setActive(false);\r\n    if (this.getMap()) this.getMap().addInteraction(del);\r\n    sbar.addControl (new ol.control.Button({\r\n      className: 'ol-delete',\r\n      title: this._getTitle(options.interactions.Delete) || \"Delete\",\r\n      name: 'Delete',\r\n      handleClick: function(e) {\r\n        // Delete selection\r\n        del.delete(selectCtrl.getInteraction().getFeatures());\r\n        var evt = {\r\n          type: 'select',\r\n          selected: [],\r\n          deselected: selectCtrl.getInteraction().getFeatures().getArray().slice(),\r\n          mapBrowserEvent: e.mapBrowserEvent\r\n        };\r\n        selectCtrl.getInteraction().getFeatures().clear();\r\n        selectCtrl.getInteraction().dispatchEvent(evt);\r\n      }\r\n    }));\r\n  }\r\n  // Info button\r\n  if (options.interactions.Info !== false) {\r\n    sbar.addControl (new ol.control.Button({\r\n      className: 'ol-info',\r\n      name: 'Info',\r\n      title: this._getTitle(options.interactions.Info) || \"Show informations\",\r\n      handleClick: function() {\r\n        self.dispatchEvent({ \r\n          type: 'info', \r\n          features: selectCtrl.getInteraction().getFeatures() \r\n        });\r\n      }\r\n    }));\r\n  }\r\n  // Select button\r\n  if (options.interactions.Select !== false) {\r\n    if (options.interactions.Select instanceof ol.interaction.Select) {\r\n      this._interactions.Select = options.interactions.Select\r\n    } else {\r\n      this._interactions.Select = new ol.interaction.Select({\r\n        condition: ol.events.condition.click\r\n      });\r\n    }\r\n    var sel = this._interactions.Select;\r\n    selectCtrl = new ol.control.Toggle({\r\n      className: 'ol-selection',\r\n      name: 'Select',\r\n      title: this._getTitle(options.interactions.Select) || \"Select\",\r\n      interaction: sel,\r\n      bar: sbar.getControls().length ? sbar : undefined,\r\n      autoActivate:true,\r\n      active:true\r\n    });\r\n    this.addControl(selectCtrl);\r\n    sel.on('change:active', function() {\r\n      sel.getFeatures().clear();\r\n    });\r\n  }\r\n};\r\n/** Add editing tools\r\n * @private\r\n */ \r\nol.control.EditBar.prototype._setEditInteraction = function (options) {\r\n  if (options.interactions.DrawPoint !== false) {\r\n    if (options.interactions.DrawPoint instanceof ol.interaction.Draw) {\r\n      this._interactions.DrawPoint = options.interactions.DrawPoint;\r\n    } else {\r\n      this._interactions.DrawPoint = new ol.interaction.Draw({\r\n        type: 'Point',\r\n        source: this._source\r\n      });\r\n    }\r\n    var pedit = new ol.control.Toggle({\r\n      className: 'ol-drawpoint',\r\n      name: 'DrawPoint',\r\n      title: this._getTitle(options.interactions.DrawPoint) || 'Point',\r\n      interaction: this._interactions.DrawPoint\r\n    });\r\n    this.addControl ( pedit );\r\n  }\r\n  if (options.interactions.DrawLine !== false) {\r\n    if (options.interactions.DrawLine instanceof ol.interaction.Draw) {\r\n      this._interactions.DrawLine = options.interactions.DrawLine\r\n    } else {\r\n      this._interactions.DrawLine = new ol.interaction.Draw ({\r\n        type: 'LineString',\r\n        source: this._source,\r\n        // Count inserted points\r\n        geometryFunction: function(coordinates, geometry) {\r\n          if (geometry) geometry.setCoordinates(coordinates);\r\n          else geometry = new ol.geom.LineString(coordinates);\r\n          this.nbpts = geometry.getCoordinates().length;\r\n          return geometry;\r\n        }\r\n      });\r\n    }\r\n    var ledit = new ol.control.Toggle({\r\n      className: 'ol-drawline',\r\n      title: this._getTitle(options.interactions.DrawLine) || 'LineString',\r\n      name: 'DrawLine',\r\n      interaction: this._interactions.DrawLine,\r\n      // Options bar associated with the control\r\n      bar: new ol.control.Bar ({\r\n        controls:[ \r\n          new ol.control.TextButton({\r\n            html: this._getTitle(options.interactions.UndoDraw) || 'undo',\r\n            title: this._getTitle(options.interactions.UndoDraw) || \"delete last point\",\r\n            handleClick: function() {\r\n              if (ledit.getInteraction().nbpts>1) ledit.getInteraction().removeLastPoint();\r\n            }\r\n          }),\r\n          new ol.control.TextButton ({\r\n            html: this._getTitle(options.interactions.FinishDraw) || 'finish',\r\n            title: this._getTitle(options.interactions.FinishDraw) || \"finish\",\r\n            handleClick: function() {\r\n              // Prevent null objects on finishDrawing\r\n              if (ledit.getInteraction().nbpts>2) ledit.getInteraction().finishDrawing();\r\n            }\r\n          })\r\n        ]\r\n      }) \r\n    });\r\n    this.addControl ( ledit );\r\n  }\r\n  if (options.interactions.DrawPolygon !== false) {\r\n    if (options.interactions.DrawPolygon instanceof ol.interaction.Draw){\r\n      this._interactions.DrawPolygon = options.interactions.DrawPolygon\r\n    } else {\r\n      this._interactions.DrawPolygon = new ol.interaction.Draw ({\r\n        type: 'Polygon',\r\n        source: this._source,\r\n        // Count inserted points\r\n        geometryFunction: function(coordinates, geometry) {\r\n          this.nbpts = coordinates[0].length;\r\n          if (geometry) geometry.setCoordinates([coordinates[0].concat([coordinates[0][0]])]);\r\n          else geometry = new ol.geom.Polygon(coordinates);\r\n          return geometry;\r\n        }\r\n      });\r\n    }\r\n    this._setDrawPolygon(\r\n      'ol-drawpolygon', \r\n      this._interactions.DrawPolygon, \r\n      this._getTitle(options.interactions.DrawPolygon) || 'Polygon', \r\n      'DrawPolygon',\r\n      options\r\n    );\r\n  }\r\n  // Draw hole\r\n  if (options.interactions.DrawHole !== false) {\r\n    if (options.interactions.DrawHole instanceof ol.interaction.DrawHole){\r\n      this._interactions.DrawHole = options.interactions.DrawHole;\r\n    } else {\r\n      this._interactions.DrawHole = new ol.interaction.DrawHole ();\r\n    }\r\n    this._setDrawPolygon(\r\n      'ol-drawhole', \r\n      this._interactions.DrawHole, \r\n      this._getTitle(options.interactions.DrawHole) || 'Hole',\r\n      'DrawHole', \r\n      options\r\n    );\r\n  }\r\n  // Draw regular\r\n  if (options.interactions.DrawRegular !== false) {\r\n    var label = { pts: 'pts', circle: 'circle' };\r\n    if (options.interactions.DrawRegular instanceof ol.interaction.DrawRegular) {\r\n      this._interactions.DrawRegular = options.interactions.DrawRegular;\r\n      label.pts = this._interactions.DrawRegular.get('ptsLabel') || label.pts;\r\n      label.circle = this._interactions.DrawRegular.get('circleLabel') || label.circle;\r\n    } else {\r\n      this._interactions.DrawRegular = new ol.interaction.DrawRegular ({\r\n        source: this._source,\r\n        sides: 4\r\n      });\r\n      if (options.interactions.DrawRegular) {\r\n        label.pts = options.interactions.DrawRegular.ptsLabel || label.pts;\r\n        label.circle = options.interactions.DrawRegular.circleLabel || label.circle;\r\n      }\r\n    }\r\n    var regular = this._interactions.DrawRegular;\r\n    var div = document.createElement('DIV');\r\n    var down = ol.ext.element.create('DIV', { parent: div });\r\n    ol.ext.element.addListener(down, ['click', 'touchstart'], function() {\r\n      var sides = regular.getSides() -1;\r\n      if (sides < 2) sides = 2;\r\n      regular.setSides (sides);\r\n      text.textContent = sides>2 ? sides+' '+label.pts : label.circle;\r\n    }.bind(this));\r\n    var text = ol.ext.element.create('TEXT', { html:'4 '+label.pts, parent: div });\r\n    var up = ol.ext.element.create('DIV', { parent: div });\r\n    ol.ext.element.addListener(up, ['click', 'touchstart'], function() {\r\n      var sides = regular.getSides() +1;\r\n      if (sides<3) sides=3;\r\n      regular.setSides(sides);\r\n      text.textContent = sides+' '+label.pts;\r\n    }.bind(this));\r\n    var ctrl = new ol.control.Toggle({\r\n      className: 'ol-drawregular',\r\n      title: this._getTitle(options.interactions.DrawRegular) || 'Regular',\r\n      name: 'DrawRegular',\r\n      interaction: this._interactions.DrawRegular,\r\n      // Options bar associated with the control\r\n      bar: new ol.control.Bar ({\r\n        controls:[ \r\n          new ol.control.TextButton({\r\n            html: div\r\n          })\r\n        ]\r\n      }) \r\n    });\r\n    this.addControl (ctrl);\r\n  }\r\n};\r\n/**\r\n * @private\r\n */\r\nol.control.EditBar.prototype._setDrawPolygon = function (className, interaction, title, name, options) {\r\n  var fedit = new ol.control.Toggle ({\r\n    className: className,\r\n    name: name,\r\n    title: title,\r\n    interaction: interaction,\r\n    // Options bar associated with the control\r\n    bar: new ol.control.Bar({\r\n      controls:[ \r\n        new ol.control.TextButton ({\r\n          html: this._getTitle(options.interactions.UndoDraw) || 'undo',\r\n          title: this._getTitle(options.interactions.UndoDraw) || 'undo last point',\r\n          handleClick: function(){\r\n            if (fedit.getInteraction().nbpts>1) fedit.getInteraction().removeLastPoint();\r\n          }\r\n        }),\r\n        new ol.control.TextButton({\r\n          html: this._getTitle(options.interactions.FinishDraw) || 'finish',\r\n          title: this._getTitle(options.interactions.FinishDraw) || 'finish',\r\n          handleClick: function() {\r\n            // Prevent null objects on finishDrawing\r\n            if (fedit.getInteraction().nbpts>3) fedit.getInteraction().finishDrawing();\r\n          }\r\n        })\r\n      ]\r\n    }) \r\n  });\r\n  this.addControl (fedit);\r\n  return fedit;\r\n};\r\n/** Add modify tools\r\n * @private\r\n */ \r\nol.control.EditBar.prototype._setModifyInteraction = function (options) {\r\n  // Modify on selected features\r\n  if (options.interactions.ModifySelect !== false && options.interactions.Select !== false) {\r\n    if (options.interactions.ModifySelect instanceof ol.interaction.ModifyFeature) {\r\n      this._interactions.ModifySelect = options.interactions.ModifySelect;\r\n    } else {\r\n      this._interactions.ModifySelect = new ol.interaction.ModifyFeature({\r\n        features: this.getInteraction('Select').getFeatures()\r\n      });\r\n    }\r\n    if (this.getMap()) this.getMap().addInteraction(this._interactions.ModifySelect);\r\n    // Activate with select\r\n    this._interactions.ModifySelect.setActive(this._interactions.Select.getActive());\r\n    this._interactions.Select.on('change:active', function() {\r\n      this._interactions.ModifySelect.setActive(this._interactions.Select.getActive());\r\n    }.bind(this));\r\n  }\r\n  if (options.interactions.Transform !== false) {\r\n    if (options.interactions.Transform instanceof ol.interaction.Transform) {\r\n      this._interactions.Transform = options.interactions.Transform;\r\n    } else {\r\n      this._interactions.Transform = new ol.interaction.Transform ({\r\n        addCondition: ol.events.condition.shiftKeyOnly\r\n      });\r\n    }\r\n    var transform = new ol.control.Toggle ({\r\n      html: '<i></i>',\r\n      className: 'ol-transform',\r\n      title: this._getTitle(options.interactions.Transform) || 'Transform',\r\n      name: 'Transform',\r\n      interaction: this._interactions.Transform\r\n    });\r\n    this.addControl (transform);\r\n  }\r\n  if (options.interactions.Split !== false) {\r\n    if (options.interactions.Split instanceof ol.interaction.Split) {\r\n      this._interactions.Split = options.interactions.Split;\r\n    } else {\r\n      this._interactions.Split = new ol.interaction.Split ({\r\n          sources: this._source\r\n      });\r\n    }\r\n    var split = new ol.control.Toggle ({\r\n      className: 'ol-split',\r\n      title: this._getTitle(options.interactions.Split) || 'Split',\r\n      name: 'Split', \r\n      interaction: this._interactions.Split\r\n    });\r\n    this.addControl (split);\r\n  }\r\n  if (options.interactions.Offset !== false) {\r\n    if (options.interactions.Offset instanceof ol.interaction.Offset) {\r\n      this._interactions.Offset = options.interactions.Offset;\r\n    } else {\r\n      this._interactions.Offset = new ol.interaction.Offset ({\r\n          source: this._source\r\n      });\r\n    }\r\n    var offset = new ol.control.Toggle ({\r\n      html: '<i></i>',\r\n      className: 'ol-offset',\r\n      title: this._getTitle(options.interactions.Offset) || 'Offset',\r\n      name: 'Offset',\r\n      interaction: this._interactions.Offset\r\n    });\r\n    this.addControl (offset);\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A simple gauge control to display level information on the map.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n *  @param {String} options.className class of the control\r\n *  @param {String} options.title title of the control\r\n *  @param {number} options.max maximum value, default 100;\r\n *  @param {number} options.val the value, default 0\r\n */\r\nol.control.Gauge = function(options) {\r\n  options = options || {};\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: ((options.className||\"\") + ' ol-gauge ol-unselectable ol-control').trim()\r\n  });\r\n  this.title_ = ol.ext.element.create('SPAN', {\r\n    parent: element\r\n  });\r\n  var div =  ol.ext.element.create('DIV', {\r\n    parent: element\r\n  });\r\n  this.gauge_ = ol.ext.element.create('BUTTON', {\r\n    type: 'button',\r\n    style: { width: '0px' },\r\n    parent: div\r\n  });\r\n  /*\r\n  var element = document.createElement(\"div\");\r\n  element.className = ((options.className||\"\") + ' ol-gauge ol-unselectable ol-control').trim();\r\n  this.title_ = document.createElement(\"span\");\r\n  element.appendChild(this.title_);\r\n  this.gauge_ = document.createElement(\"button\");\r\n  this.gauge_.setAttribute('type','button');\r\n  element.appendChild(document.createElement(\"div\").appendChild(this.gauge_))\r\n  this.gauge_.style.width = '0px';\r\n  */\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.setTitle(options.title);\r\n  this.set(\"max\", options.max||100);\r\n  this.val(options.val);\r\n};\r\nol.ext.inherits(ol.control.Gauge, ol.control.Control);\r\n/** Set the control title\r\n* @param {string} title\r\n*/\r\nol.control.Gauge.prototype.setTitle = function(title) {\r\n  this.title_.innerHTML = title||\"\";\r\n  if (!title) this.title_.display = 'none';\r\n  else this.title_.display = '';\r\n};\r\n/** Set/get the gauge value\r\n* @param {number|undefined} v the value or undefined to get it\r\n* @return {number} the value\r\n*/\r\nol.control.Gauge.prototype.val = function(v) {\r\n  if (v!==undefined) {\r\n    this.val_ = v;\r\n    this.gauge_.style.width = (v/this.get('max')*100)+\"%\";\r\n  }\r\n  return this.val_;\r\n};\r\n\r\n/** Bookmark positions on ol maps.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fires add\r\n * @fires remove\r\n * @fires select\r\n * @param {} options Geobookmark's options\r\n *  @param {string} options.className default ol-bookmark\r\n *  @param {string | undefined} options.title Title to use for the button tooltip, default \"Geobookmarks\"\r\n *  @param {string} options.placeholder input placeholder, default Add a new geomark...\r\n *  @param {string} [options.deleteTitle='Suppr.'] title for delete buttons\r\n *  @param {bool} options.editable enable modification, default true\r\n *  @param {string} options.namespace a namespace to save the boolmark (if more than one on a page), default ol\r\n *  @param {Array<any>} options.marks a list of default bookmarks: \r\n * @see [Geobookmark example](../../examples/control/map.control.geobookmark.html)\r\n * @example \r\nvar bm = new GeoBookmark ({ \r\n  marks: {\r\n    \"Paris\": {pos:ol.proj.transform([2.351828, 48.856578], 'EPSG:4326', 'EPSG:3857'), zoom:11, permanent: true },\r\n    \"London\": {pos:ol.proj.transform([-0.1275,51.507222], 'EPSG:4326', 'EPSG:3857'), zoom:12}\r\n  }\r\n});\r\n */\r\nol.control.GeoBookmark = function(options) {\r\n  options = options || {};\r\n  var self = this;\r\n  var element = document.createElement('div');\r\n  if (options.target) {\r\n    element.className = options.className || \"ol-bookmark\";\r\n  } else {\r\n    element.className = (options.className || \"ol-bookmark\") +\r\n          \" ol-unselectable ol-control ol-collapsed\";\r\n    element.addEventListener(\"mouseleave\", function() {\r\n      if (input !== document.activeElement) {\r\n        menu.style.display = 'none';\r\n      }\r\n    });\r\n    // Show bookmarks on click\r\n    this.button = ol.ext.element.create('BUTTON', {\r\n      type: 'button',\r\n      title: options.title || 'Geobookmarks',\r\n      click: function() {\r\n        var show = (menu.style.display === '' || menu.style.display === 'none');\r\n        menu.style.display = (show ? 'block': 'none');\r\n        if (show) this.setBookmarks();\r\n      }.bind(this)\r\n    });\r\n    element.appendChild(this.button);\r\n  }\r\n  // The menu\r\n  var menu = document.createElement('div');\r\n  element.appendChild(menu);\r\n  var ul = document.createElement('ul');\r\n  menu.appendChild(ul);\r\n  var input = document.createElement('input');\r\n  input.setAttribute(\"placeholder\", options.placeholder || \"Add a new geomark...\")\r\n  input.addEventListener(\"keydown\", function(e) {\r\n    e.stopPropagation();\r\n    if (e.keyCode === 13) {\r\n      e.preventDefault();\r\n      var title = this.value;\r\n      if (title) {\r\n        self.addBookmark(title);\r\n        this.value = '';\r\n        self.dispatchEvent({\r\n          type: \"add\",\r\n          name: title\r\n        });\r\n      }\r\n      menu.style.display = 'none';\r\n    }\r\n  });\r\n  input.addEventListener(\"blur\", function() {\r\n    menu.style.display = 'none';\r\n  });\r\n  menu.appendChild(input);\r\n  // Init\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.on(\"propertychange\", function(e) {\r\n    if (e.key==='editable') {\r\n      element.className = element.className.replace(\" ol-editable\",\"\");\r\n      if (this.get('editable')) {\r\n        element.className += \" ol-editable\";\r\n      }\r\n    }\r\n    // console.log(e);\r\n  }.bind(this));\r\n  this.set(\"namespace\", options.namespace || 'ol');\r\n  this.set(\"editable\", options.editable !== false);\r\n  this.set('deleteTitle', options.deleteTitle || 'Suppr.');\r\n  // Set default bmark\r\n  var bmark = {};\r\n  try {\r\n    if (localStorage[this.get('namespace')+\"@bookmark\"]) {\r\n      bmark = JSON.parse(localStorage[this.get('namespace')+\"@bookmark\"]);\r\n    }\r\n  } catch(e) { console.warn('Failed to access localStorage...'); }\r\n  if (options.marks) {\r\n    for (var i in options.marks) {\r\n      bmark[i] = options.marks[i];\r\n    }\r\n  }\r\n  this.setBookmarks(bmark);\r\n};\r\nol.ext.inherits(ol.control.GeoBookmark, ol.control.Control);\r\n/** Set bookmarks\r\n * @param {} bmark a list of bookmarks, default retreave in the localstorage\r\n * @example \r\nbm.setBookmarks({ \r\n  \"Paris\": {pos:_ol_proj_.transform([2.351828, 48.856578], 'EPSG:4326', 'EPSG:3857'), zoom:11, permanent: true },\r\n  \"London\": {pos:_ol_proj_.transform([-0.1275,51.507222], 'EPSG:4326', 'EPSG:3857'), zoom:12}\r\n});\r\n */\r\nol.control.GeoBookmark.prototype.setBookmarks = function(bmark) {\r\n  if (!bmark) {\r\n    bmark = {};\r\n    try {\r\n      bmark = JSON.parse(localStorage[this.get('namespace')+\"@bookmark\"] || \"{}\");\r\n    } catch(e) { console.warn('Failed to access localStorage...'); }\r\n  }\r\n  var modify = this.get(\"editable\");\r\n  var ul = this.element.querySelector(\"ul\");\r\n  var menu = this.element.querySelector(\"div\");\r\n  var self = this;\r\n  ul.innerHTML = '';\r\n  for (var b in bmark) {\r\n    var li = document.createElement('li');\r\n    li.textContent = b;\r\n    li.setAttribute('data-bookmark', JSON.stringify(bmark[b]));\r\n    li.setAttribute('data-name', b);\r\n    li.addEventListener('click', function() {\r\n      var bm = JSON.parse(this.getAttribute(\"data-bookmark\"));\r\n      self.getMap().getView().setCenter(bm.pos);\r\n      self.getMap().getView().setZoom(bm.zoom);\r\n      self.getMap().getView().setRotation(bm.rot || 0);\r\n      menu.style.display = 'none';\r\n      self.dispatchEvent({ type: 'select', name: this.getAttribute(\"data-name\"), bookmark: bm });\r\n    });\r\n    ul.appendChild(li);\r\n    if (modify && !bmark[b].permanent) {\r\n      var button = document.createElement('button');\r\n      button.setAttribute('data-name', b);\r\n      button.setAttribute('type', 'button');\r\n      button.setAttribute('title', this.get('deleteTitle') ||'Suppr.');\r\n      button.addEventListener('click', function(e) {\r\n        self.removeBookmark(this.getAttribute(\"data-name\"));\r\n        self.dispatchEvent({ type: \"remove\", name: this.getAttribute(\"data-name\") });\r\n        e.stopPropagation();\r\n      });\r\n      li.appendChild(button);\r\n    }\r\n  }\r\n  try {\r\n    localStorage[this.get('namespace')+\"@bookmark\"] = JSON.stringify(bmark);\r\n  } catch(e) { console.warn('Failed to access localStorage...'); }\r\n};\r\n/** Get Geo bookmarks\r\n * @return {any} a list of bookmarks : { BM1:{pos:ol.coordinates, zoom: integer}, BM2:{pos:ol.coordinates, zoom: integer} }\r\n */\r\nol.control.GeoBookmark.prototype.getBookmarks = function() {\r\n  var bm = {};\r\n  try {\r\n    bm = JSON.parse(localStorage[this.get('namespace')+\"@bookmark\"] || \"{}\");\r\n  } catch(e) { console.warn('Failed to access localStorage...'); }\r\n  return bm;\r\n};\r\n/** Remove a Geo bookmark\r\n * @param {string} name\r\n */\r\nol.control.GeoBookmark.prototype.removeBookmark = function(name) {\r\n  if (!name) {\r\n    return;\r\n  }\r\n  var bmark = this.getBookmarks();\r\n  delete bmark[name];\r\n  this.setBookmarks(bmark);\r\n};\r\n/** Add a new Geo bookmark (replace existing one if any)\r\n * @param {string} name name of the bookmark (display in the menu)\r\n * @param {*} options\r\n *  @param {ol.coordinate} position default current position\r\n *  @param {number} zoom default current map zoom\r\n *  @param {number} rotation default current map rotation\r\n *  @param {bool} permanent prevent from deletion, default false\r\n */\r\nol.control.GeoBookmark.prototype.addBookmark = function(name, position, zoom, permanent) {\r\n  if (!name) return;\r\n  var options = position;\r\n  var rot;\r\n  if (options && options.position) {\r\n    zoom = options.zoom;\r\n    permanent = options.permanent;\r\n    rot = options.rotation ;\r\n    position = options.position;\r\n  } else {\r\n    rot = this.getMap().getView().getRotation();\r\n  }\r\n  var bmark = this.getBookmarks();\r\n  // Don't override permanent bookmark\r\n  if (bmark[name] && bmark[name].permanent) return;\r\n  // Create or override\r\n  bmark[name] = {\r\n    pos: position || this.getMap().getView().getCenter(),\r\n    zoom: zoom || this.getMap().getView().getZoom(),\r\n    permanent: !!permanent\r\n  };\r\n  if (rot) {\r\n    bmark[name].rot = rot;\r\n  }\r\n  this.setBookmarks(bmark);\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO,\r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Geolocation bar\r\n * The control bar is a container for other controls. It can be used to create toolbars.\r\n * Control bars can be nested and combined with ol.control.Toggle to handle activate/deactivate.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Bar}\r\n * @param {Object=} options Control bar options.\r\n *  @param {String} options.className class of the control\r\n *  @param {String} options.centerLabel label for center button, default center\r\n *  @param {String} options.position position of the control, default bottom-right\r\n */\r\nol.control.GeolocationBar = function(options) {\r\n  if (!options) options = {};\r\n  options.className = options.className || 'ol-geobar';\r\n  ol.control.Bar.call(this, options);\r\n  this.setPosition(options.position || 'bottom-right');\r\n  var element = this.element;\r\n  // Geolocation draw interaction\r\n  var interaction = new ol.interaction.GeolocationDraw({\r\n    source: options.source,\r\n    zoom: options.zoom,\r\n    minZoom: options.minZoom,\r\n    tolerance: options.tolerance,\r\n    followTrack: options.followTrack,\r\n    minAccuracy: options.minAccuracy || 10000\r\n  });\r\n  this._geolocBt = new ol.control.Toggle ({\r\n    className: 'geolocBt',\r\n    interaction: interaction,\r\n    onToggle: function() {\r\n      interaction.pause(true);\r\n      interaction.setFollowTrack(options.followTrack);\r\n      element.classList.remove('pauseTrack');\r\n    }\r\n  });\r\n  this.addControl(this._geolocBt);\r\n  this._geolocBt.setActive(false);\r\n  // Buttons\r\n  var bar = new ol.control.Bar();\r\n  this.addControl(bar);\r\n  var centerBt = new ol.control.TextButton ({\r\n    className: 'centerBt',\r\n    html: options.centerLabel ||'center',\r\n    handleClick: function() {\r\n      interaction.setFollowTrack('auto');\r\n    }\r\n  });\r\n  bar.addControl(centerBt);\r\n  var startBt = new ol.control.Button ({\r\n    className: 'startBt',\r\n    handleClick: function(){\r\n      interaction.pause(false);\r\n      interaction.setFollowTrack('auto');\r\n      element.classList.add('pauseTrack');\r\n    }\r\n  });\r\n  bar.addControl(startBt);\r\n  var pauseBt = new ol.control.Button ({\r\n    className: 'pauseBt',\r\n    handleClick: function(){\r\n      interaction.pause(true);\r\n      interaction.setFollowTrack('auto');\r\n      element.classList.remove('pauseTrack');\r\n    }\r\n  });\r\n  bar.addControl(pauseBt);\r\n  interaction.on('follow', function(e) {\r\n    if (e.following) {\r\n      element.classList.remove('centerTrack');\r\n    } else {\r\n      element.classList.add('centerTrack');\r\n    }\r\n  });\r\n  // Activate\r\n  this._geolocBt.on('change:active', function(e) {\r\n    if (e.active) {\r\n      element.classList.add('ol-active');\r\n    } else {\r\n      element.classList.remove('ol-active');\r\n    }\r\n  });\r\n};\r\nol.ext.inherits(ol.control.GeolocationBar, ol.control.Bar);\r\n/**\r\n * Remove the control from its current map and attach it to the new map.\r\n * Subclasses may set up event handlers to get notified about changes to\r\n * the map here.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.control.GeolocationBar.prototype.setMap = function (map) {\r\n  if (this._listener) ol.Observable.unByKey(this._listener);\r\n  this._listener = null;\r\n  ol.control.Bar.prototype.setMap.call(this, map);\r\n  // Get change (new layer added or removed)\r\n  if (map) {\r\n    this._listener = map.on('moveend', function() {\r\n      var geo = this.getInteraction();\r\n      if (geo.getActive() && geo.get('followTrack') === 'auto' && geo.path_.length) {\r\n        if (geo.path_[geo.path_.length-1][0] !== map.getView().getCenter()[0]) {\r\n          this.element.classList.add('centerTrack');\r\n        }\r\n      }\r\n    }.bind(this));\r\n  }\r\n};\r\n/** Get the ol.interaction.GeolocationDraw associatedwith the bar\r\n * @return {ol.interaction.GeolocationDraw}\r\n */\r\nol.control.GeolocationBar.prototype.getInteraction = function () {\r\n  return this._geolocBt.getInteraction();\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO,\r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Geolocation bar\r\n * The control bar is a container for other controls. It can be used to create toolbars.\r\n * Control bars can be nested and combined with ol.control.Toggle to handle activate/deactivate.\r\n *\r\n * @constructor\r\n * @fires tracking\r\n * @extends {ol.control.Toggle}\r\n * @param {Object=} options ol.interaction.GeolocationDraw option.\r\n *  @param {String} options.className class of the control\r\n *  @param {String} options.title title of the control to display as tooltip, default Geolocation\r\n *  @param {number} options.delay delay before removing the location in ms, delfaut 3000 (3s)\r\n */\r\nol.control.GeolocationButton = function(options) {\r\n  if (!options) options = {};\r\n  // Geolocation draw interaction\r\n  options.followTrack = options.followTrack || 'auto';\r\n  options.zoom = options.zoom || 16;\r\n  //options.minZoom = options.minZoom || 16;\r\n  var interaction = new ol.interaction.GeolocationDraw(options);\r\n  ol.control.Toggle.call (this, {\r\n    className: options.className = ((options.className || '') + ' ol-geobt').trim(),\r\n    interaction: interaction,\r\n    title: options.title || 'Geolocation',\r\n    onToggle: function() {\r\n      interaction.pause(true);\r\n      interaction.setFollowTrack(options.followTrack || 'auto');\r\n    }\r\n  });\r\n  this.setActive(false);\r\n  interaction.on('tracking', function(e) {\r\n    this.dispatchEvent({ type: 'position', coordinate: e.geolocation.getPosition() });\r\n  }.bind(this));\r\n  // Timeout delay\r\n  var tout;\r\n  interaction.on('change:active', function() {\r\n    this.dispatchEvent({ type:'position' });\r\n    if (tout) {\r\n      clearTimeout(tout);\r\n      tout = null;\r\n    }\r\n    if (interaction.getActive()) {\r\n      tout = setTimeout(function() {\r\n        interaction.setActive(false);\r\n        tout = null;\r\n      }.bind(this), options.delay || 3000);\r\n    }\r\n  }.bind(this));\r\n};\r\nol.ext.inherits(ol.control.GeolocationButton, ol.control.Toggle);\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * OpenLayers 3 lobe Overview Control.\r\n * The globe can rotate with map (follow.) \r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n * \t@param {boolean} follow follow the map when center change, default false\r\n * \t@param {top|bottom-left|right} align position as top-left, etc.\r\n * \t@param {Array<ol.layer>} layers list of layers to display on the globe\r\n * \t@param {ol.style.Style | Array.<ol.style.Style> | undefined} style style to draw the position on the map , default a marker\r\n */\r\nol.control.Globe = function(opt_options)\r\n{\tvar options = opt_options || {};\r\n\tvar self = this;\r\n\t// API\r\n\tvar element;\r\n\tif (options.target)\r\n\t{\telement = document.createElement(\"div\");\r\n\t\tthis.panel_ = options.target;\r\n\t}\r\n\telse\r\n\t{\telement = document.createElement(\"div\");\r\n\t\telement.classList.add('ol-globe', 'ol-unselectable', 'ol-control');\r\n\t\tif (/top/.test(options.align)) element.classList.add('ol-control-top');\r\n\t\tif (/right/.test(options.align)) element.classList.add('ol-control-right');\r\n\t\tthis.panel_ = document.createElement(\"div\");\r\n\t\tthis.panel_.classList.add(\"panel\")\r\n\t\telement.appendChild(this.panel_);\r\n\t\tthis.pointer_ = document.createElement(\"div\");\r\n\t\tthis.pointer_.classList.add(\"ol-pointer\");\r\n\t\telement.appendChild(this.pointer_);\r\n\t}\r\n\tol.control.Control.call(this,\r\n\t{\telement: element,\r\n\t\ttarget: options.target\r\n\t});\r\n// http://openlayers.org/en/latest/examples/sphere-mollweide.html ???\r\n\t// Create a globe map\r\n\tthis.ovmap_ = new ol.Map(\r\n\t{\tcontrols: new ol.Collection(),\r\n\t\tinteractions: new ol.Collection(),\r\n\t\ttarget: this.panel_,\r\n\t\tview: new ol.View\r\n\t\t\t({\tzoom: 0,\r\n\t\t\t\tcenter: [0,0]\r\n\t\t\t}),\r\n\t\tlayers: options.layers\r\n\t});\r\n\tsetTimeout (function()\r\n\t{\tself.ovmap_.updateSize(); \r\n\t}, 0);\r\n\tthis.set('follow', options.follow || false);\r\n\t// Cache extent\r\n\tthis.extentLayer = new ol.layer.Vector(\r\n\t{\tname: 'Cache extent',\r\n\t\tsource: new ol.source.Vector(),\r\n\t\tstyle: options.style || [new ol.style.Style(\r\n\t\t\t\t\t{\timage: new ol.style.Circle(\r\n\t\t\t\t\t\t{\tfill: new ol.style.Fill({\r\n\t\t\t\t\t\t\t\tcolor: 'rgba(255,0,0, 1)'\r\n\t\t\t\t\t\t\t}),\r\n\t\t\t\t\t\t\tstroke: new ol.style.Stroke(\r\n\t\t\t\t\t\t\t{\twidth: 7,\r\n\t\t\t\t\t\t\t\tcolor: 'rgba(255,0,0, 0.8)'\r\n\t\t\t\t\t\t\t}),\r\n\t\t\t\t\t\t\tradius: 5\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t}\r\n\t\t\t\t)]\r\n\t})\r\n\tthis.ovmap_.addLayer(this.extentLayer);\r\n};\r\nol.ext.inherits(ol.control.Globe, ol.control.Control);\r\n/**\r\n * Set the map instance the control associated with.\r\n * @param {ol.Map} map The map instance.\r\n */\r\nol.control.Globe.prototype.setMap = function(map) {\r\n\tif (this._listener) ol.Observable.unByKey(this._listener);\r\n\tthis._listener = null;\r\n\tol.control.Control.prototype.setMap.call(this, map);\r\n\t// Get change (new layer added or removed)\r\n\tif (map) \r\n\t{\tthis._listener = map.getView().on('propertychange', this.setView.bind(this));\r\n\t\tthis.setView();\r\n\t}\r\n};\r\n/** Set the globe center with the map center\r\n*/\r\nol.control.Globe.prototype.setView = function()\r\n{\tif (this.getMap() && this.get('follow'))\r\n\t{\tthis.setCenter(this.getMap().getView().getCenter());\r\n\t}\r\n}\r\n/** Get globe map\r\n*\t@return {ol.Map}\r\n*/\r\nol.control.Globe.prototype.getGlobe = function()\r\n{\treturn this.ovmap_;\r\n}\r\n/** Show/hide the globe\r\n*/\r\nol.control.Globe.prototype.show = function(b)\r\n{\tif (b!==false) this.element.classList.remove(\"ol-collapsed\");\r\n\telse this.element.classList.add(\"ol-collapsed\");\r\n\tthis.ovmap_.updateSize();\r\n}\r\n/** Set position on the map\r\n*\t@param {top|bottom-left|right}  align\r\n*/\r\nol.control.Globe.prototype.setPosition = function(align)\r\n{\tif (/top/.test(align)) this.element.classList.add(\"ol-control-top\");\r\n\telse this.element.classList.remove(\"ol-control-top\");\r\n\tif (/right/.test(align)) this.element.classList.add(\"ol-control-right\");\r\n\telse this.element.classList.remove(\"ol-control-right\");\r\n}\r\n/** Set the globe center\r\n* @param {_ol_coordinate_} center the point to center to\r\n* @param {boolean} show show a pointer on the map, defaylt true\r\n*/\r\nol.control.Globe.prototype.setCenter = function (center, show)\r\n{\tvar self = this;\r\n\tthis.pointer_.classList.add(\"hidden\");\r\n\tif (center)\r\n\t{\tvar map = this.ovmap_;\r\n\t\tvar p = map.getPixelFromCoordinate(center);\r\n\t\tif (p) {\r\n\t\t\tif (show!==false) {\r\n\t\t\t\tvar h = this.element.clientHeight;\r\n\t\t\t\tsetTimeout(function() {\r\n\t\t\t\t\tself.pointer_.style.top = String(Math.min(Math.max(p[1],0),h)) + 'px';\r\n\t\t\t\t\tself.pointer_.style.left = \"50%\";\r\n\t\t\t\t\tself.pointer_.classList.remove(\"hidden\");\r\n\t\t\t\t}, 800);\r\n\t\t\t}\r\n\t\t\tmap.getView().animate({ center: [center[0],0] });\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Draw a graticule on the map.\r\n *\r\n * @constructor\r\n * @extends {ol.control.CanvasBase}\r\n * @param {Object=} _ol_control_ options.\r\n *  @param {ol.projectionLike} options.projection projection to use for the graticule, default EPSG:4326 \r\n *  @param {number} options.maxResolution max resolution to display the graticule\r\n *  @param {ol.style.Style} options.style Style to use for drawing the graticule, default black.\r\n *  @param {number} options.step step beetween lines (in proj units), default 1\r\n *  @param {number} options.stepCoord show a coord every stepCoord, default 1\r\n *  @param {number} options.spacing spacing beetween lines (in px), default 40px \r\n *  @param {number} options.borderWidth width of the border (in px), default 5px \r\n *  @param {number} options.margin margin of the border (in px), default 0px \r\n *  @param {number} options.formatCoord a function that takes a coordinate and a position and return the formated coordinate\r\n */\r\nol.control.Graticule = function(options) {\r\n  if (!options) options = {};\r\n  // Initialize parent\r\n  var elt = document.createElement(\"div\");\r\n  elt.className = \"ol-graticule ol-unselectable ol-hidden\";\r\n  ol.control.CanvasBase.call(this, { element: elt });\r\n  this.set('projection', options.projection || 'EPSG:4326');\r\n  // Use to limit calculation \r\n  var p = new ol.proj.Projection({code:this.get('projection')});\r\n  var m = p.getMetersPerUnit();\r\n  this.fac = 1;\r\n  while (m/this.fac>10) {\r\n    this.fac *= 10;\r\n  }\r\n  this.fac = 10000/this.fac;\r\n  this.set('maxResolution', options.maxResolution || Infinity);\r\n  this.set('step', options.step || 0.1);\r\n  this.set('stepCoord', options.stepCoord || 1);\r\n  this.set('spacing', options.spacing || 40);\r\n  this.set('margin', options.margin || 0);\r\n  this.set('borderWidth', options.borderWidth || 5);\r\n  this.set('stroke', options.stroke!==false);\r\n  this.formatCoord = options.formatCoord || function(c){return c;};\r\n  if (options.style instanceof ol.style.Style) {\r\n    this.setStyle(options.style);\r\n  }\r\n  else {\r\n    this.setStyle(new ol.style.Style({\r\n      stroke: new ol.style.Stroke({ color:\"#000\", width:1 }),\r\n      fill: new ol.style.Fill({ color: \"#fff\" }),\r\n      text: new ol.style.Text({\r\n        stroke: new ol.style.Stroke({ color:\"#fff\", width:2 }),\r\n        fill: new ol.style.Fill({ color:\"#000\" }),\r\n      }) \r\n    }));\r\n  }\r\n};\r\nol.ext.inherits(ol.control.Graticule, ol.control.CanvasBase);\r\nol.control.Graticule.prototype.setStyle = function (style) {\r\n  this._style = style;\r\n};\r\nol.control.Graticule.prototype._draw = function (e) {\r\n  if (this.get('maxResolution')<e.frameState.viewState.resolution) return;\r\n  var ctx = this.getContext(e);\r\n  var canvas = ctx.canvas;\r\n  var ratio = e.frameState.pixelRatio;\r\n  var w = canvas.width/ratio;\r\n  var h = canvas.height/ratio;\r\n  var proj = this.get('projection');\r\n  var map = this.getMap();\r\n  var bbox = \r\n  [\tmap.getCoordinateFromPixel([0,0]),\r\n    map.getCoordinateFromPixel([w,0]),\r\n    map.getCoordinateFromPixel([w,h]),\r\n    map.getCoordinateFromPixel([0,h])\r\n  ];\r\n  var xmax = -Infinity;\r\n  var xmin = Infinity;\r\n  var ymax = -Infinity;\r\n  var ymin = Infinity;\r\n  for (var i=0, c; c=bbox[i]; i++)\r\n  {\tbbox[i] = ol.proj.transform (c, map.getView().getProjection(), proj);\r\n    xmax = Math.max (xmax, bbox[i][0]);\r\n    xmin = Math.min (xmin, bbox[i][0]);\r\n    ymax = Math.max (ymax, bbox[i][1]);\r\n    ymin = Math.min (ymin, bbox[i][1]);\r\n  }\r\n  var spacing = this.get('spacing');\r\n  var step = this.get('step');\r\n  var step2 = this.get('stepCoord');\r\n  var borderWidth = this.get('borderWidth');\r\n  var margin = this.get('margin');\r\n  // Limit max line draw\r\n  var ds = (xmax-xmin)/step*spacing;\r\n  if (ds>w) \r\n  {\tvar dt = Math.round((xmax-xmin)/w*spacing /step);\r\n    step *= dt;\r\n    if (step>this.fac) step = Math.round(step/this.fac)*this.fac;\r\n  }\r\n  xmin = (Math.floor(xmin/step))*step -step;\r\n  ymin = (Math.floor(ymin/step))*step -step;\r\n  xmax = (Math.floor(xmax/step))*step +2*step;\r\n  ymax = (Math.floor(ymax/step))*step +2*step;\r\n  var extent = ol.proj.get(proj).getExtent();\r\n  if (extent)\r\n  {\tif (xmin < extent[0]) xmin = extent[0];\r\n    if (ymin < extent[1]) ymin = extent[1];\r\n    if (xmax > extent[2]) xmax = extent[2]+step;\r\n    if (ymax > extent[3]) ymax = extent[3]+step;\r\n  }\r\n  var hasLines = this.getStyle().getStroke() && this.get(\"stroke\");\r\n  var hasText = this.getStyle().getText();\r\n  var hasBorder = this.getStyle().getFill();\r\n  ctx.save();\r\n    ctx.scale(ratio,ratio);\r\n    ctx.beginPath();\r\n    ctx.rect(margin, margin, w-2*margin, h-2*margin);\r\n    ctx.clip();\r\n    ctx.beginPath();\r\n    var txt = {top:[],left:[],bottom:[], right:[]};\r\n    var x, y, p, p0, p1;\r\n    for (x=xmin; x<xmax; x += step)\r\n    {\tp0 = ol.proj.transform ([x, ymin], proj, map.getView().getProjection());\r\n      p0 = map.getPixelFromCoordinate(p0);\r\n      if (hasLines) ctx.moveTo(p0[0], p0[1]);\r\n      p = p0;\r\n      for (y=ymin+step; y<=ymax; y+=step)\r\n      {\tp1 = ol.proj.transform ([x, y], proj, map.getView().getProjection());\r\n        p1 = map.getPixelFromCoordinate(p1);\r\n        if (hasLines) ctx.lineTo(p1[0], p1[1]);\r\n        if (p[1]>0 && p1[1]<0) txt.top.push([x, p]);\r\n        if (p[1]>h && p1[1]<h) txt.bottom.push([x,p]);\r\n        p = p1;\r\n      }\r\n    }\r\n    for (y=ymin; y<ymax; y += step)\r\n    {\tp0 = ol.proj.transform ([xmin, y], proj, map.getView().getProjection());\r\n      p0 = map.getPixelFromCoordinate(p0);\r\n      if (hasLines) ctx.moveTo(p0[0], p0[1]);\r\n      p = p0;\r\n      for (x=xmin+step; x<=xmax; x+=step)\r\n      {\tp1 = ol.proj.transform ([x, y], proj, map.getView().getProjection());\r\n        p1 = map.getPixelFromCoordinate(p1);\r\n        if (hasLines) ctx.lineTo(p1[0], p1[1]);\r\n        if (p[0]<0 && p1[0]>0) txt.left.push([y,p]);\r\n        if (p[0]<w && p1[0]>w) txt.right.push([y,p]);\r\n        p = p1;\r\n      }\r\n    }\r\n    if (hasLines)\r\n    {\tctx.strokeStyle = this.getStyle().getStroke().getColor();\r\n      ctx.lineWidth = this.getStyle().getStroke().getWidth();\r\n      ctx.stroke();\r\n    }\r\n    // Draw text\r\n    if (hasText)\r\n    {\r\n      ctx.fillStyle = this.getStyle().getText().getFill().getColor();\r\n      ctx.strokeStyle = this.getStyle().getText().getStroke().getColor();\r\n      ctx.lineWidth = this.getStyle().getText().getStroke().getWidth();\r\n      ctx.font = this.getStyle().getText().getFont();\r\n      ctx.textAlign = 'center';\r\n      ctx.textBaseline = 'hanging';\r\n      var t, tf;\r\n      var offset = (hasBorder ? borderWidth : 0) + margin + 2;\r\n      for (i=0; t = txt.top[i]; i++) if (!(Math.round(t[0]/this.get('step'))%step2))\r\n      {\ttf = this.formatCoord(t[0], 'top');\r\n        ctx.strokeText(tf, t[1][0], offset);\r\n        ctx.fillText(tf, t[1][0], offset);\r\n      }\r\n      ctx.textBaseline = 'alphabetic';\r\n      for (i=0; t = txt.bottom[i]; i++) if (!(Math.round(t[0]/this.get('step'))%step2))\r\n      {\ttf = this.formatCoord(t[0], 'bottom');\r\n        ctx.strokeText(tf, t[1][0], h-offset);\r\n        ctx.fillText(tf, t[1][0], h-offset);\r\n      }\r\n      ctx.textBaseline = 'middle';\r\n      ctx.textAlign = 'left';\r\n      for (i=0; t = txt.left[i]; i++) if (!(Math.round(t[0]/this.get('step'))%step2))\r\n      {\ttf = this.formatCoord(t[0], 'left');\r\n        ctx.strokeText(tf, offset, t[1][1]);\r\n        ctx.fillText(tf, offset, t[1][1]);\r\n      }\r\n      ctx.textAlign = 'right';\r\n      for (i=0; t = txt.right[i]; i++) if (!(Math.round(t[0]/this.get('step'))%step2))\r\n      {\ttf = this.formatCoord(t[0], 'right');\r\n        ctx.strokeText(tf, w-offset, t[1][1]);\r\n        ctx.fillText(tf, w-offset, t[1][1]);\r\n      }\r\n    }\r\n    // Draw border\r\n    if (hasBorder)\r\n    {\tvar fillColor = this.getStyle().getFill().getColor();\r\n      var color, stroke;\r\n      if (stroke = this.getStyle().getStroke())\r\n      {\tcolor = this.getStyle().getStroke().getColor();\r\n      }\r\n      else\r\n      {\tcolor = fillColor;\r\n        fillColor = \"#fff\";\r\n      }\r\n      ctx.strokeStyle = color;\r\n      ctx.lineWidth = stroke ? stroke.getWidth() : 1;\r\n      // \r\n      for (i=1; i<txt.top.length; i++)\r\n      {\tctx.beginPath();\r\n        ctx.rect(txt.top[i-1][1][0], margin, txt.top[i][1][0]-txt.top[i-1][1][0], borderWidth);\r\n        ctx.fillStyle = Math.round(txt.top[i][0]/step)%2 ? color: fillColor;\r\n        ctx.fill(); \r\n        ctx.stroke(); \r\n      }\r\n      for (i=1; i<txt.bottom.length; i++)\r\n      {\tctx.beginPath();\r\n        ctx.rect(txt.bottom[i-1][1][0], h-borderWidth-margin, txt.bottom[i][1][0]-txt.bottom[i-1][1][0], borderWidth);\r\n        ctx.fillStyle = Math.round(txt.bottom[i][0]/step)%2 ? color: fillColor;\r\n        ctx.fill(); \r\n        ctx.stroke(); \r\n      }\r\n      for (i=1; i<txt.left.length; i++)\r\n      {\tctx.beginPath();\r\n        ctx.rect(margin, txt.left[i-1][1][1], borderWidth, txt.left[i][1][1]-txt.left[i-1][1][1]);\r\n        ctx.fillStyle = Math.round(txt.left[i][0]/step)%2 ? color: fillColor;\r\n        ctx.fill(); \r\n        ctx.stroke(); \r\n      }\r\n      for (i=1; i<txt.right.length; i++)\r\n      {\tctx.beginPath();\r\n        ctx.rect(w-borderWidth-margin, txt.right[i-1][1][1], borderWidth, txt.right[i][1][1]-txt.right[i-1][1][1]);\r\n        ctx.fillStyle = Math.round(txt.right[i][0]/step)%2 ? color: fillColor;\r\n        ctx.fill(); \r\n        ctx.stroke(); \r\n      }\r\n      ctx.beginPath();\r\n      ctx.fillStyle = color;\r\n      ctx.rect(margin,margin, borderWidth, borderWidth);\r\n      ctx.rect(margin,h-borderWidth-margin, borderWidth,borderWidth);\r\n      ctx.rect(w-borderWidth-margin,margin, borderWidth, borderWidth);\r\n      ctx.rect(w-borderWidth-margin,h-borderWidth-margin, borderWidth,borderWidth);\r\n      ctx.fill(); \r\n    }\r\n  ctx.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Draw a grid reference on the map and add an index.\r\n *\r\n * @constructor\r\n * @extends {ol.control.CanvasBase}\r\n * @fires select\r\n * @param {Object=} Control options.\r\n *  @param {ol.style.Style} options.style Style to use for drawing the grid (stroke and text), default black.\r\n *  @param {number} options.maxResolution max resolution to display the graticule\r\n *  @param {ol.extent} options.extent extent of the grid, required\r\n *  @param {ol.size} options.size number of lines and cols, required\r\n *  @param {number} options.margin margin to display text (in px), default 0px\r\n *  @param {ol.source.Vector} options.source source to use for the index, default none (use setIndex to reset the index)\r\n *  @param {string | function} options.property a property to display in the index or a function that takes a feature and return the name to display in the index, default 'name'.\r\n *  @param {function|undefined} options.sortFeatures sort function to sort 2 features in the index, default sort on property option\r\n *  @param {function|undefined} options.indexTitle a function that takes a feature and return the title to display in the index, default the first letter of property option\r\n *  @param {string} options.filterLabel label to display in the search bar, default 'filter'\r\n */\r\nol.control.GridReference = function(options) {\r\n  if (!options) options = {};\r\n  // Initialize parent\r\n  var elt = document.createElement(\"div\");\r\n  elt.className = (!options.target ? \"ol-control \":\"\") +\"ol-gridreference ol-unselectable \"+(options.className||\"\");\r\n  options.style = options.style || new ol.style.Style({\r\n    stroke: new ol.style.Stroke({ color:\"#000\", width:1 }),\r\n    text: new ol.style.Text({\r\n      font: \"bold 14px Arial\",\r\n      stroke: new ol.style.Stroke({ color:\"#fff\", width:2 }),\r\n      fill: new ol.style.Fill({ color:\"#000\" }),\r\n    })\r\n  });\r\n  ol.control.CanvasBase.call(this, {\r\n    element: elt,\r\n    target: options.target,\r\n    style: options.style\r\n  });\r\n  if (typeof (options.property)=='function') this.getFeatureName = options.property;\r\n  if (typeof (options.sortFeatures)=='function') this.sortFeatures = options.sortFeatures;\r\n  if (typeof (options.indexTitle)=='function') this.indexTitle = options.indexTitle;\r\n  // Set index using the source\r\n  this.source_ = options.source;\r\n  if (options.source) {\r\n    this.setIndex(options.source.getFeatures(), options);\r\n    // reload on ready\r\n    options.source.once('change',function() {\r\n      if (options.source.getState() === 'ready') {\r\n        this.setIndex(options.source.getFeatures(), options);\r\n      }\r\n    }.bind(this));\r\n  }\r\n  // Options\r\n  this.set('maxResolution', options.maxResolution || Infinity);\r\n  this.set('extent', options.extent);\r\n  this.set('size', options.size);\r\n  this.set('margin', options.margin || 0);\r\n  this.set('property', options.property || 'name');\r\n  this.set('filterLabel', options.filterLabel || 'filter');\r\n};\r\nol.ext.inherits(ol.control.GridReference, ol.control.CanvasBase);\r\n/**\r\n * Set the map instance the control is associated with.\r\n * @param {ol.Map} map The map instance.\r\n */\r\n ol.control.GridReference.prototype.setMap = function(map) {\r\n  ol.control.CanvasBase.prototype.setMap.call(this, map);\r\n  this.setIndex(this.source_.getFeatures());\r\n };\r\n/** Returns the text to be displayed in the index\r\n * @param {ol.Feature} f the feature\r\n * @return {string} the text to be displayed in the index\r\n * @api\r\n */\r\nol.control.GridReference.prototype.getFeatureName = function (f) {\r\n  return f.get(this.get('property')||'name');\r\n};\r\n/** Sort function\r\n * @param {ol.Feature} a first feature\r\n * @param {ol.Feature} b second feature\r\n * @return {Number} 0 if a==b, -1 if a<b, 1 if a>b\r\n * @api\r\n */\r\nol.control.GridReference.prototype.sortFeatures = function (a,b) {\r\n  return (this.getFeatureName(a) == this.getFeatureName(b)) ? 0 : (this.getFeatureName(a) < this.getFeatureName(b)) ? -1 : 1; \r\n};\r\n/** Get the feature title\r\n * @param {ol.Feature} f\r\n * @return the first letter of the eature name (getFeatureName)\r\n * @api\r\n */\r\nol.control.GridReference.prototype.indexTitle = function (f) {\r\n  return this.getFeatureName(f).charAt(0);\r\n};\r\n/** Display features in the index\r\n * @param { Array<ol.Feature> | ol.Collection<ol.Feature> } features\r\n */\r\nol.control.GridReference.prototype.setIndex = function (features) {\r\n  if (!this.getMap()) return;\r\n  var self = this;\r\n  if (features.getArray) features = features.getArray();\r\n  features.sort ( function(a,b) { return self.sortFeatures(a,b); } );\r\n  this.element.innerHTML = \"\";\r\n  var elt = this.element;\r\n  var search = document.createElement(\"input\");\r\n  search.setAttribute('type', 'search');\r\n  search.setAttribute('placeholder', this.get('filterLabel') || 'filter');\r\n  var searchKeyupFunction = function() {\r\n    var v = this.value.replace(/^\\*/,'');\r\n    // console.log(v)\r\n    var r = new RegExp (v, 'i');\r\n    var list = ul.querySelectorAll('li');\r\n    Array.prototype.forEach.call(list, function(li) {\r\n      if (li.classList.contains('ol-title')) {\r\n        li.style.display = '';\r\n      } else {\r\n        if (r.test(li.querySelector('.ol-name').textContent)) li.style.display = '';\r\n        else li.style.display = 'none';\r\n      }\r\n    });\r\n    Array.prototype.forEach.call(ul.querySelectorAll(\"li.ol-title\"), function(li) {\r\n      var nextVisible;\r\n      var start = false;\r\n      for (var i=0; i<list.length; i++) {\r\n        if (start) {\r\n          if (list[i].classList.contains('ol-title')) break;\r\n          if (!list[i].style.display) {\r\n            nextVisible = list[i];\r\n            break;\r\n          }\r\n        }\r\n        if (list[i] === li) start = true;\r\n      }\r\n      if (nextVisible) li.style.display = '';\r\n      else li.style.display = 'none';\r\n    });\r\n  };\r\n  search.addEventListener('search', searchKeyupFunction);\r\n  search.addEventListener('keyup', searchKeyupFunction);\r\n  elt.appendChild(search);\r\n  var ul = document.createElement(\"ul\");\r\n  elt.appendChild(ul);\r\n  var r, title;\r\n  features.forEach(function(feat) {\r\n    r = this.getReference(feat.getGeometry().getFirstCoordinate());\r\n    if (r) {\r\n      var name = this.getFeatureName(feat);\r\n      var c = this.indexTitle(feat);\r\n      if (c != title) {\r\n        var li_title = document.createElement(\"li\");\r\n        li_title.classList.add('ol-title');\r\n        li_title.textContent = c;\r\n        ul.appendChild(li_title);\r\n      }\r\n      title = c;\r\n      var li_ref_name = document.createElement(\"li\");\r\n      var span_name = document.createElement(\"span\");\r\n          span_name.classList.add(\"ol-name\");\r\n          span_name.textContent = name;\r\n      li_ref_name.appendChild(span_name);\r\n      var span_ref = document.createElement(\"span\");\r\n          span_ref.classList.add(\"ol-ref\");\r\n          span_ref.textContent = r;\r\n      li_ref_name.appendChild(span_ref);\r\n      var feature = feat;\r\n      li_ref_name.addEventListener(\"click\", function() {\r\n        this.dispatchEvent({ type:\"select\", feature: feature });\r\n      }.bind(this));\r\n      ul.appendChild(li_ref_name);\r\n    }\r\n  }.bind(this));\r\n};\r\n/** Get reference for a coord\r\n*\t@param {ol.coordinate} coords\r\n*\t@return {string} the reference\r\n*/\r\nol.control.GridReference.prototype.getReference = function (coords) {\r\n  if (!this.getMap()) return;\r\n  var extent = this.get('extent');\r\n  var size = this.get('size');\r\n  var dx = Math.floor ( (coords[0] - extent[0]) / (extent[2]- extent[0]) * size[0] );\r\n  if (dx<0 || dx>=size[0]) return \"\";\r\n  var dy = Math.floor ( (extent[3] - coords[1]) / (extent[3]- extent[1]) * size[1] );\r\n  if (dy<0 || dy>=size[1]) return \"\";\r\n  return String.fromCharCode(65+dx)+dy;\r\n};\r\n/** Draw the grid\r\n* @param {ol.event} e postcompose event\r\n* @private\r\n*/\r\nol.control.GridReference.prototype._draw = function (e) {\r\n  if (this.get('maxResolution')<e.frameState.viewState.resolution) return;\r\n  var ctx = this.getContext(e);\r\n  var canvas = ctx.canvas;\r\n  var ratio = e.frameState.pixelRatio;\r\n  var w = canvas.width/ratio;\r\n  var h = canvas.height/ratio;\r\n  var extent = this.get('extent');\r\n  var size = this.get('size');\r\n  var map = this.getMap();\r\n  var ex = ol.extent.boundingExtent([map.getPixelFromCoordinate([extent[0],extent[1]]), map.getPixelFromCoordinate([extent[2],extent[3]])]);\r\n  var p0 = [ex[0],ex[1]];\r\n  var p1 = [ex[2],ex[3]];\r\n  var dx = (p1[0]-p0[0])/size[0];\r\n  var dy = (p1[1]-p0[1])/size[1];\r\n  ctx.save();\r\n    var margin = this.get('margin');\r\n    ctx.scale(ratio,ratio);\r\n    ctx.strokeStyle = this.getStroke().getColor();\r\n    ctx.lineWidth = this.getStroke().getWidth();\r\n    // Draw grid\r\n    ctx.beginPath();\r\n    var i;\r\n    for (i=0; i<=size[0]; i++) {\r\n      ctx.moveTo(p0[0]+i*dx, p0[1]);\r\n      ctx.lineTo(p0[0]+i*dx, p1[1]);\r\n    }\r\n    for (i=0; i<=size[1]; i++) {\r\n      ctx.moveTo(p0[0], p0[1]+i*dy);\r\n      ctx.lineTo(p1[0], p0[1]+i*dy);\r\n    }\r\n    ctx.stroke();\r\n    // Draw text\r\n    ctx.font = this.getTextFont();\r\n    ctx.fillStyle = this.getTextFill().getColor();\r\n    ctx.strokeStyle = this.getTextStroke().getColor();\r\n    var lw = ctx.lineWidth = this.getTextStroke().getWidth();\r\n    var spacing = margin +lw;\r\n    ctx.textAlign = 'center';\r\n    var letter, x, y;\r\n    for (i=0; i<size[0]; i++) {\r\n      letter = String.fromCharCode(65+i);\r\n      x = p0[0]+i*dx+dx/2;\r\n      y = p0[1]-spacing;\r\n      if (y<0) {\r\n        y = spacing;\r\n        ctx.textBaseline = 'hanging';\r\n      }\r\n      else ctx.textBaseline = 'alphabetic';\r\n      ctx.strokeText(letter, x, y);\r\n      ctx.fillText(letter, x, y);\r\n      y = p1[1]+spacing;\r\n      if (y>h) {\r\n        y = h-spacing;\r\n        ctx.textBaseline = 'alphabetic';\r\n      }\r\n      else ctx.textBaseline = 'hanging';\r\n      ctx.strokeText(letter, x, y);\r\n      ctx.fillText(letter, x, y);\r\n    }\r\n    ctx.textBaseline = 'middle';\r\n    for (i=0; i<size[1]; i++) {\r\n      y = p0[1]+i*dy+dy/2;\r\n      ctx.textAlign = 'right';\r\n      x = p0[0] - spacing;\r\n      if (x<0) {\r\n        x = spacing;\r\n        ctx.textAlign = 'left';\r\n      }\r\n      else ctx.textAlign = 'right';\r\n      ctx.strokeText(i, x, y);\r\n      ctx.fillText(i, x, y);\r\n      x = p1[0] + spacing;\r\n      if (x>w) {\r\n        x = w-spacing;\r\n        ctx.textAlign = 'right';\r\n      }\r\n      else ctx.textAlign = 'left';\r\n      ctx.strokeText(i, x, y);\r\n      ctx.fillText(i, x, y);\r\n    }\r\n  ctx.restore();\r\n};\r\n\r\n/** Image line control\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fires select\r\n * @fires collapse\r\n * @param {Object=} options Control options.\r\n *\t@param {String} options.className class of the control\r\n *\t@param {Array<ol.source.Vector>|ol.source.Vector} options.source vector sources that contains the images\r\n *\t@param {Array<ol.layer.Vector>} options.layers A list of layers to display images. If no source and no layers, all visible layers will be considered.\r\n *\t@param {function} options.getImage a function that gets a feature and return the image url or false if no image to Show, default return the img propertie\r\n *\t@param {function} options.getTitle a function that gets a feature and return the title, default return an empty string\r\n *\t@param {boolean} options.collapsed the line is collapse, default false\r\n *\t@param {boolean} options.collapsible the line is collapsible, default false\r\n *\t@param {number} options.maxFeatures the maximum image element in the line, default 100\r\n *\t@param {number} options.useExtent only show feature in the current extent\r\n *\t@param {boolean} options.hover select image on hover, default false\r\n *\t@param {string|boolean} options.linkColor link color or false if no link, default false\r\n */\r\nol.control.Imageline = function(options) {\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: (options.className || '') + ' ol-imageline'\r\n      + (options.target ? '': ' ol-unselectable ol-control')\r\n      + (options.collapsed && options.collapsible ? 'ol-collapsed' : '')\r\n  });\r\n  if (!options.target && options.collapsible) {\r\n    ol.ext.element.create('BUTTON', {\r\n      type: 'button',\r\n      click: function() {\r\n        this.toggle();\r\n      }.bind(this),\r\n      parent: element\r\n    });\r\n  }\r\n  // Source \r\n  if (options.source) this._sources = options.source.forEach ? options.source : [options.source];\r\n  if (options.layers) {\r\n    this.setLayers(options.layers);\r\n  }\r\n  // Initialize\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  // Scroll imageline\r\n  this._setScrolling();\r\n  this._scrolldiv.addEventListener(\"scroll\", function() {\r\n    if (this.getMap()) this.getMap().render();\r\n  }.bind(this));\r\n  // Parameters\r\n  if (typeof(options.getImage)==='function') this._getImage =  options.getImage;\r\n  if (typeof(options.getTitle)==='function') this._getTitle =  options.getTitle;\r\n  this.set('maxFeatures', options.maxFeatures || 100);\r\n  this.set('linkColor', options.linkColor || false);\r\n  this.set('hover', options.hover || false);\r\n  this.set('useExtent', options.useExtent || false);\r\n  this.refresh();\r\n};\r\nol.ext.inherits(ol.control.Imageline, ol.control.Control);\r\n/**\r\n * Remove the control from its current map and attach it to the new map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.control.Imageline.prototype.setMap = function (map) {\r\n\tif (this._listener) {\r\n    this._listener.forEach(function(l) {\r\n      ol.Observable.unByKey(l);\r\n    }.bind(this));\r\n  }\r\n\tthis._listener = null;\r\n\tol.control.Control.prototype.setMap.call(this, map);\r\n  if (map) {\t\r\n    this._listener = [\r\n      map.on('postcompose', this._drawLink.bind(this)),\r\n      map.on('moveend', function() { \r\n        if (this.get('useExtent')) this.refresh();\r\n      }.bind(this))\r\n    ]\r\n    this.refresh();\r\n\t}\r\n};\r\n/** Set layers to use in the control\r\n * @param {Array<ol.Layer} layers\r\n */\r\nol.control.Imageline.prototype.setLayers = function (layers) {\r\n  this._sources = this._getSources(layers);\r\n};\r\n/** Get source from a set of layers\r\n * @param {Array<ol.Layer} layers\r\n * @returns {Array<ol.source.Vector}\r\n * @private\r\n */\r\nol.control.Imageline.prototype._getSources = function (layers) {\r\n  var sources = [];\r\n  layers.forEach(function(l) {\r\n    if (l.getVisible()) {\r\n      if (l.getSource() && l.getSource().getFeatures) sources.push(l.getSource());\r\n      else if (l.getLayers) this._getSources(l.getLayers());\r\n    }\r\n  }.bind(this));\r\n  return sources;\r\n};\r\n/** Set useExtent param and refresh the line\r\n * @param {boolean} b\r\n */\r\nol.control.Imageline.prototype.useExtent = function(b) {\r\n  this.set('useExtent', b);\r\n  this.refresh();\r\n};\r\n/** Is the line collapsed\r\n * @return {boolean}\r\n */\r\nol.control.Imageline.prototype.isCollapsed = function() {\r\n  return this.element.classList.contains('ol-collapsed');\r\n};\r\n/** Collapse the line\r\n * @param {boolean} b\r\n */\r\nol.control.Imageline.prototype.collapse = function(b) {\r\n  if (b) this.element.classList.add('ol-collapsed');\r\n  else this.element.classList.remove('ol-collapsed');\r\n  if (this.getMap()) {\r\n    setTimeout ( function() {\r\n      this.getMap().render();\r\n    }.bind(this), this.isCollapsed() ? 0 : 250);\r\n  }\r\n  this.dispatchEvent({ type: 'collapse', collapsed: this.isCollapsed() });\r\n};\r\n/** Collapse the line\r\n */\r\nol.control.Imageline.prototype.toggle = function() {\r\n  this.element.classList.toggle('ol-collapsed');\r\n  if (this.getMap()) {\r\n    setTimeout ( function() {\r\n      this.getMap().render();\r\n    }.bind(this), this.isCollapsed() ? 0 : 250);\r\n  }\r\n  this.dispatchEvent({ type: 'collapse', collapsed: this.isCollapsed() });\r\n};\r\n/** Default function to get an image of a feature\r\n * @param {ol.Feature} f\r\n * @private\r\n */\r\nol.control.Imageline.prototype._getImage = function(f) {\r\n  return f.get('img');\r\n};\r\n/** Default function to get an image title\r\n * @param {ol.Feature} f\r\n * @private\r\n */\r\nol.control.Imageline.prototype._getTitle = function(/* f */) {\r\n  return '';\r\n};\r\n/**\r\n * Get features\r\n * @return {Array<ol.Feature>}\r\n */\r\nol.control.Imageline.prototype.getFeatures = function() {\r\n  var map = this.getMap();\r\n  if (!map) return [];\r\n  var features = [];\r\n  var sources = this._sources || this._getSources(map.getLayers());\r\n  sources.forEach(function(s) {\r\n    if (features.length < this.get('maxFeatures')) {\r\n      if (!this.get('useExtent') || !map) {\r\n        features.push(s.getFeatures());\r\n      } else {\r\n        var extent = map.getView().calculateExtent(map.getSize());\r\n        features.push(s.getFeaturesInExtent(extent));\r\n      }\r\n    }\r\n  }.bind(this))\r\n  return features;\r\n};\r\n/** Set element scrolling with a acceleration effect on desktop\r\n * (on mobile it uses the scroll of the browser)\r\n * @private\r\n */\r\nol.control.Imageline.prototype._setScrolling = function() {\r\n  var elt = this._scrolldiv = ol.ext.element.create('DIV', {\r\n    parent: this.element\r\n  });\r\n  ol.ext.element.scrollDiv(elt, {\r\n    // Prevent selection when moving\r\n    onmove: function(b) {\r\n      this._moving=b; \r\n    }.bind(this)\r\n  });\r\n};\r\n/**\r\n * Refresh the imageline with new data\r\n */\r\nol.control.Imageline.prototype.refresh = function() {\r\n  this._scrolldiv.innerHTML = '';\r\n  var allFeatures = this.getFeatures();\r\n  var current = this._select ? this._select.feature : null;\r\n  if (this._select) this._select.elt = null;\r\n  this._iline = [];\r\n  if (this.getMap()) this.getMap().render();\r\n  // Add a new image\r\n  var addImage = function(f) {\r\n    if (this._getImage(f)) {\r\n      var img = ol.ext.element.create('DIV', {\r\n        className: 'ol-image',\r\n        parent: this._scrolldiv\r\n      });\r\n      ol.ext.element.create('IMG', {\r\n        src: this._getImage(f),\r\n        parent: img\r\n      }).addEventListener('load', function(){\r\n        this.classList.add('ol-loaded');\r\n      });\r\n      ol.ext.element.create('SPAN', {\r\n        html: this._getTitle(f),\r\n        parent: img\r\n      });\r\n      // Current image\r\n      var sel = { elt: img, feature: f };\r\n      // On click > dispatch event\r\n      img.addEventListener('click', function(){\r\n        if (!this._moving) {\r\n          this.dispatchEvent({type: 'select', feature: f });\r\n          this._scrolldiv.scrollLeft = img.offsetLeft \r\n            + ol.ext.element.getStyle(img, 'width')/2\r\n            - ol.ext.element.getStyle(this.element, 'width')/2;\r\n            if (this._select) this._select.elt.classList.remove('select');\r\n            this._select = sel;\r\n            this._select.elt.classList.add('select');\r\n          }\r\n      }.bind(this));\r\n      // Show link\r\n      img.addEventListener('mouseover', function(e) {\r\n        if (this.get('hover')) {\r\n          if (this._select) this._select.elt.classList.remove('select');\r\n          this._select = sel;\r\n          this._select.elt.classList.add('select');\r\n          this.getMap().render();\r\n          e.stopPropagation();\r\n        }\r\n      }.bind(this));\r\n      // Remove link\r\n      img.addEventListener('mouseout', function(e) {\r\n        if (this.get('hover')) {\r\n          if (this._select) this._select.elt.classList.remove('select');\r\n          this._select = false;\r\n          this.getMap().render();\r\n          e.stopPropagation();\r\n        }\r\n      }.bind(this));\r\n      // Prevent image dragging\r\n      img.ondragstart = function(){ return false; };\r\n      // Add image\r\n      this._iline.push(sel);\r\n      if (current===f) {\r\n        this._select = sel;\r\n        sel.elt.classList.add('select');\r\n      }\r\n    }\r\n  }.bind(this);\r\n  // Add images \r\n  var nb = this.get('maxFeatures');\r\n  allFeatures.forEach(function(features) {\r\n    for (var i=0, f; f=features[i]; i++) {\r\n      if (nb-- < 0) break;\r\n      addImage(f);\r\n    }\r\n  }.bind(this));\r\n  // Add the selected one\r\n  if (this._select && this._select.feature && !this._select.elt) {\r\n    addImage(this._select.feature);\r\n  }\r\n};\r\n/** Center image line on a feature\r\n * @param {ol.feature} feature\r\n * @param {boolean} scroll scroll the line to center on the image, default true\r\n * @api\r\n */\r\nol.control.Imageline.prototype.select = function(feature, scroll) {\r\n  this._select = false;\r\n  // Find the image\r\n  this._iline.forEach(function (f) {\r\n    if (f.feature === feature) {\r\n      f.elt.classList.add('select');\r\n      this._select = f;\r\n      if (scroll!==false) {\r\n        this._scrolldiv.scrollLeft = f.elt.offsetLeft \r\n          + ol.ext.element.getStyle(f.elt, 'width')/2\r\n          - ol.ext.element.getStyle(this.element, 'width')/2;\r\n      }\r\n    } else {\r\n      f.elt.classList.remove('select');\r\n    }\r\n  }.bind(this));\r\n};\r\n/** Draw link on the map\r\n * @private\r\n */\r\nol.control.Imageline.prototype._drawLink = function(e) {\r\n  if (!this.get('linkColor') | this.isCollapsed()) return;\r\n  var map = this.getMap();\r\n  if (map && this._select && this._select.elt) {\r\n    var ctx = e.context || ol.ext.getMapCanvas(this.getMap()).getContext('2d');\r\n    var ratio = e.frameState.pixelRatio;\r\n    var pt = [ \r\n      this._select.elt.offsetLeft \r\n      - this._scrolldiv.scrollLeft\r\n      + ol.ext.element.getStyle(this._select.elt, 'width')/2, \r\n      parseFloat(ol.ext.element.getStyle(this.element, 'top')) || this.getMap().getSize()[1]\r\n    ];\r\n    var geom = this._select.feature.getGeometry().getFirstCoordinate();\r\n    geom = this.getMap().getPixelFromCoordinate(geom);\r\n    ctx.save();\r\n    ctx.fillStyle = this.get('linkColor');\r\n    ctx.beginPath();\r\n      if (geom[0]>pt[0]) {\r\n        ctx.moveTo((pt[0]-5)*ratio, pt[1]*ratio);\r\n        ctx.lineTo((pt[0]+5)*ratio, (pt[1]+5)*ratio);\r\n      } else {\r\n        ctx.moveTo((pt[0]-5)*ratio, (pt[1]+5)*ratio);\r\n        ctx.lineTo((pt[0]+5)*ratio, pt[1]*ratio);\r\n      }\r\n      ctx.lineTo(geom[0]*ratio, geom[1]*ratio);\r\n    ctx.fill();\r\n    ctx.restore();\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2018 Jean-Marc VIGLINO,\r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Geoportail isochrone Control.\r\n * @see https://geoservices.ign.fr/documentation/geoservices/isochrones.html\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fires isochrone\r\n * @fires error\r\n * @param {Object=} options\r\n *\t@param {string} options.className control class name\r\n *\t@param {string} [options.apiKey] Geoportail apo key\r\n *\t@param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *\t@param {string | undefined} options.label Text label to use for the search button, default \"search\"\r\n *\t@param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *\t@param {string | undefined} options.inputLabel label for the input, default none\r\n *\t@param {string | undefined} options.noCollapse prevent collapsing on input blur, default false\r\n *\t@param {number | undefined} options.typing a delay on each typing to start searching (ms) use -1 to prevent autocompletion, default 300.\r\n *\t@param {integer | undefined} options.minLength minimum length to start searching, default 1\r\n *\t@param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *\t@param {integer | undefined} options.maxHistory maximum number of items to display in history. Set -1 if you don't want history, default maxItems\r\n *\t@param {function} options.getTitle a function that takes a feature and return the name to display in the index.\r\n *\t@param {function} options.autocomplete a function that take a search string and callback function to send an array\r\n *\r\n *  @param {string} options.exclusions Exclusion list separate with a comma 'Toll,Tunnel,Bridge'\r\n */\r\nol.control.IsochroneGeoportail = function(options) {\r\n  var self = this;\r\n\tif (!options) options = {};\r\n\tif (options.typing == undefined) options.typing = 300;\r\n\tvar classNames = (options.className ? options.className : '')+ ' ol-isochrone ol-routing';\r\n\tif (!options.target) classNames += ' ol-unselectable ol-control';\r\n\tvar element = ol.ext.element.create('DIV', { className: classNames })\r\n\tif (!options.target) {\r\n    var bt = ol.ext.element.create('BUTTON', { parent: element })\r\n    bt.addEventListener('click', function(){\r\n      element.classList.toggle('ol-collapsed');\r\n    });\r\n  }\r\n  // Inherits\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.set('iter', 1);\r\n  var content = ol.ext.element.create('DIV', { className: 'content', parent: element } )\r\n  // Search control\r\n  this._addSearchCtrl(content, options);\r\n  // Method buttons\r\n  ol.ext.element.create('BUTTON', { className: 'ol-button ol-method-time selected', title:'isochrone', parent: content })\r\n    .addEventListener('click', function(){\r\n      this.setMethod('time');\r\n    }.bind(this));\r\n  ol.ext.element.create('I', { className: 'ol-button ol-method-distance', title:'isodistance', parent: content })\r\n    .addEventListener('click', function(){\r\n      this.setMethod('distance');\r\n    }.bind(this));\r\n  // Mode buttons\r\n  ol.ext.element.create('I', { className: 'ol-button ol-car selected', title:'by car', parent: content })\r\n    .addEventListener('click', function(){\r\n      this.setMode('car');\r\n    }.bind(this));\r\n  ol.ext.element.create('I', { className: 'ol-button ol-pedestrian', title:'by foot', parent: content })\r\n    .addEventListener('click', function(){\r\n      this.setMode('pedestrian');\r\n    }.bind(this));\r\n  // Direction buttons\r\n  ol.ext.element.create('I', { className: 'ol-button ol-direction-direct selected', title:'direct', parent: content })\r\n    .addEventListener('click', function(){\r\n      this.setDirection('direct');\r\n    }.bind(this));\r\n  ol.ext.element.create('I', { className: 'ol-button ol-direction-reverse', title:'reverse', parent: content })\r\n    .addEventListener('click', function(){\r\n      this.setDirection('reverse');\r\n    }.bind(this));\r\n  // Input \r\n  var div = ol.ext.element.create('DIV', { className: 'ol-time', parent: content })\r\n  ol.ext.element.create('DIV', { html:'isochrone:', parent: div });\r\n  ol.ext.element.create('INPUT', { type: 'number', parent: div, min: 0 })\r\n    .addEventListener('change', function(){\r\n      self.set('hour', Number(this.value));\r\n    });\r\n  ol.ext.element.create('TEXT', { parent: div, html: 'h' });\r\n  ol.ext.element.create('INPUT', { type: 'number', parent: div, min: 0 })\r\n    .addEventListener('change', function(){\r\n      self.set('minute', Number(this.value));\r\n    });\r\n  ol.ext.element.create('TEXT', { parent: div, html: 'mn' });\r\n  div = ol.ext.element.create('DIV', { className: 'ol-distance', parent: content });\r\n  ol.ext.element.create('DIV', { html:'isodistance:', parent: div });\r\n  ol.ext.element.create('INPUT', { type: 'number', step: 'any', parent: div, min: 0 })\r\n    .addEventListener('change', function(){\r\n      self.set('distance', Number(this.value));\r\n    });\r\n  ol.ext.element.create('TEXT', { parent: div, html: 'km' });\r\n  div = ol.ext.element.create('DIV', { className: 'ol-iter', parent: content })\r\n  ol.ext.element.create('DIV', { html:'Iteration:', parent: div });\r\n  ol.ext.element.create('INPUT', { type: 'number', parent: div, value: 1, min: 1 })\r\n    .addEventListener('change', function(){\r\n      self.set('iter', Number(this.value));\r\n    });\r\n  // OK button\r\n  ol.ext.element.create('I', { className:'ol-ok', html:'ok', parent: content })\r\n    .addEventListener('click', function() {\r\n      var val = 0;\r\n      switch (this.get('method')) {\r\n        case 'distance':  {\r\n          val = this.get('distance')*1000;\r\n          break;\r\n        }\r\n        default: {\r\n          val = (this.get('hour')||0)*3600 + (this.get('minute')||0)*60;\r\n          break;\r\n        }\r\n      }\r\n      if (val && this.get('coordinate')) {\r\n        this.search(this.get('coordinate'), val);\r\n      }\r\n    }.bind(this));\r\n  this.set('url', 'https://wxs.ign.fr/'+(options.apiKey || 'essentiels')+'/isochrone/isochrone.json');\r\n  this._ajax = new ol.ext.Ajax({ \r\n    dataType: 'JSON',\r\n    auth: options.auth\r\n  });\r\n  this._ajax.on('success', this._success.bind(this));\r\n  this._ajax.on('error', this._error.bind(this));\r\n  // searching\r\n  this._ajax.on('loadstart', function() {\r\n    this.element.classList.add('ol-searching');\r\n  }.bind(this));\r\n  this._ajax.on('loadend', function() {\r\n    this.element.classList.remove('ol-searching');\r\n  }.bind(this));\r\n  this.setMethod(options.method);\r\n};\r\nol.ext.inherits(ol.control.IsochroneGeoportail, ol.control.Control);\r\n/**\r\n * Set the map instance the control is associated with\r\n * and add its controls associated to this map.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.control.IsochroneGeoportail.prototype.setMap = function (map) {\r\n\tol.control.Control.prototype.setMap.call(this, map);\r\n\tthis._search.setMap(map);\r\n};\r\n/** Add a new search input\r\n * @private\r\n */\r\nol.control.IsochroneGeoportail.prototype._addSearchCtrl = function (element, options) {\r\n\tvar div = ol.ext.element.create(\"DIV\", { parent: element });\r\n  var search = this._search = new ol.control.SearchGeoportail({\r\n    className: 'IGNF ol-collapsed',\r\n\t\tapiKey: options.apiKey,\r\n\t\ttarget: div\r\n\t});\r\n\tsearch.on('select', function(e){\r\n    search.setInput(e.search.fulltext);\r\n    this.set('coordinate', e.coordinate);\r\n  }.bind(this));\r\n  search.on('change:input', function(){\r\n    this.set('coordinate', false);\r\n  }.bind(this));\r\n};\r\n/** Set the travel method\r\n * @param [string] method The method (time or distance)\r\n */\r\nol.control.IsochroneGeoportail.prototype.setMethod = function(method) {7\r\n  method = (/distance/.test(method) ? 'distance' : 'time');\r\n  this.element.querySelector(\".ol-method-time\").classList.remove(\"selected\");\r\n  this.element.querySelector(\".ol-method-distance\").classList.remove(\"selected\");\r\n  this.element.querySelector(\".ol-method-\"+method).classList.add(\"selected\");\r\n  this.element.querySelector(\"div.ol-time\").classList.remove(\"selected\");\r\n  this.element.querySelector(\"div.ol-distance\").classList.remove(\"selected\");\r\n  this.element.querySelector(\"div.ol-\"+method).classList.add(\"selected\");\r\n  this.set('method', method);\r\n};\r\n/** Set mode\r\n * @param {string} mode The mode: 'car' or 'pedestrian', default 'car'\r\n */\r\nol.control.IsochroneGeoportail.prototype.setMode = function (mode) {\r\n  this.set('mode', mode);\r\n  this.element.querySelector(\".ol-car\").classList.remove(\"selected\");\r\n  this.element.querySelector(\".ol-pedestrian\").classList.remove(\"selected\");\r\n  this.element.querySelector(\".ol-\"+mode).classList.add(\"selected\");\r\n};\r\n/** Set direction\r\n * @param {string} direction The direction: 'direct' or 'reverse', default direct\r\n */\r\nol.control.IsochroneGeoportail.prototype.setDirection = function (direction) {\r\n  this.set('direction', direction);\r\n  this.element.querySelector(\".ol-direction-direct\").classList.remove(\"selected\");\r\n  this.element.querySelector(\".ol-direction-reverse\").classList.remove(\"selected\");\r\n  this.element.querySelector(\".ol-direction-\"+direction).classList.add(\"selected\");\r\n};\r\n/** Calculate an isochrone\r\n * @param {ol.coordinate} coord\r\n * @param {number|string} option A number as time (in second) or distance (in meter), depend on method propertie\r\n * or a string with a unit (s, mn, h for time or km, m)\r\n */\r\nol.control.IsochroneGeoportail.prototype.search = function(coord, option, iter) {\r\n  var proj = this.getMap() ? this.getMap().getView().getProjection() : 'EPSG:3857';\r\n  var method = /distance/.test(this.get('method')) ? 'distance' : 'time';\r\n  if (typeof(option)==='string') {\r\n    var unit = option.replace(/([0-9|.]*)([a-z]*)$/,'$2');\r\n    method = 'time';\r\n    option = parseFloat(option);\r\n    // convert unit\r\n    switch (unit) {\r\n      case 'mn': {\r\n        option = option*60;\r\n        break;\r\n      }\r\n      case 'h': {\r\n        option = option*3600;\r\n        break;\r\n      }\r\n      case 'm': {\r\n        method = 'distance';\r\n        break;\r\n      }\r\n      case 'km': {\r\n        method = 'distance';\r\n        option = option*1000;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n  var dt = Math.round(option * (this.get('iter')-(iter||0)) / this.get('iter'));\r\n  if (typeof option === 'number') {\r\n    // Send data\r\n    var data = {\r\n      'gp-access-lib': '2.1.0',\r\n      location: ol.proj.toLonLat(coord, proj),\r\n      graphName: (this.get('mode')==='pedestrian' ?  'Pieton' : 'Voiture'),\r\n      exclusions: this.get('exclusions') || undefined,\r\n      method: method,\r\n      time: method==='time' ? dt : undefined,\r\n      distance: method==='distance' ? dt : undefined,\r\n      reverse: (this.get('direction') === 'reverse'),\r\n      smoothing: this.get('smoothing') || true,\r\n      holes: this.get('holes') || false\r\n    };\r\n    this._ajax.send(this.get('url'), data, { \r\n      coord: coord, \r\n      option: option,\r\n      data: data,\r\n      iteration: (iter||0)+1 \r\n    });\r\n  }\r\n};\r\n/** Trigger result\r\n * @private\r\n */\r\nol.control.IsochroneGeoportail.prototype._success = function(e) {\r\n  var proj = this.getMap() ? this.getMap().getView().getProjection() : 'EPSG:3857';\r\n  // Convert to features\r\n  var format = new ol.format.WKT();\r\n  var evt = e.response;\r\n\tevt.feature = format.readFeature(evt.wktGeometry, {\r\n    dataProjection: 'EPSG:4326',\r\n    featureProjection: proj\r\n  });\r\n  evt.feature.set('iteration', e.options.iteration);\r\n  evt.feature.set('method', e.options.data.method);\r\n  evt.feature.set(e.options.data.method, e.options.data[e.options.data.method]);\r\n  delete evt.wktGeometry;\r\n  evt.type = 'isochrone';\r\n  evt.iteration = e.options.iteration-1;\r\n  this.dispatchEvent (evt);\r\n  if (e.options.iteration < this.get('iter')) {\r\n    this.search(e.options.coord, e.options.option, e.options.iteration);\r\n  }\r\n};\r\n/** Trigger error\r\n * @private\r\n */\r\nol.control.IsochroneGeoportail.prototype._error = function() {\r\n  this.dispatchEvent ({ type:'error' });\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * OpenLayers Layer Switcher Control.\r\n *\r\n * @constructor\r\n * @extends {ol.control.LayerSwitcher}\r\n * @param {Object=} options Control options.\r\n */\r\nol.control.LayerPopup = function(options) {\r\n  options = options || {};\r\n\toptions.switcherClass=\"ol-layerswitcher-popup\";\r\n\tif (options.mouseover!==false) options.mouseover=true;\r\n\tol.control.LayerSwitcher.call(this, options);\r\n};\r\nol.ext.inherits(ol.control.LayerPopup, ol.control.LayerSwitcher);\r\n/** Disable overflow\r\n*/\r\nol.control.LayerPopup.prototype.overflow = function(){};\r\n/** Render a list of layer\r\n * @param {elt} element to render\r\n * @layers {Array{ol.layer}} list of layer to show\r\n * @api stable\r\n */\r\nol.control.LayerPopup.prototype.drawList = function(ul, layers) {\t\r\n  var self=this;\r\n\tvar setVisibility = function(e) {\r\n    e.preventDefault(); \r\n\t\tvar l = self._getLayerForLI(this);\r\n\t\tself.switchLayerVisibility(l,layers);\r\n\t\tif (e.type==\"touchstart\") self.element.classList.add(\"ol-collapsed\");\r\n\t};\r\n\tlayers.forEach(function(layer) {\r\n    if (self.displayInLayerSwitcher(layer)) {\r\n      var d = ol.ext.element.create('LI', {\r\n        html: layer.get(\"title\") || layer.get(\"name\"),\r\n        on: { 'click touchstart': setVisibility },\r\n        parent: ul\r\n      });\r\n      self._setLayerForLI(d, layer);\r\n\t\t\tif (self.testLayerVisibility(layer)) d.classList.add(\"ol-layer-hidden\");\r\n\t\t\tif (layer.getVisible()) d.classList.add('ol-visible');\r\n\t\t}\r\n\t});\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** LayerShop a layer switcher with special controls to handle operation on layers.\r\n * @fires select\r\n * @fires drawlist\r\n * @fires toggle\r\n * @fires reorder-start\r\n * @fires reorder-end\r\n * @fires layer:visible\r\n * @fires layer:opacity\r\n * \r\n * @constructor\r\n * @extends {ol.control.LayerSwitcher}\r\n * @param {Object=} options\r\n *  @param {boolean} options.selection enable layer selection when click on the title\r\n *  @param {function} options.displayInLayerSwitcher function that takes a layer and return a boolean if the layer is displayed in the switcher, default test the displayInLayerSwitcher layer attribute\r\n *  @param {boolean} options.show_progress show a progress bar on tile layers, default false\r\n *  @param {boolean} options.mouseover show the panel on mouseover, default false\r\n *  @param {boolean} options.reordering allow layer reordering, default true\r\n *  @param {boolean} options.trash add a trash button to delete the layer, default false\r\n *  @param {function} options.oninfo callback on click on info button, if none no info button is shown DEPRECATED: use on(info) instead\r\n *  @param {boolean} options.extent add an extent button to zoom to the extent of the layer\r\n *  @param {function} options.onextent callback when click on extent, default fits view to extent\r\n *  @param {number} options.drawDelay delay in ms to redraw the layer (usefull to prevent flickering when manipulating the layers)\r\n *  @param {boolean} options.collapsed collapse the layerswitcher at beginning, default true\r\n *  @param {ol.layer.Group} options.layerGroup a layer group to display in the switcher, default display all layers of the map\r\n *  @param {boolean} options.noScroll prevent handle scrolling, default false\r\n *\r\n * Layers attributes that control the switcher\r\n *\t- allwaysOnTop {boolean} true to force layer stay on top of the others while reordering, default false\r\n *\t- displayInLayerSwitcher {boolean} display the layer in switcher, default true\r\n *\t- noSwitcherDelete {boolean} to prevent layer deletion (w. trash option = true), default false\r\n */\r\nol.control.LayerShop = function(options) {\r\n  options = options || {};\r\n  options.selection = true;\r\n  options.noScroll = true;\r\n  ol.control.LayerSwitcher.call (this, options);\r\n  this.element.classList.add('ol-layer-shop');\r\n  // Control title (selected layer)\r\n  var title = this.element.insertBefore(ol.ext.element.create('DIV', { className: 'ol-title-bar' }), this.getPanel());\r\n  this.on('select', function(e) {\r\n    title.innerText = e.layer ? e.layer.get('title') : '';\r\n    this.element.setAttribute('data-layerClass', this.getLayerClass(e.layer));\r\n  }.bind(this));\r\n  // Top/bottom bar\r\n  this._topbar = this.element.insertBefore(ol.ext.element.create('DIV', { \r\n    className: 'ol-bar ol-top-bar'\r\n  }), this.getPanel());\r\n  this._bottombar = ol.ext.element.create('DIV', { \r\n    className: 'ol-bar ol-bottom-bar',\r\n    parent: this.element\r\n  });\r\n  this._controls = [];\r\n};\r\nol.ext.inherits(ol.control.LayerShop, ol.control.LayerSwitcher);\r\n/** Set the map instance the control is associated with.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.control.LayerShop.prototype.setMap = function(map) {\r\n  if (this.getMap()) {\r\n    // Remove map controls\r\n    this._controls.forEach(function(c) {\r\n      this.getMap().removeControl(c)\r\n    }.bind(this));\r\n  }\r\n  ol.control.LayerSwitcher.prototype.setMap.call(this, map);\r\n  if (map) {\r\n    // Select first layer\r\n    this.selectLayer();\r\n    // Remove a layer\r\n    this._listener.removeLayer = map.getLayers().on('remove', function(e) {\r\n      // Select first layer\r\n      if (e.element === this.getSelection()) {\r\n        this.selectLayer();\r\n      }\r\n    }.bind(this));\r\n    // Add controls\r\n    this._controls.forEach(function(c) {\r\n      this.getMap().addControl(c)\r\n    }.bind(this));\r\n  }\r\n};\r\n/** Get the bar element (to add new element in it)\r\n * @param {string} [position='top'] bar position bottom or top, default top\r\n * @returns {Element}\r\n */\r\nol.control.LayerShop.prototype.getBarElement = function(position) {\r\n  return position==='bottom' ? this._bottombar : this._topbar;\r\n};\r\n/** Add a control to the panel\r\n * @param {ol.control.Control} control\r\n * @param {string} [position='top'] bar position bottom or top, default top\r\n */\r\nol.control.LayerShop.prototype.addControl = function(control, position) {\r\n  this._controls.push(control);\r\n  control.setTarget(position==='bottom' ? this._bottombar : this._topbar);\r\n  if (this.getMap()) {\r\n    this.getMap().addControl(control);\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc OpenLayers Layer Switcher Control.\r\n * @require layer.getPreview\r\n *\r\n * @constructor\r\n * @extends {ol.control.LayerSwitcher}\r\n * @param {Object=} options Control options.\r\n */\r\nol.control.LayerSwitcherImage = function(options) {\r\n  options = options || {};\r\n\toptions.switcherClass = \"ol-layerswitcher-image\";\r\n\tif (options.mouseover!==false) options.mouseover=true;\r\n\tol.control.LayerSwitcher.call(this, options);\r\n};\r\nol.ext.inherits(ol.control.LayerSwitcherImage, ol.control.LayerSwitcher);\r\n/** Render a list of layer\r\n * @param {elt} element to render\r\n * @layers {Array{ol.layer}} list of layer to show\r\n * @api stable\r\n */\r\nol.control.LayerSwitcherImage.prototype.drawList = function(ul, layers) {\r\n  var self = this;\r\n\tvar setVisibility = function(e) {\r\n    e.preventDefault(); \r\n\t\tvar l = self._getLayerForLI(this);\r\n\t\tself.switchLayerVisibility(l,layers);\r\n\t\tif (e.type==\"touchstart\") self.element.classList.add(\"ol-collapsed\");\r\n\t};\r\n\tol.ext.element.setStyle(ul, { height: 'auto' });\r\n\tlayers.forEach(function(layer) {\r\n    if (self.displayInLayerSwitcher(layer)) {\r\n      var preview = layer.getPreview ? layer.getPreview() : [\"none\"];\r\n      var d = ol.ext.element.create('LI', {\r\n        className: 'ol-imgcontainer' + (layer.getVisible() ? ' ol-visible':''),\r\n        on: { 'touchstart click': setVisibility },\r\n        parent: ul\r\n      });\r\n      self._setLayerForLI(d, layer);\r\n      preview.forEach(function(img){\r\n        ol.ext.element.create('IMG', {\r\n          src: img,\r\n          parent: d\r\n        })\r\n      });\r\n\t\t\tol.ext.element.create('p', {\r\n        html: layer.get(\"title\") || layer.get(\"name\"),\r\n        parent: d\r\n      });\r\n\t\t\tif (self.testLayerVisibility(layer)) d.classList.add('ol-layer-hidden');\r\n\t\t}\r\n\t});\r\n};\r\n/** Disable overflow\r\n*/\r\nol.control.LayerSwitcherImage.prototype.overflow = function(){};\r\n\r\n// eslint-disable-next-line no-unused-vars\r\n/** Create a legend for styles\r\n * @constructor\r\n * @extends {ol.control.CanvasBase}\r\n * @fires select\r\n * @param {*} options\r\n *  @param {String} options.className class of the control\r\n *  @param {ol.legend.Legend} options.legend\r\n *  @param {boolean | undefined} options.collapsed Specify if legend should be collapsed at startup. Default is true.\r\n *  @param {boolean | undefined} options.collapsible Specify if legend can be collapsed, default true.\r\n *  @param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n */\r\nol.control.Legend = function(options) {\r\n  options = options || {};\r\n  var element = document.createElement('div');\r\n  if (options.target) {\r\n    element.className = options.className || 'ol-legend';\r\n  } else {\r\n    element.className = (options.className || 'ol-legend')\r\n      +' ol-unselectable ol-control'\r\n      +(options.collapsible===false ? ' ol-uncollapsible': ' ol-collapsed');\r\n    // Show on click\r\n    var button = document.createElement('button');\r\n    button.setAttribute('type', 'button');\r\n    button.addEventListener('click', function() {\r\n      this.toggle();\r\n    }.bind(this));\r\n    element.appendChild(button);\r\n    // Hide on click\r\n    button = document.createElement('button');\r\n    button.setAttribute('type', 'button');\r\n    button.className = 'ol-closebox';\r\n    button.addEventListener('click', function() {\r\n      this.toggle();\r\n    }.bind(this));\r\n    element.appendChild(button);\r\n  }\r\n  ol.control.CanvasBase.call(this, {\r\n    element: element,\r\n\t\ttarget: options.target\r\n\t});\r\n  // The legend\r\n  this._legend = options.legend;\r\n  this._legend.getCanvas().className = 'ol-legendImg';\r\n  element.appendChild(this._legend.getCanvas());\r\n  element.appendChild(this._legend.getListElement());\r\n  if (options.collapsible!==false && options.collapsed===false) this.show();\r\n  this._legend.on('select', function(e) {\r\n    this.dispatchEvent(e);\r\n  }.bind(this));\r\n  this._legend.on('refresh', function() {\r\n    if (this._onCanvas && this.getMap()) {\r\n      try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n    }\r\n  }.bind(this));\r\n};\r\nol.ext.inherits(ol.control.Legend, ol.control.CanvasBase);\r\n/** Get the legend associated with the control\r\n * @returns {ol.legend.Legend}\r\n */\r\nol.control.Legend.prototype.getLegend = function () {\r\n  return this._legend;\r\n};\r\n/** Draw control on canvas\r\n * @param {boolean} b draw on canvas.\r\n */\r\nol.control.Legend.prototype.setCanvas = function (b) {\r\n  this._onCanvas = b;\r\n  this.element.style.visibility = b ? \"hidden\":\"visible\";\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** Is control on canvas\r\n * @returns {boolean}\r\n */\r\nol.control.Legend.prototype.onCanvas = function () {\r\n  return !!this._onCanvas;\r\n};\r\n/** Draw legend on canvas\r\n * @private\r\n */\r\nol.control.Legend.prototype._draw = function (e) {\r\n  if (this._onCanvas && !this.element.classList.contains('ol-collapsed')) {\r\n    var canvas = this._legend.getCanvas();\r\n    var ctx = this.getContext(e);\r\n    var h = ctx.canvas.height - canvas.height;\r\n    ctx.save();\r\n      ctx.rect(0, h, canvas.width, canvas.height);\r\n      var col = '#fff';\r\n      if (this._legend.getTextStyle().getBackgroundFill()) {\r\n        col = ol.color.asString(this._legend.getTextStyle().getBackgroundFill().getColor());\r\n      }\r\n      ctx.fillStyle = ctx.strokeStyle = col;\r\n      ctx.lineWidth = 10;\r\n      ctx.lineJoin = 'round';\r\n      ctx.stroke();\r\n      ctx.clearRect(0, h, canvas.width, canvas.height);\r\n      ctx.fill();\r\n      ctx.drawImage(canvas, 0, h);\r\n      ctx.restore();\r\n  }\r\n};\r\n/** Show control\r\n */\r\nol.control.Legend.prototype.show = function() {\r\n  if (this.element.classList.contains('ol-collapsed')) {\r\n    this.element.classList.remove('ol-collapsed');\r\n    this.dispatchEvent({ type:'change:collapse', collapsed: false });\r\n    if (this.getMap()) {\r\n      try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n    }\r\n  }\r\n};\r\n/** Hide control\r\n */\r\nol.control.Legend.prototype.hide = function() {\r\n  if (!this.element.classList.contains('ol-collapsed')) {\r\n    this.element.classList.add('ol-collapsed');\r\n    this.dispatchEvent({ type:'change:collapse', collapsed: true });\r\n    if (this.getMap()) {\r\n      try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n    }\r\n  }\r\n};\r\n/** Show/hide control\r\n * @returns {boolean}\r\n */\r\nol.control.Legend.prototype.collapse = function(b) {\r\n  if (b===false) this.show();\r\n  else this.hide();\r\n};\r\n/** Is control collapsed\r\n * @returns {boolean}\r\n */\r\nol.control.Legend.prototype.isCollapsed = function() {\r\n  return (this.element.classList.contains('ol-collapsed'));\r\n};\r\n/** Toggle control\r\n */\r\nol.control.Legend.prototype.toggle = function() {\r\n  this.element.classList.toggle('ol-collapsed');\r\n  this.dispatchEvent({ type:'change:collapse', collapsed: this.element.classList.contains('ol-collapsed') });\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n//\r\n/** A control to jump from one zone to another.\r\n * @constructor\r\n * @fires select\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n *\t@param {string} options.className class name\r\n *  @param {Array<any>} options.zone an array of zone: { name, extent (in EPSG:4326) }\r\n *\t@param {ol.layer.Layer|function} options.layer layer to display in the control or a function that takes a zone and returns a layer to add to the control\r\n *\t@param {ol.ProjectionLike} options.projection projection of the control, Default is EPSG:3857 (Spherical Mercator).\r\n *  @param {bolean} options.centerOnClick center on click when a zone is clicked (or listen to 'select' event to do something), default true\r\n */\r\nol.control.MapZone = function(options) {\r\n  if (!options) options={};\r\n  var element = document.createElement(\"div\");\r\n  if (options.target) {\r\n    element = ol.ext.element.create('DIV', {\r\n      className: options.className || \"ol-mapzone\"\r\n    });\r\n  } else {\r\n    element = ol.ext.element.create('DIV', {\r\n      className: (options.className || \"ol-mapzone\") +' ol-unselectable ol-control ol-collapsed'\r\n    });\r\n    var bt = ol.ext.element.create('BUTTON', {\r\n      type: 'button',\r\n      on: {\r\n        'click': function() {\r\n          element.classList.toggle(\"ol-collapsed\");\r\n          maps.forEach(function (m) {\r\n            m.updateSize();\r\n          });\r\n        }.bind(this)\r\n      },\r\n      parent: element\r\n    });\r\n    ol.ext.element.create('I', {\r\n      parent: bt\r\n    });\r\n  }\r\n  // Parent control\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.set('centerOnClick', options.centerOnClick);\r\n  // Create maps\r\n  var maps = this._maps = [];\r\n  this._projection = options.projection;\r\n  this._layer = options.layer;\r\n  options.zones.forEach(this.addZone.bind(this));\r\n  // Refresh the maps\r\n  setTimeout(function() {\r\n    maps.forEach(function (m) {\r\n      m.updateSize();\r\n    });\r\n  });\r\n};\r\nol.ext.inherits(ol.control.MapZone, ol.control.Control);\r\n/** Collapse the control\r\n * @param {boolean} b\r\n */\r\nol.control.MapZone.prototype.setCollapsed = function (b) {\r\n  if (b) {\r\n    this.element.classList.remove('ol-collapsed');\r\n    // Force map rendering\r\n    this.getMaps().forEach(function (m) {\r\n      m.updateSize();\r\n    });\r\n  } else {\r\n    this.element.classList.add('ol-collapsed');\r\n  }\r\n};\r\n/** Get control collapsed\r\n * @return {boolean} \r\n */\r\nol.control.MapZone.prototype.getCollapsed = function () {\r\n  return this.element.classList.contains('ol-collapsed');\r\n};\r\n/** Set the control visibility (collapsed)\r\n * @param {boolean} b\r\n * @deprecated use setCollapsed instead\r\n */\r\nol.control.MapZone.prototype.setVisible = ol.control.MapZone.prototype.setCollapsed;\r\n/** Get associated maps\r\n * @return {ol.Map}\r\n */\r\nol.control.MapZone.prototype.getMaps = function () {\r\n  return this._maps;\r\n};\r\n/** Get nb zone */\r\nol.control.MapZone.prototype.getLength = function () {\r\n  return this._maps.length;\r\n};\r\n/** Add a new zone to the control \r\n * @param {Object} z \r\n *  @param {string} title\r\n *  @param {ol.extent} extent if map is not defined\r\n *  @param {ol.Map} map if map is defined use the map extent \r\n *  @param {ol.layer.Layer} [layer] layer of the zone, default use default control layer\r\n */\r\nol.control.MapZone.prototype.addZone = function (z) {\r\n  var view = new ol.View({ zoom: 6, center: [0,0], projection: this._projection });\r\n  var extent;\r\n  if (z.map) {\r\n    extent = ol.proj.transformExtent(z.map.getView().calculateExtent(), z.map.getView().getProjection(), view.getProjection()) ;\r\n  } else {\r\n    extent = ol.proj.transformExtent(z.extent, 'EPSG:4326', view.getProjection());\r\n  }\r\n  // console.log(extent, z.extent)\r\n  var div = ol.ext.element.create('DIV', {\r\n    className: 'ol-mapzonezone',\r\n    parent: this.element,\r\n    click : function() {\r\n      // Get index\r\n      var index = -1;\r\n      this._maps.forEach(function(m, i) {\r\n        if (m.get('zone') === z) {\r\n          index = i;\r\n        }\r\n      })\r\n      this.dispatchEvent({\r\n        type: 'select',\r\n        zone: z,\r\n        index: index,\r\n        coordinate: ol.extent.getCenter(extent),\r\n        extent: extent\r\n      });\r\n      if (this.get('centerOnClick') !== false) {\r\n        this.getMap().getView().fit(extent);\r\n      }\r\n      this.setVisible(false);\r\n    }.bind(this)\r\n  });\r\n  var layer;\r\n  if (z.layer) {\r\n    layer = z.layer;\r\n  } else if (typeof(this._layer) === 'function') {\r\n    layer = this._layer(z);\r\n  } else {\r\n    // Try to clone the layer\r\n    layer = new this._layer.constructor({\r\n      source: this._layer.getSource()\r\n    });\r\n  }\r\n  var map = new ol.Map({\r\n    target: div,\r\n    view: view,\r\n    controls: [],\r\n    interactions:[],\r\n    layers: [layer]\r\n  });\r\n  map.set('zone', z);\r\n  this._maps.push(map);\r\n  view.fit(extent);\r\n  // Name\r\n  ol.ext.element.create('P', {\r\n    html: z.title,\r\n    parent: div\r\n  });\r\n};\r\n/** Remove a zone from the control \r\n * @param {number} index\r\n */\r\nol.control.MapZone.prototype.removeZone = function (index) {\r\n  var z = this.element.querySelectorAll('.ol-mapzonezone')[index];\r\n  if (z) {\r\n    z.remove();\r\n    this._maps.splice(index, 1);\r\n  }\r\n};\r\n/** Pre-defined zones */\r\nol.control.MapZone.zones = {};\r\n/** French overseas departments  */\r\nol.control.MapZone.zones.DOM = [{\r\n  \"title\": \"Guadeloupe\",\r\n  \"extent\": [ -61.898594315312444, 15.75623038647845, -60.957887532935324, 16.575317670979473 ]\r\n},{\r\n  \"title\": \"Guyane\",\r\n  \"extent\": [ -54.72525931072715, 2.1603763430019, -51.528236062921344, 5.7984307809552575 ]\r\n},{\r\n  \"title\": \"Martinique\",\r\n  \"extent\": [ -61.257556528564756, 14.387506317407514, -60.76934912110432, 14.895067461729951 ]\r\n},{\r\n  \"title\": \"Mayotte\",\r\n  \"extent\": [ 44.959844536967815, -13.01674138212816, 45.35328866510648, -12.65521942207829 ]\r\n},{\r\n  \"title\": \"La réunion\",\r\n  \"extent\": [ 55.17059012967656, -21.407680069231688, 55.88195702001797, -20.85560221637526 ]\r\n}];\r\n/** French overseas territories */\r\nol.control.MapZone.zones.TOM = [{\r\n  \"title\": \"Polynésie Française\",\r\n  \"extent\": [ 206.23664226630862, -22.189040615809787, 221.85920743981987, -10.835039595040698 ]\r\n},{\r\n  \"title\": \"Nouvelle Calédonie\",\r\n  \"extent\": [ 163.76420580160925, -22.581641092751838, 167.66984709498706, -19.816411635668445 ]\r\n},{\r\n  \"title\": \"St-Pierre et Miquelon\",\r\n  \"extent\": [ -56.453698765748676, 46.74449858188555, -56.0980198121544, 47.14669874229787 ]\r\n},{\r\n  \"title\": \"Wallis et Futuna\",\r\n  \"extent\": [ 181.7588623143665, -14.7341169873267, 183.95612353301715, -13.134720799175085 ]\r\n},{\r\n  \"title\": \"St-Martin St-Barthélemy\",\r\n  \"extent\": [ -63.1726389501678, 17.806097291313506, -62.7606535945649, 18.13267688837938 ]\r\n}];\r\n/** French overseas departments and territories */\r\nol.control.MapZone.zones.DOMTOM = [{\r\n  title: 'Métropole',\r\n  extent: [ -5.318421740712579, 41.16082274292913, 9.73284186155716, 51.21957336557702 ]\r\n}].concat(ol.control.MapZone.zones.DOM, ol.control.MapZone.zones.TOM);\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Control overlay for OL3\r\n * The overlay control is a control that display an overlay over the map\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fire change:visible\r\n * @param {Object=} options Control options.\r\n *  @param {string} className class of the control\r\n *  @param {boolean} hideOnClick hide the control on click, default false\r\n *  @param {boolean} closeBox add a closeBox to the control, default false\r\n */\r\nol.control.Notification = function(options) {\r\n  options = options || {};\r\n\tvar element = document.createElement(\"DIV\");\r\n  this.contentElement = document.createElement(\"DIV\");\r\n  element.appendChild(this.contentElement);\r\n  var classNames = (options.className||\"\")+ \" ol-notification\";\r\n\tif (!options.target) {\r\n    classNames += \" ol-unselectable ol-control ol-collapsed\";\r\n  }\r\n\telement.setAttribute('class', classNames);\r\n\tol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n};\r\nol.ext.inherits(ol.control.Notification, ol.control.Control);\r\n/**\r\n * Display a notification on the map\r\n * @param {string|node|undefined} what the notification to show, default get the last one\r\n * @param {number} [duration=3000] duration in ms, if -1 never hide\r\n */\r\nol.control.Notification.prototype.show = function(what, duration) {\r\n  var self = this;\r\n  var elt = this.element;\r\n  if (what) {\r\n    if (what instanceof Node) {\r\n      this.contentElement.innerHTML = '';\r\n      this.contentElement.appendChild(what);\r\n    } else {\r\n      this.contentElement.innerHTML = what;\r\n    }\r\n  }\r\n  if (this._listener) {\r\n    clearTimeout(this._listener);\r\n    this._listener = null;\r\n  }\r\n  elt.classList.add('ol-collapsed');\r\n  this._listener = setTimeout(function() {\r\n    elt.classList.remove('ol-collapsed');\r\n    if (!duration || duration >= 0) {\r\n      self._listener = setTimeout(function() {\r\n        elt.classList.add('ol-collapsed');\r\n        self._listener = null;\r\n      }, duration || 3000);\r\n    } else {\r\n      self._listener = null;\r\n    }\r\n  }, 100);\r\n};\r\n/**\r\n * Remove a notification on the map\r\n */\r\nol.control.Notification.prototype.hide = function() {\r\n  if (this._listener) {\r\n    clearTimeout(this._listener);\r\n    this._listener = null;\r\n  }\r\n  this.element.classList.add('ol-collapsed');\r\n};\r\n/**\r\n * Toggle a notification on the map\r\n * @param {number} [duration=3000] duration in ms\r\n */\r\nol.control.Notification.prototype.toggle = function(duration) {\r\n  if (this.element.classList.contains('ol-collapsed')) {\r\n    this.show(null, duration);\r\n  } else {\r\n    this.hide();\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Control overlay for OL3\r\n * The overlay control is a control that display an overlay over the map\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fire change:visible\r\n * @param {Object=} options Control options.\r\n *\t@param {String} options.className class of the control\r\n*\t@param {String|Element} options.content\r\n*\t@param {bool} options.hideOnClick hide the control on click, default false\r\n*\t@param {bool} options.closeBox add a closeBox to the control, default false\r\n*/\r\nol.control.Overlay = function(options) {\r\n  if (!options) options={};\r\n/*\r\n  var element = document.createElement(\"div\");\r\n  element.classList.add('ol-unselectable', 'ol-overlay');\r\n  //if (options.className) element.classList.add(options.className);\r\n*/\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: 'ol-unselectable ol-overlay '+(options.className||''),\r\n    html: options.content\r\n  });\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  var self = this;\r\n  if (options.hideOnClick) element.addEventListener(\"click\", function(){self.hide();});\r\n  this.set(\"closeBox\", options.closeBox);\r\n  this._timeout = false;\r\n  this.setContent (options.content);\r\n};\r\nol.ext.inherits(ol.control.Overlay, ol.control.Control);\r\n/** Set the content of the overlay\r\n* @param {string|Element} html the html to display in the control\r\n*/\r\nol.control.Overlay.prototype.setContent = function (html) {\r\n  var self = this;\r\n  if (html) {\r\n    var elt = this.element;\r\n    if (html instanceof Element) {\r\n      elt.innerHTML='';\r\n      elt.appendChild(html)\r\n    }\r\n    else if (html!==undefined) elt.innerHTML = html;\r\n    if (this.get(\"closeBox\")) {\r\n      var cb = document.createElement(\"div\");\r\n      cb.classList.add(\"ol-closebox\");\r\n      cb.addEventListener(\"click\", function(){self.hide();});\r\n      elt.insertBefore(cb, elt.firstChild);\r\n    }\r\n  }\r\n};\r\n/** Set the control visibility\r\n* @param {string|Element} html the html to display in the control\r\n* @param {ol.coordinate} coord coordinate of the top left corner of the control to start from\r\n*/\r\nol.control.Overlay.prototype.show = function (html, coord) {\r\n  var self = this;\r\n  var elt = this.element;\r\n  elt.style.display = 'block';\r\n  if (coord) {\r\n    this.center_ = this.getMap().getPixelFromCoordinate(coord);\r\n    elt.style.top = this.center_[1]+'px';\r\n    elt.style.left = this.center_[0]+'px';\r\n  } else {\r\n    //TODO: Do fix from  hkollmann pull request\r\n    this.center_ = false;\r\n    elt.style.top = \"\";\r\n    elt.style.left = \"\";\r\n  }\r\n  if (html) this.setContent(html);\r\n  if (this._timeout) clearTimeout(this._timeout);\r\n  this._timeout = setTimeout(function() {\r\n    elt.classList.add(\"ol-visible\")\r\n    elt.style.top = \"\";\r\n    elt.style.left = \"\";\r\n    self.dispatchEvent({ type:'change:visible', visible:true, element: self.element });\r\n  }, 10);\r\n};\r\n/** Show an image\r\n * @param {string} src image url\r\n * @param {*} options\r\n *  @param {string} options.title\r\n *  @param {ol.coordinate} coordinate\r\n */\r\nol.control.Overlay.prototype.showImage = function (src, options) {\r\n  options = options || {};\r\n  var content = ol.ext.element.create('DIV', {\r\n    className: 'ol-fullscreen-image'\r\n  });\r\n  ol.ext.element.create('IMG', {\r\n    src: src,\r\n    parent: content\r\n  });\r\n  if (options.title) {\r\n    content.classList.add('ol-has-title');\r\n    ol.ext.element.create('P', { \r\n      html: options.title,\r\n      parent: content\r\n    });\r\n  }\r\n  this.show(content, options.coordinate);\r\n};\r\n/** Set the control visibility hidden\r\n*/\r\nol.control.Overlay.prototype.hide = function () {\r\n  var elt = this.element;\r\n  this.element.classList.remove(\"ol-visible\");\r\n  if (this.center_) {\r\n    elt.style.top = this.center_[1]+'px';\r\n    elt.style.left = this.center_[0]+'px';\r\n    this.center_ = false;\r\n  }\r\n  if (this._timeout) clearTimeout(this._timeout);\r\n  this._timeout = setTimeout(function(){ elt.style.display = 'none'; }, 500);\r\n  this.dispatchEvent({ type:'change:visible', visible:false, element: this.element });\r\n};\r\n/** Toggle control visibility\r\n*/\r\nol.control.Overlay.prototype.toggle = function () {\t\r\n  if (this.getVisible()) this.hide();\r\n  else this.show();\r\n}\r\n/** Get the control visibility\r\n* @return {boolean} b\r\n*/\r\nol.control.Overlay.prototype.getVisible = function () {\r\n  return ol.ext.element.getStyle(this.element, 'display') !== 'none';\r\n};\r\n/** Change class name\r\n* @param {String} className a class name or a list of class names separated by a space\r\n*/\r\nol.control.Overlay.prototype.setClass = function (className) {\r\n  var vis = this.element.classList.contains('ol-visible');\r\n  this.element.className = ('ol-unselectable ol-overlay '+(vis ? 'ol-visible ' : '')+className).trim();\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * OpenLayers 3 Layer Overview Control.\r\n * The overview can rotate with map. \r\n * Zoom levels are configurable.\r\n * Click on the overview will center the map.\r\n * Change width/height of the overview trough css.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n *  @param {ol.ProjectionLike} options.projection The projection. Default is EPSG:3857 (Spherical Mercator).\r\n *  @param {Number} options.minZoom default 0\r\n *  @param {Number} options.maxZoom default 18\r\n *  @param {boolean} options.rotation enable rotation, default false\r\n *  @param {top|bottom-left|right} options.align position\r\n *  @param {Array<ol.layer>} options.layers list of layers\r\n *  @param {ol.style.Style | Array.<ol.style.Style> | undefined} options.style style to draw the map extent on the overveiw\r\n *  @param {bool|elastic} options.panAnimation use animation to center map on click, default true\r\n */\r\nol.control.Overview = function(options)\r\n{\toptions = options || {};\r\n  var self = this;\r\n  // API\r\n  this.minZoom = options.minZoom || 0;\r\n  this.maxZoom = options.maxZoom || 18;\r\n  this.rotation = options.rotation;\r\n  var element;\r\n  if (options.target) {\r\n    element = document.createElement(\"div\");\r\n    this.panel_ = options.target;\r\n  } else {\r\n    element = document.createElement(\"div\");\r\n    element.classList.add('ol-overview', 'ol-unselectable', 'ol-control', 'ol-collapsed');\r\n    if (/top/.test(options.align)) element.classList.add('ol-control-top');\r\n    if (/right/.test(options.align)) element.classList.add('ol-control-right');\r\n    var button = document.createElement(\"button\");\r\n        button.setAttribute('type','button');\r\n        button.addEventListener(\"touchstart\", function(e){ self.toggleMap(); e.preventDefault(); });\r\n        button.addEventListener(\"click\", function(){self.toggleMap()});\r\n        element.appendChild(button);\r\n    this.panel_ = document.createElement(\"div\");\r\n    this.panel_.classList.add(\"panel\");\r\n    element.appendChild(this.panel_);\r\n  }\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  // Create a overview map\r\n  this.ovmap_ = new ol.Map({\r\n    controls: new ol.Collection(),\r\n    interactions: new ol.Collection(),\r\n    target: this.panel_,\r\n    view: new ol.View ({\r\n      zoom: 2,\r\n      center: [0,0],\r\n      projection: options.projection\r\n    }),\r\n    layers: options.layers\r\n  });\r\n  this.oview_ = this.ovmap_.getView();\r\n  // Cache extent\r\n  this.extentLayer = new ol.layer.Vector({\r\n    name: 'Cache extent',\r\n    source: new ol.source.Vector(),\r\n    style: options.style || [new ol.style.Style({\r\n      image: new ol.style.Circle({\r\n        fill: new ol.style.Fill({\r\n          color: 'rgba(255,0,0, 1)'\r\n        }),\r\n        stroke: new ol.style.Stroke({\r\n          width: 7,\r\n            color: 'rgba(255,0,0, 0.8)'\r\n          }),\r\n          radius: 5\r\n        }),\r\n        stroke: new ol.style.Stroke({\r\n          width: 5,\r\n          color: \"rgba(255,0,0,0.8)\"\r\n        })\r\n      }\r\n    )]\r\n  })\r\n  this.ovmap_.addLayer(this.extentLayer);\r\n  /** Elastic bounce\r\n  *\t@param {Int} bounce number of bounce\r\n  *\t@param {Number} amplitude amplitude of the bounce [0,1] \r\n  *\t@return {Number}\r\n  * /\r\n  var bounceFn = function (bounce, amplitude){\r\n    var a = (2*bounce+1) * Math.PI/2;\r\n    var b = amplitude>0 ? -1/amplitude : -100;\r\n    var c = - Math.cos(a) * Math.pow(2, b);\r\n    return function(t) {\r\n      t = 1-Math.cos(t*Math.PI/2);\r\n      return 1 + Math.abs( Math.cos(a*t) ) * Math.pow(2, b*t) + c*t;\r\n    }\r\n  }\r\n  /** Elastic bounce\r\n  *\t@param {Int} bounce number of bounce\r\n  *\t@param {Number} amplitude amplitude of the bounce [0,1] \r\n  *\t@return {Number}\r\n  */\r\n  var elasticFn = function (bounce, amplitude) {\r\n    var a = 3*bounce * Math.PI/2;\r\n    var b = amplitude>0 ? -1/amplitude : -100;\r\n    var c = Math.cos(a) * Math.pow(2, b);\r\n    return function(t){\r\n      t = 1-Math.cos(t*Math.PI/2);\r\n      return 1 - Math.cos(a*t) * Math.pow(2, b*t) + c*t;\r\n    }\r\n  }\r\n  // Click on the preview center the map\r\n  this.ovmap_.addInteraction (new ol.interaction.Pointer({\r\n    handleDownEvent: function(evt) {\r\n      if (options.panAnimation !==false) {\r\n        if (options.panAnimation==\"elastic\" || options.elasticPan) {\r\n          self.getMap().getView().animate({\r\n            center: evt.coordinate,\r\n            easing: elasticFn(2,0.3),\r\n            duration: 1000\r\n          });\r\n        } else {\r\n          self.getMap().getView().animate({\r\n            center: evt.coordinate,\r\n            duration: 300\r\n          });\r\n        }\r\n      }\r\n      else self.getMap().getView().setCenter(evt.coordinate);\r\n      return false;\r\n    }\r\n  }));\r\n};\r\nol.ext.inherits(ol.control.Overview, ol.control.Control);\r\n/** Get overview map\r\n*\t@return {ol.Map}\r\n*/\r\nol.control.Overview.prototype.getOverviewMap = function(){\r\n  return this.ovmap_;\r\n};\r\n/** Toggle overview map\r\n*/\r\nol.control.Overview.prototype.toggleMap = function(){\r\n  this.element.classList.toggle(\"ol-collapsed\");\r\n  this.ovmap_.updateSize();\r\n  this.setView();\r\n};\r\n/** Set overview map position\r\n*\t@param {top|bottom-left|right}\r\n*/\r\nol.control.Overview.prototype.setPosition = function(align){\r\n  if (/top/.test(align)) this.element.classList.add(\"ol-control-top\");\r\n  else this.element.classList.remove(\"ol-control-top\");\r\n  if (/right/.test(align)) this.element.classList.add(\"ol-control-right\");\r\n  else this.element.classList.remove(\"ol-control-right\");\r\n};\r\n/**\r\n * Set the map instance the control associated with.\r\n * @param {ol.Map} map The map instance.\r\n */\r\nol.control.Overview.prototype.setMap = function(map) {\r\n  if (this._listener) {\r\n    for (var i in this._listener) {\r\n      ol.Observable.unByKey(this._listener[i]);\r\n    }\r\n  }\r\n  this._listener = {};\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  if (map) {\r\n    this._listener.map = map.on('change:view', function() {\r\n      if (this._listener.view) ol.Observable.unByKey(this._listener.view);\r\n      if (map.getView()) {\r\n        this._listener.view = map.getView().on('propertychange', this.setView.bind(this));\r\n        this.setView();\r\n      }\r\n    }.bind(this));\r\n    this._listener.view = map.getView().on('propertychange', this.setView.bind(this));\r\n    this.setView();\r\n  }\r\n};\r\n/** Calculate the extent of the map and draw it on the overview\r\n*/\r\nol.control.Overview.prototype.calcExtent_ = function(extent){\r\n  var map = this.getMap();\r\n  if (!map) return;\r\n  var source = this.extentLayer.getSource();\r\n  source.clear();\r\n  var f = new ol.Feature();\r\n  var size = map.getSize();\r\n  var resolution = map.getView().getResolution();\r\n  var rotation = map.getView().getRotation();\r\n  var center = map.getView().getCenter();\r\n  if (!resolution) return;\r\n  var dx = resolution * size[0] / 2;\r\n  var dy = resolution * size[1] / 2;\r\n  var res2 = this.oview_.getResolution();\r\n  if (dx/res2>5 || dy/res2>5) {\r\n    var cos = Math.cos(rotation);\r\n    var sin = Math.sin(rotation);\r\n    var i, x, y;\r\n    extent=[[-dx,-dy],[-dx,dy],[dx,dy],[dx,-dy]];\r\n    for (i = 0; i < 4; ++i) {\r\n      x = extent[i][0];\r\n      y = extent[i][1];\r\n      extent[i][0] = center[0] + x * cos - y * sin;\r\n      extent[i][1] = center[1] + x * sin + y * cos;\r\n    }\r\n    f.setGeometry (new ol.geom.Polygon( [ extent ]));\r\n  } else {\r\n    f.setGeometry (new ol.geom.Point( center ));\r\n  }\r\n  source.addFeature(f);\r\n};\r\n/**\r\n*\t@private\r\n*/\r\nol.control.Overview.prototype.setView = function(e){\r\n  if (!e) {\r\n    // refresh all\r\n    this.setView({key:'rotation'});\r\n    this.setView({key:'resolution'});\r\n    this.setView({key:'center'});\r\n    return;\r\n  }\r\n  // Set the view params\r\n  switch (e.key){\r\n    case 'rotation': {\r\n      if (this.rotation) this.oview_.setRotation(this.getMap().getView().getRotation());\r\n      else if (this.oview_.getRotation()) this.oview_.setRotation(0);\r\n      break;\r\n    }\r\n    case 'center': {\r\n      var mapExtent = this.getMap().getView().calculateExtent(this.getMap().getSize());\r\n      var extent = this.oview_.calculateExtent(this.ovmap_.getSize());\r\n      if (mapExtent[0]<extent[0] || mapExtent[1]<extent[1] \r\n      || mapExtent[2]>extent[2] || mapExtent[3]>extent[3]){\r\n        this.oview_.setCenter(this.getMap().getView().getCenter()); \r\n      }\r\n      break;\r\n    }\t\r\n    case 'resolution': {\r\n      //var z = Math.round(this.getMap().getView().getZoom()/2)*2-4;\r\n      var z = Math.round(this.oview_.getZoomForResolution(this.getMap().getView().getResolution())/2)*2-4;\r\n      z = Math.min ( this.maxZoom, Math.max(this.minZoom, z) );\r\n      this.oview_.setZoom(z);\r\n      break;\r\n    }\r\n    default: break;\r\n  }\r\n  this.calcExtent_();\r\n};\r\n\r\n/*\tCopyright (c) 2015-2018 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Set an hyperlink that will return the user to the current map view.\r\n * Just add a `permalink`property to layers to be handled by the control (and added in the url). \r\n * The layer's permalink property is used to name the layer in the url.\r\n * The control must be added after all layer are inserted in the map to take them into acount.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options\r\n *  @param {boolean} options.urlReplace replace url or not, default true\r\n *  @param {boolean|string} [options.localStorage=false] save current map view in localStorage, if 'position' only store map position\r\n *  @param {boolean} options.geohash use geohash instead of lonlat, default false\r\n *  @param {integer} options.fixed number of digit in coords, default 6\r\n *  @param {boolean} options.anchor use \"#\" instead of \"?\" in href\r\n *  @param {boolean} options.visible hide the button on the map, default true\r\n *  @param {boolean} options.hidden hide the button on the map, default false DEPRECATED: use visible instead\r\n *  @param {function} options.onclick a function called when control is clicked\r\n*/\r\nol.control.Permalink = function(opt_options) {\r\n  var options = opt_options || {};\r\n  var self = this;\r\n  var button = document.createElement('button');\r\n  this.replaceState_ = (options.urlReplace!==false);\r\n  this.fixed_ = options.fixed || 6;\r\n  this.hash_ = options.anchor ? \"#\" : \"?\";\r\n  this._localStorage = options.localStorage;\r\n  if (!this._localStorage) {\r\n    try {\r\n      localStorage.removeItem('ol@permalink');\r\n    } catch(e) { console.warn('Failed to access localStorage...'); }\r\n  }\r\n  function linkto() {\r\n    if (typeof(options.onclick) == 'function') options.onclick(self.getLink());\r\n    else self.setUrlReplace(!self.replaceState_);\r\n  }\r\n  button.addEventListener('click', linkto, false);\r\n  button.addEventListener('touchstart', linkto, false);\r\n  var element = document.createElement('div');\r\n  element.className = (options.className || \"ol-permalink\") + \" ol-unselectable ol-control\";\r\n  element.appendChild(button);\r\n  if (options.hidden || options.visible===false) ol.ext.element.hide(element);\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.set('geohash', options.geohash);\r\n  this.set('initial', false);\r\n  this.on ('change', this.viewChange_.bind(this));\r\n  // Save search params\r\n  this.search_ = {};\r\n  var init = {};\r\n  var hash = document.location.hash || document.location.search || '';\r\n//  console.log('hash', hash)\r\n  if (this.replaceState_ && !hash && this._localStorage) {\r\n    try {\r\n      hash = localStorage['ol@permalink'];\r\n    } catch(e) { console.warn('Failed to access localStorage...'); }\r\n  }\r\n  if (hash) {\r\n    hash = hash.replace(/(^#|^\\?)/,\"\").split(\"&\");\r\n    for (var i=0; i<hash.length;  i++) {\r\n      var t = hash[i].split(\"=\");\r\n      switch(t[0]) {\r\n        case 'lon':\r\n        case 'lat':\r\n        case 'z': \r\n        case 'r': {\r\n          init[t[0]] = t[1];\r\n          break\r\n        }\r\n        case 'gh': {\r\n          var ghash = t[1].split('-');\r\n          var lonlat = ol.geohash.toLonLat(ghash[0]);\r\n          init.lon = lonlat[0];\r\n          init.lat = lonlat[1];\r\n          init.z = ghash[1];\r\n          break;\r\n        }\r\n        case 'l': break;\r\n        default: this.search_[t[0]] = t[1];\r\n      }\r\n    }\r\n  }\r\n  if (init.hasOwnProperty('lon')) {\r\n    this.set('initial', init);\r\n  }\r\n  // Decode permalink\r\n  if (this.replaceState_) this.setPosition();\r\n};\r\nol.ext.inherits(ol.control.Permalink, ol.control.Control);\r\n/**\r\n * Get the initial position passed by the url\r\n */\r\nol.control.Permalink.prototype.getInitialPosition = function() {\r\n  return this.get('initial');\r\n};\r\n/**\r\n * Set the map instance the control associated with.\r\n * @param {ol.Map} map The map instance.\r\n */\r\nol.control.Permalink.prototype.setMap = function(map) {\r\n  if (this._listener) {\r\n    ol.Observable.unByKey(this._listener.change);\r\n    ol.Observable.unByKey(this._listener.moveend);\r\n  }\r\n  this._listener = null;\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  // Get change \r\n  if (map) {\r\n    this._listener = {\r\n      change: map.getLayerGroup().on('change', this.layerChange_.bind(this)),\r\n      moveend: map.on('moveend', this.viewChange_.bind(this))\r\n    };\r\n    this.setPosition();\r\n  }\r\n};\r\n/** Get layer given a permalink name (permalink propertie in the layer)\r\n*\t@param {string} the permalink to search for\r\n*\t@param {Array<ol.layer>|undefined} an array of layer to search in\r\n*\t@return {ol.layer|false}\r\n*/\r\nol.control.Permalink.prototype.getLayerByLink =  function (id, layers) {\r\n  if (!layers && this.getMap()) layers = this.getMap().getLayers().getArray();\r\n  for (var i=0; i<layers.length; i++) {\r\n    if (layers[i].get('permalink') == id) return layers[i];\r\n    // Layer Group\r\n    if (layers[i].getLayers) {\r\n      var li = this.getLayerByLink ( id, layers[i].getLayers().getArray() );\r\n      if (li) return li;\r\n    }\r\n  }\r\n  return false;\r\n};\r\n/** Set coordinates as geohash\r\n * @param {boolean}\r\n */\r\nol.control.Permalink.prototype.setGeohash = function(b) {\r\n  this.set('geohash', b);\r\n  this.setUrlParam();\r\n};\r\n/** Set map position according to the current link \r\n * @param {boolean} [force=false] if true set the position even if urlReplace is disabled\r\n */\r\nol.control.Permalink.prototype.setPosition = function(force) {\r\n  var map = this.getMap();\r\n  if (!map) return;\r\n  var hash = (this.replaceState_ || force) ? document.location.hash || document.location.search : '';\r\n  if (!hash && this._localStorage) {\r\n    try {\r\n      hash = localStorage['ol@permalink'];\r\n    } catch(e) { console.warn('Failed to access localStorage...'); }\r\n  }\r\n  if (!hash) return;\r\n  var i, t, param = {};\r\n  hash = hash.replace(/(^#|^\\?)/,\"\").split(\"&\");\r\n  for (i=0; i<hash.length;  i++) {\r\n    t = hash[i].split(\"=\");\r\n    param[t[0]] = t[1];\r\n  }\r\n  if (param.gh) {\r\n    var ghash = param.gh.split('-');\r\n    var lonlat = ol.geohash.toLonLat(ghash[0] );\r\n    param.lon = lonlat[0];\r\n    param.lat = lonlat[1];\r\n    param.z = ghash[1];\r\n  }\r\n  var c = ol.proj.transform([Number(param.lon),Number(param.lat)], 'EPSG:4326', map.getView().getProjection());\r\n  if (c[0] && c[1]) map.getView().setCenter(c);\r\n  if (param.z) map.getView().setZoom(Number(param.z));\r\n  if (param.r) map.getView().setRotation(Number(param.r));\r\n  // Reset layers visibility\r\n  function resetLayers(layers) {\r\n    if (!layers) layers = map.getLayers().getArray();\r\n    for (var i=0; i<layers.length; i++){\r\n      if (layers[i].get('permalink')) {\r\n        layers[i].setVisible(false);\r\n        // console.log(\"hide \"+layers[i].get('permalink'));\r\n      }\r\n      if (layers[i].getLayers) {\r\n        resetLayers (layers[i].getLayers().getArray());\r\n      }\r\n    }\r\n  }\r\n  if (param.l) {\r\n    resetLayers();\r\n    var l = param.l.split(\"|\");\r\n    for (i=0; i<l.length; i++) {\r\n      t = l[i].split(\":\");\r\n      var li = this.getLayerByLink(t[0]);\r\n      var op = Number(t[1]);\r\n      if (li) {\r\n        li.setOpacity(op);\r\n        li.setVisible(true);\r\n      }\r\n    }\r\n  }\r\n};\r\n/**\r\n * Get the parameters added to the url. The object can be changed to add new values.\r\n * @return {Object} a key value object added to the url as &key=value\r\n * @api stable\r\n */\r\nol.control.Permalink.prototype.getUrlParams = function() {\r\n  return this.search_;\r\n};\r\n/**\r\n * Set a parameter to the url.\r\n * @param {string} key the key parameter\r\n * @param {string|undefined} value the parameter's value, if undefined or empty string remove the parameter\r\n * @api stable\r\n */\r\nol.control.Permalink.prototype.setUrlParam = function(key, value) {\r\n  if (key) {\r\n    if (value===undefined || value==='') delete (this.search_[encodeURIComponent(key)])\r\n    else this.search_[encodeURIComponent(key)] = encodeURIComponent(value);\r\n  }\r\n  this.viewChange_();\r\n};\r\n/**\r\n * Get a parameter url.\r\n * @param {string} key the key parameter\r\n * @return {string} the parameter's value or empty string if not set\r\n * @api stable\r\n */\r\nol.control.Permalink.prototype.getUrlParam = function(key) {\r\n  return decodeURIComponent (this.search_[encodeURIComponent(key)] || '');\r\n};\r\n/**\r\n * Has a parameter url.\r\n * @param {string} key the key parameter\r\n * @return {boolean} \r\n * @api stable\r\n */\r\nol.control.Permalink.prototype.hasUrlParam = function(key) {\r\n  return this.search_.hasOwnProperty(encodeURIComponent(key));\r\n};\r\n/** Get the permalink\r\n * @param {boolean|string} [search=false] false: return full link | true: return the search string only | 'position': return position string\r\n * @return {permalink}\r\n */\r\nol.control.Permalink.prototype.getLink = function(search) {\r\n  var map = this.getMap();\r\n  var c = ol.proj.transform(map.getView().getCenter(), map.getView().getProjection(), 'EPSG:4326');\r\n  var z = Math.round(map.getView().getZoom()*10)/10;\r\n  var r = map.getView().getRotation();\r\n  var l = this.layerStr_;\r\n  // Change anchor\r\n  var anchor = (r ? \"&r=\"+(Math.round(r*10000)/10000) : \"\") + (l ? \"&l=\"+l : \"\");\r\n  if (this.get('geohash')) {\r\n    var ghash = ol.geohash.fromLonLat(c,8);\r\n    anchor = \"gh=\" + ghash + '-' + z + anchor;\r\n  } else {\r\n    anchor = \"lon=\"+c[0].toFixed(this.fixed_)+\"&lat=\"+c[1].toFixed(this.fixed_)+\"&z=\"+z + anchor;\r\n  }\r\n  if (search === 'position') return anchor;\r\n  // Add other params\r\n  for (var i in this.search_) {\r\n    anchor += \"&\" + i + (typeof(this.search_[i])!=='undefined' ? \"=\"+this.search_[i] : '');\r\n  }\r\n  if (search) return anchor;\r\n  //return document.location.origin+document.location.pathname+this.hash_+anchor;\r\n  return document.location.protocol+\"//\"+document.location.host+document.location.pathname+this.hash_+anchor;\r\n};\r\n/** Check if urlreplace is on\r\n * @return {boolean}\r\n */\r\nol.control.Permalink.prototype.getUrlReplace = function() {\r\n  return this.replaceState_;\r\n};\r\n/** Enable / disable url replacement (replaceSate)\r\n *\t@param {bool}\r\n */\r\nol.control.Permalink.prototype.setUrlReplace = function(replace) {\r\n  try {\r\n    this.replaceState_ = replace;\r\n    if (!replace) {\r\n      var s = \"\";\r\n      for (var i in this.search_) {\r\n        s += (s==\"\"?\"?\":\"&\") + i + (typeof(this.search_[i]) !== 'undefined' ? \"=\"+this.search_[i] : '');\r\n      }\r\n      window.history.replaceState (null,null, document.location.origin+document.location.pathname+s);\r\n    }\r\n    else window.history.replaceState (null,null, this.getLink());\r\n  } catch(e) {/* ok */}\r\n  /*\r\n  if (this._localStorage) {\r\n    localStorage['ol@permalink'] = this.getLink(true);\r\n  }\r\n  */\r\n};\r\n/**\r\n * On view change refresh link\r\n * @param {ol.event} The map instance.\r\n * @private\r\n */\r\nol.control.Permalink.prototype.viewChange_ = function() {\r\n  try {\r\n    if (this.replaceState_) window.history.replaceState (null,null, this.getLink());\r\n  } catch(e) {/* ok */}\r\n  if (this._localStorage) {\r\n    try {\r\n      localStorage['ol@permalink'] = this.getLink(this._localStorage);\r\n    } catch(e) { console.warn('Failed to access localStorage...'); }\r\n  }\r\n};\r\n/**\r\n * Layer change refresh link\r\n * @private\r\n */\r\nol.control.Permalink.prototype.layerChange_ = function() {\r\n  // Prevent multiple change at the same time\r\n  if (this._tout) {\r\n    clearTimeout(this._tout);\r\n    this._tout = null;\r\n  }\r\n  this._tout = setTimeout(function() {\r\n    this._tout = null;\r\n    // Get layers\r\n    var l = \"\";\r\n    function getLayers(layers) {\r\n      for (var i=0; i<layers.length; i++) {\r\n        if (layers[i].getVisible() && layers[i].get(\"permalink\")) {\r\n          if (l) l += \"|\";\r\n          l += layers[i].get(\"permalink\")+\":\"+layers[i].get(\"opacity\");\r\n        }\r\n        // Layer Group\r\n        if (layers[i].getLayers) getLayers(layers[i].getLayers().getArray());\r\n      }\r\n    }\r\n    getLayers(this.getMap().getLayers().getArray());\r\n    this.layerStr_ = l;\r\n    this.viewChange_();\r\n  }.bind(this), 200);\r\n};\r\n\r\n/*\r\n  Copyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Print control to get an image of the map\r\n * @constructor\r\n * @fire print\r\n * @fire error\r\n * @fire printing\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n *\t@param {String} options.className class of the control\r\n *\t@param {String} options.title button title\r\n *\t@param {string} options.imageType A string indicating the image format, default image/jpeg\r\n *\t@param {number} options.quality Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp\r\n *\t@param {string} options.orientation Page orientation (landscape/portrait), default guest the best one\r\n *\t@param {boolean} options.immediate force print even if render is not complete,  default false\r\n */\r\nol.control.Print = function(options) {\r\n  if (!options) options = {};\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: (options.className || 'ol-print')\r\n  });\r\n  if (!options.target) {\r\n    element.classList.add('ol-unselectable', 'ol-control');\r\n    ol.ext.element.create('BUTTON', {\r\n      type: 'button',\r\n      title: options.title || 'Print',\r\n      click: function() { this.print(); }.bind(this),\r\n      parent: element\r\n    });\r\n  }\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.set('immediate', options.immediate);\r\n  this.set('imageType', options.imageType || 'image/jpeg');\r\n  this.set('quality', options.quality || .8);\r\n  this.set('orientation', options.orientation);\r\n};\r\nol.ext.inherits(ol.control.Print, ol.control.Control);\r\n/** Helper function to copy result to clipboard\r\n * @param {Event} e print event\r\n * @return {boolean}\r\n * @private\r\n */\r\nol.control.Print.prototype.toClipboard = function(e, callback) {\r\n  try {\r\n    e.canvas.toBlob(function(blob) {\r\n      try {\r\n        navigator.clipboard.write([\r\n          new window.ClipboardItem(\r\n            Object.defineProperty({}, blob.type, {\r\n              value: blob,\r\n              enumerable: true\r\n            })\r\n          )\r\n        ])\r\n        if (typeof(callback) === 'function') callback(true);\r\n      } catch (err) {\r\n        if (typeof(callback) === 'function') callback(false);\r\n      }\r\n    });\r\n  } catch(err) {\r\n    if (typeof(callback) === 'function') callback(false);\r\n  }\r\n};\r\n/** Helper function to copy result to clipboard\r\n * @param {any} options print options\r\n * @param {function} callback a callback function that takes a boolean if copy\r\n */\r\nol.control.Print.prototype.copyMap = function(options, callback) {\r\n  this.once('print', function(e) {\r\n    this.toClipboard(e, callback);\r\n  }.bind(this));\r\n  this.print(options);\r\n};\r\n/** Get map canvas\r\n * @private\r\n */\r\nol.control.Print.prototype._getCanvas = function(event, imageType, canvas) {\r\n  var ctx;\r\n  // ol <= 5 : get the canvas\r\n  if (event.context) {\r\n    canvas = event.context.canvas;\r\n  } else {\r\n    // Create a canvas if none\r\n    if (!canvas) {\r\n      canvas = document.createElement('canvas');\r\n      var size = this.getMap().getSize();\r\n      canvas.width = size[0];\r\n      canvas.height = size[1];\r\n      ctx = canvas.getContext('2d');\r\n      if (/jp.*g$/.test(imageType)) {\r\n        ctx.fillStyle = this.get('bgColor') || 'white';\r\n        ctx.fillRect(0,0,canvas.width,canvas.height);\t\t\r\n      }\r\n    } else {\r\n      ctx = canvas.getContext('2d');\r\n    }\r\n    // ol6+ : create canvas using layer canvas\r\n    this.getMap().getViewport().querySelectorAll('.ol-layers canvas, canvas.ol-fixedoverlay').forEach(function(c) {\r\n      if (c.width) {\r\n        ctx.save();\r\n        // opacity\r\n        if (c.parentNode.style.opacity==='0') return;\r\n        ctx.globalAlpha = parseFloat(c.parentNode.style.opacity) || 1;\r\n        // Blend mode ?\r\n        if (ol.ext.element.getStyle(c.parentNode, 'mix-blend-mode') === 'multiply') {\r\n          ctx.globalCompositeOperation = 'multiply';\r\n        }\r\n        // transform\r\n        var tr = ol.ext.element.getStyle(c,'transform') || ol.ext.element.getStyle(c,'-webkit-transform');\r\n        if (/^matrix/.test(tr)) {\r\n          tr = tr.replace(/^matrix\\(|\\)$/g,'').split(',');\r\n          tr.forEach(function(t,i) { tr[i] = parseFloat(t); });\r\n          ctx.transform(tr[0],tr[1],tr[2],tr[3],tr[4],tr[5]);\r\n          ctx.drawImage(c, 0, 0);\r\n        } else {\r\n          ctx.drawImage(c, 0, 0, ol.ext.element.getStyle(c,'width'), ol.ext.element.getStyle(c,'height'));\r\n        }\r\n        ctx.restore();\r\n      }\r\n    }.bind(this));\r\n  }\r\n  return canvas;\r\n};\r\n/** Fast print\r\n * @param {*} options print options\r\n *  @param {HTMLCanvasElement|undefined} [options.canvas] if none create one, only for ol@6+\r\n *  @parama {string} options.imageType\r\n */\r\nol.control.Print.prototype.fastPrint = function(options, callback) {\r\n  options = options || {};\r\n  if (this._ol6) {\r\n    requestAnimationFrame(function() {\r\n      callback(this._getCanvas({}, options.imageType, options.canvas));\r\n    }.bind(this));\r\n  } else {\r\n    this.getMap().once('postcompose', function(event) {\r\n      if (!event.context) this._ol6 = true;\r\n      callback(this._getCanvas(event, options.imageType, options.canvas));\r\n    }.bind(this));\r\n    this.getMap().render();\r\n  }\r\n};\r\n/** Print the map\r\n * @param {function} cback a callback function that take a string containing the requested data URI.\r\n * @param {Object} options\r\n *\t@param {string} options.imageType A string indicating the image format, default the control one\r\n *\t@param {number} options.quality Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp\r\n *  @param {boolean} options.immediate true to prevent delay for printing\r\n *  @param {boolean} [options.size=[210,297]] \r\n *  @param {boolean} [options.format=a4]\r\n *  @param {boolean} [options.orient] default control orientation\r\n *  @param {boolean} [options.margin=10]\r\n *  @param {*} options.any any options passed to the print event when fired\r\n * @api\r\n */\r\nol.control.Print.prototype.print = function(options) {\r\n  options = options || {};\r\n  var imageType = options.imageType || this.get('imageType');\r\n  var quality = options.quality || this.get('quality');\r\n  if (this.getMap()) {\r\n    if (options.immediate !== 'silent') {\r\n      this.dispatchEvent(Object.assign({ \r\n        type: 'printing',\r\n      }, options));\r\n    }\r\n    // Start printing after delay to var user show info in the DOM\r\n    if (!options.immediate) {\r\n      setTimeout (function () {\r\n        options = Object.assign({}, options);\r\n        options.immediate = 'silent';\r\n        this.print(options);\r\n      }.bind(this), 200);\r\n      return;\r\n    }\r\n    // Run printing\r\n    this.getMap().once(this.get('immediate') ? 'postcompose' : 'rendercomplete', function(event) {\r\n      var canvas = this._getCanvas(event, imageType);\r\n      // Calculate print format\r\n      var size = options.size || [210,297];\r\n      var format = options.format || 'a4';\r\n      var w, h, position;\r\n      var orient = options.orient || this.get('orientation');\r\n      var margin = typeof(options.margin)==='number' ? options.margin : 10;\r\n      if (canvas) {\r\n        // Calculate size\r\n        if (orient!=='landscape' && orient!=='portrait') {\r\n          orient = (canvas.width > canvas.height) ? 'landscape' : 'portrait';\r\n        }\r\n        if (orient === 'landscape') size = [size[1],size[0]];\r\n        var sc = Math.min ((size[0]-2*margin)/canvas.width,(size[1]-2*margin)/canvas.height);\r\n        w = sc * canvas.width;\r\n        h = sc * canvas.height;\r\n        // Image position\r\n        position = [(size[0] - w)/2, (size[1] - h)/2];\r\n      }\r\n      // get the canvas image\r\n      var image;\r\n      try { \r\n        image = canvas ? canvas.toDataURL(imageType, quality) : null;\r\n      } catch(e) {\r\n        // Fire error event\r\n        this.dispatchEvent({\r\n          type: 'error',\r\n          canvas: canvas\r\n        });\r\n        return;\r\n      }\r\n      // Fire print event\r\n      var e = Object.assign({ \r\n        type: 'print',\r\n        print: {\r\n          format: format,\r\n          orientation: orient,\r\n          unit: 'mm',\r\n          size: size,\r\n          position: position,\r\n          imageWidth: w,\r\n          imageHeight: h\r\n        },\r\n        image: image,\r\n        imageType: imageType,\r\n        quality: quality,\r\n        canvas: canvas\r\n      }, options);\r\n      this.dispatchEvent(e);\r\n    }.bind(this));\r\n    this.getMap().render();\r\n  }\r\n};\r\n\r\n/*\r\n  Copyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Print control to get an image of the map\r\n * @constructor\r\n * @fire show\r\n * @fire print\r\n * @fire error\r\n * @fire printing\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n *\t@param {string} options.className class of the control\r\n *\t@param {String} options.title button title\r\n *  @param {string} [options.lang=en] control language, default en\r\n *\t@param {string} options.imageType A string indicating the image format, default image/jpeg\r\n *\t@param {number} options.quality Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp\r\n *\t@param {string} options.orientation Page orientation (landscape/portrait), default guest the best one\r\n *\t@param {boolean} options.immediate force print even if render is not complete,  default false\r\n *\t@param {boolean} [options.openWindow=false] open the file in a new window on print\r\n *\t@param {boolean} [options.copy=true] add a copy select option\r\n *\t@param {boolean} [options.print=true] add a print select option\r\n *\t@param {boolean} [options.pdf=true] add a pdf select option\r\n *\t@param {function} [options.saveAs] a function to save the image as blob\r\n *\t@param {*} [options.jsPDF] jsPDF object to save map as pdf\r\n */\r\nol.control.PrintDialog = function(options) {\r\n  if (!options) options = {};\r\n  this._lang = options.lang;\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: (options.className || 'ol-print') + ' ol-unselectable ol-control'\r\n  });\r\n  ol.ext.element.create('BUTTON', {\r\n    type: 'button',\r\n    title: options.title || 'Print',\r\n    click: function() { \r\n      this.print(); \r\n    }.bind(this),\r\n    parent: element\r\n  });\r\n  ol.control.Control.call(this, {\r\n    element: element\r\n  });\r\n  // Open in a new window\r\n  if (options.openWindow) {\r\n    this.on('print', function(e) {\r\n      // Print success\r\n      if (e.canvas) {\r\n        window.open().document.write('<img src=\"'+e.canvas.toDataURL()+'\"/>');\r\n      }\r\n    });\r\n  }\r\n  // Print control\r\n  options.target = ol.ext.element.create('DIV');\r\n  var printCtrl = this._printCtrl = new ol.control.Print(options);\r\n  printCtrl.on(['print','error','printing'], function(e) {\r\n    content.setAttribute('data-status', e.type);\r\n    if (!e.clipboard) {\r\n      this.dispatchEvent(e);\r\n    }\r\n  }.bind(this));\r\n  // North arrow\r\n  this._compass = new ol.control.Compass({ \r\n    src: options.northImage || 'compact', \r\n    visible: false, \r\n    className: 'olext-print-compass',\r\n    style: new ol.style.Stroke({ color: '#333', width: 0 })\r\n  });\r\n  // Print dialog\r\n  var printDialog = this._printDialog = new ol.control.Dialog({\r\n    target: document.body,\r\n    closeBox: true,\r\n    className: 'ol-ext-print-dialog'\r\n  });\r\n  var content = printDialog.getContentElement();\r\n  this._input = {};\r\n  var param = ol.ext.element.create('DIV',{\r\n    className: 'ol-print-param',\r\n    parent: content\r\n  });\r\n  this._pages = [ ol.ext.element.create('DIV', { \r\n    className: 'ol-page'\r\n  })];\r\n  var printMap = ol.ext.element.create('DIV', {\r\n    className: 'ol-map',\r\n    parent: this._pages[0]\r\n  });\r\n  ol.ext.element.create('DIV', {\r\n    html: this._pages[0],\r\n    className: 'ol-print-map',\r\n    parent: content\r\n  });\r\n  ol.ext.element.create('H2',{\r\n    html: this.i18n('title'),\r\n    parent: param\r\n  });\r\n  var ul = ol.ext.element.create('UL',{ parent: param });\r\n  // Orientation\r\n  var li = ol.ext.element.create('LI', { \r\n    /*\r\n    html: ol.ext.element.create('LABEL', {\r\n      html: this.18n('orientation')\r\n    }),\r\n    */\r\n    className: 'ol-orientation',\r\n    parent: ul \r\n  });\r\n  this._input.orientation = { list: li };\r\n  var label = ol.ext.element.create('LABEL', {\r\n    className: 'portrait',\r\n    parent: li\r\n  });\r\n  this._input.orientation.portrait = ol.ext.element.create('INPUT', {\r\n    type: 'radio',\r\n    name: 'ol-print-orientation',\r\n    value: 'portrait',\r\n    checked: true,\r\n    on: { change: function(e) { \r\n      this.setOrientation(e.target.value);\r\n    }.bind(this) },\r\n    parent: label\r\n  });\r\n  ol.ext.element.create('SPAN', { \r\n    html: this.i18n('portrait'),\r\n    parent: label\r\n  });\r\n  label = ol.ext.element.create('LABEL', {\r\n    className: 'landscape',\r\n    parent: li\r\n  });\r\n  this._input.orientation.landscape = ol.ext.element.create('INPUT',{\r\n    type: 'radio',\r\n    name: 'ol-print-orientation',\r\n    value: 'landscape',\r\n    on: { change: function(e) { \r\n      this.setOrientation(e.target.value);\r\n    }.bind(this) },\r\n    parent: label\r\n  });\r\n  ol.ext.element.create('SPAN', { \r\n    html: this.i18n('landscape'),\r\n    parent: label \r\n  });\r\n  // Page size\r\n  var s; \r\n  li = ol.ext.element.create('LI',{ \r\n    html: ol.ext.element.create('LABEL', {\r\n      html: this.i18n('size'),\r\n    }),\r\n    className: 'ol-size',\r\n    parent: ul \r\n  });\r\n  var size = this._input.size = ol.ext.element.create('SELECT', {\r\n    on: { change: function(){\r\n      this.setSize(size.value || originalSize);\r\n    }.bind(this) },\r\n    parent: li\r\n  });\r\n  for (s in this.paperSize) {\r\n    ol.ext.element.create('OPTION', {\r\n      html: s + (this.paperSize[s] ? ' - '+this.paperSize[s][0]+'x'+this.paperSize[s][1]+' mm' : this.i18n('custom')),\r\n      value: s,\r\n      parent: size\r\n    });\r\n  }\r\n  // Margin\r\n  li = ol.ext.element.create('LI',{ \r\n    html: ol.ext.element.create('LABEL', {\r\n      html: this.i18n('margin'),\r\n    }),\r\n    className: 'ol-margin',\r\n    parent: ul \r\n  });\r\n  var margin = this._input.margin = ol.ext.element.create('SELECT', {\r\n    on: { change: function(){\r\n      this.setMargin(margin.value);\r\n    }.bind(this) },\r\n    parent: li\r\n  });\r\n  for (s in this.marginSize) {\r\n    ol.ext.element.create('OPTION', {\r\n      html: s + ' - ' + this.marginSize[s] + ' mm',\r\n      value: this.marginSize[s],\r\n      parent: margin\r\n    });\r\n  }\r\n  // Scale\r\n  li = ol.ext.element.create('LI',{ \r\n    html: ol.ext.element.create('LABEL', {\r\n      html: this.i18n('scale'),\r\n    }),\r\n    className: 'ol-scale',\r\n    parent: ul \r\n  });\r\n  var scale = this._input.scale = ol.ext.element.create('SELECT', {\r\n    on: { change: function() {\r\n      this.setScale(parseInt(scale.value))\r\n    }.bind(this) },\r\n    parent: li\r\n  });\r\n  Object.keys(this.scales).forEach(function(s) {\r\n    ol.ext.element.create('OPTION', {\r\n      html: this.scales[s],\r\n      value: s,\r\n      parent: scale\r\n    });\r\n  }.bind(this));\r\n  // Legend\r\n  li = ol.ext.element.create('LI',{ \r\n    className: 'ol-legend',\r\n    parent: ul \r\n  });\r\n  var legend = ol.ext.element.createSwitch({ \r\n    html: (this.i18n('legend')),\r\n    checked: false,\r\n    on: { change: function() {\r\n      extraCtrl.legend.control.setCanvas(legend.checked);\r\n    }.bind(this) },\r\n    parent: li \r\n  });\r\n  // North\r\n  li = ol.ext.element.create('LI',{ \r\n    className: 'ol-print-north',\r\n    parent: ul \r\n  });\r\n  var north = this._input.north = ol.ext.element.createSwitch({ \r\n    html: this.i18n('north'),\r\n    checked: 'checked',\r\n    on:  { change: function() {\r\n      if (north.checked) this._compass.element.classList.add('ol-print-compass');\r\n      else this._compass.element.classList.remove('ol-print-compass');\r\n      this.getMap().render();\r\n    }.bind(this)},\r\n    parent: li \r\n  });\r\n  // Title\r\n  li = ol.ext.element.create('LI',{ \r\n    className: 'ol-print-title',\r\n    parent: ul \r\n  });\r\n  var title = ol.ext.element.createSwitch({ \r\n    html: this.i18n('mapTitle'),\r\n    checked: false,\r\n    on: { change: function(e) {\r\n      extraCtrl.title.control.setVisible(e.target.checked);\r\n    }.bind(this) },\r\n    parent: li \r\n  });\r\n  var titleText = ol.ext.element.create('INPUT', {\r\n    type: 'text',\r\n    placeholder: this.i18n('mapTitle'),\r\n    on: {\r\n      keydown: function(e) { \r\n        if (e.keyCode === 13) e.preventDefault();\r\n      },\r\n      keyup: function() { \r\n        extraCtrl.title.control.setTitle(titleText.value);\r\n      },\r\n      change: function() {\r\n        extraCtrl.title.control.setTitle(titleText.value);\r\n      }.bind(this)\r\n    },\r\n    parent: li\r\n  });\r\n  // User div element\r\n  var userElt = ol.ext.element.create('DIV', {\r\n    className: 'ol-user-param',\r\n    parent: param\r\n  });\r\n  // Save as\r\n  li = ol.ext.element.create('LI',{ \r\n    className: 'ol-saveas',\r\n    parent: ul \r\n  });\r\n  var copied = ol.ext.element.create('DIV', {\r\n    html: this.i18n('copied'),\r\n    className: 'ol-clipboard-copy',\r\n    parent: li\r\n  });\r\n  var save = ol.ext.element.create('SELECT', {\r\n    on: { change: function() {\r\n      // Copy to clipboard\r\n      if (this.formats[save.value].clipboard) {\r\n        printCtrl.copyMap(this.formats[save.value], function(isok) {\r\n          if (isok) {\r\n            copied.classList.add('visible');\r\n            setTimeout(function() { copied.classList.remove('visible'); }, 1000);\r\n          }\r\n        });\r\n      } else {\r\n        // Print to file\r\n        var format = (typeof(this.getSize())==='string' ? this.getSize() : null);\r\n        var opt = Object.assign({\r\n          format: format,\r\n          size: format ? this.paperSize[format] : null,\r\n          orient: this.getOrientation(),\r\n          margin: this.getMargin(),\r\n        }, this.formats[save.value]);\r\n        printCtrl.print(opt);\r\n      }\r\n      save.value = '';\r\n    }.bind(this) },\r\n    parent: li\r\n  });\r\n  ol.ext.element.create('OPTION', {\r\n    html: this.i18n('saveas'),\r\n    style: { display: 'none' },\r\n    value: '',\r\n    parent: save\r\n  });\r\n  this.formats.forEach(function(format, i) {\r\n    if (format.pdf) {\r\n      if (options.pdf === false) return;\r\n    } else if (format.clipboard) {\r\n      if (options.copy === false) return;\r\n    } else if (options.save === false) {\r\n      return;\r\n    }\r\n    ol.ext.element.create('OPTION', {\r\n      html: format.title,\r\n      value: i,\r\n      parent: save\r\n    });\r\n  });\r\n  // Save Legend\r\n  li = ol.ext.element.create('LI',{ \r\n    className: 'ol-savelegend',\r\n    parent: ul \r\n  });\r\n  var copylegend = ol.ext.element.create('DIV', {\r\n    html: this.i18n('copied'),\r\n    className: 'ol-clipboard-copy',\r\n    parent: li\r\n  });\r\n  var saveLegend = ol.ext.element.create('SELECT', {\r\n    on: { change: function() {\r\n      // Print canvas (with white background)\r\n      var clegend = extraCtrl.legend.control.getLegend().getCanvas();\r\n      var canvas = document.createElement('CANVAS');\r\n      canvas.width = clegend.width;\r\n      canvas.height = clegend.height;\r\n      var ctx = canvas.getContext('2d');\r\n      ctx.fillStyle = '#fff';\r\n      ctx.fillRect(0, 0, canvas.width, canvas.height);\r\n      ctx.drawImage(clegend, 0, 0);\r\n      // Copy to clipboard\r\n      if (this.formats[saveLegend.value].clipboard) {\r\n        canvas.toBlob(function(blob) {\r\n          try {\r\n            navigator.clipboard.write([\r\n              new window.ClipboardItem(\r\n                Object.defineProperty({}, blob.type, {\r\n                  value: blob,\r\n                  enumerable: true\r\n                })\r\n              )\r\n            ])\r\n            copylegend.classList.add('visible');\r\n            setTimeout(function() { copylegend.classList.remove('visible'); }, 1000);\r\n          } catch (err) { /* errror */ }\r\n        }, 'image/png');\r\n      } else {\r\n        var image;\r\n        try {\r\n          image = canvas.toDataURL(this.formats[saveLegend.value].imageType, this.formats[saveLegend.value].quality);\r\n          var format = (typeof(this.getSize())==='string' ? this.getSize() : 'A4');\r\n          var w = canvas.width / 96 * 25.4;\r\n          var h = canvas.height / 96 * 25.4;\r\n          var size = this.paperSize[format];\r\n          if (this.getOrientation()==='landscape') size = [size[1], size[0]];\r\n          var position = [\r\n            (size[0] - w) /2,\r\n            (size[1] - h) /2\r\n          ]; \r\n          this.dispatchEvent({\r\n            type: 'print',\r\n            print: {\r\n              legend: true,\r\n              format: format,\r\n              orientation: this.getOrientation(),\r\n              unit: 'mm',\r\n              size: this.paperSize[format],\r\n              position: position,\r\n              imageWidth: w,\r\n              imageHeight: h\r\n            },\r\n            image: image,\r\n            imageType: this.formats[saveLegend.value].imageType,\r\n            pdf: this.formats[saveLegend.value].pdf,\r\n            quality: this.formats[saveLegend.value].quality,\r\n            canvas: canvas\r\n          })\r\n        } catch(err) { /* error */ }\r\n      }\r\n      saveLegend.value = '';\r\n    }.bind(this) },\r\n    parent: li\r\n  });\r\n  ol.ext.element.create('OPTION', {\r\n    html: this.i18n('saveLegend'),\r\n    style: { display: 'none' },\r\n    value: '',\r\n    parent: saveLegend\r\n  });\r\n  this.formats.forEach(function(format, i) {\r\n    ol.ext.element.create('OPTION', {\r\n      html: format.title,\r\n      value: i,\r\n      parent: saveLegend\r\n    });\r\n  });\r\n  // Print\r\n  var prButtons = ol.ext.element.create('DIV', {\r\n    className: 'ol-ext-buttons',\r\n    parent: param\r\n  });\r\n  ol.ext.element.create('BUTTON', {\r\n    html: this.i18n('printBt'),\r\n    type: 'submit',\r\n    click: function(e) {\r\n      e.preventDefault();\r\n      window.print();\r\n    },\r\n    parent: prButtons\r\n  });\r\n  ol.ext.element.create('BUTTON', {\r\n    html: this.i18n('cancel'),\r\n    type: 'button',\r\n    click: function() { printDialog.hide(); },\r\n    parent: prButtons\r\n  });\r\n  ol.ext.element.create('DIV', {\r\n    html: this.i18n('errorMsg'),\r\n    className: 'ol-error',\r\n    parent: param\r\n  });\r\n  // Handle dialog show/hide\r\n  var originalTarget;\r\n  var originalSize;\r\n  var scalelistener;\r\n  var extraCtrl = {};\r\n  printDialog.on('show', function() {\r\n    // Dialog is showing\r\n    this.dispatchEvent({ type: 'show', userElement: userElt, dialog: this._printDialog, page: this.getPage() });\r\n    //\r\n    var map = this.getMap();\r\n    if (!map) return;\r\n    // Print document\r\n    document.body.classList.add('ol-print-document');\r\n    originalTarget = map.getTargetElement();\r\n    originalSize = map.getSize();\r\n    if (typeof(this.getSize()) === 'string') this.setSize(this.getSize());\r\n    else this.setSize(originalSize);\r\n    map.setTarget(printMap);\r\n    // Refresh on move end\r\n    if (scalelistener) ol.Observable.unByKey(scalelistener);\r\n    scalelistener = map.on('moveend', function() {\r\n      this.setScale(ol.sphere.getMapScale(map));\r\n    }.bind(this));\r\n    this.setScale(ol.sphere.getMapScale(map));\r\n    // Get extra controls\r\n    extraCtrl = {};\r\n    this.getMap().getControls().forEach(function(c) {\r\n      if (c instanceof ol.control.Legend) {\r\n        extraCtrl.legend = { control: c };\r\n      }\r\n      if (c instanceof ol.control.CanvasTitle) {\r\n        extraCtrl.title = { control: c };\r\n      }\r\n      if (c instanceof ol.control.Compass) {\r\n        if (extraCtrl.compass) {\r\n          c.element.classList.remove('ol-print-compass')\r\n        } else {\r\n          if (this._input.north.checked) c.element.classList.add('ol-print-compass')\r\n          else c.element.classList.remove('ol-print-compass')\r\n          this._compass = c;\r\n          extraCtrl.compass = { control: c };\r\n        }\r\n      }\r\n    }.bind(this));\r\n    // Show hide title\r\n    if (extraCtrl.title) {\r\n      title.checked = extraCtrl.title.isVisible = extraCtrl.title.control.getVisible();\r\n      titleText.value = extraCtrl.title.control.getTitle();\r\n      title.parentNode.parentNode.classList.remove('hidden');\r\n    } else {\r\n      title.parentNode.parentNode.classList.add('hidden');\r\n    }\r\n    // Show hide legend\r\n    if (extraCtrl.legend) {\r\n      extraCtrl.legend.ison = extraCtrl.legend.control.onCanvas();\r\n      extraCtrl.legend.collapsed = extraCtrl.legend.control.isCollapsed();\r\n      extraCtrl.legend.control.collapse(false);\r\n      saveLegend.parentNode.classList.remove('hidden');\r\n      legend.parentNode.parentNode.classList.remove('hidden');\r\n      legend.checked = !extraCtrl.legend.collapsed;\r\n      extraCtrl.legend.control.setCanvas(!extraCtrl.legend.collapsed);\r\n    } else {\r\n      saveLegend.parentNode.classList.add('hidden');\r\n      legend.parentNode.parentNode.classList.add('hidden');\r\n    }\r\n  }.bind(this));\r\n  printDialog.on('hide', function() {\r\n    // No print\r\n    document.body.classList.remove('ol-print-document');\r\n    if (!originalTarget) return;\r\n    this.getMap().setTarget(originalTarget);\r\n    originalTarget = null;\r\n    if (scalelistener) ol.Observable.unByKey(scalelistener);\r\n    // restore\r\n    if (extraCtrl.title) {\r\n      extraCtrl.title.control.setVisible(extraCtrl.title.isVisible);\r\n    }\r\n    if (extraCtrl.legend) {\r\n      extraCtrl.legend.control.setCanvas(extraCtrl.legend.ison);\r\n      extraCtrl.legend.control.collapse(extraCtrl.legend.collapsed);\r\n    }\r\n    this.dispatchEvent({ type: 'hide' });\r\n  }.bind(this));\r\n  // Update preview on resize\r\n  window.addEventListener('resize', function() {\r\n    this.setSize();\r\n  }.bind(this));\r\n  // Save or print\r\n  if (options.saveAs) {\r\n    this.on('print', function(e) {\r\n      if (!e.pdf) {\r\n        // Save image as file\r\n        e.canvas.toBlob(function(blob) {\r\n          var name = (e.print.legend ? 'legend.' : 'map.')+e.imageType.replace('image/','');\r\n          options.saveAs(blob, name);\r\n        }, e.imageType, e.quality);\r\n      }\r\n    });\r\n  }\r\n  // Save or print\r\n  if (options.jsPDF) {\r\n    this.on('print', function(e) {\r\n      if (e.pdf) {\r\n        // Export pdf using the print info\r\n        var pdf = new options.jsPDF({\r\n          orientation: e.print.orientation,\r\n          unit: e.print.unit,\r\n          format: e.print.size\r\n        });\r\n        pdf.addImage(e.image, 'JPEG', e.print.position[0], e.print.position[0], e.print.imageWidth, e.print.imageHeight);\r\n        pdf.save(e.print.legend ? 'legend.pdf' : 'map.pdf');\r\n      } \r\n    });\r\n  }\r\n};\r\nol.ext.inherits(ol.control.PrintDialog, ol.control.Control);\r\n/** Check if the dialog is oprn\r\n * @return {boolean}\r\n */\r\n ol.control.PrintDialog.prototype.isOpen = function() {\r\n  return this._printDialog.isOpen();\r\n};\r\n/** Add a new language\r\n * @param {string} lang lang id\r\n * @param {Objetct} labels\r\n */\r\nol.control.PrintDialog.addLang = function(lang, labels) {\r\n  ol.control.PrintDialog.prototype._labels[lang] = labels;\r\n};\r\n/** Translate \r\n * @param {string} what\r\n * @returns {string}\r\n */\r\nol.control.PrintDialog.prototype.i18n = function(what) {\r\n  var rep = this._labels.en[what] || 'bad param';\r\n  if (this._labels[this._lang] && this._labels[this._lang][what]) {\r\n    rep = this._labels[this._lang][what];\r\n  }\r\n  return rep;\r\n};\r\n/** Print dialog labels (for customisation) */\r\nol.control.PrintDialog.prototype._labels = {\r\n  en: {\r\n    title: 'Print',\r\n    orientation: 'Orientation',\r\n    portrait: 'Portrait',\r\n    landscape: 'Landscape',\r\n    size: 'Page size',\r\n    custom: 'screen size',\r\n    margin: 'Margin',\r\n    scale: 'Scale',\r\n    legend: 'Legend',\r\n    north: 'North arrow',\r\n    mapTitle: 'Map title',\r\n    saveas: 'Save as...',\r\n    saveLegend: 'Save legend...',\r\n    copied: '✔ Copied to clipboard',\r\n    errorMsg: 'Can\\'t save map canvas...',\r\n    printBt: 'Print...',\r\n    cancel: 'cancel'\r\n  },\r\n  fr: {\r\n    title: 'Imprimer',\r\n    orientation: 'Orientation',\r\n    portrait: 'Portrait',\r\n    landscape: 'Paysage',\r\n    size: 'Taille du papier',\r\n    custom: 'taille écran',\r\n    margin: 'Marges',\r\n    scale: 'Echelle',\r\n    legend: 'Légende',\r\n    north: 'Flèche du nord',\r\n    mapTitle: 'Titre de la carte',\r\n    saveas: 'Enregistrer sous...',\r\n    saveLegend: 'Enregistrer la légende...',\r\n    copied: '✔ Carte copiée',\r\n    errorMsg: 'Impossible d\\'enregistrer la carte',\r\n    printBt: 'Imprimer',\r\n    cancel: 'annuler'\r\n  },\r\n  zh:{\r\n    title: '打印',\r\n    orientation: '方向',\r\n    portrait: '纵向',\r\n    landscape: '横向',\r\n    size: '页面大小',\r\n    custom: '屏幕大小',\r\n    margin: '外边距',\r\n    scale: '尺度',\r\n    legend: '图例',\r\n    north: '指北针',\r\n    mapTitle: '地图名字',\r\n    saveas: '保存为...',\r\n    saveLegend: '保存图例为...',\r\n    copied: '✔ 已复制到剪贴板',\r\n    errorMsg: '无法保存地图...',\r\n    printBt: '打印...',\r\n    cancel: '取消'\r\n  }\r\n};\r\n/** List of paper size */\r\nol.control.PrintDialog.prototype.paperSize = {\r\n  '': null,\r\n  'A0': [841,1189],\r\n  'A1': [594,841],\r\n  'A2': [420,594],\r\n  'A3': [297,420],\r\n  'A4': [210,297],\r\n  'A5': [148,210],\r\n  'B4': [257,364],\r\n  'B5': [182,257]\r\n};\r\n/** List of margin size */\r\nol.control.PrintDialog.prototype.marginSize = {\r\n  none: 0,\r\n  small: 5,\r\n  large: 10\r\n};\r\n/** List of legeng options * /\r\nol.control.PrintDialog.prototype.legendOptions = {\r\n  off: 'Hide legend',\r\n  on: 'Show legend'\r\n};\r\n/** List of print image file formats */\r\nol.control.PrintDialog.prototype.formats = [{\r\n    title: 'copy to clipboard',\r\n    imageType: 'image/png',\r\n    clipboard: true\r\n  }, {\r\n    title: 'save as jpeg',\r\n    imageType: 'image/jpeg',\r\n    quality: .8\r\n  }, {\r\n    title: 'save as png',\r\n    imageType: 'image/png',\r\n    quality: .8\r\n  }, {\r\n    title: 'save as pdf',\r\n    imageType: 'image/jpeg',\r\n    pdf: true\r\n  }\r\n];\r\n/** List of print scale */\r\nol.control.PrintDialog.prototype.scales = {\r\n  ' 5000': '1/5.000',\r\n  ' 10000': '1/10.000',\r\n  ' 25000': '1/25.000',\r\n  ' 50000': '1/50.000',\r\n  ' 100000': '1/100.000',\r\n  ' 250000': '1/250.000',\r\n  ' 1000000': '1/1.000.000'\r\n};\r\n/** Get print orientation\r\n * @returns {string}\r\n */\r\nol.control.PrintDialog.prototype.getOrientation = function () {\r\n  return this._orientation || 'portrait';\r\n};\r\n/** Set print orientation\r\n * @param {string} ori landscape or portrait\r\n */\r\nol.control.PrintDialog.prototype.setOrientation = function (ori) {\r\n  this._orientation = (ori==='landscape' ? 'landscape' : 'portrait');\r\n  this._input.orientation[this._orientation].checked = true;\r\n  this.setSize();\r\n};\r\n/** Get print margin\r\n * @returns {number}\r\n */\r\nol.control.PrintDialog.prototype.getMargin = function () {\r\n  return this._margin || 0;\r\n};\r\n/** Set print margin\r\n * @param {number}\r\n */\r\nol.control.PrintDialog.prototype.setMargin = function (margin) {\r\n  this._margin = margin;\r\n  this._input.margin.value = margin;\r\n  this.setSize();\r\n};\r\n/** Get print size\r\n * @returns {ol.size}\r\n */\r\nol.control.PrintDialog.prototype.getSize = function () {\r\n  return this._size;\r\n};\r\n/** Set map print size\r\n * @param {ol/size|string} size map size as ol/size or A4, etc.\r\n */\r\nol.control.PrintDialog.prototype.setSize = function (size) {\r\n  // reset status\r\n  this._printDialog.getContentElement().setAttribute('data-status','');\r\n  if (size) this._size = size;\r\n  else size = this._size;\r\n  if (!size) return;\r\n  if (typeof(size) === 'string') {\r\n    size = size.toLocaleUpperCase();\r\n    if (!this.paperSize[size]) size = this._size = 'A4';\r\n    this._input.size.value = size;\r\n    size = [\r\n      Math.trunc(this.paperSize[size][0]* 96/25.4),\r\n      Math.trunc(this.paperSize[size][1]* 96/25.4)\r\n    ]\r\n    if (this.getOrientation() === 'landscape') {\r\n      size = [size[1], size[0]];\r\n    }\r\n    this.getPage().classList.remove('margin');\r\n  } else {\r\n    this._input.size.value = '';\r\n    this.getPage().classList.add('margin');\r\n  }\r\n  var printElement = this.getPage();\r\n  var s = printElement.parentNode.getBoundingClientRect();\r\n  var scx = (s.width - 40) / size[0];\r\n  var scy = (s.height - 40) / size[1];\r\n  var sc = Math.min(scx, scy, 1);\r\n  printElement.style.width = size[0]+'px';\r\n  printElement.style.height = size[1]+'px';\r\n  printElement.style['-webkit-transform'] = \r\n  printElement.style.transform = 'translate(-50%,-50%) scale('+sc+')';\r\n  var px = Math.round(5/sc);\r\n  printElement.style['-webkit-box-shadow'] = \r\n  printElement.style['box-shadow'] = px+'px '+px+'px '+px+'px rgba(0,0,0,.6)';\r\n  printElement.style['padding'] = (this.getMargin() * 96/25.4)+'px';\r\n  if (this.getMap()) {\r\n    this.getMap().updateSize();\r\n  }\r\n  this.dispatchEvent({ type: 'dialog:refresh' });\r\n};\r\n/** Get dialog content element \r\n * @return {Element}\r\n */\r\nol.control.PrintDialog.prototype.getContentElement = function () {\r\n  return this._printDialog.getContentElement();\r\n};\r\n/** Get dialog user element \r\n * @return {Element}\r\n */\r\nol.control.PrintDialog.prototype.getUserElement = function () {\r\n  return this._printDialog.getContentElement().querySelector('.ol-user-param');\r\n};\r\n/** Get page element\r\n * @return {Element}\r\n */\r\nol.control.PrintDialog.prototype.getPage = function () {\r\n  return this._pages[0]\r\n};\r\n/**\r\n * Remove the control from its current map and attach it to the new map.\r\n * Subclasses may set up event handlers to get notified about changes to\r\n * the map here.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.control.PrintDialog.prototype.setMap = function (map) {\r\n  if (this.getMap()) {\r\n    this.getMap().removeControl(this._compass);\r\n    this.getMap().removeControl(this._printCtrl);\r\n    this.getMap().removeControl(this._printDialog);\r\n  }\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  if (this.getMap()) {\r\n    this.getMap().addControl(this._compass);\r\n    this.getMap().addControl(this._printCtrl);\r\n    this.getMap().addControl(this._printDialog);\r\n  }\r\n};\r\n/** Set the current scale (will change the scale of the map)\r\n * @param {number|string} value the scale factor or a scale string as 1/xxx\r\n */\r\nol.control.PrintDialog.prototype.setScale = function (value) {\r\n  ol.sphere.setMapScale(this.getMap(), value);\r\n  this._input.scale.value = ' '+(Math.round(value/100) * 100);\r\n};\r\n/** Get the current map scale factor\r\n * @return {number} \r\n */\r\nol.control.PrintDialog.prototype.getScale = function () {\r\n  return ol.sphere.getMapScale(this.getMap());\r\n};\r\n/** Show print dialog \r\n * @param {*}\r\n *  @param {ol/size|string} options.size map size as ol/size or A4, etc.\r\n *  @param {number|string} options.value the scale factor or a scale string as 1/xxx\r\n *  @param {string} options.orientation landscape or portrait\r\n *  @param {number} options.margin\r\n */\r\nol.control.PrintDialog.prototype.print = function(options) {\r\n  options = options || {};\r\n  if (options.size) this.setSize(options.size);\r\n  if (options.scale) this.setScale(options.scale);\r\n  if (options.orientation) this.setOrientation(options.orientation);\r\n  if (options.margin) this.setMargin(options.margin);\r\n  this._printDialog.show();\r\n};\r\n/** Get print control\r\n * @returns {ol.control.Print}\r\n */\r\nol.control.PrintDialog.prototype.getrintControl = function() {\r\n  return this._printCtrl;\r\n}\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/*eslint no-constant-condition: [\"error\", { \"checkLoops\": false }]*/\r\n/**\r\n * @classdesc OpenLayers 3 Profil Control.\r\n * Draw a profile of a feature (with a 3D geometry)\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fires over\r\n * @fires out\r\n * @fires show\r\n * @fires dragstart\r\n * @fires dragging\r\n * @fires dragend\r\n * @fires dragcancel\r\n * @param {Object=} options\r\n *  @param {string} options.className\r\n *\t@param {String} options.title button title\r\n *  @param {ol.style.Style} [options.style] style to draw the profil, default darkblue\r\n *  @param {ol.style.Style} [options.selectStyle] style for selection, default darkblue fill\r\n *  @param {*} options.info keys/values for i19n\r\n *  @param {number} options.width\r\n *  @param {number} options.height\r\n *  @param {ol.Feature} options.feature the feature to draw profil\r\n *  @param {boolean} options.selectable enable selection on the profil, default false\r\n *  @param {boolean} options.zoomable can zoom in the profil\r\n */\r\nol.control.Profil = function(options) {\r\n  options = options || {};\r\n  this.info = options.info || ol.control.Profil.prototype.info;\r\n  var self = this;\r\n  var element;\r\n  if (options.target) {\r\n    element = document.createElement(\"div\");\r\n    element.classList.add(options.className || \"ol-profil\");\r\n  } else {\r\n    element = document.createElement(\"div\");\r\n    element.className = ((options.className || 'ol-profil') +' ol-unselectable ol-control ol-collapsed').trim();\r\n    this.button = document.createElement(\"button\");\r\n    this.button.title =  options.title || 'Profile',\r\n    this.button.setAttribute('type','button');\r\n    var click_touchstart_function = function(e) {\r\n      self.toggle();\r\n      e.preventDefault();\r\n    };\r\n    this.button.addEventListener(\"click\", click_touchstart_function);\r\n    this.button.addEventListener(\"touchstart\", click_touchstart_function);\r\n    element.appendChild(this.button);\r\n  }\r\n  // Drawing style\r\n  if (options.style instanceof ol.style.Style) {\r\n    this._style = options.style;\r\n  } else {\r\n    this._style = new ol.style.Style({\r\n      text: new ol.style.Text(),\r\n      stroke: new ol.style.Stroke({\r\n        width: 1.5,\r\n        color: '#369'\r\n      })\r\n    });\r\n  }\r\n  if (!this._style.getText()) this._style.setText(new ol.style.Text());\r\n  // Selection style\r\n  if (options.selectStyle instanceof ol.style.Style) {\r\n    this._selectStyle = options.selectStyle;\r\n  } else {\r\n    this._selectStyle = new ol.style.Style({\r\n      fill: new ol.style.Fill({ color: '#369' })\r\n    });\r\n  }\r\n  var div_inner = document.createElement(\"div\");\r\n      div_inner.classList.add(\"ol-inner\");\r\n      element.appendChild(div_inner);\r\n  var div = document.createElement(\"div\");\r\n      div.style.position = \"relative\";\r\n      div_inner.appendChild(div);\r\n  var ratio = this.ratio = 2;\r\n  this.canvas_ = document.createElement('canvas');\r\n  this.canvas_.width = (options.width || 300)*ratio;\r\n  this.canvas_.height = (options.height || 150)*ratio;\r\n  var styles = {\r\n    \"msTransform\":\"scale(0.5,0.5)\", \"msTransformOrigin\":\"0 0\",\r\n    \"webkitTransform\":\"scale(0.5,0.5)\", \"webkitTransformOrigin\":\"0 0\",\r\n    \"mozTransform\":\"scale(0.5,0.5)\", \"mozTransformOrigin\":\"0 0\",\r\n    \"transform\":\"scale(0.5,0.5)\", \"transformOrigin\":\"0 0\"\r\n  };\r\n  Object.keys(styles).forEach(function(style) {\r\n    if (style in self.canvas_.style) {\r\n      self.canvas_.style[style] = styles[style];\r\n    }\r\n  });\r\n  var div_to_canvas = document.createElement(\"div\");\r\n  div.appendChild(div_to_canvas);\r\n  div_to_canvas.style.width = this.canvas_.width/ratio + \"px\";\r\n  div_to_canvas.style.height = this.canvas_.height/ratio + \"px\";\r\n  div_to_canvas.appendChild(this.canvas_);\r\n  div_to_canvas.addEventListener('pointerdown', this.onMove.bind(this));\r\n  document.addEventListener('pointerup', this.onMove.bind(this));\r\n  div_to_canvas.addEventListener('mousemove', this.onMove.bind(this));\r\n  div_to_canvas.addEventListener('touchmove', this.onMove.bind(this));\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.set('selectable', options.selectable);\r\n  // Offset in px\r\n  this.margin_ = { top:10*ratio, left:40*ratio, bottom:30*ratio, right:10*ratio };\r\n  if (!this.info.ytitle) this.margin_.left -= 20*ratio;\r\n  if (!this.info.xtitle) this.margin_.bottom -= 20*ratio;\r\n  // Cursor\r\n  this.bar_ = document.createElement(\"div\");\r\n  this.bar_.classList.add(\"ol-profilbar\");\r\n  this.bar_.style.top = (this.margin_.top/ratio)+\"px\";\r\n  this.bar_.style.height = (this.canvas_.height-this.margin_.top-this.margin_.bottom)/ratio+\"px\";\r\n  div.appendChild(this.bar_);\r\n  this.cursor_ = document.createElement(\"div\");\r\n  this.cursor_.classList.add(\"ol-profilcursor\");\r\n  div.appendChild(this.cursor_);\r\n  this.popup_ = document.createElement(\"div\");\r\n  this.popup_.classList.add(\"ol-profilpopup\");\r\n  this.cursor_.appendChild(this.popup_);\r\n  // Track information\r\n  var t = document.createElement(\"table\");\r\n      t.cellPadding = '0';\r\n      t.cellSpacing = '0';\r\n      t.style.clientWidth = this.canvas_.width/ratio + \"px\";\r\n    div.appendChild(t);\r\n  var firstTr = document.createElement(\"tr\");\r\n      firstTr.classList.add(\"track-info\");\r\n      t.appendChild(firstTr);\r\n  var div_zmin = document.createElement(\"td\");\r\n  div_zmin.innerHTML = (this.info.zmin||\"Zmin\")+': <span class=\"zmin\">';\r\n  firstTr.appendChild(div_zmin);\r\n  var div_zmax = document.createElement(\"td\");\r\n  div_zmax.innerHTML = (this.info.zmax||\"Zmax\")+': <span class=\"zmax\">';\r\n  firstTr.appendChild(div_zmax);\r\n  var div_distance = document.createElement(\"td\");\r\n  div_distance.innerHTML = (this.info.distance||\"Distance\")+': <span class=\"dist\">';\r\n  firstTr.appendChild(div_distance);\r\n  var div_time = document.createElement(\"td\");\r\n  div_time.innerHTML = (this.info.time||\"Time\")+': <span class=\"time\">';\r\n  firstTr.appendChild(div_time);\r\n  var secondTr = document.createElement(\"tr\");\r\n      secondTr.classList.add(\"point-info\")\r\n      t.appendChild(secondTr);\r\n  var div_altitude = document.createElement(\"td\");\r\n  div_altitude.innerHTML = (this.info.altitude||\"Altitude\")+': <span class=\"z\">';\r\n  secondTr.appendChild(div_altitude);\r\n  var div_distance2 = document.createElement(\"td\");\r\n  div_distance2.innerHTML = (this.info.distance||\"Distance\")+': <span class=\"dist\">';\r\n  secondTr.appendChild(div_distance2);\r\n  var div_time2 = document.createElement(\"td\");\r\n  div_time2.innerHTML = (this.info.time||\"Time\")+': <span class=\"time\">';\r\n  secondTr.appendChild(div_time2);\r\n  // Array of data\r\n  this.tab_ = [];\r\n  // Show feature\r\n  if (options.feature) {\r\n    this.setGeometry (options.feature);\r\n  }\r\n  // Zoom on profile\r\n  if (options.zoomable) {\r\n    this.set('selectable', true);\r\n    var start, geom;\r\n    this.on('change:geometry', function() {\r\n      geom = null;\r\n    });\r\n    this.on('dragstart', function(e) {\r\n      start = e.index;\r\n    })\r\n    this.on('dragend', function(e) {\r\n      if (Math.abs(start - e.index) > 10) {\r\n        if (!geom) {\r\n          var bt = ol.ext.element.create('BUTTON', {\r\n            parent: element,\r\n            className: 'ol-zoom-out',\r\n            click: function(e) {\r\n              e.stopPropagation();\r\n              e.preventDefault();\r\n              if (geom) {\r\n                this.dispatchEvent({ type:'zoom' });\r\n                this.setGeometry(geom, this._geometry[1]);\r\n              }\r\n              element.removeChild(bt);\r\n            }.bind(this)\r\n          })\r\n        }\r\n        var saved = geom || this._geometry[0];\r\n        var g = new ol.geom.LineString(this.getSelection(start, e.index));\r\n        this.setGeometry(g, this._geometry[1]);\r\n        geom = saved;\r\n        this.dispatchEvent({ type:'zoom', geometry: g, start: start, end: e.index });\r\n      }\r\n    }.bind(this));\r\n  }\r\n};\r\nol.ext.inherits(ol.control.Profil, ol.control.Control);\r\n/** Custom infos list\r\n* @api stable\r\n*/\r\nol.control.Profil.prototype.info = {\r\n  \"zmin\": \"Zmin\",\r\n  \"zmax\": \"Zmax\",\r\n  \"ytitle\": \"Altitude (m)\",\r\n  \"xtitle\": \"Distance (km)\",\r\n  \"time\": \"Time\",\r\n  \"altitude\": \"Altitude\",\r\n  \"distance\": \"Distance\",\r\n  \"altitudeUnits\": \"m\",\r\n  \"distanceUnitsM\": \"m\",\r\n  \"distanceUnitsKM\": \"km\",\r\n};\r\n/** Show popup info\r\n* @param {string} info to display as a popup\r\n* @api stable\r\n*/\r\nol.control.Profil.prototype.popup = function(info) {\r\n  this.popup_.innerHTML = info;\r\n};\r\n/** Show point on profil\r\n * @param {*} p \r\n * @param {number} dx \r\n * @private\r\n */\r\nol.control.Profil.prototype._drawAt = function(p, dx) {\r\n  if (p) {\r\n    this.cursor_.style.left = dx+\"px\";\r\n    this.cursor_.style.top = (this.canvas_.height-this.margin_.bottom+p[1]*this.scale_[1]+this.dy_)/this.ratio+\"px\";\r\n    this.cursor_.style.display = \"block\";\r\n    this.bar_.parentElement.classList.add(\"over\");\r\n    this.bar_.style.left = dx+\"px\";\r\n    this.bar_.style.display = \"block\";\r\n    this.element.querySelector(\".point-info .z\").textContent = p[1]+this.info.altitudeUnits;\r\n    this.element.querySelector(\".point-info .dist\").textContent = (p[0]/1000).toFixed(1)+this.info.distanceUnitsKM;\r\n    this.element.querySelector(\".point-info .time\").textContent = p[2];\r\n    if (dx>this.canvas_.width/this.ratio/2) this.popup_.classList.add('ol-left');\r\n    else this.popup_.classList.remove('ol-left');\r\n  } else {\r\n    this.cursor_.style.display = \"none\";\r\n    this.bar_.style.display = 'none';\r\n    this.cursor_.style.display = 'none';  \r\n    this.bar_.parentElement.classList.remove(\"over\");\r\n  }\r\n};\r\n/** Show point at coordinate or a distance on the profil\r\n * @param { ol.coordinates|number } where a coordinate or a distance from begining, if none it will hide the point\r\n * @return { ol.coordinates } current point\r\n */\r\nol.control.Profil.prototype.showAt = function(where) {\r\n  var i, p, p0, d0 = Infinity;\r\n  if (typeof(where) === 'undefined') {\r\n    if (this.bar_.parentElement.classList.contains(\"over\")) {\r\n      // Remove it\r\n      this._drawAt();\r\n    }\r\n  } else if (where.length) {\r\n    // Look for closest the point\r\n    for (i=1; p=this.tab_[i]; i++) {\r\n      var d = ol.coordinate.dist2d(p[3], where);\r\n      if (d<d0) {\r\n        p0 = p;\r\n        d0 = d;\r\n      } \r\n    }\r\n  } else {\r\n    for (i=0; p=this.tab_[i]; i++) {\r\n      p0 = p;\r\n      if (p[0] >= where) {\r\n        break;\r\n      } \r\n    }\r\n  }\r\n  if (p0) {\r\n    var dx = (p0[0] * this.scale_[0] + this.margin_.left) / this.ratio;\r\n    this._drawAt(p0, dx);\r\n    return p0[3];\r\n  }\r\n  return null;\r\n};\r\n/** Show point at a time on the profil\r\n * @param { Date|number } time a Date or a DateTime (in s) to show the profile on, if none it will hide the point\r\n * @param { booelan } delta true if time is a delta from the start, default false\r\n * @return { ol.coordinates } current point\r\n */\r\nol.control.Profil.prototype.showAtTime = function(time, delta) {\r\n  var i, p, p0;\r\n  if (time instanceof Date) {\r\n    time = time.getTime()/1000;\r\n  } else if (delta) {\r\n    time += this.tab_[0][3][3];\r\n  }\r\n  if (typeof(time) === 'undefined') {\r\n    if (this.bar_.parentElement.classList.contains(\"over\")) {\r\n      // Remove it\r\n      this._drawAt();\r\n    }\r\n  } else {\r\n    for (i=0; p=this.tab_[i]; i++) {\r\n      p0 = p;\r\n      if (p[3][3] >= time) {\r\n        break;\r\n      } \r\n    }\r\n  }\r\n  if (p0) {\r\n    var dx = (p0[0] * this.scale_[0] + this.margin_.left) / this.ratio;\r\n    this._drawAt(p0, dx);\r\n    return p0[3];\r\n  }\r\n  return null;\r\n};\r\n/** Get the point at a given time on the profil\r\n * @param { number } time time at which to show the point\r\n * @return { ol.coordinates } current point\r\n */\r\nol.control.Profil.prototype.pointAtTime = function(time) {\r\n  var i, p;\r\n  // Look for closest the point\r\n  for (i=1; p=this.tab_[i]; i++) {\r\n    var t = p[3][3];\r\n    if (t >= time) {\r\n      // Previous one ?\r\n      var pt = this.tab_[i-1][3];\r\n      if ((pt[3]+t)/2 < time) return pt;\r\n      else return p;\r\n    }\r\n  }\r\n  return this.tab_[this.tab_.length-1][3];\r\n};\r\n/** Mouse move over canvas\r\n */\r\nol.control.Profil.prototype.onMove = function(e) {\r\n  if (!this.tab_.length) return;\r\n  var box_canvas = this.canvas_.getBoundingClientRect();\r\n  var pos = {\r\n    top: box_canvas.top + window.pageYOffset - document.documentElement.clientTop,\r\n    left: box_canvas.left + window.pageXOffset - document.documentElement.clientLeft\r\n  };\r\n  var pageX = e.pageX \r\n    || (e.touches && e.touches.length && e.touches[0].pageX) \r\n    || (e.changedTouches && e.changedTouches.length && e.changedTouches[0].pageX);\r\n  var pageY = e.pageY \r\n    || (e.touches && e.touches.length && e.touches[0].pageY) \r\n    || (e.changedTouches && e.changedTouches.length && e.changedTouches[0].pageY);\r\n  var dx = pageX -pos.left;\r\n  var dy = pageY -pos.top;\r\n  var ratio = this.ratio;\r\n  if (dx>this.margin_.left/ratio && dx<(this.canvas_.width-this.margin_.right)/ratio\r\n    && dy>this.margin_.top/ratio && dy<(this.canvas_.height-this.margin_.bottom)/ratio) {\r\n    var d = (dx*ratio-this.margin_.left)/this.scale_[0];\r\n    var p0 = this.tab_[0];\r\n    var index, p;\r\n    for (index=1; p=this.tab_[index]; index++) {\r\n      if (p[0]>=d) {\r\n        if (d < (p[0]+p0[0])/2) {\r\n          index = 0;\r\n          p = p0;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n    this._drawAt(p, dx);\r\n    this.dispatchEvent({ type:'over', click:e.type==='click', index: index, coord: p[3], time: p[2], distance: p[0] });\r\n    // Handle drag / click\r\n    switch (e.type) {\r\n      case 'pointerdown': {\r\n        this._dragging = {\r\n          event: { type:'dragstart', index: index, coord: p[3], time: p[2], distance: p[0] },\r\n          pageX: pageX,\r\n          pageY: pageY\r\n        }\r\n        break;\r\n      }\r\n      case 'pointerup': {\r\n        if (this._dragging && this._dragging.pageX) {\r\n          if (Math.abs(this._dragging.pageX - pageX)<3 && Math.abs(this._dragging.pageY - pageY) < 3) {\r\n            this.dispatchEvent({ type:'click', index: index, coord: p[3], time: p[2], distance: p[0] });\r\n            this.refresh();\r\n          }\r\n        } else {\r\n          this.dispatchEvent({ type:'dragend', index: index, coord: p[3], time: p[2], distance: p[0] });\r\n        }\r\n        this._dragging = false;\r\n        break;\r\n      }\r\n      default: {\r\n        if (this._dragging) {\r\n          if (this._dragging.pageX) {\r\n            if (Math.abs(this._dragging.pageX - pageX)>3 || Math.abs(this._dragging.pageY - pageY) > 3) {\r\n              this._dragging.pageX = this._dragging.pageY = false;\r\n              this.dispatchEvent(this._dragging.event);\r\n            }\r\n          } else {\r\n            this.dispatchEvent({ type:'dragging', index: index, coord: p[3], time: p[2], distance: p[0] });\r\n            var min = Math.min(this._dragging.event.index, index);\r\n            var max = Math.max(this._dragging.event.index, index);\r\n            this.refresh();\r\n            if (this.get('selectable')) this._drawGraph(this.tab_.slice(min, max), this._selectStyle);\r\n          }\r\n        }\r\n        break;\r\n      }\r\n    }\r\n  } else {\r\n    if (this.bar_.parentElement.classList.contains('over')) {\r\n      this._drawAt();\r\n      this.dispatchEvent({ type:'out' });\r\n    }\r\n    if (e.type === 'pointerup' && this._dragging) {\r\n      this.dispatchEvent({ type:'dragcancel' });\r\n      this._dragging = false;\r\n    }\r\n  }\r\n};\r\n/** Show panel\r\n* @api stable\r\n*/\r\nol.control.Profil.prototype.show = function() {\r\n  this.element.classList.remove(\"ol-collapsed\");\r\n  this.dispatchEvent({ type:'show', show: true });\r\n};\r\n/** Hide panel\r\n* @api stable\r\n*/\r\nol.control.Profil.prototype.hide = function() {\r\n  this.element.classList.add(\"ol-collapsed\");\r\n  this.dispatchEvent({ type:'show', show: false });\r\n};\r\n/** Toggle panel\r\n* @api stable\r\n*/\r\nol.control.Profil.prototype.toggle = function() {\r\n  this.element.classList.toggle(\"ol-collapsed\");\r\n  var b = this.element.classList.contains(\"ol-collapsed\");\r\n  this.dispatchEvent({ type:'show', show: !b });\r\n}\r\n/** Is panel visible\r\n*/\r\nol.control.Profil.prototype.isShown = function() {\r\n  return (!this.element.classList.contains(\"ol-collapsed\"));\r\n};\r\n/** Get selection\r\n * @param {number} starting point\r\n * @param {number} ending point\r\n * @return {Array<ol.coordinate>}\r\n */\r\nol.control.Profil.prototype.getSelection = function(start, end) {\r\n  var sel = [];\r\n  var min = Math.max(Math.min(start, end), 0);\r\n  var max = Math.min(Math.max(start, end), this.tab_.length-1);\r\n  for (var i=min; i <= max; i++) {\r\n    sel.push(this.tab_[i][3])\r\n  }\r\n  return sel;\r\n};\r\n/** Draw the graph\r\n * @private\r\n */\r\nol.control.Profil.prototype._drawGraph = function(t, style) {\r\n  if (!t.length) return;\r\n  var ctx = this.canvas_.getContext('2d');\r\n  var scx = this.scale_[0];\r\n  var scy = this.scale_[1];\r\n  var dy = this.dy_;\r\n  var ratio = this.ratio;\r\n  var i, p;\r\n  // Draw Path\r\n  ctx.beginPath();\r\n  for (i=0; p=t[i]; i++) {\r\n    if (i==0) ctx.moveTo(p[0]*scx,p[1]*scy+dy);\r\n    else ctx.lineTo(p[0]*scx,p[1]*scy+dy);\r\n  }\r\n  if (style.getStroke()) {\r\n    ctx.strokeStyle = style.getStroke().getColor() || '#000';\r\n    ctx.lineWidth = style.getStroke().getWidth() * ratio;\r\n    ctx.setLineDash([]);\r\n    ctx.stroke();\r\n  }\r\n  // Fill path\r\n  if (style.getFill()) {\r\n    ctx.fillStyle = style.getFill().getColor() || '#000';\r\n    ctx.Style = style.getFill().getColor() || '#000';\r\n    ctx.lineTo(t[t.length-1][0]*scx, 0);\r\n    ctx.lineTo(t[0][0]*scx, 0);\r\n    ctx.fill();\r\n  }\r\n};\r\n/**\r\n * Set the geometry to draw the profil.\r\n * @param {ol.Feature|ol.geom.Geometry} f the feature.\r\n * @param {Object=} options\r\n *  @param {ol.ProjectionLike} options.projection feature projection, default projection of the map\r\n *  @param {string} options.zunit 'm' or 'km', default m\r\n *  @param {string} options.unit 'm' or 'km', default km\r\n *  @param {Number|undefined} options.zmin default 0\r\n *  @param {Number|undefined} options.zmax default max Z of the feature\r\n *  @param {integer|undefined} options.zDigits number of digits for z graduation, default 0\r\n *  @param {Number|undefined} options.graduation z graduation default 100\r\n *  @param {integer|undefined} options.amplitude amplitude of the altitude, default zmax-zmin\r\n * @api stable\r\n */\r\nol.control.Profil.prototype.setGeometry = function(g, options) {\r\n  if (!options) options = {};\r\n  if (g instanceof ol.Feature) g = g.getGeometry();\r\n  this._geometry = [g, options];\r\n  // No Z\r\n  if (!/Z/.test(g.getLayout())) return;\r\n  // No time\r\n  if(/M/.test(g.getLayout())) this.element.querySelector(\".time\").parentElement.style.display = 'block';\r\n  else this.element.querySelector(\".time\").parentElement.style.display = 'none';\r\n  // Coords\r\n  var c = g.getCoordinates();\r\n  switch (g.getType()) {\r\n    case \"LineString\": break;\r\n    case \"MultiLineString\": c = c[0]; break;\r\n    default: return;\r\n  }\r\n  // Distance beetween 2 coords\r\n  var proj = options.projection || this.getMap().getView().getProjection();\r\n  function dist2d(p1,p2) {\r\n    return ol.sphere.getDistance(\r\n      ol.proj.transform(p1, proj, 'EPSG:4326'),\r\n      ol.proj.transform(p2, proj, 'EPSG:4326')\r\n    );\r\n  }\r\n  function getTime(t0, t1) {\r\n    if (!t0 || !t1) return \"-\"\r\n    var dt = (t1-t0) / 60; // mn\r\n    var ti = Math.trunc(dt/60);\r\n    var mn = Math.trunc(dt-ti*60);\r\n    return ti+\"h\"+(mn<10?\"0\":\"\")+mn+\"mn\";\r\n  }\r\n  // Calculate [distance, altitude, time, point] for each points\r\n  var zmin=Infinity, zmax=-Infinity;\r\n  var i, p, d, z, ti, t = this.tab_ = [];\r\n  for (i=0, p; p=c[i]; i++) {\r\n    z = p[2];\r\n    if (z<zmin) zmin=z;\r\n    if (z>zmax) zmax=z;\r\n    if (i==0) d = 0;\r\n    else d += dist2d(c[i-1], p);\r\n    ti = getTime(c[0][3],p[3]);\r\n    t.push ([d, z, ti, p]);\r\n  }\r\n  this._z = [zmin,zmax];\r\n  this.set('graduation', options.graduation || 100);\r\n  this.set('zmin', options.zmin);\r\n  this.set('zmax', options.zmax);\r\n  this.set('amplitude', options.amplitude);\r\n  this.set('unit', options.unit);\r\n  this.set('zunit', options.zunit);\r\n  this.set('zDigits', options.zDigits);\r\n  this.dispatchEvent({ type: 'change:geometry', geometry: g })\r\n  this.refresh();\r\n};\r\n/** Refresh the profil\r\n */\r\nol.control.Profil.prototype.refresh = function() {\r\n  var canvas = this.canvas_;\r\n  var ctx = canvas.getContext('2d');\r\n  var w = canvas.width;\r\n  var h = canvas.height;\r\n  ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n  ctx.clearRect(0,0, w, h);\r\n  var zmin = this._z[0];\r\n  var zmax = this._z[1];\r\n  var t = this.tab_;\r\n  var d = t[t.length-1][0];\r\n  var ti = t[t.length-1][2];\r\n  var i;\r\n  if (!d) {\r\n    console.error('[ol/control/Profil] no data...', t);\r\n    return;\r\n  }\r\n  // Margin\r\n  ctx.setTransform(1, 0, 0, 1, this.margin_.left, h-this.margin_.bottom);\r\n  var ratio = this.ratio;\r\n  w -= this.margin_.right + this.margin_.left;\r\n  h -= this.margin_.top + this.margin_.bottom;\r\n  // Draw axes\r\n  ctx.strokeStyle = this._style.getText().getFill().getColor() || '#000';\r\n  ctx.lineWidth = 0.5*ratio;\r\n  ctx.beginPath();\r\n  ctx.moveTo(0,0); ctx.lineTo(0,-h);\r\n  ctx.moveTo(0,0); ctx.lineTo(w, 0);\r\n  ctx.stroke();\r\n  // Info\r\n  this.element.querySelector(\".track-info .zmin\").textContent = zmin.toFixed(2)+this.info.altitudeUnits;\r\n  this.element.querySelector(\".track-info .zmax\").textContent = zmax.toFixed(2)+this.info.altitudeUnits;\r\n  if (d>1000) {\r\n    this.element.querySelector(\".track-info .dist\").textContent = (d/1000).toFixed(1)+this.info.distanceUnitsKM;\r\n  } else {\r\n    this.element.querySelector(\".track-info .dist\").textContent= (d).toFixed(1)+this.info.distanceUnitsM;\r\n  }\r\n  this.element.querySelector(\".track-info .time\").textContent = ti;\r\n  // Set graduation\r\n  var grad = this.get('graduation');\r\n  while (true) {\r\n    zmax = Math.ceil(zmax/grad)*grad;\r\n    zmin = Math.floor(zmin/grad)*grad;\r\n    var nbgrad = (zmax-zmin)/grad;\r\n    if (h/nbgrad < 15*ratio) {\r\n      grad *= 2;\r\n    }\r\n    else break;\r\n  }\r\n  // Set amplitude\r\n  if (typeof(this.get('zmin'))=='number' && zmin > this.get('zmin')) zmin = this.get('zmin');\r\n  if (typeof(this.get('zmax'))=='number' && zmax < this.get('zmax')) zmax = this.get('zmax');\r\n  var amplitude = this.get('amplitude');\r\n  if (amplitude) {\r\n    zmax = Math.max (zmin + amplitude, zmax);\r\n  }\r\n  // Scales lines\r\n  var scx = w/d;\r\n  var scy = -h/(zmax-zmin);\r\n  var dy = this.dy_ = -zmin*scy;\r\n  this.scale_ = [scx,scy];\r\n  this._drawGraph(t, this._style);\r\n  // Draw\r\n  ctx.font = (10*ratio)+'px arial';\r\n  ctx.textAlign = 'right';\r\n  ctx.textBaseline = 'middle';\r\n  ctx.fillStyle = this._style.getText().getFill().getColor() || '#000';\r\n  // Scale Z\r\n  ctx.beginPath();\r\n  var fix = this.get('zDigits') || 0;\r\n  for (i=zmin; i<=zmax; i+=grad) {\r\n    if (this.get('zunit') != 'km') ctx.fillText(i.toFixed(fix), -4*ratio, i*scy+dy);\r\n    else ctx.fillText((i/1000).toFixed(1), -4*ratio, i*scy+dy);\r\n    ctx.moveTo (-2*ratio, i*scy+dy);\r\n    if (i!=0) ctx.lineTo (d*scx, i*scy+dy);\r\n    else ctx.lineTo (0, i*scy+dy);\r\n  }\r\n  // Scale X\r\n  ctx.textAlign = \"center\";\r\n  ctx.textBaseline = \"top\";\r\n  ctx.setLineDash([ratio,3*ratio]);\r\n  var unit = this.get('unit') ||\"km\";\r\n  var step;\r\n  if (d>1000) {\r\n    step = Math.round(d/1000)*100;\r\n    if (step > 1000) step = Math.ceil(step/1000)*1000;\r\n  } else {\r\n    unit = \"m\";\r\n    if (d>100) step = Math.round(d/100)*10;\r\n    else if (d>10) step = Math.round(d/10);\r\n    else if (d>1) step = Math.round(d)/10;\r\n    else step = d;\r\n  }\r\n  for (i=0; i<=d; i+=step) {\r\n    var txt = (unit==\"m\") ? i : (i/1000);\r\n    //if (i+step>d) txt += \" \"+ (options.zunits || \"km\");\r\n    ctx.fillText(Math.round(txt*10)/10, i*scx, 4*ratio);\r\n    ctx.moveTo (i*scx, 2*ratio); ctx.lineTo (i*scx, 0);\r\n  }\r\n  ctx.font = (12*ratio)+\"px arial\";\r\n  ctx.fillText(this.info.xtitle.replace(\"(km)\",\"(\"+unit+\")\"), w/2, 18*ratio);\r\n  ctx.save();\r\n  ctx.rotate(-Math.PI/2);\r\n  ctx.fillText(this.info.ytitle, h/2, -this.margin_.left);\r\n  ctx.restore();\r\n  ctx.stroke();\r\n};\r\n/** Get profil image\r\n* @param {string|undefined} type image format or 'canvas' to get the canvas image, default image/png.\r\n* @param {Number|undefined} encoderOptions between 0 and 1 indicating image quality image/jpeg or image/webp, default 0.92.\r\n* @return {string} requested data uri\r\n* @api stable\r\n*/\r\nol.control.Profil.prototype.getImage = function(type, encoderOptions) {\r\n  if (type===\"canvas\") return this.canvas_;\r\n  return this.canvas_.toDataURL(type, encoderOptions);\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A simple push button control\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n *  @param {String} [options.className] class of the control\r\n *  @param {String} [options.label] waiting label\r\n *  @param {ol.layer.Layer} [options.layers] a tile layer with tileload events\r\n */\r\nol.control.ProgressBar = function(options) {\r\n  options = options || {};\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: ((options.className || '') + ' ol-progress-bar ol-unselectable ol-control').trim()\r\n  });\r\n  this._waiting = ol.ext.element.create('DIV', {\r\n    html: options.label || '',\r\n    className: 'ol-waiting',\r\n    parent: element\r\n  });\r\n  this._bar = ol.ext.element.create('DIV', {\r\n    className: 'ol-bar',\r\n    parent: element\r\n  });\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this._layerlistener = [];\r\n  this.setLayers(options.layers);\r\n};\r\nol.ext.inherits(ol.control.ProgressBar, ol.control.Control);\r\n/** Set the control visibility\r\n * @param {Number} [n] progress percentage, a number beetween 0,1, default hide progress bar\r\n */\r\nol.control.ProgressBar.prototype.setPercent = function (n) {\r\n  this._bar.style.width = ((Number(n) || 0) * 100)+'%';\r\n  if (n===undefined) {\r\n    ol.ext.element.hide(this.element);\r\n  } else {\r\n    ol.ext.element.show(this.element);\r\n  }\r\n};\r\n/** Set waiting text\r\n * @param {string} label\r\n */\r\nol.control.ProgressBar.prototype.setLabel = function (label) {\r\n  this._waiting.innerHTML = label;\r\n};\r\n/** Use a list of tile layer to shown tile load\r\n * @param {ol.layer.Layer|Array<ol.layer.Layer>} layers a layer or a list of layer\r\n */\r\nol.control.ProgressBar.prototype.setLayers = function (layers) {\r\n  // reset\r\n  this._layerlistener.forEach(function (l) {\r\n    ol.Observable.unByKey(l);\r\n  });\r\n  this._layerlistener = [];\r\n  this.setPercent();\r\n  var loading=0, loaded=0;\r\n  if (layers instanceof ol.layer.Layer) layers = [layers];\r\n  if (!layers || !layers.forEach) return;\r\n  var tout;\r\n  // Listeners\r\n  layers.forEach(function(layer) {\r\n    if (layer instanceof ol.layer.Layer) {\r\n      this._layerlistener.push(layer.getSource().on('tileloadstart', function () {\r\n        loading++;\r\n        this.setPercent(loaded/loading);\r\n        clearTimeout(tout);\r\n      }.bind(this)));\r\n      this._layerlistener.push(layer.getSource().on(['tileloadend', 'tileloaderror'], function () {\r\n        loaded++;\r\n        if (loaded === loading) {\r\n          loading = loaded = 0;\r\n          this.setPercent(1);\r\n          tout = setTimeout(this.setPercent.bind(this), 300);\r\n        } else {\r\n          this.setPercent(loaded/loading);\r\n        }\r\n      }.bind(this)));\r\n    }\r\n  }.bind(this));\r\n}\r\n\r\n/*\tCopyright (c) 2018 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Geoportail routing Control.\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fires select\r\n * @fires change:input\r\n * @param {Object=} options\r\n *\t@param {string} options.className control class name\r\n *\t@param {string | undefined} [options.apiKey] the service api key.\r\n *\t@param {string | undefined} options.authentication: basic authentication for the service API as btoa(\"login:pwd\")\r\n *\t@param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *\t@param {string | undefined} options.label Text label to use for the search button, default \"search\"\r\n *\t@param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *\t@param {string | undefined} options.inputLabel label for the input, default none\r\n *\t@param {string | undefined} options.noCollapse prevent collapsing on input blur, default false\r\n *\t@param {number | undefined} options.typing a delay on each typing to start searching (ms) use -1 to prevent autocompletion, default 300.\r\n *\t@param {integer | undefined} options.minLength minimum length to start searching, default 1\r\n *\t@param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *\t@param {integer | undefined} options.maxHistory maximum number of items to display in history. Set -1 if you don't want history, default maxItems\r\n *\t@param {function} options.getTitle a function that takes a feature and return the name to display in the index.\r\n *\t@param {function} options.autocomplete a function that take a search string and callback function to send an array\r\n *\t@param {number} options.timeout default 10s\r\n */\r\nol.control.RoutingGeoportail = function(options) {\r\n  var self = this;\r\n  if (!options) options = {};\r\n  if (options.typing == undefined) options.typing = 300;\r\n  options.apiKey = options.apiKey || 'essentiels';\r\n  // Class name for history\r\n  this._classname = options.className || 'search';\r\n  this._source = new ol.source.Vector();\r\n  // Authentication\r\n  this._auth = options.authentication;\r\n  var element = document.createElement(\"DIV\");\r\n  var classNames = (options.className||\"\")+ \" ol-routing\";\r\n  if (!options.target) {\r\n    classNames += \" ol-unselectable ol-control\";\r\n  }\r\n  element.setAttribute('class', classNames);\r\n\tif (!options.target) {\r\n    var bt = ol.ext.element.create('BUTTON', { parent: element })\r\n    bt.addEventListener('click', function(){\r\n      element.classList.toggle('ol-collapsed');\r\n    });\r\n  }\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.set('url', 'https://wxs.ign.fr/'+options.apiKey+'/itineraire/rest/route.json');\r\n  var content = ol.ext.element.create('DIV', { className: 'content', parent: element } )\r\n  var listElt = ol.ext.element.create('DIV', { className: 'search-input', parent: content });\r\n  this._search = [];\r\n  this.addSearch(listElt, options);\r\n  this.addSearch(listElt, options);\r\n  ol.ext.element.create('I', { className: 'ol-car', title: options.carlabel||'by car', parent: content })\r\n    .addEventListener(\"click\", function() {\r\n      self.setMode('car');\r\n    });\r\n  ol.ext.element.create('I', { className: 'ol-pedestrian', title: options.pedlabel||'pedestrian', parent: content })\r\n    .addEventListener(\"click\", function() {\r\n      self.setMode('pedestrian');\r\n    });\r\n  ol.ext.element.create('I', { className: 'ol-ok', title: options.runlabel||'search', html:'OK', parent: content })\r\n    .addEventListener(\"click\", function() {\r\n      self.calculate();\r\n    });\r\n  ol.ext.element.create('I', { className: 'ol-cancel', html:'cancel', parent: content })\r\n    .addEventListener(\"click\", function() {\r\n      this.resultElement.innerHTML = '';\r\n    }.bind(this));\r\n  this.resultElement = document.createElement(\"DIV\");\r\n  this.resultElement.setAttribute('class', 'ol-result');\r\n  element.appendChild(this.resultElement);\r\n  this.setMode(options.mode || 'car');\r\n  this.set('timeout', options.timeout || 10000);\r\n};\r\nol.ext.inherits(ol.control.RoutingGeoportail, ol.control.Control);\r\nol.control.RoutingGeoportail.prototype.setMode = function (mode, silent) {\r\n  this.set('mode', mode);\r\n  this.element.querySelector(\".ol-car\").classList.remove(\"selected\");\r\n  this.element.querySelector(\".ol-pedestrian\").classList.remove(\"selected\");\r\n  this.element.querySelector(\".ol-\"+mode).classList.add(\"selected\");\r\n  if (!silent) this.calculate();\r\n};\r\nol.control.RoutingGeoportail.prototype.setMethod = function (method, silent) {\r\n  this.set('method', method);\r\n  if (!silent) this.calculate();\r\n};\r\nol.control.RoutingGeoportail.prototype.addButton = function (className, title, info) {\r\n  var bt = document.createElement(\"I\");\r\n  bt.setAttribute(\"class\", className);\r\n  bt.setAttribute(\"type\", \"button\");\r\n  bt.setAttribute(\"title\", title);\r\n  bt.innerHTML = info||'';\r\n  this.element.appendChild(bt);\r\n  return bt;\r\n};\r\n/** Get point source\r\n * @return {ol.source.Vector }\r\n */\r\nol.control.RoutingGeoportail.prototype.getSource = function () {\r\n  return this._source;\r\n};\r\nol.control.RoutingGeoportail.prototype._resetArray = function (element) {\r\n  this._search = [];\r\n  var q = element.parentNode.querySelectorAll('.search-input > div')\r\n  q.forEach(function(d) {\r\n    if (d.olsearch) {\r\n      if (d.olsearch.get('feature')) {\r\n        d.olsearch.get('feature').set('step', this._search.length);\r\n        if (this._search.length===0) d.olsearch.get('feature').set('pos', 'start');\r\n        else if (this._search.length === q.length-1) d.olsearch.get('feature').set('pos', 'end');\r\n        else d.olsearch.get('feature').set('pos', '');\r\n      }\r\n      this._search.push(d.olsearch);\r\n    }\r\n  }.bind(this));\r\n};\r\n/** Remove a new search input\r\n * @private\r\n */\r\nol.control.RoutingGeoportail.prototype.removeSearch = function (element, options, after) {\r\n  element.removeChild(after);\r\n  if (after.olsearch.get('feature')) this._source.removeFeature(after.olsearch.get('feature'));\r\n  if (this.getMap()) this.getMap().removeControl(after.olsearch);\r\n  this._resetArray(element);\r\n};\r\n/** Add a new search input\r\n * @private\r\n */\r\nol.control.RoutingGeoportail.prototype.addSearch = function (element, options, after) {\r\n  var self = this;\r\n  var div = ol.ext.element.create('DIV');\r\n  if (after) element.insertBefore(div, after.nextSibling);\r\n  else element.appendChild(div);\r\n  ol.ext.element.create ('BUTTON', { title: options.startlabel||\"add/remove\", parent: div})\r\n    .addEventListener('click', function(e) {\r\n      if (e.ctrlKey) {\r\n        if (this._search.length>2) this.removeSearch(element, options, div);\r\n      } else if (e.shiftKey) {\r\n        this.addSearch(element, options, div);\r\n      }\r\n    }.bind(this));\r\n  var search = div.olsearch = new ol.control.SearchGeoportail({\r\n    className: 'IGNF ol-collapsed',\r\n    apiKey: options.apiKey,\r\n    authentication: options.authentication,\r\n    target: div,\r\n    reverse: true\r\n  });\r\n  search._changeCounter = 0;\r\n  this._resetArray(element);\r\n  search.on('select', function(e){\r\n    search.setInput(e.search.fulltext);\r\n    var f = search.get('feature');\r\n    if (!f) {\r\n      f = new ol.Feature(new ol.geom.Point(e.coordinate));\r\n      search.set('feature', f);\r\n      this._source.addFeature(f);\r\n      // Check geometry change\r\n      search.checkgeom = true;\r\n      f.getGeometry().on('change', function() {\r\n        if (search.checkgeom) this.onGeometryChange(search, f);\r\n      }.bind(this));\r\n    } else {\r\n      search.checkgeom = false;\r\n      if (!e.silent) f.getGeometry().setCoordinates(e.coordinate);\r\n      search.checkgeom = true;\r\n    }\r\n    f.set('name', search.getTitle(e.search));\r\n    f.set('step', this._search.indexOf(search));\r\n    if (f.get('step') === 0) f.set('pos','start');\r\n    else if (f.get('step') === this._search.length-1) f.set('pos','end');\r\n    search.set('selection', e.search);\r\n  }.bind(this));\r\n  search.element.querySelector('input').addEventListener('change', function(){\r\n    search.set('selection', null);\r\n    self.resultElement.innerHTML = '';\r\n  });\r\n  if (this.getMap()) this.getMap().addControl(search);\r\n};\r\n/** Geometry has changed\r\n * @private\r\n */\r\nol.control.RoutingGeoportail.prototype.onGeometryChange = function (search, f, delay) {\r\n  // Set current geom \r\n  var lonlat = ol.proj.transform(f.getGeometry().getCoordinates(), this.getMap().getView().getProjection(), 'EPSG:4326');\r\n  search._handleSelect({ \r\n    x: lonlat[0], \r\n    y: lonlat[1], \r\n    fulltext: lonlat[0].toFixed(6) + ',' + lonlat[1].toFixed(6) \r\n  }, true, { silent: true });\r\n  // Try to revers geocode\r\n  if (delay) {\r\n    search._changeCounter--;\r\n    if (!search._changeCounter) {\r\n      search.reverseGeocode(f.getGeometry().getCoordinates(), { silent: true });\r\n      return;\r\n    }\r\n  } else {\r\n    search._changeCounter++;\r\n    setTimeout(function() {\r\n      this.onGeometryChange(search, f, true);\r\n    }.bind(this), 1000);\r\n  }\r\n}\r\n/**\r\n * Set the map instance the control is associated with\r\n * and add its controls associated to this map.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.control.RoutingGeoportail.prototype.setMap = function (map) {\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  for (var i=0; i<this._search.length; i++) {\r\n    var c = this._search[i];\r\n    c.setMap(map);\r\n  }\r\n};\r\n/** Get request data\r\n * @private\r\n */\r\nol.control.RoutingGeoportail.prototype.requestData = function (steps) {\r\n  var start = steps[0];\r\n  var end = steps[steps.length-1];\r\n  var waypoints = '';\r\n  for (var i=1; i<steps.length-1; i++) {\r\n    waypoints += (waypoints ? ';':'') + steps[i].x+','+steps[i].y;\r\n  }\r\n  return {\r\n    'gp-access-lib': '1.1.0',\r\n    origin: start.x+','+start.y,\r\n    destination: end.x+','+end.y,\r\n    method: this.get('method') || 'time', // 'distance'\r\n    graphName: this.get('mode')==='pedestrian' ? 'Pieton' : 'Voiture',\r\n    waypoints: waypoints,\r\n    format: 'STANDARDEXT'\r\n  };\r\n};\r\n/** Gets time as string\r\n * @param {*} routing routing response\r\n * @return {string}\r\n * @api\r\n */\r\nol.control.RoutingGeoportail.prototype.getTimeString = function (t) {\r\n  t /= 60;\r\n  return (t<1) ? '' : (t<60) ? t.toFixed(0)+' min' : (t/60).toFixed(0)+' h '+(t%60).toFixed(0)+' min';\r\n};\r\n/** Gets distance as string\r\n * @param {number} d distance\r\n * @return {string}\r\n * @api\r\n */\r\nol.control.RoutingGeoportail.prototype.getDistanceString = function (d) {\r\n  return (d<1000) ? d.toFixed(0)+' m' : (d/1000).toFixed(2)+' km';\r\n};\r\n/** Show routing as a list\r\n * @private\r\n */\r\nol.control.RoutingGeoportail.prototype.listRouting = function (routing) {\r\n  this.resultElement.innerHTML = '';\r\n  var t = this.getTimeString(routing.duration);\r\n  t += ' ('+this.getDistanceString(routing.distance)+')';\r\n  var iElement = document.createElement('i');\r\n  iElement.textContent = t;\r\n  this.resultElement.appendChild(iElement)\r\n  var ul = document.createElement('ul');\r\n  this.resultElement.appendChild(ul);\r\n  var info = {\r\n    'none': 'Prendre sur ',\r\n    'R': 'Tourner à droite sur ',\r\n    'FR': 'Tourner légèrement à droite sur ',\r\n    'L': 'Tourner à gauche sur ',\r\n    'FL': 'Tourner légèrement à gauche sur ',\r\n    'F': 'Continuer tout droit sur ',\r\n  }\r\n  for (var i=0, f; f=routing.features[i]; i++) {\r\n    var d = this.getDistanceString(f.get('distance'));\r\n    t = this.getTimeString(f.get('durationT'));\r\n    var li = document.createElement('li');\r\n        li.classList.add(f.get('instruction'));\r\n        li.innerHTML = (info[f.get('instruction')||'none']||'#')\r\n      + ' ' + f.get('name')\r\n      + '<i>' + d + (t ? ' - ' + t : '') +'</i>'\r\n    ul.appendChild(li);\r\n  }\r\n};\r\n/** Handle routing response\r\n * @private\r\n */\r\nol.control.RoutingGeoportail.prototype.handleResponse = function (data, start, end) {\r\n  if (data.status === 'ERROR') {\r\n    this.dispatchEvent({\r\n      type: 'errror',\r\n      status: '200',\r\n      statusText: data.message\r\n    })\r\n    return;\r\n  }\r\n  var routing = { type:'routing' };\r\n  routing.features = [];\r\n  var distance = 0;\r\n  var duration = 0;\r\n  var f, route = [];\r\n  for (var i=0, l; l=data.legs[i]; i++) {\r\n    for (var j=0, s; s=l.steps[j]; j++) {\r\n      var geom = [];\r\n      for (var k=0, p; p=s.points[k]; k++){\r\n        p = p.split(',');\r\n        geom.push([parseFloat(p[0]),parseFloat(p[1])]);\r\n        if (i===0 || k!==0) route.push(geom[k]);\r\n      }\r\n      geom = new ol.geom.LineString(geom);\r\n      var options = {\r\n        geometry: geom.transform('EPSG:4326',this.getMap().getView().getProjection()),\r\n        name: s.name,\r\n        instruction: s.navInstruction,\r\n        distance: parseFloat(s.distanceMeters),\r\n        duration: parseFloat(s.durationSeconds)\r\n      }\r\n      //console.log(duration, options.duration, s)\r\n      distance += options.distance;\r\n      duration += options.duration;\r\n      options.distanceT = distance;\r\n      options.durationT = duration;\r\n      f = new ol.Feature(options);\r\n      routing.features.push(f);\r\n    }\r\n  }\r\n  routing.distance = parseFloat(data.distanceMeters);\r\n  routing.duration = parseFloat(data.durationSeconds);\r\n  // Full route\r\n  route = new ol.geom.LineString(route);\r\n  routing.feature = new ol.Feature ({\r\n    geometry: route.transform('EPSG:4326',this.getMap().getView().getProjection()),\r\n    start: this._search[0].getTitle(start),\r\n    end: this._search[0].getTitle(end), \r\n    distance: routing.distance,\r\n    duration: routing.duration\r\n  });\r\n  // console.log(data, routing);\r\n  this.dispatchEvent(routing);\r\n  this.path = routing;\r\n  console.log(routing)\r\n  return routing;\r\n};\r\n/** Calculate route\r\n * @param {Array<ol.coordinate>|undefined} steps an array of steps in EPSG:4326, default use control input values\r\n * @return {boolean} true is a new request is send (more than 2 points to calculate)\r\n */\r\nol.control.RoutingGeoportail.prototype.calculate = function (steps) {\r\n  this.resultElement.innerHTML = '';\r\n  if (steps) {\r\n    var convert = [];\r\n    steps.forEach(function(s) {\r\n      convert.push({ x: s[0], y: s[1] });\r\n    });\r\n    steps = convert;\r\n  } else {\r\n    steps = []\r\n    for (var i=0; i<this._search.length; i++) {\r\n      if (this._search[i].get('selection')) steps.push(this._search[i].get('selection'));\r\n    }\r\n  }\r\n  if (steps.length<2) return false;\r\n  var start = steps[0];\r\n  var end = steps[steps.length-1];\r\n  var data = this.requestData(steps);\r\n  var url = encodeURI(this.get('url'));\r\n  var parameters = '';\r\n  for (var index in data) {\r\n    parameters += (parameters) ? '&' : '?';\r\n    if (data.hasOwnProperty(index)) parameters += index + '=' + data[index];\r\n  }\r\n  var self = this;\r\n  this.ajax(url + parameters, \r\n    function (resp) {\r\n      if (resp.status >= 200 && resp.status < 400) {\r\n        self.listRouting(self.handleResponse (JSON.parse(resp.response), start, end));\r\n      } else {\r\n        //console.log(url + parameters, arguments);\r\n        this.dispatchEvent({ type: 'error', status: resp.status, statusText: resp.statusText});\r\n      }\r\n    }.bind(this), \r\n    function(resp){\r\n      console.log('ERROR', resp)\r\n      this.dispatchEvent({ type: 'error', status: resp.status, statusText: resp.statusText});\r\n    }.bind(this)\r\n  );\r\n  return true;\r\n};\t\r\n/** Send an ajax request (GET)\r\n * @param {string} url\r\n * @param {function} onsuccess callback\r\n * @param {function} onerror callback\r\n */\r\nol.control.RoutingGeoportail.prototype.ajax = function (url, onsuccess, onerror){\r\n  var self = this;\r\n  // Abort previous request\r\n  if (this._request) {\r\n    this._request.abort();\r\n  }\r\n  // New request\r\n  var ajax = this._request = new XMLHttpRequest();\r\n  ajax.open('GET', url, true);\r\n  ajax.timeout = this.get('timeout') || 10000;\r\n  if (this._auth) {\r\n    ajax.setRequestHeader(\"Authorization\", \"Basic \" + this._auth);\r\n  }\r\n  this.element.classList.add('ol-searching');\r\n  // Load complete\r\n  ajax.onload = function() {\r\n    self._request = null;\r\n    self.element.classList.remove('ol-searching');\r\n    onsuccess.call(self, this);\r\n  };\r\n  // Timeout\r\n  ajax.ontimeout = function () {\r\n    self._request = null;\r\n    self.element.classList.remove('ol-searching');\r\n    if (onerror) onerror.call(self, this);\r\n  };\r\n  // Oops, TODO do something ?\r\n  ajax.onerror = function() {\r\n    self._request = null;\r\n    self.element.classList.remove('ol-searching');\r\n    if (onerror) onerror.call(self, this);\r\n  };\r\n  // GO!\r\n  ajax.send();\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Scale Control.\r\n * A control to display the scale of the center on the map\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fires select\r\n * @fires change:input\r\n * @param {Object=} options\r\n *  @param {string} options.className control class name\r\n *  @param {string} options.ppi screen ppi, default 96\r\n * \t@param {string} options.editable make the control editable, default true\r\n */\r\nol.control.Scale = function(options) {\r\n  if (!options) options = {};\r\n  if (options.typing == undefined) options.typing = 300;\r\n  var element = document.createElement(\"DIV\");\r\n  var classNames = (options.className||\"\")+ \" ol-scale\";\r\n  if (!options.target) {\r\n  classNames += \" ol-unselectable ol-control\";\r\n  }\r\n  this._input = document.createElement(\"INPUT\");\r\n  this._input.value = '-';\r\n  element.setAttribute('class', classNames);\r\n  if (options.editable===false) this._input.readOnly = true;\r\n  element.appendChild(this._input);\r\n  ol.control.Control.call(this, {\r\n  element: element,\r\n  target: options.target\r\n  });\r\n  this._input.addEventListener(\"change\", this.setScale.bind(this));\r\n  this.set('ppi', options.ppi || 96)\r\n};\r\nol.ext.inherits(ol.control.Scale, ol.control.Control);\r\n/**\r\n * Remove the control from its current map and attach it to the new map.\r\n * Subclasses may set up event handlers to get notified about changes to\r\n * the map here.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.control.Scale.prototype.setMap = function (map) {\r\n  if (this._listener) ol.Observable.unByKey(this._listener);\r\n  this._listener = null;\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  // Get change (new layer added or removed)\r\n  if (map) {\r\n    this._listener = map.on('moveend', this.getScale.bind(this));\r\n  }\r\n};\r\n/** Display the scale\r\n */\r\nol.control.Scale.prototype.getScale = function () {\r\n  var map = this.getMap();\r\n  if (map) {\r\n    var d = ol.sphere.getMapScale(map, this.get('ppi'));\r\n    this._input.value = this.formatScale(d);\r\n    return d;\r\n  }\r\n};\r\n/** Format the scale 1/d\r\n * @param {Number} d\r\n * @return {string} formated string\r\n */\r\nol.control.Scale.prototype.formatScale = function (d) {\r\n  if (d>100) d = Math.round(d/100) * 100;\r\n  else d = Math.round(d);\r\n  return '1 / '+ d.toLocaleString();\r\n};\r\n/** Set the current scale (will change the scale of the map)\r\n * @param {Number} value the scale factor\r\n */\r\nol.control.Scale.prototype.setScale = function (value) {\r\n  var map = this.getMap();\r\n  if (map && value) {\r\n    if (value.target) value = value.target.value;\r\n    ol.sphere.setMapScale(map, value, this.get('ppi'));\r\n  }\r\n  this.getScale();\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Search places using the French National Base Address (BAN) API.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Search}\r\n * @fires select\r\n * @param {Object=} Control options.\r\n *  @param {string} options.className control class name\r\n *  @param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {string | undefined} options.reverseTitle Title to use for the reverse geocoding button tooltip, default \"Click on the map...\"\r\n *  @param {string | undefined} options.label Text label to use for the search button, default \"search\"\r\n *  @param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *  @param {number | undefined} options.typing a delay on each typing to start searching (ms), default 500.\r\n *  @param {integer | undefined} options.minLength minimum length to start searching, default 3\r\n *  @param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *\r\n *  @param {string|undefined} options.url Url to BAN api, default \"https://api-adresse.data.gouv.fr/search/\"\r\n *  @param {boolean} options.position Search, with priority to geo position, default false\r\n *  @param {function} options.getTitle a function that takes a feature and return the text to display in the menu, default return label attribute\r\n * @see {@link https://adresse.data.gouv.fr/api/}\r\n */\r\nol.control.SearchBAN = function(options) {\r\n  options = options || {};\r\n  options.typing = options.typing || 500;\r\n  options.url = options.url || 'https://api-adresse.data.gouv.fr/search/';\r\n  options.className = options.className || 'BAN';\r\n  options.copy = '<a href=\"https://adresse.data.gouv.fr/\" target=\"new\">&copy; BAN-data.gouv.fr</a>';\r\n  ol.control.SearchPhoton.call(this, options);\r\n};\r\nol.ext.inherits(ol.control.SearchBAN, ol.control.SearchPhoton);\r\n/** Returns the text to be displayed in the menu\r\n * @param {ol.Feature} f the feature\r\n * @return {string} the text to be displayed in the index\r\n * @api\r\n */\r\nol.control.SearchBAN.prototype.getTitle = function (f) {\r\n  var p = f.properties;\r\n  return (p.label);\r\n};\r\n/** A ligne has been clicked in the menu > dispatch event\r\n * @param {any} f the feature, as passed in the autocomplete\r\n * @api\r\n */\r\nol.control.SearchBAN.prototype.select = function (f){\r\n  var c = f.geometry.coordinates;\r\n  // Add coordinate to the event\r\n  try {\r\n    c = ol.proj.transform (f.geometry.coordinates, 'EPSG:4326', this.getMap().getView().getProjection());\r\n  } catch(e) { /* ok */ }\r\n  this.dispatchEvent({ type:\"select\", search:f, coordinate: c });\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Search on DFCI grid.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Search}\r\n * @fires select\r\n * @param {Object=} Control options. \r\n *\t@param {string} options.className control class name\r\n *\t@param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *\t@param {string | undefined} options.label Text label to use for the search button, default \"search\"\r\n *\t@param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *\t@param {number | undefined} options.typing a delay on each typing to start searching (ms), default 300.\r\n *\t@param {integer | undefined} options.minLength minimum length to start searching, default 1\r\n *\t@param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *\r\n *\t@param {string | undefined} options.property a property to display in the index, default 'name'.\r\n *\t@param {function} options.getTitle a function that takes a feature and return the name to display in the index, default return the property \r\n *\t@param {function | undefined} options.getSearchString a function that take a feature and return a text to be used as search string, default geTitle() is used as search string\r\n */\r\nol.control.SearchDFCI = function(options) {\r\n  if (!options) options = {};\r\n  options.className = options.className || 'dfci';\r\n  options.placeholder = options.placeholder || 'Code DFCI';\r\n  ol.control.Search.call(this, options);\r\n};\r\nol.ext.inherits(ol.control.SearchDFCI, ol.control.Search);\r\n/** Autocomplete function\r\n* @param {string} s search string\r\n* @return {Array<any>|false} an array of search solutions or false if the array is send with the cback argument (asnchronous)\r\n* @api\r\n*/\r\nol.control.SearchDFCI.prototype.autocomplete = function (s) {\r\n  s = s.toUpperCase();\r\n  s = s.replace(/[^0-9,^A-H,^K-N]/g,'');\r\n  if (s.length<2) {\r\n    this.setInput(s);\r\n    return [];\r\n  }\r\n  var i;\r\n  var proj = this.getMap().getView().getProjection();\r\n  var result = [];\r\n  var c = ol.coordinate.fromDFCI(s, proj);\r\n  var level = Math.floor(s.length/2)-1;\r\n  var dfci = ol.coordinate.toDFCI(c, level, proj);\r\n  dfci = dfci.replace(/[^0-9,^A-H,^K-N]/g,'');\r\n  // Valid DFCI ?\r\n  if (!/NaN/.test(dfci) && dfci) {\r\n    console.log('ok', dfci)\r\n    this.setInput(dfci + s.substring(dfci.length, s.length));\r\n    result.push({ coordinate: ol.coordinate.fromDFCI(dfci, proj), name: dfci });\r\n    if (s.length===5) {\r\n      c = ol.coordinate.fromDFCI(s+0, proj);\r\n      dfci = (ol.coordinate.toDFCI(c, level+1, proj)).substring(0,5);\r\n      for (i=0; i<10; i++) {\r\n        result.push({ coordinate: ol.coordinate.fromDFCI(dfci+i, proj), name: dfci+i });\r\n      }\r\n    }\r\n    if (level === 2) {\r\n      for (i=0; i<6; i++) {\r\n        result.push({ coordinate: ol.coordinate.fromDFCI(dfci+'.'+i, proj), name: dfci+'.'+i });\r\n      }\r\n    }\r\n  }\r\n  return result;\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Search features.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Search}\r\n * @fires select\r\n * @param {Object=} Control options. \r\n *\t@param {string} options.className control class name\r\n *\t@param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *\t@param {string | undefined} options.label Text label to use for the search button, default \"search\"\r\n *\t@param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *\t@param {number | undefined} options.typing a delay on each typing to start searching (ms), default 300.\r\n *\t@param {integer | undefined} options.minLength minimum length to start searching, default 1\r\n *\t@param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *\r\n *\t@param {string | undefined} options.property a property to display in the index, default 'name'.\r\n *\t@param {function} options.getTitle a function that takes a feature and return the name to display in the index, default return the property \r\n *\t@param {function | undefined} options.getSearchString a function that take a feature and return a text to be used as search string, default geTitle() is used as search string\r\n */\r\nol.control.SearchFeature = function(options) {\r\n  if (!options) options = {};\r\n  options.className = options.className || 'feature';\r\n  ol.control.Search.call(this, options);\r\n  if (typeof(options.getSearchString)==\"function\") this.getSearchString = options.getSearchString;\r\n  this.set('property', options.property || 'name');\r\n  this.source_ = options.source;\r\n};\r\nol.ext.inherits(ol.control.SearchFeature, ol.control.Search);\r\n/** No history avaliable on features\r\n */\r\nol.control.SearchFeature.prototype.restoreHistory = function () {\r\n  this.set('history', []);\r\n};\r\n/** No history avaliable on features\r\n */\r\nol.control.SearchFeature.prototype.saveHistory = function () {\r\n  try {\r\n    localStorage.removeItem(\"ol@search-\"+this._classname);\r\n  } catch(e) { console.warn('Failed to access localStorage...'); }\r\n}\r\n/** Returns the text to be displayed in the menu\r\n*\t@param {ol.Feature} f the feature\r\n*\t@return {string} the text to be displayed in the index\r\n*\t@api\r\n*/\r\nol.control.SearchFeature.prototype.getTitle = function (f) {\r\n  return f.get(this.get('property')||'name');\r\n};\r\n/** Return the string to search in\r\n*\t@param {ol.Feature} f the feature\r\n*\t@return {string} the text to be used as search string\r\n*\t@api\r\n*/\r\nol.control.SearchFeature.prototype.getSearchString = function (f) {\r\n  return this.getTitle(f);\r\n};\r\n/** Get the source\r\n*\t@return {ol.source.Vector}\r\n*\t@api\r\n*/\r\nol.control.SearchFeature.prototype.getSource = function () {\r\n  return this.source_;\r\n}\r\n/** Get the source\r\n*\t@param {ol.source.Vector} source\r\n*\t@api\r\n*/\r\nol.control.SearchFeature.prototype.setSource = function (source) {\r\n  this.source_ =  source;\r\n};\r\n/** Autocomplete function\r\n* @param {string} s search string\r\n* @param {int} max max \r\n* @param {function} cback a callback function that takes an array to display in the autocomplete field (for asynchronous search)\r\n* @return {Array<any>|false} an array of search solutions or false if the array is send with the cback argument (asnchronous)\r\n* @api\r\n*/\r\nol.control.SearchFeature.prototype.autocomplete = function (s) {\r\n  var result = [];\r\n  if (this.source_) {\r\n    // regexp\r\n    s = s.replace(/^\\*/,'');\r\n    var rex = new RegExp(s, 'i');\r\n    // The source\r\n    var features = this.source_.getFeatures();\r\n    var max = this.get('maxItems')\r\n    for (var i=0, f; f=features[i]; i++) {\r\n      var att = this.getSearchString(f);\r\n      if (att !== undefined && rex.test(att)) {\r\n        result.push(f);\r\n        if ((--max)<=0) break;\r\n      }\r\n    }\r\n  }\r\n  return result;\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Search on GPS coordinate.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Search}\r\n * @fires select\r\n * @param {Object=} Control options. \r\n *  @param {string} options.className control class name\r\n *  @param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {string | undefined} options.label Text label to use for the search button, default \"search\"\r\n *  @param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *  @param {number | undefined} options.typing a delay on each typing to start searching (ms), default 300.\r\n *  @param {integer | undefined} options.minLength minimum length to start searching, default 1\r\n *  @param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n */\r\nol.control.SearchGPS = function(options) {\r\n  if (!options) options = {};\r\n  options.className = (options.className || '') + ' ol-searchgps';\r\n  options.placeholder = options.placeholder || 'lon,lat';\r\n  ol.control.Search.call(this, options);\r\n  // Geolocation\r\n  this.geolocation = new ol.Geolocation({\r\n    projection: \"EPSG:4326\",\r\n    trackingOptions: {\r\n      maximumAge: 10000,\r\n      enableHighAccuracy: true,\r\n      timeout: 600000\r\n    }\r\n  });\r\n  ol.ext.element.create ('BUTTON', {\r\n    className: 'ol-geoloc',\r\n    title: 'Locate with GPS',\r\n    parent: this.element,\r\n    click: function(){\r\n      this.geolocation.setTracking(true);\r\n    }.bind(this)\r\n  })\r\n  // DMS switcher\r\n  ol.ext.element.createSwitch({\r\n    html: 'decimal',\r\n    after: 'DMS',\r\n    change: function(e) {\r\n      if (e.target.checked) this.element.classList.add('ol-dms');\r\n      else this.element.classList.remove('ol-dms');\r\n    }.bind(this),\r\n    parent: this.element\r\n  });\r\n  this._createForm();\r\n  // Move list to the end\r\n  var ul = this.element.querySelector(\"ul.autocomplete\");\r\n  this.element.appendChild(ul);\r\n};\r\nol.ext.inherits(ol.control.SearchGPS, ol.control.Search);\r\n/** Create input form\r\n * @private\r\n */\r\nol.control.SearchGPS.prototype._createForm = function () {\r\n  // Value has change\r\n  var onchange = function(e) {\r\n    if (e.target.classList.contains('ol-dms')) {\r\n      lon.value = (lond.value<0 ? -1:1) * Number(lond.value) + Number(lonm.value)/60 + Number(lons.value)/3600;\r\n      lon.value = (lond.value<0 ? -1:1) * Math.round(lon.value*10000000)/10000000;\r\n      lat.value = (latd.value<0 ? -1:1) * Number(latd.value) + Number(latm.value)/60 + Number(lats.value)/3600;\r\n      lat.value = (latd.value<0 ? -1:1) * Math.round(lat.value*10000000)/10000000;\r\n    }\r\n    if (lon.value||lat.value) {\r\n      this._input.value = lon.value+','+lat.value;\r\n    } else {\r\n      this._input.value = '';\r\n    }\r\n    if (!e.target.classList.contains('ol-dms')) {\r\n      var s = ol.coordinate.toStringHDMS([Number(lon.value), Number(lat.value)]);\r\n      var c = s.replace(/(N|S|E|W)/g,'').split('″');\r\n      c[1] = c[1].trim().split(' ');\r\n      lond.value = (/W/.test(s) ? -1 : 1) * parseInt(c[1][0]);\r\n      lonm.value = parseInt(c[1][1]);\r\n      lons.value = parseInt(c[1][2]);\r\n      c[0] = c[0].trim().split(' ');\r\n      latd.value = (/W/.test(s) ? -1 : 1) * parseInt(c[0][0]);\r\n      latm.value = parseInt(c[0][1]);\r\n      lats.value = parseInt(c[0][2]);\r\n    }\r\n    this.search();\r\n  }.bind(this);\r\n  function createInput(className, unit) {\r\n    var input = ol.ext.element.create('INPUT', {\r\n      className: className,\r\n      type:'number',\r\n      step:'any',\r\n      lang: 'en',\r\n      parent: div,\r\n      on: {\r\n        'change keyup': onchange\r\n      }\r\n    });\r\n    if (unit) {\r\n      ol.ext.element.create('SPAN', {\r\n        className: 'ol-dms',\r\n        html: unit,\r\n        parent: div,\r\n      });\r\n    }\r\n    return input;\r\n  }\r\n  // Longitude\r\n  var div = ol.ext.element.create('DIV', {\r\n    className: 'ol-longitude',\r\n    parent: this.element\r\n  });\r\n  ol.ext.element.create('LABEL', {\r\n    html: 'Longitude',\r\n    parent: div\r\n  });\r\n  var lon = createInput('ol-decimal');\r\n  var lond = createInput('ol-dms','°');\r\n  var lonm = createInput('ol-dms','\\'');\r\n  var lons = createInput('ol-dms','\"');\r\n  // Latitude\r\n  div = ol.ext.element.create('DIV', {\r\n    className: 'ol-latitude',\r\n    parent: this.element\r\n  })\r\n  ol.ext.element.create('LABEL', {\r\n    html: 'Latitude',\r\n    parent: div\r\n  });\r\n  var lat = createInput('ol-decimal');\r\n  var latd = createInput('ol-dms','°');\r\n  var latm = createInput('ol-dms','\\'');\r\n  var lats = createInput('ol-dms','\"');\r\n  // Focus on open\r\n  if (this.button) {\r\n    this.button.addEventListener(\"click\", function() {\r\n      lon.focus();\r\n    });\r\n  }\r\n  // Change value on click\r\n  this.on('select', function(e){\r\n    lon.value = e.search.gps[0];\r\n    lat.value = e.search.gps[1];\r\n  }.bind(this));\r\n  // Change value on geolocation\r\n  this.geolocation.on('change', function(){\r\n    this.geolocation.setTracking(false);\r\n    var coord = this.geolocation.getPosition();\r\n    lon.value = coord[0];\r\n    lat.value = coord[1];\r\n    this._triggerCustomEvent('keyup', lon);\r\n  }.bind(this));\r\n};\r\n/** Autocomplete function\r\n* @param {string} s search string\r\n* @return {Array<any>|false} an array of search solutions\r\n* @api\r\n*/\r\nol.control.SearchGPS.prototype.autocomplete = function (s) {\r\n  var result = [];\r\n  var c = s.split(',');\r\n  c[0] = Number(c[0]);\r\n  c[1] = Number(c[1]);\r\n  // Name\r\n  s = ol.coordinate.toStringHDMS(c)\r\n  if (s) s= s.replace(/(°|′|″) /g,'$1');\r\n  // \r\n  var coord = ol.proj.transform ([c[0], c[1]], 'EPSG:4326', this.getMap().getView().getProjection());\r\n  result.push({ gps: c, coordinate: coord, name: s });\r\n  return result;\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Search places using the French National Base Address (BAN) API.\r\n *\r\n * @constructor\r\n * @extends {ol.control.SearchJSON}\r\n * @fires select\r\n * @param {any} options extend ol.control.SearchJSON options\r\n *\t@param {string} options.className control class name\r\n *\t@param {boolean | undefined} [options.apiKey] the service api key.\r\n *\t@param {string | undefined} options.authentication: basic authentication for the service API as btoa(\"login:pwd\")\r\n *\t@param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *\t@param {string | undefined} options.label Text label to use for the search button, default \"search\"\r\n *\t@param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *\t@param {number | undefined} options.typing a delay on each typing to start searching (ms), default 500.\r\n *\t@param {integer | undefined} options.minLength minimum length to start searching, default 3\r\n *\t@param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *\r\n *\t@param {Number} options.pageSize item per page for parcelle list paging, use -1 for no paging, default 5\r\n * @see {@link https://geoservices.ign.fr/documentation/geoservices/geocodage.html}\r\n */\r\nol.control.SearchGeoportailParcelle = function(options) {\r\n  var self = this;\r\n  options.type = \"Commune\";\r\n  options.className = (options.className ? options.className:\"\")+\" IGNF-parcelle ol-collapsed-list ol-collapsed-num\";\r\n  options.inputLabel = \"Commune\";\r\n  options.noCollapse = true;\r\n  options.placeholder = options.placeholder || \"Choisissez une commune...\";\r\n  ol.control.SearchGeoportail.call(this, options);\r\n  this.set('copy', null);\r\n  var element = this.element;\r\n  // Add parcel form\r\n  var div = document.createElement(\"DIV\");\r\n  element.appendChild(div);\r\n  var label = document.createElement(\"LABEL\");\r\n  label.innerText = 'Préfixe'\r\n  div.appendChild(label);\r\n  label = document.createElement(\"LABEL\");\r\n  label.innerText = 'Section'\r\n  div.appendChild(label);\r\n  label = document.createElement(\"LABEL\");\r\n  label.innerText = 'Numéro'\r\n  div.appendChild(label);\r\n  div.appendChild(document.createElement(\"BR\"));\r\n  // Input\r\n  this._inputParcelle = {\r\n    prefix: document.createElement(\"INPUT\"),\r\n    section: document.createElement(\"INPUT\"),\r\n    numero: document.createElement(\"INPUT\")\r\n  };\r\n  this._inputParcelle.prefix.setAttribute('maxlength',3);\r\n  this._inputParcelle.section.setAttribute('maxlength',2);\r\n  this._inputParcelle.numero.setAttribute('maxlength',4);\r\n  // Delay search\r\n  var tout;\r\n  var doSearch = function() {\r\n    if (tout) clearTimeout(tout);\r\n    tout = setTimeout(function() {\r\n        self.autocompleteParcelle();\r\n    }, options.typing || 0);\r\n  }\r\n  // Add inputs\r\n  for (var i in this._inputParcelle) {\r\n    div.appendChild(this._inputParcelle[i]);\r\n    this._inputParcelle[i].addEventListener(\"keyup\", doSearch);\r\n    this._inputParcelle[i].addEventListener('blur', function() {\r\n      tout = setTimeout(function(){ element.classList.add('ol-collapsed-num'); }, 200);\r\n    });\r\n    this._inputParcelle[i].addEventListener('focus', function() {\r\n      clearTimeout(tout);\r\n      element.classList.remove('ol-collapsed-num');\r\n    });\r\n  }\r\n  this.activateParcelle(false);\r\n  // Autocomplete list\r\n  var auto = document.createElement('DIV');\r\n  auto.className = 'autocomplete-parcelle';\r\n  element.appendChild(auto);\r\n  var ul = document.createElement('UL');\r\n  ul.classList.add('autocomplete-parcelle');\r\n  auto.appendChild(ul);\r\n  ul = document.createElement('UL');\r\n  ul.classList.add('autocomplete-page');\r\n  auto.appendChild(ul);\r\n  // Show/hide list on fcus/blur\t\r\n  this._input.addEventListener('blur', function() {\r\n    setTimeout(function(){ element.classList.add('ol-collapsed-list') }, 200);\r\n  });\r\n  this._input.addEventListener('focus', function() {\r\n    element.classList.remove('ol-collapsed-list');\r\n    self._listParcelle([]);\r\n    if (self._commune) {\r\n      self._commune = null;\r\n      self._input.value = '';\r\n      self.drawList_();\r\n    }\r\n    self.activateParcelle(false);\r\n  });\r\n  this.on('select', this.selectCommune.bind(this));\r\n  this.set('pageSize', options.pageSize || 5);\r\n};\r\nol.ext.inherits(ol.control.SearchGeoportailParcelle, ol.control.SearchGeoportail);\r\n/** Select a commune => start searching parcelle  \r\n * @param {any} e \r\n * @private\r\n */\r\nol.control.SearchGeoportailParcelle.prototype.selectCommune = function(e) {\r\n  this._commune = e.search.insee;\r\n  this._input.value = e.search.insee + ' - ' + e.search.fulltext;\r\n  this.activateParcelle(true);\r\n  this._inputParcelle.numero.focus();\r\n  this.autocompleteParcelle();\r\n};\r\n/** Set the input parcelle\r\n * @param {*} p parcel\r\n * \t@param {string} p.Commune\r\n * \t@param {string} p.CommuneAbsorbee\r\n * \t@param {string} p.Section\r\n * \t@param {string} p.Numero\r\n * @param {boolean} search start a search\r\n */\r\nol.control.SearchGeoportailParcelle.prototype.setParcelle = function(p, search) {\r\n  this._inputParcelle.prefix.value = (p.Commune||'') + (p.CommuneAbsorbee||'');\r\n  this._inputParcelle.section.value = p.Section||'';\r\n  this._inputParcelle.numero.value = p.Numero||'';\r\n  if (search) this._triggerCustomEvent(\"keyup\", this._inputParcelle.prefix);\r\n};\r\n/** Activate parcelle inputs\r\n * @param {bolean} b\r\n */\r\nol.control.SearchGeoportailParcelle.prototype.activateParcelle = function(b) {\r\n  for (var i in this._inputParcelle) {\r\n    this._inputParcelle[i].readOnly = !b;\r\n  }\r\n  if (b) {\r\n    this._inputParcelle.section.parentElement.classList.add('ol-active');\r\n  } else {\r\n    this._inputParcelle.section.parentElement.classList.remove('ol-active');\t\t\r\n  }\r\n};\r\n/** Send search request for the parcelle  \r\n * @private\r\n */\r\nol.control.SearchGeoportailParcelle.prototype.autocompleteParcelle = function() {\r\n  // Add 0 to fit the format\r\n  function complete (s, n, c) {\r\n    if (!s) return s;\r\n    c = c || \"0\";\r\n    while (s.length < n) s = c+s;\r\n    return s.replace(/\\*/g,'_');\r\n  }\r\n  // The selected commune\r\n  var commune = this._commune;\r\n  var prefix = complete (this._inputParcelle.prefix.value, 3);\r\n  if (prefix === '000') {\r\n    prefix = '___';\r\n  }\r\n  // Get parcelle number\r\n  var section = complete (this._inputParcelle.section.value, 2);\r\n  var numero = complete (this._inputParcelle.numero.value, 4, \"0\");\r\n  var search = commune + (prefix||'___') + (section||\"__\") + (numero ?  numero : section ? \"____\":\"0001\");\r\n  this.searchParcelle(search, \r\n    function(jsonResp) {\r\n      this._listParcelle(jsonResp);\r\n    }.bind(this),\r\n    function() {\r\n      console.log('oops')\r\n    })\r\n};\r\n/** Send search request for a parcelle number\r\n * @param {string} search search parcelle number\r\n * @param {function} success callback function called on success\r\n * @param {function} error callback function called on error\r\n */\r\nol.control.SearchGeoportailParcelle.prototype.searchParcelle = function(search, success /*, error */) {\r\n  // Request\r\n  var request = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\r\n  +'<XLS xmlns:xls=\"http://www.opengis.net/xls\" xmlns:gml=\"http://www.opengis.net/gml\" xmlns=\"http://www.opengis.net/xls\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.2\" xsi:schemaLocation=\"http://www.opengis.net/xls http://schemas.opengis.net/ols/1.2/olsAll.xsd\">'\r\n    +'<RequestHeader/>'\r\n    +'<Request requestID=\"1\" version=\"1.2\" methodName=\"LocationUtilityService\">'\r\n      +'<GeocodeRequest returnFreeForm=\"false\">'\r\n        +'<Address countryCode=\"CadastralParcel\">'\r\n        +'<freeFormAddress>'+search+'+</freeFormAddress>'\r\n        +'</Address>'\r\n      +'</GeocodeRequest>'\r\n    +'</Request>'\r\n  +'</XLS>'\r\n  // Geocode\r\n  this.ajax(\r\n    this.get('url').replace('ols/apis/completion','geoportail/ols'), \r\n    { xls: request },\r\n    function(xml) {\r\n      // XML to JSON\r\n      var parser = new DOMParser();\r\n      var xmlDoc = parser.parseFromString(xml,\"text/xml\");\r\n      var parcelles = xmlDoc.getElementsByTagName('GeocodedAddress');\r\n      var jsonResp = []\r\n      for (var i=0, parc; parc= parcelles[i]; i++) {\r\n        var node = parc.getElementsByTagName('gml:pos')[0] || parc.getElementsByTagName('pos')[0];\r\n        var p = node.childNodes[0].nodeValue.split(' ');\r\n        var att = parc.getElementsByTagName('Place');\r\n        var json = { \r\n          lon: Number(p[1]), \r\n          lat: Number(p[0])\r\n        };\r\n        for (var k=0, a; a=att[k]; k++) {\r\n          json[a.attributes.type.value] = a.childNodes[0].nodeValue;\r\n        }\r\n        jsonResp.push(json);\r\n      }\r\n      success(jsonResp);\r\n    }, \r\n    { dataType: 'XML' }\r\n  );\r\n};\r\n/**\r\n * Draw the autocomplete list\r\n * @param {*} resp \r\n * @private\r\n */\r\nol.control.SearchGeoportailParcelle.prototype._listParcelle = function(resp) {\r\n  var self = this;\r\n  var ul = this.element.querySelector(\"ul.autocomplete-parcelle\");\r\n  ul.innerHTML='';\r\n  var page = this.element.querySelector(\"ul.autocomplete-page\");\r\n  page.innerHTML='';\r\n  this._listParc = [];\r\n  // Show page i\r\n  function showPage(i) {\r\n    var l = ul.children;\r\n    var visible = \"ol-list-\"+i;\r\n    var k;\r\n    for (k=0; k<l.length; k++) {\r\n      l[k].style.display = (l[k].className===visible) ? '' : 'none';\r\n    }\r\n    l = page.children;\r\n    for (k=0; k<l.length; k++) {\r\n      l[k].className = (l[k].innerText==i) ? 'selected' : '';\r\n    }\r\n    page.style.display = l.length>1 ? '' : 'none';\r\n  }\r\n  // Sort table\r\n  resp.sort(function(a,b) {\r\n    var na = a.INSEE+a.CommuneAbsorbee+a.Section+a.Numero;\r\n    var nb = b.INSEE+b.CommuneAbsorbee+b.Section+b.Numero;\r\n    return na===nb ? 0 : na<nb ? -1 : 1;\r\n  });\r\n  // Show list\r\n  var n = this.get('pageSize');\r\n  for (var i=0, r; r = resp[i]; i++) {\r\n    var li = document.createElement(\"LI\");\r\n    li.setAttribute(\"data-search\", i);\r\n    if (n>0) li.classList.add(\"ol-list-\"+Math.floor(i/n));\r\n    this._listParc.push(r);\r\n    li.addEventListener(\"click\", function(e) {\r\n      self._handleParcelle(self._listParc[e.currentTarget.getAttribute(\"data-search\")]);\r\n    });\r\n    li.innerHTML = r.INSEE+r.CommuneAbsorbee+r.Section+r.Numero;\r\n    ul.appendChild(li);\r\n    //\r\n    if (n>0 && !(i%n)) {\r\n      li = document.createElement(\"LI\");\r\n      li.innerText = Math.floor(i/n);\r\n      li.addEventListener(\"click\", function(e) {\r\n        showPage(e.currentTarget.innerText);\r\n      });\r\n      page.appendChild(li);\r\n    }\r\n  }\r\n  if (n>0) showPage(0);\r\n};\r\n/**\r\n * Handle parcelle section\r\n * @param {*} parc \r\n * @private\r\n */\r\nol.control.SearchGeoportailParcelle.prototype._handleParcelle = function(parc) {\r\n  this.dispatchEvent({ \r\n    type:\"parcelle\", \r\n    search: parc, \r\n    coordinate: ol.proj.fromLonLat([parc.lon, parc.lat], this.getMap().getView().getProjection())\r\n  });\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Search places using the Nominatim geocoder from the OpenStreetmap project.\r\n *\r\n * @constructor\r\n * @extends {ol.control.Search}\r\n * @fires select\r\n * @param {Object=} Control options.\r\n *  @param {string} options.className control class name\r\n *  @param {boolean | undefined} options.polygon To get output geometry of results (in geojson format), default false.\r\n *  @param {Array<Number> | undefined} options.viewbox The preferred area to find search results. Any two corner points of the box are accepted in any order as long as they span a real box, default none.\r\n *  @param {boolean | undefined} options.bounded Restrict the results to only items contained with the bounding box. Restricting the results to the bounding box also enables searching by amenity only. default false\r\n *  @param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {string | undefined} options.title Title to use for the search button tooltip, default \"Search\"\r\n *  @param {string | undefined} options.reverseTitle Title to use for the reverse geocoding button tooltip, default \"Click on the map...\"\r\n *  @param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *  @param {number | undefined} options.typing a delay on each typing to start searching (ms), default 500.\r\n *  @param {integer | undefined} options.minLength minimum length to start searching, default 3\r\n *  @param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *\r\n *  @param {string|undefined} options.url URL to Nominatim API, default \"https://nominatim.openstreetmap.org/search\"\r\n * @see {@link https://wiki.openstreetmap.org/wiki/Nominatim}\r\n */\r\nol.control.SearchNominatim = function(options) {\r\n  options = options || {};\r\n  options.className = options.className || 'nominatim';\r\n  options.typing = options.typing || 500;\r\n  options.url = options.url || 'https://nominatim.openstreetmap.org/search';\r\n  options.copy = '<a href=\"http://www.openstreetmap.org/copyright\" target=\"new\">&copy; OpenStreetMap contributors</a>';\r\n  ol.control.SearchJSON.call(this, options);\r\n  this.set('polygon', options.polygon);\r\n  this.set('viewbox', options.viewbox);\r\n  this.set('bounded', options.bounded);\r\n};\r\nol.ext.inherits(ol.control.SearchNominatim, ol.control.SearchJSON);\r\n/** Returns the text to be displayed in the menu\r\n *\t@param {ol.Feature} f the feature\r\n*\t@return {string} the text to be displayed in the index\r\n*\t@api\r\n*/\r\nol.control.SearchNominatim.prototype.getTitle = function (f) {\r\n  var info = [];\r\n  if (f.class) info.push(f.class);\r\n  if (f.type) info.push(f.type);\r\n  var title = f.display_name+(info.length ? \"<i>\"+info.join(' - ')+\"</i>\" : '');\r\n  if (f.icon) title = \"<img src='\"+f.icon+\"' />\" + title;\r\n  return (title);\r\n};\r\n/** \r\n * @param {string} s the search string\r\n * @return {Object} request data (as key:value)\r\n * @api\r\n */\r\nol.control.SearchNominatim.prototype.requestData = function (s) {\r\n  var data = { \r\n    format: \"json\", \r\n    addressdetails: 1, \r\n    q: s, \r\n    polygon_geojson: this.get('polygon') ? 1:0,\r\n    bounded: this.get('bounded') ? 1:0,\r\n    limit: this.get('maxItems')\r\n  };\r\n  if (this.get('viewbox')) data.viewbox = this.get('viewbox');\r\n  return data;\r\n};\r\n/** A ligne has been clicked in the menu > dispatch event\r\n *\t@param {any} f the feature, as passed in the autocomplete\r\n*\t@api\r\n*/\r\nol.control.SearchNominatim.prototype.select = function (f){\r\n  var c = [Number(f.lon), Number(f.lat)];\r\n  // Add coordinate to the event\r\n  try {\r\n    c = ol.proj.transform (c, 'EPSG:4326', this.getMap().getView().getProjection());\r\n  } catch(e) { /* ok */}\r\n  this.dispatchEvent({ type:\"select\", search:f, coordinate: c });\r\n};\r\n/**\r\n * Handle server response to pass the features array to the display list\r\n * @param {any} response server response\r\n * @return {Array<any>} an array of feature\r\n * @api\r\n */\r\nol.control.SearchJSON.prototype.handleResponse = function (response) {\r\n  return response.results || response;\r\n};\r\n/** Reverse geocode\r\n * @param {ol.coordinate} coord\r\n * @api\r\n */\r\nol.control.SearchNominatim.prototype.reverseGeocode = function (coord, cback) {\r\n  var lonlat = ol.proj.transform (coord, this.getMap().getView().getProjection(), 'EPSG:4326');\r\n  this.ajax(\r\n    this.get('url').replace('search', 'reverse'),\r\n    { lon: lonlat[0], lat: lonlat[1], format: 'json' },\r\n    function(resp) {\r\n      if (cback) {\r\n        cback.call(this, [resp]);\r\n      } else {\r\n        if (resp && !resp.error) {\r\n          this._handleSelect(resp, true);\r\n        }\r\n        //this.setInput('', true);\r\n      }\r\n    }.bind(this)\r\n  );\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Search places using the MediaWiki API.\r\n * @see https://www.mediawiki.org/wiki/API:Main_page\r\n *\r\n * @constructor\r\n * @extends {ol.control.SearchJSON}\r\n * @fires select\r\n * @param {Object=} Control options.\r\n *  @param {string} options.className control class name\r\n *  @param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {string | undefined} options.label Text label to use for the search button, default \"search\"\r\n *  @param {string | undefined} options.placeholder placeholder, default \"Search...\"\r\n *  @param {number | undefined} options.typing a delay on each typing to start searching (ms), default 1000.\r\n *  @param {integer | undefined} options.minLength minimum length to start searching, default 3\r\n *  @param {integer | undefined} options.maxItems maximum number of items to display in the autocomplete list, default 10\r\n *  @param {function | undefined} options.handleResponse Handle server response to pass the features array to the list\r\n * \r\n *  @param {string|undefined} options.lang API language, default none\r\n */\r\nol.control.SearchWikipedia = function(options){\r\n  options = options || {};\r\n  options.lang = options.lang||'en';\r\n  options.className = options.className || 'ol-search-wikipedia';\r\n  options.url = 'https://'+options.lang+'.wikipedia.org/w/api.php';\r\n  options.placeholder = options.placeholder || 'search string, File:filename';\r\n  options.copy = '<a href=\"https://'+options.lang+'.wikipedia.org/\" target=\"new\">Wikipedia&reg; - CC-By-SA</a>';\r\n  ol.control.SearchJSON.call(this, options);\r\n  this.set('lang', options.lang);\r\n};\r\nol.ext.inherits(ol.control.SearchWikipedia, ol.control.SearchJSON);\r\n/** Returns the text to be displayed in the menu\r\n*\t@param {ol.Feature} f the feature\r\n*\t@return {string} the text to be displayed in the index\r\n*\t@api\r\n*/\r\nol.control.SearchWikipedia.prototype.getTitle = function (f){\r\n  return ol.ext.element.create('DIV', {\r\n    html: f.title,\r\n    title: f.desc\r\n  });\r\n  //return f.desc;\r\n};\r\n/** Set the current language\r\n * @param {string} lang the current language as ISO string (en, fr, de, es, it, ja, ...)\r\n */\r\nol.control.SearchWikipedia.prototype.setLang = function (lang){\r\n  this.set('lang', lang)\r\n  this.set('url', 'https://'+lang+'.wikipedia.org/w/api.php');\r\n};\r\n/** \r\n * @param {string} s the search string\r\n * @return {Object} request data (as key:value)\r\n * @api\r\n */\r\nol.control.SearchWikipedia.prototype.requestData = function (s) {\r\n  var data = {\r\n    action: 'opensearch',\r\n    search: s,\r\n    lang: this.get('lang'),\r\n    format: 'json',\r\n    origin: '*',\r\n    limit: this.get('maxItems')\r\n  }\r\n  return data;\r\n};\r\n/**\r\n * Handle server response to pass the features array to the list\r\n * @param {any} response server response\r\n * @return {Array<any>} an array of feature\r\n */\r\nol.control.SearchWikipedia.prototype.handleResponse = function (response) {\r\n  var features = [];\r\n  for (var i=0; i<response[1].length; i++) {\r\n    features.push({\r\n      title: response[1][i],\r\n      desc: response[2][i],\r\n      uri: response[3][i]\r\n    })\r\n  }\r\n  return features;\r\n};\r\n/** A ligne has been clicked in the menu query for more info and disatch event\r\n*\t@param {any} f the feature, as passed in the autocomplete\r\n*\t@api\r\n*/\r\nol.control.SearchWikipedia.prototype.select = function (f){\r\n  var title = decodeURIComponent(f.uri.split('/').pop()).replace(/'/,'%27');\r\n  // Search for coords\r\n  ol.ext.Ajax.get({\r\n    url: f.uri.split('wiki/')[0]+'w/api.php',\r\n    data: {\r\n      action: 'query',\r\n      prop: 'pageimages|coordinates|extracts',\r\n      exintro: 1,\r\n      explaintext: 1,\r\n      piprop: 'original',\r\n      origin: '*',\r\n      format: 'json',\r\n      redirects: 1,\r\n      titles: title\r\n    },\r\n    options: {\r\n      encode: false\r\n    },\r\n    success: function (e) {\r\n      var page = e.query.pages[Object.keys(e.query.pages).pop()];\r\n      console.log(page);\r\n      var feature = {\r\n        title: f.title,\r\n        desc: page.extract || f.desc,\r\n        url: f.uri,\r\n        img: page.original ? page.original.source : undefined,\r\n        pageid: page.pageid\r\n      }\r\n      var c;\r\n      if (page.coordinates) {\r\n        feature.lon = page.coordinates[0].lon;\r\n        feature.lat = page.coordinates[0].lat;\r\n        c = [feature.lon, feature.lat];\r\n        c = ol.proj.transform (c, 'EPSG:4326', this.getMap().getView().getProjection());\r\n      }\r\n      this.dispatchEvent({ type:\"select\", search:feature, coordinate: c });\r\n    }.bind(this)\r\n  })\r\n};\r\n/** */\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Select Control.\r\n * A control to select features by attributes\r\n *\r\n * @constructor\r\n * @extends {ol.control.SelectBase}\r\n * @fires select\r\n * @param {Object=} options\r\n *  @param {string} options.className control class name\r\n *  @param {Element | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {ol.source.Vector | Array<ol.source.Vector>} options.source the source to search in\r\n *  @param {string} [options.selectLabel=select] select button label\r\n *  @param {string} [options.addLabel=add] add button label\r\n *  @param {string} [options.caseLabel=case sensitive] case checkbox label\r\n *  @param {string} [options.allLabel=match all] match all checkbox label\r\n *  @param {string} [options.attrPlaceHolder=attribute]\r\n *  @param {string} [options.valuePlaceHolder=value]\r\n */\r\nol.control.Select = function(options) {\r\n  var self = this;\r\n  if (!options) options = {};\r\n  // Container\r\n  var div = options.content = document.createElement(\"div\");\r\n  // Autocompletion list\r\n  this._ul = ol.ext.element.create('UL', {\r\n    parent: div\r\n  });\r\n  // All conditions\r\n  this._all = ol.ext.element.create('INPUT', {\r\n    type: 'checkbox',\r\n    checked: true\r\n  });\r\n  var label_match_all = ol.ext.element.create('LABEL',{\r\n    html: this._all,\r\n    parent: div\r\n  });\r\n  ol.ext.element.appendText(label_match_all, options.allLabel || 'match all');\r\n  // Use case\r\n  this._useCase = ol.ext.element.create('INPUT', {\r\n    type: 'checkbox'\r\n  });\r\n  var label_case_sensitive = ol.ext.element.create('LABEL',{\r\n    html: this._useCase,\r\n    parent: div\r\n  });\r\n  ol.ext.element.appendText(label_case_sensitive, options.caseLabel || 'case sensitive');\r\n  ol.control.SelectBase.call(this, options);\r\n  // Add button\r\n  ol.ext.element.create('BUTTON', {\r\n    className: 'ol-append',\r\n    html: options.addLabel\t|| 'add rule',\r\n    click: function(){\r\n      self.addCondition();\r\n    },\r\n    parent: div\r\n  });\r\n  this._conditions = [];\r\n  this.set('attrPlaceHolder', options.attrPlaceHolder || 'attribute');\r\n  this.set('valuePlaceHolder', options.valuePlaceHolder || 'value');\r\n  this.addCondition();\r\n};\r\nol.ext.inherits(ol.control.Select, ol.control.SelectBase);\r\n/** Add a new condition\r\n * @param {*} options\r\n * \t@param {string} options.attr attribute name\r\n * \t@param {string} options.op\toperator\r\n * \t@param {string} options.val attribute value\r\n */\r\nol.control.Select.prototype.addCondition = function (options) {\r\n  options = options || {};\r\n  this._conditions.push({\r\n    attr: options.attr || '',\r\n    op: options.op || '=',\r\n    val: options.val || ''\r\n  });\r\n  this._drawlist();\r\n};\r\n/** Get the condition list\r\n */\r\nol.control.Select.prototype.getConditions = function () {\r\n  return {\r\n    usecase: this._useCase.checked,\r\n    all: this._all.checked,\r\n    conditions: this._conditions\r\n  }\r\n};\r\n/** Set the condition list\r\n */\r\nol.control.Select.prototype.setConditions = function (cond) {\r\n  this._useCase.checked = cond.usecase;\r\n  this._all.checked = cond.all;\r\n  this._conditions = cond.conditions;\r\n  this._drawlist();\r\n};\r\n/** Get the conditions as string\r\n */\r\nol.control.Select.prototype.getConditionsString = function (cond) {\r\n  var st = '';\r\n  for (var i=0,c; c=cond.conditions[i]; i++) {\r\n    if (c.attr) {\r\n      st += (st ? (cond.all ? ' AND ' : ' OR ') : '')\r\n        + c.attr\r\n        + this.operationsList[c.op]\r\n        + c.val;\r\n    }\r\n  }\r\n  return st\r\n};\r\n/** Draw the liste\r\n * @private\r\n */\r\nol.control.Select.prototype._drawlist = function () {\r\n  this._ul.innerHTML = '';\r\n  for (var i=0; i < this._conditions.length; i++) {\r\n    this._ul.appendChild(this._getLiCondition(i));\r\n  }\r\n};\r\n/** Get a line\r\n * @return {*}\r\n * @private\r\n */\r\nol.control.Select.prototype._autocomplete = function (val, ul) {\r\n  ul.classList.remove('ol-hidden');\r\n  ul.innerHTML = '';\r\n  var attributes = {};\r\n  var sources = this.get('source');\r\n  for (var i=0, s; s=sources[i]; i++) {\r\n    var features = s.getFeatures();\r\n    for (var j=0, f; f=features[j]; j++) {\r\n      Object.assign(attributes, f.getProperties());\r\n      if (j>100) break;\r\n    }\r\n  }\r\n  var rex = new RegExp(val, 'i');\r\n  for (var a in attributes) {\r\n    if (a==='geometry') continue;\r\n    if (rex.test(a)) {\r\n      var li = document.createElement('li');\r\n      li.textContent = a;\r\n      li.addEventListener(\"click\", function() {\r\n        ul.previousElementSibling.value = this.textContent;\r\n        var event = document.createEvent('HTMLEvents');\r\n        event.initEvent('change', true, false);\r\n        ul.previousElementSibling.dispatchEvent(event);\r\n        ul.classList.add('ol-hidden');\r\n      });\r\n      ul.appendChild(li);\r\n    }\r\n  }\r\n};\r\n/** Get a line\r\n * @return {*}\r\n * @private\r\n */\r\nol.control.Select.prototype._getLiCondition = function (i) {\r\n  var self = this;\r\n  var li = document.createElement('li');\r\n  // Attribut\r\n  var autocomplete = document.createElement('div');\r\n      autocomplete.classList.add('ol-autocomplete');\r\n      autocomplete.addEventListener(\"mouseleave\", function() {\r\n        this.querySelector('ul'). classList.add('ol-hidden');\r\n      });\r\n      li.appendChild(autocomplete);\r\n  var input_attr = document.createElement('input');\r\n      input_attr.classList.add('ol-attr');\r\n      input_attr.setAttribute('type', 'search');\r\n      input_attr.setAttribute('placeholder', this.get('attrPlaceHolder'));\r\n      input_attr.addEventListener('keyup', function () {\r\n        self._autocomplete( this.value, this.nextElementSibling );\r\n      })\r\n      input_attr.addEventListener('focusout', function() {\r\n        setTimeout(function() {\r\n          autocomplete.querySelector('ul'). classList.add('ol-hidden');\r\n        }, 300);\r\n      });\r\n      input_attr.addEventListener('click', function(){\r\n        setTimeout(function() {\r\n          self._autocomplete( this.value, this.nextElementSibling );\r\n          this.nextElementSibling.classList.remove('ol-hidden');\r\n        }.bind(this));\r\n      })\r\n      input_attr.addEventListener('change', function() {\r\n        self._conditions[i].attr = this.value;\r\n      })\r\n      input_attr.value = self._conditions[i].attr;\r\n      autocomplete.appendChild(input_attr);\r\n  // Autocomplete list\r\n  var ul_autocomplete = document.createElement('ul');\r\n      ul_autocomplete.classList.add('ol-hidden')\r\n      autocomplete.appendChild(ul_autocomplete);\r\n  // Operation\r\n  var select = document.createElement('select');\r\n  li.appendChild(select);\r\n  for (var k in this.operationsList) {\r\n    var option = document.createElement('option');\r\n        option.value = k;\r\n        option.textContent = this.operationsList[k];\r\n        select.appendChild(option);\r\n  }\r\n  select.value = self._conditions[i].op;\r\n  select.addEventListener('change', function() {\r\n    self._conditions[i].op = this.value;\r\n  });\r\n  // Value\r\n  var input_value = document.createElement('input');\r\n  input_value.setAttribute('type', 'text');\r\n      input_value.setAttribute('placeholder', this.get('valuePlaceHolder'));\r\n    input_value.addEventListener('change', function() {\r\n      self._conditions[i].val = this.value;\r\n    })\r\n    input_value.value = self._conditions[i].val;\r\n    li.appendChild(input_value);\r\n  if (this._conditions.length > 1) {\r\n    var div_delete = document.createElement('div');\r\n    div_delete.classList.add('ol-delete');\r\n      div_delete.addEventListener(\"click\", function(){ self.removeCondition(i); })\r\n      li.appendChild(div_delete);\r\n  }\r\n  //\r\n  return li;\r\n};\r\n/** Remove the ith condition\r\n * @param {int} i condition index\r\n */\r\nol.control.Select.prototype.removeCondition = function (i) {\r\n  this._conditions.splice(i,1);\r\n  this._drawlist();\r\n};\r\n/** Select features by attributes\r\n * @param {*} options\r\n *  @param {Array<ol.source.Vector>|undefined} options.sources source to apply rules, default the select sources\r\n *  @param {bool} options.useCase case sensitive, default checkbox state\r\n *  @param {bool} options.matchAll match all conditions, , default checkbox state\r\n *  @param {Array<conditions>} options.conditions array of conditions\r\n * @fires select\r\n */\r\nol.control.Select.prototype.doSelect = function (options) {\r\n  options = options || {};\r\n  options.useCase = options.useCase || this._useCase.checked;\r\n  options.matchAll = options.matchAll || this._all.checked;\r\n  options.conditions = options.conditions || this._conditions\r\n  return ol.control.SelectBase.prototype.doSelect.call(this, options);\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Select features by property using a popup \r\n *\r\n * @constructor\r\n * @extends {ol.control.SelectBase}\r\n * @fires select\r\n * @param {Object=} options\r\n *  @param {string} options.className control class name\r\n *  @param {Element | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {ol/source/Vector | Array<ol/source/Vector>} options.source the source to search in\r\n *  @param {string} options.property property to select on\r\n *  @param {string} options.label control label\r\n *  @param {number} options.max max feature to test to get the values, default 10000\r\n *  @param {number} options.selectAll select all features if no option selected\r\n *  @param {string} options.type check type: checkbox or radio, default checkbox\r\n *  @param {number} options.defaultLabel label for the default radio button\r\n *  @param {function|undefined} options.onchoice function triggered when an option is clicked, default doSelect\r\n */\r\nol.control.SelectCheck = function(options) {\r\n  if (!options) options = {};\r\n  // Container\r\n  var div = options.content = ol.ext.element.create('DIV');\r\n  if (options.label) {\r\n    ol.ext.element.create('LABEL', {\r\n      html: options.label,\r\n      parent: div\r\n    });\r\n  }\r\n  // Input div\r\n  this._input = ol.ext.element.create('DIV', {\r\n    parent: div\r\n  });\r\n  options.className = options.className || 'ol-select-check';\r\n  ol.control.SelectBase.call(this, options);\r\n  this.set('property', options.property || 'name');\r\n  this.set('max', options.max || 10000);\r\n  this.set('defaultLabel', options.defaultLabel);\r\n  this.set('type', options.type);\r\n  this._selectAll = options.selectAll;\r\n  this._onchoice = options.onchoice;\r\n  // Set select options\r\n  if (options.values) {\r\n    this.setValues({ values: options.values, sort: true });\r\n  } else {\r\n    this.setValues();\r\n  }\r\n};\r\nol.ext.inherits(ol.control.SelectCheck, ol.control.SelectBase);\r\n/**\r\n* Set the map instance the control associated with.\r\n* @param {o.Map} map The map instance.\r\n*/\r\nol.control.SelectCheck.prototype.setMap = function(map) {\r\n  ol.control.SelectBase.prototype.setMap.call(this, map);\r\n  this.setValues();\r\n};\r\n/** Select features by attributes\r\n */\r\nol.control.SelectCheck.prototype.doSelect = function(options) {\r\n  console.log('select')\r\n  options = options || {};\r\n  var conditions = [];\r\n  this._checks.forEach(function(c) {\r\n    if (c.checked) {\r\n      if (c.value) {\r\n        conditions.push({\r\n          attr: this.get('property'),\r\n          op: '=',\r\n          val: c.value\r\n        });\r\n      }\r\n    }\r\n  }.bind(this));\r\n  if (!conditions.length) {\r\n    return ol.control.SelectBase.prototype.doSelect.call(this, { \r\n      features: options.features, \r\n      matchAll: this._selectAll \r\n    });\r\n  } else {\r\n    return ol.control.SelectBase.prototype.doSelect.call(this, {\r\n      features: options.features, \r\n      conditions: conditions\r\n    })\r\n  }\r\n};\r\n/** Set the popup values\r\n * @param {Object} options\r\n *  @param {Object} options.values a key/value list with key = property value, value = title shown in the popup, default search values in the sources\r\n *  @param {boolean} options.sort sort values\r\n */\r\nol.control.SelectCheck.prototype.setValues = function(options) {\r\n  options = options || {};\r\n  var values, vals;\r\n  if (options.values) {\r\n    if (options.values instanceof Array) {\r\n      vals = {};\r\n      options.values.forEach(function(v) { vals[v] = v; });\r\n    } else {\r\n      vals = options.values;\r\n    }\r\n  } else {\r\n    vals = {};\r\n    var prop = this.get('property');\r\n    this.getSources().forEach(function(s){\r\n      var features = s.getFeatures();\r\n      var max = Math.min(features.length, this.get('max'))\r\n      for (var i=0; i<max; i++) {\r\n        var p = features[i].get(prop);\r\n        if (p) vals[p] = p;\r\n      }\r\n    }.bind(this));\r\n  }\r\n  if (!Object.keys(vals).length) return;\r\n  if (options.sort) {\r\n    values = {};\r\n    Object.keys(vals).sort().forEach(function(key) {\r\n      values[key] = vals[key];\r\n    });\r\n  } else {\r\n    values = vals;\r\n  }\r\n  ol.ext.element.setHTML(this._input, '');\r\n  this._checks = [];\r\n  var id = 'radio_'+(new Date().getTime());\r\n  var addCheck = function(val, info) {\r\n    this._checks.push( ol.ext.element.createCheck({\r\n      after: info,\r\n      name: id,\r\n      val: val,\r\n      type: this.get('type'),\r\n      change: function () { \r\n        if (this._onchoice) this._onchoice()\r\n        else this.doSelect();\r\n      }.bind(this),\r\n      parent: this._input\r\n    }));\r\n  }.bind(this);\r\n  if (this.get('defaultLabel') && this.get('type')==='radio') {\r\n    addCheck('', this.get('defaultLabel'));\r\n  }\r\n  for (var k in values) addCheck(k, values[k]);\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Select features by property using a condition \r\n *\r\n * @constructor\r\n * @extends {ol.control.SelectBase}\r\n * @fires select\r\n * @param {Object=} options\r\n *  @param {string} options.className control class name\r\n *  @param {Element | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {ol/source/Vector | Array<ol/source/Vector>} options.source the source to search in\r\n *  @param {string} options.label control label, default 'condition'\r\n *  @param {number} options.selectAll select all features if no option selected\r\n *  @param {condition|Array<condition>} options.condition conditions \r\n *  @param {function|undefined} options.onchoice function triggered when an option is clicked, default doSelect\r\n */\r\nol.control.SelectCondition = function(options) {\r\n  if (!options) options = {};\r\n  // Container\r\n  var div = options.content = ol.ext.element.create('DIV');\r\n  this._check = ol.ext.element.createSwitch({\r\n    after: options.label || 'condition',\r\n    change: function () { \r\n      if (this._onchoice) this._onchoice()\r\n      else this.doSelect();\r\n    }.bind(this),\r\n    parent: div\r\n  })\r\n  // Input div\r\n  this._input = ol.ext.element.create('DIV', {\r\n    parent: div\r\n  });\r\n  options.className = options.className || 'ol-select-condition';\r\n  ol.control.SelectBase.call(this, options);\r\n  this.setCondition(options.condition);\r\n  this._selectAll = options.selectAll;\r\n  this._onchoice = options.onchoice;\r\n};\r\nol.ext.inherits(ol.control.SelectCondition, ol.control.SelectBase);\r\n/** Set condition to select on\r\n * @param {condition | Array<condition>} condition\r\n *  @param {string} attr property to select on\r\n *  @param {string} op operator (=, !=, <; <=, >, >=, contain, !contain, regecp)\r\n *  @param {*} val value to select on\r\n */\r\nol.control.SelectCondition.prototype.setCondition = function(condition) {\r\n  if (!condition) this._conditions = [];\r\n  else this._conditions = (condition instanceof Array ?  condition : [condition]);\r\n};\r\n/** Add a condition to select on\r\n * @param {condition} condition\r\n *  @param {string} attr property to select on\r\n *  @param {string} op operator (=, !=, <; <=, >, >=, contain, !contain, regecp)\r\n *  @param {*} val value to select on\r\n */\r\nol.control.SelectCondition.prototype.addCondition = function(condition) {\r\n  this._conditions.push(condition);\r\n};\r\n/** Select features by condition\r\n */\r\nol.control.SelectCondition.prototype.doSelect = function(options) {\r\n  options = options || {};\r\n  var conditions = this._conditions;\r\n  if (!this._check.checked) {\r\n    return ol.control.SelectBase.prototype.doSelect.call(this, { features: options.features, matchAll: this._selectAll });\r\n  } else {\r\n    return ol.control.SelectBase.prototype.doSelect.call(this, {\r\n      features: options.features,\r\n      conditions: conditions\r\n    })\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Select features by property using a simple text input\r\n *\r\n * @constructor\r\n * @extends {ol.control.SelectBase}\r\n * @fires select\r\n * @param {Object=} options\r\n *  @param {string} options.className control class name\r\n *  @param {Element | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {ol/source/Vector | Array<ol/source/Vector>} options.source the source to search in\r\n *  @param {string} options.property property to select on\r\n *  @param {function|undefined} options.onchoice function triggered the text change, default nothing\r\n */\r\nol.control.SelectFulltext = function(options) {\r\n  if (!options) options = {};\r\n  // Container\r\n  var div = options.content =ol.ext.element.create('DIV');\r\n  if (options.label) {\r\n    ol.ext.element.create('LABEL', {\r\n      html: options.label,\r\n      parent: div\r\n    });\r\n  }\r\n  this._input = ol.ext.element.create('INPUT', {\r\n    placeHolder: options.placeHolder || 'search...',\r\n    change: function() {\r\n      if (this._onchoice) this._onchoice();\r\n    }.bind(this),\r\n    parent: div\r\n  });\r\n  ol.control.SelectBase.call(this, options);\r\n  this._onchoice = options.onchoice;\r\n  this.set('property', options.property || 'name');\r\n};\r\nol.ext.inherits(ol.control.SelectFulltext, ol.control.SelectBase);\r\n/** Select features by condition\r\n */\r\nol.control.SelectFulltext.prototype.doSelect= function(options) {\r\n  options = options || {};\r\n  return ol.control.SelectBase.prototype.doSelect.call(this, {\r\n    features: options.features,\r\n    useCase: false,\r\n    conditions: [{\r\n      attr: this.get('property'),\r\n      op: 'contain',\r\n      val: this._input.value\r\n    }]\r\n  });\r\n}\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * A multiselect control. \r\n * A container that manage other control Select \r\n *\r\n * @constructor\r\n * @extends {ol.control.SelectBase}\r\n * @fires select\r\n * @param {Object=} options\r\n *  @param {string} options.className control class name\r\n *  @param {Element | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {ol/source/Vector | Array<ol/source/Vector>} options.source the source to search in\r\n *  @param {Array<ol.control.SelectBase>} options.controls an array of controls\r\n */\r\nol.control.SelectMulti = function(options) {\r\n  if (!options) options = {};\r\n  // Container\r\n  options.content = ol.ext.element.create('DIV');\r\n  this._container = ol.ext.element.create('UL', {\r\n    parent: options.content\r\n  });\r\n  options.className = options.className || 'ol-select-multi';\r\n  ol.control.SelectBase.call(this, options);\r\n  this._controls = [];\r\n  options.controls.forEach(this.addControl.bind(this));\r\n};\r\nol.ext.inherits(ol.control.SelectMulti, ol.control.SelectBase);\r\n/**\r\n* Set the map instance the control associated with.\r\n* @param {o.Map} map The map instance.\r\n*/\r\nol.control.SelectMulti.prototype.setMap = function(map) {\r\n  if (this.getMap()) {\r\n    this._controls.forEach(function(c) {\r\n      this.getMap().remveControl(c);\r\n    }.bind(this));\r\n  }\r\n  ol.control.SelectBase.prototype.setMap.call(this, map);\r\n  if (this.getMap()) {\r\n    this._controls.forEach(function(c) {\r\n      this.getMap().addControl(c);\r\n    }.bind(this));\r\n  }\r\n};\r\n/** Add a new control\r\n * @param {ol.control.SelectBase} c\r\n */\r\nol.control.SelectMulti.prototype.addControl = function(c) {\r\n  if (c instanceof ol.control.SelectBase) {\r\n    this._controls.push(c);\r\n    c.setTarget(ol.ext.element.create('LI', {\r\n      parent: this._container\r\n    }));\r\n    c._selectAll = true;\r\n    c._onchoice = this.doSelect.bind(this);\r\n    if (this.getMap()) {\r\n      this.getMap().addControl(c);\r\n    }\r\n  }\r\n};\r\n/** Get select controls\r\n * @return {Aray<ol.control.SelectBase>}\r\n */\r\nol.control.SelectMulti.prototype.getControls = function() {\r\n  return this._controls;\r\n};\r\n/** Select features by condition\r\n */\r\nol.control.SelectMulti.prototype.doSelect = function() {\r\n  var features = [];\r\n  this.getSources().forEach(function(s) {\r\n    features = features.concat(s.getFeatures());\r\n  });\r\n  this._controls.forEach(function(c) {\r\n    features = c.doSelect({ features: features });\r\n  });\r\n  this.dispatchEvent({ type:\"select\", features: features });\r\n  return features;\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Select features by property using a popup \r\n *\r\n * @constructor\r\n * @extends {ol.control.SelectBase}\r\n * @fires select\r\n * @param {Object=} options\r\n *  @param {string} options.className control class name\r\n *  @param {Element | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.\r\n *  @param {ol/source/Vector | Array<ol/source/Vector>} options.source the source to search in\r\n *  @param {string} options.property property to select on\r\n *  @param {number} options.max max feature to test to get the values, default 10000\r\n *  @param {number} options.selectAll select all features if no option selected\r\n *  @param {string} options.defaultLabel label for the default selection\r\n *  @param {function|undefined} options.onchoice function triggered when an option is clicked, default doSelect\r\n */\r\nol.control.SelectPopup = function(options) {\r\n  if (!options) options = {};\r\n  // Container\r\n  var div = options.content = ol.ext.element.create('DIV');\r\n  if (options.label) {\r\n    ol.ext.element.create('LABEL', {\r\n      html: options.label,\r\n      parent: div\r\n    });\r\n  }\r\n  this._input = ol.ext.element.create('SELECT', {\r\n    on: { change: function () { \r\n      if (this._onchoice) this._onchoice();\r\n      else this.doSelect();\r\n    }.bind(this) },\r\n    parent: div\r\n  });\r\n  options.className = options.className || 'ol-select-popup';\r\n  ol.control.SelectBase.call(this, options);\r\n  this.set('property', options.property || 'name');\r\n  this.set('max', options.max || 10000);\r\n  this.set('defaultLabel', options.defaultLabel);\r\n  this._selectAll = options.selectAll;\r\n  this._onchoice = options.onchoice;\r\n  // Set select options\r\n  this.setValues();\r\n};\r\nol.ext.inherits(ol.control.SelectPopup, ol.control.SelectBase);\r\n/**\r\n* Set the map instance the control associated with.\r\n* @param {o.Map} map The map instance.\r\n*/\r\nol.control.SelectPopup.prototype.setMap = function(map) {\r\n  ol.control.SelectBase.prototype.setMap.call(this, map);\r\n  this.setValues();\r\n};\r\n/** Select features by attributes\r\n */\r\nol.control.SelectPopup.prototype.doSelect = function(options) {\r\n  options = options || {};\r\n  if (!this._input.value) {\r\n    return ol.control.SelectBase.prototype.doSelect.call(this, { features: options.features, matchAll: this._selectAll });\r\n  } else {\r\n    return ol.control.SelectBase.prototype.doSelect.call(this, {\r\n      features: options.features, \r\n      conditions: [{\r\n        attr: this.get('property'),\r\n        op: '=',\r\n        val: this._input.value\r\n      }]\r\n    })\r\n  }\r\n};\r\n/** Set the popup values\r\n * @param {Object} values a key/value list with key = property value, value = title shown in the popup, default search values in the sources\r\n */\r\nol.control.SelectPopup.prototype.setValues = function(options) {\r\n  options = options || {};\r\n  var values, vals;\r\n  if (options.values) {\r\n    if (options.values instanceof Array) {\r\n      vals = {};\r\n      options.values.forEach(function(v) { vals[v] = v; });\r\n    } else {\r\n      vals = options.values;\r\n    }\r\n  } else {\r\n    vals = {};\r\n    var prop = this.get('property');\r\n    this.getSources().forEach(function(s){\r\n      var features = s.getFeatures();\r\n      var max = Math.min(features.length, this.get('max'))\r\n      for (var i=0; i<max; i++) {\r\n        var p = features[i].get(prop);\r\n        if (p) vals[p] = p;\r\n      }\r\n    }.bind(this));\r\n  }\r\n  if (options.sort) {\r\n    values = {};\r\n    Object.keys(vals).sort().forEach(function(key) {\r\n      values[key] = vals[key];\r\n    });\r\n  } else {\r\n    values = vals;\r\n  }\r\n  ol.ext.element.setHTML(this._input, '');\r\n  ol.ext.element.create('OPTION', {\r\n    className: 'ol-default',\r\n    html: this.get('defaultLabel') || '',\r\n    value: '',\r\n    parent: this._input\r\n  });\r\n  for (var k in values) {\r\n    ol.ext.element.create('OPTION', {\r\n      html: values[k],\r\n      value: k,\r\n      parent: this._input\r\n    });\r\n  }\r\n};\r\n\r\n/** A control with scroll-driven navigation to create narrative maps\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n *\t@param {String} options.className class of the control\r\n *  @param {string} options.status status, default none\r\n *  @param {string} options.position position of the status 'top', 'left', 'bottom' or 'right', default top\r\n *  @param {boolean} options.visible default true\r\n */\r\nol.control.Status = function(options) {\r\n  options = options || {};\r\n  // New element\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: (options.className || '') + ' ol-status'\r\n      + (options.target ? '': ' ol-unselectable ol-control')\r\n  });\r\n  // Initialize\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.setVisible(options.visible!==false);\r\n  if (options.position) this.setPosition(options.position);\r\n  this.status(options.status || '');\r\n};\r\nol.ext.inherits(ol.control.Status, ol.control.Control);\r\n/** Set visiblitity \r\n * @param {boolean} visible\r\n */\r\nol.control.Status.prototype.setVisible = function(visible) {\r\n  if (visible) this.element.classList.add ('ol-visible');\r\n  else this.element.classList.remove('ol-visible');\r\n};\r\n/** Show status on the map\r\n * @param {string|Element} html status text or DOM element\r\n */\r\nol.control.Status.prototype.status = function(html) {\r\n  var s = html || '';\r\n  if (s) {\r\n    ol.ext.element.show(this.element);\r\n    if (s instanceof Element || typeof(s) === 'string') {\r\n      ol.ext.element.setHTML(this.element, s)\r\n    } else {\r\n      s = '';\r\n      for (var i in html) {\r\n        s += '<label>'+i+':</label> '+html[i]+'<br/>';\r\n      }\r\n    }\r\n    ol.ext.element.setHTML(this.element, s);\r\n  } else {\r\n    ol.ext.element.hide(this.element);\r\n  }\r\n};\r\n/** Set status position\r\n * @param {string} position position of the status 'top', 'left', 'bottom' or 'right', default top\r\n */\r\nol.control.Status.prototype.setPosition = function(position) {\r\n  this.element.classList.remove('ol-left');\r\n  this.element.classList.remove('ol-right');\r\n  this.element.classList.remove('ol-bottom');\r\n  this.element.classList.remove('ol-center');\r\n  if (/^left$|^right$|^bottom$|^center$/.test(position)) {\r\n    this.element.classList.add('ol-'+position);\r\n  }\r\n};\r\n/** Show the status\r\n * @param {boolean} show show or hide the control, default true\r\n */\r\nol.control.Status.prototype.show = function(show) {\r\n  if (show===false) ol.ext.element.hide(this.element);\r\n  else ol.ext.element.show(this.element);\r\n};\r\n/** Hide the status\r\n */\r\nol.control.Status.prototype.hide = function() {\r\n  ol.ext.element.hide(this.element);\r\n};\r\n/** Toggle the status\r\n */\r\nol.control.Status.prototype.toggle = function() {\r\n  ol.ext.element.toggle(this.element);\r\n};\r\n/** Is status visible\r\n */\r\nol.control.Status.prototype.isShown = function() {\r\n  return this.element.style.display==='none';\r\n};\r\n\r\n// Add flyTo\r\n/** A control with scroll-driven navigation to create narrative maps\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fires scrollto\r\n * @fires clickimage\r\n * @param {Object=} options Control options.\r\n *\t@param {String} options.className class of the control\r\n *\t@param {Element | string | undefined} [options.html] The storymap content\r\n *\t@param {Element | string | undefined} [options.target] The target element to place the story. If no html is provided the content of the target will be used.\r\n *\t@param {boolean} [options.minibar=false] add a mini scroll bar\r\n */\r\nol.control.Storymap = function(options) {\r\n  // Remove or get target content \r\n  if (options.target) {\r\n    if (!options.html) {\r\n      options.html = options.target.innerHTML;\r\n    } else if (options.html instanceof Element) {\r\n      options.html = options.html.innerHTML;\r\n    }\r\n    options.target.innerHTML = '';\r\n  }\r\n  // New element\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: (options.className || '') + ' ol-storymap'\r\n      + (options.target ? '': ' ol-unselectable ol-control'),\r\n  });\r\n  this.content = ol.ext.element.create('DIV', {\r\n    parent: element\r\n  });\r\n  // Initialize\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  // Make a scroll div\r\n  ol.ext.element.scrollDiv (this.content, {\r\n    vertical: true,\r\n    mousewheel: true,\r\n    minibar: options.minibar\r\n  });\r\n  this.setStory(options.html);\r\n};\r\nol.ext.inherits(ol.control.Storymap, ol.control.Control);\r\n/** Scroll to a chapter\r\n * @param {string} name Name of the chapter to scroll to\r\n */\r\nol.control.Storymap.prototype.setChapter = function (name) {\r\n  var chapter = this.content.querySelectorAll('.chapter');\r\n  for (var i=0, s; s=chapter[i]; i++) {\r\n    if (s.getAttribute('name')===name) {\r\n      this.content.scrollTop = s.offsetTop - 30;\r\n    }\r\n  }\r\n};\r\n/** Scroll to a chapter\r\n * @param {string} name Name of the chapter to scroll to\r\n */\r\nol.control.Storymap.prototype.setStory = function (html) {\r\n  if (html instanceof Element) {\r\n    this.content.innerHTML = '';\r\n    this.content.appendChild(html);\r\n  } else {\r\n    this.content.innerHTML = html;\r\n  }\r\n  this.content.querySelectorAll('.chapter').forEach(function(c) {\r\n    c.addEventListener('click', function(e) {\r\n      if (!c.classList.contains('ol-select')) {\r\n        this.content.scrollTop = c.offsetTop - 30;\r\n        e.preventDefault();\r\n      } else {\r\n        if (e.target.tagName==='IMG' && e.target.dataset.title) {\r\n          this.dispatchEvent({ \r\n            coordinate: this.getMap() ? this.getMap().getCoordinateFromPixel([e.layerX,e.layerY]) : null,\r\n            type: 'clickimage', \r\n            img: e.target, \r\n            title: e.target.dataset.title, \r\n            element: c, \r\n            name: c.getAttribute('name'),\r\n            originalEvent: e\r\n          });\r\n        }\r\n      }\r\n    }.bind(this));\r\n  }.bind(this));\r\n  // Scroll to the next chapter\r\n  var sc = this.content.querySelectorAll('.ol-scroll-next');\r\n  sc.forEach(function(s) {\r\n    s.addEventListener('click', function(e) { \r\n      if (s.parentElement.classList.contains('ol-select')) {\r\n        var chapter = this.content.querySelectorAll('.chapter');\r\n        var scrollto = s.offsetTop;\r\n        for (var i=0, c; c=chapter[i]; i++) {\r\n          if (c.offsetTop > scrollto) {\r\n            scrollto = c.offsetTop;\r\n            break;\r\n          }\r\n        }\r\n        this.content.scrollTop = scrollto - 30;\r\n        e.stopPropagation();\r\n        e.preventDefault();\r\n      }\r\n    }.bind(this));\r\n  }.bind(this));\r\n  // Scroll top \r\n  sc = this.content.querySelectorAll('.ol-scroll-top');\r\n  sc.forEach(function(i) {\r\n    i.addEventListener('click', function(e){ \r\n      this.content.scrollTop = 0;\r\n      e.stopPropagation();\r\n      e.preventDefault();\r\n    }.bind(this));\r\n  }.bind(this));\r\n  var getEvent = function(currentDiv) {\r\n    var lonlat = [ parseFloat(currentDiv.getAttribute('data-lon')),\r\n      parseFloat(currentDiv.getAttribute('data-lat'))];\r\n    var coord = ol.proj.fromLonLat(lonlat, this.getMap().getView().getProjection());\r\n    var zoom = parseFloat(currentDiv.getAttribute('data-zoom'));\r\n    return { \r\n      type: 'scrollto', \r\n      element: currentDiv, \r\n      name: currentDiv.getAttribute('name'),\r\n      coordinate: coord,\r\n      lon: lonlat,\r\n      zoom: zoom\r\n    };\r\n  }.bind(this);\r\n  // Handle scrolling\r\n  var currentDiv = this.content.querySelectorAll('.chapter')[0];\r\n  setTimeout (function (){\r\n    currentDiv.classList.add('ol-select');\r\n    this.dispatchEvent(getEvent(currentDiv));\r\n  }.bind(this));\r\n  // Trigger change event on scroll\r\n  this.content.addEventListener('scroll', function() {\r\n    var current, chapter = this.content.querySelectorAll('.chapter');\r\n    var height = ol.ext.element.getStyle(this.content, 'height');\r\n    if (!this.content.scrollTop) {\r\n      current = chapter[0];\r\n    } else {\r\n      for (var i=0, s; s=chapter[i]; i++) {\r\n        var p = s.offsetTop - this.content.scrollTop;\r\n        if (p > height/3) break;\r\n        current = s;\r\n      }\r\n    }\r\n    if (current && current!==currentDiv) {\r\n      if (currentDiv) currentDiv.classList.remove('ol-select');\r\n      currentDiv = current;\r\n      currentDiv.classList.add('ol-select');\r\n      var e = getEvent(currentDiv);\r\n      var view = this.getMap().getView();\r\n      view.cancelAnimations();\r\n      switch (currentDiv.getAttribute('data-animation')) {\r\n        case 'flyto': {\r\n          view.flyTo({\r\n            center: e.coordinate,\r\n            zoomAt: Math.min(view.getZoom(), e.zoom)-1,\r\n            zoom: e.zoom\r\n          });\r\n          break;\r\n        }\r\n        default: break;\r\n      }\r\n      this.dispatchEvent(e);\r\n    }\r\n  }.bind(this));\r\n};\r\n\r\n/*\r\n  Copyright (c) 2015 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc Swipe Control.\r\n * @fires moving\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @param {Object=} Control options.\r\n *  @param {ol.layer} options.layers layer to swipe\r\n *  @param {ol.layer} options.rightLayer layer to swipe on right side\r\n *  @param {string} options.className control class name\r\n *  @param {number} options.position position propertie of the swipe [0,1], default 0.5\r\n *  @param {string} options.orientation orientation propertie (vertical|horizontal), default vertical\r\n */\r\nol.control.Swipe = function(options) {\r\n  options = options || {};\r\n  var button = document.createElement('button');\r\n  var element = document.createElement('div');\r\n  element.className = (options.className || \"ol-swipe\") + \" ol-unselectable ol-control\";\r\n  element.appendChild(button);\r\n  element.addEventListener(\"mousedown\", this.move.bind(this));\r\n  element.addEventListener(\"touchstart\", this.move.bind(this));\r\n  ol.control.Control.call(this, {\r\n    element: element\r\n  });\r\n  // An array of listener on layer postcompose\r\n  this.precomposeRight_ = this.precomposeRight.bind(this);\r\n  this.precomposeLeft_ = this.precomposeLeft.bind(this);\r\n  this.postcompose_ = this.postcompose.bind(this);\r\n  this.layers = [];\r\n  if (options.layers) this.addLayer(options.layers, false);\r\n  if (options.rightLayers) this.addLayer(options.rightLayers, true);\r\n  this.on('propertychange', function() {\r\n    if (this.getMap()) {\r\n      try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n    }\r\n    if (this.get('orientation') === \"horizontal\") {\r\n      this.element.style.top = this.get('position')*100+\"%\";\r\n      this.element.style.left = \"\";\r\n    } else {\r\n      if (this.get('orientation') !== \"vertical\") this.set('orientation', \"vertical\");\r\n      this.element.style.left = this.get('position')*100+\"%\";\r\n      this.element.style.top = \"\";\r\n    }\r\n    this.element.classList.remove(\"horizontal\", \"vertical\");\r\n    this.element.classList.add(this.get('orientation'));\r\n  }.bind(this));\r\n  this.set('position', options.position || 0.5);\r\n  this.set('orientation', options.orientation || 'vertical');\r\n};\r\nol.ext.inherits(ol.control.Swipe, ol.control.Control);\r\n/**\r\n * Set the map instance the control associated with.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.control.Swipe.prototype.setMap = function(map) {\r\n  var i;\r\n  var l;\r\n  if (this.getMap()) {\r\n    for (i=0; i<this.layers.length; i++) {\r\n      l = this.layers[i];\r\n      if (l.right) l.layer.un(['precompose','prerender'], this.precomposeRight_);\r\n      else l.layer.un(['precompose','prerender'], this.precomposeLeft_);\r\n      l.layer.un(['postcompose','postrender'], this.postcompose_);\r\n    }\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  if (map) {\r\n    this._listener = [];\r\n    for (i=0; i<this.layers.length; i++) {\r\n      l = this.layers[i];\r\n      if (l.right) l.layer.on(['precompose','prerender'], this.precomposeRight_);\r\n      else l.layer.on(['precompose','prerender'], this.precomposeLeft_);\r\n      l.layer.on(['postcompose','postrender'], this.postcompose_);\r\n    }\r\n    try { map.renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** @private\r\n*/\r\nol.control.Swipe.prototype.isLayer_ = function(layer){\r\n  for (var k=0; k<this.layers.length; k++) {\r\n    if (this.layers[k].layer === layer) return k;\r\n  }\r\n  return -1;\r\n};\r\n/** Add a layer to clip\r\n *\t@param {ol.layer|Array<ol.layer>} layer to clip\r\n*\t@param {bool} add layer in the right part of the map, default left.\r\n*/\r\nol.control.Swipe.prototype.addLayer = function(layers, right) {\r\n  if (!(layers instanceof Array)) layers = [layers];\r\n  for (var i=0; i<layers.length; i++) {\r\n    var l = layers[i];\r\n    if (this.isLayer_(l) < 0) {\r\n      this.layers.push({ layer:l, right:right });\r\n      if (this.getMap()) {\r\n        if (right) l.on(['precompose','prerender'], this.precomposeRight_);\r\n        else l.on(['precompose','prerender'], this.precomposeLeft_);\r\n        l.on(['postcompose','postrender'], this.postcompose_);\r\n        try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n      }\r\n    }\r\n  }\r\n};\r\n/** Remove all layers\r\n */\r\nol.control.Swipe.prototype.removeLayers = function() {\r\n  var layers = [];\r\n  this.layers.forEach(function(l) { layers.push(l.layer); });\r\n  this.removeLayer(layers)\r\n};\r\n/** Remove a layer to clip\r\n *\t@param {ol.layer|Array<ol.layer>} layer to clip\r\n*/\r\nol.control.Swipe.prototype.removeLayer = function(layers) {\r\n  if (!(layers instanceof Array)) layers = [layers];\r\n  for (var i=0; i<layers.length; i++) {\r\n    var k = this.isLayer_(layers[i]);\r\n    if (k >=0 && this.getMap()) {\r\n      if (this.layers[k].right) layers[i].un(['precompose','prerender'], this.precomposeRight_);\r\n      else layers[i].un(['precompose','prerender'], this.precomposeLeft_);\r\n      layers[i].un(['postcompose','postrender'], this.postcompose_);\r\n      this.layers.splice(k,1);\r\n    }\r\n  }\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** Get visible rectangle\r\n * @returns {ol.extent}\r\n */\r\nol.control.Swipe.prototype.getRectangle = function() {\r\n  var s;\r\n  if (this.get('orientation') === 'vertical') {\r\n    s = this.getMap().getSize();\r\n    return [ 0, 0, s[0]*this.get('position'), s[1]];\r\n  } else {\r\n    s = this.getMap().getSize();\r\n    return [ 0, 0, s[0], s[1]*this.get('position')];\r\n  }\r\n};\r\n/** @private\r\n*/\r\nol.control.Swipe.prototype.move = function(e) {\r\n  var self = this;\r\n  var l;\r\n  switch (e.type) {\r\n    case 'touchcancel':\r\n    case 'touchend':\r\n    case 'mouseup': {\r\n      self.isMoving = false;\r\n      [\"mouseup\", \"mousemove\", \"touchend\", \"touchcancel\", \"touchmove\"]\r\n        .forEach(function(eventName) {\r\n          document.removeEventListener(eventName, self.move);\r\n        });\r\n      break;\r\n    }\r\n    case 'mousedown':\r\n    case 'touchstart': {\r\n      self.isMoving = true;\r\n      [\"mouseup\", \"mousemove\", \"touchend\", \"touchcancel\", \"touchmove\"]\r\n        .forEach(function(eventName) {\r\n          document.addEventListener(eventName, self.move.bind(self));\r\n        });\r\n    }\r\n    // fallthrough\r\n    case 'mousemove':\r\n    case 'touchmove': {\r\n      if (self.isMoving) {\r\n        if (self.get('orientation') === 'vertical') {\r\n          var pageX = e.pageX\r\n            || (e.touches && e.touches.length && e.touches[0].pageX)\r\n            || (e.changedTouches && e.changedTouches.length && e.changedTouches[0].pageX);\r\n          if (!pageX) break;\r\n          pageX -= self.getMap().getTargetElement().getBoundingClientRect().left +\r\n            window.pageXOffset - document.documentElement.clientLeft;\r\n          l = self.getMap().getSize()[0];\r\n          var w = l - Math.min(Math.max(0, l-pageX), l);\r\n          l = w/l;\r\n          self.set('position', l);\r\n          self.dispatchEvent({ type: 'moving', size: [w, self.getMap().getSize()[1]], position: [l,0] });\r\n        } else {\r\n          var pageY = e.pageY\r\n            || (e.touches && e.touches.length && e.touches[0].pageY)\r\n            || (e.changedTouches && e.changedTouches.length && e.changedTouches[0].pageY);\r\n          if (!pageY) break;\r\n          pageY -= self.getMap().getTargetElement().getBoundingClientRect().top +\r\n            window.pageYOffset - document.documentElement.clientTop;\r\n          l = self.getMap().getSize()[1];\r\n          var h = l - Math.min(Math.max(0, l-pageY), l);\r\n          l = h/l;\r\n          self.set('position', l);\r\n          self.dispatchEvent({ type: 'moving', size: [self.getMap().getSize()[0],h], position: [0,l] });\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    default: break;\r\n  }\r\n};\r\n/** @private\r\n */\r\nol.control.Swipe.prototype._drawRect = function(e, pts) {\r\n  var tr = e.inversePixelTransform;\r\n  if (tr) {\r\n    var r = [\r\n      [pts[0][0], pts[0][1]],\r\n      [pts[0][0], pts[1][1]],\r\n      [pts[1][0], pts[1][1]],\r\n      [pts[1][0], pts[0][1]],\r\n      [pts[0][0], pts[0][1]]\r\n    ];\r\n    r.forEach(function (pt, i) {\r\n      pt = [\r\n        (pt[0]*tr[0] - pt[1]*tr[1] + tr[4]),\r\n        (-pt[0]*tr[2] + pt[1]*tr[3] + tr[5])\r\n      ];\r\n      if (!i) {\r\n        e.context.moveTo(pt[0], pt[1]);\r\n      } else {\r\n        e.context.lineTo(pt[0], pt[1]);\r\n      }\r\n    });\r\n  } else {\r\n    var ratio = e.frameState.pixelRatio;\r\n    e.context.rect(pts[0][0]*ratio,pts[0][1]*ratio,pts[1][0]*ratio,pts[1][1]*ratio);\r\n  }\r\n};\r\n/** @private\r\n*/\r\nol.control.Swipe.prototype.precomposeLeft = function(e) {\r\n  var ctx = e.context;\r\n  var size = e.frameState.size;\r\n  ctx.save();\r\n  ctx.beginPath();\r\n  var pts = [[0,0],[size[0],size[1]]];\r\n  if (this.get('orientation') === \"vertical\") {\r\n    pts[1] = [\r\n      size[0]*this.get('position'), \r\n      size[1]\r\n    ];\r\n  } else {\r\n    pts[1] = [\r\n      size[0],\r\n      size[1]*this.get('position')\r\n    ];\r\n  }\r\n  this._drawRect(e, pts);\r\n  ctx.clip();\r\n};\r\n/** @private\r\n*/\r\nol.control.Swipe.prototype.precomposeRight = function(e) {\r\n  var ctx = e.context;\r\n  var size = e.frameState.size;\r\n  ctx.save();\r\n  ctx.beginPath();\r\n  var pts = [[0,0],[size[0],size[1]]];\r\n  if (this.get('orientation') === \"vertical\") {\r\n    pts[0] = [\r\n      size[0]*this.get('position'), \r\n      0\r\n    ];\r\n  } else {\r\n    pts[0] = [\r\n      0,\r\n      size[1]*this.get('position')\r\n    ]\r\n  }\r\n  this._drawRect(e, pts);\r\n  ctx.clip();\r\n};\r\n/** @private\r\n*/\r\nol.control.Swipe.prototype.postcompose = function(e) {\r\n  // restore context when decluttering is done (ol>=6)\r\n  // https://github.com/openlayers/openlayers/issues/10096\r\n  if (e.target.getClassName && e.target.getClassName()!=='ol-layer' && e.target.get('declutter')) {\r\n    setTimeout(function () {\r\n      e.context.restore();\r\n    }, 0);\r\n  } else {\r\n    e.context.restore();\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** ol.control.Target draw a target at the center of the map.\r\n * @constructor\r\n * @extends {ol.control.CanvasBase}\r\n * @param {Object} options\r\n *  @param {ol.style.Style|Array<ol.style.Style>} options.style\r\n *  @param {string} options.composite composite operation = difference|multiply|xor|screen|overlay|darken|lighter|lighten|...\r\n */\r\nol.control.Target = function(options) {\r\n  options = options || {};\r\n\tthis.style = options.style || [\r\n    new ol.style.Style({ image: new ol.style.RegularShape ({ points: 4, radius: 11, radius1: 0, radius2: 0, snapToPixel:true, stroke: new ol.style.Stroke({ color: \"#fff\", width:3 }) }) }),\r\n    new ol.style.Style({ image: new ol.style.RegularShape ({ points: 4, radius: 11, radius1: 0, radius2: 0, snapToPixel:true, stroke: new ol.style.Stroke({ color: \"#000\", width:1 }) }) })\r\n  ];\r\n\tif (!(this.style instanceof Array)) this.style = [this.style];\r\n\tthis.composite = options.composite || '';\r\n\tvar div = document.createElement('div');\r\n\tdiv.className = \"ol-target ol-unselectable ol-control\";\r\n\tol.control.CanvasBase.call(this, {\r\n    element: div,\r\n\t\ttarget: options.target\r\n\t});\r\n\tthis.setVisible(options.visible!==false);\r\n};\r\nol.ext.inherits(ol.control.Target, ol.control.CanvasBase);\r\n/** Set the control visibility\r\n * @paraam {boolean} b \r\n */\r\nol.control.Target.prototype.setVisible = function (b) {\r\n  this.set(\"visible\",b);\r\n\tif (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** Get the control visibility\r\n * @return {boolean} b \r\n */\r\nol.control.Target.prototype.getVisible = function () {\r\n  return this.get(\"visible\");\r\n};\r\n/** Draw the target\r\n * @private\r\n */\r\nol.control.Target.prototype._draw = function (e) {\r\n  var ctx = this.getContext(e);\r\n  if (!ctx || !this.getMap() || !this.getVisible()) return;\r\n\tvar ratio = e.frameState.pixelRatio;\r\n\tctx.save();\r\n\t\tctx.scale(ratio,ratio);\r\n\t\tvar cx = ctx.canvas.width/(2*ratio);\r\n\t\tvar cy = ctx.canvas.height/(2*ratio);\r\n\t\tvar geom = new ol.geom.Point (this.getMap().getCoordinateFromPixel([cx,cy]));\r\n\t\tif (this.composite) ctx.globalCompositeOperation = this.composite;\r\n    for (var i=0; i<this.style.length; i++) {\r\n      var style = this.style[i];\r\n      if (style instanceof ol.style.Style) {\r\n        var vectorContext = e.vectorContext;\r\n        if (!vectorContext) {\r\n          var event = {\r\n            inversePixelTransform: [ratio,0,0,ratio,0,0],\r\n            context: ctx,\r\n            frameState: {\r\n              pixelRatio: ratio,\r\n              extent: e.frameState.extent,\r\n              coordinateToPixelTransform: e.frameState.coordinateToPixelTransform,\r\n              viewState: e.frameState.viewState\r\n            }\r\n          }\r\n          vectorContext = ol.render.getVectorContext(event);\r\n        } \r\n        vectorContext.setStyle(style);\r\n        vectorContext.drawGeometry(geom);\r\n      }\r\n    }\r\n\tctx.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO,\r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A simple push button control drawn as text\r\n * @constructor\r\n * @extends {ol.control.Button}\r\n * @param {Object=} options Control options.\r\n *\t@param {String} options.className class of the control\r\n *\t@param {String} options.title title of the control\r\n *\t@param {String} options.html html to insert in the control\r\n *\t@param {function} options.handleClick callback when control is clicked (or use change:active event)\r\n */\r\nol.control.TextButton = function(options)\r\n{\toptions = options || {};\r\n    options.className = (options.className||\"\") + \" ol-text-button\";\r\n    ol.control.Button.call(this, options);\r\n};\r\nol.ext.inherits(ol.control.TextButton, ol.control.Button);\r\n\r\n/*eslint no-constant-condition: [\"error\", { \"checkLoops\": false }]*/\r\n/** Timeline control\r\n *\r\n * @constructor\r\n * @extends {ol.control.Control}\r\n * @fires select\r\n * @fires scroll\r\n * @fires collapse\r\n * @param {Object=} options Control options.\r\n *\t@param {String} options.className class of the control\r\n *\t@param {Array<ol.Feature>} options.features Features to show in the timeline\r\n *\t@param {ol.SourceImageOptions.vector} options.source class of the control\r\n *\t@param {Number} options.interval time interval length in ms or a text with a format d, h, mn, s (31 days = '31d'), default none\r\n *\t@param {String} options.maxWidth width of the time line in px, default 2000px\r\n *\t@param {String} options.minDate minimum date \r\n *\t@param {String} options.maxDate maximum date \r\n *\t@param {Number} options.minZoom Minimum zoom for the line, default .2\r\n *\t@param {Number} options.maxZoom Maximum zoom for the line, default 4\r\n *\t@param {boolean} options.zoomButton Are zoom buttons avaliable, default false\r\n *\t@param {function} options.getHTML a function that takes a feature and returns the html to display\r\n *\t@param {function} options.getFeatureDate a function that takes a feature and returns its date, default the date propertie\r\n *\t@param {function} options.endFeatureDate a function that takes a feature and returns its end date, default no end date\r\n *\t@param {String} options.graduation day|month to show month or day graduation, default show only years\r\n *\t@param {String} options.scrollTimeout Time in milliseconds to get a scroll event, default 15ms\r\n */\r\nol.control.Timeline = function(options) {\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: (options.className || '') + ' ol-timeline'\r\n      + (options.target ? '': ' ol-unselectable ol-control')\r\n      + (options.zoomButton ? ' ol-hasbutton':'')\r\n  });\r\n  // Initialize\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  // Scroll div\r\n  this._scrollDiv = ol.ext.element.create('DIV', {\r\n    className: 'ol-scroll',\r\n    parent: this.element\r\n  });\r\n  // Add a button bar\r\n  this._buttons = ol.ext.element.create('DIV', {\r\n    className: 'ol-buttons',\r\n    parent: this.element\r\n  });\r\n  // Zoom buttons\r\n  if (options.zoomButton) {\r\n    // Zoom in\r\n    this.addButton({\r\n      className: 'ol-zoom-in',\r\n      handleClick: function(){\r\n        var zoom = this.get('zoom');\r\n        if (zoom>=1) {\r\n          zoom++;\r\n        } else {\r\n          zoom = Math.min(1, zoom + 0.1);\r\n        }\r\n        zoom = Math.round(zoom*100)/100;\r\n        this.refresh(zoom);\r\n      }.bind(this)\r\n    });\r\n    // Zoom out\r\n    this.addButton({\r\n      className: 'ol-zoom-out',\r\n      handleClick: function(){\r\n        var zoom = this.get('zoom');\r\n        if (zoom>1) {\r\n          zoom--;\r\n        } else {\r\n          zoom -= 0.1;\r\n        }\r\n        zoom = Math.round(zoom*100)/100;\r\n        this.refresh(zoom);\r\n      }.bind(this)\r\n    });\r\n  }\r\n  // Draw center date\r\n  this._intervalDiv = ol.ext.element.create('DIV', {\r\n    className: 'ol-center-date',\r\n    parent: this.element\r\n  });\r\n  // Remove selection\r\n  this.element.addEventListener('mouseover', function(){\r\n    if (this._select) this._select.elt.classList.remove('ol-select');\r\n  }.bind(this));\r\n  // Trigger scroll event\r\n  var scrollListener = null;\r\n  this._scrollDiv.addEventListener('scroll', function() {\r\n    this._setScrollLeft();\r\n    if (scrollListener) {\r\n      clearTimeout(scrollListener);\r\n      scrollListener = null;\r\n    }\r\n    scrollListener = setTimeout(function() {\r\n      this.dispatchEvent({ \r\n        type: 'scroll', \r\n        date: this.getDate(), \r\n        dateStart: this.getDate('start'), \r\n        dateEnd: this.getDate('end')\r\n      });\r\n    }.bind(this), options.scrollTimeout || 15);\r\n  }.bind(this));\r\n  // Magic to give \"live\" scroll events on touch devices\r\n  // this._scrollDiv.addEventListener('gesturechange', function() {});\r\n  // Scroll timeline\r\n  ol.ext.element.scrollDiv(this._scrollDiv, {\r\n    onmove: function(b) {\r\n      // Prevent selection on moving\r\n      this._moving = b; \r\n    }.bind(this)\r\n  });\r\n  this._tline = [];\r\n  // Parameters\r\n  this._scrollLeft = 0;\r\n  this.set('maxWidth', options.maxWidth || 2000);\r\n  this.set('minDate', options.minDate || Infinity);\r\n  this.set('maxDate', options.maxDate || -Infinity);\r\n  this.set('graduation', options.graduation);\r\n  this.set('minZoom', options.minZoom || .2);\r\n  this.set('maxZoom', options.maxZoom || 4);\r\n  this.setInterval(options.interval);\r\n  if (options.getHTML) this._getHTML =  options.getHTML;\r\n  if (options.getFeatureDate) this._getFeatureDate =  options.getFeatureDate;\r\n  if (options.endFeatureDate) this._endFeatureDate =  options.endFeatureDate;\r\n  // Feature source \r\n  this.setFeatures(options.features || options.source, options.zoom);\r\n};\r\nol.ext.inherits(ol.control.Timeline, ol.control.Control);\r\n/**\r\n * Set the map instance the control is associated with\r\n * and add interaction attached to it to this map.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.control.Timeline.prototype.setMap = function(map) {\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  this.refresh(this.get('zoom')||1, true);\r\n};\r\n/** Add a button on the timeline\r\n * @param {*} button\r\n *  @param {string} button.className\r\n *  @param {title} button.className\r\n *  @param {Element|string} button.html Content of the element\r\n *  @param {function} button.click a function called when the button is clicked\r\n */\r\nol.control.Timeline.prototype.addButton = function(button) {\r\n  this.element.classList.add('ol-hasbutton');\r\n  ol.ext.element.create('BUTTON', {\r\n    className: button.className || undefined,\r\n    title: button.title,\r\n    html : button.html,\r\n    click: button.handleClick,\r\n    parent: this._buttons\r\n  })\r\n};\r\n/** Set an interval\r\n * @param {number|string} length the interval length in ms or a farmatted text ie. end with y, 1d, h, mn, s (31 days = '31d'), default none\r\n */\r\nol.control.Timeline.prototype.setInterval = function(length) {\r\n  if (typeof(length)==='string') {\r\n    if (/s$/.test(length)) {\r\n      length = parseFloat(length) * 1000;\r\n    } else if (/mn$/.test(length)) {\r\n      length = parseFloat(length) * 1000 * 60;\r\n    } else if (/h$/.test(length)) {\r\n      length = parseFloat(length) * 1000 * 3600;\r\n    } else if (/d$/.test(length)) {\r\n      length = parseFloat(length) * 1000 * 3600 * 24;\r\n    } else if (/y$/.test(length)) {\r\n      length = parseFloat(length) * 1000 * 3600 * 24 * 365;\r\n    } else {\r\n      length = 0;\r\n    }\r\n  }\r\n  this.set('interval', length || 0);\r\n  if (length) this.element.classList.add('ol-interval');\r\n  else this.element.classList.remove('ol-interval');\r\n  this.refresh(this.get('zoom'));\r\n}\r\n/** Default html to show in the line\r\n * @param {ol.Feature} feature\r\n * @return {DOMElement|string}\r\n * @private\r\n */\r\nol.control.Timeline.prototype._getHTML = function(feature) {\r\n  return feature.get('name') || '';\r\n};\r\n/** Default function to get the date of a feature, returns the date attribute\r\n * @param {ol.Feature} feature\r\n * @return {Data|string}\r\n * @private\r\n */\r\nol.control.Timeline.prototype._getFeatureDate = function(feature) {\r\n  return (feature && feature.get) ? feature.get('date') : null;\r\n};\r\n/** Default function to get the end date of a feature, return undefined\r\n * @param {ol.Feature} feature\r\n * @return {Data|string}\r\n * @private\r\n */\r\nol.control.Timeline.prototype._endFeatureDate = function(/* feature */) {\r\n  return undefined;\r\n};\r\n/** Is the line collapsed\r\n * @return {boolean}\r\n */\r\nol.control.Timeline.prototype.isCollapsed = function() {\r\n  return this.element.classList.contains('ol-collapsed');\r\n};\r\n/** Collapse the line\r\n * @param {boolean} b\r\n */\r\nol.control.Timeline.prototype.collapse = function(b) {\r\n  if (b) this.element.classList.add('ol-collapsed');\r\n  else this.element.classList.remove('ol-collapsed');\r\n  this.dispatchEvent({ type: 'collapse', collapsed: this.isCollapsed() });\r\n};\r\n/** Collapse the line\r\n */\r\nol.control.Timeline.prototype.toggle = function() {\r\n  this.element.classList.toggle('ol-collapsed');\r\n  this.dispatchEvent({ type: 'collapse', collapsed: this.isCollapsed() });\r\n};\r\n/** Set the features to display in the timeline\r\n * @param {Array<ol.Features>|ol.source.Vector} features An array of features or a vector source\r\n * @param {number} zoom zoom to draw the line default 1\r\n */\r\nol.control.Timeline.prototype.setFeatures = function(features, zoom) {\r\n  this._features = this._source = null;\r\n  if (features instanceof ol.source.Vector) this._source = features;\r\n  else if (features instanceof Array) this._features = features;\r\n  else this._features = [];\r\n  this.refresh(zoom);\r\n};\r\n/**\r\n * Get features\r\n * @return {Array<ol.Feature>}\r\n */\r\nol.control.Timeline.prototype.getFeatures = function() {\r\n  return this._features || this._source.getFeatures();\r\n}\r\n/**\r\n * Refresh the timeline with new data\r\n * @param {Number} zoom Zoom factor from 0.25 to 10, default 1\r\n */\r\nol.control.Timeline.prototype.refresh = function(zoom, first) {\r\n  if (!this.getMap()) return;\r\n  if (!zoom) zoom = this.get('zoom');\r\n  zoom = Math.min(this.get('maxZoom'), Math.max(this.get('minZoom'), zoom || 1));\r\n  this.set('zoom', zoom);\r\n  this._scrollDiv.innerHTML = '';\r\n  var features = this.getFeatures();\r\n  var d, d2;\r\n  // Get features sorted by date\r\n  var tline = this._tline = [];\r\n  features.forEach(function(f) {\r\n    if (d = this._getFeatureDate(f)) {\r\n      if (!(d instanceof Date)) {\r\n        d = new Date(d)\r\n      }\r\n      if (this._endFeatureDate) {\r\n        d2 = this._endFeatureDate(f);\r\n        if (!(d2 instanceof Date)) {\r\n          d2 = new Date(d2)\r\n        }\r\n      }\r\n      if (!isNaN(d)) {\r\n        tline.push({\r\n          date: d,\r\n          end: isNaN(d2) ? null : d2,\r\n          feature: f\r\n        });\r\n      }\r\n    }\r\n  }.bind(this));\r\n  tline.sort(function(a,b) { \r\n    return (a.date < b.date ? -1 : (a.date===b.date ? 0: 1))\r\n  });\r\n  // Draw\r\n  var div = ol.ext.element.create('DIV', {\r\n    parent: this._scrollDiv\r\n  });\r\n  // Calculate width\r\n  var min = this._minDate = Math.min(this.get('minDate'), tline.length ? tline[0].date : Infinity);\r\n  var max = this._maxDate = Math.max(this.get('maxDate'), tline.length ? tline[tline.length-1].date : -Infinity);\r\n  if (!isFinite(min)) this._minDate = min = new Date();\r\n  if (!isFinite(max)) this._maxDate = max = new Date();\r\n  var delta = (max-min);\r\n  var maxWidth = this.get('maxWidth');\r\n  var scale = this._scale = (delta > maxWidth ? maxWidth/delta : 1) * zoom;\r\n  // Leave 10px on right\r\n  min = this._minDate = this._minDate - 10/scale;\r\n  delta = (max-min) * scale;\r\n  ol.ext.element.setStyle(div, {\r\n    width: delta,\r\n    maxWidth: 'unset'\r\n  });\r\n  // Draw time's bar\r\n  this._drawTime(div, min, max, scale);\r\n  // Set interval\r\n  if (this.get('interval')) {\r\n    ol.ext.element.setStyle (this._intervalDiv, { width: this.get('interval') * scale });\r\n  } else {\r\n    ol.ext.element.setStyle (this._intervalDiv, { width: '' });\r\n  }\r\n  // Draw features\r\n  var line = [];\r\n  var lineHeight = ol.ext.element.getStyle(this._scrollDiv, 'lineHeight');\r\n  // Wrapper\r\n  var fdiv = ol.ext.element.create('DIV', {\r\n      className: 'ol-features',\r\n      parent: div\r\n  });\r\n  // Add features on the line\r\n  tline.forEach(function(f) {\r\n    var d = f.date;\r\n    var t = f.elt = ol.ext.element.create('DIV', {\r\n      className: 'ol-feature',\r\n      style: {\r\n        left: Math.round((d-min)*scale),\r\n      },\r\n      html: this._getHTML(f.feature),\r\n      parent: fdiv\r\n    });\r\n    // Prevent image dragging\r\n    var img = t.querySelectorAll('img');\r\n    for (var i=0; i<img.length; i++) {\r\n      img[i].ondragstart = function(){ return false; };\r\n    }\r\n    // Calculate image width\r\n    if (f.end) {\r\n      ol.ext.element.setStyle(t, { \r\n        minWidth: (f.end-d) * scale, \r\n        width: (f.end-d) * scale, \r\n        maxWidth: 'unset'\r\n      });\r\n    }\r\n    var left = ol.ext.element.getStyle(t, 'left');\r\n    // Select on click\r\n    t.addEventListener('click', function() {\r\n      if (!this._moving) {\r\n        this.dispatchEvent({type: 'select', feature: f.feature });\r\n      }\r\n    }.bind(this));\r\n    // Find first free Y position\r\n    var pos, l;\r\n    for (pos=0; l=line[pos]; pos++) {\r\n      if (left > l) {\r\n        break;\r\n      }\r\n    }\r\n    line[pos] = left + ol.ext.element.getStyle(t, 'width');\r\n    ol.ext.element.setStyle(t, { top: pos*lineHeight });\r\n  }.bind(this));\r\n  this._nbline = line.length;\r\n  if (first) this.setDate(this._minDate, { anim: false, position: 'start' });\r\n  // Dispatch scroll event\r\n  this.dispatchEvent({ \r\n    type: 'scroll', \r\n    date: this.getDate(), \r\n    dateStart: this.getDate('start'), \r\n    dateEnd: this.getDate('end')\r\n  });\r\n};\r\n/** Get offset given a date\r\n * @param {Date} date\r\n * @return {number}\r\n * @private\r\n */\r\nol.control.Timeline.prototype._getOffsetFromDate = function(date) {\r\n  return (date - this._minDate) * this._scale;\r\n};\r\n/** Get date given an offset\r\n * @param {Date} date\r\n * @return {number}\r\n * @private\r\n */\r\nol.control.Timeline.prototype._getDateFromOffset = function(offset) {\r\n  return offset / this._scale + this._minDate;\r\n};\r\n/** Set the current position \r\n * @param {number} scrollLeft current position (undefined when scrolling)\r\n * @returns {number}\r\n * @private\r\n */\r\nol.control.Timeline.prototype._setScrollLeft = function(scrollLeft) {\r\n  this._scrollLeft = scrollLeft;\r\n  if (scrollLeft !== undefined) {\r\n    this._scrollDiv.scrollLeft = scrollLeft;\r\n  }\r\n};\r\n/** Get the current position \r\n * @returns {number}\r\n * @private\r\n */\r\nol.control.Timeline.prototype._getScrollLeft = function() {\r\n  // Unset when scrolling\r\n  if (this._scrollLeft === undefined) {\r\n    return this._scrollDiv.scrollLeft;\r\n  } else {\r\n    // St by user\r\n    return this._scrollLeft;\r\n  }\r\n};\r\n/**\r\n * Draw dates on line\r\n * @private\r\n */\r\nol.control.Timeline.prototype._drawTime = function(div, min, max, scale) {\r\n  // Times div\r\n  var tdiv = ol.ext.element.create('DIV', {\r\n    className: 'ol-times',\r\n    parent: div\r\n  });\r\n  var d, dt, month, dmonth;\r\n  var dx = ol.ext.element.getStyle(tdiv, 'left');\r\n  var heigth = ol.ext.element.getStyle(tdiv, 'height');\r\n  // Year\r\n  var year = (new Date(this._minDate)).getFullYear();\r\n  dt = ((new Date(0)).setFullYear(String(year)) - new Date(0).setFullYear(String(year-1))) * scale;\r\n  var dyear = Math.round(2*heigth/dt)+1;\r\n  while(true) {\r\n    d = new Date(0).setFullYear(year);\r\n    if (d > this._maxDate) break;\r\n    ol.ext.element.create('DIV', {\r\n      className: 'ol-time ol-year',\r\n      style: {\r\n        left: this._getOffsetFromDate(d) - dx\r\n      },\r\n      html: year,\r\n      parent: tdiv\r\n    });\r\n    year += dyear;\r\n  }\r\n  // Month\r\n  if (/day|month/.test(this.get('graduation'))) {\r\n    dt = ((new Date(0,0,1)).setFullYear(String(year)) - new Date(0,0,1).setFullYear(String(year-1))) * scale;\r\n    dmonth = Math.max(1, Math.round(12 / Math.round(dt/heigth/2)));\r\n    if (dmonth < 12) {\r\n      year = (new Date(this._minDate)).getFullYear();\r\n      month = dmonth+1;\r\n      while(true) {\r\n        d = new Date(0,0,1);\r\n        d.setFullYear(year);\r\n        d.setMonth(month-1);\r\n        if (d > this._maxDate) break;\r\n        ol.ext.element.create('DIV', {\r\n          className: 'ol-time ol-month',\r\n          style: {\r\n            left: this._getOffsetFromDate(d) - dx\r\n          },\r\n          html: d.toLocaleDateString(undefined, { month: 'short'}),\r\n          parent: tdiv\r\n        });\r\n        month += dmonth;\r\n        if (month > 12) {\r\n          year++;\r\n          month = dmonth+1;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  // Day\r\n  if (this.get('graduation')==='day') {\r\n    dt = (new Date(0,1,1) - new Date(0,0,1)) * scale;\r\n    var dday = Math.max(1, Math.round(31 / Math.round(dt/heigth/2)));\r\n    if (dday < 31) {\r\n      year = (new Date(this._minDate)).getFullYear();\r\n      month = 0;\r\n      var day = dday;\r\n      while(true) {\r\n        d = new Date(0,0,1);\r\n        d.setFullYear(year);\r\n        d.setMonth(month);\r\n        d.setDate(day);\r\n        if (isNaN(d)) {\r\n          month++;\r\n          if (month>12) {\r\n            month = 1;\r\n            year++;\r\n          }\r\n          day = dday;\r\n        } else {\r\n          if (d > this._maxDate) break;\r\n          if (day>1) {\r\n            var offdate = this._getOffsetFromDate(d);\r\n            if (this._getOffsetFromDate(new Date(year, month+1, 1)) - offdate > heigth) {\r\n              ol.ext.element.create('DIV', {\r\n                className: 'ol-time ol-day',\r\n                style: {\r\n                  left: offdate - dx\r\n                },\r\n                html: day,\r\n                parent: tdiv\r\n              });\r\n            }\r\n          }\r\n          year = d.getFullYear();\r\n          month = d.getMonth();\r\n          day = d.getDate() + dday;\r\n          if (day > new Date(year, month+1, 0).getDate()) {\r\n            month++;\r\n            day = dday;\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n};\r\n/** Center timeline on a date\r\n * @param {Date|String|ol.feature} feature a date or a feature with a date\r\n * @param {Object} options\r\n *  @param {boolean} options.anim animate scroll\r\n *  @param {string} options.position start, end or middle, default middle\r\n */\r\nol.control.Timeline.prototype.setDate = function(feature, options) {\r\n  var date;\r\n  options = options || {};\r\n  // It's a date\r\n  if (feature instanceof Date) {\r\n    date = feature;\r\n  } else {\r\n    // Get date from Feature\r\n    if (this.getFeatures().indexOf(feature) >= 0) {\r\n      date = this._getFeatureDate(feature);\r\n    }\r\n    if (date && !(date instanceof Date)) {\r\n      date = new Date(date);\r\n    }\r\n    if (!date || isNaN(date)) {\r\n      date = new Date(String(feature));\r\n    }\r\n  }\r\n  if (!isNaN(date)) {\r\n    if (options.anim === false) this._scrollDiv.classList.add('ol-move');\r\n    var scrollLeft = this._getOffsetFromDate(date);\r\n    if (options.position==='start') {\r\n      scrollLeft += ol.ext.element.outerWidth(this._scrollDiv)/2 - ol.ext.element.getStyle(this._scrollDiv, 'marginLeft')/2;\r\n    } else if (options.position==='end') {\r\n      scrollLeft -= ol.ext.element.outerWidth(this._scrollDiv)/2 - ol.ext.element.getStyle(this._scrollDiv, 'marginLeft')/2;\r\n    }\r\n    this._setScrollLeft(scrollLeft);\r\n    if (options.anim === false) this._scrollDiv.classList.remove('ol-move');\r\n    if (feature) {\r\n      for (var i=0, f; f = this._tline[i]; i++) {\r\n        if (f.feature === feature) {\r\n          f.elt.classList.add('ol-select');\r\n          this._select = f;\r\n        } else {\r\n          f.elt.classList.remove('ol-select');\r\n        }\r\n      }\r\n    }\r\n  }\r\n};\r\n/** Get round date (sticked to mn, hour day or month)\r\n * @param {Date} d\r\n * @param {string} stick sticking option to stick date to: 'mn', 'hour', 'day', 'month', default no stick\r\n * @return {Date}\r\n */\r\nol.control.Timeline.prototype.roundDate = function(d, stick) {\r\n  switch (stick) {\r\n    case 'mn': {\r\n      return new Date(this._roundTo(d, 60*1000));\r\n    }\r\n    case 'hour': {\r\n      return new Date(this._roundTo(d, 60*60*1000));\r\n    }\r\n    case 'day': {\r\n      return new Date(this._roundTo(d, 24*60*60*1000));\r\n    }\r\n    case 'month': {\r\n      d = new Date(this._roundTo(d, 24*60*60*1000));\r\n      if (d.getDate() > 15) {\r\n        d = new Date(d.setMonth(d.getMonth() + 1));\r\n      }\r\n      d = d.setDate(1);\r\n      return new Date(d);\r\n    }\r\n    default: return new Date(d);\r\n  }\r\n};\r\n/** Get the date of the center\r\n * @param {string} position position to get 'start', 'end' or 'middle', default middle\r\n * @param {string} stick sticking option to stick date to: 'mn', 'hour', 'day', 'month', default no stick\r\n * @return {Date}\r\n */\r\nol.control.Timeline.prototype.getDate = function(position, stick) {\r\n  var pos;\r\n  if (!stick) stick = position;\r\n  switch (position) {\r\n    case 'start': {\r\n      if (this.get('interval')) {\r\n        pos = - ol.ext.element.getStyle(this._intervalDiv, 'width')/2 + ol.ext.element.getStyle(this._scrollDiv, 'marginLeft')/2;\r\n      } else {\r\n        pos = - ol.ext.element.outerWidth(this._scrollDiv)/2 + ol.ext.element.getStyle(this._scrollDiv, 'marginLeft')/2;\r\n      }\r\n      break;\r\n    }\r\n    case 'end': {\r\n      if (this.get('interval')) {\r\n        pos = ol.ext.element.getStyle(this._intervalDiv, 'width')/2 - ol.ext.element.getStyle(this._scrollDiv, 'marginLeft')/2;\r\n      } else {\r\n        pos = ol.ext.element.outerWidth(this._scrollDiv)/2 - ol.ext.element.getStyle(this._scrollDiv, 'marginLeft')/2;\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      pos = 0;\r\n      break;\r\n    }\r\n  }\r\n  var d = this._getDateFromOffset(this._getScrollLeft() + pos);\r\n  d = this.roundDate(d, stick);\r\n  return new Date(d);\r\n};\r\n/** Round number to \r\n * @param {number} d\r\n * @param {number} r\r\n * @return {number}\r\n * @private\r\n */\r\nol.control.Timeline.prototype._roundTo = function(d, r) {\r\n  return Math.round(d/r) * r;\r\n};\r\n/** Get the start date of the control\r\n * @return {Date}\r\n */\r\nol.control.Timeline.prototype.getStartDate = function() {\r\n  return new Date(this.get('minDate'));\r\n}\r\n/** Get the end date of the control\r\n * @return {Date}\r\n */\r\nol.control.Timeline.prototype.getEndDate = function() {\r\n  return new Date(this.get('maxDate'));\r\n}\r\n\r\n/*\r\n  Copyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Record map canvas as video\r\n * @constructor\r\n * @fire start\r\n * @fire error\r\n * @fire stop\r\n * @fire pause\r\n * @fire resume\r\n * @extends {ol.control.Control}\r\n * @param {Object=} options Control options.\r\n *\t@param {String} options.className class of the control\r\n *\t@param {number} [options.framerate=30] framerate for the video\r\n *\t@param {number} [options.videoBitsPerSecond=5000000] bitrate for the video\r\n *\t@param {DOMElement|string} [options.videoTarget] video element or the container to add the video when finished or 'DIALOG' to show it in a dialog, default none\r\n */\r\nol.control.VideoRecorder = function(options) {\r\n  if (!options) options = {};\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: (options.className || 'ol-videorec') + ' ol-unselectable ol-control'\r\n  });\r\n  // buttons\r\n  ol.ext.element.create('BUTTON', {\r\n    type: 'button',\r\n    className: 'ol-start',\r\n    title: 'start',\r\n    click: function() { \r\n      this.start();\r\n    }.bind(this),\r\n    parent: element\r\n  });\r\n  ol.ext.element.create('BUTTON', {\r\n    type: 'button',\r\n    className: 'ol-stop',\r\n    title: 'stop',\r\n    click: function() { \r\n      this.stop();\r\n    }.bind(this),\r\n    parent: element\r\n  });\r\n  ol.ext.element.create('BUTTON', {\r\n    type: 'button',\r\n    className: 'ol-pause',\r\n    title: 'pause',\r\n    click: function() { \r\n      this.pause();\r\n    }.bind(this),\r\n    parent: element\r\n  });\r\n  ol.ext.element.create('BUTTON', {\r\n    type: 'button',\r\n    className: 'ol-resume',\r\n    title: 'resume',\r\n    click: function() {\r\n      this.resume();\r\n    }.bind(this),\r\n    parent: element\r\n  });\r\n  // Start\r\n  ol.control.Control.call(this, {\r\n    element: element,\r\n    target: options.target\r\n  });\r\n  this.set('framerate', 30);\r\n  this.set('videoBitsPerSecond', 5000000);\r\n  if (options.videoTarget === 'DIALOG') {\r\n    this._dialog = new ol.control.Dialog({ \r\n      className: 'ol-fullscreen-dialog', \r\n      target: document.body, \r\n      closeBox: true \r\n    });\r\n    this._videoTarget = this._dialog.getContentElement();\r\n  } else {\r\n    this._videoTarget = options.videoTarget;\r\n  }\r\n  // Print control\r\n  this._printCtrl = new ol.control.Print({\r\n    target: ol.ext.element.create('DIV')\r\n  });\r\n}\r\nol.ext.inherits(ol.control.VideoRecorder, ol.control.Control);\r\n/**\r\n * Remove the control from its current map and attach it to the new map.\r\n * Subclasses may set up event handlers to get notified about changes to\r\n * the map here.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.control.VideoRecorder.prototype.setMap = function (map) {\r\n  if (this.getMap()) {\r\n    this.getMap().removeControl(this._printCtrl);\r\n    if (this._dialog) this.getMap().removeControl(this._dialog);\r\n  }\r\n  ol.control.Control.prototype.setMap.call(this, map);\r\n  if (this.getMap()) {\r\n    this.getMap().addControl(this._printCtrl);\r\n    if (this._dialog) this.getMap().addControl(this._dialog);\r\n  }\r\n};\r\n/** Start recording */\r\nol.control.VideoRecorder.prototype.start = function () {\r\n  var print = this._printCtrl;\r\n  var stop = false;\r\n  function capture(canvas) {\r\n    if (stop) return;\r\n    print.fastPrint({\r\n      canvas: canvas\r\n    }, capture);\r\n  }\r\n  print.fastPrint({}, function(canvas) {\r\n    var videoStream;\r\n    try {\r\n      videoStream = canvas.captureStream(this.get('framerate') || 30);\r\n    } catch(e) {\r\n      this.dispatchEvent({\r\n        type: 'error',\r\n        error: e\r\n      });\r\n      // console.warn(e);\r\n      return;\r\n    }\r\n    this._mediaRecorder = new MediaRecorder(videoStream, {\r\n      videoBitsPerSecond : this.get('videoBitsPerSecond') || 5000000\r\n    });\r\n    var chunks = [];\r\n    this._mediaRecorder.ondataavailable = function(e) {\r\n      chunks.push(e.data);\r\n    };\r\n    this._mediaRecorder.onstop = function() {\r\n      stop = true;\r\n      var blob = new Blob(chunks, { 'type' : 'video/mp4' }); // other types are available such as 'video/webm' for instance, see the doc for more info\r\n      chunks = [];\r\n      if (this._videoTarget instanceof Element) {\r\n        var video;\r\n        if (this._videoTarget.tagName === 'VIDEO') {\r\n          video = this._videoTarget;\r\n        } else {\r\n          video = this._videoTarget.querySelector('video');\r\n          if (!video) {\r\n            video = ol.ext.element.create('VIDEO', {\r\n              controls: '',\r\n              parent: this._videoTarget\r\n            });\r\n          }\r\n        }\r\n        if (this._dialog) this._dialog.show();\r\n        video.src = URL.createObjectURL(blob);\r\n        this.dispatchEvent({ type: 'stop', videoURL: video.src });\r\n      } else {\r\n        this.dispatchEvent({ type: 'stop', videoURL: URL.createObjectURL(blob) });\r\n      }\r\n    }.bind(this);\r\n    this._mediaRecorder.onpause = function() {\r\n      stop = true;\r\n      this.dispatchEvent({ type: 'pause' });\r\n    }.bind(this);\r\n    this._mediaRecorder.onresume = function() {\r\n      stop = false;\r\n      capture(canvas);\r\n      this.dispatchEvent({ type: 'resume' });\r\n    }.bind(this);\r\n    this._mediaRecorder.onerror = function(e) {\r\n      this.dispatchEvent({ type: 'error', error: e });\r\n    }.bind(this);\r\n    stop = false;\r\n    capture(canvas);\r\n    this._mediaRecorder.start();\r\n    this.dispatchEvent({ type: 'start', canvas: canvas });\r\n    this.element.setAttribute('data-state', 'rec');\r\n  }.bind(this))\r\n};\r\n/** Stop recording */\r\nol.control.VideoRecorder.prototype.stop = function () {\r\n  if (this._mediaRecorder) {\r\n    this._mediaRecorder.stop();\r\n    this._mediaRecorder = null;\r\n    this.element.setAttribute('data-state', 'inactive');\r\n  }\r\n};\r\n/** Pause recording */\r\nol.control.VideoRecorder.prototype.pause = function () {\r\n  if (this._mediaRecorder) {\r\n    this._mediaRecorder.pause();\r\n    this.element.setAttribute('data-state', 'pause');\r\n  }\r\n};\r\n/** Resume recording after pause */\r\nol.control.VideoRecorder.prototype.resume = function () {\r\n  if (this._mediaRecorder) {\r\n    this._mediaRecorder.resume();\r\n    this.element.setAttribute('data-state', 'rec');\r\n  }\r\n};\r\n\r\n/* \r\n  Using WMS Layer with EPSG:4326 projection.\r\n  The tiles will be reprojected to map pojection (EPSG:3857).\r\n  NB: reduce tileSize to minimize deformations on small scales.\r\n*/\r\n/** WMSCapabilities\r\n * @constructor\r\n * @fires load\r\n * @fires capabilities\r\n * @extends {ol.control.Button}\r\n * @param {*} options\r\n *  @param {string|Element} options.target the target to set the dialog, use document.body to have fullwindow dialog\r\n *  @param {string} options.proxy proxy to use when requesting Getcapabilites, default none (suppose the service use CORS)\r\n *  @param {string} options.placeholder input placeholder, default 'service url...'\r\n *  @param {string} options.title dialog title, default 'WMS'\r\n *  @param {string} options.searchLabel Label for search button, default 'search'\r\n *  @param {string} options.loadLabel Label for load button, default 'load'\r\n *  @param {boolean} options.popupLayer Use a popup for the layers, default false\r\n *  @param {*} options.services a key/url object of services for quick access in a menu\r\n *  @param {Array<string>} options.srs an array of supported srs, default map projection code or 'EPSG:3857'\r\n *  @param {number} options.timeout Timeout for getCapabilities request, default 1000\r\n *  @param {boolean} options.cors Use CORS, default false\r\n *  @param {boolean} options.trace Log layer info, default false\r\n *  @param {function} [options.onselect] callback function that takes a layer and layer options on select layer\r\n */\r\nol.control.WMSCapabilities = function (options) {\r\n  options = options || {};\r\n  var buttonOptions = Object.assign({}, options || {});\r\n  this._proxy = options.proxy;\r\n  if (buttonOptions.target===document.body) delete buttonOptions.target;\r\n  if (buttonOptions.target) {\r\n    buttonOptions.className = ((buttonOptions.className||'') + ' ol-wmscapabilities ol-hidden').trim();\r\n    delete buttonOptions.target;\r\n  } else {\r\n    buttonOptions.className = ((buttonOptions.className||'') + ' ol-wmscapabilities').trim();\r\n    buttonOptions.handleClick = function () {\r\n      this.showDialog();\r\n    }.bind(this)\r\n  }\r\n  ol.control.Button.call(this, buttonOptions);\r\n  // WMS options\r\n  this.set('srs', options.srs || []);\r\n  this.set('cors', options.cors);\r\n  this.set('trace', options.trace);\r\n  this.set('title', options.title);\r\n  this.set('loadLabel', options.loadLabel);\r\n  // Dialog\r\n  this.createDialog(options);\r\n  // Default version\r\n  this._elements.formVersion.value = '1.0.0';\r\n  // Ajax request\r\n  var parser = this._getParser();\r\n  this._ajax = new ol.ext.Ajax({ dataType:'text', auth: options.authentication });\r\n  this._ajax.on('success', function (evt) {\r\n    var caps;\r\n    try {\r\n      caps = parser.read(evt.response);\r\n    } catch (e) {\r\n      this.showError({ type: 'load', error: e });\r\n    }\r\n    if (caps) {\r\n      if (!caps.Capability.Layer.Layer) {\r\n        this.showError({ type: 'noLayer' });\r\n      } else {\r\n        this.showCapabilities(caps);\r\n      }\r\n    } \r\n    this.dispatchEvent({ type: 'capabilities', capabilities: caps });\r\n    if (typeof(evt.options.callback) === 'function') evt.options.callback(caps);\r\n  }.bind(this));\r\n  this._ajax.on('error', function(evt) {\r\n    this.showError({ type: 'load', error: evt });\r\n    this.dispatchEvent({ type: 'capabilities' });\r\n    if (typeof(evt.options.callback) === 'function') false;\r\n  }.bind(this));\r\n  // Handle waiting\r\n  this._ajax.on('loadstart', function() {\r\n    this._elements.element.classList.add('ol-searching');\r\n  }.bind(this));\r\n  this._ajax.on('loadend', function() {\r\n    this._elements.element.classList.remove('ol-searching');\r\n  }.bind(this));\r\n  // Load a layer\r\n  if (options.onselect) {\r\n    this.on('load', function(e) { \r\n      options.onselect(e.layer, e.options); \r\n    });\r\n  }\r\n};\r\nol.ext.inherits(ol.control.WMSCapabilities, ol.control.Button);\r\n/** Get service parser\r\n */\r\nol.control.WMSCapabilities.prototype._getParser = function() {\r\n  return  new ol.format.WMSCapabilities();\r\n};\r\n/** Error list: a key/value list of error to display in the dialog \r\n * Overwrite it to handle internationalization\r\n */\r\nol.control.WMSCapabilities.prototype.error = {\r\n  load: 'Can\\'t retrieve service capabilities, try to add it manually...',\r\n  badUrl: 'The input value is not a valid url...',\r\n  TileMatrix: 'No TileMatrixSet supported...',\r\n  noLayer: 'No layer available for this service...',\r\n  srs: 'The service projection looks different from that of your map, it may not display correctly...'\r\n};\r\n/** Form labels: a key/value list of form labels to display in the dialog\r\n * Overwrite it to handle internationalization\r\n */\r\nol.control.WMSCapabilities.prototype.labels = {\r\n  formTitle: 'Title:',\r\n  formLayer: 'Layers:',\r\n  formMap: 'Map:',\r\n  formStyle: 'Style:',\r\n  formFormat: 'Format:',\r\n  formMinZoom: 'Min zoom level:',\r\n  formMaxZoom: 'Max zoom level:',\r\n  formExtent: 'Extent:',\r\n  mapExtent: 'use map extent...',\r\n  formProjection: 'Projection:',\r\n  formCrossOrigin: 'CrossOrigin:',\r\n  formVersion: 'Version:',\r\n  formAttribution: 'Attribution:'\r\n};\r\n/** Create dialog\r\n * @private\r\n */\r\nol.control.WMSCapabilities.prototype.createDialog = function (options) {\r\n  var target = options.target;\r\n  if (!target || target===document.body) {\r\n    this._dialog = new ol.control.Dialog({\r\n      className: 'ol-wmscapabilities',\r\n      closeBox: true,\r\n      closeOnSubmit: false,\r\n      target: options.target\r\n    });\r\n    this._dialog.on('button', function(e) {\r\n      if (e.button==='submit') {\r\n        this.getCapabilities(e.inputs.url.value);\r\n      }\r\n    }.bind(this));\r\n    target = null;\r\n  }\r\n  var element = ol.ext.element.create('DIV', {\r\n    className: ('ol-wmscapabilities '+(options.className||'')).trim(),\r\n    parent: target\r\n  });\r\n  this._elements = {\r\n    element: target || element\r\n  };\r\n  var inputdiv = ol.ext.element.create('DIV', {\r\n    className: 'ol-url',\r\n    parent: element\r\n  });\r\n  var input = this._elements.input = ol.ext.element.create('INPUT', {\r\n    className: 'url',\r\n    type: 'text',\r\n    tabIndex: 1,\r\n    placeholder: options.placeholder || 'service url...',\r\n    autocorrect: 'off',\r\n    autocapitalize: 'off',\r\n    parent: inputdiv\r\n  });\r\n  input.addEventListener('keyup', function(e) {\r\n    if (e.keyCode===13) {\r\n      this.getCapabilities(input.value, options);\r\n    }\r\n  }.bind(this));\r\n  if (options.services) {\r\n    var qaccess = ol.ext.element.create('SELECT', {\r\n      className: 'url',\r\n      on: {\r\n        change: function(e) {\r\n          var url = e.target.options[e.target.selectedIndex].value;\r\n          this.getCapabilities(url, options);\r\n          e.target.selectedIndex = 0;\r\n        }.bind(this)\r\n      },\r\n      parent: inputdiv\r\n    });\r\n    ol.ext.element.create('OPTION', {\r\n      html: ' ',\r\n      parent: qaccess\r\n    });\r\n    for (var k in options.services) {\r\n      ol.ext.element.create('OPTION', {\r\n        html: k,\r\n        value: options.services[k],\r\n        parent: qaccess\r\n      });\r\n    }\r\n  }\r\n  ol.ext.element.create('BUTTON', {\r\n    click: function() {\r\n      this.getCapabilities(input.value, options);\r\n    }.bind(this),\r\n    html: options.searchLabel || 'search',\r\n    parent: inputdiv\r\n  });\r\n  // Errors\r\n  this._elements.error = ol.ext.element.create('DIV', {\r\n    className: 'ol-error',\r\n    parent: inputdiv\r\n  });\r\n  // Result div\r\n  var rdiv = this._elements.result = ol.ext.element.create('DIV', {\r\n    className: 'ol-result',\r\n    parent: element\r\n  });\r\n  // Preview\r\n  var preview = ol.ext.element.create('DIV', {\r\n    className: 'ol-preview',\r\n    html: options.previewLabel || 'preview',\r\n    parent: rdiv\r\n  });\r\n  this._elements.preview = ol.ext.element.create('IMG', {\r\n    parent: preview\r\n  });\r\n  // Check tainted canvas\r\n  this._img = new Image;\r\n  this._img.crossOrigin = 'Anonymous';\r\n  this._img.addEventListener('error', function() {\r\n    preview.className = 'ol-preview tainted';\r\n    this._elements.formCrossOrigin.checked = false;\r\n  }.bind(this));\r\n  this._img.addEventListener('load', function() {\r\n    preview.className = 'ol-preview ok';\r\n    this._elements.formCrossOrigin.checked = true;\r\n  }.bind(this));\r\n  // Select list\r\n  this._elements.select = ol.ext.element.create('DIV', {\r\n    className: 'ol-select-list',\r\n    tabIndex: 2,\r\n    parent: rdiv\r\n  });\r\n  // Info data\r\n  this._elements.data = ol.ext.element.create('DIV', {\r\n    className: 'ol-data',\r\n    parent: rdiv\r\n  });\r\n  this._elements.buttons = ol.ext.element.create('DIV', {\r\n    className: 'ol-buttons',\r\n    parent: rdiv\r\n  });\r\n  this._elements.legend = ol.ext.element.create('IMG', {\r\n    className: 'ol-legend',\r\n    parent: rdiv\r\n  });\r\n  // WMS form\r\n  var form = this._elements.form = ol.ext.element.create('UL', {\r\n    className: 'ol-wmsform',\r\n    parent: element\r\n  });\r\n  var addLine = function(label, val, pholder) {\r\n    var li = ol.ext.element.create('LI', {\r\n      parent: form\r\n    });\r\n    ol.ext.element.create('LABEL', {\r\n      html: this.labels[label],\r\n      parent: li\r\n    });\r\n    if (typeof(val) === 'boolean') {\r\n      this._elements[label] = ol.ext.element.create('INPUT', {\r\n        type: 'checkbox',\r\n        checked: val,\r\n        parent: li\r\n      });\r\n    } else if (val instanceof Array) {\r\n      var sel = this._elements[label] = ol.ext.element.create('SELECT', {\r\n        parent: li\r\n      });\r\n      val.forEach(function(v) {\r\n        ol.ext.element.create('OPTION', {\r\n          html: v,\r\n          value: v,\r\n          parent: sel\r\n        });\r\n      }.bind(this));\r\n    } else {\r\n      this._elements[label] = ol.ext.element.create('INPUT', {\r\n        value: (val===undefined ? '' : val),\r\n        placeholder: pholder || '',\r\n        type: typeof(val),\r\n        parent: li\r\n      });\r\n    }\r\n    return li;\r\n  }.bind(this);\r\n  addLine('formTitle');\r\n  addLine('formLayer', '', 'layer1,layer2,...');\r\n  var li = addLine('formMap');\r\n  li.setAttribute('data-param', 'map');\r\n  li = addLine('formStyle');\r\n  li.setAttribute('data-param', 'style');\r\n  addLine('formFormat', ['image/png', 'image/jpeg']);\r\n  addLine('formMinZoom', 0);\r\n  addLine('formMaxZoom', 20);\r\n  li = addLine('formExtent', '', 'xmin,ymin,xmax,ymax');\r\n  li.setAttribute('data-param', 'extent');\r\n  var extent = li.querySelector('input');\r\n  ol.ext.element.create('BUTTON', {\r\n    title: this.labels.mapExtent,\r\n    click: function() {\r\n      extent.value = this.getMap().getView().calculateExtent(this.getMap().getSize()).join(',');\r\n    }.bind(this),\r\n    parent: li\r\n  });\r\n  li = addLine('formProjection', '');\r\n  li.setAttribute('data-param', 'proj');\r\n  addLine('formCrossOrigin', false);\r\n  li = addLine('formVersion', '1.3.0');\r\n  li.setAttribute('data-param', 'version');\r\n  addLine('formAttribution', '');\r\n  ol.ext.element.create('BUTTON', {\r\n    html: this.get('loadLabel') || 'Load',\r\n    click: function() {\r\n      var opt = this._getFormOptions();\r\n      var layer = this.getLayerFromOptions(opt);\r\n      this.dispatchEvent({ type: 'load', layer: layer, options: opt });\r\n      this._dialog.hide();\r\n    }.bind(this),\r\n    parent: form\r\n  });\r\n  return element;\r\n};\r\n/** Create a new layer using options received by getOptionsFromCap method\r\n * @param {*} options\r\n */\r\nol.control.WMSCapabilities.prototype.getLayerFromOptions = function (options) {\r\n  options.layer.source = new ol.source.TileWMS(options.source);\r\n  var layer = new ol.layer.Tile(options.layer);\r\n  delete options.layer.source;\r\n  return layer;\r\n};\r\n/**\r\n * Set the map instance the control is associated with\r\n * and add its controls associated to this map.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.control.WMSCapabilities.prototype.setMap = function (map) {\r\n  ol.control.Button.prototype.setMap.call(this, map);\r\n  if (this._dialog) this._dialog.setMap(map);\r\n};\r\n/** Get the dialog\r\n * @returns {ol.control.Dialog}\r\n */\r\nol.control.WMSCapabilities.prototype.getDialog = function() {\r\n  return this._dialog;\r\n};\r\n/** Show dialog for url\r\n * @param {string} [url] service url, default ask for an url\r\n * @param {*} options capabilities options\r\n *  @param {string} options.map WMS map or get map in url?map=xxx\r\n *  @param {string} options.version WMS version (yet only 1.3.0 is implemented), default 1.3.0\r\n *  @param {number} options.timeout timout to get the capabilities, default 10000\r\n */\r\nol.control.WMSCapabilities.prototype.showDialog = function(url, options) {\r\n  this.showError();\r\n  if (!this._elements.formProjection.value) {\r\n    this._elements.formProjection.value = this.getMap().getView().getProjection().getCode();\r\n  }\r\n  if (this._dialog) {\r\n    this._dialog.show({\r\n      title: this.get('title')===undefined ? 'WMS' : this.get('title'),\r\n      content: this._elements.element\r\n    });\r\n  }\r\n  this.getCapabilities(url, options);\r\n  // Center on selection\r\n  var sel = this._elements.select.querySelector('.selected');\r\n  if (sel) {\r\n    this._elements.select.scrollTop = sel.offsetTop - 20;\r\n  }\r\n};\r\n/** Test url and return true if it is a valid url string\r\n * @param {string} url\r\n * @return {bolean}\r\n * @api\r\n */\r\nol.control.WMSCapabilities.prototype.testUrl = function(url) {\r\n  // var pattern = /(https?:\\/\\/)([\\da-z.-]+)\\.([a-z]{2,6})([/\\w.-]*)*\\/?/\r\n  var pattern = new RegExp(\r\n    // protocol\r\n    '^(https?:\\\\/\\\\/)'+ \r\n    // domain name\r\n    '((([a-z\\\\d]([a-z\\\\d-]*[a-z\\\\d])*)\\\\.)+[a-z]{2,}|'+\r\n    // OR ip (v4) address\r\n    '((\\\\d{1,3}\\\\.){3}\\\\d{1,3}))'+\r\n    // port and path\r\n    '(\\\\:\\\\d+)?(\\\\/[-a-z\\\\d%_.~+]*)*'+\r\n    // query string\r\n    '(\\\\?[;&a-z\\\\d%_.~+=\\\\/-]*)?'+\r\n    // fragment locator\r\n    '(\\\\#[-a-z\\\\d_]*)?$','i');\r\n  return !!pattern.test(url);\r\n};\r\n/** Get Capabilities request parameters\r\n * @param {*} options\r\n */\r\nol.control.WMSCapabilities.prototype.getRequestParam = function(options) {\r\n  return {\r\n    SERVICE: 'WMS',\r\n    REQUEST: 'GetCapabilities',\r\n    VERSION: options.version || '1.3.0'\r\n  }\r\n};\r\n/** Get WMS capabilities for a server\r\n * @fire load\r\n * @param {string} url service url\r\n * @param {*} options \r\n *  @param {string} options.map WMS map or get map in url?map=xxx\r\n *  @param {string} [options.version=1.3.0] WMS version (yet only 1.3.0 is implemented), default 1.3.0\r\n *  @param {number} [options.timeout=10000] timout to get the capabilities, default 10000\r\n *  @param {function} [options.onload] callback function\r\n */\r\nol.control.WMSCapabilities.prototype.getCapabilities = function(url, options) {\r\n  if (!url) return;\r\n  if (!this.testUrl(url)) {\r\n    this.showError({\r\n      type: 'badUrl'\r\n    })\r\n    return;\r\n  }\r\n  options = options || {};\r\n  // Extract map attributes\r\n  url = url.split('?');\r\n  var search = url[1];\r\n  url = url[0];\r\n  // reset\r\n  this._elements.formMap.value = '';\r\n  this._elements.formLayer.value = '';\r\n  this._elements.formStyle.value = '';\r\n  this._elements.formTitle.value = '';\r\n  this._elements.formProjection.value = this.getMap().getView().getProjection().getCode();\r\n  this._elements.formFormat.selectedIndex = 0;\r\n  var map = options.map || '';\r\n  if (search) {\r\n    search = search.replace(/^\\?/,'').split('&');\r\n    search.forEach(function(s) {\r\n      s = s.split('=');\r\n      s[1] = decodeURIComponent(s[1] || '');\r\n      if (/^map$/i.test(s[0])) {\r\n        map = s[1];\r\n        this._elements.formMap.value = map;\r\n      }\r\n      if (/^layers$/i.test(s[0])) {\r\n        this._elements.formLayer.value = s[1];\r\n        this._elements.formTitle.value = s[1].split(',')[0];\r\n      }\r\n      if (/^style$/i.test(s[0])) {\r\n        this._elements.formStyle.value = s[1];\r\n      }\r\n      if (/^crs$/i.test(s[0])) {\r\n        this._elements.formProjection.value = s[1];\r\n      }\r\n      if (/^format$/i.test(s[0])) {\r\n        for (var o,i=0; o=this._elements.formFormat.options[i]; i++) {\r\n          if (o.value===s[1]) {\r\n            this._elements.formFormat.selectedIndex = i;\r\n            break;\r\n          }\r\n        }\r\n      }\r\n    }.bind(this))\r\n  }\r\n  // Fill form\r\n  this._elements.input.value = (url || '') + (map ? '?map='+map : '');\r\n  this.clearForm();\r\n  var request = this.getRequestParam(options);\r\n  if (map) request.MAP = map;\r\n  if (this._proxy) {\r\n    var q = '';\r\n    for (var r in request) q += (q?'&':'')+r+'='+request[r];\r\n    this._ajax.send(this._proxy, {\r\n      url: q\r\n    }, {\r\n      timeout: options.timeout || 10000,\r\n      callback: options.onload,\r\n      abort: false\r\n    });\r\n  } else {\r\n    this._ajax.send(url, request, {\r\n      timeout: options.timeout || 10000,\r\n      callback: options.onload,\r\n      abort: false\r\n    });\r\n  }\r\n};\r\n/** Display error\r\n * @param {*} error event\r\n */\r\nol.control.WMSCapabilities.prototype.showError = function(e) {\r\n  if (!e) this._elements.error.innerHTML = '';\r\n  else this._elements.error.innerHTML = this.error[e.type] || ('ERROR ('+e.type+')');\r\n  if (e && e.type === 'load') {\r\n    this._elements.form.classList.add('visible');\r\n  } else {\r\n    this._elements.form.classList.remove('visible');\r\n  }\r\n};\r\n/** Clear form\r\n */\r\nol.control.WMSCapabilities.prototype.clearForm = function() {\r\n  this._elements.result.classList.remove('ol-visible')\r\n  this.showError();\r\n  this._elements.select.innerHTML = '';\r\n  this._elements.data.innerHTML = '';\r\n  this._elements.preview.src = '';\r\n  this._elements.legend.src = '';\r\n  this._elements.legend.classList.remove('visible');\r\n};\r\n/** Display capabilities in the dialog\r\n * @param {*} caps JSON capabilities\r\n */\r\nol.control.WMSCapabilities.prototype.showCapabilities = function(caps) {\r\n  console.log(caps)\r\n  this._elements.result.classList.add('ol-visible')\r\n//  console.log(caps)\r\n  var list = [];\r\n  var addLayers = function(parent, level) {\r\n    level = level || 0;\r\n    parent.Layer.forEach(function(l) {\r\n      if (!l.Attribution) l.Attribution = parent.Attribution;\r\n      if (!l.EX_GeographicBoundingBox) l.EX_GeographicBoundingBox = parent.EX_GeographicBoundingBox;\r\n      var li = ol.ext.element.create('DIV', {\r\n        className: (l.Layer ? 'ol-title ' : '') + 'level-'+level,\r\n        html: l.Name || l.Title,\r\n        click: function() {\r\n          // Reset\r\n          this._elements.buttons.innerHTML = '';\r\n          this._elements.data.innerHTML = '';\r\n          this._elements.legend.src = this._elements.preview.src = '';\r\n          this._elements.element.classList.remove('ol-form');\r\n          this.showError();\r\n          // Load layer\r\n          var options = this.getOptionsFromCap(l, caps);\r\n          var layer = this.getLayerFromOptions(options);\r\n          this._currentOptions = options;\r\n          //\r\n          list.forEach(function(i) {\r\n            i.classList.remove('selected');\r\n          })\r\n          li.classList.add('selected');\r\n          // Fill form\r\n          if (layer) {\r\n            ol.ext.element.create('BUTTON', {\r\n              html: this.get('loadLabel') || 'Load',\r\n              className: 'ol-load',\r\n              click: function() {\r\n                this.dispatchEvent({type: 'load', layer: layer, options: options });\r\n                if (this._dialog) this._dialog.hide();\r\n              }.bind(this),\r\n              parent: this._elements.buttons\r\n            });\r\n            ol.ext.element.create('BUTTON', {\r\n              className: 'ol-wmsform',\r\n              click: function() {\r\n                this._elements.element.classList.toggle('ol-form');\r\n              }.bind(this),\r\n              parent: this._elements.buttons\r\n            });\r\n            // Show preview\r\n            var reso = this.getMap().getView().getResolution();\r\n            var center = this.getMap().getView().getCenter();\r\n            this._elements.preview.src = layer.getPreview(center, reso, this.getMap().getView().getProjection());\r\n            this._img.src = this._elements.preview.src;\r\n            // ShowInfo\r\n            ol.ext.element.create('p', {\r\n              className: 'ol-title',\r\n              html: options.data.title,\r\n              parent: this._elements.data\r\n            });\r\n            ol.ext.element.create('p', {\r\n              html: options.data.abstract,\r\n              parent: this._elements.data\r\n            });\r\n            if (options.data.legend.length) {\r\n              this._elements.legend.src = options.data.legend[0];\r\n              this._elements.legend.classList.add('visible');\r\n            } else {\r\n              this._elements.legend.src = '';\r\n              this._elements.legend.classList.remove('visible');\r\n            }\r\n          }\r\n        }.bind(this),\r\n        parent: this._elements.select\r\n      });\r\n      list.push(li);\r\n      if (l.Layer) {\r\n        addLayers(l, level+1);\r\n      }\r\n    }.bind(this));\r\n  }.bind(this);\r\n  // Show layers\r\n  this._elements.select.innerHTML = '';\r\n  addLayers(caps.Capability.Layer);\r\n};\r\n/** Get resolution for a layer\r\n * @param {string} 'min' or 'max'\r\n * @param {*} layer\r\n * @param {number} val\r\n * @return {number}\r\n * @private\r\n */\r\nol.control.WMSCapabilities.prototype.getLayerResolution = function(m, layer, val) {\r\n  var att = m==='min' ? 'MinScaleDenominator' : 'MaxScaleDenominator';\r\n  if (layer[att] !== undefined) return layer[att]/(72/2.54*100);\r\n  if (!layer.Layer) return (m==='min' ? 0 : 156543.03392804097);\r\n  // Get min / max of contained layers\r\n  val = (m==='min' ? 156543.03392804097 : 0);\r\n  for (var i=0; i<layer.Layer.length; i++) {\r\n    var res = this.getLayerResolution(m, layer.Layer[i], val);\r\n    if (res !== undefined) val = Math[m](val, res);\r\n  }\r\n  return val;\r\n};\r\n/** Return a WMS ol.layer.Tile for the given capabilities\r\n * @param {*} caps layer capabilities (read from the capabilities)\r\n * @param {*} parent capabilities\r\n * @return {*} options\r\n */\r\nol.control.WMSCapabilities.prototype.getOptionsFromCap = function(caps, parent) {\r\n  var formats = parent.Capability.Request.GetMap.Format;\r\n  var format, i;\r\n  // Look for prefered format first\r\n  var pref = [/png/,/jpeg/,/gif/];\r\n  for (i=0; i<3; i++) {\r\n    for (var f=0; f<formats.length; f++) {\r\n      if (pref[i].test(formats[f])) {\r\n        format = formats[f];\r\n        break;\r\n      }\r\n    }\r\n    if (format) break;\r\n  }\r\n  if (!format) format = formats[0];  \r\n  // Check srs\r\n  var srs = this.getMap().getView().getProjection().getCode();\r\n  this.showError();\r\n  var crs = false;\r\n  if (!caps.CRS) {\r\n    crs = false;\r\n  } else if (caps.CRS.indexOf(srs)>=0) {\r\n    crs = true;\r\n  } else if (caps.CRS.indexOf('EPSG:4326')>=0) {\r\n    // try to set EPSG:4326 instead\r\n    srs = 'EPSG:4326';\r\n    crs = true;\r\n  } else {\r\n    this.get('srs').forEach(function(s) {\r\n      if (caps.CRS.indexOf(s)>=0) {\r\n        srs = s;\r\n        crs = true;\r\n      }\r\n    })\r\n  }\r\n  if (!crs) {\r\n    this.showError({ type:'srs' });\r\n    if (this.get('trace')) console.log('BAD srs: ', caps.CRS);\r\n  }\r\n  var bbox = caps.EX_GeographicBoundingBox;\r\n  //bbox = ol.proj.transformExtent(bbox, 'EPSG:4326', srs);\r\n  if (bbox) bbox = ol.proj.transformExtent(bbox, 'EPSG:4326', this.getMap().getView().getProjection());\r\n  var attributions = [];\r\n  if (caps.Attribution) {\r\n    attributions.push('<a href=\"'+encodeURI(caps.Attribution.OnlineResource)+'\">&copy; '+caps.Attribution.Title.replace(/</g,'&lt;')+'</a>');\r\n  }\r\n  var layer_opt = {\r\n    title: caps.Title,\r\n    extent: bbox,\r\n    queryable: caps.queryable,\r\n    abstract: caps.Abstract,\r\n    minResolution: this.getLayerResolution('min', caps),\r\n    maxResolution: this.getLayerResolution('max', caps) || 156543.03392804097\r\n  };\r\n  var source_opt = {\r\n    url: parent.Capability.Request.GetMap.DCPType[0].HTTP.Get.OnlineResource, //parent.Service.OnlineResource,\r\n    projection: srs,\r\n    attributions: attributions,\r\n    crossOrigin: this.get('cors') ? 'anonymous' : null,\r\n    params: {\r\n      'LAYERS': caps.Name,\r\n      'FORMAT': format,\r\n      'VERSION': parent.version || '1.3.0'\r\n    }\r\n  }\r\n  // Resolution to zoom\r\n  var view = new ol.View({\r\n    projection: this.getMap().getView().getProjection()\r\n  })\r\n  view.setResolution(layer_opt.minResolution);\r\n  var maxZoom = Math.round(view.getZoom());\r\n  view.setResolution(layer_opt.maxResolution);\r\n  var minZoom = Math.round(view.getZoom());\r\n  // Fill form\r\n  this._fillForm({\r\n    title: layer_opt.title,\r\n    layers: source_opt.params.LAYERS,\r\n    format: source_opt.params.FORMAT,\r\n    minZoom: minZoom,\r\n    maxZoom: maxZoom,\r\n    extent: bbox ? bbox.join(',') : '',\r\n    projection: source_opt.projection,\r\n    attribution: source_opt.attributions[0] || '',\r\n    version: source_opt.params.VERSION\r\n  });\r\n  // Trace\r\n  if (this.get('trace')) {\r\n    var tso = JSON.stringify([ source_opt ], null, \"\\t\").replace(/\\\\\"/g,'\"');\r\n    layer_opt.source = \"SOURCE\"; \r\n    var t = \"new ol.layer.Tile (\" +JSON.stringify(layer_opt, null, \"\\t\")+ \")\" \r\n    t = t.replace(/\\\\\"/g,'\"')\r\n      .replace('\"SOURCE\"', \"new ol.source.TileWMS(\"+tso+\")\")\r\n      .replace(/\\\\t/g,\"\\t\").replace(/\\\\n/g,\"\\n\")\r\n      .replace(\"([\\n\\t\",\"(\")\r\n      .replace(\"}\\n])\",\"})\");\r\n    console.log(t);\r\n    delete layer_opt.source;\r\n  }\r\n  // Legend ?\r\n  var legend = [];\r\n    if (caps.Style) {\r\n    caps.Style.forEach(function(s) {\r\n      if (s.LegendURL) {\r\n        legend.push(s.LegendURL[0].OnlineResource);\r\n      }\r\n    });\r\n  }\r\n  return ({ \r\n    layer: layer_opt, \r\n    source: source_opt,\r\n    data: {\r\n      title: caps.Title,\r\n      abstract: caps.Abstract,\r\n      logo: caps.Attribution && caps.Attribution.LogoURL ? caps.Attribution.LogoURL.OnlineResource : undefined,\r\n      keyword: caps.KeywordList,\r\n      legend: legend,\r\n      opaque: caps.opaque,\r\n      queryable: caps.queryable\r\n    } \r\n  });\r\n};\r\n/** Get WMS options from control form\r\n * @return {*} options\r\n * @private\r\n */\r\nol.control.WMSCapabilities.prototype._getFormOptions = function() {\r\n  var minZoom = parseInt(this._elements.formMinZoom.value);\r\n  var maxZoom = parseInt(this._elements.formMaxZoom.value);\r\n  var view = new ol.View({\r\n    projection: this.getMap().getView().getProjection()\r\n  })\r\n  view.setZoom(minZoom);\r\n  var maxResolution = view.getResolution();\r\n  view.setZoom(maxZoom);\r\n  var minResolution = view.getResolution();\r\n  var ext = [];\r\n  if (this._elements.formExtent.value) {\r\n    this._elements.formExtent.value.split(',').forEach(function(b) {\r\n      ext.push(parseFloat(b));\r\n    })\r\n  }\r\n  if (ext.length !== 4) ext = undefined;\r\n  var attributions = []\r\n  if (this._elements.formAttribution.value) attributions.push(this._elements.formAttribution.value);\r\n  var options = {\r\n    layer: {\r\n      title: this._elements.formTitle.value,\r\n      extent: ext,\r\n      maxResolution: maxResolution,\r\n      minResolution: minResolution\r\n    },\r\n    source: {\r\n      url: this._elements.input.value,\r\n      crossOrigin: this._elements.formCrossOrigin.checked ? 'anonymous' : null,\r\n      projection: this._elements.formProjection.value,\r\n      attributions: attributions,\r\n      params: {\r\n        FORMAT: this._elements.formFormat.options[this._elements.formFormat.selectedIndex].value,\r\n        LAYERS: this._elements.formLayer.value,\r\n        VERSION: this._elements.formVersion.value\r\n      }\r\n    },\r\n    data: {\r\n      title: this._elements.formTitle.value\r\n    }\r\n  }\r\n  if (this._elements.formMap.value) options.source.params.MAP = this._elements.formMap.value;\r\n  return options;\r\n};\r\n/** Fill dialog form\r\n * @private\r\n */\r\nol.control.WMSCapabilities.prototype._fillForm = function(opt) {\r\n  this._elements.formTitle.value = opt.title;\r\n  this._elements.formLayer.value = opt.layers;\r\n  this._elements.formStyle.value = opt.style;\r\n  var o, i;\r\n  for (i=0; o=this._elements.formFormat.options[i]; i++) {\r\n    if (o.value === opt.format) {\r\n      this._elements.formFormat.selectedIndex = i;\r\n      break;\r\n    }\r\n  }\r\n  this._elements.formExtent.value = opt.extent || '';\r\n  this._elements.formMaxZoom.value = opt.maxZoom;\r\n  this._elements.formMinZoom.value = opt.minZoom;\r\n  this._elements.formProjection.value = opt.projection;\r\n  this._elements.formAttribution.value = opt.attribution;\r\n  this._elements.formVersion.value = opt.version;\r\n};\r\n/** Load a layer using service\r\n * @param {string} url service url\r\n * @param {string} layername\r\n * @param {function} [onload] callback function (or listen to 'load' event)\r\n */\r\nol.control.WMSCapabilities.prototype.loadLayer = function(url, layerName, onload) {\r\n  this.getCapabilities(url, {\r\n    onload: function(cap) {\r\n      if (cap) {\r\n        cap.Capability.Layer.Layer.forEach(function(l) {\r\n          if (l.Name===layerName || l.Identifier===layerName) {\r\n            var options = this.getOptionsFromCap(l, cap);\r\n            var layer = this.getLayerFromOptions(options);\r\n            this.dispatchEvent({ type: 'load', layer: layer, options: options });\r\n            if (typeof(onload) === 'function') onload({ layer: layer, options: options });\r\n          }\r\n        }.bind(this))\r\n      } else {\r\n        this.dispatchEvent({ type: 'load', error: true });\r\n      }\r\n    }.bind(this)\r\n  });\r\n};\r\n\r\n/** WMTSCapabilities\r\n * @constructor\r\n * @fires load\r\n * @fires capabilities\r\n * @extends {ol.control.WMSCapabilities}\r\n * @param {*} options\r\n *  @param {string|Element} options.target the target to set the dialog, use document.body to have fullwindow dialog\r\n *  @param {string} options.proxy proxy to use when requesting Getcapabilites, default none (suppose the service use CORS)\r\n *  @param {string} options.placeholder input placeholder, default 'service url...'\r\n *  @param {string} options.title dialog title, default 'WMS'\r\n *  @param {string} options.searchLabel Label for search button, default 'search'\r\n *  @param {string} options.loadLabel Label for load button, default 'load'\r\n *  @param {boolean} options.popupLayer Use a popup for the layers, default false\r\n *  @param {*} options.services a key/url object of services for quick access in a menu\r\n *  @param {Array<string>} options.srs an array of supported srs, default map projection code or 'EPSG:3857'\r\n *  @param {number} options.timeout Timeout for getCapabilities request, default 1000\r\n *  @param {boolean} options.cors Use CORS, default false\r\n *  @param {boolean} options.trace Log layer info, default false\r\n */\r\nol.control.WMTSCapabilities = function (options) {\r\n  options = options || {};\r\n  options.title = options.title || 'WMTS';\r\n  ol.control.WMSCapabilities.call(this, options);\r\n  this.getDialog().element.classList.add('ol-wmtscapabilities');\r\n};\r\nol.ext.inherits(ol.control.WMTSCapabilities, ol.control.WMSCapabilities);\r\n/** Get service parser\r\n * @private\r\n */\r\nol.control.WMTSCapabilities.prototype._getParser = function() {\r\n  var pars = new ol.format.WMTSCapabilities();\r\n  return {\r\n    read: function(data) {\r\n      var resp = pars.read(data);\r\n      resp.Capability = {\r\n        Layer: resp.Contents,\r\n      }\r\n      // Generic attribution for layers\r\n      resp.Capability.Layer.Attribution = {\r\n        Title: resp.ServiceProvider.ProviderName\r\n      }\r\n      // Remove non image format\r\n      var layers = [];\r\n      resp.Contents.Layer.forEach(function(l) {\r\n        if (l.Format && /jpeg|png/.test(l.Format[0])) {\r\n          layers.push(l);\r\n        }\r\n      })\r\n      resp.Contents.Layer = layers;\r\n      return resp;\r\n    }.bind(this)\r\n  }\r\n};\r\n/** Get Capabilities request parameters\r\n * @param {*} options\r\n */\r\nol.control.WMTSCapabilities.prototype.getRequestParam = function(options) {\r\n  return {\r\n    SERVICE: 'WMTS',\r\n    REQUEST: 'GetCapabilities',\r\n    VERSION: options.version || '1.0.0'\r\n  }\r\n};\r\n/** Get tile grid options only for EPSG:3857 projection\r\n * @returns {*}\r\n * @private\r\n */\r\nol.control.WMTSCapabilities.prototype._getTG = function(tileMatrixSet, minZoom, maxZoom) {\r\n  var matrixIds = new Array();\r\n  var resolutions = new Array();\r\n  var size = ol.extent.getWidth(ol.proj.get('EPSG:3857').getExtent()) / 256;\r\n  for (var z=0; z <= (maxZoom ? maxZoom : 20) ; z++) {\r\n    var id = tileMatrixSet !== 'PM' ? tileMatrixSet+':'+z : z;\r\n    matrixIds[z] = id ; \r\n    resolutions[z] = size / Math.pow(2, z);\r\n  }\r\n  return {\r\n    origin: [-20037508, 20037508],\r\n    resolutions: resolutions,\r\n    matrixIds: matrixIds,\r\n    minZoom: (minZoom ? minZoom : 0)\r\n  }\r\n};\r\n/** Get WMTS tile grid (only EPSG:3857)\r\n * @param {sting} tileMatrixSet\r\n * @param {number} minZoom\r\n * @param {number} maxZoom\r\n * @returns {ol.tilegrid.WMTS}\r\n * @private\r\n */\r\nol.control.WMTSCapabilities.prototype.getTileGrid = function(tileMatrixSet, minZoom, maxZoom) {\r\n  return new ol.tilegrid.WMTS(this._getTG(tileMatrixSet, minZoom, maxZoom));\r\n};\r\n/** Return a WMTS options for the given capabilities\r\n * @param {*} caps layer capabilities (read from the capabilities)\r\n * @param {*} parent capabilities\r\n * @return {*} options\r\n */\r\nol.control.WMTSCapabilities.prototype.getOptionsFromCap = function(caps, parent) {\r\n  var bbox = caps.WGS84BoundingBox;\r\n  if (bbox) bbox = ol.proj.transformExtent(bbox, 'EPSG:4326', this.getMap().getView().getProjection());\r\n  // Tilematrix zoom\r\n  var minZoom = Infinity, maxZoom = -Infinity;\r\n  var tmatrix;\r\n  caps.TileMatrixSetLink.forEach(function(tm) {\r\n    if (tm.TileMatrixSet === 'PM' || tm.TileMatrixSet === 'EPSG:3857') {\r\n      tmatrix = tm;\r\n      caps.TileMatrixSet = tm.TileMatrixSet;\r\n    }\r\n  });\r\n  if (!tmatrix) {\r\n    this.showError({ type: 'TileMatrix' });\r\n    return;\r\n  }\r\n  tmatrix.TileMatrixSetLimits.forEach(function(tm) {\r\n    var zoom = tm.TileMatrix.split(':').pop();\r\n    minZoom = Math.min(minZoom, parseInt(zoom));\r\n    maxZoom = Math.max(maxZoom, parseInt(zoom));\r\n  });\r\n  var view = new ol.View();\r\n  view.setZoom(minZoom);\r\n  var layer_opt = {\r\n    title: caps.Title,\r\n    extent: bbox,\r\n    abstract: caps.Abstract,\r\n    maxResolution: view.getResolution()\r\n  };\r\n  var source_opt = {\r\n    url: parent.OperationsMetadata.GetTile.DCP.HTTP.Get[0].href,\r\n    layer: caps.Identifier,\r\n    matrixSet: caps.TileMatrixSet,\r\n    format: caps.Format[0] || 'image/jpeg',\r\n    projection: 'EPSG:3857',\r\n    //tileGrid: tg,\r\n    minZoom: minZoom,\r\n    maxZoom: maxZoom,\r\n    style: caps.Style ? caps.Style[0].Identifier : 'normal',\r\n    attributions: caps.Attribution.Title,\r\n    crossOrigin: this.get('cors') ? 'anonymous' : null,\r\n    wrapX: (this.get('wrapX') !== false),\r\n  };\r\n  // Fill form\r\n  this._fillForm({\r\n    title: layer_opt.title,\r\n    layers: source_opt.layer,\r\n    style: source_opt.style,\r\n    format: source_opt.format,\r\n    minZoom: minZoom,\r\n    maxZoom: maxZoom,\r\n    extent: bbox ? bbox.join(',') : '',\r\n    projection: source_opt.projection,\r\n    attribution: source_opt.attributions || '',\r\n    version: '1.0.0'\r\n  });\r\n  // Trace\r\n  if (this.get('trace')) {\r\n    // Source\r\n    source_opt.tileGrid = 'TILEGRID';\r\n    var tso = JSON.stringify([ source_opt ], null, \"\\t\").replace(/\\\\\"/g,'\"');\r\n    tso = tso.replace('\"TILEGRID\"', 'new ol.tilegrid.WMTS('\r\n      + JSON.stringify(this._getTG(source_opt.matrixSet, source_opt.minZoom, source_opt.maxZoom), null, '\\t').replace(/\\n/g, '\\n\\t\\t')\r\n      + ')'\r\n    );\r\n    delete source_opt.tileGrid;\r\n    // Layer\r\n    layer_opt.source = \"SOURCE\";\r\n    var t = \"new ol.layer.Tile (\" +JSON.stringify(layer_opt, null, \"\\t\")+ \")\" \r\n    t = t.replace(/\\\\\"/g,'\"')\r\n      .replace('\"SOURCE\"', \"new ol.source.WMTS(\"+tso+\")\")\r\n      .replace(/\\\\t/g,\"\\t\").replace(/\\\\n/g,\"\\n\")\r\n      .replace(/\"tileGrid\": {/g, '\"tileGrid\": new ol.tilegrid.WMTS({')\r\n      .replace(/},\\n(\\t*)\"style\"/g, '}),\\n$1\"style\"')\r\n      .replace(\"([\\n\\t\",\"(\")\r\n      .replace(\"}\\n])\",\"})\");\r\n    console.log(t);\r\n    delete layer_opt.source;\r\n  }\r\n  return ({ \r\n    layer: layer_opt, \r\n    source: source_opt,\r\n    data: {\r\n      title: caps.Title,\r\n      abstract: caps.Abstract,\r\n      legend: caps.Style ? [ caps.Style[0].LegendURL[0].href ] : undefined,\r\n    } \r\n  });\r\n};\r\n/** Get WMS options from control form\r\n * @return {*} original original options \r\n * @return {*} options\r\n * @private\r\n */\r\nol.control.WMTSCapabilities.prototype._getFormOptions = function() {\r\n  var options = this._currentOptions || {};\r\n  if (!options.layer) options.layer = {};\r\n  if (!options.source) options.source = {};\r\n  if (!options.data) options.data = {};\r\n  var minZoom = parseInt(this._elements.formMinZoom.value) || 0;\r\n  var maxZoom = parseInt(this._elements.formMaxZoom.value) || 20;\r\n  var ext = [];\r\n  if (this._elements.formExtent.value) {\r\n    this._elements.formExtent.value.split(',').forEach(function(b) {\r\n      ext.push(parseFloat(b));\r\n    })\r\n  }\r\n  if (ext.length !== 4) ext = undefined;\r\n  var attributions = []\r\n  if (this._elements.formAttribution.value) attributions.push(this._elements.formAttribution.value);\r\n  var view = new ol.View({\r\n    projection: this.getMap().getView().getProjection()\r\n  })\r\n  view.setZoom(minZoom);\r\n  var layer_opt = {\r\n    title: this._elements.formTitle.value,\r\n    extent: ext,\r\n    abstract: options.layer.abstract || '',\r\n    maxResolution: view.getResolution()\r\n  }\r\n  var source_opt = {\r\n    url: this._elements.input.value,\r\n    layer: this._elements.formLayer.value,\r\n    matrixSet: options.source.matrixSet || 'PM',\r\n    format: this._elements.formFormat.options[this._elements.formFormat.selectedIndex].value,\r\n    projection: 'EPSG:3857',\r\n    minZoom: minZoom,\r\n    maxZoom: maxZoom,\r\n    // tileGrid: this._getTG(options.source.matrixSet || 'PM', minZoom, maxZoom),\r\n    style: this._elements.formStyle.value || 'normal',\r\n    attributions: attributions,\r\n    crossOrigin: this._elements.formCrossOrigin.checked ? 'anonymous' : null,\r\n    wrapX: (this.get('wrapX') !== false),\r\n  }\r\n  return ({ \r\n    layer: layer_opt, \r\n    source: source_opt,\r\n    data: {\r\n      title: this._elements.formTitle.value,\r\n      abstract: options.data.abstract,\r\n      legend: options.data.legend,\r\n    } \r\n  });\r\n};\r\n/** Create a new layer using options received by getOptionsFromCap method\r\n * @param {*} options\r\n */\r\nol.control.WMTSCapabilities.prototype.getLayerFromOptions = function (options) {\r\n  if (!options) return;\r\n  options.source.tileGrid = this.getTileGrid(options.source.matrixSet, options.source.minZoom, options.source.maxZoom);\r\n  options.layer.source = new ol.source.WMTS(options.source);\r\n  var layer = new ol.layer.Tile(options.layer);\r\n  // Restore options\r\n  delete options.layer.source;\r\n  delete options.source.tileGrid;\r\n  return layer;\r\n};\r\n\r\n/*\r\n  Copyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Feature animation base class\r\n * Use the {@link ol.Map#animateFeature} or {@link ol.layer.Vector#animateFeature} to animate a feature\r\n * on postcompose in a map or a layer\r\n* @constructor\r\n* @fires animationstart\r\n* @fires animating\r\n* @fires animationend\r\n* @param {ol.featureAnimationOptions} options\r\n*\t@param {Number} options.duration duration of the animation in ms, default 1000\r\n*\t@param {bool} options.revers revers the animation direction\r\n*\t@param {Number} options.repeat number of time to repeat the animation, default 0\r\n*\t@param {ol.style.Style} options.hiddenStyle a style to display the feature when playing the animation\r\n*\t  to be used to make the feature selectable when playing animation \r\n*\t  (@see {@link ../examples/map.featureanimation.select.html}), default the feature \r\n*\t  will be hidden when playing (and not selectable)\r\n*\t@param {ol.easing.Function} options.fade an easing function used to fade in the feature, default none\r\n*\t@param {ol.easing.Function} options.easing an easing function for the animation, default ol.easing.linear\r\n*/\r\nol.featureAnimation = function(options) {\r\n  options = options || {};\r\n  this.duration_ = typeof (options.duration)=='number' ? (options.duration>=0 ? options.duration : 0) : 1000;\r\n  this.fade_ = typeof(options.fade) == 'function' ? options.fade : null;\r\n  this.repeat_ = Number(options.repeat);\r\n  var easing = typeof(options.easing) =='function' ? options.easing : ol.easing.linear;\r\n  if (options.revers) this.easing_ = function(t) { return (1 - easing(t)); };\r\n  else this.easing_ = easing;\r\n  this.hiddenStyle = options.hiddenStyle;\r\n  ol.Object.call(this);\r\n};\r\nol.ext.inherits(ol.featureAnimation, ol.Object);\r\n/** Hidden style: a transparent style\r\n */\r\nol.featureAnimation.hiddenStyle = new ol.style.Style({ \r\n  image: new ol.style.Circle({}), \r\n  stroke: new ol.style.Stroke({ \r\n    color: 'transparent' \r\n  }) \r\n});\r\n/** Draw a geometry \r\n* @param {olx.animateFeatureEvent} e\r\n* @param {ol.geom} geom geometry for shadow\r\n* @param {ol.geom} shadow geometry for shadow (ie. style with zIndex = -1)\r\n* @private\r\n*/\r\nol.featureAnimation.prototype.drawGeom_ = function (e, geom, shadow) {\r\n  if (this.fade_) {\r\n    e.context.globalAlpha = this.fade_(1-e.elapsed);\r\n  }\r\n  var style = e.style;\r\n  for (var i=0; i<style.length; i++) {\r\n    // Prevent crach if the style is not ready (image not loaded)\r\n    try {\r\n      var vectorContext = e.vectorContext || ol.render.getVectorContext(e);\r\n      vectorContext.setStyle(style[i]);\r\n      if (style[i].getZIndex()<0) vectorContext.drawGeometry(shadow||geom);\r\n      else vectorContext.drawGeometry(geom);\r\n    } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** Function to perform manipulations onpostcompose. \r\n * This function is called with an ol.featureAnimationEvent argument.\r\n * The function will be overridden by the child implementation.    \r\n * Return true to keep this function for the next frame, false to remove it.\r\n * @param {ol.featureAnimationEvent} e\r\n * @return {bool} true to continue animation.\r\n * @api \r\n */\r\nol.featureAnimation.prototype.animate = function (/* e */) {\r\n  return false;\r\n};\r\n/** An animation controler object an object to control animation with start, stop and isPlaying function.    \r\n * To be used with {@link olx.Map#animateFeature} or {@link ol.layer.Vector#animateFeature}\r\n * @typedef {Object} animationControler\r\n * @property {function} start - start animation.\r\n * @property {function} stop - stop animation option arguments can be passed in animationend event.\r\n * @property {function} isPlaying - return true if animation is playing.\r\n */\r\n/** Animate feature on a map\r\n * @function \r\n * @param {ol.Feature} feature Feature to animate\r\n * @param {ol.featureAnimation|Array<ol.featureAnimation>} fanim the animation to play\r\n * @return {animationControler} an object to control animation with start, stop and isPlaying function\r\n */\r\nol.Map.prototype.animateFeature = function(feature, fanim) {\r\n  // Get or create an animation layer associated with the map \r\n  var layer = this._featureAnimationLayer;\r\n  if (!layer) {\r\n    layer = this._featureAnimationLayer = new ol.layer.Vector({ source: new ol.source.Vector() });\r\n    layer.setMap(this);\r\n  }\r\n  // Animate feature on this layer\r\n  layer.getSource().addFeature(feature);\r\n  var listener = fanim.on('animationend', function(e) {\r\n    if (e.feature===feature) {\r\n      // Remove feature on end\r\n      layer.getSource().removeFeature(feature);\r\n      ol.Observable.unByKey(listener);\r\n    }\r\n  });\r\n  layer.animateFeature(feature, fanim);\r\n};\r\n/** Animate feature on a vector layer \r\n * @fires animationstart, animationend\r\n * @param {ol.Feature} feature Feature to animate\r\n * @param {ol.featureAnimation|Array<ol.featureAnimation>} fanim the animation to play\r\n * @param {boolean} useFilter use the filters of the layer\r\n * @return {animationControler} an object to control animation with start, stop and isPlaying function\r\n */\r\nol.layer.Base.prototype.animateFeature = function(feature, fanim, useFilter) {\r\n  var self = this;\r\n  var listenerKey;\r\n  // Save style\r\n  var style = feature.getStyle();\r\n  var flashStyle = style || (this.getStyleFunction ? this.getStyleFunction()(feature) : null);\r\n  if (!flashStyle) flashStyle=[];\r\n  if (!(flashStyle instanceof Array)) flashStyle = [flashStyle];\r\n  // Structure pass for animating\r\n  var event = {\r\n    // Frame context\r\n    vectorContext: null,\r\n    frameState: null,\r\n    start: 0,\r\n    time: 0,\r\n    elapsed: 0,\r\n    extent: false,\r\n    // Feature information\r\n    feature: feature,\r\n    geom: feature.getGeometry(),\r\n    typeGeom: feature.getGeometry().getType(),\r\n    bbox: feature.getGeometry().getExtent(),\r\n    coord: ol.extent.getCenter(feature.getGeometry().getExtent()),\r\n    style: flashStyle\r\n  };\r\n  if (!(fanim instanceof Array)) fanim = [fanim];\r\n  // Remove null animations\r\n  for (var i=fanim.length-1; i>=0; i--) {\r\n    if (fanim[i].duration_===0) fanim.splice(i,1);\r\n  }\r\n  var nb=0, step = 0;\r\n  // Filter availiable on the layer\r\n  var filters = (useFilter && this.getFilters) ? this.getFilters() : [];\r\n  function animate(e) {\r\n    event.type = e.type;\r\n    try {\r\n      event.vectorContext = e.vectorContext || ol.render.getVectorContext(e);\r\n    } catch(e) { /* nothing todo */ }\r\n    event.frameState = e.frameState;\r\n    event.inversePixelTransform = e.inversePixelTransform;\r\n    if (!event.extent) {\r\n      event.extent = e.frameState.extent;\r\n      event.start = e.frameState.time;\r\n      event.context = e.context;\r\n    }\r\n    event.time = e.frameState.time - event.start;\r\n    event.elapsed = event.time / fanim[step].duration_;\r\n    if (event.elapsed > 1) event.elapsed = 1;\r\n    // Filter\r\n    e.context.save();\r\n    filters.forEach(function(f) {\r\n      if (f.get('active')) f.precompose(e);\r\n    });\r\n    if (this.getOpacity) {\r\n      e.context.globalAlpha = this.getOpacity();\r\n    }\r\n    // Stop animation?\r\n    if (!fanim[step].animate(event)) {\r\n      nb++;\r\n      // Repeat animation\r\n      if (nb < fanim[step].repeat_) {\r\n        event.extent = false;\r\n      } else if (step < fanim.length-1) {\r\n        // newt step\r\n        fanim[step].dispatchEvent({ type:'animationend', feature: feature });\r\n        step++;\r\n        nb=0;\r\n        event.extent = false;\r\n      } else {\r\n        // the end\r\n        stop();\r\n      }\r\n    } else {\r\n      var animEvent = { \r\n        type: 'animating', \r\n        step: step,\r\n        start: event.start,\r\n        time: event.time,\r\n        elapsed: event.elapsed,\r\n        rotation: event.rotation||0,\r\n        geom: event.geom,\r\n        coordinate: event.coord,\r\n        feature: feature \r\n      };\r\n      fanim[step].dispatchEvent(animEvent);\r\n      self.dispatchEvent(animEvent);\r\n    }\r\n    filters.forEach(function(f) {\r\n      if (f.get('active')) f.postcompose(e);\r\n    });\r\n    e.context.restore();\r\n    // tell OL3 to continue postcompose animation\r\n    e.frameState.animate = true;\r\n  }\r\n  // Stop animation\r\n  function stop(options) {\r\n    ol.Observable.unByKey(listenerKey);\r\n    listenerKey = null;\r\n    feature.setStyle(style);\r\n    // Send event\r\n    var event = { type:'animationend', feature: feature };\r\n    if (options) {\r\n      for (var i in options) if (options.hasOwnProperty(i)) {\r\n        event[i] = options[i]; \r\n      }\r\n    }\r\n    fanim[step].dispatchEvent(event);\r\n    self.dispatchEvent(event);\r\n  }\r\n  // Launch animation\r\n  function start(options) {\r\n    if (fanim.length && !listenerKey) {\r\n      listenerKey = self.on(['postcompose','postrender'], animate.bind(self));\r\n      // map or layer?\r\n      if (self.renderSync) {\r\n        try { self.renderSync(); } catch(e) { /* ok */ }\r\n      } else {\r\n        self.changed();\r\n      }\r\n      // Hide feature while animating\r\n      feature.setStyle(fanim[step].hiddenStyle || ol.featureAnimation.hiddenStyle);\r\n      // Send event\r\n      var event = { type:'animationstart', feature: feature };\r\n      if (options) {\r\n        for (var i in options) if (options.hasOwnProperty(i)) {\r\n          event[i] = options[i]; \r\n        }\r\n      }\r\n      fanim[step].dispatchEvent(event);\r\n      self.dispatchEvent(event);\r\n    }\r\n  }\r\n  start();\r\n  // Return animation controler\r\n  return {\r\n    start: start,\r\n    stop: stop,\r\n    isPlaying: function() { return (!!listenerKey); }\r\n  };\r\n};\r\n\r\n/*\r\n  Copyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Blink a feature\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationOptions} options\r\n *  @param {Number} options.nb number of blink, default 10\r\n */\r\nol.featureAnimation.Blink = function(options) {\r\n  ol.featureAnimation.call(this, options);\r\n  this.set('nb', options.nb || 10)\r\n}\r\nol.ext.inherits(ol.featureAnimation.Blink, ol.featureAnimation);\r\n/** Animate: Show or hide feature depending on the laptimes\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Blink.prototype.animate = function (e) {\t\r\n  if (!(Math.round(this.easing_(e.elapsed)*this.get('nb'))%2)) {\r\n    this.drawGeom_(e, e.geom);\r\n  }\r\n  return (e.time <= this.duration_);\r\n}\r\n\r\n/*\r\n\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Bounce animation: \r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationBounceOptions} options\r\n *\t@param {Integer} options.bounce number of bounce, default 3\r\n *\t@param {Integer} options.amplitude bounce amplitude,default 40\r\n *\t@param {ol.easing} options.easing easing used for decaying amplitude, use function(){return 0} for no decay, default ol.easing.linear\r\n *\t@param {Integer} options.duration duration in ms, default 1000\r\n */\r\nol.featureAnimation.Bounce = function(options)\r\n{\toptions = options || {};\r\n\tol.featureAnimation.call(this, options);\r\n\tthis.amplitude_ = options.amplitude || 40;\r\n\tthis.bounce_ = -Math.PI*(options.bounce || 3);\r\n}\r\nol.ext.inherits(ol.featureAnimation.Bounce, ol.featureAnimation);\r\n/** Animate\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Bounce.prototype.animate = function (e)\r\n{\t// Animate\r\n\tvar flashGeom = e.geom.clone();\r\n\t/*\r\n\tvar t = this.easing_(e.elapsed)\r\n\tt = Math.abs(Math.sin(this.bounce_*t)) * this.amplitude_ * (1-t) * e.frameState.viewState.resolution;\r\n\t*/\r\n\tvar t = Math.abs(Math.sin(this.bounce_*e.elapsed)) * this.amplitude_ * (1-this.easing_(e.elapsed)) * e.frameState.viewState.resolution;\r\n\tflashGeom.translate(0, t);\r\n\tthis.drawGeom_(e, flashGeom, e.geom);\r\n\treturn (e.time <= this.duration_);\r\n}\r\n\r\n/*\r\n\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Drop animation: drop a feature on the map\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationDropOptions} options\r\n *  @param {Number} options.speed speed of the feature if 0 the duration parameter will be used instead, default 0\r\n *  @param {Number} options.side top or bottom, default top\r\n */\r\nol.featureAnimation.Drop = function(options)\r\n{\toptions = options || {};\r\n\tthis.speed_ = options.speed || 0;\r\n\tol.featureAnimation.call(this, options);\r\n\tthis.side_ = options.side || 'top';\r\n}\r\nol.ext.inherits(ol.featureAnimation.Drop, ol.featureAnimation);\r\n/** Animate\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Drop.prototype.animate = function (e)\r\n{\t// First time > calculate duration / speed\r\n\tif (!e.time) \r\n\t{\tvar angle = e.frameState.viewState.rotation;\r\n\t\tvar s = e.frameState.size[1] * e.frameState.viewState.resolution;\r\n\t\tif (this.side_!='top') s *= -1;\r\n\t\tthis.dx = -Math.sin(angle)*s;\r\n\t\tthis.dy = Math.cos(angle)*s;\r\n\t\tif (this.speed_) \r\n\t\t{\tthis.duration_ = s/this.speed_/e.frameState.viewState.resolution;\r\n\t\t}\r\n\t}\r\n\t// Animate\r\n\tvar flashGeom = e.geom.clone();\r\n\tflashGeom.translate(\r\n\t\tthis.dx*(1-this.easing_(e.elapsed)),  \r\n\t\tthis.dy*(1-this.easing_(e.elapsed))\r\n\t);\r\n\tthis.drawGeom_(e, flashGeom, e.geom);\r\n\treturn (e.time <= this.duration_);\r\n}\r\n\r\n/*\r\n\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Fade animation: feature fade in\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationOptions} options\r\n */\r\nol.featureAnimation.Fade = function(options)\r\n{\toptions = options || {};\r\n\tthis.speed_ = options.speed || 0;\r\n\tol.featureAnimation.call(this, options);\r\n}\r\nol.ext.inherits(ol.featureAnimation.Fade, ol.featureAnimation);\r\n/** Animate\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Fade.prototype.animate = function (e)\r\n{\te.context.globalAlpha = this.easing_(e.elapsed);\r\n\tthis.drawGeom_(e, e.geom);\r\n\treturn (e.time <= this.duration_);\r\n}\r\n\r\n/*\r\n\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Do nothing for a given duration\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationShowOptions} options\r\n * \r\n */\r\nol.featureAnimation.None = function(options)\r\n{\tol.featureAnimation.call(this, options);\r\n};\r\nol.ext.inherits(ol.featureAnimation.None, ol.featureAnimation);\r\n/** Animate: do nothing during the laps time\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.None.prototype.animate = function (e)\r\n{\t\r\n\treturn (e.time <= this.duration_);\r\n};\r\n\r\n/*\r\n  Copyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Do nothing \r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n */\r\nol.featureAnimation.Null = function() {\r\n  ol.featureAnimation.call(this, { duration:0 });\r\n};\r\nol.ext.inherits(ol.featureAnimation.Null, ol.featureAnimation);\r\n\r\n/*\r\n  Copyright (c) 2016-2018 Jean-Marc VIGLINO, \r\n  released under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Path animation: feature follow a path\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationPathOptions} options extend ol.featureAnimation options\r\n *  @param {Number} options.speed speed of the feature, if 0 the duration parameter will be used instead, default 0\r\n *  @param {Number|boolean} options.rotate rotate the symbol when following the path, true or the initial rotation, default false\r\n *  @param {ol.geom.LineString|ol.Feature} options.path the path to follow\r\n *  @param {Number} options.duration duration of the animation in ms\r\n */\r\nol.featureAnimation.Path = function(options){\r\n  options = options || {};\r\n  ol.featureAnimation.call(this, options);\r\n  this.speed_ = options.speed || 0;\r\n  this.path_ = options.path;\r\n  switch (options.rotate) {\r\n    case true: \r\n    case 0:\r\n      this.rotate_ = 0;\r\n      break;\r\n    default:\r\n      this.rotate_ = options.rotate || false;\r\n      break;\r\n  }\r\n  if (this.path_ && this.path_.getGeometry) this.path_ = this.path_.getGeometry();\r\n  if (this.path_ && this.path_.getLineString) this.path_ = this.path_.getLineString();\r\n  if (this.path_.getLength) {\r\n    this.dist_ = this.path_.getLength()\r\n    if (this.path_ && this.path_.getCoordinates) this.path_ = this.path_.getCoordinates();\r\n  } else {\r\n    this.dist_ = 0;\r\n  }\r\n  if (this.speed_>0) this.duration_ = this.dist_/this.speed_;\r\n}\r\nol.ext.inherits(ol.featureAnimation.Path, ol.featureAnimation);\r\n/** Animate\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Path.prototype.animate = function (e) {\r\n  // First time \r\n  if (!e.time) {\r\n    if (!this.dist_) return false;\r\n  }\r\n  var dmax = this.dist_*this.easing_(e.elapsed);\r\n  var p0, p, s, dx,dy, dl, d = 0;\r\n  p = this.path_[0];\r\n  // Linear interpol\r\n  for (var i = 1; i<this.path_.length; i++) {\r\n    p0 = p;\r\n    p = this.path_[i];\r\n    dx = p[0]-p0[0];\r\n    dy = p[1]-p0[1];\r\n    dl = Math.sqrt(dx*dx+dy*dy);\r\n    if (dl && d+dl>=dmax) {\r\n      s = (dmax-d)/dl;\r\n      p = [ p0[0] + (p[0]-p0[0])*s, p0[1] + (p[1]-p0[1])*s];\r\n      break;\r\n    }\r\n    d += dl;\r\n  }\r\n  // Rotate symbols\r\n  var style = e.style;\r\n  e.rotation = Math.PI/2 + Math.atan2(p0[1] - p[1], p0[0] - p[0]);\r\n  if (this.rotate_!==false) {\r\n    var st = []\r\n    var angle = this.rotate_ - e.rotation + e.frameState.viewState.rotation;\r\n    e.rotation = Math.PI/2 + Math.atan2(p0[1] - p[1], p0[0] - p[0]);\r\n    for (var k=0; s=e.style[k]; k++) {\r\n      if (s.getImage()) {\r\n        //s = s.clone();\r\n        s.getImage().setRotation(angle);\r\n      }\r\n      st.push(s);\r\n    }\r\n    // Rotated style\r\n    e.style = st;\r\n  }\r\n  e.geom.setCoordinates(p);\r\n  // Animate\r\n  this.drawGeom_(e, e.geom);\r\n  // restore style (if modify by rotation)\r\n  e.style = style;\r\n  return (e.time <= this.duration_);\r\n}\r\n\r\n/*\r\n\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Shakee animation: \r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationShakeOptions} options\r\n *\t@param {Integer} options.bounce number o bounds, default 6\r\n *\t@param {Integer} options.amplitude amplitude of the animation, default 40\r\n *\t@param {bool} options.horizontal shake horizontally default false (vertical)\r\n */\r\nol.featureAnimation.Shake = function(options)\r\n{\toptions = options || {};\r\n\tol.featureAnimation.call(this, options);\r\n//\tthis.easing_ = options.easing_ || function(t){return (0.5+t)*t -0.5*t ;};\r\n\tthis.amplitude_ = options.amplitude || 40;\r\n\tthis.bounce_ = -Math.PI*(options.bounce || 6);\r\n\tthis.horizontal_ = options.horizontal;\r\n}\r\nol.ext.inherits(ol.featureAnimation.Shake, ol.featureAnimation);\r\n/** Animate\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Shake.prototype.animate = function (e)\r\n{\t// Animate\r\n\tvar flashGeom = e.geom.clone();\r\n\tvar shadow = e.geom.clone();\r\n\tvar t = this.easing_(e.elapsed)\r\n\tt = Math.sin(this.bounce_*t) * this.amplitude_ * (1-t) * e.frameState.viewState.resolution;\r\n\tif (this.horizontal_) \r\n\t{\tflashGeom.translate(t, 0);\r\n\t\tshadow.translate(t, 0);\r\n\t}\r\n\telse flashGeom.translate(0, t);\r\n\tthis.drawGeom_(e, flashGeom, shadow);\r\n\treturn (e.time <= this.duration_);\r\n}\r\n\r\n/*\r\n  Copyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Show an object for a given duration\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationOptions} options\r\n */\r\nol.featureAnimation.Show = function(options) {\r\n  ol.featureAnimation.call(this, options);\r\n}\r\nol.ext.inherits(ol.featureAnimation.Show, ol.featureAnimation);\r\n/** Animate: just show the object during the laps time\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Show.prototype.animate = function (e) {\t\r\n  this.drawGeom_(e, e.geom);\r\n  return (e.time <= this.duration_);\r\n}\r\n\r\n/*\r\n\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Slice animation: feature enter from left\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationSlideOptions} options\r\n *  @param {Number} options.speed speed of the animation, if 0 the duration parameter will be used instead, default 0\r\n */\r\nol.featureAnimation.Slide = function(options)\r\n{\toptions = options || {};\r\n\tthis.speed_ = options.speed || 0;\r\n\tol.featureAnimation.call(this, options);\r\n\tthis.side_ = options.side || 'left';\r\n}\r\nol.ext.inherits(ol.featureAnimation.Slide, ol.featureAnimation);\r\n/** Animate\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Slide.prototype.animate = function (e)\r\n{\t// First time > calculate duration / speed\r\n\tif (!e.time) \r\n\t{\tif (this.side_=='left') this.dx = (e.extent[0]-e.bbox[2])\r\n\t\telse this.dx = (e.extent[2]-e.bbox[0])\r\n\t\tif (this.speed_) this.duration_ = Math.abs(this.dx)/this.speed_/e.frameState.viewState.resolution;\r\n\t}\r\n\t// Animate\r\n\tvar flashGeom = e.geom.clone();\r\n\tflashGeom.translate(this.dx*(1-this.easing_(e.elapsed)), 0);\r\n\tthis.drawGeom_(e, flashGeom);\r\n\treturn (e.time <= this.duration_);\r\n}\r\n\r\n/*\r\n\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Teleport a feature at a given place\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationOptions} options\r\n */\r\nol.featureAnimation.Teleport = function(options)\r\n{\tol.featureAnimation.call(this, options);\r\n}\r\nol.ext.inherits(ol.featureAnimation.Teleport, ol.featureAnimation);\r\n/** Animate\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Teleport.prototype.animate = function (e)\r\n{\tvar sc = this.easing_(e.elapsed);\r\n\tif (sc)\r\n\t{\te.context.save()\r\n\t\t\tvar ratio = e.frameState.pixelRatio;\r\n\t\t\te.context.globalAlpha = sc;\r\n\t\t\te.context.scale(sc,1/sc);\r\n\t\t\tvar m = e.frameState.coordinateToPixelTransform;\r\n\t\t\tvar dx = (1/sc-1) * ratio * (m[0]*e.coord[0] + m[1]*e.coord[1] +m[4]);\r\n\t\t\tvar dy = (sc-1) * ratio * (m[2]*e.coord[0] + m[3]*e.coord[1] +m[5]);\r\n\t\t\te.context.translate(dx,dy);\r\n\t\t\tthis.drawGeom_(e, e.geom);\r\n\t\te.context.restore()\r\n\t}\r\n\treturn (e.time <= this.duration_);\r\n}\r\n\r\n/*\r\n\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Slice animation: feature enter from left\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationThrowOptions} options\r\n *  @param {left|right} options.side side of the animation, default left\r\n */\r\nol.featureAnimation.Throw = function(options)\r\n{\toptions = options || {};\r\n\tol.featureAnimation.call(this, options);\r\n\tthis.speed_ = options.speed || 0;\r\n\tthis.side_ = options.side || 'left';\r\n}\r\nol.ext.inherits(ol.featureAnimation.Throw, ol.featureAnimation);\r\n/** Animate\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Throw.prototype.animate = function (e)\r\n{\t// First time > calculate duration / speed\r\n\tif (!e.time && this.speed_) \r\n\t{\tvar dx, dy;\r\n\t\tif (this.side_=='left')\r\n\t\t{\tdx = this.dx = e.extent[0]-e.bbox[2];\r\n\t\t\tdy = this.dy = e.extent[3]-e.bbox[1];\r\n\t\t}\r\n\t\telse\r\n\t\t{\tdx = this.dx = e.extent[2]-e.bbox[0];\r\n\t\t\tdy = this.dy = e.extent[3]-e.bbox[1];\r\n\t\t}\r\n\t\tthis.duration_ = Math.sqrt(dx*dx+dy*dy)/this.speed_/e.frameState.viewState.resolution;\r\n\t}\r\n\t// Animate\r\n\tvar flashGeom = e.geom.clone();\r\n\tvar shadow = e.geom.clone();\r\n\tflashGeom.translate(this.dx*(1-this.easing_(e.elapsed)), \r\n\t\tthis.dy*Math.cos(Math.PI/2*this.easing_(e.elapsed)));\r\n\tshadow.translate(this.dx*(1-this.easing_(e.elapsed)), 0);\r\n\tthis.drawGeom_(e, flashGeom, shadow);\r\n\treturn (e.time <= this.duration_);\r\n}\r\n\r\n/*\r\n  Copyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL license (http://www.cecill.info/).\r\n*/\r\n/** Zoom animation: feature zoom in (for points)\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationZoomOptions} options\r\n *  @param {bool} options.zoomOut to zoom out\r\n */\r\nol.featureAnimation.Zoom = function(options){\r\n  options = options || {};\r\n  ol.featureAnimation.call(this, options);\r\n  this.set('zoomout', options.zoomOut);\r\n}\r\nol.ext.inherits(ol.featureAnimation.Zoom, ol.featureAnimation);\r\n/** Zoom animation: feature zoom out (for points)\r\n * @constructor\r\n * @extends {ol.featureAnimation}\r\n * @param {ol.featureAnimationZoomOptions} options\r\n */\r\nol.featureAnimation.ZoomOut = function(options) {\r\n  options = options || {};\r\n  options.zoomOut = true;\r\n  ol.featureAnimation.Zoom.call(this, options);\r\n}\r\nol.ext.inherits(ol.featureAnimation.ZoomOut, ol.featureAnimation.Zoom);\r\n/** Animate\r\n* @param {ol.featureAnimationEvent} e\r\n*/\r\nol.featureAnimation.Zoom.prototype.animate = function (e) {\r\n  var fac = this.easing_(e.elapsed);\r\n  if (fac) {\r\n    if (this.get('zoomout')) fac  = 1/fac;\r\n    var style = e.style;\r\n    var i, imgs, sc=[]\r\n    for (i=0; i<style.length; i++) {\r\n      imgs = style[i].getImage();\r\n      if (imgs) {\r\n        sc[i] = imgs.getScale();\r\n        // ol >= v6\r\n        if (e.type==='postrender') imgs.setScale(sc[i]*fac/e.frameState.pixelRatio);\r\n        else imgs.setScale(sc[i]*fac);\r\n      }\r\n    }\r\n    this.drawGeom_(e, e.geom);\r\n    for (i=0; i<style.length; i++) {\r\n      imgs = style[i].getImage();\r\n      if (imgs) imgs.setScale(sc[i]);\r\n    }\r\n  }\r\n/*\r\n  var sc = this.easing_(e.elapsed);\r\n  if (sc)\r\n  {\te.context.save()\r\n    console.log(e)\r\n      var ratio = e.frameState.pixelRatio;\r\n      var m = e.frameState.coordinateToPixelTransform;\r\n      var dx = (1/(sc)-1)* ratio * (m[0]*e.coord[0] + m[1]*e.coord[1] +m[4]);\r\n      var dy = (1/(sc)-1)*ratio * (m[2]*e.coord[0] + m[3]*e.coord[1] +m[5]);\r\n      e.context.scale(sc,sc);\r\n      e.context.translate(dx,dy);\r\n      this.drawGeom_(e, e.geom);\r\n    e.context.restore()\r\n  }\r\n*/\r\n  return (e.time <= this.duration_);\r\n}\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/* Namespace */\r\nol.filter = {};\r\n/**\r\n * @classdesc \r\n * Abstract base class; normally only used for creating subclasses and not instantiated in apps.    \r\n * Used to create filters    \r\n * Use {@link ol.layer.Base#addFilter}, {@link ol.layer.Base#removeFilter} or {@link ol.layer.Base#getFilters}\r\n * to handle filters on layers.\r\n *\r\n * @constructor\r\n * @extends {ol.Object}\r\n * @param {Object} options Extend {@link _ol_control_Control_} options.\r\n *  @param {boolean} [options.active]\r\n */\r\nol.filter.Base = function(options) {\r\n  ol.Object.call(this, options);\r\n  // Array of postcompose listener\r\n  this._listener = [];\r\n  if (options && options.active===false) this.set('active', false);\r\n  else this.set('active', true);\r\n};\r\nol.ext.inherits(ol.filter.Base, ol.Object);\r\n/** Activate / deactivate filter\r\n*\t@param {boolean} b\r\n*/\r\nol.filter.Base.prototype.setActive = function (b) {\r\n  this.set('active', b===true);\r\n};\r\n/** Get filter active\r\n*\t@return {boolean}\r\n*/\r\nol.filter.Base.prototype.getActive = function () {\r\n  return this.get('active');\r\n};\r\n(function(){\r\n/** Internal function\r\n* @this {ol.filter} this the filter\r\n* @private\r\n*/\r\nfunction precompose_(e) {\r\n  if (this.get('active') && e.context) this.precompose(e);\r\n}\r\n/** Internal function\r\n* @this {ol.filter} this the filter\r\n* @private\r\n*/\r\nfunction postcompose_(e) {\r\n  if (this.get('active') && e.context) this.postcompose(e);\r\n}\r\n/** Force filter redraw / Internal function\r\n* @this {ol.Map|ol.layer.Layer} this: the map or layer the filter is added to\r\n* @private\r\n*/\r\nfunction filterRedraw_(/* e */) {\r\n  if (this.renderSync) {\r\n    try { this.renderSync(); } catch(e) { /* ok */ }\r\n  } else {\r\n    this.changed(); \r\n  }\r\n}\r\n/** Add a filter to an ol object\r\n* @this {ol.Map|ol.layer.Layer} this: the map or layer the filter is added to\r\n* @private\r\n*/\r\nfunction addFilter_(filter) {\r\n  if (!this.filters_) this.filters_ = [];\r\n  this.filters_.push(filter);\r\n  if (filter.addToLayer) filter.addToLayer(this);\r\n  if (filter.precompose) filter._listener.push ( { listener: this.on(['precompose','prerender'], precompose_.bind(filter)), target: this });\r\n  if (filter.postcompose) filter._listener.push ( { listener: this.on(['postcompose','postrender'], postcompose_.bind(filter)), target: this });\r\n  filter._listener.push ( { listener: filter.on('propertychange', filterRedraw_.bind(this)), target: this });\r\n  filterRedraw_.call (this);\r\n}\r\n/** Remove a filter to an ol object\r\n* @this {ol.Map|ol.layer.Layer} this: the map or layer the filter is added to\r\n* @private\r\n*/\r\nfunction removeFilter_(filter) {\r\n  var i\r\n  if (!this.filters_) this.filters_ = [];\r\n  for (i=this.filters_.length-1; i>=0; i--) {\r\n    if (this.filters_[i]===filter) this.filters_.splice(i,1);\r\n  }\r\n  for (i=filter._listener.length-1; i>=0; i--) {\r\n    // Remove listener on this object\r\n    if (filter._listener[i].target === this) {\r\n      if (filter.removeFromLayer) filter.removeFromLayer(this);\r\n      ol.Observable.unByKey(filter._listener[i].listener);\r\n      filter._listener.splice(i,1);\r\n    }\r\n  }\r\n  filterRedraw_.call (this);\r\n}\r\n/** Add a filter to an ol.Map\r\n*\t@param {ol.filter}\r\n*/\r\nol.Map.prototype.addFilter = function (filter) {\r\n  console.warn('[OL-EXT] addFilter deprecated on map.')\r\n  addFilter_.call (this, filter);\r\n};\r\n/** Remove a filter to an ol.Map\r\n*\t@param {ol.filter}\r\n*/\r\nol.Map.prototype.removeFilter = function (filter) {\r\n  removeFilter_.call (this, filter);\r\n};\r\n/** Get filters associated with an ol.Map\r\n*\t@return {Array<ol.filter>}\r\n*/\r\nol.Map.prototype.getFilters = function () {\r\n  return this.filters_ || [];\r\n};\r\n/** Add a filter to an ol.Layer\r\n*\t@param {ol.filter}\r\n*/\r\nol.layer.Base.prototype.addFilter = function (filter) {\r\n  addFilter_.call (this, filter);\r\n};\r\n/** Remove a filter to an ol.Layer\r\n*\t@param {ol.filter}\r\n*/\r\nol.layer.Base.prototype.removeFilter = function (filter) {\r\n  removeFilter_.call (this, filter);\r\n};\r\n/** Get filters associated with an ol.Map\r\n*\t@return {Array<ol.filter>}\r\n*/\r\nol.layer.Base.prototype.getFilters = function () {\r\n  return this.filters_ || [];\r\n};\r\n})();\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Mask drawing using an ol.Feature\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.filter.Base}\r\n * @param {Object} [options]\r\n *  @param {ol.Feature} [options.feature] feature to mask with\r\n *  @param {ol.style.Fill} [options.fill] style to fill with\r\n *  @param {boolean} [options.inner] mask inner, default false\r\n */\r\nol.filter.Mask = function(options) {\r\n  options = options || {};\r\n  ol.filter.Base.call(this, options);\r\n  if (options.feature) {\r\n    switch (options.feature.getGeometry().getType()) {\r\n      case 'Polygon':\r\n      case 'MultiPolygon':\r\n        this.feature_ = options.feature;\r\n        break;\r\n      default: break;\r\n    }\r\n  }\r\n  this.set('inner', options.inner);\r\n  this.fillColor_ = options.fill ? ol.color.asString(options.fill.getColor()) || \"rgba(0,0,0,0.2)\" : \"rgba(0,0,0,0.2)\";\r\n}\r\nol.ext.inherits(ol.filter.Mask, ol.filter.Base);\r\n/** Draw the feature into canvas */\r\nol.filter.Mask.prototype.drawFeaturePath_ = function(e, out) {\r\n  var ctx = e.context;\r\n  var canvas = ctx.canvas;\r\n  var ratio = e.frameState.pixelRatio;\r\n  // Transform\r\n  var tr;\r\n  if (e.frameState.coordinateToPixelTransform) {\r\n    var m = e.frameState.coordinateToPixelTransform;\r\n    // ol > 6\r\n    if (e.inversePixelTransform) {\r\n      var ipt = e.inversePixelTransform;\r\n      tr = function(pt) {\r\n        pt = [\r\n          (pt[0]*m[0]+pt[1]*m[1]+m[4]),\r\n          (pt[0]*m[2]+pt[1]*m[3]+m[5])\r\n        ];\r\n        return [\r\n          (pt[0]*ipt[0] - pt[1]*ipt[1] + ipt[4]),\r\n          (-pt[0]*ipt[2] + pt[1]*ipt[3] + ipt[5])\r\n        ]\r\n      }\r\n    } else {\r\n      // ol 5\r\n      tr = function(pt) {\r\n        return [\r\n          (pt[0]*m[0]+pt[1]*m[1]+m[4])*ratio,\r\n          (pt[0]*m[2]+pt[1]*m[3]+m[5])*ratio\r\n        ];\r\n      }\r\n    }\r\n  } else {\r\n    // Older version\r\n    m = e.frameState.coordinateToPixelMatrix;\r\n    tr = function(pt) {\r\n      return [\r\n        (pt[0]*m[0]+pt[1]*m[1]+m[12])*ratio,\r\n        (pt[0]*m[4]+pt[1]*m[5]+m[13])*ratio\r\n      ];\r\n    }\r\n  }\r\n  // Geometry\r\n  var ll = this.feature_.getGeometry().getCoordinates();\r\n  if (this.feature_.getGeometry().getType()==\"Polygon\") ll = [ll];\r\n  ctx.beginPath();\r\n    if (out) {\r\n      ctx.moveTo (0,0);\r\n      ctx.lineTo (canvas.width, 0);\r\n      ctx.lineTo (canvas.width, canvas.height);\r\n      ctx.lineTo (0, canvas.height);\r\n      ctx.lineTo (0, 0);\r\n    }\r\n    for (var l=0; l<ll.length; l++) {\r\n      var c = ll[l];\r\n      for (var i=0; i<c.length; i++) {\r\n        var pt = tr(c[i][0]);\r\n        ctx.moveTo (pt[0], pt[1]);\r\n        for (var j=1; j<c[i].length; j++) {\r\n          pt = tr(c[i][j]);\r\n          ctx.lineTo (pt[0], pt[1]);\r\n        }\r\n      }\r\n    }\r\n};\r\nol.filter.Mask.prototype.postcompose = function(e) {\r\n  if (!this.feature_) return;\r\n  var ctx = e.context;\r\n  ctx.save();\r\n    this.drawFeaturePath_(e, !this.get(\"inner\"));\r\n    ctx.fillStyle = this.fillColor_;\r\n    ctx.fill(\"evenodd\");\r\n  ctx.restore();\r\n};\r\n\r\n/** Add a mix-blend-mode CSS filter (not working with IE or ol<6).\r\n * Add a className to the layer to apply the filter to a specific layer.    \r\n * With ol<6 use {@link ol.filter.Composite} instead.    \r\n * Use {@link ol.layer.Base#addFilter}, {@link ol.layer.Base#removeFilter} or {@link ol.layer.Base#getFilters}\r\n * @constructor\r\n * @extends {ol.Object}\r\n * @param {Object} options\r\n *  @param {string} options.blend mix-blend-mode to apply (as {@link https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode CSS property})\r\n *  @param {string} options.filter filter to apply (as {@link https://developer.mozilla.org/en-US/docs/Web/CSS/filter CSS property})\r\n *  @param {boolan} options.display show/hide layer from CSS (but keep it in layer list)\r\n */\r\nol.filter.CSS = function(options) {\r\n  ol.filter.Base.call(this, options);\r\n  this._layers = [];\r\n};\r\nol.ext.inherits(ol.filter.CSS, ol.filter.Base);\r\n/** Modify blend mode\r\n * @param {string} blend mix-blend-mode to apply (as {@link https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode CSS property})\r\n */\r\nol.filter.CSS.prototype.setBlend = function(blend) {\r\n  this.set('blend', blend);\r\n  this._layers.forEach(function(layer) {\r\n    layer.once('postrender', function(e) {\r\n      e.context.canvas.parentNode.style['mix-blend-mode'] = blend || '';\r\n    }.bind(this));\r\n    layer.changed();\r\n  });\r\n};\r\n/** Modify filter mode\r\n * @param {string} filter filter to apply (as {@link https://developer.mozilla.org/en-US/docs/Web/CSS/filter CSS property})\r\n */\r\nol.filter.CSS.prototype.setFilter = function(filter) {\r\n  this.set('filter', filter);\r\n  this._layers.forEach(function(layer) {\r\n    layer.once('postrender', function(e) {\r\n      e.context.canvas.parentNode.style['filter'] = filter || '';\r\n    }.bind(this));\r\n    layer.changed();\r\n  });\r\n};\r\n/** Modify layer visibility (but keep it in the layer list)\r\n * @param {bolean} display\r\n */\r\n ol.filter.CSS.prototype.setDisplay = function(display) {\r\n  this.set('display', display);\r\n  this._layers.forEach(function(layer) {\r\n    layer.once('postrender', function(e) {\r\n      e.context.canvas.parentNode.style['display'] = display ? '' : 'none';\r\n    }.bind(this));\r\n    layer.changed();\r\n  });\r\n};\r\n/** Add CSS filter to the layer\r\n * @param {ol.layer.Base} layer \r\n */\r\nol.filter.CSS.prototype.addToLayer = function(layer) {\r\n  layer.once('postrender', function(e) {\r\n    e.context.canvas.parentNode.style['mix-blend-mode'] = this.get('blend') || '';\r\n    e.context.canvas.parentNode.style['filter'] = this.get('filter') || '';\r\n    e.context.canvas.parentNode.style['display'] = this.get('display')!==false ?  '' : 'none';\r\n  }.bind(this));\r\n  layer.changed();\r\n  this._layers.push(layer);\r\n  // layer.getRenderer().getImage().parentNode.style['mix-blend-mode'] = 'multiply';\r\n};\r\n/** Remove CSS filter from the layer\r\n * @param {ol.layer.Base} layer \r\n */\r\nol.filter.CSS.prototype.removeFromLayer = function(layer) {\r\n  var pos = this._layers.indexOf(layer);\r\n  if (pos>=0) {\r\n    layer.once('postrender', function(e) {\r\n      e.context.canvas.parentNode.style['mix-blend-mode'] = '';\r\n      e.context.canvas.parentNode.style['filter'] = '';\r\n      e.context.canvas.parentNode.style['display'] = '';\r\n    }.bind(this));\r\n    layer.changed();\r\n    this._layers.splice(pos, 1);\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** @typedef {Object} CanvasFilterOptions\r\n * @property {url} url Takes an IRI pointing to an SVG filter element\r\n * @property {number} blur Gaussian blur value in px\r\n * @property {number} brightness linear multiplier to the drawing, under 100: darkens the image, over 100 brightens it\r\n * @property {number} contrast Adjusts the contrast, under 0: black, 100 no change\r\n * @property {ol.pixel} shadow Applies a drop shadow effect, pixel offset\r\n * @property {number} shadowBlur Blur radius\r\n * @property {number} shadowColor \r\n * @property {number} grayscale 0: unchanged, 100: completely grayscale\r\n * @property {number} hueRotate Hue rotation angle in deg\r\n * @property {number} invert Inverts the drawing, 0: unchanged, 100: invert\r\n * @property {number} saturate Saturates the drawing, 0: unsaturated, 100: unchanged\r\n * @property {number} sepia Converts the drawing to sepia, 0: sepia, 100: unchanged\r\n */\r\n/** Add a canvas Context2D filter to a layer\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.filter.Base}\r\n * @param {CanvasFilterOptions} options\r\n */\r\nol.filter.CanvasFilter = function(options) {\r\n  ol.filter.Base.call(this, options);\r\n  this._svg = {};\r\n};\r\nol.ext.inherits(ol.filter.CanvasFilter, ol.filter.Base);\r\n/** Add a new svg filter\r\n * @param {string|ol.ext.SVGFilter} url IRI pointing to an SVG filter element\r\n */\r\nol.filter.CanvasFilter.prototype.addSVGFilter = function(url) {\r\n  if (url.getId) url = '#'+url.getId();\r\n  this._svg[url] = 1;\r\n  this.dispatchEvent({ type: 'propertychange', key: 'svg', oldValue: this._svg });\r\n};\r\n/** Remove a svg filter\r\n * @param {string|ol.ext.SVGFilter} url IRI pointing to an SVG filter element\r\n */\r\nol.filter.CanvasFilter.prototype.removeSVGFilter = function(url) {\r\n  if (url.getId) url = '#'+url.getId();\r\n  delete this._svg[url]\r\n  this.dispatchEvent({ type: 'propertychange', key: 'svg', oldValue: this._svg });\r\n};\r\n/**\r\n * @private\r\n */\r\nol.filter.CanvasFilter.prototype.precompose = function() {\r\n};\r\n/**\r\n * @private\r\n */\r\nol.filter.CanvasFilter.prototype.postcompose = function(e) {\r\n  var filter = []\r\n  // Set filters\r\n  if (this.get('url')!==undefined) filter.push('url('+this.get('url')+')'); \r\n  for (var f in this._svg) {\r\n    filter.push('url('+f+')'); \r\n  }\r\n  if (this.get('blur')!==undefined) filter.push('blur('+this.get('blur')+'px)'); \r\n  if (this.get('brightness')!==undefined) filter.push('brightness('+this.get('brightness')+'%)'); \r\n  if (this.get('contrast')!==undefined) filter.push('contrast('+this.get('contrast')+'%)'); \r\n  if (this.get('shadow')!==undefined) {\r\n    filter.push('drop-shadow('\r\n      + this.get('shadow')[0]+'px ' \r\n      + this.get('shadow')[1]+'px '\r\n      + (this.get('shadowBlur')||0)+'px ' \r\n      + this.get('shadowColor')+')'); \r\n  }\r\n  if (this.get('grayscale')!==undefined) filter.push('grayscale('+this.get('grayscale')+'%)'); \r\n  if (this.get('hueRotate')!==undefined) filter.push('hue-rotate('+this.get('hueRotate')+'deg)'); \r\n  if (this.get('invert')!==undefined) filter.push('invert('+this.get('invert')+'%)'); \r\n  if (this.get('saturate')!==undefined) filter.push('saturate('+this.get('saturate')+'%)'); \r\n  if (this.get('sepia')!==undefined) filter.push('sepia('+this.get('sepia')+'%)');\r\n  filter = filter.join(' ');\r\n  // Apply filter\r\n  if (filter) {\r\n    e.context.save();\r\n    e.context.filter = filter;\r\n    e.context.drawImage(e.context.canvas, 0,0);\r\n    e.context.restore();\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Clip layer or map\r\n*  @constructor\r\n* @requires ol.filter\r\n* @extends {ol.filter.Base}\r\n* @param {Object} [options]\r\n*  @param {Array<ol.Coordinate>} [options.coords]\r\n*  @param {ol.Extent} [options.extent]\r\n*  @param {string} [options.units] coords units percent (%) or pixel (px)\r\n*  @param {boolean} [options.keepAspectRatio] keep aspect ratio\r\n*  @param {string} [options.color] backgroundcolor\r\n*/\r\nol.filter.Clip = function(options) {\r\n  options = options || {};\r\n  ol.filter.Base.call(this, options);\r\n  this.set(\"coords\", options.coords);\r\n  this.set(\"units\", options.units);\r\n  this.set(\"keepAspectRatio\", options.keepAspectRatio);\r\n  this.set(\"extent\", options.extent || [0,0,1,1]);\r\n  this.set(\"color\", options.color);\r\n  if (!options.extent && options.units!=\"%\" && options.coords) {\r\n    var xmin = Infinity;\r\n    var ymin = Infinity;\r\n    var xmax = -Infinity;\r\n    var ymax = -Infinity;\r\n    for (var i=0, p; p=options.coords[i]; i++) {\r\n      if (xmin > p[0]) xmin = p[0];\r\n      if (xmax < p[0]) xmax = p[0];\r\n      if (ymin > p[1]) ymin = p[1];\r\n      if (ymax < p[1]) ymax = p[1];\r\n    }\r\n    options.extent = [xmin,ymin,xmax,ymax];\r\n  }\r\n}\r\nol.ext.inherits(ol.filter.Clip, ol.filter.Base);\r\nol.filter.Clip.prototype.clipPath_ = function(e) {\r\n  var ctx = e.context;\r\n  var size = e.frameState.size;\r\n  var coords = this.get(\"coords\");\r\n  if (!coords) return;\r\n  var ex = this.get('extent');\r\n  var scx = 1, scy = 1;\r\n  if (this.get(\"units\")==\"%\") {\r\n    scx = size[0]/(ex[2]-ex[0]);\r\n    scy = size[1]/(ex[3]-ex[1]);\r\n  }\r\n  if (this.get(\"keepAspectRatio\")) {\r\n    scx = scy = Math.min (scx, scy);\r\n  }\r\n  var pos = this.get('position');\r\n  var dx=0, dy=0;\r\n  if (/left/.test(pos)) {\r\n    dx = -ex[0]*scx;\r\n  } else if (/center/.test(pos)) {\r\n    dx = size[0]/2 - (ex[2]-ex[0])*scx/2;\r\n  } else if (/right/.test(pos)) {\r\n    dx = size[0] - (ex[2]-ex[0])*scx;\r\n  }\r\n  var fx = function(x) { return x*scx + dx };\r\n  if (/top/.test(pos)) {\r\n    dy = -ex[1]*scy;\r\n  } else if (/middle/.test(pos)) {\r\n    dy = size[1]/2 - (ex[3]-ex[1])*scy/2;\r\n  } else if (/bottom/.test(pos)) {\r\n    dy = size[1] - (ex[3]-ex[1])*scy;\r\n  }\r\n  var fy = function(y) { return y*scy + dy; };\r\n  var pt = [ fx(coords[0][0]), fy(coords[0][1]) ];\r\n  var tr = e.inversePixelTransform;\r\n  if (tr) {\r\n    pt = [\r\n      (pt[0]*tr[0] - pt[1]*tr[1] + tr[4]),\r\n      (-pt[0]*tr[2] + pt[1]*tr[3] + tr[5])\r\n    ];\r\n  }\r\n  ctx.moveTo ( pt[0], pt[1] );\r\n  for (var i=1, p; p=coords[i]; i++) {\r\n    pt = [ fx(p[0]), fy(p[1]) ];\r\n    if (tr) {\r\n      pt = [\r\n        (pt[0]*tr[0] - pt[1]*tr[1] + tr[4]),\r\n        (-pt[0]*tr[2] + pt[1]*tr[3] + tr[5])\r\n      ];\r\n    }\r\n    ctx.lineTo ( pt[0], pt[1] );\r\n  }\r\n  pt = [ fx(coords[0][0]), fy(coords[0][1]) ];\r\n  if (tr) {\r\n    pt = [\r\n      (pt[0]*tr[0] - pt[1]*tr[1] + tr[4]),\r\n      (-pt[0]*tr[2] + pt[1]*tr[3] + tr[5])\r\n    ];\r\n  }\r\n  ctx.moveTo ( pt[0], pt[1] );\r\n};\r\n/**\r\n * @private\r\n */\r\nol.filter.Clip.prototype.precompose = function(e) {\r\n  if (!this.get(\"color\")){\r\n    e.context.save();\r\n    e.context.beginPath();\r\n    this.clipPath_(e);\r\n    e.context.clip();\r\n  }\r\n};\r\n/**\r\n * @private\r\n */\r\nol.filter.Clip.prototype.postcompose = function(e) {\r\n  if (this.get(\"color\")) {\r\n    var ctx = e.context;\r\n    var canvas = e.context.canvas;\r\n    ctx.save();\r\n    ctx.beginPath();\r\n    ctx.moveTo(0,0);\r\n    ctx.lineTo(0,canvas.height);\r\n    ctx.lineTo(canvas.width, canvas.height);\r\n    ctx.lineTo(canvas.width, canvas.height);\r\n    ctx.lineTo(canvas.width, 0);\r\n    ctx.lineTo(0, 0);\r\n    this.clipPath_(e);\r\n    ctx.fillStyle = this.get(\"color\");\r\n    ctx.fill(\"evenodd\");\r\n  }\r\n  e.context.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** @typedef {Object} FilterColorizeOptions\r\n * @property {ol.Color} color style to fill with\r\n * @property {string} operation 'enhance' or a CanvasRenderingContext2D.globalCompositeOperation\r\n * @property {number} value a value to modify the effect value [0-1]\r\n * @property {boolean} inner mask inner, default false\r\n * @property {boolean} preserveAlpha preserve alpha channel, default false\r\n */\r\n/** Colorize map or layer\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.filter.Base}\r\n * @author Thomas Tilak https://github.com/thhomas\r\n * @author Jean-Marc Viglino https://github.com/viglino\r\n * @param {FilterColorizeOptions} options\r\n */\r\nol.filter.Colorize = function(options) {\r\n  ol.filter.Base.call(this, options);\r\n  this.setFilter(options);\r\n}\r\nol.ext.inherits(ol.filter.Colorize, ol.filter.Base);\r\n/** Set options to the filter\r\n * @param {FilterColorizeOptions} [options]\r\n */\r\nol.filter.Colorize.prototype.setFilter = function(options) {\r\n  options = options || {};\r\n  switch (options) {\r\n    case \"grayscale\": options = { operation:'hue', color: [0,0,0], value:1 }; break;\r\n    case \"invert\": options = { operation:'difference', color: [255,255,255], value:1 }; break;\r\n    case \"sepia\": options = { operation:'color', color: [153,102,51], value:0.6 }; break;\r\n    default: break;\r\n  }\r\n  var color = options.color ? ol.color.asArray(options.color) : [ options.red, options.green, options.blue, options.value];\r\n  this.set('color', ol.color.asString(color))\r\n  this.set ('value', options.value||1);\r\n  this.set ('preserveAlpha', options.preserveAlpha);\r\n  var v;\r\n  switch (options.operation){\r\n    case 'hue':\r\n    case 'difference':\r\n    case 'color-dodge':\r\n    case 'enhance': {\r\n      this.set ('operation', options.operation);\r\n      break;\r\n    }\r\n    case 'saturation': {\r\n      v = 255*(options.value || 0);\r\n      this.set('color', ol.color.asString([0,0,v,v||1]));\r\n      this.set ('operation', options.operation);\r\n      break;\r\n    }\r\n    case 'luminosity': {\r\n      v = 255*(options.value || 0);\r\n      this.set('color', ol.color.asString([v,v,v,255]));\r\n      //this.set ('operation', 'luminosity')\r\n      this.set ('operation', 'hard-light');\r\n      break;\r\n    }\r\n    case 'contrast': {\r\n      v = 255*(options.value || 0);\r\n      this.set('color', ol.color.asString([v,v,v,255]));\r\n      this.set('operation', 'soft-light');\r\n      break;\r\n    }\r\n    default: {\r\n      this.set ('operation', 'color');\r\n      this.setValue(options.value||1);\r\n      break;\r\n    }\r\n  }\r\n}\r\n/** Set the filter value\r\n * @param {ol.Color} options.color style to fill with\r\n */\r\nol.filter.Colorize.prototype.setValue = function(v) {\r\n  this.set ('value', v);\r\n  var c = ol.color.asArray(this.get(\"color\"));\r\n  c[3] = v;\r\n  this.set(\"color\", ol.color.asString(c));\r\n}\r\n/** Set the color value\r\n * @param {number} options.value a [0-1] value to modify the effect value\r\n */\r\nol.filter.Colorize.prototype.setColor = function(c) {\r\n  c = ol.color.asArray(c);\r\n  if (c) {\r\n    c[3] = this.get(\"value\");\r\n    this.set(\"color\", ol.color.asString(c));\r\n  }\r\n}\r\n/** @private \r\n */\r\nol.filter.Colorize.prototype.precompose = function(/* e */) {\r\n}\r\n/** @private \r\n */\r\nol.filter.Colorize.prototype.postcompose = function(e) {\r\n  // Set back color hue\r\n  var c2, ctx2;\r\n  var ctx = e.context;\r\n  var canvas = ctx.canvas;\r\n  ctx.save();\r\n    if (this.get('operation')=='enhance') {\r\n      var v = this.get('value');\r\n      if (v) {\r\n        var w = canvas.width;\r\n        var h = canvas.height;\r\n        if (this.get('preserveAlpha')) {\r\n          c2 = document.createElement('CANVAS');\r\n          c2.width = canvas.width;\r\n          c2.height = canvas.height;\r\n          ctx2 = c2.getContext('2d');\r\n          ctx2.drawImage (canvas, 0, 0, w, h);\r\n          ctx2.globalCompositeOperation = 'color-burn';\r\n          console.log(v)\r\n          ctx2.globalAlpha = v;\r\n          ctx2.drawImage (c2, 0, 0, w, h);\r\n          ctx2.drawImage (c2, 0, 0, w, h);\r\n          ctx2.drawImage (c2, 0, 0, w, h);\r\n          ctx.globalCompositeOperation = 'source-in';\r\n          ctx.drawImage(c2, 0,0);\r\n        } else {  \r\n          ctx.globalCompositeOperation = 'color-burn'\r\n          ctx.globalAlpha = v;\r\n          ctx.drawImage (canvas, 0, 0, w, h);\r\n          ctx.drawImage (canvas, 0, 0, w, h);\r\n          ctx.drawImage (canvas, 0, 0, w, h);\r\n        }\r\n      }\r\n    } else {\r\n      if (this.get('preserveAlpha')) {\r\n        c2 = document.createElement('CANVAS');\r\n        c2.width = canvas.width;\r\n        c2.height = canvas.height;\r\n        ctx2 = c2.getContext('2d');\r\n        ctx2.drawImage(canvas, 0,0);\r\n        ctx2.globalCompositeOperation = this.get('operation');\r\n        ctx2.fillStyle = this.get('color');\r\n        ctx2.fillRect(0,0,canvas.width,canvas.height);\r\n        ctx.globalCompositeOperation = 'source-in';\r\n        ctx.drawImage(c2, 0,0);\r\n      } else {\r\n        ctx.globalCompositeOperation = this.get('operation');\r\n        ctx.fillStyle = this.get('color');\r\n        ctx.fillRect(0,0,canvas.width,canvas.height);  \r\n      }\r\n    }\r\n  ctx.restore();\r\n}\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Add a composite filter on a layer.    \r\n * With ol6+ you'd better use {@link ol.filter.CSS} instead.    \r\n * Use {@link ol.layer.Base#addFilter}, {@link ol.layer.Base#removeFilter} or {@link ol.layer.Base#getFilters}\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.filter.Base}\r\n * @param {Object} options\r\n *  @param {string} options.operation composite operation\r\n */\r\nol.filter.Composite = function(options) {\r\n  ol.filter.Base.call(this, options);\r\n  this.set(\"operation\", options.operation || \"source-over\");\r\n}\r\nol.ext.inherits(ol.filter.Composite, ol.filter.Base);\r\n/** Change the current operation\r\n*\t@param {string} operation composite function\r\n*/\r\nol.filter.Composite.prototype.setOperation = function(operation) {\r\n  this.set('operation', operation || \"source-over\");\r\n}\r\nol.filter.Composite.prototype.precompose = function(e) {\r\n  var ctx = e.context;\r\n  ctx.save();\r\n  ctx.globalCompositeOperation = this.get('operation');\r\n}\r\nol.filter.Composite.prototype.postcompose = function(e) {\r\n  e.context.restore();\r\n}\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Crop drawing using an ol.Feature\r\n* @constructor\r\n* @requires ol.filter\r\n* @requires ol.filter.Mask\r\n* @extends {ol.filter.Mask}\r\n* @param {Object} [options]\r\n*  @param {ol.Feature} [options.feature] feature to crop with\r\n*  @param {boolean} [options.inner=false] mask inner, default false\r\n*/\r\nol.filter.Crop = function(options) {\r\n  options = options || {};\r\n  ol.filter.Mask.call(this, options);\r\n}\r\nol.ext.inherits(ol.filter.Crop, ol.filter.Mask);\r\nol.filter.Crop.prototype.precompose = function(e) {\r\n  if (this.feature_) {\r\n    var ctx = e.context;\r\n    ctx.save();\r\n      this.drawFeaturePath_(e, this.get(\"inner\"));\r\n      ctx.clip(\"evenodd\");\r\n  }\r\n}\r\nol.filter.Crop.prototype.postcompose = function(e) {\r\n  if (this.feature_) e.context.restore();\r\n}\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Fold filer map\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.filter.Base}\r\n * @param {Object} [options]\r\n *  @param {Array<number>} [options.fold] number of fold (horizontal and vertical)\r\n *  @param {number} [options.margin] margin in px, default 8\r\n *  @param {number} [options.padding] padding in px, default 8\r\n *  @param {number|number[]} [options.fsize] fold size in px, default 8,10\r\n *  @param {boolean} [options.fill] true to fill the background, default false\r\n *  @param {boolean} [options.shadow] true to display shadow, default true\r\n */\r\nol.filter.Fold = function(options) {\r\n  options = options || {};\r\n  ol.filter.Base.call(this, options);\r\n  this.set('fold', options.fold || [8,4]);\r\n  this.set('margin', options.margin || 8);\r\n  this.set('padding', options.padding || 8);\r\n  if (typeof options.fsize == 'number') options.fsize = [options.fsize,options.fsize];\r\n  this.set('fsize', options.fsize || [8,10]);\r\n  this.set('fill', options.fill);\r\n  this.set('shadow', options.shadow!==false);\r\n};\r\nol.ext.inherits(ol.filter.Fold, ol.filter.Base);\r\nol.filter.Fold.prototype.drawLine_ = function(ctx, d, m) {\r\n  var canvas = ctx.canvas;\r\n  var fold = this.get(\"fold\");\r\n  var w = canvas.width;\r\n  var h = canvas.height;\r\n  var x, y, i;\r\n  ctx.beginPath();\r\n  ctx.moveTo ( m, m );\r\n  for (i=1; i<=fold[0]; i++) {\r\n    x = i*w/fold[0] - (i==fold[0] ? m : 0);\r\n    y =  d[1]*(i%2) +m;\r\n    ctx.lineTo ( x, y );\r\n  }\r\n  for (i=1; i<=fold[1]; i++) {\r\n    x = w - d[0]*(i%2) - m;\r\n    y = i*h/fold[1] - (i==fold[1] ? d[0]*(fold[0]%2) + m : 0);\r\n    ctx.lineTo ( x, y );\r\n  }\r\n  for (i=fold[0]; i>0; i--) {\r\n    x = i*w/fold[0] - (i==fold[0] ? d[0]*(fold[1]%2) + m : 0);\r\n    y = h - d[1]*(i%2) -m;\r\n    ctx.lineTo ( x, y );\r\n  }\r\n  for (i=fold[1]; i>0; i--) {\r\n    x = d[0]*(i%2) + m;\r\n    y = i*h/fold[1] - (i==fold[1] ? m : 0);\r\n    ctx.lineTo ( x, y );\r\n  }\r\n  ctx.closePath();\r\n};\r\nol.filter.Fold.prototype.precompose = function(e) {\r\n  var ctx = e.context;\r\n  ctx.save();\r\n    ctx.shadowColor = \"rgba(0,0,0,0.3)\";\r\n    ctx.shadowBlur = 8;\r\n    ctx.shadowOffsetX = 2;\r\n    ctx.shadowOffsetY = 3;\r\n    this.drawLine_(ctx, this.get(\"fsize\"), this.get(\"margin\"));\r\n    ctx.fillStyle=\"#fff\";\r\n    if (this.get('fill')) ctx.fill();\r\n    ctx.strokeStyle = \"rgba(0,0,0,0.1)\";\r\n    ctx.stroke();\r\n  ctx.restore();\r\n  ctx.save();\r\n    this.drawLine_(ctx, this.get(\"fsize\"), this.get(\"margin\") + this.get(\"padding\"));\r\n    ctx.clip();\r\n};\r\nol.filter.Fold.prototype.postcompose = function(e) {\r\n  var ctx = e.context;\r\n  var canvas = ctx.canvas;\r\n  ctx.restore();\r\n  ctx.save();\r\n    this.drawLine_(ctx, this.get(\"fsize\"), this.get(\"margin\"));\r\n    ctx.clip();\r\n    if (this.get('shadow')) {\r\n      var fold = this.get(\"fold\");\r\n      var w = canvas.width/fold[0];\r\n      var h = canvas.height/fold[1];\r\n      var grd = ctx.createRadialGradient(5*w/8,5*w/8,w/4,w/2,w/2,w);\r\n      grd.addColorStop(0,\"transparent\");\r\n      grd.addColorStop(1,\"rgba(0,0,0,0.2)\");\r\n      ctx.fillStyle = grd;\r\n      ctx.scale (1,h/w);\r\n      for (var i=0; i<fold[0]; i++) for (var j=0; j<fold[1]; j++) {\r\n        ctx.save()\r\n        ctx.translate(i*w, j*w);\r\n        ctx.fillRect(0,0,w,w);\r\n        ctx.restore()\r\n      }\r\n    }\r\n  ctx.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Make a map or layer look like made of a set of Lego bricks.\r\n *  @constructor\r\n * @requires ol.filter\r\n * @extends {ol.filter.Base}\r\n * @param {Object} [options]\r\n *  @param {string} [options.channel] RGB channels: 'r', 'g' or 'b', default use intensity\r\n *  @param {ol.colorlike} [options.color] color, default black\r\n *  @param {number} [options.size] point size, default 30\r\n *  @param {null | string | undefined} [options.crossOrigin] crossOrigin attribute for loaded images.\r\n */\r\nol.filter.Halftone = function(options) {\r\n  if (!options) options = {};\r\n  ol.filter.Base.call(this, options);\r\n  this.internal_ = document.createElement('canvas');\r\n  this.setSize(options.size);\r\n  this.set('channel', options.channel);\r\n}\r\nol.ext.inherits(ol.filter.Halftone, ol.filter.Base);\r\n/** Set the current size\r\n*\t@param {number} width the pattern width, default 30\r\n*/\r\nol.filter.Halftone.prototype.setSize = function (size) {\r\n  size = Number(size) || 30;\r\n  this.set(\"size\", size);\r\n};\r\n/** Postcompose operation\r\n*/\r\nol.filter.Halftone.prototype.postcompose = function(e) {\r\n  var ctx = e.context;\r\n  var canvas = ctx.canvas;\r\n  var ratio = e.frameState.pixelRatio;\r\n  // ol v6+\r\n  if (e.type === 'postrender') {\r\n    ratio = 1;\r\n  }\r\n  ctx.save();\r\n    // resize \r\n    var step = this.get('size')*ratio;\r\n    var p = e.frameState.extent;\r\n    var res = e.frameState.viewState.resolution/ratio;\r\n    var offset = [ -Math.round((p[0]/res)%step), Math.round((p[1]/res)%step) ];\r\n    var ctx2 = this.internal_.getContext(\"2d\");\r\n    var w = this.internal_.width = canvas.width;\r\n    var h = this.internal_.height = canvas.height;\r\n    // No smoothing please\r\n    ctx2.webkitImageSmoothingEnabled =\r\n    ctx2.mozImageSmoothingEnabled =\r\n    ctx2.msImageSmoothingEnabled =\r\n    ctx2.imageSmoothingEnabled = false;\r\n    var w2 = Math.floor((w-offset[0])/step);\r\n    var h2 = Math.floor((h-offset[1])/step);\r\n    ctx2.drawImage (canvas, offset[0], offset[1], w2*step, h2*step, 0, 0, w2, h2);\r\n    var data = ctx2.getImageData(0, 0, w2,h2).data;\r\n    // Draw tone\r\n    ctx.clearRect (0, 0, w,h);\r\n    ctx.fillStyle = ol.color.asString(this.get('color') || '#000');\r\n    for (var x=0; x<w2; x++) for (var y=0; y<h2; y++) {\r\n      var pix;\r\n      switch (this.get('channel')) {\r\n        case 'r': pix = data[x*4+y*w2*4] / 2.55; break;\r\n        case 'g': pix = data[x*4+1+y*w2*4] / 2.55; break;\r\n        case 'b': pix = data[x*4+2+y*w2*4] / 2.55; break;\r\n        default:\r\n          pix = ol.color.toHSL([data[x*4+y*w2*4], data[x*4+1+y*w2*4], data[x*4+2+y*w2*4]]);\r\n          pix = pix[2];\r\n          break;\r\n      }\r\n      var l = (100-pix)/140;\r\n      if (l) {\r\n        ctx.beginPath();\r\n        ctx.arc(offset[0]+step/2+x*step, offset[1]+step/2+y*step, step*l, 0, 2 * Math.PI);\r\n        ctx.closePath();\r\n        ctx.fill();\r\n      }\r\n    }\r\n  ctx.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Make a map or layer look like made of a set of Lego bricks.\r\n *  @constructor\r\n * @requires ol.filter\r\n * @extends {ol.filter.Base}\r\n * @param {Object} [options]\r\n *  @param {string} [options.img]\r\n *  @param {number} [options.brickSize] size of te brick, default 30\r\n *  @param {null | string | undefined} [options.crossOrigin] crossOrigin attribute for loaded images.\r\n */\r\nol.filter.Lego = function(options) {\r\n  if (!options) options = {};\r\n  ol.filter.Base.call(this, options);\r\n  var img = new Image();\r\n  // Default image\r\n  img.src = this.img[options.img] || this.img.ol3;\r\n  img.crossOrigin = options.crossOrigin || null;\r\n  // and pattern \r\n  this.pattern = {\r\n    canvas: document.createElement('canvas')\r\n  };\r\n  this.setBrick (options.brickSize, img);\r\n  this.internal_ = document.createElement('canvas');\r\n}\r\nol.ext.inherits(ol.filter.Lego, ol.filter.Base);\r\n/** Image definition\r\n*/\r\nol.filter.Lego.prototype.img = {\r\n  brick: \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAAAnNCSVQICFXsRgQAAAAJcEhZcwAAD10AAA9dAah0GUAAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAGAElEQVRo3sWZy4tkVx3HP+fcc29Vd1dP17TdTcbJPDKPMGR0kVEZkuBCF0EE9Z8QXLhxMUsRF4oLwYWQTSCgSxUXroQhoiEuskgEUUQh+BhHOpkZO11dr3vvefxc3FPlNHNvPbrD1Dl016XoqvM539/znFbcZo3VjbFmxcMA3Mg2fSoAiQJDov7/B1o9+aEgkycv4PBSPU9eHeDEixNwOAFXPYvFia0+rcnQEeBr218cfLIwCqW1UWillEYphUKpCmCCIQAiCEhAJIggTiSISBAfggTvJZTifQghWO+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xhvruJUYffhGCxWKS0IqqReFXFN5g583qaNokC0aSf/JUaVn95ufNrJ9SwGlapMkkUXuPMAy/E24CJbQVeVWeIXDAFbEYwWCymes3XAMZW9d5gC8k3Rn++79hJjErvvcBB0P53/sBBAOa5knmdnWwlywlQZ7mHfQivOsd6yVDEkGIwxDVrfo2yY4nJ5tMTLe9rkYKSkUtcEqXk9/DKok9d5nLlfpzxyn0Tu7Gk7jLVNx8eQFw98oUi6Vz07NiZ3c/4y+bz+i1gHxliEhJnQFKn6MbVu01ISRaSX2b8vk/4q4D77GErCTGxM2EBW1P8pLr4YJkjiKORhZ91hR1qpsG9m89O9pASOXxMXF6wrCb0ACIidBJe8ZNdjHID24DsA/RhCImInAnztQqr897UeI1lDp3ToU8TO2jiat39q0cLD7GJlNBdERFhLd8dPjamtldx98K8dhNGD91cZ6zKPl6hyNJPP5rYIcsGFGprVva+Nl4GF455lVzI0UcvU0ySX7R5aKabHnrwMRSJlhiQr7fT1QCprYPnmKHgzjQtliwZNrIZHyHBkHHLSMG4KI+JK6Lna+9wFuETUzecLAUHN6QkBARofHwCFImr6Mbld+Lw0Upwhy/acKWUMswS07YI77tllHJTqsW4t4lLtcLKBwyl0JN05YQSiqS0knW+a7eGu4W3rrgmJMwRNpCkLvRsaBoqKAkzZGgi66S/HV+Sf4GQxvor4xPbYDkVIuLS2RZ6CV4wRMQkNNpXGb9go1V8BSElJXRrWIXCupM9We2hvMPPG1bbaqxf3sWhamTzhjVpHsCc/a9dQ3xo82uJL9jRNRLfTTnnBO+u/pTkLT5c8fPNd9nt5tLmRbsVynbsXR704Bbeq775v0uht3btfyZT7OA5knjdAAAAAElFTkSuQmCC\"\r\n};\r\n/** Overwrite to handle brickSize\r\n* @param {string} key\r\n* @param {any} val\r\n*/\r\nol.filter.Lego.prototype.set = function (key, val) {\r\n  ol.filter.Base.prototype.set.call(this, key, val);\r\n  if (key==\"brickSize\" && this.pattern && this.pattern.canvas.width!=val) {\r\n    this.setBrick(val);\r\n  }\r\n}\r\n/** Set the current brick\r\n*\t@param {number} width the pattern width, default 30\r\n*\t@param {'brick'|'ol3'|'lego'|undefined} img the pattern, default ol3\r\n*\t@param {string} crossOrigin\r\n*/\r\nol.filter.Lego.prototype.setBrick = function (width, img, crossOrigin) {\r\n  width = Number(width) || 30;\r\n  if (typeof(img) === 'string') {\r\n    var i = new Image;\r\n    i.src = this.img[img] || this.img.ol3;\r\n    i.crossOrigin = crossOrigin || null;\r\n    img = i;\r\n  }\r\n  if (img) this.pattern.img = img;\r\n  if (!this.pattern.img.width) {\r\n    var self = this;\r\n    this.pattern.img.onload = function() {\r\n      self.setBrick(width,img);\r\n    }\r\n    return;\r\n  }\r\n  this.pattern.canvas.width = this.pattern.canvas.height = width;\r\n  this.pattern.ctx = this.pattern.canvas.getContext(\"2d\");\r\n  this.pattern.ctx.fillStyle = this.pattern.ctx.createPattern (this.pattern.img, 'repeat');\r\n  this.set(\"brickSize\", width);\r\n  if (img) this.set(\"img\", img.src);\r\n};\r\n/** Get translated pattern\r\n*\t@param {number} offsetX x offset\r\n*\t@param {number} offsetY y offset\r\n*/\r\nol.filter.Lego.prototype.getPattern = function (offsetX, offsetY) {\t\r\n  if (!this.pattern.ctx) return \"transparent\";\r\n  //return this.pattern.ctx.fillStyle\r\n  var c = this.pattern.canvas;\r\n  var ctx = this.pattern.ctx;\r\n  var sc = c.width / this.pattern.img.width;\r\n  ctx.save();\r\n    ctx.clearRect(0,0,c.width,c.height);\r\n    ctx.scale(sc,sc);\r\n    offsetX /= sc;\r\n    offsetY /= sc;\r\n    ctx.translate(offsetX, offsetY);\r\n    ctx.beginPath();\r\n    ctx.clearRect(-2*c.width, -2*c.height, 4*c.width, 4*c.height);\r\n    ctx.rect(-offsetX, -offsetY, 2*c.width/sc, 2*c.height/sc);\r\n    ctx.fill(); \r\n  ctx.restore();\r\n  return ctx.createPattern(c, 'repeat');\r\n};\r\n/** Postcompose operation\r\n*/\r\nol.filter.Lego.prototype.postcompose = function(e) {\r\n  // Set back color hue\r\n  var ctx = e.context;\r\n  var canvas = ctx.canvas;\r\n  var ratio = e.frameState.pixelRatio;\r\n  // ol v6+\r\n  if (e.type==='postrender') {\r\n    ratio = 1;\r\n  }\r\n  ctx.save();\r\n    // resize \r\n    var step = this.pattern.canvas.width*ratio;\r\n    var p = e.frameState.extent;\r\n    var res = e.frameState.viewState.resolution/ratio;\r\n    var offset = [ -Math.round((p[0]/res)%step), Math.round((p[1]/res)%step) ];\r\n    var ctx2 = this.internal_.getContext(\"2d\");\r\n    var w = this.internal_.width = canvas.width;\r\n    var h = this.internal_.height = canvas.height;\r\n    // No smoothing please\r\n    ctx2.webkitImageSmoothingEnabled =\r\n    ctx2.mozImageSmoothingEnabled =\r\n    ctx2.msImageSmoothingEnabled =\r\n    ctx2.imageSmoothingEnabled = false;\r\n    var w2 = Math.floor((w-offset[0])/step);\r\n    var h2 = Math.floor((h-offset[1])/step);\r\n    ctx2.drawImage (canvas, offset[0], offset[1], w2*step, h2*step, 0, 0, w2, h2);\r\n    //\r\n    ctx.webkitImageSmoothingEnabled =\r\n    ctx.mozImageSmoothingEnabled =\r\n    ctx.msImageSmoothingEnabled =\r\n    ctx.imageSmoothingEnabled = false;\r\n    ctx.clearRect (0, 0, w,h);\r\n    ctx.drawImage (this.internal_, 0,0, w2,h2, offset[0],offset[1], w2*step, h2*step);\r\n/*\r\n    for (var x=offset[0]; x<w; x+=step) for (var y=offset[1]; y<h; y+=step)\r\n    {\tif (x>=0 && y<h) ctx2.drawImage (canvas, x, y, 1, 1, x, y, step, step);\r\n    }\r\n    ctx.clearRect (0, 0, w,h);\r\n    ctx.drawImage (c, 0, 0);\r\n*/\r\n    // Draw brick stud\r\n    ctx.scale(ratio,ratio);\r\n    ctx.fillStyle = this.getPattern (offset[0]/ratio, offset[1]/ratio);\r\n    ctx.rect(0,0, w, h);\r\n    ctx.fill(); \r\n  ctx.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** @typedef {Object} FilterPencilSketchOptions\r\n * @property {number} blur blur value in pixel, default 8\r\n * @property {number} value intensity value [0,1], default .8\r\n */\r\n/** Colorize map or layer\r\n * Original idea: https://www.freecodecamp.org/news/sketchify-turn-any-image-into-a-pencil-sketch-with-10-lines-of-code-cf67fa4f68ce/\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.filter.Base}\r\n * @param {FilterPencilSketchOptions} options\r\n */\r\nol.filter.PencilSketch = function(options) {\r\n  options = options || {};\r\n  ol.filter.Base.call(this, options);\r\n  this.set('blur', options.blur || 8);\r\n  this.set('intensity', options.intensity || .8);\r\n};\r\nol.ext.inherits(ol.filter.PencilSketch, ol.filter.Base);\r\n/** @private \r\n */\r\nol.filter.PencilSketch.prototype.precompose = function(/* e */) {\r\n};\r\n/** @private \r\n */\r\nol.filter.PencilSketch.prototype.postcompose = function(e) {\r\n  // Set back color hue\r\n  var ctx = e.context;\r\n  var canvas = ctx.canvas;\r\n  var w = canvas.width;\r\n  var h = canvas.height;\r\n  // Grayscale image\r\n  var bwimg = document.createElement('canvas');\r\n  bwimg.width = w;\r\n  bwimg.height = h;\r\n  var bwctx = bwimg.getContext('2d');\r\n  bwctx.filter = 'grayscale(1) invert(1) blur('+this.get('blur')+'px)';\r\n  bwctx.drawImage(canvas, 0,0);\r\n  ctx.save();\r\n    if (!this.get('color')) {\r\n      ctx.filter = 'grayscale(1)';\r\n      ctx.drawImage(canvas, 0,0);\r\n    } else {\r\n      ctx.globalCompositeOperation = 'darken';\r\n      ctx.globalAlpha = .3;\r\n      ctx.drawImage(canvas, 0,0);\r\n    }\r\n    ctx.globalCompositeOperation = 'color-dodge';\r\n    ctx.globalAlpha = this.get('intensity');\r\n    ctx.drawImage(bwimg, 0,0);\r\n  ctx.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** @typedef {Object} FilterPointillismOptions\r\n * @property {number} saturate saturation, default 2\r\n */\r\n/** A pointillism filter to turn maps into pointillism paintings\r\n * @constructor\r\n * @extends {ol.filter.Base}\r\n * @param {FilterPointillismOptions} options\r\n */\r\nol.filter.Pointillism = function(options) {\r\n  options = options || {};\r\n  ol.filter.Base.call(this, options);\r\n  this.set('saturate', Number(options.saturate) || 2);\r\n  this.pixels = [];\r\n};\r\nol.ext.inherits(ol.filter.Pointillism, ol.filter.Base);\r\n/** Create points to place on the map\r\n * @private\r\n */\r\nol.filter.Pointillism.prototype._getPixels = function(nb) {\r\n  if (nb > this.pixels.length) {\r\n    while (this.pixels.length < nb) {\r\n      this.pixels.push([Math.random(), Math.random(), Math.random()*4+2]);\r\n    }\r\n  }\r\n  return nb;\r\n};\r\n/** @private \r\n */\r\nol.filter.Pointillism.prototype.precompose = function(/* e */) {\r\n};\r\n/** @private \r\n */\r\nol.filter.Pointillism.prototype.postcompose = function(e) {\r\n  // var ratio = e.frameState.pixelRatio;\r\n  // Set back color hue\r\n  var ctx = e.context;\r\n  var canvas = ctx.canvas;\r\n  var w = canvas.width;\r\n  var h = canvas.height;\r\n  // Grayscale image\r\n  var img = document.createElement('canvas');\r\n  img.width = w;\r\n  img.height = h;\r\n  var ictx = img.getContext('2d');\r\n  ictx.filter = 'saturate('+Math.round(2*this.get('saturate')*100)+'%)';\r\n  ictx.drawImage(canvas, 0,0);\r\n  ctx.save();\r\n    // Saturate and blur\r\n    ctx.filter = 'blur(3px) saturate('+(this.get('saturate')*100)+'%)';\r\n    ctx.drawImage(canvas, 0,0);\r\n    // ctx.clearRect(0,0,w,h); // debug\r\n    // Draw points\r\n    ctx.filter = 'none';\r\n    ctx.opacity = .5;\r\n    var max = this._getPixels(w*h/50);\r\n    for (var i=0; i<max; i++) {\r\n      var x = Math.floor(this.pixels[i][0]*w);\r\n      var y = Math.floor(this.pixels[i][1]*h);\r\n      ctx.fillStyle = ol.color.asString(ictx.getImageData(x, y, 1, 1).data);\r\n      ctx.beginPath();\r\n      ctx.arc(x,y, this.pixels[i][2], 0, 2*Math.PI);\r\n      ctx.fill();\r\n    }\r\n  ctx.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Add a canvas Context2D SVG filter to a layer\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.filter.Base}\r\n * @param {ol.ext.SVGFilter|Array<ol.ext.SVGFilter>} filters\r\n */\r\nol.filter.SVGFilter = function(filters) {\r\n  ol.filter.Base.call(this);\r\n  this._svg = {};\r\n  if (filters) {\r\n    if (!(filters instanceof Array)) filters = [filters];\r\n    filters.forEach(function(f) {\r\n      this.addSVGFilter(f);\r\n    }.bind(this));\r\n  }\r\n};\r\nol.ext.inherits(ol.filter.SVGFilter, ol.filter.Base);\r\n/** Add a new svg filter\r\n * @param {ol.ext.SVGFilter} filter\r\n */\r\nol.filter.SVGFilter.prototype.addSVGFilter = function(filter) {\r\n  var url = '#'+filter.getId();\r\n  this._svg[url] = 1;\r\n  this.dispatchEvent({ type: 'propertychange', key: 'svg', oldValue: this._svg });\r\n};\r\n/** Remove a svg filter\r\n * @param {ol.ext.SVGFilter} filter\r\n */\r\nol.filter.SVGFilter.prototype.removeSVGFilter = function(filter) {\r\n  var url = '#'+filter.getId();\r\n  delete this._svg[url]\r\n  this.dispatchEvent({ type: 'propertychange', key: 'svg', oldValue: this._svg });\r\n};\r\n/**\r\n * @private\r\n */\r\nol.filter.SVGFilter.prototype.precompose = function() {\r\n};\r\n/**\r\n * @private\r\n */\r\nol.filter.SVGFilter.prototype.postcompose = function(e) {\r\n  var filter = []\r\n  // Set filters\r\n  for (var f in this._svg) {\r\n    filter.push('url('+f+')'); \r\n  }\r\n  filter = filter.join(' ');\r\n  var canvas = document.createElement('canvas');\r\n  canvas.width = e.context.canvas.width;\r\n  canvas.height = e.context.canvas.height;\r\n  canvas.getContext('2d').drawImage(e.context.canvas,0,0);\r\n  // Apply filter\r\n  if (filter) {\r\n    e.context.save();\r\n    e.context.clearRect(0,0,canvas.width, canvas.height);\r\n    e.context.filter = filter;\r\n    e.context.drawImage(canvas, 0,0);\r\n    e.context.restore();\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** @typedef {Object} FilterTextureOptions\r\n *  @property {Image | undefined} img Image object for the texture\r\n *  @property {string} src Image source URI\r\n *  @property {number} scale scale to draw the image. Default 1.\r\n *  @property {number} [opacity]\r\n *  @property {boolean} rotate Whether to rotate the texture with the view (may cause animation lags on mobile or slow devices). Default is true.\r\n *  @property {null | string | undefined} crossOrigin The crossOrigin attribute for loaded images.\r\n */\r\n/** Add texture effects on maps or layers\r\n * @constructor\r\n * @requires ol.filter\r\n * @extends {ol.filter.Base}\r\n * @param {FilterTextureOptions} options\r\n */\r\nol.filter.Texture = function(options)\r\n{\tol.filter.Base.call(this, options);\r\n\tthis.setFilter(options);\r\n}\r\nol.ext.inherits(ol.filter.Texture, ol.filter.Base);\r\n/** Set texture\r\n * @param {FilterTextureOptions} [options]\r\n */\r\nol.filter.Texture.prototype.setFilter = function(options)\r\n{\tvar img;\r\n\toptions = options || {};\r\n\tif (options.img) img = options.img;\r\n\telse \r\n\t{\timg = new Image();\r\n\t\tif (options.src) {\r\n\t\t\t// Look for a texture stored in ol.filter.Texture.Image\r\n\t\t\tif (ol.filter.Texture.Image && ol.filter.Texture.Image[options.src]) {\r\n\t\t\t\timg.src = ol.filter.Texture.Image[options.src];\r\n\t\t\t} \r\n\t\t\t// default source\r\n\t\t\telse {\r\n\t\t\t\tif (!img.src) img.src = options.src;\r\n\t\t\t}\r\n\t\t}\r\n\t\timg.crossOrigin = options.crossOrigin || null;\r\n\t}\r\n\tthis.set('rotateWithView', options.rotateWithView !== false);\r\n\tthis.set('opacity', typeof(options.opacity)=='number' ? options.opacity : 1);\r\n\tthis.set('ready', false);\r\n\tvar self = this;\r\n\tfunction setPattern(img)\r\n\t{\tself.pattern = {};\r\n\t\tself.pattern.scale = options.scale || 1;\r\n\t\tself.pattern.canvas = document.createElement('canvas');\r\n\t\tself.pattern.canvas.width = img.width * self.pattern.scale;\r\n\t\tself.pattern.canvas.height = img.height * self.pattern.scale;\r\n\t\tself.pattern.canvas.width = img.width;// * self.pattern.scale;\r\n\t\tself.pattern.canvas.height = img.height;// * self.pattern.scale;\r\n\t\tself.pattern.ctx = self.pattern.canvas.getContext(\"2d\");\r\n\t\tself.pattern.ctx.fillStyle = self.pattern.ctx.createPattern(img, 'repeat');\r\n\t\t// Force refresh\r\n\t\tself.set('ready', true);\r\n\t}\r\n\tif (img.width) \r\n\t{\tsetPattern(img);\r\n\t}\r\n\telse\r\n\t{\timg.onload = function()\r\n\t\t{\tsetPattern(img);\r\n\t\t}\r\n\t}\r\n}\r\n/** Get translated pattern\r\n *\t@param {number} offsetX x offset\r\n *\t@param {number} offsetY y offset\r\n */\r\nol.filter.Texture.prototype.getPattern = function (offsetX, offsetY)\r\n{\tvar c = this.pattern.canvas;\r\n\tvar ctx = this.pattern.ctx;\r\n\tctx.save();\r\n\t/*\r\n\t\toffsetX /= this.pattern.scale;\r\n\t\toffsetY /= this.pattern.scale;\r\n\t\tctx.scale(this.pattern.scale,this.pattern.scale);\r\n\t*/\r\n\t\tctx.translate(-offsetX, offsetY);\r\n\t\tctx.beginPath();\r\n\t\tctx.rect(offsetX, -offsetY, c.width, c.height);\r\n\t\tctx.fill();\r\n\tctx.restore();\r\n\treturn ctx.createPattern(c, 'repeat');\r\n}\r\n/** Draw pattern over the map on postcompose */\r\nol.filter.Texture.prototype.postcompose = function(e)\r\n{\t// not ready\r\n\tif (!this.pattern) return;\r\n\t// Set back color hue\r\n\tvar ctx = e.context;\r\n\tvar canvas = ctx.canvas;\r\n\tvar m = 1.5 * Math.max(canvas.width, canvas.height);\r\n\tvar mt = e.frameState.pixelToCoordinateTransform;\r\n\t// Old version (matrix)\r\n\tif (!mt)\r\n\t{\tmt = e.frameState.pixelToCoordinateMatrix,\r\n\t\tmt[2] = mt[4];\r\n\t\tmt[3] = mt[5];\r\n\t\tmt[4] = mt[12];\r\n\t\tmt[5] = mt[13];\r\n\t}\r\n\tvar ratio = e.frameState.pixelRatio;\r\n\tvar res = e.frameState.viewState.resolution;\r\n\tvar w = canvas.width/2, \r\n\t\th = canvas.height/2;\r\n\tctx.save();\r\n\t\tctx.globalCompositeOperation = \"multiply\";\r\n\t\t//ctx.globalCompositeOperation = \"overlay\";\r\n\t\t//ctx.globalCompositeOperation = \"color\";\r\n\t\tctx.globalAlpha = this.get('opacity');\r\n\t\tctx.scale(ratio*this.pattern.scale,ratio*this.pattern.scale);\r\n\t\tif (this.get('rotateWithView'))\r\n\t\t{\t// Translate pattern\r\n\t\t\tres *= this.pattern.scale\r\n\t\t\tctx.fillStyle = this.getPattern ((w*mt[0] + h*mt[1] + mt[4])/res, (w*mt[2] + h*mt[3] + mt[5])/res);\r\n\t\t\t// Rotate on canvas center and fill\r\n\t\t\tctx.translate(w/this.pattern.scale, h/this.pattern.scale);\r\n\t\t\tctx.rotate(e.frameState.viewState.rotation);\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.rect(-w-m, -h-m, 2*m, 2*m);\r\n\t\t\tctx.fill(); \r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t/**/\r\n\t\t\t\tvar dx = -(w*mt[0] + h*mt[1] + mt[4])/res;\r\n\t\t\t\tvar dy = (w*mt[2] + h*mt[3] + mt[5])/res;\r\n\t\t\t\tvar cos = Math.cos(e.frameState.viewState.rotation);\r\n\t\t\t\tvar sin = Math.sin(e.frameState.viewState.rotation);\r\n\t\t\t\tvar offsetX = (dx*cos - dy*sin) / this.pattern.scale;\r\n\t\t\t\tvar offsetY = (dx*sin + dy*cos) / this.pattern.scale;\r\n\t\t\t\tctx.translate(offsetX, offsetY);\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.fillStyle = this.pattern.ctx.fillStyle;\r\n\t\t\t\tctx.rect(-offsetX -m , -offsetY -m, 2*m, 2*m);\r\n\t\t\t\tctx.fill(); \r\n\t\t\t/*\t//old version without centered rotation\r\n\t\t\t\tvar offsetX = -(e.frameState.extent[0]/res) % this.pattern.canvas.width;\r\n\t\t\t\tvar offsetY = (e.frameState.extent[1]/res) % this.pattern.canvas.height;\r\n\t\t\t\tctx.rotate(e.frameState.viewState.rotation);\r\n\t\t\t\tctx.translate(offsetX, offsetY);\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.fillStyle = this.pattern.ctx.fillStyle\r\n\t\t\t\tctx.rect(-offsetX -m , -offsetY -m, 2*m, 2*m);\r\n\t\t\t\tctx.fill(); \r\n\t\t\t*/\r\n\t\t}\r\n\tctx.restore();\r\n}\r\n\r\n/*eslint no-constant-condition: [\"error\", { \"checkLoops\": false }]*/\r\n/** Feature format for reading and writing data in the GeoJSONX format.\r\n * @constructor \r\n * @extends {ol.format.GeoJSON}\r\n * @param {*} options options.\r\n *  @param {number} options.decimals number of decimals to save, default 7 for EPSG:4326, 2 for other projections\r\n *  @param {boolean|Array<*>} options.deleteNullProperties An array of property values to remove, if false, keep all properties, default [null,undefined,\"\"]\r\n *  @param {boolean|Array<*>} options.extended Decode/encode extended GeoJSON with foreign members (id, bbox, title, etc.), default false\r\n *  @param {Array<string>|function} options.whiteList A list of properties to keep on features when encoding or a function that takes a property name and retrun true if the property is whitelisted\r\n *  @param {Array<string>|function} options.blackList A list of properties to remove from features when encoding or a function that takes a property name and retrun true if the property is blacklisted\r\n *  @param {string} [options.layout='XY'] layout layout (XY or XYZ or XYZM)\r\n *  @param {ol.ProjectionLike} options.dataProjection Projection of the data we are reading. If not provided `EPSG:4326`\r\n *  @param {ol.ProjectionLike} options.featureProjection Projection of the feature geometries created by the format reader. If not provided, features will be returned in the dataProjection.\r\n */\r\nol.format.GeoJSONX = function(options) {\r\n  options = options || {};\r\n  ol.format.GeoJSON.call (this, options);\r\n  this._hash = {};\r\n  this._count = 0;\r\n  this._extended = options.extended;\r\n  if (typeof(options.whiteList)==='function') {\r\n    this._whiteList = options.whiteList;\r\n  } else if (options.whiteList && options.whiteList.indexOf) {\r\n    this._whiteList = function (k) { return options.whiteList.indexOf(k) > -1 };\r\n  } else {\r\n    this._whiteList = function() { return true };\r\n  } \r\n  if (typeof(options.blackList)==='function') {\r\n    this._blackList = options.blackList;\r\n  } else if (options.blackList && options.blackList.indexOf) {\r\n    this._blackList = function (k) { return options.blackList.indexOf(k) > -1 };\r\n  } else {\r\n    this._blackList = function() { return false };\r\n  } \r\n  this._deleteNull = options.deleteNullProperties===false ? false : [null,undefined,\"\"];\r\n  var decimals = 2;\r\n  if (!options.dataProjection || options.dataProjection === 'EPSG:4326') decimals = 7;\r\n  if (!isNaN(parseInt(options.decimals))) decimals = parseInt(options.decimals);\r\n  this._decimals = decimals;\r\n  this.setLayout(options.layout || 'XY');\r\n};\r\nol.ext.inherits(ol.format.GeoJSONX, ol.format.GeoJSON);\r\n/** Radix */\r\nol.format.GeoJSONX.prototype._radix = \r\n'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ !#$%&\\'()*-.:<=>?@[]^_`{|}~';\r\n/** Radix size */\r\nol.format.GeoJSONX.prototype._size = ol.format.GeoJSONX.prototype._radix.length;\r\n/** GeoSJON types */\r\nol.format.GeoJSONX.prototype._type = {\r\n  \"Point\": 0,\r\n  \"LineString\": 1,\r\n  \"Polygon\": 2,\r\n  \"MultiPoint\": 3,\r\n  \"MultiLineString\": 4,\r\n  \"MultiPolygon\": 5,\r\n  \"GeometryCollection\": null // Not supported\r\n};\r\n/** GeoSJONX types */\r\nol.format.GeoJSONX.prototype._toType = [\r\n  \"Point\",\r\n  \"LineString\",\r\n  \"Polygon\",\r\n  \"MultiPoint\",\r\n  \"MultiLineString\",\r\n  \"MultiPolygon\"\r\n];\r\n/** Set geometry layout\r\n * @param {string} layout the geometry layout (XY or XYZ or XYZM)\r\n */\r\nol.format.GeoJSONX.prototype.setLayout = function(layout) {\r\n  switch(layout) {\r\n    case 'XYZ': \r\n    case 'XYZM': {\r\n      this._layout = layout;\r\n      break;\r\n    }\r\n    default:  {\r\n      this._layout = 'XY';\r\n      break;\r\n    }\r\n  }\r\n};\r\n/** Get geometry layout\r\n * @return {string} layout \r\n */\r\nol.format.GeoJSONX.prototype.getLayout = function() {\r\n  return this._layout;\r\n};\r\n/** Encode a number\r\n * @param {number} number Number to encode\r\n * @param {number} decimals Number of decimals\r\n * @param {string}\r\n */\r\nol.format.GeoJSONX.prototype.encodeNumber = function(number, decimals) {\r\n  if (isNaN(Number(number)) || number === null || !isFinite(number)) {\r\n    number = 0;\r\n  }\r\n  if (!decimals && decimals!==0) decimals = this._decimals;\r\n  // Round number\r\n  number = Math.round(number * Math.pow(10, decimals));\r\n  // Zigzag encoding (get positive number)\r\n  if (number<0) number = -2*number - 1;\r\n  else number = 2*number;\r\n  // Encode\r\n  var result = '';\r\n  var modulo, residual = number;\r\n  while (true) {\r\n    modulo = residual % this._size\r\n    result = this._radix.charAt(modulo) + result;\r\n    residual = Math.floor(residual / this._size);\r\n    if (residual == 0) break;\r\n  }\r\n  return result;\r\n};\r\n/** Decode a number\r\n * @param {string} s \r\n * @param {number} decimals Number of decimals\r\n * @return {number}\r\n */\r\nol.format.GeoJSONX.prototype.decodeNumber = function(s, decimals) {\r\n  if (!decimals && decimals!==0) decimals = this._decimals;\r\n  var decode = 0;\r\n  s.split('').forEach(function (c) {\r\n    decode = (decode * this._size) + this._radix.indexOf(c);\r\n  }.bind(this));\r\n  // Zigzag encoding\r\n  var result = Math.floor(decode/2)\r\n  if (result !== decode/2) result = -1-result;\r\n  return result / Math.pow(10, decimals);\r\n};\r\n/** Encode coordinates\r\n * @param {ol.coordinate|Array<ol.coordinate>} v\r\n * @param {number} decimal\r\n * @return {string|Array<string>}\r\n * @api\r\n */\r\nol.format.GeoJSONX.prototype.encodeCoordinates = function(v, decimal) {\r\n  var i, p, tp;\r\n  if (typeof(v[0]) === 'number') {\r\n    p = this.encodeNumber(v[0], decimal) +','+ this.encodeNumber(v[1], decimal);\r\n    if (this._layout[2]=='Z' && v.length > 2) p += ',' + this.encodeNumber(v[i][2], 2);\r\n    if (this._layout[3]=='M' && v.length > 3) p += ',' + this.encodeNumber(v[i][3], 0);\r\n    return p;\r\n  } else if (v.length && v[0]) {\r\n    if (typeof(v[0][0]) === 'number') {\r\n      var dxy = [0,0,0,0];\r\n      var xy = [];\r\n      var hasZ = (this._layout[2]=='Z' && v[0].length > 2);\r\n      var hasM = (this._layout[3]=='M' && v[0].length > 3);\r\n      for (i=0; i<v.length; i++) {\r\n        tp = [\r\n          Math.round( v[i][0] * Math.pow(10, decimal)),\r\n          Math.round( v[i][1] * Math.pow(10, decimal))\r\n        ];\r\n        if (hasZ) tp[2] = v[i][2];\r\n        if (hasM) tp[3] = v[i][3];\r\n        v[i] = tp;\r\n        var dx = v[i][0] - dxy[0];\r\n        var dy = v[i][1] - dxy[1];\r\n        if (i==0 || (dx!==0 || dy!==0)) {\r\n          p = this.encodeNumber(dx, 0) +','\r\n            + this.encodeNumber(dy, 0)\r\n            + (hasZ ? ',' + this.encodeNumber(v[i][2] - dxy[2], 2) : '')\r\n            + (hasM ? ',' + this.encodeNumber(v[i][3] - dxy[3], 0) : '');\r\n          xy.push(p);\r\n          dxy = v[i];\r\n        }\r\n      }\r\n      // Almost 2 points...\r\n      // if (xy.length<2) xy.push('A,A');\r\n      return xy.join(';');\r\n    } else {\r\n      for (i=0; i<v.length; i++) {\r\n        v[i] = this.encodeCoordinates(v[i], decimal);\r\n      }\r\n      return v;\r\n    }\r\n  } else {\r\n    return this.encodeCoordinates([0,0], decimal);\r\n  }\r\n};\r\n/** Decode coordinates\r\n * @param {string|Array<string>}\r\n * @param {number} decimal Number of decimals\r\n * @return {ol.coordinate|Array<ol.coordinate>} v\r\n * @api\r\n */\r\nol.format.GeoJSONX.prototype.decodeCoordinates = function(v, decimals) {\r\n  var i, p;\r\n  if (typeof(v) === 'string') {\r\n    v = v.split(';');\r\n    if (v.length>1) {\r\n      var pow = Math.pow(10,decimals);\r\n      var dxy = [0,0,0,0];\r\n      v.forEach(function(vi, i) {\r\n        v[i] = vi.split(',');\r\n        v[i][0] = Math.round((this.decodeNumber(v[i][0], decimals) + dxy[0]) * pow) / pow;\r\n        v[i][1] = Math.round((this.decodeNumber(v[i][1], decimals) + dxy[1]) * pow) / pow;\r\n        if (v[i].length > 2) v[i][2] = Math.round((this.decodeNumber(v[i][2], 2) + dxy[2]) * pow) / pow;\r\n        if (v[i].length > 3) v[i][3] = Math.round((this.decodeNumber(v[i][3], 0) + dxy[3]) * pow) / pow;\r\n        dxy = v[i];\r\n      }.bind(this));\r\n      return v;\r\n    } else {\r\n      v = v[0].split(',');\r\n      p = [ this.decodeNumber(v[0], decimals), this.decodeNumber(v[1], decimals) ];\r\n      if (v.length > 2) p[2] = this.decodeNumber(v[2], 2);\r\n      if (v.length > 3) p[3] = this.decodeNumber(v[3], 0);\r\n      return p;\r\n    }\r\n  } else if (v.length) {\r\n    var r = [];\r\n    for (i=0; i<v.length; i++) {\r\n      r[i] = this.decodeCoordinates(v[i], decimals);\r\n    }\r\n    return r;\r\n  } else {\r\n    return [0,0];\r\n  }\r\n};\r\n/** Encode an array of features as a GeoJSONX object.\r\n * @param {Array<ol.Feature>} features Features.\r\n * @param {*} options Write options.\r\n * @return {*} GeoJSONX Object.\r\n * @override\r\n * @api\r\n */\r\nol.format.GeoJSONX.prototype.writeFeaturesObject = function (features, options) {\r\n  options = options || {};\r\n  this._count = 0;\r\n  this._hash = {};\r\n  var geojson = ol.format.GeoJSON.prototype.writeFeaturesObject.call(this, features, options);\r\n  geojson.decimals = this._decimals;\r\n  geojson.hashProperties = [];\r\n  Object.keys(this._hash).forEach(function(k) {\r\n    geojson.hashProperties.push(k);\r\n  }.bind(this));\r\n  this._count = 0;\r\n  this._hash = {};\r\n  // Push features at the end of the object\r\n  var temp = geojson.features;\r\n  delete geojson.features;\r\n  geojson.features = temp;\r\n  return geojson;\r\n};\r\n/** Encode a set of features as a GeoJSONX object.\r\n * @param {ol.Feature} feature Feature\r\n * @param {*} options Write options.\r\n * @return {*} GeoJSONX Object.\r\n * @override\r\n * @api\r\n */\r\nol.format.GeoJSONX.prototype.writeFeatureObject = function(source, options) {\r\n  var f0 = ol.format.GeoJSON.prototype.writeFeatureObject.call(this, source, options);\r\n  // Only features supported yet\r\n  if (f0.type !== 'Feature') throw 'GeoJSONX doesn\\'t support '+f0.type+'.';\r\n  var f = [];\r\n  // Encode geometry\r\n  if (f0.geometry.type==='Point') {\r\n    f.push(this.encodeCoordinates(f0.geometry.coordinates, this._decimals));\r\n  } else if (f0.geometry.type==='MultiPoint') {\r\n    var pts = [];\r\n    f0.geometry.coordinates.forEach(function(p) {\r\n      pts.push(this.encodeCoordinates(p, this._decimals));\r\n    }.bind(this));\r\n    f.push ([\r\n      this._type[f0.geometry.type],\r\n      pts.join(';')\r\n    ]);\r\n  } else {\r\n    if (!this._type[f0.geometry.type]) {\r\n      throw 'GeoJSONX doesn\\'t support '+f0.geometry.type+'.';\r\n    }\r\n    f.push ([\r\n      this._type[f0.geometry.type],\r\n      this.encodeCoordinates(f0.geometry.coordinates, this._decimals)\r\n    ]);\r\n  }\r\n  // Encode properties\r\n  var k;\r\n  var prop = [];\r\n  for (k in f0.properties) {\r\n    if (!this._whiteList(k) || this._blackList(k)) continue;\r\n    if (!this._hash.hasOwnProperty(k)) {\r\n      this._hash[k] = this._count;\r\n      this._count++;\r\n    }\r\n    if (!this._deleteNull || this._deleteNull.indexOf(f0.properties[k])<0) {\r\n      prop.push (this._hash[k], f0.properties[k]);\r\n    }\r\n  }\r\n  // Create prop table\r\n  if (prop.length || this._extended) {\r\n    f.push(prop);\r\n  }\r\n  // Other properties (id, title, bbox, centerline...\r\n  if (this._extended) {\r\n    var found = false;\r\n    prop = {};\r\n    for (k in f0) {\r\n      if (!/^type$|^geometry$|^properties$/.test(k)) {\r\n        prop[k] = f0[k];\r\n        found = true;\r\n      }\r\n    }\r\n    if (found) f.push(prop);\r\n  }\r\n  return f;\r\n};\r\n/** Encode a geometry as a GeoJSONX object.\r\n * @param {ol.geom.Geometry} geometry Geometry.\r\n * @param {*} options Write options.\r\n * @return {*} Object.\r\n * @override\r\n * @api\r\n */\r\nol.format.GeoJSONX.prototype.writeGeometryObject = function(source, options) {\r\n  var g = ol.format.GeoJSON.prototype.writeGeometryObject.call(this, source, options);\r\n  // Encode geometry\r\n  if (g.type==='Point') {\r\n    return this.encodeCoordinates(g.coordinates, this._decimals)\r\n  } else {\r\n    return [\r\n      this._type[g.type],\r\n      this.encodeCoordinates(g.coordinates, this._decimals)\r\n    ];\r\n  }\r\n};\r\n/** Decode a GeoJSONX object.\r\n * @param {*} object GeoJSONX\r\n * @param {*} options Read options.\r\n * @return {Array<ol.Feature>}\r\n * @override\r\n * @api\r\n */\r\nol.format.GeoJSONX.prototype.readFeaturesFromObject = function (object, options) {\r\n  this._hashProperties = object.hashProperties || [];\r\n  options = options || {};\r\n  options.decimals = parseInt(object.decimals);\r\n  if (!options.decimals && options.decimals!==0) throw 'Bad file format...';\r\n  var features = ol.format.GeoJSON.prototype.readFeaturesFromObject.call(this, object, options);\r\n  return features;\r\n};\r\n/** Decode GeoJSONX Feature object.\r\n * @param {*} object GeoJSONX\r\n * @param {*} options Read options.\r\n * @return {ol.Feature}\r\n */\r\nol.format.GeoJSONX.prototype.readFeatureFromObject = function (f0, options) {\r\n  var f = {\r\n    type: 'Feature'\r\n  }\r\n  if (typeof(f0[0]) === 'string') {\r\n    f.geometry = {\r\n      type: 'Point',\r\n      coordinates: this.decodeCoordinates(f0[0], typeof(options.decimals) === 'number' ? options.decimals : this.decimals)\r\n    }  \r\n  } else {\r\n    f.geometry = {\r\n      type: this._toType[f0[0][0]]\r\n    }\r\n    if (f.geometry.type === 'MultiPoint') {\r\n      var g = f.geometry.coordinates = [];\r\n      var coords = f0[0][1].split(';');\r\n      coords.forEach(function(c) {\r\n        c = c.split(',');\r\n        g.push([this.decodeNumber(c[0], options.decimals), this.decodeNumber(c[1], options.decimals)])\r\n      }.bind(this));\r\n    } else {\r\n      f.geometry.coordinates = this.decodeCoordinates(f0[0][1], typeof(options.decimals) === 'number' ? options.decimals : this.decimals);\r\n    }\r\n  }\r\n  if (this._hashProperties && f0[1]) {\r\n    f.properties = {};\r\n    var t = f0[1];\r\n    for (var i=0; i<t.length; i+=2) {\r\n      f.properties[this._hashProperties[t[i]]] = t[i+1];\r\n    }\r\n  } else {\r\n    f.properties = f0[1];\r\n  }\r\n  // Extended properties\r\n  if (f0[2]) {\r\n    for (var k in f0[2]) {\r\n      f[k] = f0[2][k];\r\n    }\r\n  }\r\n  var feature = ol.format.GeoJSON.prototype.readFeatureFromObject.call(this, f, options);\r\n  return feature;\r\n};\r\n\r\n/** Feature format for reading and writing data in the GeoJSONP format,\r\n * using Polyline Algorithm to encode geometry.\r\n * @constructor \r\n * @extends {ol.format.GeoJSON}\r\n * @param {*} options options.\r\n *  @param {number} options.decimals number of decimals to save, default 6\r\n *  @param {ol.ProjectionLike} options.dataProjection Projection of the data we are reading. If not provided `EPSG:4326`\r\n *  @param {ol.ProjectionLike} options.featureProjection Projection of the feature geometries created by the format reader. If not provided, features will be returned in the dataProjection.\r\n */\r\nol.format.GeoJSONP = function(options) {\r\n  options = options || {};\r\n  ol.format.GeoJSONX.call (this, options);\r\n  this._lineFormat = new ol.format.Polyline({ factor: Math.pow(10, options.decimals || 6) });\r\n};\r\nol.ext.inherits(ol.format.GeoJSONP, ol.format.GeoJSONX);\r\n/** Encode coordinates\r\n * @param {ol.coordinate|Array<ol.coordinate>} v\r\n * @return {string|Array<string>}\r\n * @api\r\n */\r\nol.format.GeoJSONP.prototype.encodeCoordinates = function(v) {\r\n  var g;\r\n  if (typeof(v[0]) === 'number') {\r\n    g = new ol.geom.Point(v);\r\n    return this._lineFormat.writeGeometry(g);\r\n  } else if (v.length && v[0]) {\r\n    var tab = (typeof(v[0][0]) === 'number');\r\n    if (tab) {\r\n      g = new ol.geom.LineString(v);\r\n      return this._lineFormat.writeGeometry(g);\r\n    } else {\r\n      var r = [];\r\n      for (var i=0; i<v.length; i++) {\r\n        r[i] = this.encodeCoordinates(v[i]);\r\n      }\r\n      return r;\r\n    }\r\n  } else {\r\n    return this.encodeCoordinates([0,0]);\r\n  }\r\n};\r\n/** Decode coordinates\r\n * @param {string|Array<string>}\r\n * @return {ol.coordinate|Array<ol.coordinate>} v\r\n * @api\r\n */\r\nol.format.GeoJSONP.prototype.decodeCoordinates = function(v) {\r\n  var i, g;\r\n  if (typeof(v) === 'string') {\r\n    g = this._lineFormat.readGeometry(v);\r\n    return g.getCoordinates()[0];\r\n  } else if (v.length) {\r\n    var tab = (typeof(v[0]) === 'string');\r\n    var r = [];\r\n    if (tab) {\r\n      for (i=0; i<v.length; i++) {\r\n        g = this._lineFormat.readGeometry(v[i]);\r\n        r[i] = g.getCoordinates();\r\n      }\r\n    } else {\r\n      for (i=0; i<v.length; i++) {\r\n        r[i] = this.decodeCoordinates(v[i]);\r\n      }\r\n    }\r\n    return r;\r\n  } else {\r\n    return null;\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Feature format for reading data in the GeoRSS format.\r\n * @constructor ol.fromat.GeoRSS\r\n * @extends {ol.Object}\r\n * @param {*} options options.\r\n *  @param {ol.ProjectionLike} options.dataProjection Projection of the data we are reading. If not provided `EPSG:4326`\r\n *  @param {ol.ProjectionLike} options.featureProjection Projection of the feature geometries created by the format reader. If not provided, features will be returned in the dataProjection.\r\n */\r\nol.format.GeoRSS = function(options) {\r\n  options = options || {};\r\n  ol.Object.call (this, options);\r\n};\r\nol.ext.inherits(ol.format.GeoRSS, ol.Object);\r\n/**\r\n * Read a feature.  Only works for a single feature. Use `readFeatures` to\r\n * read a feature collection.\r\n *\r\n * @param {Node|string} source Source.\r\n * @param {*} options Read options.\r\n *  @param {ol.ProjectionLike} options.dataProjection Projection of the data we are reading. If not provided `EPSG:4326`\r\n *  @param {ol.ProjectionLike} options.featureProjection Projection of the feature geometries created by the format reader. If not provided, features will be returned in the dataProjection.\r\n * @return {ol.Feature} Feature or null if no feature read\r\n * @api\r\n */\r\nol.format.GeoRSS.prototype.readFeature = function(source, options) {\r\n  options = options || {};\r\n  var att, atts = source.children;\r\n  var f = new ol.Feature();\r\n  // Get attributes\r\n  for (var j=0; att = atts[j]; j++) {\r\n    f.set(att.tagName, att.innerHTML);\r\n  }\r\n  var temp, g, coord=[];\r\n  // Get geometry\r\n  if (f.get('geo:long')) {\r\n    // LonLat\r\n    g = new ol.geom.Point([parseFloat(f.get('geo:long')), parseFloat(f.get('geo:lat'))]);\r\n    f.unset('geo:long');\r\n    f.unset('geo:lat');\r\n  } else if (f.get('georss:point')) {\r\n    // Point\r\n    coord = f.get('georss:point').trim().split(' ');\r\n    g = new ol.geom.Point([parseFloat(coord[1]), parseFloat(coord[0])]);\r\n    f.unset('georss:point');\r\n  } else if (f.get('georss:polygon')) {\r\n    // Polygon\r\n    temp = f.get('georss:polygon').trim().split(' ');\r\n    for (var i=0; i<temp.length; i += 2) {\r\n      coord.push([parseFloat(temp[i+1]), parseFloat(temp[i])]) \r\n    }\r\n    g = new ol.geom.Polygon([coord]);\r\n    f.unset('georss:polygon');\r\n  } else if (f.get('georss:where')) {\r\n    // GML\r\n    console.warn('[GeoRSS] GML format not implemented')\r\n    f.unset('georss:where');\r\n    return null;\r\n  } else {\r\n    console.warn('[GeoRSS] unknown geometry')\r\n    return null;\r\n  }\r\n  if (options.featureProjection || this.get('featureProjection')) {\r\n    g.transform (options.dataProjection || this.get('dataProjection') || 'EPSG:4326', options.featureProjection || this.get('featureProjection'));\r\n  }\r\n  f.setGeometry(g);\r\n  return f;\r\n};\r\n/**\r\n * Read all features.  Works with both a single feature and a feature\r\n * collection.\r\n *\r\n * @param {Document|Node|string} source Source.\r\n * @param {*} options Read options.\r\n *  @param {ol.ProjectionLike} options.dataProjection Projection of the data we are reading. If not provided `EPSG:4326`\r\n *  @param {ol.ProjectionLike} options.featureProjection Projection of the feature geometries created by the format reader. If not provided, features will be returned in the dataProjection.\r\n * @return {Array<ol.Feature>} Features.\r\n * @api\r\n */\r\nol.format.GeoRSS.prototype.readFeatures = function(source, options) {\r\n  var items;\r\n  if (typeof(source)==='string') {\r\n    var parser = new DOMParser();\r\n    var xmlDoc = parser.parseFromString(source,\"text/xml\");\r\n    items = xmlDoc.getElementsByTagName(this.getDocumentItemsTagName(xmlDoc));\r\n  } else if (source instanceof Document) {\r\n    items = source.getElementsByTagName(this.getDocumentItemsTagName(source));\r\n  } else if (source instanceof Node) {\r\n    items = source;\r\n  } else {\r\n    return [];\r\n  }\r\n  var features = []\r\n  for (var i=0, item; item = items[i]; i++) {\r\n    var f = this.readFeature(item, options);\r\n    if (f) features.push(f);\r\n  }\r\n  return features;\r\n};\r\n/**\r\n * Get the tag name for the items in the XML Document depending if we are\r\n * dealing with an atom base document or not.\r\n * @param {Document} xmlDoc document to extract the tag name for the items\r\n * @return {string} tag name\r\n * @private\r\n */\r\nol.format.GeoRSS.prototype.getDocumentItemsTagName = function(xmlDoc) {\r\n  switch (xmlDoc.documentElement.tagName) {\r\n    case 'feed':\r\n      return 'entry';\r\n    default:\r\n      return 'item';\r\n  }\r\n}\r\n\r\n/** Clip interaction to clip layers in a circle\r\n * @constructor\r\n * @extends {ol.interaction.Pointer}\r\n * @param {ol.interaction.Clip.options} options flashlight  param\r\n *  @param {number} options.radius radius of the clip, default 100\r\n *\t@param {ol.layer|Array<ol.layer>} options.layers layers to clip\r\n */\r\nol.interaction.Clip = function(options) {\r\n  this.layers_ = [];\r\n  ol.interaction.Pointer.call(this, {\r\n    handleDownEvent: this._setPosition,\r\n    handleMoveEvent: this._setPosition\r\n  });\r\n  this.precomposeBind_ = this.precompose_.bind(this);\r\n  this.postcomposeBind_ = this.postcompose_.bind(this);\r\n  // Default options\r\n  options = options || {};\r\n  this.pos = false;\r\n  this.radius = (options.radius||100);\r\n  if (options.layers) this.addLayer(options.layers);\r\n};\r\nol.ext.inherits(ol.interaction.Clip, ol.interaction.Pointer);\r\n/** Set the map > start postcompose\r\n*/\r\nol.interaction.Clip.prototype.setMap = function(map) {\r\n  var i;\r\n  if (this.getMap()) {\r\n    for (i=0; i<this.layers_.length; i++) {\r\n      this.layers_[i].un(['precompose','prerender'], this.precomposeBind_);\r\n      this.layers_[i].un(['postcompose','postrender'], this.postcomposeBind_);\r\n    }\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n  ol.interaction.Pointer.prototype.setMap.call(this, map);\r\n  if (map) {\r\n    for (i=0; i<this.layers_.length; i++) {\r\n      this.layers_[i].on(['precompose','prerender'], this.precomposeBind_);\r\n      this.layers_[i].on(['postcompose','postrender'], this.postcomposeBind_);\r\n    }\r\n    try { map.renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** Set clip radius\r\n *\t@param {integer} radius\r\n */\r\nol.interaction.Clip.prototype.setRadius = function(radius) {\r\n  this.radius = radius;\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** Get clip radius\r\n *\t@returns {integer} radius\r\n */\r\nol.interaction.Clip.prototype.getRadius = function() {\r\n  return this.radius;\r\n};\r\n/** Add a layer to clip\r\n *\t@param {ol.layer|Array<ol.layer>} layer to clip\r\n*/\r\nol.interaction.Clip.prototype.addLayer = function(layers)  {\r\n  if (!(layers instanceof Array)) layers = [layers];\r\n  for (var i=0; i<layers.length; i++) {\r\n    if (this.getMap()) {\r\n      layers[i].on(['precompose','prerender'], this.precomposeBind_);\r\n      layers[i].on(['postcompose','postrender'], this.postcomposeBind_);\r\n      try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n    }\r\n    this.layers_.push(layers[i]);\r\n  }\r\n};\r\n/** Remove all layers\r\n */\r\nol.interaction.Clip.prototype.removeLayers = function() {\r\n  this.removeLayer(this.layers_);\r\n};\r\n/** Remove a layer to clip\r\n *\t@param {ol.layer|Array<ol.layer>} layer to clip\r\n*/\r\nol.interaction.Clip.prototype.removeLayer = function(layers) {\r\n  if (!(layers instanceof Array)) layers = [layers];\r\n  for (var i=0; i<layers.length; i++) {\r\n    var k;\r\n    for (k=0; k<this.layers_.length; k++) {\r\n      if (this.layers_[k]===layers[i]) {\r\n        break;\r\n      }\r\n    }\r\n    if (k!=this.layers_.length && this.getMap()) {\r\n      this.layers_[k].un(['precompose','prerender'], this.precomposeBind_);\r\n      this.layers_[k].un(['postcompose','postrender'], this.postcomposeBind_);\r\n      this.layers_.splice(k,1);\r\n    }\r\n  }\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** Set position of the clip\r\n * @param {ol.coordinate} coord\r\n */\r\nol.interaction.Clip.prototype.setPosition = function(coord) {\r\n  if (this.getMap()) {\r\n    this.pos = this.getMap().getPixelFromCoordinate(coord);\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** Get position of the clip\r\n * @returns {ol.coordinate}\r\n */\r\nol.interaction.Clip.prototype.getPosition = function() {\r\n  if (this.pos) return this.getMap().getCoordinateFromPixel(this.pos);\r\n  return null;\r\n};\r\n/** Set position of the clip\r\n * @param {ol.Pixel} pixel\r\n */\r\n ol.interaction.Clip.prototype.setPixelPosition = function(pixel) {\r\n  this.pos = pixel;\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/** Get position of the clip\r\n * @returns {ol.Pixel} pixel\r\n */\r\n ol.interaction.Clip.prototype.getPixelPosition = function() {\r\n  return this.pos;\r\n};\r\n/** Set position of the clip\r\n * @param {ol.MapBrowserEvent} e\r\n * @privata\r\n */\r\nol.interaction.Clip.prototype._setPosition = function(e) {\r\n  if (e.type==='pointermove' && this.get('action')==='onclick') return;\r\n  if (e.pixel) {\r\n    this.pos = e.pixel;\r\n  }\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n/* @private\r\n*/\r\nol.interaction.Clip.prototype.precompose_ = function(e) {\r\n  if (!this.getActive()) return;\r\n  var ctx = e.context;\r\n  var ratio = e.frameState.pixelRatio;\r\n  ctx.save();\r\n  ctx.beginPath();\r\n  var pt = [ this.pos[0], this.pos[1] ];\r\n  var radius = this.radius;\r\n  var tr = e.inversePixelTransform;\r\n  if (tr) {\r\n    pt = [\r\n      (pt[0]*tr[0] - pt[1]*tr[1] + tr[4]),\r\n      (-pt[0]*tr[2] + pt[1]*tr[3] + tr[5])\r\n    ];\r\n  } else {\r\n    pt[0] *= ratio;\r\n    pt[1] *= ratio;\r\n    radius *= ratio;\r\n  }\r\n  ctx.arc (pt[0], pt[1], radius, 0, 2*Math.PI);\r\n  ctx.clip();\r\n};\r\n/* @private\r\n*/\r\nol.interaction.Clip.prototype.postcompose_ = function(e) {\r\n  if (!this.getActive()) return;\r\n  e.context.restore();\r\n};\r\n/**\r\n * Activate or deactivate the interaction.\r\n * @param {boolean} active Active.\r\n * @observable\r\n * @api\r\n */\r\nol.interaction.Clip.prototype.setActive = function(b) {\r\n  if (b===this.getActive()) return;\r\n  ol.interaction.Pointer.prototype.setActive.call (this, b);\r\n  var i;\r\n  if (b) {\r\n    for(i=0; i<this.layers_.length; i++) {\r\n      this.layers_[i].on(['precompose','prerender'], this.precomposeBind_);\r\n      this.layers_[i].on(['postcompose','postrender'], this.postcomposeBind_);\r\n    }\r\n  } else {\r\n    for(i=0; i<this.layers_.length; i++) {\r\n      this.layers_[i].un(['precompose','prerender'], this.precomposeBind_);\r\n      this.layers_[i].un(['postcompose','postrender'], this.postcomposeBind_);\r\n    }\r\n  }\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n};\r\n\r\n/** An interaction to check the current map and add key events listeners.\r\n * It will fire a 'focus' event on the map when map is focused (use mapCondition option to handle the condition when the map is focused).\r\n * @constructor\r\n * @fires focus\r\n * @param {*} options\r\n *  @param {function} condition a function that takes a mapBrowserEvent and returns true if the map must be activated, default always true\r\n *  @param {function} onKeyDown a function that takes a keydown event is fired on the active map\r\n *  @param {function} onKeyPress a function that takes a keypress event is fired on the active map\r\n *  @param {function} onKeyUp a function that takes a keyup event is fired on the active map\r\n * @extends {ol.interaction.Interaction}\r\n */\r\nol.interaction.CurrentMap = function(options) {\r\n  options = options || {};\r\n  var condition = options.condition || function() {\r\n    return true;\r\n  }\r\n  // Check events on the map\r\n  ol.interaction.Interaction.call(this, {\r\n    handleEvent: function(e) {\r\n      if (condition(e)) {\r\n        if (!this.isCurrentMap()) {\r\n          this.setCurrentMap(this.getMap());\r\n          this.dispatchEvent({ type: 'focus', map: this.getMap() });\r\n          this.getMap().dispatchEvent({ type: 'focus', map: this.getMap() });\r\n        }\r\n      }\r\n      return true;\r\n    }.bind(this)\r\n  });\r\n  // Add a key listener\r\n  if (options.onKeyDown) { \r\n    document.addEventListener('keydown', function(e) {\r\n      if (this.isCurrentMap() && !/INPUT|TEXTAREA|SELECT/.test(document.activeElement.tagName)) {\r\n        options.onKeyDown ({ type: e.type, map: this.getMap(), originalEvent: e });\r\n      }\r\n    }.bind(this));\r\n  }\r\n  if (options.onKeyPress) { \r\n    document.addEventListener('keydown', function(e) {\r\n      if (this.isCurrentMap() && !/INPUT|TEXTAREA|SELECT/.test(document.activeElement.tagName)) {\r\n        options.onKeyPress ({ type: e.type, map: this.getMap(), originalEvent: e });\r\n      }\r\n    }.bind(this));\r\n  }\r\n  if (options.onKeyUp) { \r\n    document.addEventListener('keydown', function(e) {\r\n      if (this.isCurrentMap() && !/INPUT|TEXTAREA|SELECT/.test(document.activeElement.tagName)) {\r\n        options.onKeyUp ({ type: e.type, map: this.getMap(), originalEvent: e });\r\n      }\r\n    }.bind(this));\r\n  }\r\n};\r\nol.ext.inherits(ol.interaction.CurrentMap, ol.interaction.Interaction);\r\n/** The current map */\r\nol.interaction.CurrentMap.prototype._currentMap = undefined;\r\n/** Check if is the current map \r\n * @return {boolean}\r\n */\r\nol.interaction.CurrentMap.prototype.isCurrentMap = function() {\r\n  return this.getMap() === ol.interaction.CurrentMap.prototype._currentMap;\r\n};\r\n/** Get the current map\r\n * @return {ol.Map}\r\n */\r\nol.interaction.CurrentMap.prototype.getCurrentMap = function() {\r\n  return ol.interaction.CurrentMap.prototype._currentMap;\r\n};\r\n/** Set the current map\r\n * @param {ol.Map} map\r\n */\r\nol.interaction.CurrentMap.prototype.setCurrentMap = function(map) {\r\n  ol.interaction.CurrentMap.prototype._currentMap = map;\r\n};\r\n\r\n/** Blob interaction to clip layers in a blob\r\n * @constructor\r\n * @extends {ol.interaction.Clip}\r\n * @param {*} options blob  options\r\n *  @param {number} options.radius radius of the clip, default 100\r\n *\t@param {ol.layer|Array<ol.layer>} options.layers layers to clip\r\n *\t@param {number} [options.stiffness=20] spring stiffness coef, default 20\r\n *\t@param {number} [options.damping=7] spring damping coef\r\n *\t@param {number} [options.mass=1] blob mass\r\n *\t@param {number} [options.points=10] number of points for the blob polygon\r\n *\t@param {number} [options.tension=.5] blob polygon spline tension \r\n *\t@param {number} [options.fuss] bob fussing factor\r\n *\t@param {number} [options.amplitude=1] blob deformation amplitude factor\r\n */\r\nol.interaction.Blob = function(options) {\r\n  ol.interaction.Clip.call(this, options);\r\n};\r\nol.ext.inherits(ol.interaction.Blob, ol.interaction.Clip);\r\n/** Animate the blob\r\n * @private\r\n */\r\nol.interaction.Blob.prototype.precompose_ = function(e) {\r\n  if (!this.getActive()) return;\r\n  var ctx = e.context;\r\n  var ratio = e.frameState.pixelRatio;\r\n  ctx.save();\r\n  if (!this.pos) {\r\n    ctx.beginPath();\r\n    ctx.moveTo (0,0);\r\n    ctx.clip();\r\n    return;\r\n  }\r\n  var pt = [ this.pos[0], this.pos[1] ];\r\n  var tr = e.inversePixelTransform;\r\n  if (tr) {\r\n    pt = [\r\n      (pt[0]*tr[0] - pt[1]*tr[1] + tr[4]),\r\n      (-pt[0]*tr[2] + pt[1]*tr[3] + tr[5])\r\n    ];\r\n  } else {\r\n    pt[0] *= ratio;\r\n    pt[1] *= ratio;\r\n  }\r\n  // Time laps\r\n  if (!this.frame) this.frame = e.frameState.time;\r\n  var dt = e.frameState.time - this.frame;\r\n  this.frame = e.frameState.time;\r\n  // Blob position\r\n  pt = this._getCenter(pt, dt);\r\n  // Blob geom\r\n  var blob = this._calculate(dt);\r\n  // Draw\r\n  var p = blob[0];\r\n  ctx.beginPath();\r\n  ctx.moveTo (pt[0] + p[0], pt[1] + p[1]);\r\n  for (var i=1; p=blob[i]; i++) {\r\n    ctx.lineTo (pt[0] + p[0], pt[1] + p[1]);\r\n  }\r\n  ctx.clip();\r\n  e.frameState.animate = true;\r\n};\r\n/** Get blob center with kinetic\r\n * @param {number} dt0 time laps\r\n * @private\r\n */\r\nol.interaction.Blob.prototype._getCenter = function(pt, dt0) {\r\n  if (!this._center) {\r\n    this._center = pt;\r\n    this._velocity = [0, 0];\r\n  } else {\r\n    var k = this.get('stiffness') || 20;     // stiffness\r\n    var d = -1* (this.get('damping') || 7);  // damping\r\n    var mass = Math.max(this.get('mass') || 1, .1);\r\n    var dt = Math.min(dt0/1000, 1/30);\r\n    var fSpring = [\r\n      k * (pt[0] - this._center[0]),\r\n      k * (pt[1] - this._center[1])\r\n    ];\r\n    var fDamping = [\r\n      d * this._velocity[0],\r\n      d * this._velocity[1]\r\n    ];\r\n    var accel = [\r\n      (fSpring[0] + fDamping[0]) / mass,\r\n      (fSpring[1] + fDamping[1]) / mass\r\n    ];\r\n    this._velocity[0] += accel[0] * dt;\r\n    this._velocity[1] += accel[1] * dt;\r\n    this._center[0] += this._velocity[0] * dt;\r\n    this._center[1] += this._velocity[1] * dt;\r\n  }\r\n  return this._center;\r\n};\r\n/** Calculate the blob geom\r\n * @param {number} dt time laps\r\n * @returns {Array<ol.coordinate>}\r\n * @private\r\n */\r\nol.interaction.Blob.prototype._calculate = function(dt) {\r\n  var i, nb = this.get('points') || 10;\r\n  if (!this._waves || this._waves.length !== nb) {\r\n    this._waves = [];\r\n    for (i = 0; i < nb; i++) {\r\n      this._waves.push({\r\n        angle: Math.random()*Math.PI, \r\n        noise: Math.random()\r\n      });\r\n    }\r\n  }\r\n  var blob = [];\r\n  var speed = (this._velocity[0]*this._velocity[0] + this._velocity[1]*this._velocity[1]) / 500;\r\n  this._rotation = (this._rotation||0) + (this._velocity[0]>0 ? 1 : -1) * Math.min(.015, speed/70000*dt);\r\n  for (i = 0; i < nb; i++) {\r\n    var angle = i * 2 * Math.PI / nb + this._rotation;\r\n    var radius = this.radius + Math.min(this.radius, speed);\r\n    var delta = Math.cos(this._waves[i].angle) * radius/4 * this._waves[i].noise * (this.get('amplitude') || 1);\r\n    blob.push([\r\n      (this.radius + delta) * Math.cos(angle),\r\n      (this.radius + delta) * Math.sin(angle)\r\n    ]);\r\n    // Add noise\r\n    this._waves[i].angle += (Math.PI + Math.random() + speed/200)/350 * dt * (this.get('fuss') || 1);\r\n    this._waves[i].noise = Math.min(1, Math.max(0, this._waves[i].noise + (Math.random() - .5) *.1 *(this.get('fuss') || 1)));\r\n  }\r\n  blob.push(blob[0]);\r\n  return ol.coordinate.cspline(blob, { tension: this.get('tension') });\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Handles coordinates on the center of the viewport.\r\n * It can be used as abstract base class used for creating subclasses. \r\n * The CenterTouch interaction modifies map browser event coordinate and pixel properties to force pointer on the viewport center to any interaction that them.\r\n * Only pointermove pointerup are concerned with it.\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @param {olx.interaction.InteractionOptions} options Options\r\n *  @param {ol.style.Style|Array<ol.style.Style>} options.targetStyle a style to draw the target point, default cross style\r\n *  @param {string} options.composite composite operation for the target : difference|multiply|xor|screen|overlay|darken|lighter|lighten|...\r\n */\r\nol.interaction.CenterTouch = function(options) {\r\n  options = options || {};\r\n  // LIst of listerner on the object\r\n  this._listener = {};\r\n  // Filter event\r\n  var rex = /^pointermove$|^pointerup$/;\r\n  // Interaction to defer center on top of the interaction \r\n  // this is done to enable other coordinates manipulation inserted after the interaction (snapping)\r\n  this.ctouch = new ol.interaction.Interaction({\r\n    handleEvent: function(e) {\r\n      if (rex.test(e.type) && this.getMap()) {\r\n        e.coordinate = this.getMap().getView().getCenter();\r\n        e.pixel = this.getMap().getSize();\r\n        e.pixel = [ e.pixel[0]/2, e.pixel[1]/2 ];\r\n      }\r\n      return true; \r\n    }\r\n  });\r\n  // Target on map center\r\n  this._target = new ol.control.Target({\r\n    style: options.targetStyle,\r\n    composite: options.composite\r\n  });\r\n  ol.interaction.Interaction.call(this, {\r\n    handleEvent: function(e) {\r\n      if (rex.test(e.type)) this.pos_ = e.coordinate;\r\n      if (options.handleEvent) return options.handleEvent.call (this,e);\r\n      return true; \r\n    }\r\n  });\r\n};\r\nol.ext.inherits(ol.interaction.CenterTouch, ol.interaction.Interaction);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {_ol_Map_} map Map.\r\n * @api stable\r\n */\r\nol.interaction.CenterTouch.prototype.setMap = function(map) {\r\n  if (this.getMap()) {\r\n    this.getMap().removeInteraction(this.ctouch);\r\n    this.getMap().removeInteraction(this._target);\r\n  }\r\n  ol.interaction.Interaction.prototype.setMap.call (this, map);\r\n  if (this.getMap()) {\r\n    if (this.getActive()) {\r\n      this.getMap().addInteraction(this.ctouch);\r\n      this.getMap().addControl(this._target);\r\n    }\r\n  }\r\n};\r\n/**\r\n * Activate or deactivate the interaction.\r\n * @param {boolean} active Active.\r\n * @observable\r\n * @api\r\n */\r\nol.interaction.CenterTouch.prototype.setActive = function(b) {\r\n  ol.interaction.Interaction.prototype.setActive.call (this, b);\r\n  this.pos_ = null;\r\n  if (this.getMap()) {\r\n    if (this.getActive()) {\r\n      this.getMap().addInteraction(this.ctouch);\r\n      this.getMap().addControl(this._target);\r\n    } else {\r\n      this.getMap().removeInteraction(this.ctouch);\r\n      this.getMap().removeControl(this._target);\r\n    }\r\n  }\r\n};\r\n/** Get the position of the target\r\n * @return {ol.coordinate}\r\n */\r\nol.interaction.CenterTouch.prototype.getPosition = function () {\r\n  if (!this.pos_) {\r\n    var px =this.getMap().getSize();\r\n    px = [ px[0]/2, px[1]/2 ];\r\n    this.pos_ = this.getMap().getCoordinateFromPixel(px);\r\n  }\r\n  return this.pos_; \r\n};\r\n\r\n/** An interaction to copy/paste features on a map. \r\n * It will fire a 'focus' event on the map when map is focused (use mapCondition option to handle the condition when the map is focused).\r\n * @constructor\r\n * @fires focus\r\n * @fires copy\r\n * @fires paste\r\n * @extends {ol.interaction.Interaction}\r\n * @param {Object} options Options\r\n *  @param {function} options.condition a function that takes a mapBrowserEvent and return the action to perform: 'copy', 'cut' or 'paste', default Ctrl+C / Ctrl+V\r\n *  @param {function} options.mapCondition a function that takes a mapBrowserEvent and return true if the map is the active map, default always returns true\r\n *  @param {ol.Collection<ol.Feature>} options.features list of features to copy\r\n *  @param {ol.source.Vector | Array<ol.source.Vector>} options.sources the source to copy from (used for cut), if not defined, it will use the destination\r\n *  @param {ol.source.Vector} options.destination the source to copy to\r\n */\r\nol.interaction.CopyPaste = function(options) {\r\n  options = options || {};\r\n  // Features to copy\r\n  this.features = [];\r\n  this._cloneFeature = true;\r\n  var condition = options.condition;\r\n  if (typeof (condition) !== 'function') {\r\n    condition = function (e) {\r\n      if (e.originalEvent.ctrlKey) {\r\n        if (/^c$/i.test(e.originalEvent.key)) return 'copy';\r\n        if (/^x$/i.test(e.originalEvent.key)) return 'cut';\r\n        if (/^v$/i.test(e.originalEvent.key)) return 'paste';\r\n      }\r\n      return false;\r\n    }\r\n  }\r\n  this._featuresSource = options.features || new ol.Collection();\r\n  this.setSources(options.sources);\r\n  this.setDestination(options.destination);\r\n  // Create intreaction\r\n  ol.interaction.CurrentMap.call(this, {\r\n    condition: options.mapCondition,\r\n    onKeyDown: function (e) {\r\n      switch (condition(e)) {\r\n        case 'copy': {\r\n          this.copy({ silent: false });\r\n          break;\r\n        }\r\n        case 'cut': {\r\n          this.copy({ cut: true, silent: false });\r\n          break;\r\n        }\r\n        case 'paste': {\r\n          this.paste({ silent: false });\r\n          break;\r\n        }\r\n        default: break;\r\n      }\r\n    }.bind(this)\r\n  });\r\n};\r\nol.ext.inherits(ol.interaction.CopyPaste, ol.interaction.CurrentMap);\r\n/** Sources to cut feature from\r\n * @param { ol.source.Vector | Array<ol.source.Vector> } sources\r\n */\r\nol.interaction.CopyPaste.prototype.setSources = function (sources) {\r\n  if (sources) {\r\n    this._source = [];\r\n    this._source = sources instanceof Array ? sources : [sources];\r\n  } else {\r\n    this._source = null;\r\n  }\r\n};\r\n/** Get sources to cut feature from\r\n * @return { Array<ol.source.Vector> } \r\n */\r\nol.interaction.CopyPaste.prototype.getSources = function () {\r\n  return this._source;\r\n};\r\n/** Source to paste features\r\n * @param { ol.source.Vector } source\r\n */\r\nol.interaction.CopyPaste.prototype.setDestination = function (destination) {\r\n  this._destination = destination;\r\n};\r\n/** Get source to paste features\r\n * @param { ol.source.Vector } \r\n */\r\nol.interaction.CopyPaste.prototype.getDestination = function () {\r\n  return this._destination;\r\n};\r\n/** Get current feature to copy\r\n * @return {Array<ol.Feature>}\r\n */\r\nol.interaction.CopyPaste.prototype.getFeatures = function() {\r\n  return this.features;\r\n};\r\n/** Set current feature to copy\r\n * @param {Object} options\r\n *  @param {Array<ol.Feature> | ol.Collection<ol.Feature>} options.features feature to copy, default get in the provided collection\r\n *  @param {boolean} options.cut try to cut feature from the sources, default false\r\n *  @param {boolean} options.silent true to send an event, default true\r\n */\r\nol.interaction.CopyPaste.prototype.copy = function (options) {\r\n  options = options || {};\r\n  var features = options.features || this._featuresSource.getArray();\r\n  // Try to remove feature from sources\r\n  if (options.cut) {\r\n    var sources = this._source || [this._destination];\r\n    // Remove feature from sources\r\n    features.forEach(function(f) {\r\n      sources.forEach(function(source) {\r\n        try {\r\n          source.removeFeature(f);\r\n        } catch(e) {/*ok*/}\r\n      });\r\n    });\r\n  }\r\n  if (this._cloneFeature) {\r\n    this.features = [];\r\n    features.forEach(function(f) {\r\n      this.features.push(f.clone());\r\n    }.bind(this));\r\n  } else {\r\n    this.features = features;\r\n  }\r\n  // Send an event\r\n  if (options.silent===false) this.dispatchEvent({ type: options.cut ? 'cut' : 'copy', time: (new Date).getTime() });\r\n};\r\n/** Paste features\r\n * @param {Object} options\r\n *  @param {Array<ol.Feature> | ol.Collection<ol.Feature>} features feature to copy, default get current features\r\n *  @param {ol.source.Vector} options.destination Source to paste to, default the current source\r\n *  @param {boolean} options.silent true to send an event, default true\r\n */\r\nol.interaction.CopyPaste.prototype.paste = function(options) {\r\n  options = options || {};\r\n  var features = options.features || this.features;\r\n  if (features) {\r\n    var destination = options.destination || this._destination;\r\n    if (destination) {\r\n      destination.addFeatures(this.features);\r\n      if (this._cloneFeature) this.copy({ features: this.features });\r\n    }\r\n  }\r\n  // Send an event\r\n  if (options.silent===false) this.dispatchEvent({ type:'paste', features: features, time: (new Date).getTime() });\r\n};\r\n\r\n/*\tCopyright (c) 2018 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A Select interaction to delete features on click.\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @fires deletestart\r\n * @fires deleteend\r\n * @param {*} options ol.interaction.Select options\r\n */\r\nol.interaction.Delete = function(options) {\r\n  ol.interaction.Select.call(this, options);\r\n  this.on('select', function(e) {\r\n    this.getFeatures().clear();\r\n    this.delete(e.selected);\r\n  }.bind(this));\r\n};\r\nol.ext.inherits(ol.interaction.Delete, ol.interaction.Select);\r\n/** Get vector source of the map\r\n * @return {Array<ol.source.Vector>}\r\n */\r\nol.interaction.Delete.prototype._getSources = function(layers) {\r\n  if (!this.getMap()) return [];\r\n  if (!layers) layers = this.getMap().getLayers();\r\n  var sources = [];\r\n  layers.forEach(function (l) {\r\n    // LayerGroup\r\n    if (l.getLayers) {\r\n      sources = sources.concat(this._getSources(l.getLayers()));\r\n    } else {\r\n      if (l.getSource && l.getSource() instanceof ol.source.Vector) {\r\n        sources.push(l.getSource());\r\n      }\r\n    }\r\n  }.bind(this));\r\n  return sources;\r\n};\r\n/** Delete features: remove the features from the map (from all layers in the map)\r\n * @param {ol.Collection<ol.Feature>|Array<ol.Feature>} features The features to delete\r\n * @api\r\n */\r\nol.interaction.Delete.prototype.delete = function(features) {\r\n  if (features && (features.length || features.getLength())) {\r\n    this.dispatchEvent({ type: 'deletestart', features: features });\r\n    var delFeatures = [];\r\n    // Get the sources concerned\r\n    this._getSources().forEach(function (source) {\r\n      try {\r\n        // Try to delete features in the source\r\n        features.forEach(function(f) {\r\n          source.removeFeature(f);\r\n          delFeatures.push(f);\r\n        });\r\n      } catch(e) { /* ok */ }\r\n    })\r\n    this.dispatchEvent({ type: 'deleteend', features: delFeatures });\r\n  }\r\n};\r\n\r\n/** Drag an overlay on the map\r\n * @constructor\r\n * @extends {ol.interaction.Pointer}\r\n * @fires dragstart\r\n * @fires dragging\r\n * @fires dragend\r\n * @param {any} options\r\n *  @param {ol.Overlay|Array<ol.Overlay>} options.overlays the overlays to drag\r\n *  @param {ol.Size} options.offset overlay offset, default [0,0]\r\n */\r\nol.interaction.DragOverlay = function(options) {\r\n  if (!options) options = {};\r\n  var offset = options.offset || [0,0];\r\n  // Extend pointer\r\n  ol.interaction.Pointer.call(this, {\r\n    // start draging on an overlay\r\n    handleDownEvent: function(evt) {\r\n      var res = evt.frameState.viewState.resolution\r\n      var coordinate = [evt.coordinate[0] + offset[0]*res, evt.coordinate[1] - offset[1]*res];\r\n      // Click on a button (closeBox) or on a link: don't drag!\r\n      if (/^(BUTTON|A)$/.test(evt.originalEvent.target.tagName)) {\r\n        this._dragging = false;\r\n        return true;\r\n      }\r\n      // Start dragging\r\n      if (this._dragging) {\r\n        if (options.centerOnClick !== false) {\r\n          this._dragging.setPosition(coordinate, true);\r\n        } else {\r\n          coordinate = this._dragging.getPosition();\r\n        }\r\n        this.dispatchEvent({ \r\n          type: 'dragstart',\r\n          overlay: this._dragging,\r\n          originalEvent: evt.originalEvent,\r\n          frameState: evt.frameState,\r\n          coordinate: coordinate\r\n        });\r\n        return true;\r\n      }\r\n      return false;\r\n    },\r\n    // Drag\r\n    handleDragEvent: function(evt) {\r\n      var res = evt.frameState.viewState.resolution\r\n      var coordinate = [evt.coordinate[0] + offset[0]*res, evt.coordinate[1] - offset[1]*res];\r\n      if (this._dragging) {\r\n        this._dragging.setPosition(coordinate, true);\r\n        this.dispatchEvent({ \r\n          type: 'dragging',\r\n          overlay: this._dragging,\r\n          originalEvent: evt.originalEvent,\r\n          frameState: evt.frameState,\r\n          coordinate: coordinate\r\n        });\r\n      }\r\n    },\r\n    // Stop dragging\r\n    handleUpEvent: function(evt) {\r\n      var res = evt.frameState.viewState.resolution\r\n      var coordinate = [evt.coordinate[0] + offset[0]*res, evt.coordinate[1] - offset[1]*res];\r\n      if (this._dragging) {\r\n        this.dispatchEvent({ \r\n          type: 'dragend',\r\n          overlay: this._dragging,\r\n          originalEvent: evt.originalEvent,\r\n          frameState: evt.frameState,\r\n          coordinate: coordinate\r\n        });\r\n        this._dragging = false;\r\n        return true;\r\n      }\r\n      return false;\r\n    }\r\n  });\r\n  // List of overlays / listeners\r\n  this._overlays = [];\r\n  if (!(options.overlays instanceof Array)) options.overlays = [options.overlays];\r\n  options.overlays.forEach(this.addOverlay.bind(this));\r\n};\r\nol.ext.inherits(ol.interaction.DragOverlay, ol.interaction.Pointer);\r\n/** Add an overlay to the interacton\r\n * @param {ol.Overlay} ov\r\n */\r\nol.interaction.DragOverlay.prototype.addOverlay = function (ov) {\r\n  for (var i=0, o; o=this._overlays[i]; i++) {\r\n    if (o===ov) return;\r\n  }\r\n  // Stop event overlay\r\n  if (ov.element.parentElement && ov.element.parentElement.classList.contains('ol-overlaycontainer-stopevent')) {\r\n    console.warn('[DragOverlay.addOverlay] overlay must be created with stopEvent set to false!');\r\n    return;\r\n  }\r\n  // Add listener on overlay of the same map\r\n  var handler = function() {\r\n    if (this.getMap()===ov.getMap()) this._dragging = ov;\r\n  }.bind(this);\r\n  this._overlays.push({\r\n    overlay: ov,\r\n    listener: handler\r\n  });\r\n  ov.element.addEventListener('pointerdown', handler);\r\n};\r\n/** Remove an overlay from the interacton\r\n * @param {ol.Overlay} ov\r\n */\r\nol.interaction.DragOverlay.prototype.removeOverlay = function (ov) {\r\n  for (var i=0, o; o=this._overlays[i]; i++) {\r\n    if (o.overlay===ov) {\r\n      var l = this._overlays.splice(i,1)[0];\r\n      ov.element.removeEventListener('pointerdown', l.listener);\r\n      break;\r\n    }\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Interaction to draw holes in a polygon.\r\n * It fires a drawstart, drawend event when drawing the hole\r\n * and a modifystart, modifyend event before and after inserting the hole in the feature geometry.\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @fires drawstart\r\n * @fires drawend\r\n * @fires modifystart\r\n * @fires modifyend\r\n * @param {olx.interaction.DrawHoleOptions} options extend olx.interaction.DrawOptions\r\n * \t@param {Array<ol.layer.Vector> | function | undefined} options.layers A list of layers from which polygons should be selected. Alternatively, a filter function can be provided. default: all visible layers\r\n * \t@param {Array<ol.Feature> | ol.Collection<ol.Feature> | function | undefined} options.features An array or a collection of features the interaction applies on or a function that takes a feature and a layer and returns true if the feature is a candidate\r\n * \t@param { ol.style.Style | Array<ol.style.Style> | StyleFunction | undefined }\tStyle for the selected features, default: default edit style\r\n */\r\nol.interaction.DrawHole = function(options) {\r\n  if (!options) options = {};\r\n  var self = this;\r\n  // Select interaction for the current feature\r\n  this._select = new ol.interaction.Select({ style: options.style });\r\n  this._select.setActive(false);\r\n  // Geometry function that test points inside the current\r\n  var geometryFn, geomFn = options.geometryFunction;\r\n  if (geomFn) {\r\n    geometryFn = function(c,g) {\r\n      g = self._geometryFn (c, g);\r\n      return geomFn (c,g);\r\n    }\r\n  } else {\r\n    geometryFn = function(c,g) { return self._geometryFn (c, g); }\r\n  }\r\n  // Create draw interaction\r\n  options.type = \"Polygon\";\r\n  options.geometryFunction = geometryFn;\r\n  ol.interaction.Draw.call(this, options);\r\n  // Layer filter function\r\n  if (options.layers) {\r\n    if (typeof (options.layers) === 'function') {\r\n      this.layers_ = options.layers;\r\n    } else if (options.layers.indexOf) {\r\n      this.layers_ = function(l) {\r\n        return (options.layers.indexOf(l) >= 0); \r\n      };\r\n    }\r\n  }\r\n  // Features to apply on \r\n  if (typeof(options.features) === 'function') {\r\n    this._features = options.features;\r\n  } else if (options.features) {\r\n    var features = options.features;\r\n    this._features = function(f) {\r\n      if (features.indexOf) {\r\n        return !!features[features.indexOf(f)];\r\n      } else {\r\n        return !!features.item(features.getArray().indexOf(f));\r\n      }\r\n    }\r\n  } else {\r\n    this._features = function() { return true }\r\n  }\r\n  // Start drawing if inside a feature\r\n  this.on('drawstart', this._startDrawing.bind(this));\r\n  // End drawing add the hole to the current Polygon\r\n  this.on('drawend', this._finishDrawing.bind(this));\r\n};\r\nol.ext.inherits(ol.interaction.DrawHole, ol.interaction.Draw);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.DrawHole.prototype.setMap = function(map) {\r\n  if (this.getMap()) this.getMap().removeInteraction(this._select);\r\n  if (map) map.addInteraction(this._select);\r\n  ol.interaction.Draw.prototype.setMap.call (this, map);\r\n};\r\n/**\r\n * Activate/deactivate the interaction\r\n * @param {boolean}\r\n * @api stable\r\n */\r\nol.interaction.DrawHole.prototype.setActive = function(b) {\r\n  this._select.getFeatures().clear();\r\n  ol.interaction.Draw.prototype.setActive.call (this, b);\r\n};\r\n/**\r\n * Remove last point of the feature currently being drawn \r\n * (test if points to remove before).\r\n */\r\nol.interaction.DrawHole.prototype.removeLastPoint = function() {\r\n  if (this._feature && this._feature.getGeometry().getCoordinates()[0].length>2) {\r\n    ol.interaction.Draw.prototype.removeLastPoint.call(this);\r\n  }\r\n};\r\n/** \r\n * Get the current polygon to hole\r\n * @return {ol.Feature}\r\n */\r\nol.interaction.DrawHole.prototype.getPolygon = function() {\r\n  return this._polygon;\r\n  // return this._select.getFeatures().item(0).getGeometry();\r\n};\r\n/**\r\n * Get current feature to add a hole and start drawing\r\n * @param {ol.interaction.Draw.Event} e\r\n * @private\r\n */\r\nol.interaction.DrawHole.prototype._startDrawing = function(e) {\r\n  var map = this.getMap();\r\n  this._feature = e.feature;\r\n  var coord = e.feature.getGeometry().getCoordinates()[0][0];\r\n  this._current = null;\r\n  // Check object under the pointer\r\n  map.forEachFeatureAtPixel(\r\n    map.getPixelFromCoordinate(coord),\r\n    function(feature, layer) {\r\n      if (this._features(feature, layer)) {\r\n        var poly = feature.getGeometry();\r\n        if (poly.getType() === \"Polygon\"\r\n          && poly.intersectsCoordinate(coord)) {\r\n          this._polygonIndex = false;\r\n          this._polygon = poly;\r\n          this._current = feature;\r\n        } else if (poly.getType() === \"MultiPolygon\"\r\n          && poly.intersectsCoordinate(coord)) {\r\n          for (var i=0, p; p=poly.getPolygon(i); i++) {\r\n            if (p.intersectsCoordinate(coord)) {\r\n              this._polygonIndex = i;\r\n              this._polygon = p;\r\n              this._current = feature;\r\n              break;\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }.bind(this), {\r\n      layerFilter: this.layers_\r\n    }\r\n  );\r\n  this._select.getFeatures().clear();\r\n  if (!this._current) {\r\n    this.setActive(false);\r\n    this.setActive(true);\r\n  } else {\r\n    this._select.getFeatures().push(this._current);\r\n  }\r\n};\r\n/**\r\n * Stop drawing and add the sketch feature to the target feature. \r\n * @param {ol.interaction.Draw.Event} e\r\n * @private\r\n */\r\nol.interaction.DrawHole.prototype._finishDrawing = function(e) {\r\n  // The feature is the hole\r\n  e.hole = e.feature;\r\n  // Get the current feature\r\n  e.feature = this._select.getFeatures().item(0);\r\n  this.dispatchEvent({ type: 'modifystart', features: [ this._current ] });\r\n  // Create the hole\r\n  var c = e.hole.getGeometry().getCoordinates()[0];\r\n  if (c.length > 3) {\r\n    if (this._polygonIndex!==false) {\r\n      var geom = e.feature.getGeometry();\r\n      var newGeom = new ol.geom.MultiPolygon([]);\r\n      for (var i=0, pi; pi=geom.getPolygon(i); i++) {\r\n        if (i===this._polygonIndex) {\r\n          pi.appendLinearRing(new ol.geom.LinearRing(c));\r\n          newGeom.appendPolygon(pi);\r\n        } else {\r\n          newGeom.appendPolygon(pi);\r\n        }\r\n      }\r\n      e.feature.setGeometry(newGeom);\r\n    } else {\r\n      this.getPolygon().appendLinearRing(new ol.geom.LinearRing(c));\r\n    }\r\n  }\r\n  this.dispatchEvent({ type: 'modifyend', features: [ this._current ] });\r\n  // reset\r\n  this._feature = null;\r\n  this._select.getFeatures().clear();\r\n};\r\n/**\r\n * Function that is called when a geometry's coordinates are updated.\r\n * @param {Array<ol.coordinate>} coordinates\r\n * @param {ol.geom.Polygon} geometry\r\n * @return {ol.geom.Polygon}\r\n * @private\r\n */\r\nol.interaction.DrawHole.prototype._geometryFn = function(coordinates, geometry) {\r\n  var coord = coordinates[0].pop();\r\n  if (!this.getPolygon() || this.getPolygon().intersectsCoordinate(coord)) {\r\n    this.lastOKCoord = [coord[0],coord[1]];\r\n  }\r\n  coordinates[0].push([this.lastOKCoord[0],this.lastOKCoord[1]]);\r\n  if (geometry) {\r\n    geometry.setCoordinates([coordinates[0].concat([coordinates[0][0]])]);\r\n  } else {\r\n    geometry = new ol.geom.Polygon(coordinates);\r\n  }\r\n  return geometry;\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Interaction rotate\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @fires drawstart, drawing, drawend, drawcancel\r\n * @param {olx.interaction.TransformOptions} options\r\n *  @param {Array<ol.Layer>} options.source Destination source for the drawn features\r\n *  @param {ol.Collection<ol.Feature>} options.features Destination collection for the drawn features \r\n *  @param {ol.style.Style | Array.<ol.style.Style> | ol.style.StyleFunction | undefined} options.style style for the sketch\r\n *  @param {integer} options.sides number of sides, default 0 = circle\r\n *  @param { ol.events.ConditionType | undefined } options.condition A function that takes an ol.MapBrowserEvent and returns a boolean that event should be handled. By default module:ol/events/condition.always.\r\n *  @param { ol.events.ConditionType | undefined } options.squareCondition A function that takes an ol.MapBrowserEvent and returns a boolean to draw square features. Default test shift key\r\n *  @param { ol.events.ConditionType | undefined } options.centerCondition A function that takes an ol.MapBrowserEvent and returns a boolean to draw centered features. Default check Ctrl key\r\n *  @param { bool } options.canRotate Allow rotation when centered + square, default: true\r\n *  @param { string } [options.geometryName=geometry] \r\n *  @param { number } options.clickTolerance click tolerance on touch devices, default: 6\r\n *  @param { number } options.maxCircleCoordinates Maximum number of point on a circle, default: 100\r\n */\r\nol.interaction.DrawRegular = function(options) {\r\n  if (!options) options={};\r\n  this.squaredClickTolerance_ = options.clickTolerance ? options.clickTolerance * options.clickTolerance : 36;\r\n  this.maxCircleCoordinates_ = options.maxCircleCoordinates || 100;\r\n  // Collection of feature to transform \r\n  this.features_ = options.features;\r\n  // List of layers to transform \r\n  this.source_ = options.source;\r\n  // Square condition\r\n  this.conditionFn_ = options.condition;\r\n  // Square condition\r\n  this.squareFn_ = options.squareCondition;\r\n  // Centered condition\r\n  this.centeredFn_ = options.centerCondition;\r\n  // Allow rotation when centered + square\r\n  this.canRotate_ = (options.canRotate !== false);\r\n  // Specify custom geometry name\r\n  this.geometryName_ = options.geometryName;\r\n  // Number of sides (default=0: circle)\r\n  this.setSides(options.sides);\r\n  // Style\r\n  var defaultStyle = ol.style.Style.defaultStyle(true);\r\n  // Create a new overlay layer for the sketch\r\n  this.sketch_ = new ol.Collection();\r\n  this.overlayLayer_ = new ol.layer.Vector({\r\n    source: new ol.source.Vector({\r\n      features: this.sketch_,\r\n      useSpatialIndex: false\r\n    }),\r\n    name:'DrawRegular overlay',\r\n    displayInLayerSwitcher: false,\r\n    style: options.style || defaultStyle\r\n  });\r\n  ol.interaction.Interaction.call(this, {\t\r\n      /*\r\n      handleDownEvent: this.handleDownEvent_,\r\n      handleMoveEvent: this.handleMoveEvent_,\r\n      handleUpEvent: this.handleUpEvent_,\r\n      */\r\n      handleEvent: this.handleEvent_\r\n    });\r\n};\r\nol.ext.inherits(ol.interaction.DrawRegular, ol.interaction.Interaction);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.DrawRegular.prototype.setMap = function(map) {\r\n  if (this.getMap()) this.getMap().removeLayer(this.overlayLayer_);\r\n  ol.interaction.Interaction.prototype.setMap.call (this, map);\r\n  this.overlayLayer_.setMap(map);\r\n};\r\n/**\r\n * Activate/deactivate the interaction\r\n * @param {boolean}\r\n * @api stable\r\n */\r\nol.interaction.DrawRegular.prototype.setActive = function(b) {\r\n  this.reset();\r\n  ol.interaction.Interaction.prototype.setActive.call (this, b);\r\n}\r\n/**\r\n * Reset the interaction\r\n * @api stable\r\n */\r\nol.interaction.DrawRegular.prototype.reset = function() {\r\n  this.overlayLayer_.getSource().clear();\r\n  this.started_ = false;\r\n}\r\n/**\r\n * Set the number of sides.\r\n * @param {int} number of sides.\r\n * @api stable\r\n */\r\nol.interaction.DrawRegular.prototype.setSides = function (nb) {\r\n  nb = parseInt(nb);\r\n  this.sides_ = nb>2 ? nb : 0;\r\n}\r\n/**\r\n * Allow rotation when centered + square\r\n * @param {bool} \r\n * @api stable\r\n */\r\nol.interaction.DrawRegular.prototype.canRotate = function (b) {\r\n  if (b===true || b===false) this.canRotate_ = b;\r\n  return this.canRotate_;\r\n}\r\n/**\r\n * Get the number of sides.\r\n * @return {int} number of sides.\r\n * @api stable\r\n */\r\nol.interaction.DrawRegular.prototype.getSides = function () {\r\n  return this.sides_;\r\n}\r\n/** Default start angle array for each sides\r\n*/\r\nol.interaction.DrawRegular.prototype.startAngle = {\r\n  'default':Math.PI/2,\r\n  3: -Math.PI/2,\r\n  4: Math.PI/4\r\n};\r\n/** Get geom of the current drawing\r\n* @return {ol.geom.Polygon | ol.geom.Point}\r\n*/\r\nol.interaction.DrawRegular.prototype.getGeom_ = function () {\r\n  this.overlayLayer_.getSource().clear();\r\n  if (!this.center_) return false;\r\n  var g;\r\n  if (this.coord_) {\r\n    var center = this.center_;\r\n    var coord = this.coord_;\r\n    // Specific case: circle\r\n    var d, dmax, r, circle, centerPx;\r\n    if (!this.sides_ && this.square_ && !this.centered_) {\r\n      center = [(coord[0] + center[0])/2, (coord[1] + center[1])/2];\r\n      d = [coord[0] - center[0], coord[1] - center[1]];\r\n      r = Math.sqrt(d[0]*d[0]+d[1]*d[1]);\r\n      circle = new ol.geom.Circle(center, r, 'XY');\r\n      // Optimize points on the circle\r\n      centerPx = this.getMap().getPixelFromCoordinate(center);\r\n      dmax = Math.max (100, Math.abs(centerPx[0]-this.coordPx_[0]), Math.abs(centerPx[1]-this.coordPx_[1]));\r\n      dmax = Math.min ( this.maxCircleCoordinates_, Math.round(dmax / 3 ));\r\n      return ol.geom.Polygon.fromCircle (circle, dmax, 0);\r\n    } else {\r\n      var hasrotation = this.canRotate_ && this.centered_ && this.square_;\r\n      d = [coord[0] - center[0], coord[1] - center[1]];\r\n      if (this.square_ && !hasrotation) {\r\n        //var d = [coord[0] - center[0], coord[1] - center[1]];\r\n        var dm = Math.max (Math.abs(d[0]), Math.abs(d[1])); \r\n        coord = [ \r\n          center[0] + (d[0]>0 ? dm:-dm),\r\n          center[1] + (d[1]>0 ? dm:-dm)\r\n        ];\r\n      }\r\n      r = Math.sqrt(d[0]*d[0]+d[1]*d[1]);\r\n      if (r>0) {\r\n        circle = new ol.geom.Circle(center, r, 'XY');\r\n        var a;\r\n        if (hasrotation) a = Math.atan2(d[1], d[0]);\r\n        else a = this.startAngle[this.sides_] || this.startAngle['default'];\r\n        if (this.sides_) {\r\n          g = ol.geom.Polygon.fromCircle (circle, this.sides_, a);\r\n        } else {\r\n          // Optimize points on the circle\r\n          centerPx = this.getMap().getPixelFromCoordinate(this.center_);\r\n          dmax = Math.max (100, Math.abs(centerPx[0]-this.coordPx_[0]), Math.abs(centerPx[1]-this.coordPx_[1]));\r\n          dmax = Math.min ( this.maxCircleCoordinates_, Math.round(dmax / (this.centered_ ? 3:5) ));\r\n          g = ol.geom.Polygon.fromCircle (circle, dmax, 0);\r\n        }\r\n        if (hasrotation) return g;\r\n        // Scale polygon to fit extent\r\n        var ext = g.getExtent();\r\n        if (!this.centered_) center = this.center_;\r\n        else center = [ 2*this.center_[0]-this.coord_[0], 2*this.center_[1]-this.coord_[1] ];\r\n        var scx = (center[0] - coord[0]) / (ext[0] - ext[2]);\r\n        var scy = (center[1] - coord[1]) / (ext[1] - ext[3]);\r\n        if (this.square_) {\r\n          var sc = Math.min(Math.abs(scx),Math.abs(scy));\r\n          scx = Math.sign(scx)*sc;\r\n          scy = Math.sign(scy)*sc;\r\n        }\r\n        var t = [ center[0] - ext[0]*scx, center[1] - ext[1]*scy ];\r\n        g.applyTransform(function(g1, g2, dim) {\r\n          for (var i=0; i<g1.length; i+=dim) {\r\n            g2[i] = g1[i]*scx + t[0];\r\n            g2[i+1] = g1[i+1]*scy + t[1];\r\n          }\r\n          return g2;\r\n        });\r\n        return g;\r\n      }\r\n    }\r\n  }\r\n  // No geom => return a point\r\n  return new ol.geom.Point(this.center_);\r\n};\r\n/** Draw sketch\r\n* @return {ol.Feature} The feature being drawn.\r\n*/\r\nol.interaction.DrawRegular.prototype.drawSketch_ = function(evt) {\r\n  this.overlayLayer_.getSource().clear();\r\n  if (evt) {\r\n    this.square_ = this.squareFn_ ? this.squareFn_(evt) : evt.originalEvent.shiftKey;\r\n    this.centered_ = this.centeredFn_ ? this.centeredFn_(evt) : evt.originalEvent.metaKey || evt.originalEvent.ctrlKey;\r\n    var g = this.getGeom_();\r\n    if (g) {\r\n      var f = this.feature_;\r\n      //f.setGeometry (g);\r\n      if (g.getType()==='Polygon') f.getGeometry().setCoordinates(g.getCoordinates());\r\n      this.overlayLayer_.getSource().addFeature(f);\r\n      if (this.coord_ \r\n        && this.square_ \r\n        && ((this.canRotate_ && this.centered_ && this.coord_) || (!this.sides_ && !this.centered_))) {\r\n        this.overlayLayer_.getSource().addFeature(new ol.Feature(new ol.geom.LineString([this.center_,this.coord_])));\r\n      }\r\n      return f;\r\n    }\r\n  }\r\n};\r\n/** Draw sketch (Point)\r\n*/\r\nol.interaction.DrawRegular.prototype.drawPoint_ = function(pt, noclear) {\r\n  if (!noclear) this.overlayLayer_.getSource().clear();\r\n  this.overlayLayer_.getSource().addFeature(new ol.Feature(new ol.geom.Point(pt)));\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} evt Map browser event.\r\n */\r\nol.interaction.DrawRegular.prototype.handleEvent_ = function(evt) {\r\n  var dx, dy;\r\n  // Event date time\r\n  this._eventTime = new Date();\r\n  switch (evt.type) {\r\n    case \"pointerdown\": {\r\n      if (this.conditionFn_ && !this.conditionFn_(evt)) break;\r\n      this.downPx_ = evt.pixel;\r\n      this.start_(evt);\r\n      // Test long touch\r\n      var dt = 500;\r\n      this._longTouch = false;\r\n      setTimeout(function() {\r\n        this._longTouch = (new Date() - this._eventTime > .9*dt);\r\n        if (this._longTouch) this.handleMoveEvent_(evt);\r\n      }.bind(this), dt);\r\n      break;\r\n    }\r\n    case \"pointerup\": {\r\n      // Started and fisrt move\r\n      if (this.started_ && this.coord_) {\r\n        dx = this.downPx_[0] - evt.pixel[0];\r\n        dy = this.downPx_[1] - evt.pixel[1];\r\n        if (dx*dx + dy*dy <= this.squaredClickTolerance_) {\r\n          // The pointer has moved\r\n          if ( this.lastEvent == \"pointermove\" || this.lastEvent == \"keydown\" ) {\r\n            this.end_(evt);\r\n          }\r\n          // On touch device there is no move event : terminate = click on the same point\r\n          else {\r\n            dx = this.upPx_[0] - evt.pixel[0];\r\n            dy = this.upPx_[1] - evt.pixel[1];\r\n            if ( dx*dx + dy*dy <= this.squaredClickTolerance_) {\r\n              this.end_(evt);\r\n            } else  {\r\n              this.handleMoveEvent_(evt);\r\n              this.drawPoint_(evt.coordinate,true);\r\n            }\r\n          }\r\n        }\r\n      }\r\n      this.upPx_ = evt.pixel;\t\r\n      break;\r\n    }\r\n    case \"pointerdrag\": {\r\n      if (this.started_) {\r\n        var centerPx = this.getMap().getPixelFromCoordinate(this.center_);\r\n        dx = centerPx[0] - evt.pixel[0];\r\n        dy = centerPx[1] - evt.pixel[1];\r\n        if (dx*dx + dy*dy <= this.squaredClickTolerance_) {\r\n          this.reset();\r\n        }\r\n      }\r\n      return !this._longTouch;\r\n      // break;\r\n    }\r\n    case \"pointermove\": {\r\n      if (this.started_) {\r\n        dx = this.downPx_[0] - evt.pixel[0];\r\n        dy = this.downPx_[1] - evt.pixel[1];\r\n        if (dx*dx + dy*dy > this.squaredClickTolerance_) {\r\n          this.handleMoveEvent_(evt);\r\n          this.lastEvent = evt.type;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      this.lastEvent = evt.type;\r\n      // Prevent zoom in on dblclick\r\n      if (this.started_ && evt.type==='dblclick') {\r\n        //evt.stopPropagation();\r\n        return false;\r\n      }\r\n      break;\r\n    }\r\n  }\r\n  return true;\r\n}\r\n/** Stop drawing.\r\n */\r\nol.interaction.DrawRegular.prototype.finishDrawing = function() {\r\n  if (this.started_ && this.coord_) {\r\n    this.end_({ pixel: this.upPx_, coordinate: this.coord_});\r\n  }\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} evt Event.\r\n */\r\nol.interaction.DrawRegular.prototype.handleMoveEvent_ = function(evt) {\r\n  if (this.started_) {\r\n    this.coord_ = evt.coordinate;\r\n    this.coordPx_ = evt.pixel;\r\n    var f = this.drawSketch_(evt);\r\n    this.dispatchEvent({ \r\n      type:'drawing', \r\n      feature: f, \r\n      pixel: evt.pixel, \r\n      startCoordinate: this.center_,\r\n      coordinate: evt.coordinate, \r\n      square: this.square_, \r\n      centered: this.centered_ \r\n    });\r\n  } else  {\r\n    this.drawPoint_(evt.coordinate);\r\n  }\r\n};\r\n/** Start an new draw\r\n * @param {ol.MapBrowserEvent} evt Map browser event.\r\n * @return {boolean} `false` to stop the drag sequence.\r\n */\r\nol.interaction.DrawRegular.prototype.start_ = function(evt) {\r\n  if (!this.started_) {\r\n    this.started_ = true;\r\n    this.center_ = evt.coordinate;\r\n    this.coord_ = null;\r\n    var f = this.feature_ = new ol.Feature({});\r\n    f.setGeometryName(this.geometryName_);\r\n    f.setGeometry(new ol.geom.Polygon([[evt.coordinate,evt.coordinate,evt.coordinate]]));\r\n    this.drawSketch_(evt);\r\n    this.dispatchEvent({ type:'drawstart', feature: f, pixel: evt.pixel, coordinate: evt.coordinate });\r\n  } else {\r\n    this.coord_ = evt.coordinate;\r\n  }\r\n};\r\n/** End drawing\r\n * @param {ol.MapBrowserEvent} evt Map browser event.\r\n * @return {boolean} `false` to stop the drag sequence.\r\n */\r\nol.interaction.DrawRegular.prototype.end_ = function(evt) {\r\n  this.coord_ = evt.coordinate;\r\n  this.started_ = false;\r\n  if (this.coord_ && (this.center_[0]!==this.coord_[0] || this.center_[1]!==this.coord_[1])) {\r\n    var f = this.feature_;\r\n    f.setGeometry(this.getGeom_());\r\n    if (this.source_) this.source_.addFeature(f);\r\n    else if (this.features_) this.features_.push(f);\r\n    this.dispatchEvent({ type:'drawend', feature: f, pixel: evt.pixel, coordinate: evt.coordinate, square: this.square_, centered: this.centered_ });\r\n  } else {\r\n    this.dispatchEvent({ type:'drawcancel', feature: null, pixel: evt.pixel, coordinate: evt.coordinate, square: this.square_, centered: this.centered_ });\r\n  }\r\n  this.center_ = this.coord_ = null;\r\n  this.drawSketch_();\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Interaction DrawTouch : pointer is deferred to the center of the viewport and a target is drawn to materialize this point\r\n * The interaction modifies map browser event coordinate and pixel properties to force pointer on the viewport center to any interaction that them.\r\n * @constructor\r\n * @fires drawstart\r\n * @fires drawend\r\n * @fires drawabort\r\n * @extends {ol.interaction.CenterTouch}\r\n * @param {olx.interaction.DrawOptions} options\r\n *  @param {ol.source.Vector | undefined} options.source Destination source for the drawn features.\r\n *  @param {ol.geom.GeometryType} options.type Drawing type ('Point', 'LineString', 'Polygon') not ('MultiPoint', 'MultiLineString', 'MultiPolygon' or 'Circle'). Required.\r\n *\t@param {boolean} [options.tap=true] enable point insertion on tap, default true\r\n *  @param {ol.style.Style|Array<ol.style.Style>} [options.style] Drawing style\r\n *  @param {ol.style.Style|Array<ol.style.Style>} [options.sketchStyle] Sketch style\r\n *  @param {ol.style.Style|Array<ol.style.Style>} [options.targetStyle] a style to draw the target point, default cross style\r\n *  @param {string} [options.composite] composite operation : difference|multiply|xor|screen|overlay|darken|lighter|lighten|...\r\n */\r\nol.interaction.DrawTouch = function(options) {\r\n  options = options||{};\r\n  options.handleEvent = function(e) {\r\n    if (this.get('tap')) {\r\n      this.sketch.setPosition(this.getPosition());\r\n      switch (e.type) {\r\n        case 'singleclick': {\r\n          this.addPoint();\r\n          break;\r\n        }\r\n        case 'dblclick': {\r\n          this.addPoint();\r\n          this.finishDrawing();\r\n          return false;\r\n          //break;\r\n        }\r\n        default: break;\r\n      }\r\n    }\r\n    return true;\r\n  }\r\n  if (!options.sketchStyle) {\r\n    options.sketchStyle = ol.style.Style.defaultStyle();\r\n  }\r\n  var sketch = this.sketch = new ol.layer.SketchOverlay(options);\r\n  sketch.on(['drawstart', 'drawabort'], function(e) { this.dispatchEvent(e); }.bind(this));\r\n  sketch.on(['drawend'], function(e) { \r\n    if (e.feature && e.valid && options.source) options.source.addFeature(e.feature);\r\n    this.dispatchEvent(e); \r\n  }.bind(this));\r\n  ol.interaction.CenterTouch.call(this, options);\r\n  this._source = options.source;\r\n  this.set('tap', options.tap!==false);\r\n};\r\nol.ext.inherits(ol.interaction.DrawTouch, ol.interaction.CenterTouch);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.DrawTouch.prototype.setMap = function(map) {\r\n  if (this._listener) {\r\n    for(var l in this._listener) ol.Observable.unByKey(l);\r\n  }\r\n  this._listener = {};\r\n  ol.interaction.CenterTouch.prototype.setMap.call (this, map);\r\n  this.sketch.setMap(map);\r\n  if (map){\r\n    this._listener.center = map.on('postcompose', function() {\r\n      if (!ol.coordinate.equal(this.getPosition(), this.sketch.getPosition() || [])) {\r\n        this.sketch.setPosition(this.getPosition());\r\n      }\r\n    }.bind(this));\r\n  }\r\n};\r\n/** Set geometry type\r\n * @param {ol.geom.GeometryType} type\r\n */\r\nol.interaction.DrawTouch.prototype.setGeometryType = function(type) {\r\n  return this.sketch.setGeometryType(type);\r\n};\r\n/** Get geometry type\r\n * @return {ol.geom.GeometryType}\r\n */\r\nol.interaction.DrawTouch.prototype.getGeometryType = function() {\r\n  return this.sketch.getGeometryType();\r\n};\r\n/** Start drawing and add the sketch feature to the target layer. \r\n * The ol.interaction.Draw.EventType.DRAWEND event is dispatched before inserting the feature.\r\n */\r\nol.interaction.DrawTouch.prototype.finishDrawing = function() {\r\n  this.sketch.finishDrawing(true);\r\n};\r\n/** Add a new Point to the drawing\r\n */\r\nol.interaction.DrawTouch.prototype.addPoint = function() {\r\n  this.sketch.addPoint(this.getPosition());\r\n};\r\n/** Remove last point of the feature currently being drawn.\r\n */\r\nol.interaction.DrawTouch.prototype.removeLastPoint = function() {\r\n  this.sketch.removeLastPoint();\r\n};\r\n/**\r\n * Activate or deactivate the interaction.\r\n * @param {boolean} active Active.\r\n * @observable\r\n * @api\r\n */\r\nol.interaction.DrawTouch.prototype.setActive = function(b) {\r\n  ol.interaction.CenterTouch.prototype.setActive.call (this, b);\r\n  this.sketch.abortDrawing();\r\n  this.sketch.setVisible(b);\r\n};\r\n\r\n/** Extend DragAndDrop choose drop zone + fires loadstart, loadend\r\n * @constructor\r\n * @extends {ol.interaction.DragAndDrop}\r\n * @fires loadstart, loadend, addfeatures\r\n * @param {*} options\r\n *  @param {string} options.zone selector for the drop zone, default document\r\n *  @param{ol.projection} options.projection default projection of the map\r\n *  @param {Array<function(new:ol.format.Feature)>|undefined} options.formatConstructors Format constructors, default [ ol.format.GPX, ol.format.GeoJSONX, ol.format.GeoJSONP, ol.format.GeoJSON, ol.format.IGC, ol.format.KML, ol.format.TopoJSON ]\r\n *  @param {Array<string>|undefined} options.accept list of accepted format, default [\"gpx\",\"json\",\"geojsonx\",\"geojsonp\",\"geojson\",\"igc\",\"kml\",\"topojson\"]\r\n */\r\nol.interaction.DropFile = function(options) {\r\n  options = options||{};\r\n  ol.interaction.DragAndDrop.call(this, {});\r\n  var zone = options.zone || document;\r\n  zone.addEventListener('dragenter', this.onstop );\r\n  zone.addEventListener('dragover', this.onstop );\r\n  zone.addEventListener('dragleave', this.onstop );\r\n  // Options\r\n  this.formatConstructors_ = options.formatConstructors || [ ol.format.GPX, ol.format.GeoJSONX, ol.format.GeoJSONP, ol.format.GeoJSON, ol.format.IGC, ol.format.KML, ol.format.TopoJSON ];\r\n  this.projection_ = options.projection;\r\n  this.accept_ = options.accept || [\"gpx\",\"json\",\"geojsonx\",\"geojsonp\",\"geojson\",\"igc\",\"kml\",\"topojson\"];\r\n  var self = this;\r\n  zone.addEventListener('drop', function(e){ return self.ondrop(e);});\r\n};\r\nol.ext.inherits(ol.interaction.DropFile, ol.interaction.DragAndDrop);\r\n/** Set the map\r\n*/\r\nol.interaction.DropFile.prototype.setMap = function(map) {\r\n  ol.interaction.Interaction.prototype.setMap.call(this, map);\r\n};\r\n/** Do something when over\r\n*/\r\nol.interaction.DropFile.prototype.onstop = function(e) {\r\n  e.preventDefault();\r\n  e.stopPropagation();\r\n  return false;\r\n}\r\n/** Do something when over\r\n*/\r\nol.interaction.DropFile.prototype.ondrop = function(e) {\r\n  e.preventDefault();\r\n  if (e.dataTransfer && e.dataTransfer.files.length) {\r\n    var self = this;\r\n    var projection = this.projection_ || (this.getMap() ? this.getMap().getView().getProjection() : null);\r\n    // fetch FileList object\r\n    var files = e.dataTransfer.files; // e.originalEvent.target.files ?\r\n    // process all File objects\r\n    var file;\r\n    var pat = /\\.([0-9a-z]+)(?=[?#])|(\\.)(?:[\\w]+)$/;\r\n    for (var i=0; file=files[i]; i++) {\r\n      var ex = file.name.match(pat)[0];\r\n      var isok = (this.accept_.indexOf(ex.toLocaleLowerCase()) >= 0);\r\n      self.dispatchEvent({ type:'loadstart', file: file, filesize: file.size, filetype: file.type, fileextension: ex, projection: projection, isok: isok });\r\n      // Don't load file\r\n      if (!this.formatConstructors_.length) continue;\r\n      // Load file\r\n      var reader = new FileReader();\r\n      var formatConstructors = this.formatConstructors_\r\n      var theFile = file;\r\n      reader.onload = function(e) {\r\n        var result = e.target.result;\r\n        var features = [];\r\n        var i, ii;\r\n        for (i = 0, ii = formatConstructors.length; i < ii; ++i) {\r\n          var formatConstructor = formatConstructors[i];\r\n          try {\r\n            var format = new formatConstructor();\r\n            features = format.readFeatures(result, { featureProjection: projection });\r\n            if (features && features.length > 0) {\r\n              self.dispatchEvent({ type:'addfeatures', features: features, file: theFile, projection: projection });\r\n              self.dispatchEvent({ type:'loadend', features: features, file: theFile, projection: projection });\r\n              return;\r\n            }\r\n          } catch(e) { /* ok */ }\r\n        }\r\n        // Nothing match, try to load by yourself\r\n        self.dispatchEvent({ type:'loadend', file: theFile, result: result });\r\n      };\r\n      // Start loading\r\n      reader.readAsText(file);\r\n    }\r\n  }\r\n  return false;\r\n};\r\n\r\n/** A Select interaction to fill feature's properties on click.\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @fires setattributestart\r\n * @fires setattributeend\r\n * @param {*} options extentol.interaction.Select options\r\n *  @param {boolean} options.active activate the interaction on start, default true\r\n *  @param {string=} options.name \r\n *  @param {boolean|string} options.cursor interaction cursor if false use default, default use a paint bucket cursor\r\n * @param {*} properties The properties as key/value\r\n */\r\nol.interaction.FillAttribute = function(options, properties) {\r\n  options = options || {};\r\n  if (!options.condition) options.condition = ol.events.condition.click;\r\n  ol.interaction.Select.call(this, options);\r\n  this.setActive(options.active!==false)\r\n  this.set('name', options.name);\r\n  this._attributes = properties;\r\n  this.on('select', function(e) {\r\n    this.getFeatures().clear();\r\n    this.fill(e.selected, this._attributes);\r\n  }.bind(this));\r\n  if (options.cursor === undefined) {\r\n    var canvas = document.createElement('CANVAS');\r\n    canvas.width = canvas.height = 32;\r\n    var ctx = canvas.getContext(\"2d\");\r\n    ctx.beginPath();\r\n      ctx.moveTo(9,3);\r\n      ctx.lineTo(2,9);\r\n      ctx.lineTo(10,17);\r\n      ctx.lineTo(17,11);\r\n    ctx.closePath();\r\n    ctx.fillStyle = \"#fff\";\r\n    ctx.fill();\r\n    ctx.stroke();\r\n    ctx.beginPath();\r\n      ctx.moveTo(6,4);\r\n      ctx.lineTo(0,8);\r\n      ctx.lineTo(0,13);\r\n      ctx.lineTo(3,17);\r\n      ctx.lineTo(3,8);\r\n    ctx.closePath();\r\n    ctx.fillStyle = \"#000\";\r\n    ctx.fill();\r\n    ctx.stroke();\r\n    ctx.moveTo(8,8);\r\n    ctx.lineTo(10,0);\r\n    ctx.lineTo(11,0);\r\n    ctx.lineTo(13,3);\r\n    ctx.lineTo(13,7);\r\n    ctx.stroke();\r\n    this._cursor = 'url('+canvas.toDataURL()+') 0 13, auto';\r\n  }\r\n  if (options.cursor) {\r\n    this._cursor = options.cursor;\r\n  }\r\n};\r\nol.ext.inherits(ol.interaction.FillAttribute, ol.interaction.Select);\r\n/** Define the interaction cursor\r\n * @param {string} cursor CSS cursor\r\n */\r\nol.interaction.FillAttribute.prototype.setCursor = function(cursor) {\r\n  this._cursor = cursor;\r\n};\r\n/** Get the interaction cursor\r\n * @return {string} cursor\r\n */\r\nol.interaction.FillAttribute.prototype.getCursor = function() {\r\n  return this._cursor;\r\n};\r\n/** Activate the interaction\r\n * @param {boolean} active\r\n */\r\nol.interaction.FillAttribute.prototype.setActive = function(active) {\r\n  if(active === this.getActive()) return;\r\n  ol.interaction.Select.prototype.setActive.call(this, active);\r\n  if (this.getMap() && this._cursor) {\r\n    if (active) {\r\n      this._previousCursor = this.getMap().getTargetElement().style.cursor;\r\n      this.getMap().getTargetElement().style.cursor = this._cursor;\r\n//      console.log('setCursor',this._cursor)\r\n    } else {\r\n      this.getMap().getTargetElement().style.cursor = this._previousCursor;\r\n      this._previousCursor = undefined;\r\n    }\r\n  }\r\n};\r\n/** Set attributes\r\n * @param {*} properties The properties as key/value\r\n */\r\nol.interaction.FillAttribute.prototype.setAttributes = function(properties) {\r\n  this._attributes = properties;\r\n};\r\n/** Set an attribute\r\n * @param {string} key \r\n * @param {*} val \r\n */\r\nol.interaction.FillAttribute.prototype.setAttribute = function(key, val) {\r\n  this._attributes[key] = val;\r\n};\r\n/** get attributes\r\n * @return {*} The properties as key/value\r\n */\r\nol.interaction.FillAttribute.prototype.getAttributes = function() {\r\n  return this._attributes;\r\n};\r\n/** Get an attribute\r\n * @param {string} key \r\n * @return {*} val \r\n */\r\nol.interaction.FillAttribute.prototype.getAttribute = function(key) {\r\n  return this._attributes[key];\r\n};\r\n/** Fill feature attributes\r\n * @param {Array<ol.Feature>} features The features to modify\r\n * @param {*} properties The properties as key/value\r\n */\r\nol.interaction.FillAttribute.prototype.fill = function(features, properties) {\r\n  if (features.length && properties) {\r\n    // Test changes\r\n    var changes = false;\r\n    for (var i=0, f; f = features[i]; i++) {\r\n      for (var p in properties) {\r\n        if (f.get(p) !== properties[p]) changes = true;\r\n      }\r\n      if (changes) break;\r\n    }\r\n    // Set Attributes\r\n    if (changes) {\r\n      this.dispatchEvent({ \r\n        type: 'setattributestart', \r\n        features: features, \r\n        properties: properties \r\n      });\r\n      features.forEach(function(f) {\r\n        for (var p in properties) {\r\n          f.set(p, properties[p]);\r\n        }\r\n      });\r\n      this.dispatchEvent({ \r\n        type: 'setattributeend', \r\n        features: features, \r\n        properties: properties \r\n      });\r\n    }\r\n  }\r\n};\r\n\r\n/**\r\n * @constructor\r\n * @extends {ol.interaction.Pointer}\r\n * @param {ol.flashlight.options} flashlight options param\r\n *\t@param {ol.Color} options.color light color, default transparent\r\n *  @param {ol.Color} options.fill fill color, default rgba(0,0,0,0.8)\r\n *  @param {number} options.radius radius of the flash\r\n */\r\nol.interaction.Flashlight = function(options) {\r\n  ol.interaction.Pointer.call(this, {\r\n    handleDownEvent: this.setPosition,\r\n    handleMoveEvent: this.setPosition\r\n  });\r\n  // Default options\r\n  options = options||{};\r\n  this.pos = false;\r\n  this.radius = (options.radius||100);\r\n  this.setColor(options);\r\n};\r\nol.ext.inherits(ol.interaction.Flashlight, ol.interaction.Pointer);\r\n/** Set the map > start postcompose\r\n*/\r\nol.interaction.Flashlight.prototype.setMap = function(map) {\r\n  if (this.getMap()) {\r\n    this.getMap().render();\r\n  }\r\n  if (this._listener) ol.Observable.unByKey(this._listener);\r\n  this._listener = null;\r\n  ol.interaction.Pointer.prototype.setMap.call(this, map);\r\n  if (map) {\r\n    this._listener = map.on('postcompose', this.postcompose_.bind(this));\r\n  }\r\n}\r\n/** Set flashlight radius\r\n *\t@param {integer} radius\r\n*/\r\nol.interaction.Flashlight.prototype.setRadius = function(radius) {\r\n  this.radius = radius\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n}\r\n/** Set flashlight color\r\n *\t@param {ol.flashlight.options} flashlight options param\r\n*\t\t- color {ol.Color} light color, default transparent\r\n*\t\t- fill {ol.Color} fill color, default rgba(0,0,0,0.8)\r\n*/\r\nol.interaction.Flashlight.prototype.setColor = function(options) {\r\n  // Backcolor\r\n  var color = (options.fill ? options.fill : [0,0,0,0.8]);\r\n  var c = ol.color.asArray(color);\r\n  this.startColor = ol.color.asString(c);\r\n  // Halo color\r\n  if (options.color) {\r\n    c = this.endColor = ol.color.asString(ol.color.asArray(options.color)||options.color);\r\n  } else  {\r\n    c[3] = 0\r\n    this.endColor = ol.color.asString(c);\r\n  }\r\n  c[3] = 0.1;\r\n  this.midColor = ol.color.asString(c);\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n}\r\n/** Set position of the flashlight\r\n*\t@param {ol.Pixel|ol.MapBrowserEvent}\r\n*/\r\nol.interaction.Flashlight.prototype.setPosition = function(e) {\r\n  if (e.pixel) this.pos = e.pixel;\r\n  else this.pos = e;\r\n  if (this.getMap()) {\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n}\r\n/** Postcompose function\r\n*/\r\nol.interaction.Flashlight.prototype.postcompose_ = function(e) {\r\n  var ctx = ol.ext.getMapCanvas(this.getMap()).getContext('2d');\r\n  var ratio = e.frameState.pixelRatio;\r\n  var w = ctx.canvas.width;\r\n  var h = ctx.canvas.height;\r\n  ctx.save();\r\n  ctx.scale(ratio,ratio);\r\n  if (!this.pos) {\r\n    ctx.fillStyle = this.startColor;\r\n    ctx.fillRect( 0,0,w,h );\r\n  } else {\r\n    var d = Math.max(w, h);\r\n    // reveal wherever we drag\r\n    var radGrd = ctx.createRadialGradient( this.pos[0], this.pos[1], w*this.radius/d, this.pos[0], this.pos[1], h*this.radius/d );\r\n    radGrd.addColorStop(   0, this.startColor );\r\n    radGrd.addColorStop( 0.8, this.midColor );\r\n    radGrd.addColorStop(   1, this.endColor );\r\n    ctx.fillStyle = radGrd;\r\n    ctx.fillRect( this.pos[0] - d, this.pos[1] - d, 2*d, 2*d );\r\n  }\r\n  ctx.restore();\r\n};\r\n\r\n/** An interaction to focus on the map on click. Usefull when using keyboard event on the map.\r\n * @constructor\r\n * @fires focus\r\n * @extends {ol.interaction.Interaction}\r\n */\r\nol.interaction.FocusMap = function() {\r\n  //\r\n  ol.interaction.Interaction.call(this, {});\r\n  // Focus (hidden) button to focus on the map when click on it \r\n  this.focusBt = ol.ext.element.create('BUTTON', {\r\n    on: {\r\n      focus: function() {\r\n        this.dispatchEvent({ type:'focus' });\r\n      }.bind(this)\r\n    },\r\n    style: {\r\n      position: 'absolute',\r\n      zIndex: -1,\r\n      top: 0,\r\n      opacity: 0\r\n    }\r\n  });\r\n};\r\nol.ext.inherits(ol.interaction.FocusMap, ol.interaction.Interaction);\r\n/** Set the map > add the focus button and focus on the map when pointerdown to enable keyboard events.\r\n */\r\nol.interaction.FocusMap.prototype.setMap = function(map) {\r\n  if (this._listener) ol.Observable.unByKey(this._listener);\r\n  this._listener = null;\r\n  if (this.getMap()) { this.getMap().getViewport().removeChild(this.focusBt); }\r\n  ol.interaction.Interaction.prototype.setMap.call (this, map);\r\n  if (this.getMap()) {\r\n    // Force focus on the clicked map\r\n    this._listener = this.getMap().on('pointerdown', function() {\r\n      if (this.getActive()) this.focusBt.focus();\r\n    }.bind(this));\r\n    this.getMap().getViewport().appendChild(this.focusBt); \r\n  }\r\n};\r\n\r\n// \r\n/** Interaction to draw on the current geolocation\r\n *\tIt combines a draw with a ol.Geolocation\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @fires drawstart, drawend, drawing, tracking, follow\r\n * @param {any} options\r\n *  @param { ol.Collection.<ol.Feature> | undefined } option.features Destination collection for the drawn features.\r\n *  @param { ol.source.Vector | undefined } options.source Destination source for the drawn features.\r\n *  @param {ol.geom.GeometryType} options.type Drawing type ('Point', 'LineString', 'Polygon'), default LineString.\r\n *  @param {Number | undefined} options.minAccuracy minimum accuracy underneath a new point will be register (if no condition), default 20\r\n *  @param {function | undefined} options.condition a function that take a ol.Geolocation object and return a boolean to indicate whether location should be handled or not, default return true if accuracy < minAccuracy\r\n *  @param {Object} options.attributes a list of attributes to register as Point properties: {accuracy:true,accuracyGeometry:true,heading:true,speed:true}, default none.\r\n *  @param {Number} options.tolerance tolerance to add a new point (in meter), default 5\r\n *  @param {Number} options.zoom zoom for tracking, default 16\r\n *  @param {Number} options.minZoom min zoom for tracking, if zoom is less it will zoom to it, default use zoom option\r\n *  @param {boolean|auto|position|visible} options.followTrack true if you want the interaction to follow the track on the map, default true\r\n *  @param { ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined } options.style Style for sketch features.\r\n */\r\nol.interaction.GeolocationDraw = function(options) {\r\n  if (!options) options={};\r\n  // Geolocation\r\n  this.geolocation = new ol.Geolocation(({ \r\n    projection: \"EPSG:4326\",\r\n    trackingOptions: {\r\n      maximumAge: 10000,\r\n      enableHighAccuracy: true,\r\n      timeout: 600000\r\n    }\r\n  }));\r\n  this.geolocation.on('change', this.draw_.bind(this));\r\n  // Current path\r\n  this.path_ = [];\r\n  this.lastPosition_ = false;\r\n  // Default style\r\n  var white = [255, 255, 255, 1];\r\n  var blue = [0, 153, 255, 1];\r\n  var width = 3;\r\n  var circle = new ol.style.Circle({\r\n    radius: width * 2,\r\n    fill: new ol.style.Fill({ color: blue }),\r\n    stroke: new ol.style.Stroke({ color: white, width: width / 2 })\r\n  });\r\n  var style = [\r\n    new ol.style.Style({\r\n      stroke: new ol.style.Stroke({ color: white, width: width + 2 })\r\n    }),\r\n    new ol.style.Style({\r\n      stroke: new ol.style.Stroke({ color: blue, width: width }),\r\n      fill: new ol.style.Fill({\r\n        color: [255, 255, 255, 0.5]\r\n      })\r\n    })\r\n  ];\r\n  var triangle = new ol.style.RegularShape({\r\n    radius: width * 3.5,\r\n    points: 3,\r\n    rotation: 0,\r\n    fill: new ol.style.Fill({ color: blue }),\r\n    stroke: new ol.style.Stroke({ color: white, width: width / 2 })\r\n  });\r\n  // stretch the symbol\r\n  var c = triangle.getImage();\r\n  var ctx = c.getContext(\"2d\");\r\n  var c2 = document.createElement('canvas');\r\n  c2.width = c2.height = c.width;\r\n  c2.getContext(\"2d\").drawImage(c, 0,0);\r\n  ctx.clearRect(0,0,c.width,c.height);\r\n  ctx.drawImage(c2, 0,0, c.width, c.height, width, 0, c.width-2*width, c.height);\r\n  var defaultStyle = function(f) {\r\n    if (f.get('heading')===undefined) {\r\n      style[1].setImage(circle);\r\n    } else {\r\n      style[1].setImage(triangle);\r\n      triangle.setRotation( f.get('heading') || 0);\r\n    }\r\n    return style;\r\n  }\r\n  // Style for the accuracy geometry\r\n  this.locStyle = {\r\n    error: new ol.style.Style({ fill: new ol.style.Fill({ color: [255, 0, 0, 0.2] }) }),\r\n    warn: new ol.style.Style({ fill: new ol.style.Fill({ color: [255, 192, 0, 0.2] }) }),\r\n    ok: new ol.style.Style({ fill: new ol.style.Fill({ color: [0, 255, 0, 0.2] }) }),\r\n  };\r\n  // Create a new overlay layer for the sketch\r\n  this.overlayLayer_ = new ol.layer.Vector({\r\n    source: new ol.source.Vector(),\r\n    name:'GeolocationDraw overlay',\r\n    style: options.style || defaultStyle\r\n  });\r\n  this.sketch_ = [new ol.Feature(), new ol.Feature(), new ol.Feature()];\r\n  this.overlayLayer_.getSource().addFeatures(this.sketch_);\r\n  this.features_ = options.features;\r\n  this.source_ = options.source;\r\n  this.condition_ = options.condition || function(loc) { \r\n    return loc.getAccuracy() < this.get(\"minAccuracy\") \r\n  };\r\n  // Prevent interaction when tracking\r\n  ol.interaction.Interaction.call(this, {\r\n    handleEvent: function() {\r\n      return (!this.get('followTrack') || this.get('followTrack')=='auto');//  || !geoloc.getTracking());\r\n    }\r\n  });\r\n  this.set('type', options.type||\"LineString\");\r\n  this.set('attributes', options.attributes||{});\r\n  this.set('minAccuracy', options.minAccuracy||20);\r\n  this.set('tolerance', options.tolerance||5);\r\n  this.set('zoom', options.zoom);\r\n  this.set('minZoom', options.minZoom);\r\n  this.setFollowTrack (options.followTrack===undefined ? true : options.followTrack);\r\n  this.setActive(false);\r\n};\r\nol.ext.inherits(ol.interaction.GeolocationDraw, ol.interaction.Interaction);\r\n/** Simplify 3D geometry\r\n * @param {ol.geom.Geometry} geo\r\n * @param {number} tolerance\r\n */\r\nol.interaction.GeolocationDraw.prototype.simplify3D = function(geo, tolerance) {\r\n  var geom = geo.getCoordinates();\r\n  var proj = this.getMap().getView().getProjection();\r\n  if (this.get(\"type\")==='Polygon') {\r\n    geom = geom[0];\r\n  }\r\n  var simply = [geom[0]];\r\n  var pi, p = ol.proj.transform(geom[0], proj, 'EPSG:4326')\r\n  for (var i=1; i<geom.length; i++) {\r\n    pi = ol.proj.transform(geom[i], proj, 'EPSG:4326')\r\n    var d = ol.sphere.getDistance(p, pi);\r\n    if (d > tolerance) {\r\n      simply.push(geom[i]);\r\n      p = pi;\r\n    }\r\n  }\r\n  if (simply[simply.length-1] !== geom[geom.length-1]) {\r\n    simply.push(geom[geom.length-1]);\r\n  }\r\n  /*\r\n  var simply = geo.simplify(tolerance).getCoordinates();\r\n  if (this.get(\"type\")==='Polygon') {\r\n    simply = simply[0];\r\n  }\r\n  var step=0;\r\n  simply.forEach(function(p) {\r\n    for (; step<this.path_.length; step++) {\r\n      if (ol.coordinate.equal(p, this.path_[step])) {\r\n        p[2] = this.path_[step][2];\r\n        p[3] = this.path_[step][3];\r\n        break;\r\n      }\r\n    }\r\n  }.bind(this));\r\n  */\r\n  // Get 3D geom\r\n  if (this.get(\"type\")==='Polygon') {\r\n    geo = new ol.geom.Polygon([simply], 'XYZM');\r\n  } else {\r\n    geo = new ol.geom.LineString(simply, 'XYZM');\r\n  }\r\n  return geo;\r\n};\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.GeolocationDraw.prototype.setMap = function(map) {\r\n  if (this.getMap()) this.getMap().removeLayer(this.overlayLayer_);\r\n  ol.interaction.Pointer.prototype.setMap.call (this, map);\r\n  this.overlayLayer_.setMap(map);\r\n  if (map) this.geolocation.setProjection(map.getView().getProjection());\r\n};\r\n/** Activate or deactivate the interaction.\r\n * @param {boolean} active\r\n */\r\nol.interaction.GeolocationDraw.prototype.setActive = function(active) {\r\n  if (active === this.getActive()) return;\r\n  ol.interaction.Interaction.prototype.setActive.call(this, active);\r\n  this.overlayLayer_.setVisible(active);\r\n  if (this.getMap()) {\r\n    this.geolocation.setTracking(active);\r\n    try { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n  }\r\n  this.pause(!active);\r\n  if (active) {\r\n    // Start drawing\r\n    this.reset();\r\n    this.dispatchEvent({ type:'drawstart', feature: this.sketch_[1]});\r\n  } else {\r\n    var f = this.sketch_[1].clone();\r\n    if (f.getGeometry()) {\r\n      if (this.features_) this.features_.push(f);\r\n      if (this.source_) this.source_.addFeature(f);\r\n    }\r\n    this.dispatchEvent({ type:'drawend', feature: f});\r\n  }\r\n};\r\n/** Simulate a track and override current geolocation\r\n * @param {Array<ol.coordinate>|boolean} track a list of point or false to stop\r\n * @param {*} options\r\n *  @param {number} delay delay in ms, default 1000 (1s)\r\n *  @param {number} accuracy gps accuracy, default 10\r\n *  @param {boolean} repeat repeat track, default true\r\n */\r\nol.interaction.GeolocationDraw.prototype.simulate = function(track, options) {\r\n  if (this._track) {\r\n    clearTimeout(this._track.timeout);\r\n  }\r\n  if (!track) {\r\n    this._track = false;\r\n    return;\r\n  }\r\n  options = options || {};\r\n  var delay = options.delay || 1000;\r\n  function handleTrack() {\r\n    if (this._track.pos >= this._track.track.length) {\r\n      this._track = false;\r\n      return;\r\n    }\r\n    var coord = this._track.track[this._track.pos];\r\n    coord[2] = coord[3] || 0;\r\n    coord[3] = (new Date()).getTime();\r\n    this._track.pos++;\r\n    if (options.repeat !== false) {\r\n      this._track.pos = this._track.pos % this._track.track.length;\r\n    } \r\n    if (this.getActive()) this.draw_(true, coord, options.accuracy);\r\n    this._track.timeout = setTimeout(handleTrack.bind(this), delay);\r\n  }\r\n  this._track = {\r\n    track: track,\r\n    pos: 0,\r\n    timeout: setTimeout(handleTrack.bind(this), 0)\r\n  }\r\n};\r\n/** Is simulation on ?\r\n * @returns {boolean}\r\n */\r\nol.interaction.GeolocationDraw.prototype.simulating = function() {\r\n  return !!this._track;\r\n};\r\n/** Reset drawing\r\n*/\r\nol.interaction.GeolocationDraw.prototype.reset = function() {\r\n  this.sketch_[1].setGeometry();\r\n  this.path_ = [];\r\n  this.lastPosition_ = false;\r\n};\r\n/** Start tracking = setActive(true)\r\n */\r\nol.interaction.GeolocationDraw.prototype.start = function() {\r\n  this.setActive(true);\r\n};\r\n/** Stop tracking = setActive(false)\r\n */\r\nol.interaction.GeolocationDraw.prototype.stop = function() {\r\n  this.setActive(false);\r\n};\r\n/** Pause drawing\r\n * @param {boolean} b \r\n */\r\nol.interaction.GeolocationDraw.prototype.pause = function(b) {\r\n  this.pause_ = (b!==false);\r\n};\r\n/** Is paused\r\n * @return {boolean} b \r\n */\r\nol.interaction.GeolocationDraw.prototype.isPaused = function() {\r\n  return this.pause_;\r\n};\r\n/** Enable following the track on the map\r\n* @param {boolean|auto|position|visible} follow, \r\n*\tfalse: don't follow, \r\n*\ttrue: follow (position+zoom), \r\n*\t'position': follow only position,\r\n*\t'auto': start following until user move the map,\r\n*\t'visible': center when position gets out of the visible extent\r\n*/\r\nol.interaction.GeolocationDraw.prototype.setFollowTrack = function(follow) {\r\n  this.set('followTrack', follow);\r\n  var map = this.getMap();\r\n  // Center if wanted\r\n  if (this.getActive() && map) {\r\n    var zoom;\r\n    if (follow !== 'position') {\r\n      if (this.get('minZoom')) {\r\n        zoom = Math.max(this.get('minZoom'), map.getView().getZoom());\r\n      } else {\r\n        zoom = this.get('zoom');\r\n      }\r\n    }\r\n    if (follow !== false && !this.lastPosition_) {\r\n      var pos = this.path_[this.path_.length-1];\r\n      if (pos) {\r\n        map.getView().animate({\r\n          center: pos,\r\n          zoom: zoom\r\n        });\r\n      }\r\n    } else if (follow==='auto' && this.lastPosition_) {\r\n      map.getView().animate({\r\n        center: this.lastPosition_,\r\n        zoom: zoom\r\n      });\r\n    }\r\n  }\r\n  this.lastPosition_ = false;\t\t\t\t\r\n  this.dispatchEvent({ type:'follow', following: follow!==false });\r\n};\r\n/** Add a new point to the current path\r\n * @private\r\n */\r\nol.interaction.GeolocationDraw.prototype.draw_ = function(simulate, coord, accuracy) {\r\n  var map = this.getMap();\r\n  if (!map) return;\r\n  var accu, pos, p, loc, heading;\r\n  // Simulation mode\r\n  if (this._track) {\r\n    if (simulate!==true) return;\r\n    pos = coord;\r\n    accu = accuracy || 10;\r\n    if (this.path_ && this.path_.length) {\r\n      var pt = this.path_[this.path_.length-1];\r\n      heading = Math.atan2(coord[0]-pt[0],coord[1]-pt[1])\r\n    }\r\n    var circle = new ol.geom.Circle(pos, map.getView().getResolution()*accu);\r\n    p = ol.geom.Polygon.fromCircle(circle);\r\n  } else {\r\n    // Current location\r\n    loc = this.geolocation;\r\n    accu = loc.getAccuracy();\r\n    pos = this.getPosition(loc);\r\n    p = loc.getAccuracyGeometry();\r\n    heading = loc.getHeading();\r\n  }\r\n  // Center on point\r\n  // console.log(this.get('followTrack'))\r\n  switch (this.get('followTrack')) {\r\n    // Follow center + zoom\r\n    case true: {\r\n      // modify zoom\r\n      if (this.get('followTrack') == true) {\r\n        if (this.get('minZoom')) {\r\n          if (this.get('minZoom') > map.getView().getZoom()) {\r\n            map.getView().setZoom(this.get('minZoom'));\r\n          }\r\n        } else {\r\n          map.getView().setZoom( this.get('zoom') || 16 );\r\n        }\r\n        if (!ol.extent.containsExtent(map.getView().calculateExtent(map.getSize()), p.getExtent())) {\r\n          map.getView().fit(p.getExtent());\r\n        }\r\n      }\r\n      map.getView().setCenter( pos );\r\n      break;\r\n    }\r\n    // Follow  position \r\n    case 'position': {\r\n      // modify center\r\n      map.getView().setCenter( pos );\r\n      break;\r\n    }\r\n    // Keep on following \r\n    case 'auto': {\r\n      if (this.lastPosition_) {\r\n        var center = map.getView().getCenter();\r\n        // console.log(center,this.lastPosition_)\r\n        if (center[0]!=this.lastPosition_[0] || center[1]!=this.lastPosition_[1]) {\r\n          //this.dispatchEvent({ type:'follow', following: false });\r\n          this.setFollowTrack (false);\r\n        } else {\r\n          map.getView().setCenter( pos );\t\r\n          this.lastPosition_ = pos;\r\n        }\r\n      } else {\r\n        map.getView().setCenter( pos );\t\r\n        if (this.get('minZoom')) {\r\n          if (this.get('minZoom') > map.getView().getZoom()) {\r\n            map.getView().setZoom(this.get('minZoom'));\r\n          }\r\n        } else if (this.get('zoom')) {\r\n          map.getView().setZoom( this.get('zoom'));\r\n        }\r\n        this.lastPosition_ = pos;\r\n      }\r\n      break;\r\n    }\r\n    // Force to stay on the map\r\n    case 'visible': {\r\n      if (!ol.extent.containsCoordinate(map.getView().calculateExtent(map.getSize()), pos)) {\r\n        map.getView().setCenter (pos);\r\n      }\r\n      break;\r\n    }\r\n    // Don't follow\r\n    default: break;\r\n  }\r\n  // Draw occuracy\r\n  var f = this.sketch_[0];\r\n  f.setGeometry(p);\r\n  if (accu < this.get(\"minAccuracy\")/2) f.setStyle(this.locStyle.ok);\r\n  else if (accu < this.get(\"minAccuracy\")) f.setStyle(this.locStyle.warn);\r\n  else f.setStyle(this.locStyle.error);\r\n  var geo;\r\n  if (this.pause_) {\r\n    this.lastPosition_ = pos;\r\n  }\r\n  if (!this.pause_ && (!loc || this.condition_.call(this, loc))) {\r\n    f = this.sketch_[1];\r\n    this.path_.push(pos);\r\n    switch (this.get(\"type\")) {\r\n      case \"Point\":\r\n        this.path_ = [pos];\r\n        f.setGeometry(new ol.geom.Point(pos, 'XYZM'));\r\n        var attr = this.get('attributes');\r\n        if (attr.heading) f.set(\"heading\",loc.getHeading());\r\n        if (attr.accuracy) f.set(\"accuracy\",loc.getAccuracy());\r\n        if (attr.altitudeAccuracy) f.set(\"altitudeAccuracy\", loc.getAltitudeAccuracy());\r\n        if (attr.speed) f.set(\"speed\",loc.getSpeed());\r\n        break;\r\n      case \"LineString\":\r\n        if (this.path_.length>1) {\r\n          geo = new ol.geom.LineString(this.path_, 'XYZM');\r\n          if (this.get(\"tolerance\")) geo = this.simplify3D (geo, this.get(\"tolerance\"));\r\n          f.setGeometry(geo);\r\n        } else {\r\n          f.setGeometry();\r\n        }\r\n        break;\r\n      case \"Polygon\":\r\n        if (this.path_.length>2) {\r\n          geo = new ol.geom.Polygon([this.path_], 'XYZM');\r\n          if (this.get(\"tolerance\")) geo = this.simplify3D (geo, this.get(\"tolerance\"));\r\n          f.setGeometry(geo);\r\n        }\r\n        else f.setGeometry();\r\n        break;\r\n    }\r\n    this.dispatchEvent({ type:'drawing', feature: this.sketch_[1], geolocation: loc });\r\n  }\r\n  this.sketch_[2].setGeometry(new ol.geom.Point(pos));\r\n  this.sketch_[2].set(\"heading\", heading);\r\n  // Drawing\r\n  this.dispatchEvent({ type:'tracking', feature: this.sketch_[1], geolocation: loc });\r\n};\r\n/** Get a position according to the geolocation\r\n * @param {Geolocation} loc\r\n * @returns {Array<any>} an array of measure X,Y,Z,T\r\n * @api\r\n */\r\nol.interaction.GeolocationDraw.prototype.getPosition = function (loc) {\r\n  var pos = loc.getPosition();\r\n  pos.push (Math.round((loc.getAltitude()||0)*100)/100);\r\n  pos.push (Math.round((new Date()).getTime()/1000));\r\n  return pos;\r\n}\r\n\r\n/** Interaction hover do to something when hovering a feature\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @fires hover, enter, leave\r\n * @param {olx.interaction.HoverOptions} \r\n *  @param { string | undefined } options.cursor css cursor propertie or a function that gets a feature, default: none\r\n *  @param {function | undefined} options.featureFilter filter a function with two arguments, the feature and the layer of the feature. Return true to select the feature \r\n *  @param {function | undefined} options.layerFilter filter a function with one argument, the layer to test. Return true to test the layer\r\n *  @param {Array<ol.layer> | undefined} options.layers a set of layers to test\r\n *  @param {number | undefined} options.hitTolerance Hit-detection tolerance in pixels.\r\n *  @param { function | undefined } options.handleEvent Method called by the map to notify the interaction that a browser event was dispatched to the map. The function may return false to prevent the propagation of the event to other interactions in the map's interactions chain.\r\n */\r\nol.interaction.Hover = function(options) {\r\n  if (!options) options={};\r\n  var self = this;\r\n  var dragging = false;\r\n  ol.interaction.Interaction.call(this, {\r\n    handleEvent: function(e) {\r\n      if (!self.getActive()) return true;\r\n      switch(e.type) {\r\n        case 'pointerdrag': { \r\n          dragging = true;\r\n          break;\r\n        } \r\n        case 'pointerup': { \r\n          dragging = false;\r\n          break;\r\n        }\r\n        case 'pointermove': {\r\n          if (!dragging) { \r\n            self.handleMove_(e); \r\n          } \r\n          break;\r\n        }\r\n      }\r\n      if (options.handleEvent) return options.handleEvent(e);\r\n      return true; \r\n    }\r\n  });\r\n  this.setLayerFilter (options.layerFilter);\r\n  if (options.layers && options.layers.length) {\r\n    this.setLayerFilter(function(l) {\r\n      return (options.layers.indexOf(l) >= 0);\r\n    })\r\n  } \r\n  this.setFeatureFilter (options.featureFilter);\r\n  this.set('hitTolerance', options.hitTolerance)\r\n  this.setCursor (options.cursor);\r\n};\r\nol.ext.inherits(ol.interaction.Hover, ol.interaction.Interaction);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.Hover.prototype.setMap = function(map) {\r\n  if (this.previousCursor_!==undefined && this.getMap()) {\r\n    this.getMap().getTargetElement().style.cursor = this.previousCursor_;\r\n    this.previousCursor_ = undefined;\r\n  }\r\n  ol.interaction.Interaction.prototype.setMap.call (this, map);\r\n};\r\n/** Activate / deactivate interaction\r\n * @param {boolean} b\r\n */\r\nol.interaction.Hover.prototype.setActive = function(b) {\r\n  ol.interaction.Interaction.prototype.setActive.call (this, b);\r\n  if (this.cursor_ && this.getMap() && this.getMap().getTargetElement()) {\r\n    var style = this.getMap().getTargetElement().style;\r\n    if (this.previousCursor_ !== undefined) {\r\n      style.cursor = this.previousCursor_;\r\n      this.previousCursor_ = undefined;\r\n    }\r\n  }\r\n};\r\n/**\r\n * Set cursor on hover\r\n * @param { string } cursor css cursor propertie or a function that gets a feature, default: none\r\n * @api stable\r\n */\r\nol.interaction.Hover.prototype.setCursor = function(cursor) {\r\n  if (!cursor && this.previousCursor_!==undefined && this.getMap()) {\r\n    this.getMap().getTargetElement().style.cursor = this.previousCursor_;\r\n    this.previousCursor_ = undefined;\r\n  }\r\n  this.cursor_ = cursor;\r\n};\r\n/** Feature filter to get only one feature\r\n* @param {function} filter a function with two arguments, the feature and the layer of the feature. Return true to select the feature \r\n*/\r\nol.interaction.Hover.prototype.setFeatureFilter = function(filter) {\r\n  if (typeof (filter) == 'function') this.featureFilter_ = filter;\r\n  else this.featureFilter_ = function(){ return true; };\r\n};\r\n/** Feature filter to get only one feature\r\n* @param {function} filter a function with one argument, the layer to test. Return true to test the layer\r\n*/\r\nol.interaction.Hover.prototype.setLayerFilter = function(filter) {\r\n  if (typeof (filter) == 'function') this.layerFilter_ = filter;\r\n  else this.layerFilter_ = function(){ return true; };\r\n};\r\n/** Get features whenmove\r\n* @param {ol.event} e \"move\" event\r\n*/\r\nol.interaction.Hover.prototype.handleMove_ = function(e) {\r\n  var map = this.getMap();\r\n  if (map) {\r\n    //var b = map.hasFeatureAtPixel(e.pixel);\r\n    var feature, layer;\r\n    var self = this;\r\n    var b = map.forEachFeatureAtPixel(\r\n      e.pixel, \r\n      function(f, l) {\r\n        if (self.featureFilter_.call(null,f,l)) {\r\n          feature = f;\r\n          layer = l;\r\n          return true;\r\n        } else {\r\n          feature = layer = null;\r\n          return false;\r\n        }\r\n      },{ \r\n        hitTolerance: this.get('hitTolerance'),\r\n        layerFilter: self.layerFilter_ \r\n      }\r\n    );\r\n    if (b) this.dispatchEvent({ \r\n      type: 'hover', \r\n      feature: feature, \r\n      layer: layer, \r\n      coordinate: e.coordinate, \r\n      pixel: e.pixel, \r\n      map: e.map, \r\n      originalEvent: e.originalEvent,\r\n      dragging: e.dragging \r\n    });\r\n    if (this.feature_===feature && this.layer_===layer){\r\n      /* ok */\r\n    } else {\r\n      this.feature_ = feature;\r\n      this.layer_ = layer;\r\n      if (feature) {\r\n        this.dispatchEvent({ \r\n          type: 'enter', \r\n          feature: feature, \r\n          layer: layer, \r\n          coordinate: e.coordinate, \r\n          pixel: e.pixel, \r\n          map: e.map, \r\n          originalEvent: e.originalEvent,\r\n          dragging: e.dragging \r\n        });\r\n      } else {\r\n        this.dispatchEvent({ \r\n          type: 'leave', \r\n          coordinate: e.coordinate, \r\n          pixel: e.pixel, \r\n          map: e.map, \r\n          originalEvent: e.originalEvent,\r\n          dragging: e.dragging \r\n        });\r\n      }\r\n    }\r\n    if (this.cursor_) {\r\n      var style = map.getTargetElement().style;\r\n      if (b) {\r\n        if (style.cursor != this.cursor_) {\r\n          this.previousCursor_ = style.cursor;\r\n          style.cursor = this.cursor_;\r\n        }\r\n      } else if (this.previousCursor_ !== undefined) {\r\n        style.cursor = this.previousCursor_;\r\n        this.previousCursor_ = undefined;\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Interaction to handle longtouch events\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @param {olx.interaction.LongTouchOptions} \r\n * \t@param {function | undefined} options.handleLongTouchEvent Function handling 'longtouch' events, it will receive a mapBrowserEvent. Or listen to the map 'longtouch' event.\r\n *\t@param {integer | undefined} [options.pixelTolerance=0] pixel tolerance before drag, default 0\r\n *\t@param {integer | undefined} [options.delay=1000] The delay for a long touch in ms, default is 1000\r\n */\r\nol.interaction.LongTouch = function(options) {\r\n  if (!options) options = {};\r\n  this.delay_ = options.delay || 1000;\r\n  var ltouch = options.handleLongTouchEvent || function(){};\r\n  var _timeout = null;\r\n  var position, event;\r\n  var tol = options.pixelTolerance || 0;\r\n  ol.interaction.Interaction.call(this, {\r\n    handleEvent: function(e) {\r\n      if (this.getActive()) {\r\n        switch (e.type) {\r\n          case 'pointerdown': {\r\n            if (_timeout) clearTimeout(_timeout);\r\n            position = e.pixel;\r\n            event = {\r\n              type: 'longtouch',\r\n              originalEvent: e.originalEvent,\r\n              frameState: e.frameState,\r\n              pixel: e.pixel,\r\n              coordinate: e.coordinate,\r\n              map: this.getMap()\r\n            }\r\n            _timeout = setTimeout (function() {\r\n              ltouch(event);\r\n              event.map.dispatchEvent(event);\r\n            }, this.delay_);\r\n            break;\r\n          }\r\n          case 'pointerdrag': {\r\n            // Check if dragging over tolerance\r\n            if (_timeout && (Math.abs(e.pixel[0] - position[0]) > tol || Math.abs(e.pixel[1] - position[1]) > tol)) {\r\n              clearTimeout(_timeout);\r\n              _timeout = null;\r\n            }\r\n            break;\r\n          }\r\n          case 'pointerup': {\r\n            if (_timeout) {\r\n              clearTimeout(_timeout);\r\n              _timeout = null;\r\n            }\r\n            break;\r\n          }\r\n          default: break;\r\n        }\r\n      } else {\r\n        if (_timeout) {\r\n          clearTimeout(_timeout);\r\n          _timeout = null;\r\n        }\r\n      }\r\n      return true;\r\n    }\r\n  });\r\n};\r\nol.ext.inherits(ol.interaction.LongTouch, ol.interaction.Interaction);\r\n\r\n// Use ol.getUid for Openlayers < v6\r\n/** Extent the ol/interaction/Modify with a getModifyFeatures\r\n * Get the features modified by the interaction\r\n * @return {Array<ol.Feature>} the modified features\r\n * @deprecated\r\n */\r\nol.interaction.Modify.prototype.getModifiedFeatures = function() {\r\n  var featuresById = {};\r\n  this.dragSegments_.forEach( function(s) {\r\n    var feature = s[0].feature;\r\n    // Openlayers > v.6\r\n    if (window.ol && window.ol.util) featuresById[ol.util.getUid(feature)] = feature;\r\n    // old version of Openlayers (< v.6) or ol all versions\r\n    else featuresById[ol.getUid(feature)] = feature;\r\n  });\r\n  var features = [];\r\n  for (var i in featuresById) features.push(featuresById[i]);\r\n  return features;\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Interaction for modifying feature geometries. Similar to the core ol/interaction/Modify.\r\n * The interaction is more suitable to use to handle feature modification: only features concerned \r\n * by the modification are passed to the events (instead of all feature with ol/interaction/Modify)\r\n * - the modifystart event is fired before the feature is modified (no points still inserted)\r\n * - the modifyend event is fired after the modification\r\n * - it fires a modifying event\r\n * @constructor\r\n * @extends {ol.interaction.Pointer}\r\n * @fires modifystart\r\n * @fires modifying\r\n * @fires modifyend\r\n * @fires select\r\n * @param {*} options\r\n *\t@param {ol.source.Vector} options.source a source to modify (configured with useSpatialIndex set to true)\r\n *\t@param {ol.source.Vector|Array<ol.source.Vector>} options.sources a list of source to modify (configured with useSpatialIndex set to true)\r\n *  @param {ol.Collection.<ol.Feature>} options.features collection of feature to modify\r\n *  @param {integer} options.pixelTolerance Pixel tolerance for considering the pointer close enough to a segment or vertex for editing. Default is 10.\r\n *  @param {function|undefined} options.filter a filter that takes a feature and return true if it can be modified, default always true.\r\n *  @param {ol.style.Style | Array<ol.style.Style> | undefined} options.style Style for the sketch features.\r\n *  @param {ol.EventsConditionType | undefined} options.condition A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event will be considered to add or move a vertex to the sketch. Default is ol.events.condition.primaryAction.\r\n *  @param {ol.EventsConditionType | undefined} options.deleteCondition A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. By default, ol.events.condition.singleClick with ol.events.condition.altKeyOnly results in a vertex deletion.\r\n *  @param {ol.EventsConditionType | undefined} options.insertVertexCondition A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether a new vertex can be added to the sketch features. Default is ol.events.condition.always\r\n *  @param {boolean} options.wrapX Wrap the world horizontally on the sketch overlay, default false\r\n */\r\nol.interaction.ModifyFeature = function(options){\r\n  if (!options) options = {};\r\n  var dragging, modifying;\r\n  ol.interaction.Pointer.call(this,{\r\n    /*\r\n    handleDownEvent: this.handleDownEvent,\r\n    handleDragEvent: this.handleDragEvent,\r\n    handleMoveEvent: this.handleMoveEvent,\r\n    handleUpEvent: this.handleUpEvent,\r\n    */\r\n    handleEvent: function(e) {\r\n      switch(e.type) {\r\n        case 'pointerdown': {\r\n          dragging = this.handleDownEvent(e);\r\n          modifying = dragging || this._deleteCondition(e);\r\n          return !dragging;\r\n        }\r\n        case 'pointerup': {\r\n          dragging = false;\r\n          return this.handleUpEvent(e);\r\n        }\r\n        case 'pointerdrag': {\r\n          if (dragging) return this.handleDragEvent(e);\r\n          else return true;\r\n        }\r\n        case 'pointermove': {\r\n          if (!dragging) return this.handleMoveEvent(e);\r\n          else return true;\r\n        }\r\n        case 'singleclick':\r\n        case 'click': {\r\n          // Prevent click when modifying\r\n          return !modifying;\r\n        }\r\n        default: return true;\r\n      }\r\n    }\r\n  });\r\n  // Snap distance (in px)\r\n  this.snapDistance_ = options.pixelTolerance || 10;\r\n  // Split tolerance between the calculated intersection and the geometry\r\n  this.tolerance_ = 1e-10;\r\n  // Cursor\r\n  this.cursor_ = options.cursor;\r\n  // List of source to split\r\n  this.sources_ = options.sources ? (options.sources instanceof Array) ? options.sources:[options.sources] : [];\r\n  if (options.source) this.sources_.push (options.source);\r\n  if (options.features) this.sources_.push (new ol.source.Vector({ features: options.features }));\r\n  // Get all features candidate\r\n  this.filterSplit_ = options.filter || function(){ return true; };\r\n  this._condition = options.condition || ol.events.condition.primaryAction;\r\n  this._deleteCondition = options.deleteCondition || ol.events.condition.altKeyOnly;\r\n  this._insertVertexCondition = options.insertVertexCondition || ol.events.condition.always;\r\n  // Default style\r\n  var sketchStyle = function() {\r\n    return [ new ol.style.Style({\r\n        image: new ol.style.Circle({\r\n          radius: 6,\r\n          fill: new ol.style.Fill({ color: [0, 153, 255, 1] }),\r\n          stroke: new ol.style.Stroke({ color: '#FFF', width: 1.25 })\r\n        })\r\n      })\r\n    ];\r\n  }\r\n  // Custom style\r\n  if (options.style) {\r\n    if (typeof(options.style) === 'function') {\r\n      sketchStyle = options.style\r\n     } else {\r\n       sketchStyle = function() { return options.style; }\r\n     }\r\n  }\r\n  // Create a new overlay for the sketch\r\n  this.overlayLayer_ = new ol.layer.Vector({\r\n    source: new ol.source.Vector({\r\n      useSpatialIndex: false\r\n    }),\r\n    name:'Modify overlay',\r\n    displayInLayerSwitcher: false,\r\n    style: sketchStyle,\r\n    wrapX: options.wrapX\r\n  });\r\n};\r\nol.ext.inherits(ol.interaction.ModifyFeature, ol.interaction.Pointer);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.ModifyFeature.prototype.setMap = function(map) {\r\n  if (this.getMap()) this.getMap().removeLayer(this.overlayLayer_);\r\n  ol.interaction.Interaction.prototype.setMap.call (this, map);\r\n  this.overlayLayer_.setMap(map);\r\n};\r\n/**\r\n * Activate or deactivate the interaction + remove the sketch.\r\n * @param {boolean} active.\r\n * @api stable\r\n */\r\nol.interaction.ModifyFeature.prototype.setActive = function(active) {\r\n  ol.interaction.Interaction.prototype.setActive.call (this, active);\r\n  if (this.overlayLayer_) this.overlayLayer_.getSource().clear();\r\n};\r\n/** Get closest feature at pixel\r\n * @param {ol.Pixel} \r\n * @return {*} \r\n * @private\r\n */\r\nol.interaction.ModifyFeature.prototype.getClosestFeature = function(e) {\r\n  var f, c, d = this.snapDistance_+1;\r\n  for (var i=0; i<this.sources_.length; i++) {\r\n    var source = this.sources_[i];\r\n    f = source.getClosestFeatureToCoordinate(e.coordinate);\r\n    if (f && this.filterSplit_(f)) {\r\n      var ci = f.getGeometry().getClosestPoint(e.coordinate);\r\n      var di = ol.coordinate.dist2d(e.coordinate,ci) / e.frameState.viewState.resolution;\r\n      if (di < d){\r\n        d = di;\r\n        c = ci;\r\n      }\r\n      break;\r\n    }\r\n  }\r\n  if (d > this.snapDistance_) {\r\n    if (this.currentFeature) this.dispatchEvent({ type: 'select', selected: [], deselected: [this.currentFeature] })\r\n    this.currentFeature = null;\r\n    return false;\r\n  } else {\r\n    // Snap to node\r\n    var coord = this.getNearestCoord (c, f.getGeometry());\r\n    if (coord) {\r\n      coord = coord.coord;\r\n      var p = this.getMap().getPixelFromCoordinate(coord);\r\n      if (ol.coordinate.dist2d(e.pixel, p) < this.snapDistance_) {\r\n        c = coord;\r\n      }\r\n      //\r\n      if (this.currentFeature !== f) this.dispatchEvent({ type: 'select', selected: [f], deselected: [this.currentFeature] })\r\n      this.currentFeature = f;\r\n      return { source:source, feature:f, coord: c };\r\n    }\r\n  }\r\n}\r\n/** Get nearest coordinate in a list \r\n* @param {ol.coordinate} pt the point to find nearest\r\n* @param {ol.geom} coords list of coordinates\r\n* @return {*} the nearest point with a coord (projected point), dist (distance to the geom), ring (if Polygon)\r\n*/\r\nol.interaction.ModifyFeature.prototype.getNearestCoord = function(pt, geom) {\r\n  var i, l, p, p0, dm;\r\n  switch (geom.getType()) {\r\n    case 'Point': {\r\n      return { coord: geom.getCoordinates(), dist: ol.coordinate.dist2d(geom.getCoordinates(), pt) };\r\n    }\r\n    case 'MultiPoint': {\r\n      return this.getNearestCoord (pt, new ol.geom.LineString(geom.getCoordinates()));\r\n    }\r\n    case 'LineString':\r\n    case 'LinearRing': {\r\n      var d;\r\n      dm = Number.MAX_VALUE;\r\n      var coords = geom.getCoordinates();\r\n      for (i=0; i < coords.length; i++) {\r\n        d = ol.coordinate.dist2d (pt, coords[i]);\r\n        if (d < dm) {\r\n          dm = d;\r\n          p0 = coords[i];\r\n        }\r\n      }\r\n      return { coord: p0, dist: dm };\r\n    }\r\n    case 'MultiLineString': {\r\n      var lstring = geom.getLineStrings();\r\n      p0 = false, dm = Number.MAX_VALUE;\r\n      for (i=0; l=lstring[i]; i++) {\r\n        p = this.getNearestCoord(pt, l);\r\n        if (p && p.dist<dm) {\r\n          p0 = p;\r\n          dm = p.dist;\r\n          p0.ring = i;\r\n        }\r\n      }\r\n      return p0;\r\n    }\r\n    case 'Polygon': {\r\n      var lring = geom.getLinearRings();\r\n      p0 = false;\r\n      dm = Number.MAX_VALUE;\r\n      for (i=0; l=lring[i]; i++) {\r\n        p = this.getNearestCoord(pt, l);\r\n        if (p && p.dist<dm) {\r\n          p0 = p;\r\n          dm = p.dist;\r\n          p0.ring = i;\r\n        }\r\n      }\r\n      return p0;\r\n    }\r\n    case 'MultiPolygon': {\r\n      var poly = geom.getPolygons();\r\n      p0 = false;\r\n      dm = Number.MAX_VALUE;\r\n      for (i=0; l=poly[i]; i++) {\r\n        p = this.getNearestCoord(pt, l);\r\n        if (p && p.dist<dm) {\r\n          p0 = p;\r\n          dm = p.dist;\r\n          p0.poly = i;\r\n        }\r\n      }\r\n      return p0;\r\n    }\r\n    case 'GeometryCollection': {\r\n      var g = geom.getGeometries();\r\n      p0 = false;\r\n      dm = Number.MAX_VALUE;\r\n      for (i=0; l=g[i]; i++) {\r\n        p = this.getNearestCoord(pt, l);\r\n        if (p && p.dist<dm) {\r\n          p0 = p;\r\n          dm = p.dist;\r\n          p0.geom = i;\r\n        }\r\n      }\r\n      return p0;\r\n    }\r\n    default: return false;\r\n  }\r\n};\r\n/** Get arcs concerned by a modification \r\n * @param {ol.geom} geom the geometry concerned\r\n * @param {ol.coordinate} coord pointed coordinates\r\n */\r\nol.interaction.ModifyFeature.prototype.getArcs = function(geom, coord) {\r\n  var arcs = false;\r\n  var coords, i, s, l, g;\r\n  switch(geom.getType()) {\r\n    case 'Point': {\r\n      if (ol.coordinate.equal(coord, geom.getCoordinates())) {\r\n        arcs = { \r\n          geom: geom, \r\n          type: geom.getType(),\r\n          coord1: [],\r\n          coord2: [],\r\n          node: true\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'MultiPoint': {\r\n      coords = geom.getCoordinates();\r\n      for (i=0; i < coords.length; i++) {\r\n        if (ol.coordinate.equal(coord, coords[i])) {\r\n          arcs = { \r\n            geom: geom, \r\n            type: geom.getType(),\r\n            index: i,\r\n            coord1: [],\r\n            coord2: [],\r\n            node: true\r\n          }\r\n          break;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'LinearRing': \r\n    case 'LineString': {\r\n      var p = geom.getClosestPoint(coord);\r\n      if (ol.coordinate.dist2d(p,coord) < 1.5*this.tolerance_) {\r\n        var split;\r\n        // Split the line in two\r\n        if (geom.getType() === 'LinearRing') {\r\n          g = new ol.geom.LineString(geom.getCoordinates());\r\n          split = g.splitAt(coord, this.tolerance_);\r\n        } else {\r\n          split = geom.splitAt(coord, this.tolerance_);\r\n        }\r\n        // If more than 2\r\n        if (split.length>2) {\r\n          coords = split[1].getCoordinates();\r\n          for (i=2; s=split[i]; i++) {\r\n            var c = s.getCoordinates();\r\n            c.shift();\r\n            coords = coords.concat(c);\r\n          }\r\n          split = [ split[0], new ol.geom.LineString(coords) ];\r\n        }\r\n        // Split in two\r\n        if (split.length === 2) {\r\n          var c0 = split[0].getCoordinates();\r\n          var c1 = split[1].getCoordinates();\r\n          var nbpt = c0.length + c1.length -1;\r\n          c0.pop();\r\n          c1.shift();\r\n          arcs = { \r\n            geom: geom, \r\n            type: geom.getType(),\r\n            coord1: c0, \r\n            coord2: c1,\r\n            node: (geom.getCoordinates().length === nbpt),\r\n            closed: false\r\n          }\r\n        } else if (split.length === 1) {\r\n          s = split[0].getCoordinates();\r\n          var start = ol.coordinate.equal(s[0], coord);\r\n          var end = ol.coordinate.equal(s[s.length-1], coord);\r\n          // Move first point\r\n          if (start) {\r\n            s.shift();\r\n            if (end) s.pop();\r\n            arcs = { \r\n              geom: geom, \r\n              type: geom.getType(),\r\n              coord1: [], \r\n              coord2: s,\r\n              node: true,\r\n              closed: end\r\n            }\r\n          } else if (end) {\r\n            // Move last point\r\n            s.pop()\r\n            arcs = { \r\n              geom: geom, \r\n              type: geom.getType(),\r\n              coord1: s, \r\n              coord2: [],\r\n              node: true,\r\n              closed: false\r\n            }\r\n          }\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'MultiLineString': {\r\n      var lstring = geom.getLineStrings();\r\n      for (i=0; l=lstring[i]; i++) {\r\n        arcs = this.getArcs(l, coord);\r\n        if (arcs) {\r\n          arcs.geom = geom;\r\n          arcs.type = geom.getType();\r\n          arcs.lstring = i;\r\n          break;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'Polygon': {\r\n      var lring = geom.getLinearRings();\r\n      for (i=0; l=lring[i]; i++) {\r\n        arcs = this.getArcs(l, coord);\r\n        if (arcs) {\r\n          arcs.geom = geom;\r\n          arcs.type = geom.getType();\r\n          arcs.index = i;\r\n          break;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'MultiPolygon': {\r\n      var poly = geom.getPolygons();\r\n      for (i=0; l=poly[i]; i++) {\r\n        arcs = this.getArcs(l, coord);\r\n        if (arcs) {\r\n          arcs.geom = geom;\r\n          arcs.type = geom.getType();\r\n          arcs.poly = i;\r\n          break;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'GeometryCollection': {\r\n      g = geom.getGeometries();\r\n      for (i=0; l=g[i]; i++) {\r\n        arcs = this.getArcs(l, coord);\r\n        if (arcs) {\r\n          arcs.geom = geom;\r\n          arcs.g = i;\r\n          arcs.typeg = arcs.type;\r\n          arcs.type = geom.getType();\r\n          break;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      console.error('ol/interaction/ModifyFeature '+geom.getType()+' not supported!');\r\n      break;\r\n    }\r\n  }\r\n  return arcs;\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} evt Map browser event.\r\n * @return {boolean} `true` to start the drag sequence.\r\n */\r\nol.interaction.ModifyFeature.prototype.handleDownEvent = function(evt) {\r\n  if (!this.getActive()) return false;\r\n  // Something to move ?\r\n  var current = this.getClosestFeature(evt);\r\n  if (current && (this._condition(evt) || this._deleteCondition(evt))) {\r\n    var features = [];\r\n    this.arcs = [];\r\n    // Get features concerned\r\n    this.sources_.forEach(function(s) {\r\n      var extent = ol.extent.buffer (ol.extent.boundingExtent([current.coord]), this.tolerance_);\r\n      features = features.concat(features, s.getFeaturesInExtent(extent));\r\n    }.bind(this));\r\n    // Get arcs concerned\r\n    this._modifiedFeatures = [];\r\n    features.forEach(function(f) {\r\n      var a = this.getArcs(f.getGeometry(), current.coord);\r\n      if (a) {\r\n        if (this._insertVertexCondition(evt) || a.node) {\r\n          a.feature = f;\r\n          this._modifiedFeatures.push(f);\r\n          this.arcs.push(a);\r\n        }\r\n      }\r\n    }.bind(this));\r\n    if (this._modifiedFeatures.length) {\r\n      if (this._deleteCondition(evt)) {\r\n        return !this._removePoint(current, evt); \r\n      } else {\r\n        this.dispatchEvent({ \r\n          type:'modifystart', \r\n          coordinate: current.coord,\r\n          originalEvent: evt.originalEvent,\r\n          features: this._modifiedFeatures\r\n        });\r\n        this.handleDragEvent({ \r\n          coordinate: current.coord,\r\n          originalEvent: evt.originalEvent\r\n        })\r\n        return true;\r\n      }\r\n    } else {\r\n      return true;\r\n    }\r\n  } else {\r\n    return false;\r\n  }\r\n};\r\n/** Get modified features\r\n * @return {Array<ol.Feature>} list of modified features\r\n */\r\nol.interaction.ModifyFeature.prototype.getModifiedFeatures = function() {\r\n  return this._modifiedFeatures || [];\r\n};\r\n/** Removes the vertex currently being pointed.\r\n */\r\nol.interaction.ModifyFeature.prototype.removePoint = function() {\r\n  this._removePoint({},{});\r\n};\r\n/**\r\n * @private\r\n */\r\nol.interaction.ModifyFeature.prototype._getModification = function(a) {\r\n  var coords = a.coord1.concat(a.coord2);\r\n  switch (a.type) {\r\n    case 'LineString': {\r\n      if (a.closed) coords.push(coords[0]);\r\n      if (coords.length>1) {\r\n        if (a.geom.getCoordinates().length != coords.length) {\r\n          a.coords = coords;\r\n          return true;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'MultiLineString': {\r\n      if (a.closed) coords.push(coords[0]);\r\n      if (coords.length>1) {\r\n        var c = a.geom.getCoordinates();\r\n        if (c[a.lstring].length != coords.length) {\r\n          c[a.lstring] = coords;\r\n          a.coords = c;\r\n          return true;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'Polygon': {\r\n      if (a.closed) coords.push(coords[0]);\r\n      if (coords.length>3) {\r\n        c = a.geom.getCoordinates();\r\n        if (c[a.index].length != coords.length) {\r\n          c[a.index] = coords;\r\n          a.coords = c;\r\n          return true;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'MultiPolygon': {\r\n      if (a.closed) coords.push(coords[0]);\r\n      if (coords.length>3) {\r\n        c = a.geom.getCoordinates();\r\n        if (c[a.poly][a.index].length != coords.length) {\r\n          c[a.poly][a.index] = coords;\r\n          a.coords = c;\r\n          return true;\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'GeometryCollection': {\r\n      a.type = a.typeg;\r\n      var geom = a.geom;\r\n      var geoms = geom.getGeometries();\r\n      a.geom = geoms[a.g];\r\n      var found = this._getModification(a);\r\n      // Restore current arc\r\n      geom.setGeometries(geoms);\r\n      a.geom = geom;\r\n      a.type = 'GeometryCollection';\r\n      return found;\r\n    }\r\n    default: {\r\n      //console.error('ol/interaction/ModifyFeature '+a.type+' not supported!');\r\n      break;\r\n    }\r\n  }\r\n  return false;\r\n};\r\n/** Removes the vertex currently being pointed.\r\n * @private\r\n */\r\nol.interaction.ModifyFeature.prototype._removePoint = function(current, evt) {\r\n  if (!this.arcs) return false;\r\n  this.overlayLayer_.getSource().clear();\r\n  var found = false;\r\n  // Get all modifications\r\n  this.arcs.forEach(function(a) {\r\n    found = found || this._getModification(a);\r\n  }.bind(this));\r\n  // Almost one point is removed\r\n  if (found) {\r\n    this.dispatchEvent({ \r\n      type:'modifystart', \r\n      coordinate: current.coord,\r\n      originalEvent: evt.originalEvent,\r\n      features: this._modifiedFeatures\r\n    });\r\n    this.arcs.forEach(function(a) {\r\n      if (a.geom.getType() === 'GeometryCollection') {\r\n        if (a.coords) {\r\n          var geoms = a.geom.getGeometries();\r\n          geoms[a.g].setCoordinates(a.coords);\r\n          a.geom.setGeometries(geoms);\r\n        }\r\n      } else {\r\n        if (a.coords) a.geom.setCoordinates(a.coords);\r\n      }\r\n    }.bind(this));\r\n    this.dispatchEvent({ \r\n      type:'modifyend', \r\n      coordinate: current.coord,\r\n      originalEvent: evt.originalEvent,\r\n      features: this._modifiedFeatures\r\n    });\r\n  }\r\n  this.arcs = [];\r\n  return found;\r\n};\r\n/**\r\n * @private\r\n */\r\nol.interaction.ModifyFeature.prototype.handleUpEvent = function(e) {\r\n  if (!this.getActive()) return false;\r\n  if (!this.arcs || !this.arcs.length) return true;\r\n  this.overlayLayer_.getSource().clear();\r\n  this.dispatchEvent({ \r\n    type:'modifyend', \r\n    coordinate: e.coordinate,\r\n    originalEvent: e.originalEvent,\r\n    features: this._modifiedFeatures\r\n  });\r\n  this.arcs = [];\r\n  return true;\r\n};\r\n/**\r\n * @private\r\n */\r\nol.interaction.ModifyFeature.prototype.setArcCoordinates = function(a, coords) {\r\n  var c;\r\n  switch (a.type) {\r\n    case 'Point': {\r\n      a.geom.setCoordinates(coords[0]);\r\n      break;\r\n    }\r\n    case 'MultiPoint': {\r\n      c = a.geom.getCoordinates();\r\n      c[a.index] = coords[0];\r\n      a.geom.setCoordinates(c);\r\n      break;\r\n    }\r\n    case 'LineString': {\r\n      a.geom.setCoordinates(coords);\r\n      break;\r\n    }\r\n    case 'MultiLineString': {\r\n      c = a.geom.getCoordinates();\r\n      c[a.lstring] = coords;\r\n      a.geom.setCoordinates(c);\r\n      break;\r\n    }\r\n    case 'Polygon': {\r\n      c = a.geom.getCoordinates();\r\n      c[a.index] = coords;\r\n      a.geom.setCoordinates(c);\r\n      break;\r\n    }\r\n    case 'MultiPolygon': {\r\n      c = a.geom.getCoordinates();\r\n      c[a.poly][a.index] = coords;\r\n      a.geom.setCoordinates(c);\r\n      break;\r\n    }\r\n    case 'GeometryCollection': {\r\n      a.type = a.typeg;\r\n      var geom = a.geom;\r\n      var geoms = geom.getGeometries();\r\n      a.geom = geoms[a.g];\r\n      this.setArcCoordinates(a, coords);\r\n      geom.setGeometries(geoms);\r\n      a.geom = geom;\r\n      a.type = 'GeometryCollection';\r\n      break;\r\n    }\r\n  }\r\n};\r\n/**\r\n * @private\r\n */\r\nol.interaction.ModifyFeature.prototype.handleDragEvent = function(e) {\r\n  if (!this.getActive()) return false;\r\n  if (!this.arcs) return true;\r\n  // Show sketch\r\n  this.overlayLayer_.getSource().clear();\r\n  var p = new ol.Feature(new ol.geom.Point(e.coordinate));\r\n  this.overlayLayer_.getSource().addFeature(p);\r\n  // Nothing to do\r\n  if (!this.arcs.length) return true;\r\n  // Move arcs\r\n  this.arcs.forEach(function(a) {\r\n    var coords = a.coord1.concat([e.coordinate], a.coord2);\r\n    if (a.closed) coords.push(e.coordinate);\r\n    this.setArcCoordinates(a, coords);\r\n  }.bind(this));\r\n  this.dispatchEvent({ \r\n    type:'modifying', \r\n    coordinate: e.coordinate,\r\n    originalEvent: e.originalEvent,\r\n    features: this._modifiedFeatures\r\n  });\r\n  return true;\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} evt Event.\r\n * @private\r\n */\r\nol.interaction.ModifyFeature.prototype.handleMoveEvent = function(e) {\r\n  if (!this.getActive()) return false;\r\n  this.overlayLayer_.getSource().clear();\r\n  var current = this.getClosestFeature(e);\r\n  // Draw sketch\r\n  if (current) {\r\n    var p = new ol.Feature(new ol.geom.Point(current.coord));\r\n    this.overlayLayer_.getSource().addFeature(p);\r\n  }\r\n  // Show cursor\r\n  var element = e.map.getTargetElement();\r\n  if (this.cursor_) {\r\n    if (current) {\r\n      if (element.style.cursor != this.cursor_) {\r\n        this.previousCursor_ = element.style.cursor;\r\n        element.style.cursor = this.cursor_;\r\n      }\r\n    } else if (this.previousCursor_ !== undefined) {\r\n      element.style.cursor = this.previousCursor_;\r\n      this.previousCursor_ = undefined;\r\n    }\r\n  }\r\n};\r\n/** Get the current feature to modify\r\n * @return {ol.Feature} \r\n */\r\nol.interaction.ModifyFeature.prototype.getCurrentFeature = function() {\r\n  return this.currentFeature;\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Modify interaction with a popup to delet a point on touch device\r\n * @constructor\r\n * @fires showpopup\r\n * @fires hidepopup\r\n * @extends {ol.interaction.Modify}\r\n * @param {olx.interaction.ModifyOptions} options\r\n * @param {String|undefined} options.title title to display, default \"remove point\"\r\n * @param {String|undefined} options.className CSS class name for the popup\r\n * @param {String|undefined} options.positioning positioning for the popup\r\n * @param {Number|Array<number>|undefined} options.offsetBox offset box for the popup\r\n * @param {Boolean|undefined} options.usePopup use a popup, default true\r\n */\r\nol.interaction.ModifyTouch = function(options) {\r\n  var self = this;\r\n  if (!options) options = {};\r\n  this._popup = new ol.Overlay.Popup ({\r\n    popupClass: options.className || 'modifytouch',\r\n    positioning: options.positioning || 'bottom-rigth',\r\n    offsetBox: options.offsetBox || 10\r\n  });\r\n  this._source = options.source;\r\n  this._features = options.features;\r\n  // popup content\r\n  var a = document.createElement('a');\r\n  a.appendChild(document.createTextNode(options.title || \"remove point\"));\r\n  a.onclick = function() {\r\n    self.removePoint();\r\n  };\r\n  this.setPopupContent(a);\r\n  var pixelTolerance = options.pixelTolerance || 0;\r\n  var searchDist = pixelTolerance +5;\r\n  // Check if there is a feature to select\r\n  options.condition = function(e) {\r\n    var features = this.getMap().getFeaturesAtPixel(e.pixel,{\r\n      hitTolerance: searchDist\r\n    });\r\n    var p0, p1, found = false;\r\n\t\tif (features) {\r\n      var search = this._features;\r\n      if (!search) {\r\n        p0 = [e.pixel[0] - searchDist, e.pixel[1] - searchDist]\r\n        p1 = [e.pixel[0] + searchDist, e.pixel[1] + searchDist]\r\n        p0 = this.getMap().getCoordinateFromPixel(p0);\r\n        p1 = this.getMap().getCoordinateFromPixel(p1);\r\n        var ext = ol.extent.boundingExtent([p0,p1]);\r\n        search = this._source.getFeaturesInExtent(ext);\r\n      } \r\n      if (search.getArray) search = search.getArray();\r\n      for (var i=0, f; f=features[i]; i++) {\r\n        if (search.indexOf(f) >= 0) break;\r\n      }\r\n      if (f) {\r\n        p0 = e.pixel;\r\n        p1 = f.getGeometry().getClosestPoint(e.coordinate);\r\n        p1 = this.getMap().getPixelFromCoordinate(p1);\r\n        var dx = p0[0] - p1[0];\r\n        var dy = p0[1] - p1[1];\r\n        found = (Math.sqrt(dx*dx+dy*dy) < searchDist);\r\n      }\r\n    }\r\n    // Show popup if any\r\n    this.showDeleteBt(found ? { type:'show', feature:f, coordinate: e.coordinate } : { type:'hide' });\r\n    return true;\r\n  };\r\n  // Hide popup on insert\r\n\toptions.insertVertexCondition = function() {\r\n\t\tthis.showDeleteBt({ type:'hide' });\r\n\t\treturn true;\r\n  }\r\n  ol.interaction.Modify.call(this, options);\r\n  this.on(['modifystart','modifyend'], function(){\r\n\t\tthis.showDeleteBt({ type:'hide', modifying: true });\r\n  });\r\n  // Use a popup ?\r\n  this.set('usePopup', options.usePopup !== false);\r\n};\r\nol.ext.inherits(ol.interaction.ModifyTouch, ol.interaction.Modify);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.ModifyTouch.prototype.setMap = function(map) {\t\r\n  if (this.getMap()) {\r\n    this.getMap().removeOverlay(this._popup);\r\n  }\r\n\tol.interaction.Modify.prototype.setMap.call (this, map);\r\n  if (this.getMap()) {\r\n    this.getMap().addOverlay(this._popup);\r\n  }\r\n};\r\n/** Activate the interaction and remove popup\r\n * @param {Boolean} b\r\n */\r\nol.interaction.ModifyTouch.prototype.setActive = function(b) {\t\r\n  ol.interaction.Modify.prototype.setActive.call (this, b);\r\n  this.showDeleteBt({ type:'hide' });\r\n};\r\n/**\r\n * Remove the current point\r\n */\r\nol.interaction.ModifyTouch.prototype.removePoint = function() {\t\r\n  // Prevent touch + click on popup \r\n  if (new Date() - this._timeout < 200) return;\r\n  // Remove point\r\n  ol.interaction.Modify.prototype.removePoint.call (this);\r\n  this.showDeleteBt({ type:'hide' });\r\n}\r\n/**\r\n * Show the delete button (menu)\r\n * @param {Event} e\r\n * @api stable\r\n */\r\nol.interaction.ModifyTouch.prototype.showDeleteBt = function(e) {\r\n  if (this.get('usePopup') && e.type==='show') {\r\n    this._popup.show(e.coordinate, this._menu);\r\n  } else {\r\n    this._popup.hide();\r\n  }\r\n  e.type += 'popup';\r\n  this.dispatchEvent(e);\r\n  // Date if popup start a timeout to prevent touch + click on the popup\r\n  this._timeout = new Date();\r\n};\r\n/**\r\n * Change the popup content\r\n * @param {DOMElement} html \r\n */\r\nol.interaction.ModifyTouch.prototype.setPopupContent = function(html) {\r\n  this._menu = html;\r\n}\r\n/**\r\n * Get the popup content\r\n * @return {DOMElement}\r\n */\r\nol.interaction.ModifyTouch.prototype.getPopupContent = function() {\r\n  return this._menu;\r\n}\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Offset interaction for offseting feature geometry\r\n * @constructor\r\n * @extends {ol.interaction.Pointer}\r\n * @fires offsetstart\r\n * @fires offsetting\r\n * @fires offsetend\r\n * @param {any} options\r\n *\t@param {ol.layer.Vector | Array<ol.layer.Vector>} options.layers list of feature to transform \r\n *\t@param {ol.Collection.<ol.Feature>} options.features collection of feature to transform\r\n *\t@param {ol.source.Vector | undefined} options.source source to duplicate feature when ctrl key is down\r\n *\t@param {boolean} options.duplicate force feature to duplicate (source must be set)\r\n *  @param {ol.style.Style | Array.<ol.style.Style> | ol.style.StyleFunction | undefined} style style for the sketch\r\n */\r\nol.interaction.Offset = function(options) {\r\n  if (!options) options = {};\r\n\t// Extend pointer\r\n\tol.interaction.Pointer.call(this, {\r\n    handleDownEvent: this.handleDownEvent_,\r\n    handleDragEvent: this.handleDragEvent_,\r\n    handleMoveEvent: this.handleMoveEvent_,\r\n    handleUpEvent: this.handleUpEvent_\r\n  });\r\n\t// Collection of feature to transform\r\n\tthis.features_ = options.features;\r\n\t// List of layers to transform\r\n  this.layers_ = options.layers ? (options.layers instanceof Array) ? options.layers:[options.layers] : null;\r\n  // duplicate\r\n  this.set('duplicate', options.duplicate);\r\n  this.source_ = options.source;\r\n  // Style\r\n  this._style = (typeof (options.style) === 'function') ? options.style : function () { \r\n    if (options.style) return options.style;\r\n    else return ol.style.Style.defaultStyle(true);\r\n  };\r\n  // init\r\n  this.previousCursor_ = false;\r\n};\r\nol.ext.inherits(ol.interaction.Offset, ol.interaction.Pointer);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.Offset.prototype.setMap = function(map) {\r\n\tol.interaction.Pointer.prototype.setMap.call (this, map);\r\n};\r\n/** Get Feature at pixel\r\n * @param {ol.MapBrowserEvent} evt Map browser event.\r\n * @return {any} a feature and the hit point\r\n * @private\r\n */\r\nol.interaction.Offset.prototype.getFeatureAtPixel_ = function(e) {\r\n  var self = this;\r\n\treturn this.getMap().forEachFeatureAtPixel(e.pixel,\r\n\t\tfunction(feature, layer) {\r\n      var current;\r\n\t\t\t// feature belong to a layer\r\n\t\t\tif (self.layers_) {\r\n        for (var i=0; i<self.layers_.length; i++) {\r\n          if (self.layers_[i]===layer) {\r\n            current = feature;\r\n            break;\r\n          }\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// feature in the collection\r\n\t\t\telse if (self.features_) {\r\n        self.features_.forEach (function(f) {\r\n          if (f===feature) {\r\n            current = feature \r\n          }\r\n        });\r\n\t\t\t}\r\n\t\t\t// Others\r\n\t\t\telse {\r\n        current = feature;\r\n      }\r\n      // Only poygon or linestring\r\n      var typeGeom = current.getGeometry().getType();\r\n      if (current && /Polygon|LineString/.test(typeGeom)) {\r\n        if (typeGeom==='Polygon' && current.getGeometry().getCoordinates().length>1) return false;\r\n        // test distance\r\n        var p = current.getGeometry().getClosestPoint(e.coordinate);\r\n        var dx = p[0]-e.coordinate[0];\r\n        var dy = p[1]-e.coordinate[1];\r\n        var d = Math.sqrt(dx*dx+dy*dy) / e.frameState.viewState.resolution;\r\n        if (d<5) {\r\n          return { \r\n            feature: current, \r\n            hit: p, \r\n            coordinates: current.getGeometry().getCoordinates(),\r\n            geom: current.getGeometry().clone(),\r\n            geomType: typeGeom\r\n          }\r\n        } else {\r\n          return false;\r\n        }\r\n      } else {\r\n        return false;\r\n      }\r\n\t\t},  { hitTolerance: 5 });\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} e Map browser event.\r\n * @return {boolean} `true` to start the drag sequence.\r\n * @private\r\n */\r\nol.interaction.Offset.prototype.handleDownEvent_ = function(e) {\t\r\n  this.current_ = this.getFeatureAtPixel_(e);\r\n  if (this.current_) {\r\n    this.currentStyle_ = this.current_.feature.getStyle();\r\n    if (this.source_ && (this.get('duplicate') || e.originalEvent.ctrlKey)) {\r\n      this.current_.feature = this.current_.feature.clone();\r\n      this.current_.feature.setStyle(this._style(this.current_.feature));\r\n      this.source_.addFeature(this.current_.feature);\r\n    } else {\r\n      // Modify the current feature\r\n      this.current_.feature.setStyle(this._style(this.current_.feature));\r\n      this._modifystart = true;\r\n    }\r\n    this.dispatchEvent({ type:'offsetstart', feature: this.current_.feature, offset: 0 });\r\n    return true;\r\n  } else  {\r\n    return false;\r\n  }\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} e Map browser event.\r\n * @private\r\n */\r\nol.interaction.Offset.prototype.handleDragEvent_ = function(e) {\r\n  if (this._modifystart) {\r\n    this.dispatchEvent({ type:'modifystart', features: [ this.current_.feature ] });\r\n    this._modifystart = false;\r\n  }\r\n  var p = this.current_.geom.getClosestPoint(e.coordinate);\r\n  var d = ol.coordinate.dist2d(p, e.coordinate);\r\n  var seg, v1, v2, offset;\r\n  switch (this.current_.geomType) {\r\n    case  'Polygon': {\r\n      seg = ol.coordinate.findSegment(p, this.current_.coordinates[0]).segment;\r\n      if (seg) {\r\n        v1 = [ seg[1][0]-seg[0][0], seg[1][1]-seg[0][1] ];\r\n        v2 = [ e.coordinate[0]-p[0], e.coordinate[1]-p[1] ];\r\n        if (v1[0]*v2[1] - v1[1]*v2[0] > 0) {\r\n          d = -d;\r\n        }\r\n        offset = [];\r\n        for (var i=0; i<this.current_.coordinates.length; i++) {\r\n          offset.push( ol.coordinate.offsetCoords(this.current_.coordinates[i], i==0 ? d : -d) );\r\n        }\r\n        this.current_.feature.setGeometry(new ol.geom.Polygon(offset));\r\n      }\r\n      break;\r\n    }\r\n    case 'LineString': {\r\n      seg = ol.coordinate.findSegment(p, this.current_.coordinates).segment;\r\n      if (seg) {\r\n        v1 = [ seg[1][0]-seg[0][0], seg[1][1]-seg[0][1] ];\r\n        v2 = [ e.coordinate[0]-p[0], e.coordinate[1]-p[1] ];\r\n        if (v1[0]*v2[1] - v1[1]*v2[0] > 0) {\r\n          d = -d;\r\n        }\r\n        offset = ol.coordinate.offsetCoords(this.current_.coordinates, d);\r\n        this.current_.feature.setGeometry(new ol.geom.LineString(offset));\r\n      }\r\n      break;\r\n    }\r\n    default: {\r\n      break;\r\n    }\r\n  }\r\n  this.dispatchEvent({ type:'offsetting', feature: this.current_.feature, offset: d, segment: [p, e.coordinate], coordinate: e.coordinate });  \r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} e Map browser event.\r\n * @private\r\n */\r\nol.interaction.Offset.prototype.handleUpEvent_ = function(e) {\r\n  if (!this._modifystart) {\r\n    this.dispatchEvent({ type:'offsetend', feature: this.current_.feature, coordinate: e.coordinate }); \r\n  }\r\n  this.current_.feature.setStyle(this.currentStyle_);\r\n  this.current_ = false;\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} e Event.\r\n * @private\r\n */\r\nol.interaction.Offset.prototype.handleMoveEvent_ = function(e) {\t\r\n  var f = this.getFeatureAtPixel_(e);\r\n  if (f) {\r\n    if (this.previousCursor_ === false) {\r\n      this.previousCursor_ = e.map.getTargetElement().style.cursor;\r\n    }\r\n    e.map.getTargetElement().style.cursor = 'pointer';\r\n  } else {\r\n    e.map.getTargetElement().style.cursor = this.previousCursor_;\r\n    this.previousCursor_ = false;\r\n  }\r\n};\r\n\r\n/*\t\r\n  Water ripple effect.\r\n  Original code (Java) by Neil Wallis \r\n  @link http://www.neilwallis.com/java/water.html\r\n  Original code (JS) by Sergey Chikuyonok (serge.che@gmail.com)\r\n  @link http://chikuyonok.ru\r\n  @link http://media.chikuyonok.ru/ripple/\r\n  Copyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n  @link https://github.com/Viglino\r\n*/\r\n/**\r\n * @constructor\r\n * @extends {ol.interaction.Pointer}\r\n * @param {*} options\r\n *  @param {ol/layer/Layer} options.layer layer to animate\r\n *  @param {number} options.radius raindrop radius\r\n *  @param {number} options.interval raindrop interval (in ms), default 1000\r\n */\r\nol.interaction.Ripple = function(options) {\r\n  ol.interaction.Pointer.call(this, {\r\n    handleDownEvent: this.rainDrop,\r\n    handleMoveEvent: this.rainDrop\r\n  });\r\n  // Default options\r\n  options = options||{};\r\n  this.riprad = options.radius || 3;\r\n  this.ripplemap = [];\r\n  this.last_map = [];\r\n  // Generate random ripples\r\n  this.rains (this.interval);\r\n  options.layer.on(['postcompose', 'postrender'], this.postcompose_.bind(this));\r\n};\r\nol.ext.inherits(ol.interaction.Ripple, ol.interaction.Pointer);\r\n/** Generate random rain drop\r\n*\t@param {integer} interval\r\n*/\r\nol.interaction.Ripple.prototype.rains = function(interval) {\r\n  if (this.onrain) clearTimeout (this.onrain);\r\n  var self = this;\r\n  var vdelay = (typeof(interval)==\"number\" ? interval : 1000)/2;\r\n  var delay = 3*vdelay/2;\r\n  var rnd = Math.random;\r\n  function rain() {\r\n    if (self.width) self.rainDrop([rnd() * self.width, rnd() * self.height]);\r\n    self.onrain = setTimeout (rain, rnd()*vdelay + delay);\r\n  }\r\n  // Start raining\r\n  if (delay) rain();\r\n}\r\n/** Disturb water at specified point\r\n*\t@param {ol.Pixel|ol.MapBrowserEvent}\r\n*/\r\nol.interaction.Ripple.prototype.rainDrop = function(e) {\r\n  if (!this.width) return;\r\n  var dx,dy;\r\n  if (e.pixel) {\r\n    dx = e.pixel[0]*this.ratio;\r\n    dy = e.pixel[1]*this.ratio;\r\n  } else {\r\n    dx = e[0]*this.ratio;\r\n    dy = e[1]*this.ratio;\r\n  }\r\n  dx <<= 0;\r\n  dy <<= 0;\r\n  for (var j = dy - this.riprad*this.ratio; j < dy + this.riprad*this.ratio; j++) {\r\n    for (var k = dx - this.riprad*this.ratio; k < dx + this.riprad*this.ratio; k++) {\r\n      this.ripplemap[this.oldind + (j * this.width) + k] += 128;\r\n    }\r\n  }\r\n}\r\n/** Postcompose function\r\n*/\r\nol.interaction.Ripple.prototype.postcompose_ = function(e) {\r\n  var ctx = e.context;\r\n  var canvas = ctx.canvas;\r\n  // Initialize when canvas is ready / modified\r\n  if (this.width != canvas.width || this.height != canvas.height) {\r\n    this.width = canvas.width;\r\n    this.height = canvas.height;\r\n    this.ratio = e.frameState.pixelRatio;\r\n    this.half_width = this.width >> 1;\r\n    this.half_height = this.height >> 1;\r\n    this.size = this.width * (this.height + 2) * 2;\r\n    this.oldind = this.width;\r\n    this.newind = this.width * (this.height + 3);\r\n    for (var i = 0; i < this.size; i++) {\r\n      this.last_map[i] = this.ripplemap[i] = 0;\r\n    }\r\n  }\r\n  this.texture = ctx.getImageData(0, 0, this.width, this.height);\r\n  this.ripple = ctx.getImageData(0, 0, this.width, this.height);\t\r\n  // Run animation\r\n  var a, b, data, cur_pixel, new_pixel;\r\n    var t = this.oldind; this.oldind = this.newind; this.newind = t;\r\n    i = 0;\r\n    var _rd = this.ripple.data,\r\n        _td = this.texture.data;\r\n    for (var y = 0; y < this.height; y++) {\r\n      for (var x = 0; x < this.width; x++) {\r\n          var _newind = this.newind + i,\r\n      _mapind = this.oldind + i;\r\n      data = (\r\n          this.ripplemap[_mapind - this.width] + \r\n          this.ripplemap[_mapind + this.width] + \r\n          this.ripplemap[_mapind - 1] + \r\n          this.ripplemap[_mapind + 1]) >> 1;\r\n      data -= this.ripplemap[_newind];\r\n      data -= data >> 5;\r\n      this.ripplemap[_newind] = data;\r\n      //where data=0 then still, where data>0 then wave\r\n      data = 1024 - data;\r\n      if (this.last_map[i] != data) {\r\n        this.last_map[i] = data;\r\n        //offsets\r\n        a = (((x - this.half_width) * data / 1024) << 0) + this.half_width;\r\n        b = (((y - this.half_height) * data / 1024) << 0) + this.half_height;\r\n        //bounds check\r\n        if (a >= this.width) a = this.width - 1;\r\n        if (a < 0) a = 0;\r\n        if (b >= this.height) b = this.height - 1;\r\n        if (b < 0) b = 0;\r\n        new_pixel = (a + (b * this.width)) * 4;\r\n        cur_pixel = i * 4;\r\n        /**/\r\n        _rd[cur_pixel] = _td[new_pixel];\r\n        _rd[cur_pixel + 1] = _td[new_pixel + 1];\r\n        _rd[cur_pixel + 2] = _td[new_pixel + 2];\r\n        /*/\r\n        // only in blue pixels \r\n                if (_td[new_pixel + 2]>_td[new_pixel + 1]\r\n          && _td[new_pixel + 2]>_td[new_pixel])\r\n        {\r\n                _rd[cur_pixel] = _td[new_pixel];\r\n                _rd[cur_pixel + 1] = _td[new_pixel + 1];\r\n                _rd[cur_pixel + 2] = _td[new_pixel + 2];\r\n        }\r\n        else this.ripplemap[_newind] = 0;\r\n        /**/\r\n      }\r\n      ++i;\r\n    }\r\n  }\r\n  ctx.putImageData(this.ripple, 0, 0);\r\n  // tell OL3 to continue postcompose animation\r\n  this.getMap().render(); \r\n};\r\n\r\n/*\r\n  Copyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (http://www.cecill.info/).\r\n  ol/interaction/SelectCluster is an interaction for selecting vector features in a cluster.\r\n*/\r\n/**\r\n * @classdesc\r\n * Interaction for selecting vector features in a cluster. \r\n * It can be used as an ol.interaction.Select. \r\n * When clicking on a cluster, it springs apart to reveal the features in the cluster.\r\n * Revealed features are selectable and you can pick the one you meant.\r\n * Revealed features are themselves a cluster with an attribute features that contain the original feature.\r\n * \r\n * @constructor\r\n * @extends {ol.interaction.Select}\r\n * @param {olx.interaction.SelectOptions=} options SelectOptions.\r\n *  @param {ol.style} options.featureStyle used to style the revealed features as options.style is used by the Select interaction.\r\n * \t@param {boolean} options.selectCluster false if you don't want to get cluster selected\r\n * \t@param {Number} options.pointRadius to calculate distance between the features\r\n * \t@param {bool} options.spiral means you want the feature to be placed on a spiral (or a circle)\r\n * \t@param {Number} options.circleMaxObjects number of object that can be place on a circle\r\n * \t@param {Number} options.maxObjects number of object that can be drawn, other are hidden\r\n * \t@param {bool} options.animate if the cluster will animate when features spread out, default is false\r\n * \t@param {Number} options.animationDuration animation duration in ms, default is 500ms\r\n * \t@param {boolean} options.autoClose if selecting a cluster should close previously selected clusters. False to get toggle feature. Default is true\r\n * @fires ol.interaction.SelectEvent\r\n * @api stable\r\n */\r\nol.interaction.SelectCluster = function(options) {\r\n  options = options || {};\r\n  this.pointRadius = options.pointRadius || 12;\r\n  this.circleMaxObjects = options.circleMaxObjects || 10;\r\n  this.maxObjects = options.maxObjects || 60;\r\n  this.spiral = (options.spiral !== false);\r\n  this.animate = options.animate;\r\n  this.animationDuration = options.animationDuration || 500;\r\n  this.selectCluster_ = (options.selectCluster !== false);\r\n  this._autoClose = (options.autoClose !== false)\r\n  // Create a new overlay layer for \r\n  var overlay = this.overlayLayer_ = new ol.layer.Vector({\r\n    source: new ol.source.Vector({\r\n      features: new ol.Collection(),\r\n      wrapX: options.wrapX,\r\n      useSpatialIndex: true\r\n    }),\r\n    name:'Cluster overlay',\r\n    updateWhileAnimating: true,\r\n    updateWhileInteracting: true,\r\n    displayInLayerSwitcher: false,\r\n    style: options.featureStyle\r\n  });\r\n  // Add the overlay to selection\r\n  if (options.layers) {\r\n    if (typeof(options.layers) == \"function\") {\r\n      var fnLayers = options.layers;\r\n      options.layers = function(layer) {\r\n        return (layer===overlay || fnLayers(layer));\r\n      };\r\n    } else if (options.layers.push) {\r\n      options.layers.push(this.overlayLayer_);\r\n    }\r\n  }\r\n  // Don't select links\r\n  if (options.filter) {\r\n    var fnFilter = options.filter;\r\n    options.filter = function(f,l){\r\n      //if (l===overlay && f.get(\"selectclusterlink\")) return false;\r\n      if (!l && f.get(\"selectclusterlink\")) return false;\r\n      else return fnFilter(f,l);\r\n    };\r\n  } else options.filter = function(f,l) {\r\n    //if (l===overlay && f.get(\"selectclusterlink\")) return false; \r\n    if (!l && f.get(\"selectclusterlink\")) return false; \r\n    else return true;\r\n  };\r\n  this.filter_ = options.filter;\r\n  if (!this._autoClose && !options.toggleCondition) {\r\n    options.toggleCondition = ol.events.condition.singleClick;\r\n  }\r\n  ol.interaction.Select.call(this, options);\r\n  this.on(\"select\", this.selectCluster.bind(this));\r\n};\r\nol.ext.inherits(ol.interaction.SelectCluster, ol.interaction.Select);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.SelectCluster.prototype.setMap = function(map) {\r\n  if (this.getMap()) {\r\n    this.getMap().removeLayer(this.overlayLayer_);\r\n  }\r\n  if (this._listener) ol.Observable.unByKey(this._listener);\r\n  this._listener = null;\r\n  ol.interaction.Select.prototype.setMap.call (this, map);\r\n  this.overlayLayer_.setMap(map);\r\n  // map.addLayer(this.overlayLayer_);\r\n  if (map && map.getView()) {\r\n    this._listener = map.getView().on('change:resolution', this.clear.bind(this));\r\n  }\r\n};\r\n/**\r\n * Clear the selection, close the cluster and remove revealed features\r\n * @api stable\r\n */\r\nol.interaction.SelectCluster.prototype.clear = function() {\r\n  this.getFeatures().clear();\r\n  this.overlayLayer_.getSource().clear();\r\n};\r\n/**\r\n * Get the layer for the revealed features\r\n * @api stable\r\n */\r\nol.interaction.SelectCluster.prototype.getLayer = function() {\r\n  return this.overlayLayer_;\r\n};\r\n/**\r\n * Select a cluster \r\n * @param {ol.SelectEvent | ol.Feature} a cluster feature ie. a feature with a 'features' attribute.\r\n * @api stable\r\n */\r\nol.interaction.SelectCluster.prototype.selectCluster = function (e) {\r\n  // It's a feature => convert to SelectEvent\r\n  if (e instanceof ol.Feature) {\r\n    e = { selected: [e] };\r\n  }\r\n  // Nothing selected\r\n  if (!e.selected.length) {\r\n    if (this._autoClose) {\r\n      this.clear();\r\n    } else {\r\n      var deselectedFeatures = e.deselected;\r\n      deselectedFeatures.forEach(deselectedFeature => {\r\n        var selectClusterFeatures = deselectedFeature.get('selectcluserfeatures');\r\n        selectClusterFeatures.forEach(selectClusterFeature => {\r\n          this.overlayLayer_.getSource().removeFeature(selectClusterFeature);\r\n        });\r\n      });\r\n    }\r\n    return;\r\n  }\r\n  // Get selection\r\n  var feature = e.selected[0];\r\n  // It's one of ours\r\n  if (feature.get('selectclusterfeature')) return;\r\n  // Clic out of the cluster => close it\r\n  var source = this.overlayLayer_.getSource();\r\n  if (this._autoClose) {\r\n    source.clear();\r\n  }\r\n  var cluster = feature.get('features');\r\n  // Not a cluster (or just one feature)\r\n  if (!cluster || cluster.length==1) return;\r\n  // Remove cluster from selection\r\n  if (!this.selectCluster_) this.getFeatures().clear();\r\n  var center = feature.getGeometry().getCoordinates();\r\n  // Pixel size in map unit\r\n  var pix = this.getMap().getView().getResolution();\r\n  var r, a, i, max;\r\n  var p, cf, lk;\r\n  // The features\r\n  var features = [];\r\n  // Draw on a circle\r\n  if (!this.spiral || cluster.length <= this.circleMaxObjects) {\r\n    max = Math.min(cluster.length, this.circleMaxObjects);\r\n    r = pix * this.pointRadius * (0.5 + max / 4);\r\n    for (i=0; i<max; i++) {\r\n      a = 2*Math.PI*i/max;\r\n      if (max==2 || max == 4) a += Math.PI/4;\r\n      p = [ center[0]+r*Math.sin(a), center[1]+r*Math.cos(a) ];\r\n      cf = new ol.Feature({ 'selectclusterfeature':true, 'features':[cluster[i]], geometry: new ol.geom.Point(p) });\r\n      cf.setStyle(cluster[i].getStyle());\r\n      features.push(cf);\r\n      lk = new ol.Feature({ 'selectclusterlink':true, geometry: new ol.geom.LineString([center,p]) });\r\n      features.push(lk);\r\n    }\r\n  }\r\n  // Draw on a spiral\r\n  else {\r\n    // Start angle\r\n    a = 0;\r\n    var d = 2*this.pointRadius;\r\n    max = Math.min (this.maxObjects, cluster.length);\r\n    // Feature on a spiral\r\n    for (i=0; i<max; i++) {\r\n      // New radius => increase d in one turn\r\n      r = d/2 + d*a/(2*Math.PI);\r\n      // Angle\r\n      a = a + (d+0.1)/r;\r\n      var dx = pix*r*Math.sin(a)\r\n      var dy = pix*r*Math.cos(a)\r\n      p = [ center[0]+dx, center[1]+dy ];\r\n      cf = new ol.Feature({ 'selectclusterfeature':true, 'features':[cluster[i]], geometry: new ol.geom.Point(p) });\r\n      cf.setStyle(cluster[i].getStyle()); \r\n      features.push(cf);\r\n      lk = new ol.Feature({ 'selectclusterlink':true, geometry: new ol.geom.LineString([center,p]) });\r\n      features.push(lk);\r\n    }\r\n  }\r\n  feature.set('selectcluserfeatures', features);\r\n  if (this.animate) {\r\n    this.animateCluster_(center, features);\r\n  } else {\r\n    source.addFeatures(features);\r\n  }\r\n};\r\n/**\r\n * Animate the cluster and spread out the features\r\n * @param {ol.Coordinates} the center of the cluster\r\n */\r\nol.interaction.SelectCluster.prototype.animateCluster_ = function(center, features) {\r\n  // Stop animation (if one is running)\r\n  if (this.listenerKey_) {\r\n    ol.Observable.unByKey(this.listenerKey_);\r\n  }\r\n  // Features to animate\r\n  // var features = this.overlayLayer_.getSource().getFeatures();\r\n  if (!features.length) return;\r\n  var style = this.overlayLayer_.getStyle();\r\n  var stylefn = (typeof(style) == 'function') ? style : style.length ? function(){ return style; } : function(){ return [style]; } ;\r\n  var duration = this.animationDuration || 500;\r\n  var start = new Date().getTime();\r\n  // Animate function\r\n  function animate(event) {\r\n    var vectorContext = event.vectorContext || ol.render.getVectorContext(event);\r\n    // Retina device\r\n    var ratio = event.frameState.pixelRatio;\r\n    var res = this.getMap().getView().getResolution();\r\n    var e = ol.easing.easeOut((event.frameState.time - start) / duration);\r\n    for (var i=0, feature; feature = features[i]; i++) if (feature.get('features')) {\r\n      var pt = feature.getGeometry().getCoordinates();\r\n      pt[0] = center[0] + e * (pt[0]-center[0]);\r\n      pt[1] = center[1] + e * (pt[1]-center[1]);\r\n      var geo = new ol.geom.Point(pt);\r\n      // Image style\r\n      var st = stylefn(feature, res);\r\n      for (var s=0; s<st.length; s++) {\r\n        var sc;\r\n        // OL < v4.3 : setImageStyle doesn't check retina\r\n        var imgs = ol.Map.prototype.getFeaturesAtPixel ? false : st[s].getImage();\r\n        if (imgs) {\r\n          sc = imgs.getScale();\r\n          imgs.setScale(ratio); \r\n        }\r\n        // OL3 > v3.14\r\n        if (vectorContext.setStyle) {\r\n          vectorContext.setStyle(st[s]);\r\n          vectorContext.drawGeometry(geo);\r\n        }\r\n        // older version\r\n        else {\r\n          vectorContext.setImageStyle(imgs);\r\n          vectorContext.drawPointGeometry(geo);\r\n        }\r\n        if (imgs) imgs.setScale(sc);\r\n      }\r\n    }\r\n    // Stop animation and restore cluster visibility\r\n    if (e > 1.0) {\r\n      ol.Observable.unByKey(this.listenerKey_);\r\n      this.overlayLayer_.getSource().addFeatures(features);\r\n      this.overlayLayer_.changed();\r\n      return;\r\n    }\r\n    // tell OL3 to continue postcompose animation\r\n    event.frameState.animate = true;\r\n  }\r\n  // Start a new postcompose animation\r\n  this.listenerKey_ = this.overlayLayer_.on(['postcompose','postrender'], animate.bind(this));\r\n  // Start animation with a ghost feature\r\n  var feature = new ol.Feature(new ol.geom.Point(this.getMap().getView().getCenter()));\r\n  feature.setStyle(new ol.style.Style({ image: new ol.style.Circle({}) }));\r\n  this.overlayLayer_.getSource().addFeature(feature);\r\n};\r\n/** Helper function to get the extent of a cluster\r\n * @param {ol.feature} feature\r\n * @return {ol.extent|null} the extent or null if extent is empty (no cluster or superimposed points)\r\n */\r\nol.interaction.SelectCluster.prototype.getClusterExtent = function(feature) {\r\n  if (!feature.get('features')) return null;\r\n  var extent = ol.extent.createEmpty();\r\n  feature.get('features').forEach(function(f) {\r\n    extent = ol.extent.extend(extent, f.getGeometry().getExtent());\r\n  });\r\n  if (extent[0]===extent[2] && extent[1]===extent[3]) return null;\r\n  return extent;\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Interaction to snap to guidelines\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @param {*} options\r\n *  @param {number | undefined} options.pixelTolerance distance (in px) to snap to a guideline, default 10 px\r\n *  @param {bool | undefined} options.enableInitialGuides whether to draw initial guidelines based on the maps orientation, default false.\r\n *  @param {ol.style.Style | Array<ol.style.Style> | undefined} options.style Style for the sektch features.\r\n *  @param {*} options.vectorClass a vector layer class to create the guides with ol6, use ol/layer/VectorImage using ol6\r\n */\r\nol.interaction.SnapGuides = function(options) {\r\n  if (!options) options = {};\r\n  // Intersect 2 guides\r\n  function getIntersectionPoint (d1, d2) {\r\n    var d1x = d1[1][0] - d1[0][0];\r\n    var d1y = d1[1][1] - d1[0][1];\r\n    var d2x = d2[1][0] - d2[0][0];\r\n    var d2y = d2[1][1] - d2[0][1];\r\n    var det = d1x * d2y - d1y * d2x;\r\n    if (det != 0) {\r\n      var k = (d1x * d1[0][1] - d1x * d2[0][1] - d1y * d1[0][0] + d1y * d2[0][0]) / det;\r\n      return [d2[0][0] + k*d2x, d2[0][1] + k*d2y];\r\n    }\r\n    else return false;\r\n  }\r\n  function dist2D (p1,p2) {\r\n    var dx = p1[0]-p2[0];\r\n    var dy = p1[1]-p2[1];\r\n    return Math.sqrt(dx*dx+dy*dy);\r\n  }\r\n  // Snap distance (in px)\r\n  this.snapDistance_ = options.pixelTolerance || 10;\r\n  this.enableInitialGuides_ = options.enableInitialGuides || false;\r\n  // Default style\r\n  var sketchStyle = [\r\n    new ol.style.Style({\r\n      stroke: new ol.style.Stroke({\r\n        color: '#ffcc33',\r\n        lineDash: [8,5],\r\n        width: 1.25\r\n      })\r\n    })\r\n  ];\r\n  // Custom style\r\n  if (options.style) sketchStyle = options.style instanceof Array ? options.style : [options.style];\r\n  // Create a new overlay for the sketch\r\n  this.overlaySource_ = new ol.source.Vector({\r\n    features: new ol.Collection(),\r\n    useSpatialIndex: false\r\n  });\r\n  // Use ol/layer/VectorImage to render the snap guides as an image to improve performance on rerenderers\r\n  var vectorClass = options.vectorClass || ol.layer.Vector;\r\n  this.overlayLayer_ = new vectorClass({\r\n    // render the snap guides as an image to improve performance on rerenderers\r\n    renderMode: 'image',\r\n    source: this.overlaySource_,\r\n      style: function() {\r\n        return sketchStyle;\r\n      },\r\n      name:'Snap overlay',\r\n      displayInLayerSwitcher: false\r\n    });\r\n  // Use snap interaction\r\n  ol.interaction.Interaction.call(this, {\r\n    handleEvent: function(e) {\r\n      if (this.getActive()) {\r\n        var features = this.overlaySource_.getFeatures();\r\n        var prev = null;\r\n        var p = null;\r\n        var res = e.frameState.viewState.resolution;\r\n        for (var i=0, f; f = features[i]; i++) {\r\n          var c = f.getGeometry().getClosestPoint(e.coordinate);\r\n          if ( dist2D(c, e.coordinate) / res < this.snapDistance_) {\r\n            // Intersection on 2 lines\r\n            if (prev) {\r\n              var c2 = getIntersectionPoint(prev.getGeometry().getCoordinates(),  f.getGeometry().getCoordinates());\r\n              if (c2) {\r\n                if (dist2D(c2, e.coordinate) / res < this.snapDistance_) {\r\n                  p = c2;\r\n                }\r\n              }\r\n            } else {\r\n              p = c;\r\n            }\r\n            prev = f;\r\n          }\r\n        }\r\n        if (p) e.coordinate = p;\r\n      }\r\n      return true;\r\n    }\r\n  });\r\n};\r\nol.ext.inherits(ol.interaction.SnapGuides, ol.interaction.Interaction);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.SnapGuides.prototype.setMap = function(map) {\r\n  if (this.getMap()) this.getMap().removeLayer(this.overlayLayer_);\r\n  ol.interaction.Interaction.prototype.setMap.call (this, map);\r\n  this.overlayLayer_.setMap(map);\r\n  if (map) this.projExtent_ = map.getView().getProjection().getExtent();\r\n};\r\n/** Activate or deactivate the interaction.\r\n * @param {boolean} active\r\n */\r\nol.interaction.SnapGuides.prototype.setActive = function(active) {\r\n  this.overlayLayer_.setVisible(active);\r\n  ol.interaction.Interaction.prototype.setActive.call (this, active);\r\n}\r\n/** Clear previous added guidelines\r\n * @param {Array<ol.Feature> | undefined} features a list of feature to remove, default remove all feature\r\n */\r\nol.interaction.SnapGuides.prototype.clearGuides = function(features) {\r\n  if (!features) {\r\n    this.overlaySource_.clear();\r\n  } else {\r\n    for (var i=0, f; f=features[i]; i++) {\r\n      try {\r\n        this.overlaySource_.removeFeature(f);\r\n      } catch(e) {/* nothing to to */}\r\n    }\r\n  }\r\n};\r\n/** Get guidelines\r\n * @return {ol.Collection} guidelines features\r\n */\r\nol.interaction.SnapGuides.prototype.getGuides = function() {\r\n  return this.overlaySource_.getFeaturesCollection();\r\n}\r\n/** Add a new guide to snap to\r\n * @param {Array<ol.coordinate>} v the direction vector\r\n * @return {ol.Feature} feature guide\r\n */\r\nol.interaction.SnapGuides.prototype.addGuide = function(v, ortho) {\r\n  if (v) {\r\n    var map = this.getMap();\r\n    // Limit extent\r\n    var extent = map.getView().calculateExtent(map.getSize());\r\n    var guideLength = Math.max(\r\n      this.projExtent_[2] - this.projExtent_[0],\r\n      this.projExtent_[3] - this.projExtent_[1]\r\n    );\r\n    extent = ol.extent.buffer(extent, guideLength * 1.5);\r\n    //extent = ol.extent.boundingExtent(extent, this.projExtent_);\r\n    if (extent[0]<this.projExtent_[0]) extent[0]=this.projExtent_[0];\r\n    if (extent[1]<this.projExtent_[1]) extent[1]=this.projExtent_[1];\r\n    if (extent[2]>this.projExtent_[2]) extent[2]=this.projExtent_[2];\r\n    if (extent[3]>this.projExtent_[3]) extent[3]=this.projExtent_[3];\r\n    var dx = v[0][0] - v[1][0];\r\n    var dy = v[0][1] - v[1][1];\r\n    var d = 1 / Math.sqrt(dx*dx+dy*dy);\r\n    var generateLine = function(loopDir) {\r\n      var p, g = [];\r\n      var loopCond = guideLength*loopDir*2;\r\n      for (var i=0; loopDir > 0 ? i < loopCond : i > loopCond; i+=(guideLength * loopDir) / 100) {\r\n        if (ortho) p = [ v[0][0] + dy*d*i, v[0][1] - dx*d*i];\r\n        else p = [ v[0][0] + dx*d*i, v[0][1] + dy*d*i];\r\n        if (ol.extent.containsCoordinate(extent, p)) g.push(p);\r\n        else break;\r\n      }\r\n      return new ol.Feature(new ol.geom.LineString([g[0], g[g.length-1]]));\r\n    }\r\n    var f0 = generateLine(1);\r\n    var f1 = generateLine(-1);\r\n    this.overlaySource_.addFeature(f0);\r\n    this.overlaySource_.addFeature(f1);\r\n    return [f0, f1];\r\n  }\r\n};\r\n/** Add a new orthogonal guide to snap to\r\n * @param {Array<ol.coordinate>} v the direction vector\r\n * @return {ol.Feature} feature guide\r\n */\r\nol.interaction.SnapGuides.prototype.addOrthoGuide = function(v) {\r\n  return this.addGuide(v, true);\r\n};\r\n/** Listen to draw event to add orthogonal guidelines on the first and last point.\r\n * @param {_ol_interaction_Draw_} drawi a draw interaction to listen to\r\n * @api\r\n */\r\nol.interaction.SnapGuides.prototype.setDrawInteraction = function(drawi) {\r\n  var self = this;\r\n  // Number of points currently drawing\r\n  var nb = 0;\r\n  // Current guidelines\r\n  var features = [];\r\n  function setGuides(e) {\r\n    var coord = e.target.getCoordinates();\r\n    var s = 2;\r\n    switch (e.target.getType()) {\r\n      case 'Point':\r\n        return;\r\n      case 'Polygon':\r\n        coord = coord[0].slice(0, -1);\r\n        break;\r\n      default: break;\r\n    }\r\n    var l = coord.length;\r\n    if (l === s && self.enableInitialGuides_) {\r\n      var x = coord[0][0];\r\n      var y = coord[0][1];\r\n      coord = [[x, y], [x, y - 1]];\r\n    }\r\n    if (l != nb && (self.enableInitialGuides_ ? l >= s : l > s)) {\r\n      self.clearGuides(features);\r\n      // use try catch to remove a bug on freehand draw...\r\n      try {\r\n        var p1 = coord[l - s], p2 = coord[l - s - 1];\r\n        if (l > s && !(p1[0] === p2[0] && p1[1] === p2[1])) {\r\n          features = self.addOrthoGuide([coord[l - s], coord[l - s - 1]]);\r\n        }\r\n        features = features.concat(self.addGuide([coord[0], coord[1]]));\r\n        features = features.concat(self.addOrthoGuide([coord[0], coord[1]]));\r\n        nb = l;\r\n      } catch (e) { /* ok*/ }\r\n    }\r\n  }\r\n  // New drawing\r\n  drawi.on (\"drawstart\", function(e) {\r\n    // When geom is changing add a new orthogonal direction \r\n    e.feature.getGeometry().on(\"change\", setGuides);\r\n  });\r\n  // end drawing / deactivate => clear directions\r\n  drawi.on ([\"drawend\", \"change:active\"], function(e) {\r\n    self.clearGuides(features);\r\n    if (e.feature) e.feature.getGeometry().un(\"change\", setGuides);\r\n    nb = 0;\r\n    features = [];\r\n  });\r\n};\r\n/** Listen to modify event to add orthogonal guidelines relative to the currently dragged point\r\n * @param {_ol_interaction_Modify_} modifyi a modify interaction to listen to\r\n * @api\r\n */\r\nol.interaction.SnapGuides.prototype.setModifyInteraction = function (modifyi) {\r\n  function mod(d, n) {\r\n    return ((d % n) + n) % n;\r\n  }\r\n  var self = this;\r\n  // Current guidelines\r\n  var features = [];\r\n  function computeGuides(e) {\r\n    var selectedVertex = e.target.vertexFeature_\r\n    if (!selectedVertex) return;\r\n    var f = e.target.getModifiedFeatures()[0];\r\n    var geom = f.getGeometry();\r\n    var coord = geom.getCoordinates();\r\n    switch (geom.getType()) {\r\n      case 'Point':\r\n        return;\r\n      case 'Polygon':\r\n        coord = coord[0].slice(0, -1);\r\n        break;\r\n      default: break;\r\n    }\r\n    var modifyVertex = selectedVertex.getGeometry().getCoordinates();\r\n    var idx = coord.findIndex(function(c) {\r\n      return c[0] === modifyVertex[0] && c[1] === modifyVertex[1]\r\n    });\r\n    var l = coord.length;\r\n    self.clearGuides(features);\r\n    features = self.addOrthoGuide([coord[mod(idx - 1, l)], coord[mod(idx - 2, l)]]);\r\n    features = features.concat(self.addGuide([coord[mod(idx - 1, l)], coord[mod(idx - 2, l)]]));\r\n    features = features.concat(self.addGuide([coord[mod(idx + 1, l)], coord[mod(idx + 2, l)]]));\r\n    features = features.concat(self.addOrthoGuide([coord[mod(idx + 1, l)], coord[mod(idx + 2, l)]]));\r\n  }\r\n  function setGuides(e) {\r\n    // This callback is called before ol adds the vertex to the feature, so\r\n    // defer a moment for openlayers to add the new vertex\r\n    setTimeout(computeGuides, 0, e);\r\n  }\r\n  function drawEnd() {\r\n    self.clearGuides(features);\r\n    features = [];\r\n  }\r\n  // New drawing\r\n  modifyi.on(\"modifystart\", setGuides);\r\n  // end drawing, clear directions\r\n  modifyi.on(\"modifyend\", drawEnd);\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** An interaction to snap on pixel on a layer\r\n * The CenterTouch interaction modifies map browser event coordinate and pixel properties to force pointer on the viewport center to any interaction that them.\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @param {olx.interaction.InteractionOptions} options Options\r\n *  @param {ol.layer.Layer} options.layer layer to snap on\r\n */\r\nol.interaction.SnapLayerPixel = function(options) {\r\n  options = options || {};\r\n  // Get layer canevas context\r\n  this._layer = options.layer;\r\n  this._layer.on(['postcompose', 'postrender'], function(e) {\r\n    this._ctx = e.context;\r\n  }.bind(this));\r\n  var radius = options.radius || 8;\r\n  var size = 2*radius;\r\n  ol.interaction.Interaction.call(this, {\r\n    handleEvent: function(e) {\r\n      if (this._layer.getVisible() && this._layer.getOpacity() \r\n      && ol.events.condition.altKeyOnly(e) && this.getMap()) {\r\n        var x0 = e.pixel[0] - radius;\r\n        var y0 = e.pixel[1] - radius;\r\n        var imgd = this._ctx.getImageData(x0, y0, size, size);\r\n        var pix = imgd.data;\r\n        // Loop over each pixel and invert the color.\r\n        var x, y, xm, ym, max=-1; \r\n        var t = [];\r\n        for (x=0; x < size; x++) {\r\n          t.push([])\r\n          for (y=0; y < size; y++) {\r\n            var l = pix[3+ 4 * (x + y*size)];\r\n            t[x].push(l>10 ? l : 0)\r\n          }\r\n        }\r\n        for (x=1; x < size-1; x++) {\r\n          for (y=1; y < size-1; y++) {\r\n            var m = t[x][y+1] + t[x][y] + t[x][y+1] \r\n              + t[x-1][y-1] + t[x-1][y] + t[x-1][y+1] \r\n              + t[x+1][y-1] + t[x+1][y] + t[x+1][y+1];\r\n            if (m > max) {\r\n              max = m;\r\n              xm = x;\r\n              ym = y;\r\n            } \r\n          }\r\n        }\r\n        e.pixel = [x0+xm, y0+ym];\r\n        e.coordinate = this.getMap().getCoordinateFromPixel(e.pixel);\r\n        /*\r\n        e.coordinate = this.getMap().getView().getCenter();\r\n        e.pixel = this.getMap().getSize();\r\n        e.pixel = [ e.pixel[0]/2, e.pixel[1]/2 ];\r\n        */\r\n      }\r\n      return true; \r\n    }\r\n  });\r\n};\r\nol.ext.inherits(ol.interaction.SnapLayerPixel, ol.interaction.Interaction);\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Interaction split interaction for splitting feature geometry\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @fires  beforesplit, aftersplit, pointermove\r\n * @param {*} \r\n *  @param {ol.source.Vector|Array<ol.source.Vector>} options.source a list of source to split (configured with useSpatialIndex set to true)\r\n *  @param {ol.Collection.<ol.Feature>} options.features collection of feature to split\r\n *  @param {integer} options.snapDistance distance (in px) to snap to an object, default 25px\r\n *\t@param {string|undefined} options.cursor cursor name to display when hovering an objet\r\n *  @param {function|undefined} opttion.filter a filter that takes a feature and return true if it can be clipped, default always split.\r\n *  @param ol.style.Style | Array<ol.style.Style> | false | undefined} options.featureStyle Style for the selected features, choose false if you don't want feature selection. By default the default edit style is used.\r\n *  @param {ol.style.Style | Array<ol.style.Style> | undefined} options.sketchStyle Style for the sektch features. \r\n *  @param {function|undefined} options.tolerance Distance between the calculated intersection and a vertex on the source geometry below which the existing vertex will be used for the split.  Default is 1e-10.\r\n */\r\nol.interaction.Split = function(options) {\r\n  if (!options) options = {};\r\n  ol.interaction.Interaction.call(this, {\r\n    handleEvent: function(e) {\r\n      switch (e.type) {\r\n        case \"singleclick\":\r\n          return this.handleDownEvent(e);\r\n        case \"pointermove\":\r\n          return this.handleMoveEvent(e);\r\n        default: \r\n          return true;\r\n      }\r\n      //return true;\r\n    }\r\n  });\r\n  // Snap distance (in px)\r\n  this.snapDistance_ = options.snapDistance || 25;\r\n  // Split tolerance between the calculated intersection and the geometry\r\n  this.tolerance_ = options.tolerance || 1e-10;\r\n  // Cursor\r\n  this.cursor_ = options.cursor;\r\n  // List of source to split\r\n  this.sources_ = options.sources ? (options.sources instanceof Array) ? options.sources:[options.sources] : [];\r\n  if (options.features) {\r\n    this.sources_.push (new ol.source.Vector({ features: options.features }));\r\n  }\r\n  // Get all features candidate\r\n  this.filterSplit_ = options.filter || function(){ return true; };\r\n  // Default style\r\n  var white = [255, 255, 255, 1];\r\n  var blue = [0, 153, 255, 1];\r\n  var width = 3;\r\n  var fill = new ol.style.Fill({ color: 'rgba(255,255,255,0.4)' });\r\n  var stroke = new ol.style.Stroke({\r\n    color: '#3399CC',\r\n    width: 1.25\r\n  });\r\n  var sketchStyle = [\r\n    new ol.style.Style({\r\n      image: new ol.style.Circle({\r\n        fill: fill,\r\n        stroke: stroke,\r\n        radius: 5\r\n      }),\r\n      fill: fill,\r\n      stroke: stroke\r\n    })\r\n  ];\r\n  var featureStyle = [\r\n    new ol.style.Style({\r\n      stroke: new ol.style.Stroke({\r\n        color: white,\r\n        width: width + 2\r\n      })\r\n    }),\r\n    new ol.style.Style({\r\n      image: new ol.style.Circle({\r\n        radius: 2*width,\r\n        fill: new ol.style.Fill({\r\n          color: blue\r\n        }),\r\n        stroke: new ol.style.Stroke({\r\n          color: white,\r\n          width: width/2\r\n        })\r\n      }),\r\n      stroke: new ol.style.Stroke({\r\n          color: blue,\r\n          width: width\r\n        })\r\n    }),\r\n  ];\r\n  // Custom style\r\n  if (options.sketchStyle) sketchStyle = options.sketchStyle instanceof Array ? options.sketchStyle : [options.sketchStyle];\r\n  if (options.featureStyle) featureStyle = options.featureStyle instanceof Array ? options.featureStyle : [options.featureStyle];\r\n  // Create a new overlay for the sketch\r\n  this.overlayLayer_ = new ol.layer.Vector({\r\n    source: new ol.source.Vector({\r\n      useSpatialIndex: false\r\n    }),\r\n    name:'Split overlay',\r\n    displayInLayerSwitcher: false,\r\n    style: function(f) {\r\n      if (f._sketch_) return sketchStyle;\r\n      else return featureStyle;\r\n    }\r\n  });\r\n};\r\nol.ext.inherits(ol.interaction.Split, ol.interaction.Interaction);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.Split.prototype.setMap = function(map) {\r\n  if (this.getMap()) this.getMap().removeLayer(this.overlayLayer_);\r\n  ol.interaction.Interaction.prototype.setMap.call (this, map);\r\n  this.overlayLayer_.setMap(map);\r\n};\r\n/** Get closest feature at pixel\r\n * @param {ol.Pixel} \r\n * @return {ol.feature} \r\n * @private\r\n */\r\nol.interaction.Split.prototype.getClosestFeature = function(e) {\r\n  var source, f, c, g, d = this.snapDistance_+1;\r\n  // Look for closest point in the sources\r\n  this.sources_.forEach(function(si) {\r\n    var fi = si.getClosestFeatureToCoordinate(e.coordinate);\r\n    if (fi && fi.getGeometry().splitAt) {\r\n      var ci = fi.getGeometry().getClosestPoint(e.coordinate);\r\n      var gi = new ol.geom.LineString([e.coordinate,ci]);\r\n      var di = gi.getLength() / e.frameState.viewState.resolution;\r\n      if (di < d) {\r\n        source = si;\r\n        d = di;\r\n        f = fi;\r\n        g = gi;\r\n        c = ci;\r\n      }\r\n    }\r\n  });\r\n  // Snap ?\r\n  if (d > this.snapDistance_) {\r\n    return false;\r\n  } else {\r\n    // Snap to node\r\n    var coord = this.getNearestCoord (c, f.getGeometry().getCoordinates());\r\n    var p = this.getMap().getPixelFromCoordinate(coord);\r\n    if (ol.coordinate.dist2d(e.pixel, p) < this.snapDistance_) {\r\n      c = coord;\r\n    }\r\n    //\r\n    return { source:source, feature:f, coord: c, link: g };\r\n  }\r\n}\r\n/** Get nearest coordinate in a list \r\n* @param {ol.coordinate} pt the point to find nearest\r\n* @param {Array<ol.coordinate>} coords list of coordinates\r\n* @return {ol.coordinate} the nearest coordinate in the list\r\n*/\r\nol.interaction.Split.prototype.getNearestCoord = function(pt, coords) {\r\n  var d, dm=Number.MAX_VALUE, p0;\r\n  for (var i=0; i < coords.length; i++) {\r\n    d = ol.coordinate.dist2d (pt, coords[i]);\r\n    if (d < dm) {\r\n      dm = d;\r\n      p0 = coords[i];\r\n    }\r\n  }\r\n  return p0;\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} evt Map browser event.\r\n * @return {boolean} `true` to start the drag sequence.\r\n */\r\nol.interaction.Split.prototype.handleDownEvent = function(evt) {\r\n  // Something to split ?\r\n  var current = this.getClosestFeature(evt);\r\n  if (current) {\r\n    var self = this;\r\n    self.overlayLayer_.getSource().clear();\r\n    var split = current.feature.getGeometry().splitAt(current.coord, this.tolerance_);\r\n    var i;\r\n    if (split.length > 1) {\r\n      var tosplit = [];\r\n      for (i=0; i<split.length; i++) {\r\n        var f = current.feature.clone();\r\n        f.setGeometry(split[i]);\r\n        tosplit.push(f);\r\n      }\r\n      self.dispatchEvent({ type:'beforesplit', original: current.feature, features: tosplit });\r\n      current.source.dispatchEvent({ type:'beforesplit', original: current.feature, features: tosplit });\r\n      current.source.removeFeature(current.feature);\r\n      for (i=0; i<tosplit.length; i++) {\r\n        current.source.addFeature(tosplit[i]);\r\n      }\r\n      self.dispatchEvent({ type:'aftersplit', original: current.feature, features: tosplit });\r\n      current.source.dispatchEvent({ type:'aftersplit', original: current.feature, features: tosplit });\r\n    }\r\n  }\r\n  return false;\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} evt Event.\r\n */\r\nol.interaction.Split.prototype.handleMoveEvent = function(e) {\r\n  var map = e.map;\r\n  this.overlayLayer_.getSource().clear();\r\n  var current = this.getClosestFeature(e);\r\n  if (current && this.filterSplit_(current.feature)) {\r\n    var p, l;\r\n    // Draw sketch\r\n    this.overlayLayer_.getSource().addFeature(current.feature);\r\n    p = new ol.Feature(new ol.geom.Point(current.coord));\r\n    p._sketch_ = true;\r\n    this.overlayLayer_.getSource().addFeature(p);\r\n    //\r\n    l = new ol.Feature(current.link);\r\n    l._sketch_ = true;\r\n    this.overlayLayer_.getSource().addFeature(l);\r\n    // move event\r\n    this.dispatchEvent({\r\n      type: 'pointermove',\r\n      coordinate: e.coordinate,\r\n      frameState: e.frameState,\r\n      originalEvent: e.originalEvent,\r\n      map: e.map,\r\n      pixel: e.pixel,\r\n      feature: current.feature,\r\n      linkGeometry: current.link\r\n    });\r\n  } else {\r\n    this.dispatchEvent(e);\r\n  }\r\n  var element = map.getTargetElement();\r\n  if (this.cursor_) {\r\n    if (current) {\r\n      if (element.style.cursor != this.cursor_) {\r\n        this.previousCursor_ = element.style.cursor;\r\n        element.style.cursor = this.cursor_;\r\n      }\r\n    } else if (this.previousCursor_ !== undefined) {\r\n      element.style.cursor = this.previousCursor_;\r\n      this.previousCursor_ = undefined;\r\n    }\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/*eslint no-constant-condition: [\"error\", { \"checkLoops\": false }]*/\r\n/** Interaction splitter: acts as a split feature agent while editing vector features (LineString).\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @fires  beforesplit, aftersplit\r\n * @param {olx.interaction.SplitOptions} \r\n *\t- source {ol.source.Vector|Array{ol.source.Vector}} The target source (or array of source) with features to be split (configured with useSpatialIndex set to true)\r\n *\t- triggerSource {ol.source.Vector} Any newly created or modified features from this source will be used to split features on the target source. If none is provided the target source is used instead.\r\n *\t- features {ol.Collection.<ol.Feature>} A collection of feature to be split (replace source target).\r\n *\t- triggerFeatures {ol.Collection.<ol.Feature>} Any newly created or modified features from this collection will be used to split features on the target source (replace triggerSource).\r\n *\t- filter {function|undefined} a filter that takes a feature and return true if the feature is eligible for splitting, default always split.\r\n *\t- tolerance {function|undefined} Distance between the calculated intersection and a vertex on the source geometry below which the existing vertex will be used for the split. Default is 1e-10.\r\n * @todo verify auto intersection on features that split.\r\n */\r\nol.interaction.Splitter = function(options)\r\n{\tif (!options) options = {};\r\n\tol.interaction.Interaction.call(this,\r\n\t{\thandleEvent: function(e)\r\n\t\t\t{\t// Hack to get only one changeFeature when draging with ol.interaction.Modify on.\r\n\t\t\t\tif (e.type != \"pointermove\" && e.type != \"pointerdrag\")\r\n\t\t\t\t{\tif (this.lastEvent_)\r\n\t\t\t\t\t{\tthis.splitSource(this.lastEvent_.feature);\r\n\t\t\t\t\t\tthis.lastEvent_ = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.moving_ = false;\r\n\t\t\t\t}\r\n\t\t\t\telse this.moving_ = true;\r\n\t\t\t\treturn true; \r\n\t\t\t},\r\n\t});\r\n\t// Features added / remove\r\n\tthis.added_ = [];\r\n\tthis.removed_ = [];\r\n\t// Source to split\r\n\tif (options.features)\r\n\t{\tthis.source_ = new ol.source.Vector({ features: options.features });\r\n\t}\r\n\telse \r\n\t{\tthis.source_ = options.source ? options.source : new ol.source.Vector({ features: new ol.Collection() });\r\n\t}\r\n\tvar trigger = this.triggerSource;\r\n\tif (options.triggerFeatures)\r\n\t{\ttrigger = new ol.source.Vector({ features: options.triggerFeatures });\r\n\t}\r\n\tif (trigger)\r\n\t{\ttrigger.on(\"addfeature\", this.onAddFeature.bind(this));\r\n\t\ttrigger.on(\"changefeature\", this.onChangeFeature.bind(this));\r\n\t\ttrigger.on(\"removefeature\", this.onRemoveFeature.bind(this));\r\n\t}\r\n\telse\r\n\t{\tthis.source_.on(\"addfeature\", this.onAddFeature.bind(this));\r\n\t\tthis.source_.on(\"changefeature\", this.onChangeFeature.bind(this));\r\n\t\tthis.source_.on(\"removefeature\", this.onRemoveFeature.bind(this));\r\n\t}\r\n\t// Split tolerance between the calculated intersection and the geometry\r\n\tthis.tolerance_ = options.tolerance || 1e-10;\r\n\t// Get all features candidate\r\n\tthis.filterSplit_ = options.filter || function(){ return true; };\r\n};\r\nol.ext.inherits(ol.interaction.Splitter, ol.interaction.Interaction);\r\n/** Calculate intersection on 2 segs\r\n* @param {Array<_ol_coordinate_>} s1 first seg to intersect (2 points)\r\n* @param {Array<_ol_coordinate_>} s2 second seg to intersect (2 points)\r\n* @return { boolean | _ol_coordinate_ } intersection point or false no intersection\r\n*/\r\nol.interaction.Splitter.prototype.intersectSegs = function(s1,s2)\r\n{\tvar tol = this.tolerance_;\r\n\t// Solve\r\n\tvar x12 = s1[0][0] - s1[1][0];\r\n\tvar x34 = s2[0][0] - s2[1][0];\r\n\tvar y12 = s1[0][1] - s1[1][1];\r\n\tvar y34 = s2[0][1] - s2[1][1];\r\n\tvar det = x12 * y34 - y12 * x34;\r\n\t// No intersection\r\n\tif (Math.abs(det) < tol)\r\n\t{\treturn false;\r\n\t}\r\n\telse\r\n\t{\t// Outside segement\r\n\t\tvar r1 = ((s1[0][0] - s2[1][0])*y34 - (s1[0][1] - s2[1][1])*x34) / det;\r\n\t\tif (Math.abs(r1)<tol) return s1[0];\r\n\t\tif (Math.abs(1-r1)<tol) return s1[1];\r\n\t\tif (r1<0 || r1>1) return false;\r\n\t\tvar r2 = ((s1[0][1] - s2[1][1])*x12 - (s1[0][0] - s2[1][0])*y12) / det;\r\n\t\tif (Math.abs(r2)<tol) return s2[1];\r\n\t\tif (Math.abs(1-r2)<tol) return s2[0];\r\n\t\tif (r2<0 || r2>1) return false;\r\n\t\t// Intersection\r\n\t\tvar a = s1[0][0] * s1[1][1] - s1[0][1] * s1[1][0];\r\n\t\tvar b = s2[0][0] * s2[1][1] - s2[0][1] * s2[1][0];\r\n\t\tvar p = [(a * x34 - b * x12) / det, (a * y34 - b * y12) / det];\r\n\t\t// Test start / end\r\n/*\r\nconsole.log(\"r1: \"+r1)\r\nconsole.log(\"r2: \"+r2)\r\nconsole.log (\"s10: \"+(_ol_coordinate_.dist2d(p,s1[0])<tol)) ;\r\nconsole.log (\"s11: \"+(_ol_coordinate_.dist2d(p,s1[1])<tol)) ;\r\nconsole.log (\"s20: \"+(_ol_coordinate_.dist2d(p,s2[0])<tol)) ;\r\nconsole.log (\"s21: \"+(_ol_coordinate_.dist2d(p,s2[1])<tol)) ;\r\n*/\r\n\t\treturn p;\r\n\t}\r\n};\r\n/** Split the source using a feature\r\n* @param {ol.Feature} feature The feature to use to split.\r\n*/\r\nol.interaction.Splitter.prototype.splitSource = function(feature)\r\n{\t// Allready perform a split\r\n\tif (this.splitting) return;\r\n\tvar self = this;\r\n\tvar i, k, f2;\r\n\t// Start splitting\r\n\tthis.source_.dispatchEvent({ type:'beforesplit', feaure: feature, source: this.source_ });\r\n\tthis.splitting = true;\r\n\tthis.added_ = [];\r\n\tthis.removed_ = [];\r\n\tvar c = feature.getGeometry().getCoordinates();\r\n\tvar seg, split = [];\r\n\tfunction intersect (f)\r\n\t{\tif (f !== feature)\r\n\t\t{\tvar c2 = f.getGeometry().getCoordinates();\r\n\t\t\tfor (var j=0; j<c2.length-1; j++)\r\n\t\t\t{\tvar p = this.intersectSegs (seg, [c2[j],c2[j+1]]);\r\n\t\t\t\tif (p)\r\n\t\t\t\t{\tsplit.push(p);\r\n\t\t\t\t\tg = f.getGeometry().splitAt(p, this.tolerance_);\r\n\t\t\t\t\tif (g && g.length>1)\r\n\t\t\t\t\t{\tfound = f;\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t// Split existing features\r\n\tfor (i=0; i<c.length-1; i++)\r\n\t{\tseg = [c[i],c[i+1]];\r\n\t\tvar extent = ol.extent.buffer(ol.extent.boundingExtent(seg), this.tolerance_ /*0.01*/ );\r\n\t\tvar g;\r\n\t\twhile (true)\r\n\t\t{\tvar found = false;\r\n\t\t\tthis.source_.forEachFeatureIntersectingExtent(extent, intersect.bind(this));\r\n\t\t\t// Split feature\r\n\t\t\tif (found)\r\n\t\t\t{\tvar f = found;\r\n\t\t\t\tthis.source_.removeFeature(f);\r\n\t\t\t\tfor (k=0; k<g.length; k++)\r\n\t\t\t\t{\tf2 = f.clone();\r\n\t\t\t\t\tf2.setGeometry(g[k]);\r\n\t\t\t\t\tthis.source_.addFeature(f2);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse break;\r\n\t\t}\r\n\t}\r\n\t// Auto intersect\r\n\tfor (i=0; i<c.length-2; i++)\r\n\t{\tfor (var j=i+1; j<c.length-1; j++)\r\n\t\t{\tvar p = this.intersectSegs ([c[i],c[i+1]], [c[j],c[j+1]]);\r\n\t\t\tif (p && p!=c[i+1])\r\n\t\t\t{\tsplit.push(p);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t// Split original\r\n\tvar splitOriginal = false;\r\n\tif (split.length)\r\n\t{\tvar result = feature.getGeometry().splitAt(split, this.tolerance_);\r\n\t\tif (result.length>1)\r\n\t\t{\tfor (k=0; k<result.length; k++)\r\n\t\t\t{\tf2 = feature.clone();\r\n\t\t\t\tf2.setGeometry(result[k]);\r\n\t\t\t\tthis.source_.addFeature(f2);\r\n\t\t\t}\r\n\t\t\tsplitOriginal = true;\r\n\t\t}\r\n\t}\r\n\t// If the interaction is inserted after modify interaction, the objet is not consistant \r\n\t// > wait end of other interactions\r\n\tsetTimeout (function()\r\n\t{\tif (splitOriginal) self.source_.removeFeature(feature);\r\n\t\tself.source_.dispatchEvent({ type:'aftersplit', featureAdded: self.added_, featureRemoved: self.removed_, source: this.source_ });\r\n\t\t// Finish\r\n\t\tself.splitting = false;\r\n\t},0);\r\n};\r\n/** New feature source is added \r\n*/\r\nol.interaction.Splitter.prototype.onAddFeature = function(e)\r\n{\tthis.splitSource(e.feature);\r\n\tif (this.splitting) \r\n\t{\tthis.added_.push(e.feature);\r\n\t}\r\n\t/*\r\n\tif (this.splitting) return;\r\n\tvar self = this;\r\n\tsetTimeout (function() { self.splitSource(e.feature); }, 0);\r\n\t*/\r\n};\r\n/** Feature source is removed > count features added/removed\r\n*/\r\nol.interaction.Splitter.prototype.onRemoveFeature = function(e)\r\n{\tif (this.splitting) \r\n\t{\tvar n = this.added_.indexOf(e.feature);\r\n\t\tif (n==-1)\r\n\t\t{\tthis.removed_.push(e.feature);\r\n\t\t}\r\n\t\telse\r\n\t\t{\tthis.added_.splice(n,1);\r\n\t\t}\r\n\t}\r\n};\r\n/** Feature source is changing \r\n*/\r\nol.interaction.Splitter.prototype.onChangeFeature = function(e)\r\n{\tif (this.moving_) \r\n\t{\tthis.lastEvent_ = e;\r\n\t}\r\n\telse this.splitSource(e.feature);\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Interaction synchronize\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @param {*} options\r\n *  @param {Array<ol.Map>} options maps An array of maps to synchronize with the map of the interaction\r\n */\r\nol.interaction.Synchronize = function(options) {\r\n  if (!options) options={};\r\n  var self = this;\r\n  ol.interaction.Interaction.call(this, {\r\n    handleEvent: function(e) {\r\n      if (e.type==\"pointermove\") { self.handleMove_(e); }\r\n      return true;\r\n    }\r\n  });\r\n  this.maps = options.maps || [];\r\n  if (options.active === false) this.setActive(false);\r\n};\r\nol.ext.inherits(ol.interaction.Synchronize, ol.interaction.Interaction);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.Synchronize.prototype.setMap = function(map) {\r\n  if (this._listener) {\r\n    ol.Observable.unByKey(this._listener.center);\r\n    ol.Observable.unByKey(this._listener.rotation);\r\n    ol.Observable.unByKey(this._listener.resolution);\r\n    this.getMap().getTargetElement().removeEventListener('mouseout', this._listener.mouseout);\r\n  }\r\n  this._listener = null;\r\n  ol.interaction.Interaction.prototype.setMap.call (this, map);\r\n  if (map) {\r\n    this._listener = {};\r\n    this._listener.center = this.getMap().getView().on('change:center', this.syncMaps.bind(this));\r\n    this._listener.rotation = this.getMap().getView().on('change:rotation', this.syncMaps.bind(this));\r\n    this._listener.resolution = this.getMap().getView().on('change:resolution', this.syncMaps.bind(this));\r\n    this._listener.mouseout = this.handleMouseOut_.bind(this);\r\n    if (this.getMap().getTargetElement()) {\r\n      this.getMap().getTargetElement().addEventListener('mouseout', this._listener.mouseout);\r\n    }\r\n    this.syncMaps();\r\n  }\r\n};\r\n/** Auto activate/deactivate controls in the bar\r\n * @param {boolean} b activate/deactivate\r\n */\r\nol.interaction.Synchronize.prototype.setActive = function (b) {\r\n  ol.interaction.Interaction.prototype.setActive.call(this, b);\r\n  this.syncMaps();\r\n};\r\n/** Synchronize the maps\r\n */\r\nol.interaction.Synchronize.prototype.syncMaps = function() {\r\n  if (!this.getActive()) return;\r\n  var map = this.getMap();\r\n  if (map) {\r\n    if (map.get('lockView')) return;\r\n    for (var i=0; i<this.maps.length; i++) {\r\n      this.maps[i].set('lockView', true);\r\n      // sync\r\n      if (this.maps[i].getView().getRotation() != map.getView().getRotation()) {\r\n        this.maps[i].getView().setRotation(map.getView().getRotation()); \r\n      }\r\n      if (this.maps[i].getView().getCenter() != map.getView().getCenter()) {\r\n        this.maps[i].getView().setCenter(map.getView().getCenter()); \r\n      }\r\n      if (this.maps[i].getView().getResolution() != map.getView().getResolution()) {\r\n        this.maps[i].getView().setResolution(map.getView().getResolution());\r\n      }\r\n      this.maps[i].set('lockView', false);\r\n    }\r\n  }\r\n};\r\n/** Cursor move > tells other maps to show the cursor\r\n* @param {ol.event} e \"move\" event\r\n*/\r\nol.interaction.Synchronize.prototype.handleMove_ = function(e) {\r\n  for (var i=0; i<this.maps.length; i++) {\r\n    this.maps[i].showTarget(e.coordinate);\r\n  }\r\n  this.getMap().showTarget();\r\n};\r\n/** Cursor out of map > tells other maps to hide the cursor\r\n* @param {event} e \"mouseOut\" event\r\n*/\r\nol.interaction.Synchronize.prototype.handleMouseOut_ = function(/*e*/) {\r\n  for (var i=0; i<this.maps.length; i++) {\r\n    if (this.maps[i]._targetOverlay) this.maps[i]._targetOverlay.setPosition(undefined);\r\n  }\r\n};\r\n/** Show a target overlay at coord\r\n* @param {ol.coordinate} coord\r\n*/\r\nol.Map.prototype.showTarget = function(coord) {\r\n  if (!this._targetOverlay) {\r\n    var elt = document.createElement(\"div\");\r\n    elt.classList.add(\"ol-target\");\r\n    this._targetOverlay = new ol.Overlay({ element: elt });\r\n    this._targetOverlay.setPositioning('center-center');\r\n    this.addOverlay(this._targetOverlay);\r\n    elt.parentElement.classList.add(\"ol-target-overlay\");\r\n    // hack to render targetOverlay before positioning it\r\n    this._targetOverlay.setPosition([0,0]);\r\n  }\r\n  this._targetOverlay.setPosition(coord);\r\n};\r\n/** Hide the target overlay\r\n*/\r\nol.Map.prototype.hideTarget = function() {\r\n  this.removeOverlay(this._targetOverlay);\r\n  this._targetOverlay = undefined;\r\n};\r\n\r\n/*\t\r\n  Tinker Bell effect on maps.\r\n  Copyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n  @link https://github.com/Viglino\r\n*/\r\n/**\r\n * @constructor\r\n * @extends {ol.interaction.Pointer}\r\n *\t@param {ol.interaction.TinkerBell.options}  options flashlight param\r\n*\t\t- color {ol.color} color of the sparkles\r\n*/\r\nol.interaction.TinkerBell = function(options) {\r\n  options = options || {};\r\n  ol.interaction.Pointer.call(this, {\r\n    handleDownEvent: this.onMove,\r\n    handleMoveEvent: this.onMove\r\n  });\r\n  this.set('color', options.color ? ol.color.asString(options.color) : \"#fff\");\r\n  this.sparkle = [0,0];\r\n  this.sparkles = [];\r\n  this.lastSparkle = this.time = new Date();\r\n  var self = this;\r\n  this.out_ = function() { self.isout_=true; };\r\n  this.isout_ = true;\r\n};\r\nol.ext.inherits(ol.interaction.TinkerBell, ol.interaction.Pointer);\r\n/** Set the map > start postcompose\r\n*/\r\nol.interaction.TinkerBell.prototype.setMap = function(map) {\r\n  if (this._listener) ol.Observable.unByKey(this._listener);\r\n  this._listener = null;\r\n  if (this.getMap()) {\r\n    map.getViewport().removeEventListener('mouseout', this.out_, false);\r\n    this.getMap().render();\r\n  }\r\n  ol.interaction.Pointer.prototype.setMap.call(this, map);\r\n  if (map) {\r\n    this._listener = map.on('postcompose', this.postcompose_.bind(this));\r\n    map.getViewport().addEventListener('mouseout', this.out_, false);\r\n  }\r\n};\r\nol.interaction.TinkerBell.prototype.onMove = function(e) {\r\n  this.sparkle = e.pixel;\r\n  this.isout_ = false;\r\n  this.getMap().render();\r\n};\r\n/** Postcompose function\r\n*/\r\nol.interaction.TinkerBell.prototype.postcompose_ = function(e) {\r\n  var delta = 15;\r\n  var ctx = e.context || ol.ext.getMapCanvas(this.getMap()).getContext('2d');\r\n  var dt = e.frameState.time - this.time;\r\n  this.time = e.frameState.time;\r\n  if (e.frameState.time-this.lastSparkle > 30 && !this.isout_) {\r\n    this.lastSparkle = e.frameState.time;\r\n    this.sparkles.push({ p:[this.sparkle[0]+Math.random()*delta-delta/2, this.sparkle[1]+Math.random()*delta], o:1 });\r\n  }\r\n  ctx.save();\r\n    ctx.scale(e.frameState.pixelRatio,e.frameState.pixelRatio);\r\n    ctx.fillStyle = this.get(\"color\");\r\n    for (var i=this.sparkles.length-1, p; p=this.sparkles[i]; i--) {\r\n      if (p.o < 0.2) {\r\n        this.sparkles.splice(0,i+1);\r\n        break;\r\n      }\r\n      ctx.globalAlpha = p.o;\r\n      ctx.beginPath();\r\n      ctx.arc (p.p[0], p.p[1], 2.2, 0, 2 * Math.PI, false);\r\n      ctx.fill();\r\n      p.o *= 0.98;\r\n      p.p[0] += (Math.random()-0.5);\r\n      p.p[1] += dt*(1+Math.random())/30;\r\n    }\r\n  ctx.restore();\r\n  // continue postcompose animation\r\n  if (this.sparkles.length) this.getMap().render(); \r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Interaction splitter: acts as a split feature agent while editing vector features (LineString).\r\n * @constructor\r\n * @extends {ol.interaction.Pointer}\r\n * @param {olx.interaction.TouchCompass} \r\n *\t- onDrag {function|undefined} Function handling \"drag\" events. It provides a dpixel and a traction (in projection) vector form the center of the compas\r\n *\t- size {Number} size of the compass in px, default 80\r\n *\t- alpha {Number} opacity of the compass, default 0.5\r\n */\r\nol.interaction.TouchCompass = function(options) {\r\n\toptions = options||{};\r\n\tvar opt = {};\r\n\t// Click on the compass\r\n\topt.handleDownEvent = function(e)\r\n\t{\tvar s = this.getCenter_();\r\n\t\tvar dx = e.pixel[0]-s[0];\r\n\t\tvar dy = e.pixel[1]-s[1];\r\n\t\tthis.start = e;\r\n\t\treturn (Math.sqrt(dx*dx+dy*dy) < this.size/2);\r\n\t};\r\n\t// Pn drag\r\n\topt.handleDragEvent = function(e) {\r\n\t\tif (!this.pos) {\r\n\t\t\tthis.pos = this.start;\r\n\t\t\ttry { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n\t\t}\r\n\t\tthis.pos = e;\r\n\t};\r\n\t// Stop drag\r\n\topt.handleUpEvent = function()\r\n\t{\tthis.pos = false;\r\n\t\treturn true;\r\n\t};\r\n\tol.interaction.Pointer.call(this, opt);\r\n\tthis.ondrag_ = options.onDrag;\r\n\tthis.size = options.size || 80;\r\n\tthis.alpha = options.alpha || 0.5;\r\n\tif (!ol.interaction.TouchCompass.prototype.compass)\r\n\t{\tvar canvas = ol.interaction.TouchCompass.prototype.compass = document.createElement('canvas');\r\n\t\tvar ctx = canvas.getContext(\"2d\");\r\n\t\tvar s = canvas.width = canvas.height = this.size;\r\n\t\tvar w = s/10;\r\n\t\tvar r = s/2;\r\n\t\tvar r2 = 0.22*r;\r\n\t\tctx.translate(r,r);\r\n\t\tctx.fillStyle = \"#999\";\r\n\t\tctx.strokeStyle = \"#ccc\";\r\n\t\tctx.lineWidth = w;\r\n\t\tctx.beginPath();\r\n\t\tctx.arc (0,0, s*0.42, 0, 2*Math.PI);\r\n\t\tctx.fill();\r\n\t\tctx.stroke();\r\n\t\tctx.fillStyle = \"#99f\";\r\n\t\tctx.beginPath();\r\n\t\tctx.moveTo (0,0); \r\n\t\tctx.lineTo (r,0); ctx.lineTo (r2,r2); ctx.moveTo (0,0);\r\n\t\tctx.lineTo (-r,0); ctx.lineTo (-r2,-r2); ctx.moveTo (0,0);\r\n\t\tctx.lineTo (0,r); ctx.lineTo (-r2,r2); ctx.moveTo (0,0);\r\n\t\tctx.lineTo (0,-r); ctx.lineTo (r2,-r2); ctx.moveTo (0,0);\r\n\t\tctx.fill();\r\n\t\tctx.fillStyle = \"#eee\";\r\n\t\tctx.beginPath();\r\n\t\tctx.moveTo (0,0); \r\n\t\tctx.lineTo (r,0); ctx.lineTo (r2,-r2); ctx.moveTo (0,0);\r\n\t\tctx.lineTo (-r,0); ctx.lineTo (-r2,r2); ctx.moveTo (0,0);\r\n\t\tctx.lineTo (0,r); ctx.lineTo (r2,r2); ctx.moveTo (0,0);\r\n\t\tctx.lineTo (0,-r); ctx.lineTo (-r2,-r2); ctx.moveTo (0,0);\r\n\t\tctx.fill();\r\n\t}\r\n};\r\nol.ext.inherits(ol.interaction.TouchCompass, ol.interaction.Pointer);\r\n/** Compass Image as a JS Image object\r\n* @api\r\n*/\r\nol.interaction.TouchCompass.prototype.compass = null;\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {_ol_Map_} map Map.\r\n * @api stable\r\n */\r\nol.interaction.TouchCompass.prototype.setMap = function(map) {\r\n\tif (this._listener) ol.Observable.unByKey(this._listener);\r\n\tthis._listener = null;\r\n\tol.interaction.Pointer.prototype.setMap.call (this, map);\r\n\tif (map) {\r\n\t\tthis._listener = map.on('postcompose', this.drawCompass_.bind(this));\r\n\t\tol.ext.getMapCanvas(map);\r\n\t}\r\n};\r\n/**\r\n * Activate or deactivate the interaction.\r\n * @param {boolean} active Active.\r\n * @observable\r\n * @api\r\n */\r\nol.interaction.TouchCompass.prototype.setActive = function(b)\r\n{\tol.interaction.Pointer.prototype.setActive.call (this, b);\r\n\tif (this.getMap()) {\r\n\t\ttry { this.getMap().renderSync(); } catch(e) { /* ok */ }\r\n\t}\r\n}\r\n/**\r\n * Get the center of the compass\r\n * @param {_ol_coordinate_}\r\n * @private\r\n */\r\nol.interaction.TouchCompass.prototype.getCenter_ = function()\r\n{\tvar margin = 10;\r\n\tvar s = this.size;\r\n\tvar c = this.getMap().getSize(); \r\n\treturn [c[0]/2, c[1]-margin-s/2];\r\n}\r\n/**\r\n * Draw the compass on post compose\r\n * @private\r\n */\r\nol.interaction.TouchCompass.prototype.drawCompass_ = function(e)\r\n{\tif (!this.getActive()) return;\r\n\tvar ctx = e.context || ol.ext.getMapCanvas(this.getMap()).getContext('2d');\r\n\tvar ratio = e.frameState.pixelRatio;\r\n\tctx.save();\r\n\tctx.scale(ratio,ratio);\r\n\tctx.globalAlpha = this.alpha;\r\n\tctx.strokeStyle = \"#fff\";\r\n\tctx.lineWidth = 5;\r\n\tvar s = this.size;\r\n\tvar c = this.getCenter_();\r\n\tctx.drawImage(this.compass, 0,0,this.compass.width,this.compass.height, c[0]-s/2, c[1]-s/2, s,s);\r\n\tif (this.pos)\r\n\t{\tvar dx = this.pos.pixel[0]-this.start.pixel[0];\r\n\t\tvar dy = this.pos.pixel[1]-this.start.pixel[1];\r\n\t\tfor (var i=1; i<=4; i++)\r\n\t\t{\tctx.beginPath();\r\n\t\t\tctx.arc (c[0] +dx/4*i, c[1] +dy/4*i, s/2*(0.6+0.4*i/4), 0, 2*Math.PI);\r\n\t\t\tctx.stroke();\r\n\t\t}\r\n\t}\r\n\tctx.restore();\r\n\tif (this.pos)\r\n\t{\t// Get delta\r\n\t\tif (this.ondrag_) \r\n\t\t{\tvar r = this.getMap().getView().getResolution();\r\n\t\t\tvar delta = \r\n\t\t\t\t{\tdpixel: [ this.pos.pixel[0] - this.start.pixel[0], this.pos.pixel[1] - this.start.pixel[1] ]\r\n\t\t\t\t}\r\n\t\t\tdelta.traction = [ delta.dpixel[0]*r, -delta.dpixel[1]*r];\r\n\t\t\tthis.ondrag_(delta, this.pos);\r\n\t\t}\r\n\t\t// Continue animation\r\n\t\te.frameState.animate = true;\r\n\t}\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Handle a touch cursor to defer event position on overlay position\r\n * It can be used as abstract base class used for creating subclasses. \r\n * The TouchCursor interaction modifies map browser event coordinate and pixel properties to force pointer on the graphic cursor on the screen to any interaction that them.\r\n * @constructor\r\n * @extends {ol.interaction.DragOverlay}\r\n * @param {olx.interaction.InteractionOptions} options Options\r\n *  @param {string} options.className cursor class name\r\n *  @param {ol.coordinate} options.coordinate position of the cursor\r\n *  @param {Array<*>} options.buttons an array of buttons\r\n *  @param {number} options.maxButtons maximum number of buttons (default 5)\r\n */\r\nol.interaction.TouchCursor = function(options) {\r\n  options = options || {};\r\n  // List of listerner on the object\r\n  this._listeners = {};\r\n  // Interaction to defer position on top of the interaction \r\n  // this is done to enable other coordinates manipulation inserted after the interaction (snapping)\r\n  var offset = [-35,-35];\r\n  this.ctouch = new ol.interaction.Interaction({\r\n    handleEvent: function(e) {\r\n      if (!/drag/.test(e.type) && this.getMap()) {\r\n        e.coordinate = this.overlay.getPosition();\r\n        e.pixel = this.getMap().getPixelFromCoordinate(e.coordinate);\r\n        this._lastEvent = e;\r\n      } else {\r\n        var res = e.frameState.viewState.resolution\r\n        var cosa = Math.cos(e.frameState.viewState.rotation);\r\n        var sina = Math.sin(e.frameState.viewState.rotation);\r\n        e.coordinate = [\r\n          e.coordinate[0] + cosa*offset[0]*res + sina*offset[1]*res, \r\n          e.coordinate[1] + sina*offset[0]*res - cosa*offset[1]*res\r\n        ];\r\n        e.pixel = this.getMap().getPixelFromCoordinate(e.coordinate);\r\n      }\r\n      return true; \r\n    }.bind(this)\r\n  });\r\n  // Force interaction on top\r\n  this.ctouch.set('onTop', true);\r\n  // Add Overlay\r\n  this.overlay = new ol.Overlay.Fixed({\r\n    className: ('ol-touch-cursor '+(options.className||'')).trim(),\r\n    positioning: 'top-left',\r\n    element: ol.ext.element.create('DIV', {}),\r\n    stopEvent: false,\r\n  });\r\n  ol.interaction.DragOverlay.call(this, {\r\n    centerOnClick: false,\r\n    //offset: [-20,-20],\r\n    overlays: this.overlay\r\n  });\r\n  this.setPosition(options.coordinate, true);\r\n  this.set('maxButtons', options.maxButtons || 5);\r\n  if (options.buttons) {\r\n    if (options.buttons.length > this.get('maxButtons')) this.set('maxButtons', options.buttons.length);\r\n    var elt = this.overlay.element;\r\n    var begin = options.buttons.length > 4 ? 0 : 1;\r\n    options.buttons.forEach((function (b, i) {\r\n      if (i<5) {\r\n        ol.ext.element.create('DIV', {\r\n          className: ((b.className||'')+' ol-button ol-button-' + (i+begin)).trim(),\r\n          html: ol.ext.element.create('DIV', { html: b.html }),\r\n          click: b.click,\r\n          on: b.on,\r\n          parent: elt\r\n        })\r\n      }\r\n    }))\r\n  }\r\n  // Replace events to handle click\r\n  var dragging = false;\r\n  var start = false;\r\n  this.on('dragstart', function (e) {\r\n    this._pixel = this.getMap().getPixelFromCoordinate(this.overlay.getPosition())\r\n    start = e;\r\n    return !e.overlay;\r\n  })\r\n  this.on('dragend', function (e) {\r\n    this._pixel = this.getMap().getPixelFromCoordinate(this.overlay.getPosition())\r\n    if (!e.overlay) return true;\r\n    if (dragging) {\r\n      this.dispatchEvent({\r\n        type: 'dragend', \r\n        dragging: dragging,\r\n        originalEvent: e.originalEvent, \r\n        frameState: e.frameState,\r\n        pixel: this._pixel,\r\n        coordinate: this.overlay.getPosition() \r\n      });\r\n      dragging = false;\r\n    } else {\r\n      if (e.originalEvent.target === this.overlay.element) {\r\n        this.dispatchEvent({ \r\n          type: 'click', \r\n          dragging: dragging,\r\n          originalEvent: e.originalEvent, \r\n          frameState: e.frameState,\r\n          pixel: this._pixel,\r\n          coordinate: this.overlay.getPosition() \r\n        });\r\n      }\r\n    }\r\n    return false;\r\n  }.bind(this))\r\n  this.on('dragging', function (e) {\r\n    this._pixel = this.getMap().getPixelFromCoordinate(this.overlay.getPosition());\r\n    if (!e.overlay) return true;\r\n    dragging = true;\r\n    if (start) {\r\n      this.dispatchEvent({ \r\n        type: 'dragstart', \r\n        dragging: dragging,\r\n        originalEvent: start.originalEvent, \r\n        frameState: e.frameState,\r\n        pixel: this._pixel,\r\n        coordinate: start.coordinate\r\n      });\r\n      start = false;\r\n    }\r\n    this.dispatchEvent({ \r\n      type: 'dragging', \r\n      dragging: dragging,\r\n      originalEvent: e.originalEvent, \r\n      frameState: e.frameState,\r\n      pixel: this._pixel,\r\n      coordinate: this.overlay.getPosition() \r\n    });\r\n    return false;\r\n  }.bind(this))\r\n};\r\nol.ext.inherits(ol.interaction.TouchCursor, ol.interaction.DragOverlay);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {_ol_Map_} map Map.\r\n * @api stable\r\n */\r\nol.interaction.TouchCursor.prototype.setMap = function(map) {\r\n  // Reset\r\n  if (this.getMap()) {\r\n    this.getMap().removeInteraction(this.ctouch);\r\n    if (this.getActive()) this.getMap().removeOverlay(this.overlay);\r\n  }\r\n  for (var l in this._listeners) {\r\n    ol.Observable.unByKey(this._listeners[l]);\r\n  }\r\n  this._listeners = {};\r\n  ol.interaction.DragOverlay.prototype.setMap.call (this, map);\r\n  // Set listeners\r\n  if (map) {\r\n    if (this.getActive()) {\r\n      map.addOverlay(this.overlay);\r\n      setTimeout( function() {\r\n        this.setPosition(this.getPosition() || map.getView().getCenter());\r\n      }.bind(this));\r\n    }\r\n    map.addInteraction(this.ctouch);\r\n    this._listeners.addInteraction = map.getInteractions().on('add', function(e) {\r\n      // Move on top\r\n      if (!e.element.get('onTop')) {\r\n        map.removeInteraction(this.ctouch);\r\n        map.addInteraction(this.ctouch);\r\n      }\r\n    }.bind(this));\r\n  }\r\n};\r\n/**\r\n * Activate or deactivate the interaction.\r\n * @param {boolean} active Active.\r\n * @param {ol.coordinate|null} position position of the cursor (when activating), default viewport center.\r\n * @observable\r\n * @api\r\n */\r\nol.interaction.TouchCursor.prototype.setActive = function(b, position) {\r\n  if (b!==this.getActive()) {\r\n    this.ctouch.setActive(b);\r\n    if (!b) {\r\n      this.setPosition();\r\n      this.overlay.element.classList.remove('active');\r\n      if (this._activate) clearTimeout(this._activate);\r\n      if (this.getMap()) this.getMap().removeOverlay(this.overlay);\r\n    } else {\r\n      if (this.getMap()) {\r\n        this.getMap().addOverlay(this.overlay);\r\n      }\r\n      if (position) {\r\n        this.setPosition(position);\r\n      } else if (this.getMap()) {\r\n        this.setPosition(this.getMap().getView().getCenter());\r\n      }\r\n      this._activate = setTimeout(function() {\r\n        this.overlay.element.classList.add('active');\r\n      }.bind(this), 100);\r\n    }\r\n    ol.interaction.DragOverlay.prototype.setActive.call (this, b);\r\n  } else if (position) {\r\n    this.setPosition(position);\r\n  } else if (this.getMap()) {\r\n    this.setPosition(this.getMap().getView().getCenter());\r\n  }\r\n};\r\n/** Set the position of the target\r\n * @param {ol.coordinate} coord\r\n */\r\nol.interaction.TouchCursor.prototype.setPosition = function (coord) {\r\n  this.overlay.setPosition(coord, true); \r\n  if (this.getMap() && coord) {\r\n    this._pixel = this.getMap().getPixelFromCoordinate(coord);\r\n  }\r\n};\r\n/** Offset the target position\r\n * @param {ol.coordinate} coord\r\n */\r\nol.interaction.TouchCursor.prototype.offsetPosition = function (coord) {\r\n  var pos = this.overlay.getPosition();\r\n  if (pos) this.overlay.setPosition([pos[0]+coord[0], pos[1]+coord[1]]); \r\n};\r\n/** Get the position of the target\r\n * @return {ol.coordinate}\r\n */\r\nol.interaction.TouchCursor.prototype.getPosition = function () {\r\n  return this.overlay.getPosition(); \r\n};\r\n/** Get pixel position\r\n * @return {ol.pixel}\r\n */\r\nol.interaction.TouchCursor.prototype.getPixel = function () {\r\n  if (this.getMap()) return this.getMap().getPixelFromCoordinate(this.getPosition());\r\n};\r\n/** Get cursor overlay\r\n * @return {ol.Overlay}\r\n */\r\nol.interaction.TouchCursor.prototype.getOverlay = function () {\r\n  return this.overlay; \r\n};\r\n/** Get cursor overlay element\r\n * @return {Element}\r\n */\r\nol.interaction.TouchCursor.prototype.getOverlayElement = function () {\r\n  return this.overlay.element; \r\n};\r\n/** Get cursor button element\r\n * @param {string|number} button the button className or the button index\r\n * @return {Element}\r\n */\r\nol.interaction.TouchCursor.prototype.getButtonElement = function (button) {\r\n  if (typeof(button) === 'number') return this.getOverlayElement().getElementsByClassName('ol-button')[button];\r\n  return this.getOverlayElement().getElementsByClassName(button)[0];\r\n};\r\n/** Remove a button element\r\n * @param {string|number|undefined} button the button className or the button index, if undefined remove all buttons, default remove all\r\n * @return {Element}\r\n */\r\nol.interaction.TouchCursor.prototype.removeButton = function (button) {\r\n  if (button===undefined) {\r\n    var buttons = this.getOverlayElement().getElementsByClassName('ol-button');\r\n    for (var i=buttons.length-1; i>=0; i--) {\r\n      this.getOverlayElement().removeChild(buttons[i]);\r\n    }\r\n  } else {\r\n    var elt = this.getButtonElement(button);\r\n    if (elt) this.getOverlayElement().removeChild(elt);\r\n  }\r\n};\r\n/** Add a button element\r\n * @param {*} button\r\n *  @param {string} options.className button class name\r\n *  @param {DOMElement|string} options.html button content\r\n *  @param {function} options.click onclick function\r\n *  @param {*} options.on an object with \r\n *  @param {boolean} options.before\r\n */\r\nol.interaction.TouchCursor.prototype.addButton = function (b) {\r\n  var buttons = this.getOverlayElement().getElementsByClassName('ol-button');\r\n  var max = (this.get('maxButtons') || 5);\r\n  if (buttons.length >= max) {\r\n    console.error('[ol/interaction/TouchCursor~addButton] too many button on the cursor (max='+max+')...')\r\n    return;\r\n  } \r\n  var button = ol.ext.element.create('DIV', {\r\n    className: ((b.className||'')+' ol-button').trim(),\r\n    html: ol.ext.element.create('DIV', { html: b.html }),\r\n    click: b.click,\r\n    on: b.on\r\n  });\r\n  if (!b.before || buttons.length===0) this.getOverlayElement().appendChild(button);\r\n  else this.getOverlayElement().insertBefore(button, buttons[0]);\r\n  // Reorder buttons\r\n  var start = buttons.length >= max ? 0 : 1;\r\n  for (var i=0; i<buttons.length; i++) {\r\n    buttons[i].className = buttons[i].className.replace(/ol-button-\\d/g, '').trim() + ' ol-button-' + (i+start);\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** TouchCursor interaction + ModifyFeature\r\n * @constructor\r\n * @extends {ol.interaction.TouchCursor}\r\n * @fires drawend\r\n * @fires change:type\r\n * @param {olx.interaction.InteractionOptions} options Options\r\n *  @param {string} options.className cursor class name\r\n *  @param {ol.coordinate} options.coordinate cursor position\r\n *  @param {string} options.type geometry type\r\n *  @param {Array<string>} options.types geometry types avaliable, default none\r\n *  @param {ol.source.Vector} options.source Destination source for the drawn features\r\n *  @param {ol.Collection<ol.Feature>} options.features Destination collection for the drawn features\r\n *  @param {number} options.clickTolerance The maximum distance in pixels for \"click\" event to add a point/vertex to the geometry being drawn. default 6\r\n *  @param {number} options.snapTolerance Pixel distance for snapping to the drawing finish, default 12\r\n *  @param {number} options.maxPoints The number of points that can be drawn before a polygon ring or line string is finished. By default there is no restriction.\r\n *  @param {number} options.minPoints The number of points that must be drawn before a polygon ring or line string can be finished. Default is 3 for polygon rings and 2 for line strings.\r\n *  @param {ol.style.Style} options.style Style for sketch features.\r\n *  @param {function} options.geometryFunction Function that is called when a geometry's coordinates are updated.\r\n *  @param {string} options.geometryName Geometry name to use for features created by the draw interaction.\r\n *  @param {boolean} options.wrapX Wrap the world horizontally on the sketch overlay, default false\r\n */\r\nol.interaction.TouchCursorDraw = function(options) {\r\n  options = options || {};\r\n  // Draw \r\n  var sketch = this.sketch = new ol.layer.SketchOverlay({\r\n    type: options.type\r\n  });\r\n  sketch.on('drawend', function(e) {\r\n    if (e.valid && options.source) options.source.addFeature(e.feature);\r\n    this.getOverlayElement().classList.add('nodrawing');\r\n    this.dispatchEvent(e);\r\n  }.bind(this));\r\n  sketch.on('drawstart', function(e) {\r\n    this.getOverlayElement().classList.remove('nodrawing');\r\n    this.dispatchEvent(e);\r\n  }.bind(this));\r\n  sketch.on('drawabort', function(e) {\r\n    this.getOverlayElement().classList.add('nodrawing');\r\n    this.dispatchEvent(e);\r\n  }.bind(this));\r\n  // Create cursor\r\n  ol.interaction.TouchCursor.call(this, {\r\n    className: options.className,\r\n    coordinate: options.coordinate,\r\n  });\r\n  this.getOverlayElement().classList.add('nodrawing');\r\n  this.set('types', options.types);\r\n  this.setType(options.type);\r\n  this.on('click', function() {\r\n    this.sketch.addPoint(this.getPosition());\r\n  }.bind(this))\r\n  this.on('dragging', function() {\r\n    this.sketch.setPosition(this.getPosition());\r\n  }.bind(this))\r\n};\r\nol.ext.inherits(ol.interaction.TouchCursorDraw, ol.interaction.TouchCursor);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {_ol_Map_} map Map.\r\n * @api stable\r\n */\r\nol.interaction.TouchCursorDraw.prototype.setMap = function(map) {\r\n  ol.interaction.TouchCursor.prototype.setMap.call (this, map);\r\n  this.sketch.setMap(map);\r\n  if (map) {\r\n    this._listeners.movend = map.on('moveend', function() {\r\n      this.sketch.setPosition(this.getPosition())\r\n    }.bind(this))\r\n  }\r\n};\r\n/**\r\n * Activate or deactivate the interaction.\r\n * @param {boolean} active Active.\r\n * @param {ol.coordinate|null} position position of the cursor (when activating), default viewport center.\r\n * @observable\r\n * @api\r\n */\r\nol.interaction.TouchCursorDraw.prototype.setActive = function(b, position) {\r\n  ol.interaction.TouchCursor.prototype.setActive.call (this, b, position);\r\n  this.sketch.abortDrawing();\r\n  this.sketch.setPosition(position);\r\n  this.sketch.setVisible(b);\r\n};\r\n/**\r\n * Set Geometry type\r\n * @param {string} type Geometry type\r\n */\r\nol.interaction.TouchCursorDraw.prototype.setType = function(type) {\r\n  this.removeButton();\r\n  var sketch = this.sketch;\r\n  this.getOverlayElement().classList.remove(sketch.getGeometryType());\r\n  // Set type\r\n  var oldValue = sketch.setGeometryType();\r\n  type = sketch.setGeometryType(type);\r\n  this.getOverlayElement().classList.add(type);\r\n  this.dispatchEvent({\r\n    type: 'change:type',\r\n    oldValue: oldValue\r\n  });\r\n  // Next type\r\n  var types = this.get('types');\r\n  if (types && types.length) {\r\n    var next = types[(types.indexOf(type) + 1) % types.length];\r\n    this.addButton({\r\n      className: 'ol-button-type '+next, \r\n      click: function() {\r\n        this.setType(next)\r\n      }.bind(this)\r\n    });\r\n  }\r\n  // Add buttons\r\n  if (type !== 'Point') {\r\n    // Cancel drawing\r\n    this.addButton({\r\n      className: 'ol-button-x', \r\n      click: function() {\r\n        sketch.abortDrawing();\r\n      }\r\n    });\r\n    if (type !== 'Circle') {\r\n      // Add a new point (nothing to do, just click)\r\n      this.addButton({ \r\n        className: 'ol-button-check',\r\n        click: function() {\r\n          sketch.finishDrawing(true);\r\n        }\r\n      });\r\n      // Remove last point\r\n      this.addButton({  \r\n        className: 'ol-button-remove', \r\n        click: function() {\r\n          sketch.removeLastPoint();\r\n        }\r\n      });\r\n    }\r\n  }\r\n};\r\n/** Get geometry type\r\n */\r\nol.interaction.TouchCursorDraw.prototype.getType = function() {\r\n  return this.sketch.getGeometryType();\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** TouchCursor interaction + ModifyFeature\r\n * @constructor\r\n * @extends {ol.interaction.TouchCursor}\r\n * @param {olx.interaction.InteractionOptions} options Options\r\n *  @param {string} options.className cursor class name\r\n *  @param {ol.coordinate} options.coordinate cursor position\r\n *\t@param {ol.source.Vector} options.source a source to modify (configured with useSpatialIndex set to true)\r\n *\t@param {ol.source.Vector|Array<ol.source.Vector>} options.sources a list of source to modify (configured with useSpatialIndex set to true)\r\n *  @param {ol.Collection.<ol.Feature>} options.features collection of feature to modify\r\n *  @param {function|undefined} options.filter a filter that takes a feature and return true if it can be modified, default always true.\r\n *  @param {number} pixelTolerance Pixel tolerance for considering the pointer close enough to a segment or vertex for editing, default 10\r\n *  @param {ol.style.Style | Array<ol.style.Style> | undefined} options.style Style for the sketch features.\r\n *  @param {boolean} options.wrapX Wrap the world horizontally on the sketch overlay, default false\r\n */\r\nol.interaction.TouchCursorModify = function(options) {\r\n  options = options || {};\r\n  var drag = false;       // enable drag\r\n  var dragging = false;   // dragging a point\r\n  var del = false;        // deleting a point\r\n  // Modify interaction\r\n  var mod = this._modify = new ol.interaction.ModifyFeature ({ \r\n    source: options.source,\r\n    sources: options.sources,\r\n    features: options.features,\r\n    pixelTolerance: options.pixelTolerance,\r\n    filter: options.filter,\r\n    style: options.style || [ \r\n      new ol.style.Style({\r\n        image: new ol.style.RegularShape ({\r\n          points: 4,\r\n          radius: 10,\r\n          radius2: 0,\r\n          stroke: new ol.style.Stroke({\r\n            color: [255,255,255, .5],\r\n            width: 3\r\n          })\r\n        })\r\n      }),\r\n      new ol.style.Style({\r\n        image: new ol.style.RegularShape ({\r\n          points: 4,\r\n          radius: 10,\r\n          radius2: 0,\r\n          stroke: new ol.style.Stroke({\r\n            color: [0, 153, 255, 1],\r\n            width: 1.25\r\n          })\r\n        })\r\n      })\r\n    ],\r\n    wrapX: options.wrapX,\r\n    condition: function(e) {\r\n      return e.dragging || dragging;\r\n    },\r\n    deleteCondition: function() {\r\n      return del;\r\n    }\r\n  });\r\n  ol.interaction.TouchCursor.call(this, {\r\n    className: ('disable '+options.className).trim(),\r\n    coordinate: options.coordinate,\r\n    buttons: [{\r\n        // Dragging button\r\n        className: 'ol-button-move', \r\n        on: { \r\n          pointerdown: function() { drag = true; },\r\n          pointerup: function() { drag = false; }\r\n        }\r\n      }, { \r\n        // Add a new point to a line\r\n        className: 'ol-button-add', \r\n        click: function() { \r\n          dragging = true;\r\n          mod.handleDownEvent(this._lastEvent);\r\n          mod.handleUpEvent(this._lastEvent);\r\n          dragging = false;\r\n        }.bind(this)\r\n      }, { \r\n        // Remove a point\r\n        className: 'ol-button-remove', \r\n        click: function() { \r\n          del = true;\r\n          mod.handleDownEvent(this._lastEvent); \r\n          del = false;\r\n        }.bind(this)\r\n      }\r\n    ]\r\n  });\r\n  // Show when modification is active\r\n  mod.on('select', function(e) {\r\n    if (e.selected.length) {\r\n      this.getOverlayElement().classList.remove('disable')\r\n    } else {\r\n      this.getOverlayElement().classList.add('disable')\r\n    }\r\n  }.bind(this));\r\n  // Handle dragging, prevent drag outside the control\r\n  this.on('dragstart', function() {\r\n    if (drag) {\r\n      mod.handleDownEvent(this._lastEvent);\r\n    }\r\n  }.bind(this));\r\n  this.on('dragging', function(e) {\r\n    if (drag) mod.handleDragEvent(e);\r\n  });\r\n  this.on('dragend', function(e) {\r\n    mod.handleUpEvent(e);\r\n    drag = false;\r\n  });\r\n};\r\nol.ext.inherits(ol.interaction.TouchCursorModify, ol.interaction.TouchCursor);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {_ol_Map_} map Map.\r\n * @api stable\r\n */\r\nol.interaction.TouchCursorModify.prototype.setMap = function(map) {\r\n  if (this.getMap()) {\r\n    this.getMap().removeInteraction(this._modify);\r\n  }\r\n  if (map) {\r\n    map.addInteraction(this._modify);\r\n  }\r\n  ol.interaction.TouchCursor.prototype.setMap.call (this, map);\r\n};\r\n/**\r\n * Activate or deactivate the interaction.\r\n * @param {boolean} active Active.\r\n * @param {ol.coordinate|null} position position of the cursor (when activating), default viewport center.\r\n * @observable\r\n * @api\r\n */\r\nol.interaction.TouchCursorModify.prototype.setActive = function(b, position) {\r\n  ol.interaction.TouchCursor.prototype.setActive.call (this, b, position);\r\n  this._modify.setActive(b);\r\n};\r\n/**\r\n * Get the modify interaction.\r\n * @retunr {ol.interaction.ModifyFeature} \r\n * @observable\r\n * @api\r\n */\r\nol.interaction.TouchCursorModify.prototype.getInteraction = function() {\r\n  return this._modify;\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A TouchCursor to select objects on hovering the cursor\r\n * @constructor\r\n * @extends {ol.interaction.DragOverlay}\r\n * @param {olx.interaction.InteractionOptions} options Options\r\n *  @param {string} options.className cursor class name\r\n *  @param {ol.coordinate} options.coordinate position of the cursor\r\n */\r\nol.interaction.TouchCursorSelect = function(options) {\r\n  options = options || {};\r\n  ol.interaction.TouchCursor.call(this, {\r\n    className: 'ol-select '+(options.className || ''),\r\n    coordinate: options.coordinate\r\n  });\r\n  this._selection = null;\r\n  this._layerFilter = options.layerFilter;\r\n  this._filter = options.filter;\r\n  this._style = options.style || ol.style.Style.defaultStyle(true);\r\n  this.set('hitTolerance', options.hitTolerance || 0);\r\n  this.on(['change:active', 'dragging'], function() { this.select() });\r\n};\r\nol.ext.inherits(ol.interaction.TouchCursorSelect, ol.interaction.TouchCursor);\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {_ol_Map_} map Map.\r\n * @api stable\r\n */\r\nol.interaction.TouchCursorSelect.prototype.setMap = function(map) {\r\n  ol.interaction.TouchCursor.prototype.setMap.call (this, map);\r\n  if (map) {\r\n    // Select on move end\r\n    this._listeners.movend = map.on('moveend', function() {\r\n      this.select()\r\n    }.bind(this))\r\n  }\r\n};\r\n/** Get current selection\r\n * @return {ol.Feature|null}\r\n */\r\nol.interaction.TouchCursorSelect.prototype.getSelection = function() {\r\n  return this._selection ? this._selection.feature : null;\r\n};\r\n/** Set position\r\n * @param {ol.coordinate} coord\r\n */\r\nol.interaction.TouchCursorSelect.prototype.setPosition = function(coord) {\r\n  ol.interaction.TouchCursor.prototype.setPosition.call (this, coord);\r\n  this.select();\r\n};\r\n/** Select feature \r\n * @param {ol.Feature|undefined} f a feature to select or select at the cursor position\r\n */\r\nol.interaction.TouchCursorSelect.prototype.select = function(f) {\r\n  var current = this._selection;\r\n  if (this.getActive() && this.getPosition()) {\r\n    if (!f) {\r\n      var sel = this.getMap().getFeaturesAtPixel(this.getPixel(), {\r\n        layerFilter: this._layerFilter,\r\n        filter: this._filter,\r\n        hitTolerance: this.get('hitTolerance')\r\n      });\r\n      f = sel ? sel[0] : null;\r\n    }\r\n    if (f) {\r\n      if (current && f === current.feature) {\r\n        current = null;\r\n      } else {\r\n        this._selection = {\r\n          feature: f,\r\n          style: f.getStyle()\r\n        }\r\n        f.setStyle(this._style);\r\n        this.dispatchEvent({ type:'select', selected: [f], deselected: current ? [current.feature] : [] });\r\n      }\r\n    } else {\r\n      this._selection = null;\r\n      this.dispatchEvent({ type:'select', selected: [], deselected: current ? [current.feature] : [] });\r\n    }\r\n  } else {\r\n    this._selection = null;\r\n    this.dispatchEvent({ type:'select', selected: [], deselected: current ? [current.feature] : [] });\r\n  }\r\n  // Restore current style\r\n  if (current) {\r\n    current.feature.setStyle(current.style);\r\n  }\r\n  // \r\n  if (this._selection) this.getOverlayElement().classList.remove('disable');\r\n  else this.getOverlayElement().classList.add('disable');\r\n};\r\n\r\n/** Interaction rotate\r\n * @constructor\r\n * @extends {ol.interaction.Pointer}\r\n * @fires select | rotatestart | rotating | rotateend | translatestart | translating | translateend | scalestart | scaling | scaleend\r\n * @param {any} options\r\n *  @param {function} options.filter A function that takes a Feature and a Layer and returns true if the feature may be transformed or false otherwise.\r\n *  @param {Array<ol.Layer>} options.layers array of layers to transform,\r\n *  @param {ol.Collection<ol.Feature>} options.features collection of feature to transform,\r\n *\t@param {ol.EventsConditionType|undefined} options.condition A function that takes an ol.MapBrowserEvent and a feature collection and returns a boolean to indicate whether that event should be handled. default: ol.events.condition.always.\r\n *\t@param {ol.EventsConditionType|undefined} options.addCondition A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled ie. the feature will be added to the transforms features. default: ol.events.condition.never.\r\n *\t@param {number | undefined} options.hitTolerance Tolerance to select feature in pixel, default 0\r\n *\t@param {bool} options.translateFeature Translate when click on feature\r\n *\t@param {bool} options.translate Can translate the feature\r\n *  @param {bool} options.translateBBox Enable translate when the user drags inside the bounding box\r\n *\t@param {bool} options.stretch can stretch the feature\r\n *\t@param {bool} options.scale can scale the feature\r\n *\t@param {bool} options.rotate can rotate the feature\r\n *\t@param {bool} options.noFlip prevent the feature geometry to flip, default false\r\n *\t@param {bool} options.selection the intraction handle selection/deselection, if not use the select prototype to add features to transform, default true\r\n *\t@param {ol.events.ConditionType | undefined} options.keepAspectRatio A function that takes an ol.MapBrowserEvent and returns a boolean to keep aspect ratio, default ol.events.condition.shiftKeyOnly.\r\n *\t@param {ol.events.ConditionType | undefined} options.modifyCenter A function that takes an ol.MapBrowserEvent and returns a boolean to apply scale & strech from the center, default ol.events.condition.metaKey or ol.events.condition.ctrlKey.\r\n *\t@param {boolean} options.enableRotatedTransform Enable transform when map is rotated\r\n *\t@param {boolean} [options.keepRectangle=false] keep rectangle when possible\r\n *\t@param {} options.style list of ol.style for handles\r\n *\r\n */\r\nol.interaction.Transform = function(options) {\r\n  if (!options) options = {};\r\n\tvar self = this;\r\n  this.selection_ = new ol.Collection();\r\n\t// Create a new overlay layer for the sketch\r\n\tthis.handles_ = new ol.Collection();\r\n\tthis.overlayLayer_ = new ol.layer.Vector({\r\n    source: new ol.source.Vector({\r\n      features: this.handles_,\r\n      useSpatialIndex: false,\r\n      wrapX: false // For vector editing across the -180° and 180° meridians to work properly, this should be set to false\r\n    }),\r\n    name:'Transform overlay',\r\n    displayInLayerSwitcher: false,\r\n    // Return the style according to the handle type\r\n    style: function (feature) {\r\n      return (self.style[(feature.get('handle')||'default')+(feature.get('constraint')||'')+(feature.get('option')||'')]);\r\n    },\r\n  });\r\n  // Extend pointer\r\n  ol.interaction.Pointer.call(this, {\r\n    handleDownEvent: this.handleDownEvent_,\r\n    handleDragEvent: this.handleDragEvent_,\r\n    handleMoveEvent: this.handleMoveEvent_,\r\n    handleUpEvent: this.handleUpEvent_\r\n  });\r\n  // Collection of feature to transform\r\n  this.features_ = options.features;\r\n  // Filter or list of layers to transform\r\n  if (typeof(options.filter)==='function') this._filter = options.filter;\r\n  this.layers_ = options.layers ? (options.layers instanceof Array) ? options.layers:[options.layers] : null;\r\n  this._handleEvent = options.condition || function() { return true; };\r\n  this.addFn_ = options.addCondition || function() { return false; };\r\n  /* Translate when click on feature */\r\n  this.set('translateFeature', (options.translateFeature!==false));\r\n  /* Can translate the feature */\r\n  this.set('translate', (options.translate!==false));\r\n  /* Translate when click on the bounding box */\r\n  this.set('translateBBox', (options.translateBBox===true));\r\n  /* Can stretch the feature */\r\n  this.set('stretch', (options.stretch!==false));\r\n  /* Can scale the feature */\r\n  this.set('scale', (options.scale!==false));\r\n  /* Can rotate the feature */\r\n  this.set('rotate', (options.rotate!==false));\r\n  /* Keep aspect ratio */\r\n  this.set('keepAspectRatio', (options.keepAspectRatio || function(e){ return e.originalEvent.shiftKey }));\r\n  /* Modify center */\r\n  this.set('modifyCenter', (options.modifyCenter || function(e){ return e.originalEvent.metaKey || e.originalEvent.ctrlKey }));\r\n  /* Prevent flip */\r\n  this.set('noFlip', (options.noFlip || false));\r\n  /* Handle selection */\r\n  this.set('selection', (options.selection !== false));\r\n  /*  */\r\n  this.set('hitTolerance', (options.hitTolerance || 0));\r\n  /* Enable view rotated transforms */\r\n  this.set('enableRotatedTransform', (options.enableRotatedTransform || false));\r\n  /* Keep rectangle angles 90 degrees */\r\n  this.set('keepRectangle', (options.keepRectangle || false));\r\n  // Force redraw when changed\r\n  this.on ('propertychange', function() {\r\n    this.drawSketch_();\r\n  });\r\n  // setstyle\r\n  this.setDefaultStyle();\r\n};\r\nol.ext.inherits(ol.interaction.Transform, ol.interaction.Pointer);\r\n/** Cursors for transform\r\n*/\r\nol.interaction.Transform.prototype.Cursors = {\r\n  'default': 'auto',\r\n  'select': 'pointer',\r\n  'translate': 'move',\r\n  'rotate': 'move',\r\n  'rotate0': 'move',\r\n  'scale': 'nesw-resize',\r\n  'scale1': 'nwse-resize',\r\n  'scale2': 'nesw-resize',\r\n  'scale3': 'nwse-resize',\r\n  'scalev': 'ew-resize',\r\n  'scaleh1': 'ns-resize',\r\n  'scalev2': 'ew-resize',\r\n  'scaleh3': 'ns-resize'\r\n};\r\n/**\r\n * Remove the interaction from its current map, if any,  and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.Transform.prototype.setMap = function(map) {\r\n  var oldMap = this.getMap();\r\n  if (oldMap) {\r\n    var targetElement = oldMap.getTargetElement();\r\n    oldMap.removeLayer(this.overlayLayer_);\r\n    if (this.previousCursor_ && targetElement) {\r\n      targetElement.style.cursor = this.previousCursor_;\r\n    }\r\n    this.previousCursor_ = undefined;\r\n  }\r\n  ol.interaction.Pointer.prototype.setMap.call (this, map);\r\n  this.overlayLayer_.setMap(map);\r\n  if (map === null) {\r\n    this.select(null);\r\n  }\r\n  if (map !== null) {\r\n    this.isTouch = /touch/.test(map.getViewport().className);\r\n    this.setDefaultStyle();\r\n  }\r\n};\r\n/**\r\n * Activate/deactivate interaction\r\n * @param {bool}\r\n * @api stable\r\n */\r\nol.interaction.Transform.prototype.setActive = function(b) {\r\n  this.select(null);\r\n  this.overlayLayer_.setVisible(b);\r\n  ol.interaction.Pointer.prototype.setActive.call (this, b);\r\n};\r\n/** Set default sketch style\r\n * @param {Object|undefined} options\r\n *  @param {ol.style.Stroke} stroke stroke style for selection rectangle\r\n *  @param {ol.style.Fill} fill fill style for selection rectangle\r\n *  @param {ol.style.Stroke} pointStroke stroke style for handles\r\n *  @param {ol.style.Fill} pointFill fill style for handles\r\n */\r\nol.interaction.Transform.prototype.setDefaultStyle = function(options) {\r\n  options = options || {}\r\n  // Style\r\n  var stroke = options.pointStroke || new ol.style.Stroke({ color: [255,0,0,1], width: 1 });\r\n  var strokedash = options.stroke || new ol.style.Stroke({ color: [255,0,0,1], width: 1, lineDash:[4,4] });\r\n  var fill0 = options.fill || new ol.style.Fill({ color:[255,0,0,0.01] });\r\n  var fill = options.pointFill || new ol.style.Fill({ color:[255,255,255,0.8] });\r\n  var circle = new ol.style.RegularShape({\r\n      fill: fill,\r\n      stroke: stroke,\r\n      radius: this.isTouch ? 12 : 6,\r\n      points: 15\r\n    });\r\n  circle.getAnchor()[0] = this.isTouch ? -10 : -5;\r\n  var bigpt = new ol.style.RegularShape({\r\n      fill: fill,\r\n      stroke: stroke,\r\n      radius: this.isTouch ? 16 : 8,\r\n      points: 4,\r\n      angle: Math.PI/4\r\n    });\r\n  var smallpt = new ol.style.RegularShape({\r\n      fill: fill,\r\n      stroke: stroke,\r\n      radius: this.isTouch ? 12 : 6,\r\n      points: 4,\r\n      angle: Math.PI/4\r\n    });\r\n  function createStyle (img, stroke, fill) {\r\n    return [ new ol.style.Style({image:img, stroke:stroke, fill:fill}) ];\r\n  }\r\n  /** Style for handles */\r\n  this.style = {\r\n    'default': createStyle (bigpt, strokedash, fill0),\r\n    'translate': createStyle (bigpt, stroke, fill),\r\n    'rotate': createStyle (circle, stroke, fill),\r\n    'rotate0': createStyle (bigpt, stroke, fill),\r\n    'scale': createStyle (bigpt, stroke, fill),\r\n    'scale1': createStyle (bigpt, stroke, fill),\r\n    'scale2': createStyle (bigpt, stroke, fill),\r\n    'scale3': createStyle (bigpt, stroke, fill),\r\n    'scalev': createStyle (smallpt, stroke, fill),\r\n    'scaleh1': createStyle (smallpt, stroke, fill),\r\n    'scalev2': createStyle (smallpt, stroke, fill),\r\n    'scaleh3': createStyle (smallpt, stroke, fill),\r\n  };\r\n  this.drawSketch_();\r\n}\r\n/**\r\n * Set sketch style.\r\n * @param {style} style Style name: 'default','translate','rotate','rotate0','scale','scale1','scale2','scale3','scalev','scaleh1','scalev2','scaleh3'\r\n * @param {ol.style.Style|Array<ol.style.Style>} olstyle\r\n * @api stable\r\n */\r\nol.interaction.Transform.prototype.setStyle = function(style, olstyle) {\r\n  if (!olstyle) return;\r\n  if (olstyle instanceof Array) this.style[style] = olstyle;\r\n  else this.style[style] = [ olstyle ];\r\n  for (var i=0; i<this.style[style].length; i++) {\r\n    var im = this.style[style][i].getImage();\r\n    if (im) {\r\n      if (style == 'rotate') im.getAnchor()[0] = -5;\r\n      if (this.isTouch) im.setScale(1.8);\r\n    }\r\n    var tx = this.style[style][i].getText();\r\n    if (tx) {\r\n      if (style == 'rotate') tx.setOffsetX(this.isTouch ? 14 : 7);\r\n      if (this.isTouch) tx.setScale(1.8);\r\n    }\r\n  }\r\n  this.drawSketch_();\r\n};\r\n/** Get Feature at pixel\r\n * @param {ol.Pixel}\r\n * @return {ol.feature}\r\n * @private\r\n */\r\nol.interaction.Transform.prototype.getFeatureAtPixel_ = function(pixel) {\r\n  var self = this;\r\n  return this.getMap().forEachFeatureAtPixel(pixel,\r\n    function(feature, layer) {\r\n      var found = false;\r\n      // Overlay ?\r\n      if (!layer) {\r\n        if (feature===self.bbox_) {\r\n          if (self.get('translateBBox')) {\r\n            return { feature: feature, handle: 'translate', constraint:'', option: '' };\r\n          } else {\r\n            return false;\r\n          }\r\n        }\r\n        self.handles_.forEach (function(f) { if (f===feature) found=true; });\r\n        if (found) return { feature: feature, handle:feature.get('handle'), constraint:feature.get('constraint'), option:feature.get('option') };\r\n      }\r\n      // No seletion\r\n      if (!self.get('selection')) {\r\n        // Return the currently selected feature the user is interacting with.\r\n        if (self.selection_.getArray().some(function(f) { return feature === f; })) {\r\n          return { feature: feature };\r\n        }\r\n        return null;\r\n      }\r\n      // filter condition\r\n      if (self._filter) {\r\n        if (self._filter(feature,layer)) return { feature: feature };\r\n        else return null;\r\n      }\r\n      // feature belong to a layer\r\n      else if (self.layers_) {\r\n        for (var i=0; i<self.layers_.length; i++) {\r\n          if (self.layers_[i]===layer) return { feature: feature };\r\n        }\r\n        return null;\r\n      }\r\n      // feature in the collection\r\n      else if (self.features_) {\r\n        self.features_.forEach (function(f) { if (f===feature) found=true; });\r\n        if (found) return { feature: feature };\r\n        else return null;\r\n      }\r\n      // Others\r\n      else return { feature: feature };\r\n    },\r\n    { hitTolerance: this.get('hitTolerance') }\r\n  ) || {};\r\n}\r\n/** Rotate feature from map view rotation\r\n * @param {ol.Feature} f the feature\r\n * @param {boolean} clone clone resulting geom\r\n * @param {ol.geom.Geometry} rotated geometry\r\n */\r\nol.interaction.Transform.prototype.getGeometryRotateToZero_ = function(f, clone) {\r\n  var origGeom = f.getGeometry();\r\n  var viewRotation = this.getMap().getView().getRotation();\r\n  if (viewRotation === 0 || !this.get('enableRotatedTransform')) {\r\n    return (clone) ? origGeom.clone() : origGeom;\r\n  }\r\n  var rotGeom = origGeom.clone();\r\n  rotGeom.rotate(viewRotation * -1, this.getMap().getView().getCenter());\r\n  return rotGeom;\r\n};\r\n/** Test if rectangle\r\n * @param {ol.Geometry} geom\r\n * @returns {boolean}\r\n * @private\r\n */\r\nol.interaction.Transform.prototype._isRectangle = function(geom) {\r\n  if (this.get('keepRectangle') && geom.getType() === 'Polygon') {\r\n    var coords = geom.getCoordinates()[0];\r\n    return coords.length === 5;\r\n  }\r\n  return false;\r\n};\r\n/** Draw transform sketch\r\n* @param {boolean} draw only the center\r\n*/\r\nol.interaction.Transform.prototype.drawSketch_ = function(center) {\r\n  var i, f, geom;\r\n  var keepRectangle = this.selection_.item(0) && this._isRectangle(this.selection_.item(0).getGeometry());\r\n  this.overlayLayer_.getSource().clear();\r\n  if (!this.selection_.getLength()) return;\r\n  var viewRotation = this.getMap().getView().getRotation();\r\n  var ext = this.getGeometryRotateToZero_(this.selection_.item(0)).getExtent();\r\n  var coords;\r\n  if (keepRectangle) {\r\n    coords = this.getGeometryRotateToZero_(this.selection_.item(0)).getCoordinates()[0].slice(0, 4);\r\n    coords.unshift(coords[3]);\r\n  }\r\n  // Clone and extend\r\n  ext = ol.extent.buffer(ext, 0);\r\n  this.selection_.forEach(function (f) {\r\n    var extendExt = this.getGeometryRotateToZero_(f).getExtent();\r\n    ol.extent.extend(ext, extendExt);\r\n  }.bind(this));\r\n  if (center===true) {\r\n    if (!this.ispt_) {\r\n      this.overlayLayer_.getSource().addFeature(new ol.Feature( { geometry: new ol.geom.Point(this.center_), handle:'rotate0' }) );\r\n      geom = ol.geom.Polygon.fromExtent(ext);\r\n      if (this.get('enableRotatedTransform') && viewRotation !== 0) {\r\n        geom.rotate(viewRotation, this.getMap().getView().getCenter())\r\n      }\r\n      f = this.bbox_ = new ol.Feature(geom);\r\n      this.overlayLayer_.getSource().addFeature (f);\r\n    }\r\n  } else {\r\n    if (this.ispt_) {\r\n      // Calculate extent arround the point\r\n      var p = this.getMap().getPixelFromCoordinate([ext[0], ext[1]]);\r\n      if (p) {\r\n        ext = ol.extent.boundingExtent([\r\n          this.getMap().getCoordinateFromPixel([p[0]-10, p[1]-10]),\r\n          this.getMap().getCoordinateFromPixel([p[0]+10, p[1]+10])\r\n        ]);\r\n      }\r\n    }\r\n    geom = keepRectangle ? new ol.geom.Polygon([coords]) : ol.geom.Polygon.fromExtent(ext);\r\n    if (this.get('enableRotatedTransform') && viewRotation !== 0) {\r\n      geom.rotate(viewRotation, this.getMap().getView().getCenter())\r\n    }\r\n    f = this.bbox_ = new ol.Feature(geom);\r\n    var features = [];\r\n    var g = geom.getCoordinates()[0];\r\n    if (!this.ispt_) {\r\n      features.push(f);\r\n      // Middle\r\n      if (!this.iscircle_ && this.get('stretch') && this.get('scale')) for (i=0; i<g.length-1; i++) {\r\n        f = new ol.Feature( { geometry: new ol.geom.Point([(g[i][0]+g[i+1][0])/2,(g[i][1]+g[i+1][1])/2]), handle:'scale', constraint:i%2?\"h\":\"v\", option:i });\r\n        features.push(f);\r\n      }\r\n      // Handles\r\n      if (this.get('scale')) for (i=0; i<g.length-1; i++) {\r\n        f = new ol.Feature( { geometry: new ol.geom.Point(g[i]), handle:'scale', option:i });\r\n        features.push(f);\r\n      }\r\n      // Center\r\n      if (this.get('translate') && !this.get('translateFeature')) {\r\n        f = new ol.Feature( { geometry: new ol.geom.Point([(g[0][0]+g[2][0])/2, (g[0][1]+g[2][1])/2]), handle:'translate' });\r\n        features.push(f);\r\n      }\r\n    }\r\n    // Rotate\r\n    if (!this.iscircle_ && this.get('rotate')) {\r\n      f = new ol.Feature( { geometry: new ol.geom.Point(g[3]), handle:'rotate' });\r\n      features.push(f);\r\n    }\r\n    // Add sketch\r\n    this.overlayLayer_.getSource().addFeatures(features);\r\n  }\r\n};\r\n/** Select a feature to transform\r\n* @param {ol.Feature} feature the feature to transform\r\n* @param {boolean} add true to add the feature to the selection, default false\r\n*/\r\nol.interaction.Transform.prototype.select = function(feature, add) {\r\n  if (!feature) {\r\n    this.selection_.clear();\r\n    this.drawSketch_();\r\n    return;\r\n  }\r\n  if (!feature.getGeometry || !feature.getGeometry()) return;\r\n  // Add to selection\r\n  if (add) {\r\n    this.selection_.push(feature);\r\n  } else {\r\n\tvar index = this.selection_.getArray().indexOf(feature);\r\n\tthis.selection_.removeAt(index);\r\n  }\r\n  this.ispt_ = (this.selection_.getLength()===1 ? (this.selection_.item(0).getGeometry().getType() == \"Point\") : false);\r\n  this.iscircle_ = (this.selection_.getLength()===1 ? (this.selection_.item(0).getGeometry().getType() == \"Circle\") : false);\r\n  this.drawSketch_();\r\n  this.watchFeatures_();\r\n  // select event\r\n  this.dispatchEvent({ type:'select', feature: feature, features: this.selection_ });\r\n};\r\n/** Update the selection collection.\r\n* @param {ol.Collection<ol.Feature>} features the features to transform\r\n*/\r\nol.interaction.Transform.prototype.setSelection = function(features) {\r\n  this.selection_.clear();\r\n  features.forEach(function(feature) {\r\n    this.selection_.push(feature);\r\n  }.bind(this));\r\n  this.ispt_ = (this.selection_.getLength()===1 ? (this.selection_.item(0).getGeometry().getType() == \"Point\") : false);\r\n  this.iscircle_ = (this.selection_.getLength()===1 ? (this.selection_.item(0).getGeometry().getType() == \"Circle\") : false);\r\n  this.drawSketch_();\r\n  this.watchFeatures_();\r\n  // select event\r\n  this.dispatchEvent({ type:'select', features: this.selection_ });\r\n};\r\n/** Watch selected features\r\n * @private\r\n */\r\nol.interaction.Transform.prototype.watchFeatures_ = function() {\r\n  // Listen to feature modification\r\n  if (this._featureListeners) {\r\n    this._featureListeners.forEach(function (l) {\r\n      ol.Observable.unByKey(l)\r\n    });\r\n  }\r\n  this._featureListeners = [];\r\n  this.selection_.forEach(function(f) {\r\n    this._featureListeners.push(\r\n      f.on('change', function() {\r\n        if (!this.isUpdating_) {\r\n          this.drawSketch_();\r\n        }\r\n      }.bind(this))\r\n    );\r\n  }.bind(this));\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} evt Map browser event.\r\n * @return {boolean} `true` to start the drag sequence.\r\n * @private\r\n */\r\nol.interaction.Transform.prototype.handleDownEvent_ = function(evt) {\r\n  if (!this._handleEvent(evt, this.selection_)) return;\r\n  var sel = this.getFeatureAtPixel_(evt.pixel);\r\n  var feature = sel.feature;\r\n  if (this.selection_.getLength()\r\n    && this.selection_.getArray().indexOf(feature) >= 0\r\n    && ((this.ispt_ && this.get('translate')) || this.get('translateFeature'))\r\n  ){\r\n    sel.handle = 'translate';\r\n  }\r\n  if (sel.handle) {\r\n    this.mode_ = sel.handle;\r\n    this.opt_ = sel.option;\r\n    this.constraint_ = sel.constraint;\r\n    // Save info\r\n    var viewRotation = this.getMap().getView().getRotation();\r\n    this.coordinate_ = evt.coordinate;\r\n    this.pixel_ = evt.pixel;\r\n    this.geoms_ = [];\r\n    this.rotatedGeoms_ = [];\r\n    var extent = ol.extent.createEmpty();\r\n    var rotExtent = ol.extent.createEmpty();\r\n    for (var i=0, f; f=this.selection_.item(i); i++) {\r\n      this.geoms_.push(f.getGeometry().clone());\r\n      extent = ol.extent.extend(extent, f.getGeometry().getExtent());\r\n      if (this.get('enableRotatedTransform') && viewRotation !== 0) {\r\n        var rotGeom = this.getGeometryRotateToZero_(f, true);\r\n        this.rotatedGeoms_.push(rotGeom);\r\n        rotExtent = ol.extent.extend(rotExtent, rotGeom.getExtent());\r\n      }\r\n    }\r\n    this.extent_ = (ol.geom.Polygon.fromExtent(extent)).getCoordinates()[0];\r\n    if (this.get('enableRotatedTransform') && viewRotation !== 0) {\r\n      this.rotatedExtent_ = (ol.geom.Polygon.fromExtent(rotExtent)).getCoordinates()[0];\r\n    }\r\n    if (this.mode_==='rotate') {\r\n      this.center_ = this.getCenter() || ol.extent.getCenter(extent);\r\n      // we are now rotating (cursor down on rotate mode), so apply the grabbing cursor\r\n      var element = evt.map.getTargetElement();\r\n      element.style.cursor = this.Cursors.rotate0;\r\n      this.previousCursor_ = element.style.cursor;\r\n    } else {\r\n      this.center_ = ol.extent.getCenter(extent);\r\n    }\r\n    this.angle_ = Math.atan2(this.center_[1]-evt.coordinate[1], this.center_[0]-evt.coordinate[0]);\r\n    this.dispatchEvent({\r\n      type: this.mode_+'start',\r\n      feature: this.selection_.item(0), // backward compatibility\r\n      features: this.selection_,\r\n      pixel: evt.pixel,\r\n      coordinate: evt.coordinate\r\n    });\r\n    return true;\r\n  }\r\n  else if (this.get('selection')) {\r\n    if (feature){\r\n      if (!this.addFn_(evt)) this.selection_.clear();\r\n      var index = this.selection_.getArray().indexOf(feature);\r\n      if (index < 0) this.selection_.push(feature);\r\n      else this.selection_.removeAt(index);\r\n    } else {\r\n      this.selection_.clear();\r\n    }\r\n    this.ispt_ = this.selection_.getLength()===1 ? (this.selection_.item(0).getGeometry().getType() == \"Point\") : false;\r\n    this.iscircle_ = (this.selection_.getLength()===1 ? (this.selection_.item(0).getGeometry().getType() == \"Circle\") : false);\r\n    this.drawSketch_();\r\n    this.watchFeatures_();\r\n    this.dispatchEvent({ type:'select', feature: feature, features: this.selection_, pixel: evt.pixel, coordinate: evt.coordinate });\r\n    return false;\r\n  }\r\n};\r\n/**\r\n * Get features to transform\r\n * @return {ol.Collection<ol.Feature>}\r\n */\r\nol.interaction.Transform.prototype.getFeatures = function() {\r\n  return this.selection_;\r\n};\r\n/**\r\n * Get the rotation center\r\n * @return {ol.coordinates|undefined}\r\n */\r\nol.interaction.Transform.prototype.getCenter = function() {\r\n  return this.get('center');\r\n};\r\n/**\r\n * Set the rotation center\r\n * @param {ol.coordinates|undefined} c the center point, default center on the objet\r\n */\r\nol.interaction.Transform.prototype.setCenter = function(c) {\r\n  return this.set('center', c);\r\n}\r\nfunction projectVectorOnVector(displacement_vector, base) {\r\n  var k = (displacement_vector[0] * base[0] + displacement_vector[1] * base[1]) / (base[0] * base[0] + base[1] * base[1]);\r\n  return [base[0] * k, base[1] * k];\r\n}\r\nfunction countVector(start, end) {\r\n  return [end[0] - start[0], end[1] - start[1]];\r\n}\r\nfunction movePoint(point, displacementVector) {\r\n  return [point[0]+displacementVector[0], point[1]+displacementVector[1]];\r\n}\r\n/**\r\n * @param {ol.MapBrowserEvent} evt Map browser event.\r\n * @private\r\n */\r\nol.interaction.Transform.prototype.handleDragEvent_ = function(evt) {\r\n  if (!this._handleEvent(evt, this.features_)) return;\r\n  var viewRotation = this.getMap().getView().getRotation();\r\n  var i, j, f, geometry;\r\n  var pt0 = [this.coordinate_[0], this.coordinate_[1]];\r\n  var pt = [evt.coordinate[0], evt.coordinate[1]];\r\n  this.isUpdating_ = true;\r\n  switch (this.mode_) {\r\n    case 'rotate': {\r\n      var a = Math.atan2(this.center_[1]-pt[1], this.center_[0]-pt[0]);\r\n      if (!this.ispt) {\r\n        // var geometry = this.geom_.clone();\r\n        // geometry.rotate(a-this.angle_, this.center_);\r\n        // this.feature_.setGeometry(geometry);\r\n        for (i=0, f; f=this.selection_.item(i); i++) {\r\n          geometry = this.geoms_[i].clone();\r\n          geometry.rotate(a - this.angle_, this.center_);\r\n          // bug: ol, bad calculation circle geom extent\r\n          if (geometry.getType() == 'Circle') geometry.setCenterAndRadius(geometry.getCenter(), geometry.getRadius());\r\n          f.setGeometry(geometry);\r\n        }\r\n      }\r\n      this.drawSketch_(true);\r\n      this.dispatchEvent({\r\n        type:'rotating',\r\n        feature: this.selection_.item(0),\r\n        features: this.selection_,\r\n        angle: a-this.angle_,\r\n        pixel: evt.pixel,\r\n        coordinate: evt.coordinate\r\n      });\r\n      break;\r\n    }\r\n    case 'translate': {\r\n      var deltaX = pt[0] - pt0[0];\r\n      var deltaY = pt[1] - pt0[1];\r\n      //this.feature_.getGeometry().translate(deltaX, deltaY);\r\n      for (i=0, f; f=this.selection_.item(i); i++) {\r\n        f.getGeometry().translate(deltaX, deltaY);\r\n      }\r\n      this.handles_.forEach(function(f) {\r\n        f.getGeometry().translate(deltaX, deltaY);\r\n      });\r\n      this.coordinate_ = evt.coordinate;\r\n      this.dispatchEvent({\r\n        type:'translating',\r\n        feature: this.selection_.item(0),\r\n        features: this.selection_,\r\n        delta:[deltaX,deltaY],\r\n        pixel: evt.pixel,\r\n        coordinate: evt.coordinate\r\n      });\r\n      break;\r\n    }\r\n    case 'scale': {\r\n      var center = this.center_;\r\n      if (this.get('modifyCenter')(evt)) {\r\n        var extentCoordinates = this.extent_;\r\n        if (this.get('enableRotatedTransform') && viewRotation !== 0) {\r\n          extentCoordinates = this.rotatedExtent_;\r\n        }\r\n        center = extentCoordinates[(Number(this.opt_)+2)%4];\r\n      }\r\n      var keepRectangle = (this.geoms_.length == 1 && this._isRectangle(this.geoms_[0]));\r\n      var stretch = this.constraint_;\r\n      var opt = this.opt_;\r\n      var downCoordinate = this.coordinate_;\r\n      var dragCoordinate = evt.coordinate;\r\n      if (this.get('enableRotatedTransform') && viewRotation !== 0) {\r\n        var downPoint = new ol.geom.Point(this.coordinate_);\r\n        downPoint.rotate(viewRotation * -1, center);\r\n        downCoordinate = downPoint.getCoordinates();\r\n        var dragPoint = new ol.geom.Point(evt.coordinate);\r\n        dragPoint.rotate(viewRotation * -1, center);\r\n        dragCoordinate = dragPoint.getCoordinates();\r\n      }\r\n      var scx = ((dragCoordinate)[0] - (center)[0]) / (downCoordinate[0] - (center)[0]);\r\n      var scy = ((dragCoordinate)[1] - (center)[1]) / (downCoordinate[1] - (center)[1]);\r\n      var displacementVector = [dragCoordinate[0] - downCoordinate[0], (dragCoordinate)[1] - downCoordinate[1]];\r\n      if (this.get('enableRotatedTransform') && viewRotation !== 0) {\r\n        var centerPoint = new ol.geom.Point(center);\r\n        centerPoint.rotate(viewRotation * -1, this.getMap().getView().getCenter());\r\n        center = centerPoint.getCoordinates();\r\n      }\r\n      if (this.get('noFlip')) {\r\n        if (scx<0) scx=-scx;\r\n        if (scy<0) scy=-scy;\r\n      }\r\n      if (this.constraint_) {\r\n        if (this.constraint_==\"h\") scx=1;\r\n        else scy=1;\r\n      } else {\r\n        if (this.get('keepAspectRatio')(evt)) {\r\n          scx = scy = Math.min(scx,scy);\r\n        }\r\n      }\r\n      for (i=0, f; f=this.selection_.item(i); i++) {\r\n        geometry = (viewRotation === 0 || !this.get('enableRotatedTransform')) ? this.geoms_[i].clone() : this.rotatedGeoms_[i].clone();\r\n        geometry.applyTransform(function(g1, g2, dim) {\r\n          if (dim<2) return g2;\r\n          if (!keepRectangle) {\r\n            for (j=0; j<g1.length; j+=dim) {\r\n              if (scx!=1) g2[j] = center[0] + (g1[j]-center[0])*scx;\r\n              if (scy!=1) g2[j+1] = center[1] + (g1[j+1]-center[1])*scy;\r\n            }\r\n          } else {\r\n            var pointArray = [[6], [0, 8], [2], [4]]\r\n            var pointA = [g1[0], g1[1]];\r\n            var pointB = [g1[2], g1[3]];\r\n            var pointC = [g1[4], g1[5]];\r\n            var pointD = [g1[6], g1[7]];\r\n            var pointA1 = [g1[8], g1[9]];\r\n            if (stretch) {\r\n              var base = (opt % 2 === 0) ? countVector(pointA, pointB) : countVector(pointD, pointA);\r\n              var projectedVector = projectVectorOnVector(displacementVector, base);\r\n              var nextIndex = opt+1 < pointArray.length ? opt+1 : 0;\r\n              var coordsToChange = [...pointArray[opt], ...pointArray[nextIndex]];\r\n              for (j = 0; j < g1.length; j += dim) {\r\n                  g2[j] = coordsToChange.includes(j) ? g1[j] + projectedVector[0] : g1[j];\r\n                  g2[j + 1] = coordsToChange.includes(j) ? g1[j + 1] + projectedVector[1] : g1[j + 1];\r\n              }\r\n            } else {\r\n              var projectedLeft, projectedRight;\r\n              switch (opt) {\r\n                case 0:\r\n                  displacementVector = countVector(pointD, dragCoordinate);\r\n                  projectedLeft = projectVectorOnVector(displacementVector, countVector(pointC, pointD));\r\n                  projectedRight = projectVectorOnVector(displacementVector, countVector(pointA, pointD));\r\n                  [g2[0], g2[1]] = movePoint(pointA, projectedLeft);\r\n                  [g2[4], g2[5]] = movePoint(pointC, projectedRight);\r\n                  [g2[6], g2[7]] = movePoint(pointD, displacementVector);\r\n                  [g2[8], g2[9]] = movePoint(pointA1, projectedLeft);\r\n                  break;\r\n                case 1:\r\n                  displacementVector = countVector(pointA, dragCoordinate);\r\n                  projectedLeft = projectVectorOnVector(displacementVector, countVector(pointD, pointA));\r\n                  projectedRight = projectVectorOnVector(displacementVector, countVector(pointB, pointA));\r\n                  [g2[0], g2[1]] = movePoint(pointA, displacementVector);\r\n                  [g2[2], g2[3]] = movePoint(pointB, projectedLeft);\r\n                  [g2[6], g2[7]] = movePoint(pointD, projectedRight);\r\n                  [g2[8], g2[9]] = movePoint(pointA1, displacementVector);\r\n                  break;\r\n                case 2:\r\n                  displacementVector = countVector(pointB, dragCoordinate);\r\n                  projectedLeft = projectVectorOnVector(displacementVector, countVector(pointA, pointB));\r\n                  projectedRight = projectVectorOnVector(displacementVector, countVector(pointC, pointB));\r\n                  [g2[0], g2[1]] = movePoint(pointA, projectedRight);\r\n                  [g2[2], g2[3]] = movePoint(pointB, displacementVector);\r\n                  [g2[4], g2[5]] = movePoint(pointC, projectedLeft);\r\n                  [g2[8], g2[9]] = movePoint(pointA1, projectedRight);\r\n                  break;\r\n                case 3:\r\n                  displacementVector = countVector(pointC, dragCoordinate);\r\n                  projectedLeft = projectVectorOnVector(displacementVector, countVector(pointB, pointC));\r\n                  projectedRight = projectVectorOnVector(displacementVector, countVector(pointD, pointC));\r\n                  [g2[2], g2[3]] = movePoint(pointB, projectedRight);\r\n                  [g2[4], g2[5]] = movePoint(pointC, displacementVector);\r\n                  [g2[6], g2[7]] = movePoint(pointD, projectedLeft);\r\n                  break;\r\n              }\r\n            }\r\n          }\r\n          // bug: ol, bad calculation circle geom extent\r\n          if (geometry.getType() == 'Circle') geometry.setCenterAndRadius(geometry.getCenter(), geometry.getRadius());\r\n          return g2;\r\n        });\r\n        if (this.get('enableRotatedTransform') && viewRotation !== 0) {\r\n          //geometry.rotate(viewRotation, rotationCenter);\r\n          geometry.rotate(viewRotation, this.getMap().getView().getCenter());\r\n        }\r\n        f.setGeometry(geometry);\r\n      }\r\n      this.drawSketch_();\r\n      this.dispatchEvent({\r\n        type:'scaling',\r\n        feature: this.selection_.item(0),\r\n        features: this.selection_,\r\n        scale:[scx,scy],\r\n        pixel: evt.pixel,\r\n        coordinate: evt.coordinate\r\n      });\r\n      break;\r\n    }\r\n    default: break;\r\n  }\r\n  this.isUpdating_ = false;\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} evt Event.\r\n * @private\r\n */\r\nol.interaction.Transform.prototype.handleMoveEvent_ = function(evt) {\r\n  if (!this._handleEvent(evt, this.features_)) return;\r\n  // console.log(\"handleMoveEvent\");\r\n  if (!this.mode_) {\r\n    var sel = this.getFeatureAtPixel_(evt.pixel);\r\n    var element = evt.map.getTargetElement();\r\n    if (sel.feature) {\r\n      var c = sel.handle ? this.Cursors[(sel.handle||'default')+(sel.constraint||'')+(sel.option||'')] : this.Cursors.select;\r\n      if (this.previousCursor_===undefined) {\r\n        this.previousCursor_ = element.style.cursor;\r\n      }\r\n      element.style.cursor = c;\r\n    } else {\r\n      if (this.previousCursor_!==undefined) element.style.cursor = this.previousCursor_;\r\n      this.previousCursor_ = undefined;\r\n    }\r\n  }\r\n};\r\n/**\r\n * @param {ol.MapBrowserEvent} evt Map browser event.\r\n * @return {boolean} `false` to stop the drag sequence.\r\n */\r\nol.interaction.Transform.prototype.handleUpEvent_ = function(evt) {\r\n  // remove rotate0 cursor on Up event, otherwise it's stuck on grab/grabbing\r\n  if (this.mode_ === 'rotate') {\r\n    var element = evt.map.getTargetElement();\r\n    element.style.cursor = this.Cursors.default;\r\n    this.previousCursor_ = undefined;\r\n  }\r\n  //dispatchEvent\r\n  this.dispatchEvent({\r\n    type:this.mode_+'end',\r\n    feature: this.selection_.item(0),\r\n    features: this.selection_,\r\n    oldgeom: this.geoms_[0],\r\n    oldgeoms: this.geoms_\r\n  });\r\n  this.drawSketch_();\r\n  this.mode_ = null;\r\n  return false;\r\n};\r\n/** Get the features that are selected for transform\r\n * @return ol.Collection\r\n */\r\nol.interaction.Transform.prototype.getFeatures = function() {\r\n  return this.selection_;\r\n};\r\n\r\n/** Undo/redo interaction\r\n * @constructor\r\n * @extends {ol.interaction.Interaction}\r\n * @fires undo\r\n * @fires redo\r\n * @fires change:add\r\n * @fires change:remove\r\n * @fires change:clear\r\n * @param {Object} options\r\n *  @param {number=} options.maxLength max undo stack length (0=Infinity), default Infinity\r\n *  @param {Array<ol.Layer>} options.layers array of layers to undo/redo\r\n */\r\nol.interaction.UndoRedo = function(options) {\r\n  if (!options) options = {};\r\n\tol.interaction.Interaction.call(this, {\t\r\n    handleEvent: function() { \r\n      return true; \r\n    }\r\n  });\r\n  //array of layers to undo/redo\r\n  this._layers = options.layers\r\n  this._undoStack = new ol.Collection();\r\n  this._redoStack = new ol.Collection();\r\n  // Zero level stack\r\n  this._undo = [];\r\n  this._redo = [];\r\n  this._undoStack.on('add', function(e) {\r\n    if (e.element.level === undefined) {\r\n      e.element.level = this._level;\r\n      if (!e.element.level) {\r\n        e.element.view = {\r\n          center: this.getMap().getView().getCenter(),\r\n          zoom: this.getMap().getView().getZoom()\r\n        };\r\n        this._undo.push(e.element);\r\n      }\r\n    } else {\r\n      if (!e.element.level) this._undo.push(this._redo.shift());\r\n    }\r\n    if (!e.element.level) {\r\n      this.dispatchEvent({ \r\n        type: 'stack:add', \r\n        action: e.element\r\n      });\r\n    }\r\n    this._reduce();\r\n  }.bind(this));\r\n  this._undoStack.on('remove', function(e) {\r\n    if (!e.element.level) {\r\n      if (this._doShift) {\r\n        this._undo.shift();\r\n      } else {\r\n        if (this._undo.length) this._redo.push(this._undo.pop());\r\n      }\r\n      if (!this._doClear) {\r\n        this.dispatchEvent({ \r\n          type: 'stack:remove', \r\n          action: e.element,\r\n          shift: this._doShift\r\n        });\r\n      }\r\n    }\r\n  }.bind(this));\r\n  // Block counter\r\n  this._block = 0;\r\n  this._level = 0;\r\n  // Shift an undo action ?\r\n  this._doShift = false;\r\n  // Start recording\r\n  this._record = true;\r\n  // Custom definitions\r\n  this._defs = {};\r\n};\r\nol.ext.inherits(ol.interaction.UndoRedo, ol.interaction.Interaction);\r\n/** Add a custom undo/redo\r\n * @param {string} action the action key name\r\n * @param {function} undoFn function called when undoing\r\n * @param {function} redoFn function called when redoing\r\n * @api\r\n */\r\nol.interaction.UndoRedo.prototype.define = function(action, undoFn, redoFn) {\r\n  this._defs[action] = { undo: undoFn, redo: redoFn };\r\n};\r\n/** Get first level undo / redo length\r\n * @param {string} [type] get redo stack length, default get undo\r\n * @return {number}\r\n */\r\nol.interaction.UndoRedo.prototype.length = function(type) {\r\n  return (type==='redo') ? this._redo.length : this._undo.length;\r\n};\r\n/** Set undo stack max length\r\n * @param {number} length\r\n */\r\nol.interaction.UndoRedo.prototype.setMaxLength = function(length) {\r\n  length = parseInt(length);\r\n  if (length && length<0) length = 0;\r\n  this.set('maxLength', length);\r\n  this._reduce();\r\n};\r\n/** Get undo / redo size (includes all block levels)\r\n * @param {string} [type] get redo stack length, default get undo\r\n * @return {number}\r\n */\r\nol.interaction.UndoRedo.prototype.size = function(type) {\r\n  return (type==='redo') ? this._redoStack.getLength() : this._undoStack.getLength();\r\n};\r\n/** Set undo stack max size\r\n * @param {number} size\r\n */\r\nol.interaction.UndoRedo.prototype.setMaxSize = function(size) {\r\n  size = parseInt(size);\r\n  if (size && size<0) size = 0;\r\n  this.set('maxSize', size);\r\n  this._reduce();\r\n};\r\n/** Reduce stack: shift undo to set size\r\n * @private\r\n */\r\nol.interaction.UndoRedo.prototype._reduce = function() {\r\n  if (this.get('maxLength')) {\r\n    while (this.length() > this.get('maxLength')) {\r\n      this.shift();\r\n    }\r\n  }\r\n  if (this.get('maxSize')) {\r\n    while (this.length() > 1 && this.size() > this.get('maxSize')) {\r\n      this.shift();\r\n    }\r\n  }\r\n};\r\n/** Get first level undo / redo first level stack\r\n * @param {string} [type] get redo stack, default get undo\r\n * @return {Array<*>}\r\n */\r\nol.interaction.UndoRedo.prototype.getStack = function(type) {\r\n  return (type==='redo') ? this._redo : this._undo;\r\n};\r\n/** Add a new custom undo/redo\r\n * @param {string} action the action key name\r\n * @param {any} prop an object that will be passed in the undo/redo functions of the action\r\n * @param {string} name action name\r\n * @return {boolean} true if the action is defined\r\n */\r\nol.interaction.UndoRedo.prototype.push = function(action, prop, name) {\r\n  if (this._defs[action]) {\r\n    this._undoStack.push({ \r\n      type: action,\r\n      name: name,\r\n      custom: true,\r\n      prop: prop \r\n    });\r\n    return true;\r\n  } else {\r\n    console.warn('[UndoRedoInteraction]: \"'+action+'\" is not defined.');\r\n    return false;\r\n  }\r\n};\r\n/** Remove undo action from the beginning of the stack. \r\n * The action is not returned.\r\n */\r\nol.interaction.UndoRedo.prototype.shift = function() {\r\n  this._doShift = true;\r\n  var a = this._undoStack.removeAt(0);\r\n  this._doShift = false;\r\n  // Remove all block\r\n  if (a.type==='blockstart') {\r\n    a = this._undoStack.item(0);\r\n    while (this._undoStack.getLength() && a.level>0) {\r\n      this._undoStack.removeAt(0);\r\n      a = this._undoStack.item(0);\r\n    }\r\n  }\r\n};\r\n/** Activate or deactivate the interaction, ie. records or not events on the map.\r\n * @param {boolean} active\r\n * @api stable\r\n */\r\nol.interaction.UndoRedo.prototype.setActive = function(active) {\r\n  ol.interaction.Interaction.prototype.setActive.call (this, active);\r\n  this._record = active;\r\n};\r\n/**\r\n * Remove the interaction from its current map, if any, and attach it to a new\r\n * map, if any. Pass `null` to just remove the interaction from the current map.\r\n * @param {ol.Map} map Map.\r\n * @api stable\r\n */\r\nol.interaction.UndoRedo.prototype.setMap = function(map) {\r\n  if (this._mapListener) {\r\n    this._mapListener.forEach(function(l) { ol.Observable.unByKey(l); })\r\n  }\r\n  this._mapListener = [];\r\n  ol.interaction.Interaction.prototype.setMap.call (this, map);\r\n  // Watch blocks\r\n  if (map) {\r\n    this._mapListener.push(map.on('undoblockstart', this.blockStart.bind(this)));\r\n    this._mapListener.push(map.on('undoblockend', this.blockEnd.bind(this)));\r\n  }\r\n  // Watch sources\r\n  this._watchSources();\r\n  this._watchInteractions();\r\n};\r\n/** Watch for changes in the map sources\r\n * @private\r\n */\r\nol.interaction.UndoRedo.prototype._watchSources = function() {\r\n  var map = this.getMap();\r\n  // Clear listeners\r\n  if (this._sourceListener) {\r\n    this._sourceListener.forEach(function(l) { ol.Observable.unByKey(l); })\r\n  }\r\n  this._sourceListener = [];\r\n  var self = this;\r\n  // Ges vector layers \r\n  function getVectorLayers(layers, init) {\r\n    if (!init) init = [];\r\n    layers.forEach(function(l) {\r\n      if (l instanceof ol.layer.Vector) {\r\n        if (!self._layers || self._layers.indexOf(l) >= 0) {\r\n          init.push(l);\r\n        }\r\n      } else if (l.getLayers) {\r\n        getVectorLayers(l.getLayers(), init);\r\n      }\r\n    });\r\n    return init;\r\n  }\r\n  if (map) {\r\n    // Watch the vector sources in the map \r\n    var vectors = getVectorLayers(map.getLayers());\r\n    vectors.forEach((function(l) {\r\n      var s = l.getSource();\r\n      this._sourceListener.push( s.on(['addfeature', 'removefeature'], this._onAddRemove.bind(this)) );\r\n      this._sourceListener.push( s.on('clearstart', function() {\r\n        this.blockStart('clear')\r\n      }.bind(this)));\r\n      this._sourceListener.push( s.on('clearend', this.blockEnd.bind(this)) );\r\n    }).bind(this));\r\n    // Watch new inserted/removed\r\n    this._sourceListener.push( map.getLayers().on(['add', 'remove'], this._watchSources.bind(this) ) );\r\n  }\r\n};\r\n/** Watch for interactions\r\n * @private\r\n */\r\nol.interaction.UndoRedo.prototype._watchInteractions = function() {\r\n  var map = this.getMap();\r\n  // Clear listeners\r\n  if (this._interactionListener) {\r\n    this._interactionListener.forEach(function(l) { ol.Observable.unByKey(l); })\r\n  }\r\n  this._interactionListener = [];\r\n  if (map) {\r\n    // Watch the interactions in the map \r\n    map.getInteractions().forEach((function(i) {\r\n      this._interactionListener.push(i.on(\r\n        ['setattributestart', 'modifystart', 'rotatestart', 'translatestart', 'scalestart', 'deletestart', 'deleteend', 'beforesplit', 'aftersplit'], \r\n        this._onInteraction.bind(this)\r\n      ));\r\n    }).bind(this));\r\n    // Watch new inserted / unwatch removed\r\n    this._interactionListener.push( map.getInteractions().on(\r\n      ['add', 'remove'], \r\n      this._watchInteractions.bind(this)\r\n    ));\r\n  }\r\n};\r\n/** A feature is added / removed\r\n */\r\nol.interaction.UndoRedo.prototype._onAddRemove = function(e) {\r\n  if (this._record) {\r\n    this._redoStack.clear();\r\n    this._redo.length = 0;\r\n    this._undoStack.push({\r\n      type: e.type, \r\n      source: e.target, \r\n      feature: e.feature\r\n    });\r\n  }\r\n};\r\n/** Perform an interaction\r\n * @private\r\n */\r\nol.interaction.UndoRedo.prototype._onInteraction = function(e) {\r\n  var fn = this._onInteraction[e.type];\r\n  if (fn) fn.call(this,e);\r\n};\r\n/** Set attribute\r\n * @private\r\n */\r\nol.interaction.UndoRedo.prototype._onInteraction.setattributestart = function(e) {\r\n  this.blockStart(e.target.get('name') || 'setattribute');\r\n  var newp = Object.assign({}, e.properties);\r\n  e.features.forEach(function(f) {\r\n    var oldp = {};\r\n    for (var p in newp) {\r\n      oldp[p] = f.get(p);\r\n    }\r\n    this._undoStack.push({\r\n      type: 'changeattribute', \r\n      feature: f,\r\n      newProperties: newp,\r\n      oldProperties: oldp\r\n    });\r\n  }.bind(this));\r\n  this.blockEnd();\r\n};\r\nol.interaction.UndoRedo.prototype._onInteraction.rotatestart = \r\nol.interaction.UndoRedo.prototype._onInteraction.translatestart = \r\nol.interaction.UndoRedo.prototype._onInteraction.scalestart = \r\nol.interaction.UndoRedo.prototype._onInteraction.modifystart = function (e) {\r\n  this.blockStart(e.type.replace(/start$/,''));\r\n  e.features.forEach(function(m) {\r\n    this._undoStack.push({ \r\n      type: 'changegeometry', \r\n      feature: m, \r\n      oldGeom: m.getGeometry().clone() \r\n    });\r\n  }.bind(this));\r\n  this.blockEnd();\r\n};\r\n/** Start an undo block\r\n * @param {string} [name] name f the action\r\n * @api\r\n */\r\nol.interaction.UndoRedo.prototype.blockStart = function (name) {\r\n  this._redoStack.clear();\r\n  this._redo.length = 0;\r\n  this._undoStack.push({ \r\n    type: 'blockstart', \r\n    name: name\r\n  });\r\n  this._level++;\r\n};\r\n/** @private\r\n */\r\nol.interaction.UndoRedo.prototype._onInteraction.beforesplit = function() {\r\n  this.blockStart('split');\r\n};\r\nol.interaction.UndoRedo.prototype._onInteraction.deletestart = function() {\r\n  this.blockStart('delete');\r\n}\r\n/** End an undo block\r\n * @api\r\n */\r\nol.interaction.UndoRedo.prototype.blockEnd = function () {\r\n  this._undoStack.push({ type: 'blockend' });\r\n  this._level--;\r\n};\r\n/** @private\r\n */\r\nol.interaction.UndoRedo.prototype._onInteraction.aftersplit =\r\nol.interaction.UndoRedo.prototype._onInteraction.deleteend =\r\nol.interaction.UndoRedo.prototype.blockEnd;\r\n/** handle undo/redo\r\n * @private\r\n */\r\nol.interaction.UndoRedo.prototype._handleDo = function(e, undo) {\r\n  // Not active\r\n  if (!this.getActive()) return;\r\n  // Stop recording while undoing\r\n  this._record = false;\r\n  if (e.custom) {\r\n    if (this._defs[e.type]) {\r\n      if (undo) this._defs[e.type].undo(e.prop);\r\n      else this._defs[e.type].redo(e.prop);\r\n    } else {\r\n      console.warn('[UndoRedoInteraction]: \"'+e.type+'\" is not defined.');\r\n    }\r\n  } else {\r\n    switch (e.type) {\r\n      case 'addfeature': {\r\n        if (undo) e.source.removeFeature(e.feature);\r\n        else e.source.addFeature(e.feature);\r\n        break;\r\n      }\r\n      case 'removefeature': {\r\n        if (undo) e.source.addFeature(e.feature);\r\n        else e.source.removeFeature(e.feature);\r\n        break;\r\n      }\r\n      case 'changegeometry': {\r\n        var geom = e.feature.getGeometry();\r\n        e.feature.setGeometry(e.oldGeom);\r\n        e.oldGeom = geom;\r\n        break;\r\n      }\r\n      case 'changeattribute': {\r\n        var newp = e.newProperties;\r\n        var oldp = e.oldProperties;\r\n        for (var p in oldp) {\r\n          if (oldp === undefined) e.feature.unset(p);\r\n          else e.feature.set(p, oldp[p]);\r\n        }\r\n        e.oldProperties = newp;\r\n        e.newProperties = oldp;\r\n        break;\r\n      }\r\n      case 'blockstart': {\r\n        this._block += undo ? -1 : 1;\r\n        break;\r\n      }\r\n      case 'blockend': {\r\n        this._block += undo ? 1 : -1;\r\n        break;\r\n      }\r\n      default: {\r\n        console.warn('[UndoRedoInteraction]: \"'+e.type+'\" is not defined.');\r\n      }\r\n    }\r\n  }\r\n  // Handle block\r\n  if (this._block<0) this._block = 0;\r\n  if (this._block) {\r\n    if (undo) this.undo();\r\n    else this.redo();\r\n  }\r\n  this._record = true;\r\n  // Dispatch event\r\n  this.dispatchEvent( { \r\n    type: undo ? 'undo' : 'redo',\r\n    action: e\r\n  });\r\n};\r\n/** Undo last operation\r\n * @api\r\n */\r\nol.interaction.UndoRedo.prototype.undo = function() {\r\n  var e = this._undoStack.item(this._undoStack.getLength() - 1);\r\n  if (!e) return;\r\n  this._redoStack.push(e);\r\n  this._undoStack.pop();\r\n  this._handleDo(e, true);\r\n};\r\n/** Redo last operation\r\n * @api\r\n */\r\nol.interaction.UndoRedo.prototype.redo = function() {\r\n  var e = this._redoStack.item(this._redoStack.getLength() - 1);\r\n  if (!e) return;\r\n  this._undoStack.push(e);\r\n  this._redoStack.pop();\r\n  this._handleDo(e, false);\r\n};\r\n/** Clear undo stack\r\n * @api\r\n */\r\nol.interaction.UndoRedo.prototype.clear = function() {\r\n  this._doClear = true;\r\n  this._undo.length = this._redo.length = 0;\r\n  this._undoStack.clear();\r\n  this._redoStack.clear();\r\n  this._doClear = false;\r\n  this.dispatchEvent({ type: 'stack:clear' });\r\n};\r\n/** Check if undo is avaliable\r\n * @return {number} the number of undo \r\n * @api\r\n */\r\nol.interaction.UndoRedo.prototype.hasUndo = function() {\r\n  return this._undoStack.getLength();\r\n};\r\n/** Check if redo is avaliable\r\n * @return {number} the number of redo\r\n * @api\r\n */\r\nol.interaction.UndoRedo.prototype.hasRedo = function() {\r\n  return this._redoStack.getLength();\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Abstract base class; normally only used for creating subclasses. Bin collector for data\r\n * @constructor\r\n * @extends {ol.source.Vector}\r\n * @param {Object} options ol.source.VectorOptions + grid option\r\n *  @param {ol.source.Vector} options.source Source\r\n *  @param {boolean} options.listenChange listen changes (move) on source features to recalculate the bin, default true\r\n *  @param {fucntion} [options.geometryFunction] Function that takes an ol.Feature as argument and returns an ol.geom.Point as feature's center.\r\n *  @param {function} [options.flatAttributes] Function takes a bin and the features it contains and aggragate the features in the bin attributes when saving\r\n */\r\nol.source.BinBase = function (options) {\r\n  options = options || {};\r\n  this._bindModify = this._onModifyFeature.bind(this);\r\n  this._watch = true;\r\n  ol.source.Vector.call(this, options);\r\n  this._origin = options.source;\r\n  this._listen = (options.listenChange !== false);\r\n  // Geometry function\r\n  this._geomFn = options.geometryFunction || ol.coordinate.getFeatureCenter || function (f) { return f.getGeometry().getFirstCoordinate(); };\r\n  // Existing features\r\n  this.reset();\r\n  // Future features\r\n  this._origin.on('addfeature', this._onAddFeature.bind(this));\r\n  this._origin.on('removefeature', this._onRemoveFeature.bind(this));\r\n  this._origin.on('clearstart', this._onClearFeature.bind(this));\r\n  this._origin.on('clearend', this._onClearFeature.bind(this));\r\n  if (typeof (options.flatAttributes) === 'function') this._flatAttributes = options.flatAttributes;\r\n};\r\nol.ext.inherits(ol.source.BinBase, ol.source.Vector);\r\n/**\r\n * On add feature\r\n * @param {ol.events.Event} e\r\n * @param {ol.Feature} bin\r\n * @private\r\n */\r\nol.source.BinBase.prototype._onAddFeature = function (e, bin, listen) {\r\n  var f = e.feature || e.target;\r\n  bin = bin || this.getBinAt(this._geomFn(f), true);\r\n  if (bin) bin.get('features').push(f);\r\n  if (this._listen && listen!==false) f.on('change', this._bindModify);\r\n};\r\n/**\r\n *  On remove feature\r\n *  @param {ol.events.Event} e\r\n *  @param {ol.Feature} bin\r\n *  @private\r\n */\r\nol.source.BinBase.prototype._onRemoveFeature = function (e, bin, listen) {\r\n  if (!this._watch) return;\r\n  var f = e.feature || e.target;\r\n  bin = bin || this.getBinAt(this._geomFn(f));\r\n  if (bin) {\r\n    // Remove feature from bin\r\n    var features = bin.get('features');\r\n    for (var i=0, fi; fi=features[i]; i++) {\r\n      if (fi===f) {\r\n        features.splice(i, 1);\r\n        break;\r\n      }\r\n    }\r\n    // Remove bin if no features\r\n    if (!features.length) {\r\n      this.removeFeature(bin);\r\n    }\r\n  } else {\r\n    // console.log(\"[ERROR:Bin] remove feature: feature doesn't exists anymore.\");\r\n  }\r\n  if (this._listen && listen!==false) f.un('change', this._bindModify);\r\n};\r\n/** When clearing features remove the listener\r\n * @private\r\n */\r\nol.source.BinBase.prototype._onClearFeature = function (e) {\r\n  if (e.type==='clearstart') {\r\n    if (this._listen) {\r\n      this._origin.getFeatures().forEach(function (f) {\r\n        f.un('change', this._bindModify);\r\n      }.bind(this));\r\n    }\r\n    this.clear();\r\n    this._watch = false;\r\n  } else {\r\n    this._watch = true;\r\n  }\r\n};\r\n/**\r\n * Get the bin that contains a feature\r\n * @param {ol.Feature} f the feature\r\n * @return {ol.Feature} the bin or null it doesn't exit\r\n */\r\nol.source.BinBase.prototype.getBin = function (feature) {\r\n  var bins = this.getFeatures();\r\n  for (var i=0, b; b = bins[i]; i++) {\r\n    var features = b.get('features');\r\n    for (var j=0, f; f=features[j]; j++) {\r\n      if (f===feature) return b;\r\n    }\r\n  }\r\n  return null;\r\n}\r\n/** Get the grid geometry at the coord \r\n * @param {ol.Coordinate} coord\r\n * @param {Object} attributes add key/value to this object to add properties to the grid feature\r\n * @returns {ol.geom.Polygon} \r\n * @api\r\n */\r\nol.source.BinBase.prototype.getGridGeomAt = function (coord /*, attributes */) {\r\n  return new ol.geom.Polygon([coord]);\r\n};\r\n/** Get the bean at a coord\r\n * @param {ol.Coordinate} coord\r\n * @param {boolean} create true to create if doesn't exit\r\n * @return {ol.Feature} the bin or null it doesn't exit\r\n */\r\nol.source.BinBase.prototype.getBinAt = function (coord, create) {\r\n  var attributes = {};\r\n  var g = this.getGridGeomAt(coord, attributes);\r\n  if (!g) return null;\r\n  var center = g.getInteriorPoint ? g.getInteriorPoint().getCoordinates() : g.getInteriorPoints().getCoordinates()[0];// ol.extent.getCenter(g.getExtent());\r\n  var features = this.getFeaturesAtCoordinate( center );\r\n  var bin = features[0];\r\n  if (!bin && create) {\r\n    attributes.geometry = g;\r\n    attributes.features = [];\r\n    attributes.center = center;\r\n    bin = new ol.Feature(attributes);\r\n    this.addFeature(bin);\r\n  }\r\n  return bin || null;\r\n};\r\n/**\r\n *  A feature has been modified\r\n *  @param {ol.events.Event} e\r\n *  @private\r\n */\r\nol.source.BinBase.prototype._onModifyFeature = function (e) {\r\n  var bin = this.getBin(e.target);\r\n  var bin2 = this.getBinAt(this._geomFn(e.target), 'create');\r\n  if (bin !== bin2) {\r\n    // remove from the bin\r\n    if (bin) {\r\n      this._onRemoveFeature(e, bin, false);\r\n    }\r\n    // insert in the new bin\r\n    if (bin2) {\r\n      this._onAddFeature(e, bin2, false);\r\n    }\r\n  }\r\n  this.changed();\r\n};\r\n/** Clear all bins and generate a new one. \r\n */\r\nol.source.BinBase.prototype.reset = function () {\r\n  this.clear();\r\n  var features = this._origin.getFeatures();\r\n  for (var i = 0, f; f = features[i]; i++) {\r\n    this._onAddFeature({ feature: f });\r\n  }\r\n  this.changed();\r\n};\r\n/**\r\n * Get features without circular dependencies (vs. getFeatures)\r\n * @return {Array<ol.Feature>}\r\n */\r\nol.source.BinBase.prototype.getGridFeatures = function () {\r\n  var features = [];\r\n  this.getFeatures().forEach(function (f) {\r\n    var bin = new ol.Feature(f.getGeometry().clone());\r\n    for (var i in f.getProperties()) {\r\n      if (i!=='features' && i!=='geometry') {\r\n        bin.set(i, f.get(i));\r\n      }\r\n    }\r\n    bin.set('nb', f.get('features').length);\r\n    this._flatAttributes(bin, f.get('features'));\r\n    features.push(bin);\r\n  }.bind(this));\r\n  return features;\r\n};\r\n/** Create bin attributes using the features it contains when exporting \r\n * @param {ol.Feature} bin the bin to export\r\n * @param {Array<ol.Features>} features the features it contains\r\n */\r\nol.source.BinBase.prototype._flatAttributes = function(/*bin, features*/) {\r\n};\r\n/** Set the flatAttribute function\r\n * @param {function} fn Function that takes a bin and the features it contains and aggragate the features in the bin attributes when saving\r\n */\r\n ol.source.BinBase.prototype.setFlatAttributesFn = function(fn) {\r\n  if (typeof(fn)==='function') this._flatAttributes = fn;\r\n};\r\n/**\r\n * Get the orginal source\r\n * @return {ol.source.Vector}\r\n */\r\nol.source.BinBase.prototype.getSource = function () {\r\n  return this._origin;\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n  @classdesc\r\n  ol.source.DBPedia is a DBPedia layer source that load DBPedia located content in a vector layer.\r\n  olx.source.DBPedia: olx.source.Vector\r\n  {\turl: {string} Url for DBPedia SPARQL \r\n  }\r\n  Inherits from:\r\n  <ol.source.Vector>\r\n*/\r\n/**\r\n* @constructor ol.source.DBPedia\r\n* @extends {ol.source.Vector}\r\n* @param {olx.source.DBPedia=} opt_options\r\n*/\r\nol.source.DBPedia = function(opt_options) {\r\n  var options = opt_options || {};\r\n  options.loader = this._loaderFn;\r\n  /** Url for DBPedia SPARQL */\r\n  this._url = options.url || \"http://fr.dbpedia.org/sparql\";\r\n  /** Max resolution to load features  */\r\n  this._maxResolution = options.maxResolution || 100;\r\n  /** Result language */\r\n  this._lang = options.lang || \"fr\";\r\n  /** Query limit */\r\n  this._limit = options.limit || 1000;\r\n  /** Default attribution */\r\n  if (!options.attributions) options.attributions = [ \"&copy; <a href='http://dbpedia.org/'>DBpedia</a> CC-by-SA\" ];\r\n  // Bbox strategy : reload at each move\r\n    if (!options.strategy) options.strategy = ol.loadingstrategy.bbox;\r\n  ol.source.Vector.call (this, options);\r\n};\r\nol.ext.inherits(ol.source.DBPedia, ol.source.Vector);\r\n/** Decode RDF attributes and choose to add feature to the layer\r\n* @param {feature} the feature\r\n* @param {attributes} RDF attributes\r\n* @param {lastfeature} last feature added (null if none)\r\n* @return {boolean} true: add the feature to the layer\r\n* @API stable\r\n*/\r\nol.source.DBPedia.prototype.readFeature = function (feature, attributes, lastfeature) {\r\n  // Copy RDF attributes values\r\n  for (var i in attributes) {\r\n    if (attributes[i].type==='uri') attributes[i].value = encodeURI(attributes[i].value);\r\n    feature.set (i, attributes[i].value);\r\n  }\r\n  // Prevent same feature with different type duplication\r\n  if (lastfeature && lastfeature.get(\"subject\") == attributes.subject.value) {\r\n    // Kepp dbpedia.org type ?\r\n    // if (bindings[i].type.match (\"dbpedia.org\") lastfeature.get(\"type\") = bindings[i].type.value;\r\n    // Concat types\r\n    lastfeature.set(\"type\", lastfeature.get(\"type\") +\"\\n\"+ attributes.type.value);\r\n    return false;\r\n  } else {\r\n    return true;\r\n  }\r\n};\r\n/** Set RDF query subject, default: select label, thumbnail, abstract and type\r\n* @API stable\r\n*/\r\nol.source.DBPedia.prototype.querySubject = function () {\r\n  return \"?subject rdfs:label ?label. \"\r\n    + \"OPTIONAL {?subject dbpedia-owl:thumbnail ?thumbnail}.\"\r\n    + \"OPTIONAL {?subject dbpedia-owl:abstract ?abstract} . \"\r\n    + \"OPTIONAL {?subject rdf:type ?type}\";\r\n}\r\n/** Set RDF query filter, default: select language\r\n* @API stable\r\n*/\r\nol.source.DBPedia.prototype.queryFilter = function () {\r\n  return\t \"lang(?label) = '\"+this._lang+\"' \"\r\n    + \"&& lang(?abstract) = '\"+this._lang+\"'\"\r\n  // Filter on type \r\n  //+ \"&& regex (?type, 'Monument|Sculpture|Museum', 'i')\"\r\n}\r\n/** Loader function used to load features.\r\n* @private\r\n*/\r\nol.source.DBPedia.prototype._loaderFn = function(extent, resolution, projection) {\r\n  if (resolution > this._maxResolution) return;\r\n  var self = this;\r\n  var bbox = ol.proj.transformExtent(extent, projection, \"EPSG:4326\");\r\n  // SPARQL request: for more info @see http://fr.dbpedia.org/\r\n  var query =\t\"PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> \"\r\n        + \"SELECT DISTINCT * WHERE { \"\r\n        + \"?subject geo:lat ?lat . \"\r\n        + \"?subject geo:long ?long . \"\r\n        + this.querySubject()+\" . \"\r\n        + \"FILTER(\"+this.queryFilter()+\") . \"\r\n        // Filter bbox\r\n        + \"FILTER(xsd:float(?lat) <= \" + bbox[3] + \" && \" + bbox[1] + \" <= xsd:float(?lat) \"\r\n        + \"&& xsd:float(?long) <= \" + bbox[2] + \" && \" + bbox[0] + \" <= xsd:float(?long) \"\r\n        + \") . \"\r\n        + \"} LIMIT \"+this._limit;\r\n  // Ajax request to get the tile\r\n  ol.ext.Ajax.get({\r\n    url: this._url,\r\n    data: { query: query, format:\"json\" },\r\n    success: function(data) {\r\n      var bindings = data.results.bindings;\r\n      var features = [];\r\n      var att, pt, feature, lastfeature = null;\r\n      for ( var i in bindings ) {\r\n        att = bindings[i];\r\n        pt = [Number(bindings[i].long.value), Number(bindings[i].lat.value)];\r\n        feature = new ol.Feature(new ol.geom.Point(ol.proj.transform (pt,\"EPSG:4326\",projection)));\r\n        if (self.readFeature(feature, att, lastfeature)) {\r\n          features.push(feature);\r\n          lastfeature = feature;\r\n        }\r\n      }\r\n      self.addFeatures(features);\r\n    }});\r\n};\r\nol.style.clearDBPediaStyleCache;\r\nol.style.dbPediaStyleFunction; \r\n(function(){\r\n// Style cache\r\nvar styleCache = {};\r\n/** Reset the cache (when fonts are loaded)\r\n*/\r\nol.style.clearDBPediaStyleCache = function() {\r\n  styleCache = {};\r\n}\r\n/** Get a default style function for dbpedia\r\n* @param {} options\r\n* @param {string|function|undefined} options.glyph a glyph name or a function that takes a feature and return a glyph\r\n* @param {number} options.radius radius of the symbol, default 8\r\n* @param {ol.style.Fill} options.fill style for fill, default navy\r\n* @param {ol.style.stroke} options.stroke style for stroke, default 2px white\r\n* @param {string} options.prefix a prefix if many style used for the same type\r\n*\r\n* @require ol.style.FontSymbol and FontAwesome defs are required for dbPediaStyleFunction()\r\n*/\r\nol.style.dbPediaStyleFunction = function(options) {\r\n  if (!options) options={};\r\n  // Get font function using dbPedia type\r\n  var getFont;\r\n  switch (typeof(options.glyph)) {\r\n    case \"function\": getFont = options.glyph; break;\r\n    case \"string\": getFont = function(){ return options.glyph; }; break;\r\n    default: {\r\n      getFont = function (f) {\r\n        var type = f.get(\"type\");\r\n        if (type) {\r\n          if (type.match(\"/Museum\")) return \"fa-camera\";\r\n          else if (type.match(\"/Monument\")) return \"fa-building\";\r\n          else if (type.match(\"/Sculpture\")) return \"fa-android\";\r\n          else if (type.match(\"/Religious\")) return \"fa-institution\";\r\n          else if (type.match(\"/Castle\")) return \"fa-key\";\r\n          else if (type.match(\"Water\")) return \"fa-tint\";\r\n          else if (type.match(\"Island\")) return \"fa-leaf\";\r\n          else if (type.match(\"/Event\")) return \"fa-heart\";\r\n          else if (type.match(\"/Artwork\")) return \"fa-asterisk\";\r\n          else if (type.match(\"/Stadium\")) return \"fa-futbol-o\";\r\n          else if (type.match(\"/Place\")) return \"fa-street-view\";\r\n        }\r\n        return \"fa-star\";\r\n      }\r\n      break;\r\n    }\r\n  }\r\n  // Default values\r\n  var radius = options.radius || 8;\r\n  var fill = options.fill || new ol.style.Fill({ color:\"navy\"});\r\n  var stroke = options.stroke || new ol.style.Stroke({ color: \"#fff\", width: 2 });\r\n  var prefix = options.prefix ? options.prefix+\"_\" : \"\";\r\n  // Vector style function\r\n  return function (feature) {\r\n    var glyph = getFont(feature);\r\n    var k = prefix + glyph;\r\n    var style = styleCache[k];\r\n    if (!style) {\r\n      styleCache[k] = style = new ol.style.Style ({\r\n        image: new ol.style.FontSymbol({\r\n          glyph: glyph, \r\n          radius: radius, \r\n          fill: fill,\r\n          stroke: stroke\r\n        })\r\n      });\r\n    }\r\n    return [style];\r\n  }\r\n};\r\n})();\r\n\r\n/*\tCopyright (c) 2018 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** DFCI source: a source to display the French DFCI grid on a map\r\n * @see http://ccffpeynier.free.fr/Files/dfci.pdf\r\n * @constructor ol.source.DFCI\r\n * @extends {ol/source/Vector}\r\n * @param {any} options Vector source options\r\n *  @param {Array<Number>} resolutions a list of resolution to change the drawing level, default [1000,100,20]\r\n */\r\nol.source.DFCI = function(options) {\r\n\toptions = options || {};\r\n\toptions.loader = this._calcGrid;\r\n  options.strategy =  function(extent, resolution) {\r\n    if (this.resolution && this.resolution != resolution){\r\n      this.clear();\r\n      this.refresh();\r\n    }\r\n    return [extent];\r\n  }\r\n  this._bbox = [[0,1600000],[11*100000, 1600000+10*100000]];\r\n  ol.source.Vector.call (this, options);\r\n  this.set('resolutions', options.resolutions || [1000,100,20]);\r\n  // Add Lambert IIe proj \r\n  if (!proj4.defs[\"EPSG:27572\"]) proj4.defs(\"EPSG:27572\",\"+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs\");\r\n  ol.proj.proj4.register(proj4);\r\n};\r\nol.ext.inherits(ol.source.DFCI, ol.source.Vector);\r\n/** Cacluate grid according extent/resolution\r\n */\r\nol.source.DFCI.prototype._calcGrid = function (extent, resolution, projection) {\r\n  // Show step 0\r\n  var f, ext, res = this.get('resolutions');\r\n  if (resolution > (res[0] || 1000)) {\r\n    if (this.resolution != resolution) {\r\n      if (!this._features0) {\r\n        ext = [this._bbox[0][0], this._bbox[0][1],this._bbox[1][0], this._bbox[1][1]];\r\n        this._features0 = this._getFeatures(0, ext, projection);\r\n      }\r\n      this.addFeatures(this._features0);\r\n    }\r\n  }\r\n  else if (resolution > (res[1] || 100)) {\r\n    this.clear();\r\n    ext = ol.proj.transformExtent(extent, projection, 'EPSG:27572');\r\n    f = this._getFeatures(1, ext, projection)\r\n    this.addFeatures(f);\r\n  }\r\n  else if (resolution > (res[2] || 0)) {\r\n    this.clear();\r\n    ext = ol.proj.transformExtent(extent, projection, 'EPSG:27572');\r\n    f = this._getFeatures(2, ext, projection)\r\n    this.addFeatures(f);\r\n  }\r\n  else {\r\n    this.clear();\r\n    ext = ol.proj.transformExtent(extent, projection, 'EPSG:27572');\r\n    f = this._getFeatures(3, ext, projection)\r\n    this.addFeatures(f);\r\n  }\r\n  // reset load\r\n  this.resolution = resolution;\r\n};\r\n/**\r\n * Get middle point\r\n * @private\r\n */\r\nol.source.DFCI.prototype._midPt = function(p1,p2) {\r\n  return [(p1[0]+p2[0])/2, (p1[1]+p2[1])/2];\r\n};\r\n/**\r\n * Get feature with geom\r\n * @private\r\n */\r\nol.source.DFCI.prototype._trFeature = function(geom, id, level, projection) {\r\n  var g  = new ol.geom.Polygon([geom]);\r\n  var f = new ol.Feature(g.transform('EPSG:27572', projection));\r\n  f.set('id', id);\r\n  f.set('level', level);\r\n  return f;\r\n};\r\n/** Get features\r\n * \r\n */\r\nol.source.DFCI.prototype._getFeatures = function (level, extent, projection) {\r\n  var features = [];\r\n  var i;\r\n  var step = 100000;\r\n  if (level>0) step /= 5;\r\n  if (level>1) step /= 10;\r\n  var p0 = [\r\n    Math.max(this._bbox[0][0], Math.floor(extent[0]/step)*step), \r\n    Math.max(this._bbox[0][1], Math.floor(extent[1]/step)*step)\r\n  ];\r\n  var p1 = [\r\n    Math.min(this._bbox[1][0]+99999, Math.floor(extent[2]/step)*step), \r\n    Math.min(this._bbox[1][1]+99999, Math.floor(extent[3]/step)*step)\r\n  ];\r\n  for (var x=p0[0]; x<=p1[0]; x += step) {\r\n    for (var y=p0[1]; y<=p1[1]; y += step) {\r\n      var p, geom = [ [x,y], [x+step, y], [x+step, y+step], [x , y+step], [x,y]];\r\n      if (level>2) {\r\n        var m = this._midPt(geom[0],geom[2]);\r\n        // .5\r\n        var g = [];\r\n        for (i=0; i<geom.length; i++) {\r\n          g.push(this._midPt(geom[i],m))\r\n        }\r\n        features.push(this._trFeature(g, ol.coordinate.toDFCI([x,y], 2)+'.5', level, projection));\r\n        // .1 > .4\r\n        for (i=0; i<4; i++) {\r\n          g = [];\r\n          g.push(geom[i]);\r\n          g.push(this._midPt(geom[i],geom[(i+1)%4]));\r\n          g.push(this._midPt(m,g[1]));\r\n          g.push(this._midPt(m,geom[i]));\r\n          p = this._midPt(geom[i],geom[(i+3)%4]);\r\n          g.push(this._midPt(m,p));\r\n          g.push(p);\r\n          g.push(geom[i]);\r\n          features.push(this._trFeature(g, ol.coordinate.toDFCI([x,y], 2)+'.'+(4-i), level, projection));\r\n        }\r\n      } else {\r\n        features.push(this._trFeature(geom, ol.coordinate.toDFCI([x,y], level), level, projection));\r\n      }\r\n    }\r\n  }\r\n  return features\r\n};\r\n\r\n/*\tCopyright (c) 2018 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** DayNight source: a source to display day/night on a map\r\n * @constructor \r\n * @extends {ol.source.Vector}\r\n * @param {any} options Vector source options\r\n *  @param {string|Date} time source date time\r\n *  @param {number} step step in degree for coordinate precision\r\n */\r\nol.source.DayNight = function(options) {\r\n  options = options || {};\r\n  options.loader = this._loader\r\n  options.strategy = ol.loadingstrategy.all;\r\n  ol.source.Vector.call (this, options);\r\n  this.set('time', options.time || new Date());\r\n  this.set('step', options.step || 1);\r\n};\r\nol.ext.inherits(ol.source.DayNight, ol.source.Vector);\r\n(function(){\r\n/** Loader\r\n * @private\r\n */\r\nol.source.DayNight.prototype._loader = function(extent, resolution, projection) {\r\n  var lonlat = this.getCoordinates(this.get('time'));\r\n  var geom = new ol.geom.Polygon([lonlat]);\r\n  geom.transform('EPSG:4326', projection);\r\n  this.addFeature(new ol.Feature(geom));\r\n};\r\n/** Set source date time\r\n * @param {string|Date} time source date time\r\n */\r\nol.source.DayNight.prototype.setTime = function(time) {\r\n  this.set('time', time);\r\n  this.refresh();\r\n};\r\n/** Compute the position of the Sun in ecliptic coordinates at julianDay.\r\n * @see http://en.wikipedia.org/wiki/Position_of_the_Sun \r\n * @param {number} julianDay\r\n * @private\r\n */\r\nfunction _sunEclipticPosition(julianDay) {\r\n  var deg2rad = Math.PI / 180;\r\n  // Days since start of J2000.0\r\n  var n = julianDay - 2451545.0;\r\n  // mean longitude of the Sun\r\n  var L = 280.460 + 0.9856474 * n;\r\n  L %= 360;\r\n  // mean anomaly of the Sun\r\n  var g = 357.528 + 0.9856003 * n;\r\n  g %= 360;\r\n  // ecliptic longitude of Sun\r\n  var lambda = L + 1.915 * Math.sin(g * deg2rad) +\r\n    0.02 * Math.sin(2 * g * deg2rad);\r\n  // distance from Sun in AU\r\n  var R = 1.00014 - 0.01671 * Math.cos(g * deg2rad) -\r\n    0.0014 * Math.cos(2 * g * deg2rad);\r\n  return { lambda: lambda, R: R };\r\n}\r\n/** \r\n * @see http://en.wikipedia.org/wiki/Axial_tilt#Obliquity_of_the_ecliptic_.28Earth.27s_axial_tilt.29\r\n * @param {number} julianDay\r\n * @private\r\n */\r\nfunction _eclipticObliquity(julianDay) {\r\n  var n = julianDay - 2451545.0;\r\n  // Julian centuries since J2000.0\r\n  var T = n / 36525;\r\n  var epsilon = 23.43929111 -\r\n    T * (46.836769 / 3600\r\n      - T * (0.0001831 / 3600\r\n        + T * (0.00200340 / 3600\r\n          - T * (0.576e-6 / 3600\r\n            - T * 4.34e-8 / 3600))));\r\n  return epsilon;\r\n}\r\n/* Compute the Sun's equatorial position from its ecliptic position.\r\n * @param {number} sunEclLng sun lon in degrees\r\n * @param {number} eclObliq secliptic position in degrees\r\n * @return {number} position in degrees\r\n * @private\r\n */\r\nfunction _sunEquatorialPosition(sunEclLon, eclObliq) {\r\n  var rad2deg = 180 / Math.PI;\r\n  var deg2rad = Math.PI / 180;\r\n  var alpha = Math.atan(Math.cos(eclObliq * deg2rad)\r\n    * Math.tan(sunEclLon * deg2rad)) * rad2deg;\r\n  var delta = Math.asin(Math.sin(eclObliq * deg2rad)\r\n    * Math.sin(sunEclLon * deg2rad)) * rad2deg;\r\n  var lQuadrant = Math.floor(sunEclLon / 90) * 90;\r\n  var raQuadrant = Math.floor(alpha / 90) * 90;\r\n  alpha = alpha + (lQuadrant - raQuadrant);\r\n  return {alpha: alpha, delta: delta};\r\n}\r\n/** Get night-day separation line\r\n * @param {string} time DateTime string, default yet\r\n * @param {string} options use 'line' to get the separation line, 'day' to get the day polygon, 'night' to get the night polygon or 'daynight' to get both polygon, default 'night'\r\n * @return {Array<ol.Point>|Array<Array<ol.Point>>}\r\n */\r\nol.source.DayNight.prototype.getCoordinates = function (time, options) {\r\n  var rad2deg = 180 / Math.PI;\r\n  var deg2rad = Math.PI / 180;\r\n  var date = time ? new Date(time) : new Date();\r\n  // Calculate the present UTC Julian Date. \r\n  // Function is valid after the beginning of the UNIX epoch 1970-01-01 and ignores leap seconds. \r\n  var julianDay = (date / 86400000) + 2440587.5;\r\n  // Calculate Greenwich Mean Sidereal Time (low precision equation).\r\n  // http://aa.usno.navy.mil/faq/docs/GAST.php \r\n  var gst = (18.697374558 + 24.06570982441908 * (julianDay - 2451545.0)) % 24;\r\n  var lonlat = [];\r\n  var sunEclPos = _sunEclipticPosition(julianDay);\r\n  var eclObliq = _eclipticObliquity(julianDay);\r\n  var sunEqPos = _sunEquatorialPosition(sunEclPos.lambda, eclObliq);\r\n  var step = this.get('step') || 1;\r\n  for (var i = -180; i <= 180; i += step) {\r\n    var lon = i;\r\n    // Hour angle (indegrees) of the sun for a longitude on Earth.\r\n    var ha = (gst * 15 + lon) - sunEqPos.alpha;\r\n    // Latitude     \r\n    var lat = Math.atan(-Math.cos(ha * deg2rad) /\r\n      Math.tan(sunEqPos.delta * deg2rad)) * rad2deg;\r\n    // New point\r\n    lonlat.push([lon, lat]);\r\n  }\r\n  switch (options) {\r\n    case 'line': break;\r\n    case 'day': sunEqPos.delta *= -1;\r\n    // fallthrough\r\n    default: {\r\n      // Close polygon\r\n      lat = (sunEqPos.delta < 0) ? 90 : -90;\r\n      for(var tlon=180; tlon>=-180; tlon-=step){\r\n        lonlat.push([tlon,lat]);\r\n      }\r\n      lonlat.push(lonlat[0])\r\n      break;\r\n    }\r\n  }\r\n  // Return night + day polygon\r\n  if (options === 'daynight') {\r\n    var day = [];\r\n    lonlat.forEach(function (t) { day.push(t.slice()); });\r\n    day[0][1] = -day[0][1];\r\n    day[day.length-1][1] = -day[0][1];\r\n    day[day.length-1][1] = -day[0][1];\r\n    lonlat = [ lonlat, day ];\r\n  }\r\n  // Return polygon\r\n  return lonlat;\r\n};\r\n})();\r\n\r\n/*eslint no-constant-condition: [\"error\", { \"checkLoops\": false }]*/\r\n/** Delaunay source\r\n * Calculate a delaunay triangulation from points in a source\r\n * @param {*} options extend ol/source/Vector options\r\n *  @param {ol/source/Vector} options.source the source that contains the points\r\n */\r\nol.source.Delaunay = function(options) {\r\n  options = options || {};\r\n  this._nodes = options.source;\r\n  delete options.source;\r\n  ol.source.Vector.call (this, options);\r\n  // Convex hull\r\n  this.hull = [];\r\n  // A new node is added to the source node: calculate the new triangulation\r\n  this._nodes.on('addfeature', this._onAddNode.bind(this));\r\n  // A new node is removed from the source node: calculate the new triangulation\r\n  this._nodes.on('removefeature', this._onRemoveNode.bind(this));\r\n  this.set ('epsilon', options.epsilon || .0001)\r\n};\r\nol.ext.inherits(ol.source.Delaunay, ol.source.Vector);\r\n/** Clear source (and points)\r\n * @param {boolean} opt_fast\r\n */\r\nol.source.Delaunay.prototype.clear = function(opt_fast) {\r\n  ol.source.Vector.prototype.clear.call(this, opt_fast);\r\n  this.getNodeSource().clear(opt_fast);\r\n};\r\n/** Add a new triangle in the source\r\n * @param {Array<ol/coordinates>} pts\r\n */\r\nol.source.Delaunay.prototype._addTriangle = function(pts) {\r\n  pts.push(pts[0]);\r\n  var triangle = new ol.Feature(new ol.geom.Polygon([pts]));\r\n  this.addFeature(triangle);\r\n  this.flip.push(triangle);\r\n  return triangle;\r\n};\r\n/** Get nodes \r\n */\r\nol.source.Delaunay.prototype.getNodes = function () {\r\n  return this._nodes.getFeatures();\r\n};\r\n/** Get nodes source\r\n */\r\nol.source.Delaunay.prototype.getNodeSource = function () {\r\n  return this._nodes;\r\n};\r\n/**\r\n * A point has been removed\r\n * @param {ol/source/Vector.Event} evt \r\n */\r\nol.source.Delaunay.prototype._onRemoveNode = function(evt) {\r\n  // console.log(evt)\r\n  var pt = evt.feature.getGeometry().getCoordinates();\r\n  if (!pt) return;\r\n  // Still there (when removing duplicated points)\r\n  if (this.getNodesAt(pt).length) return;\r\n  // console.log('removenode', evt.feature)\r\n  // Get associated triangles\r\n  var triangles = this.getTrianglesAt(pt);\r\n  this.flip=[];\r\n  // Get hole\r\n  var i;\r\n  var edges = [];\r\n  while (triangles.length) {\r\n    var tr = triangles.pop()\r\n    this.removeFeature(tr);\r\n    tr = tr.getGeometry().getCoordinates()[0];\r\n    var pts = [];\r\n    for (i=0; i<3; i++) {\r\n      p = tr[i];\r\n      if (!ol.coordinate.equal(p,pt)) {\r\n        pts.push(p);\r\n      }\r\n    }\r\n    edges.push(pts);\r\n  }\r\n  pts = edges.pop();\r\n/* DEBUG\r\nvar se = '';\r\nedges.forEach(function(e){\r\n  se += ' - '+this.listpt(e);\r\n}.bind(this));\r\nconsole.log('EDGES', se);\r\n*/\r\n  i = 0;\r\n  function testEdge(p0, p1, index) {\r\n    if (ol.coordinate.equal(p0, pts[index])) {\r\n      if (index) pts.push(p1);\r\n      else pts.unshift(p1);\r\n      return true\r\n    }\r\n    return false;\r\n  }\r\n  while (true) {\r\n    var e = edges[i];\r\n    if ( testEdge(e[0], e[1], 0) \r\n      || testEdge(e[1], e[0], 0)\r\n      || testEdge(e[0], e[1], pts.length-1)\r\n      || testEdge(e[1], e[0], pts.length-1)\r\n    ) {\r\n      edges.splice(i,1);\r\n      i = 0;\r\n    } else {\r\n      i++\r\n    }\r\n    if (!edges.length) break;\r\n    if (i>=edges.length) {\r\n//      console.log(this.listpt(pts), this.listpt(edges));\r\n      throw '[DELAUNAY:removePoint] No edge found';\r\n    }\r\n  }\r\n  // Closed = interior\r\n// console.log('PTS', this.listpt(pts))\r\n  var closed = ol.coordinate.equal(pts[0], pts[pts.length-1]);\r\n  if (closed) pts.pop();\r\n  // Update convex hull: remove pt + add new ones\r\n  var p;\r\n  for (i; p=this.hull[i]; i++) {\r\n    if (ol.coordinate.equal(pt,p)) {\r\n      this.hull.splice(i,1);\r\n      break;\r\n    }\r\n  }\r\n  this.hull = ol.coordinate.convexHull(this.hull.concat(pts));\r\n// select.getFeatures().clear();\r\n  // \r\n  var clockwise = function (t) {\r\n    var i1, s = 0;\r\n    for (var i=0; i<t.length; i++) {\r\n      i1 = (i+1) % t.length;\r\n      s += (t[i1][0] - t[i][0]) * (t[i1][1] + t[i][1]);\r\n    }\r\n//    console.log(s)\r\n    return (s>=0 ? 1:-1)\r\n  };\r\n  // Add ears\r\n  // interior point : ear area and object area have the same sign\r\n  // extrior point : add a new point and close\r\n  var clock;\r\n  var enveloppe = pts.slice();\r\n  if (closed) {\r\n    clock = clockwise(pts);\r\n  } else {\r\n//    console.log('ouvert', pts, pts.slice().push(pt))\r\n    enveloppe.push(pt);\r\n    clock = clockwise(enveloppe);\r\n  }\r\n// console.log('S=',clock,'CLOSED',closed)\r\n// console.log('E=',this.listpt(enveloppe))\r\n  for (i=0; i<=pts.length+1; i++) {\r\n    if (pts.length<3) break;\r\n    var t = [\r\n      pts[i % pts.length],\r\n      pts[(i+1) % pts.length],\r\n      pts[(i+2) % pts.length] \r\n    ];\r\n    if (clockwise(t)===clock) {\r\n      var ok = true;\r\n      for (var k=i+3; k<i+pts.length; k++) {\r\n//        console.log('test '+k, this.listpt([pts[k % pts.length]]))\r\n        if (this.inCircle(pts[k % pts.length], t)) {\r\n          ok = false;\r\n          break;\r\n        }\r\n      }\r\n      if (ok) {\r\n// console.log(this.listpt(t),'ok');\r\n        this._addTriangle(t);\r\n        // remove\r\n        pts.splice((i+1) % pts.length, 1);\r\n        // and restart\r\n        i = -1;\r\n      }\r\n    }\r\n// else console.log(this.listpt(t),'nok');\r\n  }\r\n/* DEBUG * /\r\nif (pts.length>3) console.log('oops');\r\nconsole.log('LEAV',this.listpt(pts));\r\nvar ul = $('ul.triangles').html('');\r\n$('<li>')\r\n.text('E:'+this.listpt(enveloppe)+' - '+clock+' - '+closed)\r\n.data('triangle', new ol.Feature(new ol.geom.Polygon([enveloppe])))\r\n.click(function(){\r\n  var t = $(this).data('triangle');\r\n  select.getFeatures().clear();\r\n  select.getFeatures().push(t);\r\n})\r\n.appendTo(ul);\r\nfor (var i=0; i<this.flip.length; i++) {\r\n  $('<li>')\r\n    .text(this.listpt(this.flip[i].getGeometry().getCoordinates()[0])\r\n        +' - ' + clockwise(this.flip[i].getGeometry().getCoordinates()[0]))\r\n    .data('triangle', this.flip[i])\r\n    .click(function(){\r\n      var t = $(this).data('triangle');\r\n      select.getFeatures().clear();\r\n      select.getFeatures().push(t);\r\n    })\r\n    .appendTo(ul);\r\n}\r\n/**/\r\n  // Flip?\r\n  this.flipTriangles();\r\n};\r\n/**\r\n * A new point has been added\r\n * @param {ol/source/VectorEvent} e \r\n */\r\nol.source.Delaunay.prototype._onAddNode = function(e) {\r\n  var finserted = e.feature;\r\n  var i, p;\r\n  // Not a point!\r\n  if (finserted.getGeometry().getType() !== 'Point') {\r\n    this._nodes.removeFeature(finserted);\r\n    return;\r\n  }\r\n  // Reset flip table\r\n  this.flip = [];\r\n  var nodes = this.getNodes();\r\n  // The point\r\n  var pt = finserted.getGeometry().getCoordinates();\r\n  // Test existing point\r\n  if (this.getNodesAt(pt).length > 1) {\r\n    // console.log('remove duplicated points')\r\n    this._nodes.removeFeature(finserted);\r\n    return;\r\n  }\r\n  // Triangle needs at least 3 points\r\n  if (nodes.length <= 3) {\r\n    if (nodes.length===3) {\r\n      var pts = [];\r\n      for (i=0; i<3; i++) pts.push(nodes[i].getGeometry().getCoordinates());\r\n      this._addTriangle(pts);\r\n      this.hull = ol.coordinate.convexHull(pts);\r\n    }\r\n    return;\r\n  }\r\n  // Get the triangle\r\n  var t = this.getFeaturesAtCoordinate(pt)[0];\r\n  if (t) {\r\n    this.removeFeature(t);\r\n    t.set('del', true);\r\n    var c = t.getGeometry().getCoordinates()[0];\r\n    for (i=0; i<3; i++) {\r\n      this._addTriangle([ pt, c[i], c[(i+1)%3]]);\r\n    }\r\n  } else {\r\n    // Calculate new convex hull\r\n    var hull2 = this.hull.slice();\r\n    hull2.push(pt);\r\n    hull2 = ol.coordinate.convexHull(hull2);\r\n    // Search for points\r\n    for (i=0; p=hull2[i]; i++) {\r\n      if (ol.coordinate.equal(p,pt)) break;\r\n    }\r\n    i = (i!==0 ? i-1 : hull2.length-1);\r\n    var p0 = hull2[i];\r\n    var stop = hull2[(i+2) % hull2.length];\r\n    for (i=0; p=this.hull[i]; i++) {\r\n      if (ol.coordinate.equal(p,p0)) break;\r\n    }\r\n    // Connect to the hull\r\n    while (true) {\r\n      // DEBUG: prevent infinit loop\r\n      if (i>1000) {\r\n        console.error('[DELAUNAY:addPoint] Too many iterations')\r\n        break;\r\n      }\r\n      i++;\r\n      p = this.hull[i % this.hull.length];\r\n      this._addTriangle([pt, p, p0]);\r\n      p0 = p;\r\n      if (p[0] === stop[0] && p[1] === stop[1]) break;\r\n    }\r\n    this.hull = hull2;\r\n  }\r\n  this.flipTriangles();\r\n};\r\n/** Flipping algorithme: test new inserted triangle and flip\r\n */\r\nol.source.Delaunay.prototype.flipTriangles = function ()\t{\r\n  var count = 1000; // Count to prevent too many iterations\r\n  var pi;\r\n  while (this.flip.length) {\r\n    // DEBUG: prevent infinite loop\r\n    if (count--<0) {\r\n      console.error('[DELAUNAY:flipTriangles] Too many iterations')\r\n      break;\r\n    }\r\n    var tri = this.flip.pop();\r\n    if (tri.get('del')) continue;\r\n    var ti = tri.getGeometry().getCoordinates()[0];\r\n    for (var k=0; k<3; k++) {\r\n      // Get facing triangles\r\n      var mid = [(ti[(k+1)%3][0]+ti[k][0])/2, (ti[(k+1)%3][1]+ti[k][1])/2];\r\n      var triangles = this.getTrianglesAt(mid);\r\n      var pt1 = null;\r\n      // Get opposite point\r\n      if (triangles.length>1) {\r\n        var t0 = triangles[0].getGeometry().getCoordinates()[0];\r\n        var t1 = triangles[1].getGeometry().getCoordinates()[0];\r\n        for (pi=0; pi<t1.length; pi++) {\r\n          if (!this._ptInTriangle(t1[pi], t0)) {\r\n            pt1 = t1[pi];\r\n            break;\r\n          }\r\n        }\r\n      }\r\n      if (pt1) {\r\n        // Is in circle ?\r\n        if (this.inCircle(pt1, t0)) {\r\n          var pt2;\r\n          // Get opposite point\r\n          for (pi=0; pi<t0.length; pi++) {\r\n            if (!this._ptInTriangle(t0[pi], t1)) {\r\n              pt2 = t0.splice(pi,1)[0];\r\n              break;\r\n            }\r\n          }\r\n          // Flip triangles\r\n          if (this.intersectSegs([pt1, pt2], t0)) {\r\n            while (triangles.length) {\r\n              var tmp = triangles.pop();\r\n              tmp.set('del', true);\r\n              this.removeFeature(tmp);\r\n            }\r\n            this._addTriangle([pt1, pt2, t0[0]]);\r\n            this._addTriangle([pt1, pt2, t0[1]]);\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n};\r\n/** Test intersection beetween 2 segs\r\n * @param {Array<ol.coordinates>} d1\r\n * @param {Array<ol.coordinates>} d2\r\n * @return {bbolean}\r\n */\r\nol.source.Delaunay.prototype.intersectSegs = function (d1, d2)\t{\r\n  var d1x = d1[1][0] - d1[0][0];\r\n  var d1y = d1[1][1] - d1[0][1];\r\n  var d2x = d2[1][0] - d2[0][0];\r\n  var d2y = d2[1][1] - d2[0][1];\r\n  var det = d1x * d2y - d1y * d2x;\r\n  if (det != 0) {\r\n    var k = (d1x * d1[0][1] - d1x * d2[0][1] - d1y * d1[0][0] + d1y * d2[0][0]) / det;\r\n    // Intersection: return [d2[0][0] + k*d2x, d2[0][1] + k*d2y];\r\n    return (0<k && k<1);\r\n  }\r\n  else return false;\r\n};\r\n/** Test pt is a triangle's node\r\n * @param {ol.coordinate} pt\r\n * @param {Array<ol.coordinate>} triangle\r\n * @return {boolean}\r\n */\r\nol.source.Delaunay.prototype._ptInTriangle = function(pt, triangle) {\r\n  for (var i=0, p; p=triangle[i]; i++) {\r\n    if (ol.coordinate.equal(pt,p)) return true;\r\n  }\r\n  return false;\r\n};\r\n/** List points in a triangle (assume points get an id) for debug purposes\r\n * @param {Array<ol.coordinate>} pts\r\n * @return {String} ids list\r\n */\r\nol.source.Delaunay.prototype.listpt = function (pts) {\r\n  var s = '';\r\n  for (var i=0, p; p = pts[i]; i++) {\r\n    var c = this._nodes.getClosestFeatureToCoordinate(p);\r\n    if (!ol.coordinate.equal(c.getGeometry().getCoordinates(), p)) c=null;\r\n    s += (s?', ':'') + (c ? c.get('id') : '?');\r\n  }\r\n  return s;\r\n};\r\n/** Test if coord is within triangle's circumcircle \r\n * @param {ol.coordinate} coord\r\n * @param {Array<ol.coordinate>} triangle\r\n * @return {boolean}\r\n */\r\nol.source.Delaunay.prototype.inCircle = function (coord, triangle) {\r\n  var c = this.getCircumCircle(triangle);\r\n  return ol.coordinate.dist2d(coord, c.center) < c.radius;\r\n}\r\n/** Calculate the circumcircle of a triangle\r\n * @param {Array<ol.coordinate>} triangle\r\n * @return {*}\r\n */\r\nol.source.Delaunay.prototype.getCircumCircle = function (triangle) {\r\n  var x1 = triangle[0][0];\r\n  var y1 = triangle[0][1];\r\n  var x2 = triangle[1][0];\r\n  var y2 = triangle[1][1];\r\n  var x3 = triangle[2][0];\r\n  var y3 = triangle[2][1];\r\n  var m1 = (x1-x2)/(y2-y1);\r\n  var m2 = (x1-x3)/(y3-y1);\r\n  var b1 = ((y1+y2)/2) - m1*(x1+x2)/2;\r\n  var b2 = ((y1+y3)/2) - m2*(x1+x3)/2;\r\n  var cx = (b2-b1)/(m1-m2);\r\n  var cy = m1*cx + b1;\r\n  var center = [cx, cy];\r\n  return  { \r\n    center: center, \r\n    radius: ol.coordinate.dist2d(center,triangle[0])\r\n  };\r\n};\r\n/** Get triangles at a point\r\n */\r\nol.source.Delaunay.prototype.getTrianglesAt = function(coord) {\r\n  var extent = ol.extent.buffer (ol.extent.boundingExtent([coord]), this.get('epsilon'));\r\n  var result = [];\r\n  this.forEachFeatureIntersectingExtent(extent, function(f){\r\n    result.push(f);\r\n  });\r\n  return result;\r\n};\r\n/** Get nodes at a point\r\n */\r\nol.source.Delaunay.prototype.getNodesAt = function(coord) {\r\n  var extent = ol.extent.buffer (ol.extent.boundingExtent([coord]), this.get('epsilon'));\r\n  return this._nodes.getFeaturesInExtent(extent);\r\n};\r\n/** Get Voronoi\r\n * @param {boolean} border include border, default false\r\n * @return { Array< ol.geom.Polygon > }\r\n */\r\nol.source.Delaunay.prototype.calculateVoronoi = function(border) {\r\n  var voronoi = [];\r\n  this.getNodes().forEach(function(f) {\r\n    var pt = f.getGeometry().getCoordinates();\r\n    var isborder = false;\r\n    if (border !== true) {\r\n      for (var i=0; i<this.hull.length; i++) {\r\n        if (ol.coordinate.equal(pt, this.hull[i])) {\r\n          isborder = true;\r\n          break;\r\n        }\r\n      }\r\n    }\r\n    if (!isborder) {\r\n      var tr = this.getTrianglesAt(pt);\r\n      var pts = [];\r\n      tr.forEach(function(triangle) {\r\n        var c = this.getCircumCircle(triangle.getGeometry().getCoordinates()[0]);\r\n        pts.push({\r\n          pt: c.center,\r\n          d: Math.atan2(c.center[1]-pt[1],c.center[0]-pt[0])\r\n        })\r\n      }.bind(this));\r\n      pts.sort(function(a,b) { return a.d - b.d });\r\n      var poly = [];\r\n      pts.forEach(function(p) {\r\n        poly.push(p.pt);\r\n      });\r\n      poly.push(poly[0]);\r\n      var prop = f.getProperties();\r\n      prop.geometry = new ol.geom.Polygon([poly]);\r\n      voronoi.push(new ol.Feature(prop));\r\n    }\r\n  }.bind(this));\r\n  return voronoi;\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A source that use a set of feature to collect data on it.\r\n * If a binSource is provided the bin is recalculated when features change.\r\n * @constructor\r\n * @extends {ol.source.BinBase}\r\n * @param {Object} options ol.source.VectorOptions + grid option\r\n *  @param {ol.source.Vector} options.source source to collect in the bin\r\n *  @param {ol.source.Vector} options.binSource a source to use as bin collector, default none\r\n *  @param {Array<ol.Feature>} options.features the features, ignored if binSource is provided, default none\r\n *  @param {number} [options.size] size of the grid in meter, default 200m\r\n *  @param {function} [options.geometryFunction] Function that takes an ol.Feature as argument and returns an ol.geom.Point as feature's center.\r\n *  @param {function} [options.flatAttributes] Function takes a bin and the features it contains and aggragate the features in the bin attributes when saving\r\n */\r\nol.source.FeatureBin = function (options) {\r\n  options = options || {};\r\n  if (options.binSource) {\r\n    this._sourceFeature = options.binSource;\r\n    // When features change recalculate the bin...\r\n    var timout;\r\n    this._sourceFeature.on(['addfeature','changefeature','removefeature'], function() {\r\n      if (timout) {\r\n        // Do it only one time\r\n        clearTimeout(timout);\r\n      }\r\n      timout = setTimeout(function () {\r\n        this.reset();\r\n      }.bind(this));\r\n    }.bind(this));\r\n  } else {\r\n    this._sourceFeature = new ol.source.Vector ({ features: options.features || [] });\r\n  }\r\n  ol.source.BinBase.call(this, options);\r\n};\r\nol.ext.inherits(ol.source.FeatureBin, ol.source.BinBase);\r\n/** Set features to use as bin collector\r\n * @param {ol.Feature} features\r\n */\r\nol.source.FeatureBin.prototype.setFeatures = function (features) {\r\n  this._sourceFeature.clear();\r\n  this._sourceFeature.addFeatures(features || []);\r\n  this.reset();\r\n};\r\n/** Get the grid geometry at the coord \r\n * @param {ol.Coordinate} coord\r\n * @returns {ol.geom.Polygon} \r\n * @api\r\n */\r\nol.source.FeatureBin.prototype.getGridGeomAt = function (coord, attributes) {\r\n  var f = this._sourceFeature.getFeaturesAtCoordinate(coord)[0];\r\n  if (!f) return null;\r\n  var a = f.getProperties();\r\n  for (var i in a) {\r\n    if (i!=='geometry') attributes[i] = a[i];\r\n  }\r\n  return f.getGeometry();\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n  ol.source.GeoImage is a layer source with georeferencement to place it on a map.\r\n*/\r\n/** @typedef {Object} GeoImageOptions\r\n * @property {url} url url of the static image\r\n * @property {image} image the static image, if not provided, use url to load an image\r\n * @property {ol.Coordinate} imageCenter coordinate of the center of the image\r\n * @property {ol.Size|number} imageScale [scalex, scaley] of the image\r\n * @property {number} imageRotate angle of the image in radian, default 0\r\n * @property {ol.Extent} imageCrop of the image to be show (in the image) default: [0,0,imageWidth,imageHeight]\r\n * @property {Array.<ol.Coordinate>} imageMask linestring to mask the image on the map\r\n */\r\n/** Layer source with georeferencement to place it on a map\r\n * @constructor \r\n * @extends {ol.source.ImageCanvas}\r\n * @param {GeoImageOptions} options\r\n */\r\nol.source.GeoImage = function(opt_options) {\r\n  var options = { \r\n    attributions: opt_options.attributions,\r\n    logo: opt_options.logo,\r\n    projection: opt_options.projection\r\n  };\r\n  // options.projection = opt_options.projection;\r\n  // Load Image\r\n  this._image = (opt_options.image ? opt_options.image : new Image );\r\n  this._image.crossOrigin = opt_options.crossOrigin; // 'anonymous';\r\n  // Show image on load\r\n  var self = this;\r\n  this._image.onload = function() {\r\n    self.setCrop (self.crop);\r\n    self.changed();\r\n  }\r\n  if (!opt_options.image) this._image.src = opt_options.url;\r\n  // Draw image on canvas\r\n  options.canvasFunction = this.calculateImage;\r\n  ol.source.ImageCanvas.call (this, options);\t\r\n  // Coordinate of the image center \r\n  this.center = opt_options.imageCenter;\r\n  // Image scale \r\n  this.setScale(opt_options.imageScale);\r\n  // Rotation of the image\r\n  this.rotate = opt_options.imageRotate ? opt_options.imageRotate : 0;\r\n  // Crop of the image\r\n  this.crop = opt_options.imageCrop;\r\n  // Mask of the image\r\n  this.mask = opt_options.imageMask;\r\n  // Crop\r\n  this.setCrop (this.crop);\r\n  // Calculate extent on change\r\n  this.on('change', function() {\r\n    this.set('extent', this.calculateExtent());\r\n  }.bind(this));\r\n};\r\nol.ext.inherits(ol.source.GeoImage, ol.source.ImageCanvas);\r\n/** calculate image at extent / resolution\r\n * @param {ol/extent/Extent} extent\r\n * @param {number} resolution\r\n * @param {number} pixelRatio\r\n * @param {ol/size/Size} size\r\n * @return {HTMLCanvasElement}\r\n */\r\nol.source.GeoImage.prototype.calculateImage = function(extent, resolution, pixelRatio, size) {\r\n  if (!this.center) return;\r\n  var canvas = document.createElement('canvas');\r\n  canvas.width = size[0];\r\n  canvas.height = size[1];\r\n  var ctx = canvas.getContext('2d');\r\n  if (!this._imageSize) return canvas;\r\n  // transform coords to pixel\r\n  function tr(xy) {\r\n    return [\r\n      (xy[0]-extent[0])/(extent[2]-extent[0]) * size[0],\r\n      (xy[1]-extent[3])/(extent[1]-extent[3]) * size[1]\r\n    ];\r\n  }\r\n  // Clipping mask\r\n  if (this.mask) {\r\n    ctx.beginPath();\r\n    var p = tr(this.mask[0]);\r\n    ctx.moveTo(p[0],p[1]);\r\n    for (var i=1; i<this.mask.length; i++) {\r\n      p = tr(this.mask[i]);\r\n      ctx.lineTo(p[0],p[1]);\r\n    }\r\n    ctx.clip();\r\n  }\r\n  // Draw\r\n  var pixel = tr(this.center);\r\n  var dx = (this._image.naturalWidth/2 - this.crop[0]) *this.scale[0] /resolution *pixelRatio;\r\n  var dy = (this._image.naturalHeight/2 - this.crop[1]) *this.scale[1] /resolution *pixelRatio;\r\n  var sx = this._imageSize[0]*this.scale[0]/resolution *pixelRatio;\r\n  var sy = this._imageSize[1]*this.scale[1]/resolution *pixelRatio;\r\n  ctx.translate(pixel[0],pixel[1]);\r\n  if (this.rotate) ctx.rotate(this.rotate);\r\n  ctx.drawImage(this._image, this.crop[0], this.crop[1], this._imageSize[0], this._imageSize[1], -dx, -dy, sx,sy);\r\n  return canvas;\r\n}\r\n/**\r\n * Get coordinate of the image center.\r\n * @return {ol.Coordinate} coordinate of the image center.\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.getCenter = function() {\r\n  return this.center;\r\n}\r\n/**\r\n * Set coordinate of the image center.\r\n * @param {ol.Coordinate} coordinate of the image center.\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.setCenter = function(center) {\r\n  this.center = center;\r\n  this.changed();\r\n}\r\n/**\r\n * Get image scale.\r\n * @return {ol.size} image scale (along x and y axis).\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.getScale = function() {\r\n  return this.scale;\r\n}\r\n/**\r\n * Set image scale.\r\n * @param {ol.size|Number} image scale (along x and y axis or both).\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.setScale = function(scale) {\r\n  switch (typeof(scale)) {\r\n    case 'number':\r\n      scale = [scale,scale];\r\n      break;\r\n    case 'object': \r\n      if (scale.length != 2) return;\r\n      break;\r\n    default: return;\r\n  }\r\n  this.scale = scale;\r\n  this.changed();\r\n};\r\n/**\r\n * Get image rotation.\r\n * @return {Number} rotation in degre.\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.getRotation = function() {\r\n  return this.rotate;\r\n};\r\n/**\r\n * Set image rotation.\r\n * @param {Number} rotation in radian.\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.setRotation = function(angle) {\r\n  this.rotate = angle;\r\n  this.changed();\r\n};\r\n/**\r\n * Get the image.\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.getGeoImage = function() {\r\n  return this._image;\r\n};\r\n/**\r\n * Get image crop extent.\r\n * @return {ol.extent} image crop extent.\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.getCrop = function() {\r\n  return this.crop;\r\n};\r\n/**\r\n * Set image mask.\r\n * @param {ol.geom.LineString} coords of the mask\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.setMask = function(mask) {\r\n  this.mask = mask;\r\n  this.changed();\r\n};\r\n/**\r\n * Get image mask.\r\n * @return {ol.geom.LineString} coords of the mask\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.getMask = function() {\r\n  return this.mask;\r\n};\r\n/**\r\n * Set image crop extent.\r\n * @param {ol.extent|Number} image crop extent or a number to crop from original size.\r\n * @api stable\r\n */\r\nol.source.GeoImage.prototype.setCrop = function(crop) {\r\n  // Image not loaded => get it latter\r\n  if (!this._image.naturalWidth) {\r\n    this.crop = crop;\r\n    return;\r\n  }\r\n  if (crop) {\r\n    switch (typeof(crop)) {\r\n      case 'number':\r\n        crop = [crop,crop,this._image.naturalWidth-crop,this._image.naturalHeight-crop];\r\n        break;\r\n      case 'object': \r\n        if (crop.length != 4) return;\r\n        break;\r\n      default: return;\r\n    }\r\n    crop = ol.extent.boundingExtent([ [crop[0],crop[1]], [crop[2],crop[3]] ]);\r\n    this.crop = [ Math.max(0,crop[0]), Math.max(0,crop[1]), Math.min(this._image.naturalWidth,crop[2]), Math.min(this._image.naturalHeight,crop[3]) ];\r\n  }\r\n  else this.crop = [0,0, this._image.naturalWidth,this._image.naturalHeight];\r\n  if (this.crop[2]<=this.crop[0]) this.crop[2] = this.crop[0]+1;\r\n  if (this.crop[3]<=this.crop[1]) this.crop[3] = this.crop[1]+1;\r\n  this._imageSize = [ this.crop[2]-this.crop[0], this.crop[3]-this.crop[1] ];\r\n  this.changed();\r\n};\r\n/** Get the extent of the source.\r\n * @param {module:ol/extent~Extent} extent If provided, no new extent will be created. Instead, that extent's coordinates will be overwritten.\r\n * @return {ol.extent}\r\n */\r\nol.source.GeoImage.prototype.getExtent = function(opt_extent) {\r\n  var ext = this.get('extent');\r\n  if (!ext) ext = this.calculateExtent();\r\n  if (opt_extent) {\r\n    for (var i=0; i<opt_extent.length; i++) {\r\n      opt_extent[i] = ext[i];\r\n    }\r\n  }\r\n  return ext;\r\n};\r\n/** Calculate the extent of the source image.\r\n * @param {boolean} usemask return the mask extent, default return the image extent\r\n * @return {ol.extent}\r\n */\r\nol.source.GeoImage.prototype.calculateExtent = function(usemask) {\r\n  var polygon;\r\n  if (usemask!==false && this.getMask()) {\r\n    polygon = new ol.geom.Polygon([this.getMask()])\r\n  } else {\r\n    var center = this.getCenter();\r\n    var scale = this.getScale();\r\n    var width = this.getGeoImage().width * scale[0];\r\n    var height = this.getGeoImage().height * scale[1];\r\n    var extent = ol.extent.boundingExtent([\r\n      [ center[0]-width/2, center[1]-height/2 ],\r\n      [ center[0]+width/2, center[1]+height/2 ]\r\n    ]);\r\n    polygon = ol.geom.Polygon.fromExtent(extent);\r\n    polygon.rotate(-this.getRotation(), center);\r\n  }\r\n  var ext = polygon.getExtent();\r\n  return ext;\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** ol.source.GeoRSS is a source that load Wikimedia Commons content in a vector layer.\r\n * @constructor \r\n * @extends {ol.source.Vector}\r\n * @param {*} options source options\r\n *  @param {string} options.url GeoRSS feed url\r\n */\r\nol.source.GeoRSS = function(options) {\r\n  options = options || {};\r\n  options.loader = this._loaderFn;\r\n  ol.source.Vector.call (this, options);\r\n};\r\nol.ext.inherits(ol.source.GeoRSS, ol.source.Vector);\r\n/** Loader function used to load features.\r\n* @private\r\n*/\r\nol.source.GeoRSS.prototype._loaderFn = function(extent, resolution, projection){\r\n  // Ajax request to get source\r\n  ol.ext.Ajax.get({\r\n    url: this.getUrl(),\r\n    dataType: 'XML',\r\n    error: function(){ console.log('oops'); },\r\n    success: function(xml) {\r\n      var features = (new ol.format.GeoRSS()).readFeatures(xml, { featureProjection: projection });\r\n      this.addFeatures(features);\r\n    }.bind(this)\r\n  });\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** IGN's Geoportail WMTS source\r\n * @constructor\r\n * @extends {ol.source.WMTS}\r\n * @param {olx.source.Geoportail=} options WMTS options \r\n *  @param {string=} options.layer Geoportail layer name\r\n *  @param {number} options.minZoom\r\n *  @param {number} options.maxZoom\r\n *  @param {string} options.server\r\n *  @param {string} options.gppKey api key, default 'choisirgeoportail'\r\n *  @param {string} options.authentication basic authentication associated with the gppKey as btoa(\"login:pwd\")\r\n *  @param {string} options.format image format, default 'image/jpeg'\r\n *  @param {string} options.style layer style, default 'normal'\r\n *  @param {string} options.crossOrigin default 'anonymous'\r\n *  @param {string} options.wrapX default true\r\n */\r\nol.source.Geoportail = function (layer, options) {\r\n  options = options || {};\r\n  if (layer.layer) {\r\n    options = layer;\r\n    layer = options.layer;\r\n  }\r\n  var matrixIds = new Array();\r\n  var resolutions = new Array();//[156543.03392804103,78271.5169640205,39135.75848201024,19567.879241005125,9783.939620502562,4891.969810251281,2445.9849051256406,1222.9924525628203,611.4962262814101,305.74811314070485,152.87405657035254,76.43702828517625,38.218514142588134,19.109257071294063,9.554628535647034,4.777314267823517,2.3886571339117584,1.1943285669558792,0.5971642834779396,0.29858214173896974,0.14929107086948493,0.07464553543474241];\r\n  var size = ol.extent.getWidth(ol.proj.get('EPSG:3857').getExtent()) / 256;\r\n  for (var z=0; z <= (options.maxZoom ? options.maxZoom : 20) ; z++) {\r\n    matrixIds[z] = z ; \r\n    resolutions[z] = size / Math.pow(2, z);\r\n  }\r\n  var tg = new ol.tilegrid.WMTS ({\r\n    origin: [-20037508, 20037508],\r\n    resolutions: resolutions,\r\n    matrixIds: matrixIds\r\n  });\r\n  tg.minZoom = (options.minZoom ? options.minZoom : 0);\r\n  var attr = [ ol.source.Geoportail.prototype.attribution ];\r\n  if (options.attributions) attr = options.attributions;\r\n  this._server = options.server || 'https://wxs.ign.fr/geoportail/wmts';\r\n  this._gppKey = options.gppKey || options.key || 'choisirgeoportail';\r\n  var wmts_options = {\r\n    url: this.serviceURL(),\r\n    layer: layer,\r\n    matrixSet: 'PM',\r\n    format: options.format ? options.format : 'image/jpeg',\r\n    projection: 'EPSG:3857',\r\n    tileGrid: tg,\r\n    style: options.style ? options.style : 'normal',\r\n    attributions: attr,\r\n    crossOrigin: (typeof options.crossOrigin == 'undefined') ? 'anonymous' : options.crossOrigin,\r\n    wrapX: !(options.wrapX===false)\r\n  };\r\n  ol.source.WMTS.call(this, wmts_options);\r\n  // Load url using basic authentification\r\n  if (options.authentication) {\r\n    this.setTileLoadFunction(ol.source.Geoportail.tileLoadFunctionWithAuthentication(options.authentication, this.getFormat()));\r\n  }\r\n};\r\nol.ext.inherits(ol.source.Geoportail, ol.source.WMTS);\r\n/** Standard IGN-GEOPORTAIL attribution \r\n*/\r\nol.source.Geoportail.prototype.attribution = '<a href=\"http://www.geoportail.gouv.fr/\">Géoportail</a> &copy; <a href=\"http://www.ign.fr/\">IGN-France</a>';\r\n/** Get service URL according to server url or standard url\r\n*/\r\nol.source.Geoportail.prototype.serviceURL = function() {\r\n  if (this._server) {\r\n    return this._server.replace (/^(https?:\\/\\/[^/]*)(.*)$/, \"$1/\"+this._gppKey+\"$2\") ;\r\n  } else {\r\n    return (window.geoportailConfig ? window.geoportailConfig.url : \"https://wxs.ign.fr/\") +this._gppKey+ \"/geoportail/wmts\" ;\r\n  }\r\n};\r\n/**\r\n * Return the associated API key of the Map.\r\n * @function\r\n * @return the API key.\r\n * @api stable\r\n */\r\nol.source.Geoportail.prototype.getGPPKey = function() {\r\n  return this._gppKey;\r\n};\r\n/**\r\n * Set the associated API key to the Map.\r\n * @param {String} key the API key.\r\n * @param {String} authentication as btoa(\"login:pwd\")\r\n * @api stable\r\n */\r\nol.source.Geoportail.prototype.setGPPKey = function(key, authentication) {\r\n  this._gppKey = key;\r\n  var serviceURL = this.serviceURL();\r\n  this.setTileUrlFunction (function() {\r\n    var url = ol.source.Geoportail.prototype.getTileUrlFunction().apply(this, arguments);\r\n    if (url) {\r\n      var args = url.split(\"?\");\r\n      return serviceURL+\"?\"+args[1];\r\n    }\r\n    else return url;\r\n  });\r\n  // Load url using basic authentification\r\n  if (authentication) {\r\n    this.setTileLoadFunction(ol.source.Geoportail.tileLoadFunctionWithAuthentication(authentication, this.getFormat()));\r\n  }\r\n};\r\n/** Return the GetFeatureInfo URL for the passed coordinate, resolution, and\r\n * projection. Return `undefined` if the GetFeatureInfo URL cannot be\r\n * constructed.\r\n * @param {ol.Coordinate} coord \r\n * @param {Number} resolution \r\n * @param {ol.proj.Projection} projection default the source projection\r\n * @param {Object} options \r\n *  @param {string} options.INFO_FORMAT response format text/plain, text/html, application/json, default text/plain\r\n * @return {String|undefined} GetFeatureInfo URL.\r\n */\r\nol.source.Geoportail.prototype.getFeatureInfoUrl  = function(coord, resolution, projection, options) {\r\n  options = options || {};\r\n  if (!projection) projection = this.getProjection();\r\n  var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution(coord, resolution);\r\n  var ratio = 1;\r\n  var url = this.getTileUrlFunction()(tileCoord, ratio, projection);\r\n  if (!url) return url;\r\n  var tileResolution = this.tileGrid.getResolution(tileCoord[0]);\r\n  var tileExtent = this.tileGrid.getTileCoordExtent(tileCoord);\r\n  var i = Math.floor((coord[0] - tileExtent[0]) / (tileResolution / ratio));\r\n  var j = Math.floor((tileExtent[3] - coord[1]) / (tileResolution / ratio));\r\n  return url.replace(/Request=GetTile/i, 'Request=getFeatureInfo')\r\n    +'&INFOFORMAT='+(options.INFO_FORMAT||'text/plain')\r\n    +'&I='+i\r\n    +'&J='+j;\r\n};\r\n/** Get feature info\r\n * @param {ol.Coordinate} coord \r\n * @param {Number} resolution \r\n * @param {ol.proj.Projection} projection default the source projection\r\n * @param {Object} options \r\n *  @param {string} options.INFO_FORMAT response format text/plain, text/html, application/json, default text/plain\r\n *  @param {function} options.callback a function that take the response as parameter\r\n *  @param {function} options.error function called when an error occurred\r\n */\r\nol.source.Geoportail.prototype.getFeatureInfo = function(coord, resolution, options) {\r\n  var url = this.getFeatureInfoUrl(coord, resolution, null, options);\r\n  ol.ext.Ajax.get({\r\n    url: url,\r\n    dataType: options.format || 'text/plain',\r\n    options: { \r\n      encode: false \r\n    },\r\n    success: function(resp) {\r\n      if (options.callback) options.callback(resp);\r\n    },\r\n    error: options.error || function(){}\r\n  })\r\n};\r\n/** Get a tile load function to load tiles with basic authentication\r\n * @param {string} authentication as btoa(\"login:pwd\")\r\n * @param {string} format mime type\r\n * @return {function} tile load function to load tiles with basic authentication\r\n */\r\nol.source.Geoportail.tileLoadFunctionWithAuthentication = function(authentication, format) {\r\n  if (!authentication) return undefined;\r\n  return function(tile, src) {\r\n    var xhr = new XMLHttpRequest();\r\n    xhr.open(\"GET\", src);\r\n    xhr.setRequestHeader(\"Authorization\", \"Basic \" + authentication);\r\n    xhr.responseType = \"arraybuffer\";\r\n    xhr.onload = function () {\r\n      var arrayBufferView = new Uint8Array(this.response);\r\n      var blob = new Blob([arrayBufferView], { type: format });\r\n      var urlCreator = window.URL || window.webkitURL;\r\n      var imageUrl = urlCreator.createObjectURL(blob);\r\n      tile.getImage().src = imageUrl;\r\n    };\r\n    xhr.onerror = function () {\r\n      tile.getImage().src = \"\";\r\n    };\r\n    xhr.send();\r\n  };\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A source for grid binning\r\n * @constructor\r\n * @extends {ol.source.Vector}\r\n * @param {Object} options ol.source.VectorOptions + grid option\r\n *  @param {ol.source.Vector} options.source Source\r\n *  @param {number} [options.size] size of the grid in meter, default 200m\r\n *  @param {function} [options.geometryFunction] Function that takes an ol.Feature as argument and returns an ol.geom.Point as feature's center.\r\n *  @param {function} [options.flatAttributes] Function takes a bin and the features it contains and aggragate the features in the bin attributes when saving\r\n */\r\nol.source.GridBin = function (options) {\r\n  options = options || {};\r\n  ol.source.BinBase.call(this, options);\r\n  this.set('gridProjection', options.gridProjection || 'EPSG:4326');\r\n  this.set('size', options.size || 1);\r\n};\r\nol.ext.inherits(ol.source.GridBin, ol.source.BinBase);\r\n/** Set grid projection\r\n * @param {ol.ProjectionLike} proj\r\n */\r\nol.source.GridBin.prototype.setGridProjection = function (proj) {\r\n  this.set('gridProjection', proj);\r\n  this.reset();\r\n};\r\n/** Set grid size\r\n * @param {number} size\r\n */\r\nol.source.GridBin.prototype.setSize = function (size) {\r\n  this.set('size', size);\r\n  this.reset();\r\n};\r\n/** Get the grid geometry at the coord \r\n * @param {ol.Coordinate} coord\r\n * @returns {ol.geom.Polygon} \r\n * @api\r\n */\r\nol.source.GridBin.prototype.getGridGeomAt = function (coord) {\r\n  coord = ol.proj.transform (coord, this.getProjection() || 'EPSG:3857', this.get('gridProjection'));\r\n  var size = this.get('size');\r\n  var x = size * Math.floor(coord[0] / size);\r\n  var y = size * Math.floor(coord[1] / size);\r\n  var geom = new ol.geom.Polygon([[[x,y], [x+size,y], [x+size,y+size], [x,y+size], [x,y]]]);\r\n  return geom.transform(this.get('gridProjection'), this.getProjection() || 'EPSG:3857');\r\n};\r\n\r\n/*\tCopyright (c) 2017-2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A source for hexagonal binning\r\n * @constructor\r\n * @extends {ol.source.Vector}\r\n * @param {Object} options ol.source.VectorOptions + ol.HexGridOptions\r\n *  @param {ol.source.Vector} options.source Source\r\n *  @param {number} [options.size] size of the hexagon in map units, default 80000\r\n *  @param {ol.coordinate} [options.origin] origin of the grid, default [0,0]\r\n *  @param {HexagonLayout} [options.layout] grid layout, default pointy\r\n *  @param {function} [options.geometryFunction] Function that takes an ol.Feature as argument and returns an ol.geom.Point as feature's center.\r\n *  @param {function} [options.flatAttributes] Function takes a bin and the features it contains and aggragate the features in the bin attributes when saving\r\n */\r\nol.source.HexBin = function (options) {\r\n  options = options || {};\r\n  /** The HexGrid\r\n   * \t@type {ol.HexGrid}\r\n   */\r\n  this._hexgrid = new ol.HexGrid(options);\r\n  ol.source.BinBase.call(this, options);\r\n};\r\nol.ext.inherits(ol.source.HexBin, ol.source.BinBase);\r\n/** Get the hexagon geometry at the coord \r\n * @param {ol.Coordinate} coord\r\n * @returns {ol.geom.Polygon} \r\n * @api\r\n */\r\nol.source.HexBin.prototype.getGridGeomAt = function (coord) {\r\n  var h = this._hexgrid.coord2hex(coord);\r\n  return new ol.geom.Polygon([this._hexgrid.getHexagon(h)])\r\n};\r\n/**\tSet the inner HexGrid size.\r\n * \t@param {number} newSize\r\n * \t@param {boolean} noreset If true, reset will not be called (It need to be called through)\r\n */\r\nol.source.HexBin.prototype.setSize = function (newSize, noreset) {\r\n  this._hexgrid.setSize(newSize);\r\n  if (!noreset) {\r\n    this.reset();\r\n  }\r\n}\r\n/**\tGet the inner HexGrid size.\r\n * \t@return {number}\r\n */\r\nol.source.HexBin.prototype.getSize = function () {\r\n  return this._hexgrid.getSize();\r\n}\r\n/**\tSet the inner HexGrid layout.\r\n * \t@param {HexagonLayout} newLayout\r\n * \t@param {boolean} noreset If true, reset will not be called (It need to be called through)\r\n */\r\nol.source.HexBin.prototype.setLayout = function (newLayout, noreset) {\r\n  this._hexgrid.setLayout(newLayout);\r\n  if (!noreset) {\r\n    this.reset();\r\n  }\r\n}\r\n/**\tGet the inner HexGrid layout.\r\n * \t@return {HexagonLayout}\r\n */\r\nol.source.HexBin.prototype.getLayout = function () {\r\n  return this._hexgrid.getLayout();\r\n};\r\n/**\tSet the inner HexGrid origin.\r\n * \t@param {ol.Coordinate} newLayout\r\n * \t@param {boolean} noreset If true, reset will not be called (It need to be called through)\r\n */\r\nol.source.HexBin.prototype.setOrigin = function (newLayout, noreset) {\r\n  this._hexgrid.setOrigin(newLayout);\r\n  if (!noreset) {\r\n    this.reset();\r\n  }\r\n};\r\n/**\tGet the inner HexGrid origin.\r\n * \t@return {ol.Coordinate}\r\n */\r\nol.source.HexBin.prototype.getOrigin = function () {\r\n  return this._hexgrid.getOrigin();\r\n};\r\n/**\r\n * Get hexagons without circular dependencies (vs. getFeatures)\r\n * @return {Array<ol.Feature>}\r\n */\r\nol.source.HexBin.prototype.getHexFeatures = function () {\r\n  return ol.source.BinBase.prototype.getGridFeatures.call(this);\r\n};\r\n\r\n/*\tCopyright (c) 2021 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n*/\r\n/** Inverse distance weighting interpolated source - Shepard's method\r\n * @see https://en.wikipedia.org/wiki/Inverse_distance_weighting\r\n * @constructor \r\n * @extends {ol.source.ImageCanvas}\r\n * @param {*} [options]\r\n *  @param {ol.source.vector} options.source a source to interpolate\r\n *  @param {number} [options.scale=4] scale factor, use large factor to enhance performances (but minor accuracy)\r\n *  @param {string|function} options.weight The feature attribute to use for the weight or a function that returns a weight from a feature. Weight values should range from 0 to 100. Default use the weight attribute of the feature.\r\n */\r\nol.source.IDW = function(options) {\r\n  options = options || {};\r\n  // Draw image on canvas\r\n  options.canvasFunction = this.calculateImage;\r\n  this._source = options.source;\r\n  this._canvas = document.createElement('CANVAS');\r\n  this._source.on(['addfeature','removefeature','clear','removefeature'], function() {\r\n    this.changed();\r\n  }.bind(this));\r\n  ol.source.ImageCanvas.call (this, options);\r\n  this.set('scale', options.scale || 4);\r\n  this._weight = typeof(options.weight) === 'function' ? options.weight : function(f) { return f.get(options.weight||'weight'); }\r\n};\r\nol.ext.inherits(ol.source.IDW, ol.source.ImageCanvas);\r\n/** Get the source\r\n */\r\nol.source.IDW.prototype.getSource = function() {\r\n  return this._source;\r\n};\r\n/** Convert hue to rgb factor\r\n * @param {number} h\r\n * @return {number}\r\n * @private\r\n */\r\nol.source.IDW.prototype.hue2rgb = function(h) {\r\n  h = (h + 6) % 6;\r\n  if (h < 1) return Math.round(h * 255);\r\n  if (h < 3) return 255;\r\n  if (h < 4) return Math.round((4 - h) * 255);\r\n  return 0;\r\n};\r\n/** Get color for a value. Return an array of RGBA values.\r\n * @param {number} v value\r\n * @returns {Array<number>} \r\n * @api\r\n */\r\nol.source.IDW.prototype.getColor = function(v) {\r\n  // Get hue\r\n  var h = 4 - (0.04 * v);\r\n  // Convert to RGB\r\n  return [\r\n    this.hue2rgb(h + 2), \r\n    this.hue2rgb(h),\r\n    this.hue2rgb(h - 2),\r\n    255\r\n  ]\r\n};\r\n/** Apply the value to the map RGB. Overwrite this function to set your own colors.\r\n * @param {number} v value\r\n * @param {Uint8ClampedArray} data RGBA array\r\n * @param {number} i index in the RGBA array\r\n * @api\r\n */\r\nol.source.IDW.prototype.setData = function(v, data, i) {\r\n  // Get color\r\n  var color = this.getColor(v)\r\n  // Convert to RGB\r\n  data[i] = color[0];\r\n  data[i+1] = color[1];\r\n  data[i+2] = color[2];\r\n  data[i+3] = color[3];\r\n};\r\n/** Get image value at coord (RGBA)\r\n * @param {l.coordinate} coord\r\n * @return {Uint8ClampedArray}\r\n */\r\nol.source.IDW.prototype.getValue = function(coord) {\r\n  if (!this._canvas) return null\r\n  var pt = this.transform(coord);\r\n  var v = this._canvas.getContext('2d').getImageData(Math.round(pt[0]), Math.round(pt[1]), 1, 1).data;\r\n  return (v);\r\n};\r\n/** Calculate IDW at extent / resolution\r\n * @param {ol/extent/Extent} extent\r\n * @param {number} resolution\r\n * @param {number} pixelRatio\r\n * @param {ol/size/Size} size\r\n * @return {HTMLCanvasElement}\r\n * @private\r\n */\r\nol.source.IDW.prototype.calculateImage = function(extent, resolution, pixelRatio, size) {\r\n  if (!this._source) return this._canvas;\r\n  // Calculation canvas at small resolution\r\n  var canvas = document.createElement('CANVAS');\r\n  var width = canvas.width = Math.round(size[0] / (this.get('scale')*pixelRatio));\r\n  var height = canvas.height = Math.round(size[1] / (this.get('scale')*pixelRatio));\r\n  var ctx = canvas.getContext('2d');\r\n  var imageData = ctx.getImageData(0, 0, width, height);\r\n  // Transform coords to pixel / value\r\n  var pts = [];\r\n  var dw = width / (extent[2]-extent[0]);\r\n  var dh = height / (extent[1]-extent[3]);\r\n  var tr = this.transform = function(xy, v) {\r\n    return [\r\n      (xy[0]-extent[0]) * dw,\r\n      (xy[1]-extent[3]) * dh,\r\n      v\r\n    ];\r\n  }\r\n  // Get features / weight\r\n  this._source.getFeatures().forEach(function(f) {\r\n    pts.push(tr(f.getGeometry().getFirstCoordinate(), this._weight(f)));\r\n  }.bind(this));\r\n  // Compute image\r\n  var x, y;\r\n  for (y = 0; y < height; y++) {\r\n    for (x = 0; x < width; x++) {\r\n      var t = 0, b = 0;\r\n      for(var i = 0; i < pts.length; ++i) {\r\n        var dx = x -  pts[i][0];\r\n        var dy = y -  pts[i][1];\r\n        var d = dx*dx + dy*dy;\r\n        // Inverse distance weighting - Shepard's method\r\n        if (d === 0) {\r\n          b = 1; \r\n          t = pts[i][2];\r\n          break;\r\n        }\r\n        var inv = 1 / (d*d);\r\n        t += inv * pts[i][2];\r\n        b += inv;\r\n      }\r\n      this.setData(t/b, imageData.data, (y*width + x)*4);\r\n    }\r\n  }\r\n  ctx.putImageData(imageData, 0, 0);\r\n  /* DEBUG : Draw points * /\r\n  pts.forEach(function(p) {\r\n    ctx.fillRect(p[0], p[1], 1, 1);\r\n  });\r\n  /**/\r\n  // Draw full resolution canvas\r\n  this._canvas.width = Math.round(size[0]);\r\n  this._canvas.height = Math.round(size[1]);\r\n  this._canvas.getContext('2d').drawImage(canvas, 0, 0, size[0], size[1]);\r\n  return this._canvas;\r\n}\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A source for INSEE grid\r\n * @constructor\r\n * @extends {ol.source.Vector}\r\n * @param {Object} options ol.source.VectorOptions + grid option\r\n *  @param {ol.source.Vector} options.source Source\r\n *  @param {number} [options.size] size of the grid in meter, default 200m\r\n *  @param {function} [options.geometryFunction] Function that takes an ol.Feature as argument and returns an ol.geom.Point as feature's center.\r\n *  @param {function} [options.flatAttributes] Function takes a bin and the features it contains and aggragate the features in the bin attributes when saving\r\n */\r\nol.source.InseeBin = function (options) {\r\n  options = options || {};\r\n  this._grid = new ol.InseeGrid({ size: options.size });\r\n  ol.source.BinBase.call(this, options);\r\n};\r\nol.ext.inherits(ol.source.InseeBin, ol.source.BinBase);\r\n/** Set grid size\r\n * @param {number} size\r\n */\r\nol.source.InseeBin.prototype.setSize = function (size) {\r\n  if (this.getSize() !== size) {\r\n    this._grid.set('size', size);\r\n    this.reset();\r\n  }\r\n};\r\n/** Get grid size\r\n * @return {number} size\r\n */\r\nol.source.InseeBin.prototype.getSize = function () {\r\n  return this._grid.get('size');\r\n};\r\n/** Get the grid geometry at the coord \r\n * @param {ol.Coordinate} coord\r\n * @returns {ol.geom.Polygon} \r\n * @api\r\n */\r\nol.source.InseeBin.prototype.getGridGeomAt = function (coord) {\r\n  return this._grid.getGridAtCoordinate(coord, this.getProjection());\r\n};\r\n/** Get grid extent \r\n * @param {ol.ProjectionLike} proj\r\n * @return {ol.Extent}\r\n */\r\nol.source.InseeBin.prototype.getGridExtent = function (proj) {\r\n  return this._grid.getExtent(proj);\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n\t@classdesc\r\n\tol.source.Mapillary is a source that load Mapillary's geotagged photos in a vector layer.\r\n\tInherits from:\r\n\t<ol.source.Vector>\r\n*/\r\n/**\r\n* @constructor ol.source.Mapillary\r\n* @extends {ol.source.Vector}\r\n* @param {olx.source.Mapillary=} options\r\n*/\r\nol.source.Mapillary = function(opt_options)\r\n{\tvar options = opt_options || {};\r\n\toptions.loader = this._loaderFn;\r\n\t/** Max resolution to load features  */\r\n\tthis._maxResolution = options.maxResolution || 100;\r\n\t/** Query limit */\r\n\tthis._limit = options.limit || 100;\r\n\t/** Default attribution */\r\n\tif (!options.attributions) options.attributions = [ \"&copy; <a href='https://www.mapillary.com/'>Mapillary</a>\" ];\r\n\t// Bbox strategy : reload at each move\r\n    if (!options.strategy) options.strategy = ol.loadingstrategy.bbox;\r\n\t// Init parent\r\n\tol.source.Vector.call (this, options);\r\n\t// Client ID\r\n\t// this.set(\"clientId\", options.clientId);\r\n};\r\nol.ext.inherits(ol.source.Mapillary, ol.source.Vector);\r\n/** Decode wiki attributes and choose to add feature to the layer\r\n* @param {feature} the feature\r\n* @param {attributes} wiki attributes\r\n* @return {boolean} true: add the feature to the layer\r\n* @API stable\r\n*/\r\nol.source.Mapillary.prototype.readFeature = function (/*feature, attributes*/)\r\n{\t// Allways read feature (no filter)\r\n\treturn true;\r\n};\r\n/** Loader function used to load features.\r\n* @private\r\n*/\r\nol.source.Mapillary.prototype._loaderFn = function(extent, resolution, projection)\r\n{\tif (resolution > this._maxResolution) return;\r\n\tvar bbox = ol.proj.transformExtent(extent, projection, \"EPSG:4326\");\r\n\t// Commons API: for more info @see https://www.mapillary.com/developer\r\n\tvar date = Date.now() - 6 * 30 * 24 * 60 * 60 * 1000;\r\n\tvar url = \"https://a.mapillary.com/v2/search/im?client_id=\"\r\n\t\t+ this.get('clientId')\r\n\t\t+ \"&max_lat=\" + bbox[3]\r\n\t\t+ \"&max_lon=\" + bbox[2]\r\n\t\t+ \"&min_lat=\" + bbox[1]\r\n\t\t+ \"&min_lon=\" + bbox[0]\r\n\t\t+ \"&limit=\"+(this._limit-1)\r\n\t\t+ \"&start_time=\" + date;\r\n\t// Ajax request to get the tile\r\n\tol.ext.Ajax.get(\r\n\t{\turl: url,\r\n\t\tdataType: 'jsonp', \r\n\t\tsuccess: function(data) \r\n\t\t{\tconsole.log(data);\r\n\t\t\t/*\r\n\t\t\tvar features = [];\r\n\t\t\tvar att, pt, feature, lastfeature = null;\r\n\t\t\tif (data.query && data.query.pages) return;\r\n\t\t\tfor ( var i in data.query.pages)\r\n\t\t\t{\tatt = data.query.pages[i];\r\n\t\t\t\tif (att.coordinates && att.coordinates.length ) \r\n\t\t\t\t{\tpt = [att.coordinates[0].lon, att.coordinates[0].lat];\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\tvar meta = att.imageinfo[0].metadata;\r\n\t\t\t\t\tif (!meta)\r\n\t\t\t\t\t{\t//console.log(att);\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpt = [];\r\n\t\t\t\t\tfor (var k=0; k<meta.length; k++)\r\n\t\t\t\t\t{\tif (meta[k].name==\"GPSLongitude\") pt[0] = meta[k].value;\r\n\t\t\t\t\t\tif (meta[k].name==\"GPSLatitude\") pt[1] = meta[k].value;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!pt.length) \r\n\t\t\t\t\t{\t//console.log(att);\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfeature = new ol.Feature(new ol.geom.Point(ol.proj.transform (pt,\"EPSG:4326\",projection)));\r\n\t\t\t\tatt.imageinfo[0].title = att.title;\r\n\t\t\t\tif (self.readFeature(feature, att.imageinfo[0]))\r\n\t\t\t\t{\tfeatures.push(feature);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tself.addFeatures(features);\r\n\t\t\t*/\r\n    }});\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A source to turn your maps into oil paintings...\r\n * Original idea:  Santhosh G https://www.codeproject.com/Articles/471994/OilPaintEffect\r\n * JS implementation: Loktar (https://github.com/loktar00) https://codepen.io/loktar00/full/Fhzot/\r\n * @constructor\r\n * @extends {ol.source.Vector}\r\n * @param {Object} options\r\n *  @param {Array<ol/source/Source|ol/layer/Layer>} sources Input sources or layers. For vector data, use an VectorImage layer.\r\n *  @param {number} radius default 4\r\n *  @param {number} intensity default 25\r\n */\r\nol.source.OilPainting = function (options) {\r\n  options.operation = this._operation;\r\n  options.operationType = 'image';\r\n  ol.source.Raster.call(this, options);\r\n  this.set('radius', options.radius || 4);\r\n  this.set('intensity', options.intensity || 25);\r\n  this.on('beforeoperations', function (event) {\r\n    var w = Math.round((event.extent[2]-event.extent[0])/event.resolution);\r\n    var h = Math.round((event.extent[3]-event.extent[1])/event.resolution);\r\n    event.data.image = new ImageData(w,h);\r\n    event.data.radius = Number(this.get('radius')) || 1;\r\n    event.data.intensity = Number(this.get('intensity'));\r\n  }.bind(this));\r\n};\r\nol.ext.inherits(ol.source.OilPainting, ol.source.Raster);\r\n/** Set value and force change\r\n */\r\nol.source.OilPainting.prototype.set = function(key, val) {\r\n  if (val) {\r\n    switch (key) {\r\n      case 'intensity': \r\n      case 'radius': {\r\n        val = Number(val);\r\n        if (val<1) val = 1;\r\n        this.changed();\r\n        break;\r\n      }\r\n    }\r\n  }\r\n  return ol.source.Raster.prototype.set.call(this, key, val);\r\n};\r\n/**\r\n * @private\r\n */\r\nol.source.OilPainting.prototype._operation = function(pixels, data) {\r\n  var width = pixels[0].width,\r\n    height = pixels[0].height,\r\n    imgData = pixels[0],\r\n    pixData = imgData.data,\r\n    pixelIntensityCount = [];\r\n  var destImageData = data.image,\r\n    destPixData = destImageData.data,\r\n    intensityLUT = [],\r\n    rgbLUT = [];\r\n  for (var y = 0; y < height; y++) {\r\n    intensityLUT[y] = [];\r\n    rgbLUT[y] = [];\r\n    for (var x = 0; x < width; x++) {\r\n      var idx = (y * width + x) * 4,\r\n        r = pixData[idx],\r\n        g = pixData[idx + 1],\r\n        b = pixData[idx + 2],\r\n        avg = (r + g + b) / 3;\r\n      intensityLUT[y][x] = Math.round((avg * data.intensity) / 255);\r\n      rgbLUT[y][x] = {\r\n        r: r,\r\n        g: g,\r\n        b: b\r\n      };\r\n    }\r\n  }\r\n  var radius = data.radius;\r\n  for (y = 0; y < height; y++) {\r\n    for (x = 0; x < width; x++) {\r\n      pixelIntensityCount = [];\r\n      // Find intensities of nearest pixels within radius.\r\n      for (var yy = -radius; yy <= radius; yy++) {\r\n        for (var xx = -radius; xx <= radius; xx++) {\r\n          if (y + yy > 0 && y + yy < height && x + xx > 0 && x + xx < width) {\r\n            var intensityVal = intensityLUT[y + yy][x + xx];\r\n            if (!pixelIntensityCount[intensityVal]) {\r\n              pixelIntensityCount[intensityVal] = {\r\n                val: 1,\r\n                r: rgbLUT[y + yy][x + xx].r,\r\n                g: rgbLUT[y + yy][x + xx].g,\r\n                b: rgbLUT[y + yy][x + xx].b\r\n              }\r\n            } else {\r\n              pixelIntensityCount[intensityVal].val++;\r\n              pixelIntensityCount[intensityVal].r += rgbLUT[y + yy][x + xx].r;\r\n              pixelIntensityCount[intensityVal].g += rgbLUT[y + yy][x + xx].g;\r\n              pixelIntensityCount[intensityVal].b += rgbLUT[y + yy][x + xx].b;\r\n            }\r\n          }\r\n        }\r\n      }\r\n      pixelIntensityCount.sort(function (a, b) {\r\n        return b.val - a.val;\r\n      });\r\n      var curMax = pixelIntensityCount[0].val,\r\n        dIdx = (y * width + x) * 4;\r\n      destPixData[dIdx] = ~~ (pixelIntensityCount[0].r / curMax);\r\n      destPixData[dIdx + 1] = ~~ (pixelIntensityCount[0].g / curMax);\r\n      destPixData[dIdx + 2] = ~~ (pixelIntensityCount[0].b / curMax);\r\n      destPixData[dIdx + 3] = 255;\r\n    }\r\n  }\r\n  return destImageData;\r\n};\r\n\r\n/*\tCopyright (c) 2018 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * OSM layer using the Ovepass API\r\n * @constructor ol.source.Overpass\r\n * @extends {ol.source.Vector}\r\n * @param {any} options\r\n *  @param {string} options.url service url, default: https://overpass-api.de/api/interpreter\r\n *  @param {Array<string>} options.filter an array of tag filters, ie. [\"key\", \"key=value\", \"key~value\", ...]\r\n *  @param {boolean} options.node get nodes, default: true\r\n *  @param {boolean} options.way get ways, default: true\r\n *  @param {boolean} options.rel get relations, default: false\r\n *  @param {number} options.maxResolution maximum resolution to load features\r\n *  @param {string|ol.Attribution|Array<string>} options.attributions source attribution, default OSM attribution\r\n *  @param {ol.loadingstrategy} options.strategy loading strategy, default ol.loadingstrategy.bbox\r\n */\r\nol.source.Overpass = function(options) {\r\n\toptions = options || {};\r\n\toptions.loader = this._loaderFn;\r\n\t/** Ovepass API Url */\r\n\tthis._url = options.url || 'https://overpass-api.de/api/interpreter';\r\n\t/** Max resolution to load features  */\r\n\tthis._maxResolution = options.maxResolution || 100;\r\n\t/** Default attribution */\r\n\tif (!options.attributions) {\r\n    options.attributions = ol.source.OSM.ATTRIBUTION;\r\n  }\r\n\t// Bbox strategy : reload at each move\r\n  if (!options.strategy) options.strategy = ol.loadingstrategy.bbox;\r\n  ol.source.Vector.call (this, options);\r\n  this._types = {\r\n    node: options.node!==false,\r\n    way: options.way!==false,\r\n    rel: options.rel===true\r\n  };\r\n  this._filter = options.filter;\r\n};\r\nol.ext.inherits(ol.source.Overpass, ol.source.Vector);\r\n/** Loader function used to load features.\r\n* @private\r\n*/\r\nol.source.Overpass.prototype._loaderFn = function(extent, resolution, projection) {\r\n  if (resolution > this._maxResolution) return;\r\n\tvar self = this;\r\n  var bbox = ol.proj.transformExtent(extent, projection, \"EPSG:4326\");\r\n  bbox = bbox[1] + ',' + bbox[0] + ',' + bbox[3] + ',' + bbox[2];\r\n  // Overpass QL\r\n  var query = '[bbox:'+bbox+'][out:xml][timeout:25];';\r\n  query += '(';\r\n  // Search attributes\r\n  for (var t in this._types) {\r\n    if (this._types[t]) {\r\n      query += t;\r\n      for (var n=0, filter; filter = this._filter[n]; n++) {\r\n        query += '['+filter+']';\r\n      }\r\n      query += ';'\r\n    }\r\n  }\r\n  query +=');out;>;out skel qt;'\r\n  var ajax = new XMLHttpRequest();\r\n\tajax.open('POST', this._url, true);\r\n\tajax.onload = function () {\r\n    var features = new ol.format.OSMXML().readFeatures(this.responseText,{featureProjection: projection});\r\n    var result = [];\r\n    // Remove duplicated features\r\n    for (var i=0, f; f=features[i]; i++) {\r\n      if (!self.hasFeature(f)) result.push(f);\r\n    }\r\n    self.addFeatures(result);\r\n\t};\r\n\tajax.onerror = function () {\r\n\t\tconsole.log(arguments);\r\n\t};\r\n  ajax.send('data='+query);\r\n};\r\n/**\r\n * Search if feature is allready loaded\r\n * @param {ol.Feature} feature\r\n * @return {boolean} \r\n * @private\r\n */\r\nol.source.Overpass.prototype.hasFeature = function(feature) {\r\n\tvar p = feature.getGeometry().getFirstCoordinate();\r\n\tvar id = feature.getId();\r\n\tvar existing = this.getFeaturesInExtent([p[0]-0.1, p[1]-0.1, p[0]+0.1, p[1]+0.1]);\r\n\tfor (var i=0, f; f=existing[i]; i++) {\r\n\t\tif (id===f.getId()) {\r\n      return true;\r\n    }\r\n\t}\r\n\treturn false;\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A vector source to load WFS at a tile zoom level\r\n * @constructor\r\n * @fires tileloadstart\r\n * @fires tileloadend\r\n * @fires tileloaderror\r\n * @fires overload\r\n * @extends {ol.source.Vector}\r\n * @param {Object} options\r\n *  @param {string} [options.version=1.1.0] WFS version to use. Can be either 1.0.0, 1.1.0 or 2.0.0.\r\n *  @param {string} options.typeName WFS type name parameter\r\n *  @param {number} options.tileZoom zoom to load the tiles\r\n *  @param {number} options.maxFeatures maximum features returned in the WFS\r\n *  @param {number} options.featureLimit maximum features in the source before refresh, default Infinity\r\n *  @param {boolean} [options.pagination] experimental enable pagination, default no pagination\r\n */\r\nol.source.TileWFS = function (options) {\r\n  options = options || {};\r\n  if (!options.featureLimit) options.featureLimit = Infinity;\r\n  // Tile loading strategy\r\n  var zoom = options.tileZoom || 14;\r\n  var sourceOpt = {\r\n    strategy: ol.loadingstrategy.tile(ol.tilegrid.createXYZ({ minZoom: zoom, maxZoom: zoom, tileSize:512  }))\r\n  };\r\n  // Loading params\r\n  var format = new ol.format.GeoJSON();\r\n  var url = options.url\r\n    + '?service=WFS'\r\n    + '&request=GetFeature'\r\n    + '&version=' + (options.version || '1.1.0')\r\n    + '&typename=' + (options.typeName || '')\r\n    + '&outputFormat=application/json';\r\n  if (options.maxFeatures) {\r\n    url += '&maxFeatures=' + options.maxFeatures + '&count=' + options.maxFeatures;\r\n  }\r\n  var loader = { loading: 0, loaded: 0 };\r\n  // Loading fn\r\n  sourceOpt.loader = function(extent, resolution, projection) {\r\n    if (loader.loading === loader.loaded) {\r\n      loader.loading = loader.loaded = 0;\r\n      if (this.getFeatures().length > options.maxFeatures) {\r\n        this.clear();\r\n        this.refresh();\r\n      }\r\n    }\r\n    loader.loading++;\r\n    this.dispatchEvent({ \r\n      type: 'tileloadstart',\r\n      loading: loader.loading, \r\n      loaded: loader.loaded\r\n    });\r\n    this._loadTile(url, extent, projection, format, loader);\r\n  }\r\n  ol.source.Vector.call(this, sourceOpt);\r\n  this.set('pagination', options.pagination);\r\n};\r\nol.ext.inherits(ol.source.TileWFS, ol.source.Vector);\r\n/**\r\n * \r\n */\r\nol.source.TileWFS.prototype._loadTile = function(url, extent, projection, format, loader) {\r\n  var req = url \r\n    + '&srsname=' + projection.getCode()\r\n    + '&bbox=' + extent.join(',') + ',' + projection.getCode();\r\n  if (this.get('pagination') && !/&startIndex/.test(url)) {\r\n    req += '&startIndex=0';\r\n  }\r\n  ol.ext.Ajax.get({\r\n    url: req,\r\n    success: function(response) {\r\n      loader.loaded++;\r\n      if (response.error) {\r\n        this.dispatchEvent({ \r\n          type: 'tileloaderror', \r\n          error: response, \r\n          loading: loader.loading, \r\n          loaded: loader.loaded \r\n        });\r\n      } else {\r\n        var pos = response.numberReturned || 0;\r\n        if (/&startIndex/.test(url)) {\r\n          pos += parseInt(url.replace(/.*&startIndex=(\\d*).*/, '$1'));\r\n          url = url.replace(/&startIndex=(\\d*)/, '');\r\n        }\r\n        // Still something to load ?\r\n        if (pos < response.totalFeatures) {\r\n          if (!this.get('pagination')) {\r\n            this.dispatchEvent({ type: 'overload', total: response.totalFeatures, returned: response.numberReturned });\r\n            this.dispatchEvent({ \r\n              type: 'tileloadend', \r\n              loading: loader.loading, \r\n              loaded: loader.loaded \r\n            });\r\n          } else {\r\n            url += '&startIndex='+pos;\r\n            loader.loaded--;\r\n            this._loadTile(url, extent, projection, format, loader);\r\n          }\r\n        } else {\r\n          this.dispatchEvent({ \r\n            type: 'tileloadend', \r\n            loading: loader.loading, \r\n            loaded: loader.loaded \r\n          });\r\n        }\r\n        var features = format.readFeatures(response, {\r\n          featureProjection: projection\r\n        });\r\n        if (features.length > 0) {\r\n          this.addFeatures(features);\r\n        }\r\n      }\r\n    }.bind(this),\r\n    error: function(e) {\r\n      loader.loaded++;\r\n      this.dispatchEvent({\r\n        type: 'tileloaderror',\r\n        error: e,\r\n        loading: loader.loading, \r\n        loaded: loader.loaded\r\n      });\r\n    }.bind(this)\r\n  })\r\n};\r\n\r\n(function () {\r\n  var clear = ol.source.Vector.prototype.clear;\r\n  /** Overwrite ol/source/Vector clear to fire clearstart / clearend event\r\n   */\r\n  ol.source.Vector.prototype.clear = function(opt_fast) {\r\n    this.dispatchEvent({ type: 'clearstart' });\r\n    clear.call(this, opt_fast)\r\n    this.dispatchEvent({ type: 'clearend' });\r\n  };\r\n})();\r\n\r\n/** \r\n * @classdesc 3D vector layer rendering\r\n * @constructor\r\n * @extends {pl.layer.Image}\r\n * @param {Object} options\r\n *  @param {ol.layer.Vector} options.source the source to display in 3D\r\n *  @param {ol.style.Style} options.styler drawing style\r\n *  @param {number} options.maxResolution  max resolution to render 3D\r\n *  @param {number} options.defaultHeight default height if none is return by a propertie\r\n *  @param {function|string|Number} options.height a height function (returns height giving a feature) or a popertie name for the height or a fixed value\r\n *  @param {Array<number>} options.center center of the view, default [.5,1]\r\n */\r\nol.layer.Vector3D = function (options) {\r\n  options = options || {};\r\n  this._source = options.source;\r\n  this.height_ = this.getHfn (options.height);\r\n  var canvas = document.createElement('canvas');\r\n  ol.layer.Image.call (this, { \r\n    source: new ol.source.ImageCanvas({\r\n      canvasFunction: function(extent, resolution, pixelRatio, size /*, projection*/ ) {\r\n        canvas.width = size[0];\r\n        canvas.height = size[1];\r\n        return canvas;\r\n      }\r\n    }), \r\n    center: options.center || [.5,1],\r\n    defaultHeight: options.defaultHeight || 0,\r\n    maxResolution: options.maxResolution || Infinity \r\n  });\r\n  this.setStyle(options.style);\r\n  this.on (['postcompose', 'postrender'], this.onPostcompose_.bind(this));\r\n}\r\nol.ext.inherits(ol.layer.Vector3D, ol.layer.Image);\r\n/**\r\n * Set the height function for the layer\r\n * @param {function|string|Number} height a height function (returns height giving a feature) or a popertie name or a fixed value\r\n */\r\nol.layer.Vector3D.prototype.setHeight = function(height) {\r\n  this.height_ = this.getHfn (height);\r\n  this.changed();\r\n};\r\n/**\r\n * Set style associated with the layer\r\n * @param {ol.style.Style} s\r\n */\r\nol.layer.Vector3D.prototype.setStyle = function(s) {\r\n  if (s instanceof ol.style.Style) this._style = s;\r\n  else this._style = new ol.style.Style();\r\n  if (!this._style.getStroke()) {\r\n    this._style.setStroke(new ol.style.Stroke({\r\n      width: 1,\r\n      color: 'red'\r\n    }));\r\n  }\r\n  if (!this._style.getFill()) {\r\n    this._style.setFill( new ol.style.Fill({ color: 'rgba(0,0,255,0.5)'}) );\r\n  }\r\n  if (!this._style.getText()) {\r\n    this._style.setText( new ol.style.Fill({ \r\n      color: 'red'}) \r\n    );\r\n  }\r\n  // Get the geometry\r\n  if (s && s.getGeometry()) {\r\n    var geom = s.getGeometry();\r\n    if (typeof(geom)==='function') {\r\n      this.set('geometry', geom);\r\n    } else {\r\n      this.set('geometry', function() { return geom; });\r\n    }\r\n  } else {\r\n    this.set('geometry', function(f) { return f.getGeometry(); });\r\n  }\r\n};\r\n/**\r\n * Get style associated with the layer\r\n * @return {ol.style.Style}\r\n */\r\nol.layer.Vector3D.prototype.getStyle = function() {\r\n  return this._style;\r\n};\r\n/** Calculate 3D at potcompose\r\n * @private\r\n */\r\nol.layer.Vector3D.prototype.onPostcompose_ = function(e) {\r\n  var res = e.frameState.viewState.resolution;\r\n  if (res > this.get('maxResolution')) return;\r\n  this.res_ = res*400;\r\n  if (this.animate_) {\r\n    var elapsed = e.frameState.time - this.animate_;\r\n    if (elapsed < this.animateDuration_) {\r\n      this.elapsedRatio_ = this.easing_(elapsed / this.animateDuration_);\r\n      // tell OL3 to continue postcompose animation\r\n      e.frameState.animate = true;\r\n    } else {\r\n      this.animate_ = false;\r\n      this.height_ = this.toHeight_\r\n    }\r\n  }\r\n  var ratio = e.frameState.pixelRatio;\r\n  var ctx = e.context;\r\n  var m = this.matrix_ = e.frameState.coordinateToPixelTransform;\r\n  // Old version (matrix)\r\n  if (!m) {\r\n    m = e.frameState.coordinateToPixelMatrix,\r\n    m[2] = m[4];\r\n    m[3] = m[5];\r\n    m[4] = m[12];\r\n    m[5] = m[13];\r\n  }\r\n  this.center_ = [ \r\n    ctx.canvas.width*this.get('center')[0]/ratio, \r\n    ctx.canvas.height*this.get('center')[1]/ratio \r\n  ];\r\n  var f = this._source.getFeaturesInExtent(e.frameState.extent);\r\n  ctx.save();\r\n    ctx.scale(ratio,ratio);\r\n    var s = this.getStyle();\r\n    ctx.lineWidth = s.getStroke().getWidth();\r\n    ctx.lineCap = s.getStroke().getLineCap();\r\n    ctx.strokeStyle = ol.color.asString(s.getStroke().getColor());\r\n    ctx.fillStyle = ol.color.asString(s.getFill().getColor());\r\n    var builds = [];\r\n    for (var i=0; i<f.length; i++) {\r\n      builds.push (this.getFeature3D_ (f[i], this._getFeatureHeight(f[i])));\r\n    }\r\n    this.drawFeature3D_ (ctx, builds);\r\n  ctx.restore();\r\n};\r\n/** Create a function that return height of a feature\r\n * @param {function|string|number} h a height function or a popertie name or a fixed value\r\n * @return {function} function(f) return height of the feature f\r\n * @private\r\n */\r\nol.layer.Vector3D.prototype.getHfn= function(h) {\r\n  switch (typeof(h)) {\r\n    case 'function': return h;\r\n    case 'string': {\r\n      var dh = this.get('defaultHeight');\r\n        return (function(f) {\r\n          return (Number(f.get(h)) || dh); \r\n        });\r\n      }\r\n    case 'number': return (function(/*f*/) { return h; });\r\n    default: return (function(/*f*/) { return 10; });\r\n  }\r\n};\r\n/** Animate rendering\r\n * @param {*} options\r\n *  @param {string|function|number} options.height an attribute name or a function returning height of a feature or a fixed value\r\n *  @param {number} options.duration the duration of the animatioin ms, default 1000\r\n *  @param {ol.easing} options.easing an ol easing function\r\n *\t@api\r\n */\r\nol.layer.Vector3D.prototype.animate = function(options) {\r\n  options = options || {};\r\n  this.toHeight_ = this.getHfn(options.height);\r\n  this.animate_ = new Date().getTime();\r\n  this.animateDuration_ = options.duration ||1000;\r\n  this.easing_ = options.easing || ol.easing.easeOut;\r\n  // Force redraw\r\n  this.changed();\r\n};\r\n/** Check if animation is on\r\n*\t@return {bool}\r\n*/\r\nol.layer.Vector3D.prototype.animating = function() {\r\n  if (this.animate_ && new Date().getTime() - this.animate_ > this.animateDuration_) {\r\n    this.animate_ = false;\r\n  }\r\n  return !!this.animate_;\r\n}\r\n/** Get height for a feature\r\n * @param {ol.Feature} f\r\n * @return {number}\r\n * @private\r\n */\r\nol.layer.Vector3D.prototype._getFeatureHeight = function (f) {\r\n  if (this.animate_) {\r\n    var h1 = this.height_(f);\r\n    var h2 = this.toHeight_(f);\r\n    return (h1*(1-this.elapsedRatio_)+this.elapsedRatio_*h2);\r\n  }\r\n  else return this.height_(f);\r\n};\r\n/** Get hvector for a point\r\n * @private\r\n */\r\nol.layer.Vector3D.prototype.hvector_ = function (pt, h) {\r\n  var p0 = [\r\n    pt[0]*this.matrix_[0] + pt[1]*this.matrix_[1] + this.matrix_[4],\r\n    pt[0]*this.matrix_[2] + pt[1]*this.matrix_[3] + this.matrix_[5]\r\n  ];\r\n  return {\r\n    p0: p0, \r\n    p1: [\r\n      p0[0] + h/this.res_ * (p0[0]-this.center_[0]),\r\n      p0[1] + h/this.res_ * (p0[1]-this.center_[1])\r\n    ]\r\n  };\r\n};\r\n/** Get a vector 3D for a feature\r\n * @private\r\n */\r\nol.layer.Vector3D.prototype.getFeature3D_ = function (f, h) {\r\n  var geom = this.get('geometry')(f);\r\n  var c = geom.getCoordinates();\r\n  switch (geom.getType()) {\r\n    case \"Polygon\":\r\n      c = [c];\r\n    // fallthrough\r\n    case \"MultiPolygon\":\r\n      var build = [];\r\n      for (var i=0; i<c.length; i++) {\r\n        for (var j=0; j<c[i].length; j++) {\r\n          var b = [];\r\n          for (var k=0; k<c[i][j].length; k++) {\r\n            b.push( this.hvector_(c[i][j][k], h) );\r\n          }\r\n          build.push(b);\r\n        }\r\n      }\r\n      return { type:\"MultiPolygon\", feature: f, geom: build };\r\n    case \"Point\":\r\n      return { type:\"Point\", feature: f, geom: this.hvector_(c,h) };\r\n    default: return {};\r\n  }\r\n};\r\n/** Draw 3D feature\r\n * @private\r\n */\r\nol.layer.Vector3D.prototype.drawFeature3D_ = function(ctx, build) {\r\n  var i,j, b, k;\r\n  // Construct\r\n  for (i=0; i<build.length; i++) {\t\r\n    switch (build[i].type) {\r\n      case \"MultiPolygon\": {\r\n        for (j=0; j<build[i].geom.length; j++) {\r\n          b = build[i].geom[j];\r\n          for (k=0; k < b.length; k++) {\r\n            ctx.beginPath();\r\n            ctx.moveTo(b[k].p0[0], b[k].p0[1]);\r\n            ctx.lineTo(b[k].p1[0], b[k].p1[1]);\r\n            ctx.stroke();\r\n          }\r\n        }\r\n        break;\r\n      }\r\n      case \"Point\": {\r\n        var g = build[i].geom;\r\n          ctx.beginPath();\r\n          ctx.moveTo(g.p0[0], g.p0[1]);\r\n          ctx.lineTo(g.p1[0], g.p1[1]);\r\n          ctx.stroke();\r\n          break;\r\n        }\r\n      default: break;\r\n    }\r\n  }\r\n  // Roof\r\n  for (i=0; i<build.length; i++) {\r\n    switch (build[i].type) {\r\n      case \"MultiPolygon\": {\r\n        ctx.beginPath();\r\n        for (j=0; j<build[i].geom.length; j++) {\r\n          b = build[i].geom[j];\r\n          if (j==0) {\r\n            ctx.moveTo(b[0].p1[0], b[0].p1[1]);\r\n            for (k=1; k < b.length; k++) {\r\n              ctx.lineTo(b[k].p1[0], b[k].p1[1]);\r\n            }\r\n          } else {\r\n            ctx.moveTo(b[0].p1[0], b[0].p1[1]);\r\n            for (k=b.length-2; k>=0; k--) {\r\n              ctx.lineTo(b[k].p1[0], b[k].p1[1]);\r\n            }\r\n          }\r\n          ctx.closePath();\r\n        }\r\n        ctx.fill(\"evenodd\");\r\n        ctx.stroke();\r\n        break;\r\n      }\r\n      case \"Point\": {\r\n        b = build[i];\r\n        var t = b.feature.get('label');\r\n        if (t) {\r\n          var p = b.geom.p1;\r\n          var m = ctx.measureText(t);\r\n          var h = Number (ctx.font.match(/\\d+(\\.\\d+)?/g).join([]));\r\n          ctx.fillRect (p[0]-m.width/2 -5, p[1]-h -5, m.width +10, h +10)\r\n          ctx.strokeRect (p[0]-m.width/2 -5, p[1]-h -5, m.width +10, h +10)\r\n          ctx.save()\r\n            ctx.fillStyle = ol.color.asString(this._style.getText().getFill().getColor());\r\n            ctx.textAlign = 'center';\r\n            ctx.textBaseline = 'bottom';\r\n            ctx.fillText ( t, p[0], p[1] );\r\n          ctx.restore();\r\n        }\r\n        break;\r\n      }\r\n      default: break;\r\n    }\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n  @classdesc\r\n  ol.source.WikiCommons is a source that load Wikimedia Commons content in a vector layer.\r\n  Inherits from:\r\n  <ol.source.Vector>\r\n*/\r\n/**\r\n* @constructor ol.source.WikiCommons\r\n* @extends {ol.source.Vector}\r\n* @param {olx.source.WikiCommons=} options\r\n*/\r\nol.source.WikiCommons = function(opt_options) {\r\n  var options = opt_options || {};\r\n  options.loader = this._loaderFn;\r\n  /** Max resolution to load features  */\r\n  this._maxResolution = options.maxResolution || 100;\r\n  /** Result language */\r\n  this._lang = options.lang || \"fr\";\r\n  /** Query limit */\r\n  this._limit = options.limit || 100;\r\n  /** Default attribution */\r\n  if (!options.attributions) options.attributions = [ \"&copy; <a href='https://commons.wikimedia.org/'>Wikimedia Commons</a>\" ];\r\n  // Bbox strategy : reload at each move\r\n    if (!options.strategy) options.strategy = ol.loadingstrategy.bbox;\r\n  ol.source.Vector.call (this, options);\r\n};\r\nol.ext.inherits(ol.source.WikiCommons, ol.source.Vector);\r\n/** Decode wiki attributes and choose to add feature to the layer\r\n* @param {feature} the feature\r\n* @param {attributes} wiki attributes\r\n* @return {boolean} true: add the feature to the layer\r\n* @API stable\r\n*/\r\nol.source.WikiCommons.prototype.readFeature = function (feature, attributes){\r\n  feature.set(\"descriptionurl\", attributes.descriptionurl);\r\n  feature.set(\"url\", attributes.url);\r\n  feature.set(\"title\", attributes.title.replace(/^file:|.jpg$/ig,\"\"));\r\n  feature.set(\"thumbnail\", attributes.url.replace(/^(.+wikipedia\\/commons)\\/([a-zA-Z0-9]\\/[a-zA-Z0-9]{2})\\/(.+)$/,\"$1/thumb/$2/$3/200px-$3\"));\r\n  feature.set(\"user\", attributes.user);\r\n  if (attributes.extmetadata && attributes.extmetadata.LicenseShortName) feature.set(\"copy\", attributes.extmetadata.LicenseShortName.value);\r\n  return true;\r\n};\r\n/** Loader function used to load features.\r\n* @private\r\n*/\r\nol.source.WikiCommons.prototype._loaderFn = function(extent, resolution, projection){\r\n  if (resolution > this._maxResolution) return;\r\n  var self = this;\r\n  var bbox = ol.proj.transformExtent(extent, projection, \"EPSG:4326\");\r\n  // Commons API: for more info @see https://commons.wikimedia.org/wiki/Commons:API/MediaWiki\r\n  var url = \"https://commons.wikimedia.org/w/api.php?action=query&format=json&origin=*&prop=coordinates|imageinfo\"\r\n    + \"&generator=geosearch&iiprop=timestamp|user|url|extmetadata|metadata|size&iiextmetadatafilter=LicenseShortName\"\r\n    + \"&ggsbbox=\" + bbox[3] + \"|\" + bbox[0] + \"|\" + bbox[1] + \"|\" + bbox[2]\r\n    + \"&ggslimit=\"+this._limit\r\n    + \"&iilimit=\"+(this._limit-1)\r\n    + \"&ggsnamespace=6\";\r\n  // Ajax request to get the tile\r\n  ol.ext.Ajax.get({\r\n    url: url,\r\n    success: function(data) {\r\n      //console.log(data);\r\n      var features = [];\r\n      var att, pt, feature;\r\n      if (!data.query || !data.query.pages) return;\r\n      for ( var i in data.query.pages){\r\n        att = data.query.pages[i];\r\n        if (att.coordinates && att.coordinates.length ) {\r\n          pt = [att.coordinates[0].lon, att.coordinates[0].lat];\r\n        } else {\r\n          var meta = att.imageinfo[0].metadata;\r\n          if (!meta) {\r\n            //console.log(att);\r\n            continue;\r\n          }\r\n          pt = [];\r\n          var found=0;\r\n          for (var k=0; k<meta.length; k++) {\r\n            if (meta[k].name==\"GPSLongitude\") {\r\n              pt[0] = meta[k].value;\r\n              found++;\r\n            }\r\n            if (meta[k].name==\"GPSLatitude\") {\r\n              pt[1] = meta[k].value;\r\n              found++;\r\n            }\r\n          }\r\n          if (found!=2) {\r\n            //console.log(att);\r\n            continue;\r\n          }\r\n        }\r\n        feature = new ol.Feature(new ol.geom.Point(ol.proj.transform (pt,\"EPSG:4326\",projection)));\r\n        att.imageinfo[0].title = att.title;\r\n        if (self.readFeature(feature, att.imageinfo[0])) {\r\n          features.push(feature);\r\n        }\r\n      }\r\n      self.addFeatures(features);\r\n  }});\r\n};\r\n\r\n/*\r\n  Copyright (c) 2015 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (http://www.cecill.info/).\r\n  ol.layer.AnimatedCluster is a vector layer that animate cluster\r\n*/\r\n/**\r\n *  A vector layer for animated cluster\r\n * @constructor \r\n * @extends {ol.layer.Vector}\r\n * @param {olx.layer.AnimatedClusterOptions=} options extend olx.layer.Options\r\n *  @param {Number} options.animationDuration animation duration in ms, default is 700ms \r\n *  @param {ol.easingFunction} animationMethod easing method to use, default ol.easing.easeOut\r\n */\r\nol.layer.AnimatedCluster = function(opt_options) {\r\n  var options = opt_options || {};\r\n  ol.layer.Vector.call (this, options);\r\n  this.oldcluster = new ol.source.Vector();\r\n  this.clusters = [];\r\n  this.animation={start:false};\r\n  this.set('animationDuration', typeof(options.animationDuration)=='number' ? options.animationDuration : 700);\r\n  this.set('animationMethod', options.animationMethod || ol.easing.easeOut);\r\n  // Save cluster before change\r\n  this.getSource().on('change', this.saveCluster.bind(this));\r\n  // Animate the cluster\r\n  this.on(['precompose','prerender'], this.animate.bind(this));\r\n  this.on(['postcompose','postrender'], this.postanimate.bind(this));\r\n};\r\nol.ext.inherits(ol.layer.AnimatedCluster, ol.layer.Vector);\r\n/** save cluster features before change\r\n * @private\r\n */\r\nol.layer.AnimatedCluster.prototype.saveCluster = function() {\r\n  if (this.oldcluster) {\r\n    this.oldcluster.clear();\r\n    if (!this.get('animationDuration')) return;\r\n    var features = this.getSource().getFeatures();\r\n    if (features.length && features[0].get('features')) {\r\n      this.oldcluster.addFeatures (this.clusters);\r\n      this.clusters = features.slice(0);\r\n      this.sourceChanged = true;\r\n    }\r\n  }\r\n};\r\n/** \r\n * Get the cluster that contains a feature\r\n * @private\r\n*/\r\nol.layer.AnimatedCluster.prototype.getClusterForFeature = function(f, cluster) {\r\n  for (var j=0, c; c=cluster[j]; j++) {\r\n    var features = c.get('features');\r\n    if (features && features.length) {\r\n      for (var k=0, f2; f2=features[k]; k++) {\r\n        if (f===f2) {\r\n          return c;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  return false;\r\n};\r\n/** \r\n * Stop animation \r\n * @private \r\n */\r\nol.layer.AnimatedCluster.prototype.stopAnimation = function() {\r\n  this.animation.start = false;\r\n  this.animation.cA = [];\r\n  this.animation.cB = [];\r\n};\r\n/** \r\n * animate the cluster\r\n * @private\r\n */\r\nol.layer.AnimatedCluster.prototype.animate = function(e) {\r\n  var duration = this.get('animationDuration');\r\n  if (!duration) return;\r\n  var resolution = e.frameState.viewState.resolution;\r\n  var i, c0, a = this.animation;\r\n  var time = e.frameState.time;\r\n  // Start a new animation, if change resolution and source has changed\r\n  if (a.resolution != resolution && this.sourceChanged) {\r\n    var extent = e.frameState.extent;\r\n    if (a.resolution < resolution) {\r\n      extent = ol.extent.buffer(extent, 100*resolution);\r\n      a.cA = this.oldcluster.getFeaturesInExtent(extent);\r\n      a.cB = this.getSource().getFeaturesInExtent(extent);\r\n      a.revers = false;\r\n    } else {\r\n      extent = ol.extent.buffer(extent, 100*resolution);\r\n      a.cA = this.getSource().getFeaturesInExtent(extent);\r\n      a.cB = this.oldcluster.getFeaturesInExtent(extent);\r\n      a.revers = true;\r\n    }\r\n    a.clusters = [];\r\n    for (i=0, c0; c0=a.cA[i]; i++) {\r\n      var f = c0.get('features');\r\n      if (f && f.length) {\r\n        var c = this.getClusterForFeature (f[0], a.cB);\r\n        if (c) a.clusters.push({ f:c0, pt:c.getGeometry().getCoordinates() });\r\n      }\r\n    }\r\n    // Save state\r\n    a.resolution = resolution;\r\n    this.sourceChanged = false;\r\n    // No cluster or too much to animate\r\n    if (!a.clusters.length || a.clusters.length>1000) {\r\n      this.stopAnimation();\r\n      return;\r\n    }\r\n    // Start animation from now\r\n    time = a.start = (new Date()).getTime();\r\n  }\r\n  // Run animation\r\n  if (a.start) {\r\n    var vectorContext = e.vectorContext || ol.render.getVectorContext(e);\r\n    var d = (time - a.start) / duration;\r\n    // Animation ends\r\n    if (d > 1.0) {\r\n      this.stopAnimation();\r\n      d = 1;\r\n    }\r\n    d = this.get('animationMethod')(d);\r\n    // Animate\r\n    var style = this.getStyle();\r\n    var stylefn = (typeof(style) == 'function') ? style : style.length ? function(){ return style; } : function(){ return [style]; } ;\r\n    // Layer opacity\r\n    e.context.save();\r\n    e.context.globalAlpha = this.getOpacity();\r\n    for (i=0, c; c=a.clusters[i]; i++) {\r\n      var pt = c.f.getGeometry().getCoordinates();\r\n      var dx = pt[0]-c.pt[0];\r\n      var dy = pt[1]-c.pt[1];\r\n      if (a.revers) {\r\n        pt[0] = c.pt[0] + d * dx;\r\n        pt[1] = c.pt[1] + d * dy;\r\n      } else {\r\n        pt[0] = pt[0] - d * dx;\r\n        pt[1] = pt[1] - d * dy;\r\n      }\r\n      // Draw feature\r\n      var st = stylefn(c.f, resolution, true);\r\n      if (!st.length) st = [st];\r\n      // If one feature: draw the feature\r\n      if (c.f.get(\"features\").length===1 && !dx && !dy) {\r\n        f = c.f.get(\"features\")[0];\r\n      }\r\n      // else draw a point\r\n      else {\r\n        var geo = new ol.geom.Point(pt);\r\n        f = new ol.Feature(geo);\r\n      }\r\n      for (var k=0, s; s=st[k]; k++) {\r\n        // Multi-line text\r\n        if (s.getText() && /\\n/.test(s.getText().getText())) {\r\n          var offsetX = s.getText().getOffsetX();\r\n          var offsetY = s.getText().getOffsetY();\r\n          var rot = s.getText().getRotation() || 0;\r\n          var fontSize = Number((s.getText().getFont() || '10px').match(/\\d+/)) * 1.2;\r\n          var str = s.getText().getText().split('\\n')\r\n          var dl, nb = str.length-1;\r\n          var s2 = s.clone();\r\n          // Draw each lines\r\n          str.forEach(function(t, i) {\r\n            if (i==1) {\r\n              // Allready drawn\r\n              s2.setImage();\r\n              s2.setFill();\r\n              s2.setStroke();\r\n            }\r\n            switch (s.getText().getTextBaseline()) {\r\n              case 'alphabetic':\r\n              case 'ideographic':\r\n              case 'bottom': {\r\n                dl = nb;\r\n                break;\r\n              }\r\n              case 'hanging':\r\n              case 'top': {\r\n                dl = 0;\r\n                break;\r\n              }\r\n              default : {\r\n                dl = nb/2;\r\n                break;\r\n              }\r\n            }\r\n            s2.getText().setOffsetX(offsetX - Math.sin(rot)*fontSize*(i - dl));\r\n            s2.getText().setOffsetY(offsetY + Math.cos(rot)*fontSize*(i - dl));\r\n            s2.getText().setText(t);\r\n            vectorContext.drawFeature(f, s2);\r\n          });\r\n        } else {\r\n          vectorContext.drawFeature(f, s);\r\n        }\r\n        /* OLD VERSION OL < 4.3\r\n        // Retina device\r\n        var ratio = e.frameState.pixelRatio;\r\n        var sc;\r\n        // OL < v4.3 : setImageStyle doesn't check retina\r\n        var imgs = ol.Map.prototype.getFeaturesAtPixel ? false : s.getImage();\r\n        if (imgs)\r\n        {\tsc = imgs.getScale(); \r\n          imgs.setScale(sc*ratio); \r\n        }\r\n        // OL3 > v3.14\r\n        if (vectorContext.setStyle)\r\n        {\t// If one feature: draw the feature\r\n          if (c.f.get(\"features\").length===1 && !dx && !dy) {\r\n            vectorContext.drawFeature(c.f.get(\"features\")[0], s);\r\n          }\r\n          // else draw a point\r\n          else {\r\n            vectorContext.setStyle(s);\r\n            vectorContext.drawGeometry(geo);\r\n          }\r\n        }\r\n        // older version\r\n        else\r\n        {\tvectorContext.setImageStyle(imgs);\r\n          vectorContext.setTextStyle(s.getText());\r\n          vectorContext.drawPointGeometry(geo);\r\n        }\r\n        if (imgs) imgs.setScale(sc);\r\n        */\r\n      }\r\n    }\r\n    e.context.restore();\r\n    // tell ol to continue postcompose animation\r\n    e.frameState.animate = true;\r\n    // Prevent layer drawing (clip with null rect)\r\n    e.context.save();\r\n    e.context.beginPath();\r\n    e.context.rect(0,0,0,0);\r\n    e.context.clip();\r\n    this.clip_ = true;\r\n  }\r\n  return;\r\n};\r\n/**  \r\n * remove clipping after the layer is drawn\r\n * @private\r\n */\r\nol.layer.AnimatedCluster.prototype.postanimate = function(e) {\r\n  if (this.clip_) {\r\n    e.context.restore();\r\n    this.clip_ = false;\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc\r\n * Image layer to use with a GeoImage source and return the extent calcaulted with this source.\r\n * @extends {ol.layer.Image}\r\n * @param {Object=} options Layer Image options.\r\n * @api\r\n */\r\nol.layer.GeoImage = function(options) {\r\n  ol.layer.Image.call(this, options);\r\n}\r\nol.ext.inherits (ol.layer.GeoImage, ol.layer.Image);\r\n/**\r\n * Return the {@link module:ol/extent~Extent extent} of the source associated with the layer.\r\n * @return {ol.Extent} The layer extent.\r\n * @observable\r\n * @api\r\n */\r\nol.layer.GeoImage.prototype.getExtent = function() {\r\n  return this.getSource().getExtent();\r\n}\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n// \r\n/** IGN's Geoportail WMTS layer definition\r\n * @constructor \r\n * @extends {ol.layer.Tile}\r\n * @param {olx.layer.WMTSOptions=} options WMTS options if not defined default are used\r\n *  @param {string} options.layer Geoportail layer name\r\n *  @param {string} options.gppKey Geoportail API key, default use layer registered key\r\n *  @param {ol.projectionLike} [options.projection=EPSG:3857] projection for the extent, default EPSG:3857\r\n * @param {olx.source.WMTSOptions=} tileoptions WMTS options if not defined default are used\r\n */\r\nol.layer.Geoportail = function(layer, options, tileoptions) {\r\n  options = options || {};\r\n  tileoptions = tileoptions || {};\r\n  // use function(options, tileoption) when layer is set in options\r\n  if (typeof(layer)!=='string') {\r\n    tileoptions = options || {};\r\n    options = layer;\r\n    layer = options.layer;\r\n  }\r\n  var maxZoom = options.maxZoom;\r\n  // A source is defined\r\n  if (options.source) {\r\n    layer = options.source.getLayer();\r\n    options.gppKey = options.source.getGPPKey();\r\n  }\r\n  var capabilities = window.geoportailConfig ? window.geoportailConfig.capabilities[options.gppKey || options.key] || window.geoportailConfig.capabilities[\"default\"] || ol.layer.Geoportail.capabilities : ol.layer.Geoportail.capabilities;\r\n  capabilities = capabilities[layer];\r\n  if (!capabilities) capabilities = ol.layer.Geoportail.capabilities[layer];\r\n  if (!capabilities) {\r\n    capabilities = { title: layer, originators: [] };\r\n    console.error(\"ol.layer.Geoportail: no layer definition for \\\"\"+layer+\"\\\"\\nTry to use ol/layer/Geoportail~loadCapabilities() to get it.\");\r\n    // throw new Error(\"ol.layer.Geoportail: no layer definition for \\\"\"+layer+\"\\\"\");\r\n  }\r\n  // tile options & default params\r\n  for (var i in capabilities) if (typeof\ttileoptions[i]== \"undefined\") tileoptions[i] = capabilities[i];\r\n  this._originators = capabilities.originators;\r\n  if (!tileoptions.gppKey) tileoptions.gppKey = options.gppKey || options.key;\r\n  if (!options.source) options.source = new ol.source.Geoportail(layer, tileoptions);\r\n  if (!options.title) options.title = capabilities.title;\r\n  if (!options.name) options.name = layer;\r\n  options.layer = layer;\r\n  if (!options.queryable) options.queryable = capabilities.queryable;\r\n  if (!options.desc) options.desc = capabilities.desc;\r\n  if (!options.extent && capabilities.bbox) {\r\n    if (capabilities.bbox[0]>-170 && capabilities.bbox[2]<170) {\r\n      options.extent = ol.proj.transformExtent(capabilities.bbox, 'EPSG:4326', options.projection || 'EPSG:3857');\r\n    }\r\n  }\r\n  options.maxZoom = maxZoom;\r\n  // calculate layer max resolution\r\n  if (!options.maxResolution && tileoptions.minZoom) {\r\n    options.source.getTileGrid().minZoom -= (tileoptions.minZoom>1 ? 2 : 1);\r\n    options.maxResolution = options.source.getTileGrid().getResolution(options.source.getTileGrid().minZoom)\r\n    options.source.getTileGrid().minZoom = tileoptions.minZoom;\r\n  }\r\n  ol.layer.Tile.call (this, options);\r\n  // BUG GPP: Attributions constraints are not set properly :(\r\n/** /\r\n  // Set attribution according to the originators\r\n  var counter = 0;\r\n  // Get default attribution\r\n  var getAttrib = function(title, o) {\r\n    if (this.get('attributionMode')==='logo') {\r\n      if (!title) return ol.source.Geoportail.prototype.attribution;\r\n      else return '<a href=\"'+o.href+'\"><img src=\"'+o.logo+'\" title=\"&copy; '+o.attribution+'\" /></a>';\r\n    } else {\r\n      if (!title) return ol.source.Geoportail.prototype.attribution;\r\n      else return '&copy; <a href=\"'+o.href+'\" title=\"&copy; '+(o.attribution||title)+'\" >'+title+'</a>'\r\n    }\r\n  }.bind(this);\r\n  var currentZ, currentCenter = [];\r\n  var setAttribution = function(e) {\r\n    var a, o, i;\r\n    counter--;\r\n    if (!counter) {\r\n      var z = e.frameState.viewState.zoom;\r\n      console.log(e)\r\n      if (z===currentZ \r\n        && e.frameState.viewState.center[0]===currentCenter[0]\r\n        && e.frameState.viewState.center[1]===currentCenter[1]){\r\n          return;\r\n      }\r\n      currentZ = z;\r\n      currentCenter = e.frameState.viewState.center;\r\n      var ex = e.frameState.extent;\r\n      ex = ol.proj.transformExtent (ex, e.frameState.viewState.projection, 'EPSG:4326');\r\n      if (this._originators) {\r\n        var attrib = this.getSource().getAttributions();\r\n        // ol v5\r\n        if (typeof(attrib)==='function') attrib = attrib();\r\n        attrib.splice(0, attrib.length);\r\n        var maxZoom = 0;\r\n        for (a in this._originators) {\r\n          o = this._originators[a];\r\n          for (i=0; i<o.constraint.length; i++) {\r\n            if (o.constraint[i].maxZoom > maxZoom\r\n              && ol.extent.intersects(ex, o.constraint[i].bbox)) {\r\n                maxZoom = o.constraint[i].maxZoom;\r\n            }\r\n          }\t\r\n        }\r\n        if (maxZoom < z) z = maxZoom;\r\n        if (this.getSource().getTileGrid() && z < this.getSource().getTileGrid().getMinZoom()) {\r\n          z = this.getSource().getTileGrid().getMinZoom();\r\n        }\r\n        for (a in this._originators) {\r\n          o = this._originators[a];\r\n          if (!o.constraint.length) {\r\n            attrib.push (getAttrib(a, o));\r\n          } else {\r\n            for (i=0; i<o.constraint.length; i++) {\r\n              if ( z <= o.constraint[i].maxZoom \r\n                && z >= o.constraint[i].minZoom \r\n                && ol.extent.intersects(ex, o.constraint[i].bbox)) {\r\n                  attrib.push (getAttrib(a, o));\r\n                  break;\r\n              }\r\n            }\r\n          }\r\n        }\r\n        if (!attrib.length) attrib.push ( getAttrib() );\r\n        this.getSource().setAttributions(attrib);\r\n      }\r\n    }\r\n  }.bind(this);\r\n  this.on('precompose', function(e) {\r\n    counter++;\r\n    setTimeout(function () { setAttribution(e) }, 500);\r\n  });\r\n/**/\r\n};\r\nol.ext.inherits (ol.layer.Geoportail, ol.layer.Tile);\r\n/** Default capabilities for main layers\r\n */\r\nol.layer.Geoportail.capabilities = {\r\n  // choisirgeoportail\r\n  \"GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2\": { \"key\":\"cartes\", \"server\":\"https://wxs.ign.fr/geoportail/wmts\",\"layer\":\"GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2\",\"title\":\"Plan IGN v2\",\"format\":\"image/png\",\"style\":\"normal\",\"queryable\":false,\"tilematrix\":\"PM\",\"minZoom\":0,\"maxZoom\":19,\"bbox\":[-175,-85,175,85],\"desc\":\"Cartographie multi-échelles sur le territoire national, issue des bases de données vecteur de l’IGN, mis à jour régulièrement et réalisée selon un processus entièrement automatisé. Version actuellement en beta test\",\"originators\":{\"IGN\":{\"href\":\"http://www.ign.fr\",\"attribution\":\"Institut national de l'information géographique et forestière\",\"logo\":\"https://wxs.ign.fr/static/logos/IGN/IGN.gif\",\"minZoom\":0,\"maxZoom\":19,\"constraint\":[{\"minZoom\":0,\"maxZoom\":19,\"bbox\":[-175,-85,175,85]}]}}},\r\n  \"CADASTRALPARCELS.PARCELLAIRE_EXPRESS\": { \"key\":\"parcellaire\", \"server\":\"https://wxs.ign.fr/geoportail/wmts\",\"layer\":\"CADASTRALPARCELS.PARCELLAIRE_EXPRESS\",\"title\":\"PCI vecteur\",\"format\":\"image/png\",\"style\":\"PCI vecteur\",\"queryable\":false,\"tilematrix\":\"PM\",\"minZoom\":0,\"maxZoom\":19,\"bbox\":[-63.37252,-21.475586,55.925865,51.31212],\"desc\":\"Plan cadastral informatisé vecteur de la DGFIP.\",\"originators\":{\"IGN\":{\"href\":\"http://www.ign.fr\",\"attribution\":\"Institut national de l'information géographique et forestière\",\"logo\":\"https://wxs.ign.fr/static/logos/IGN/IGN.gif\",\"minZoom\":0,\"maxZoom\":19,\"constraint\":[{\"minZoom\":0,\"maxZoom\":19,\"bbox\":[-63.37252,-21.475586,55.925865,51.31212]}]}}},\r\n  \"ORTHOIMAGERY.ORTHOPHOTOS\": { \"key\":\"ortho\", \"server\":\"https://wxs.ign.fr/geoportail/wmts\",\"layer\":\"ORTHOIMAGERY.ORTHOPHOTOS\",\"title\":\"Photographies aériennes\",\"format\":\"image/jpeg\",\"style\":\"normal\",\"queryable\":true,\"tilematrix\":\"PM\",\"minZoom\":0,\"bbox\":[-178.18713,-22.767689,167.94624,51.11242],\"desc\":\"Photographies aériennes\",\"originators\":{\"CRCORSE\":{\"href\":\"http://www.corse.fr//\",\"attribution\":\"CRCORSE\",\"logo\":\"https://wxs.ign.fr/static/logos/CRCORSE/CRCORSE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[8.428783,41.338627,9.688606,43.08541]}]},\"SIGLR\":{\"href\":\"http://www.siglr.org//\",\"attribution\":\"SIGLR\",\"logo\":\"https://wxs.ign.fr/static/logos/SIGLR/SIGLR.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[1.6784439,42.316307,4.8729386,44.978218]}]},\"BOURGOGNE-FRANCHE-COMTE\":{\"href\":\"https://www.bourgognefranchecomte.fr/\",\"attribution\":\"Auvergne\",\"logo\":\"https://wxs.ign.fr/static/logos/BOURGOGNE-FRANCHE-COMTE/BOURGOGNE-FRANCHE-COMTE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[2.837849,46.131435,7.1713247,48.408287]}]},\"FEDER_AUVERGNE\":{\"href\":\"http://www.europe-en-auvergne.eu/\",\"attribution\":\"Auvergne\",\"logo\":\"https://wxs.ign.fr/static/logos/FEDER_AUVERGNE/FEDER_AUVERGNE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[2.0398402,44.60505,3.38408,45.49146]}]},\"FEDER_PAYSDELALOIRE\":{\"href\":\"https://www.europe.paysdelaloire.fr/\",\"attribution\":\"Pays-de-la-Loire\",\"logo\":\"https://wxs.ign.fr/static/logos/FEDER_PAYSDELALOIRE/FEDER_PAYSDELALOIRE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[-2.457367,46.19304,0.951426,48.57609]}]},\"IGN\":{\"href\":\"http://www.ign.fr\",\"attribution\":\"Institut national de l'information géographique et forestière\",\"logo\":\"https://wxs.ign.fr/static/logos/IGN/IGN.gif\",\"minZoom\":13,\"maxZoom\":20,\"constraint\":[{\"minZoom\":19,\"maxZoom\":19,\"bbox\":[-63.160706,-21.401262,55.84643,51.11242]},{\"bbox\":[0.035491213,43.221077,6.0235267,49.696926]},{\"minZoom\":20,\"maxZoom\":20,\"bbox\":[0.035491213,43.221077,6.0235267,49.696926]},{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[-178.18713,-21.401329,55.85611,51.11242]}]},\"E-MEGALIS\":{\"href\":\"http://www.e-megalisbretagne.org//\",\"attribution\":\"Syndicat mixte de coopération territoriale (e-Megalis)\",\"logo\":\"https://wxs.ign.fr/static/logos/E-MEGALIS/E-MEGALIS.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[-3.7059498,47.971947,-1.8486879,48.99035]}]},\"FEDER2\":{\"href\":\"http://www.europe-en-france.gouv.fr/\",\"attribution\":\"Fonds européen de développement économique et régional\",\"logo\":\"https://wxs.ign.fr/static/logos/FEDER2/FEDER2.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[1.3577043,48.824635,4.269964,50.37648]}]},\"PREFECTURE_GUADELOUPE\":{\"href\":\"www.guadeloupe.pref.gouv.fr/\",\"attribution\":\"guadeloupe\",\"logo\":\"https://wxs.ign.fr/static/logos/PREFECTURE_GUADELOUPE/PREFECTURE_GUADELOUPE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[-61.82342,14.371942,-60.787838,16.521578]}]},\"OCCITANIE\":{\"href\":\"https://www.laregion.fr/\",\"attribution\":\"La Région Occitanie; Pyrénées - Méditerranée\",\"logo\":\"https://wxs.ign.fr/static/logos/OCCITANIE/OCCITANIE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[2.2086434,48.805965,2.4859917,48.915382]}]},\"RGD_SAVOIE\":{\"href\":\"http://www.rgd.fr\",\"attribution\":\"Régie de Gestion de Données des Pays de Savoie (RGD 73-74)\",\"logo\":\"https://wxs.ign.fr/static/logos/RGD_SAVOIE/RGD_SAVOIE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":19,\"maxZoom\":19,\"bbox\":[5.7759595,45.65335,7.0887337,46.438328]},{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[5.5923314,45.017353,7.2323394,46.438328]}]},\"CG45\":{\"href\":\"http://www.loiret.com\",\"attribution\":\"Le conseil général du Loiret\",\"logo\":\"https://wxs.ign.fr/static/logos/CG45/CG45.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[1.4883244,47.471867,3.1349874,48.354233]}]},\"CRAIG\":{\"href\":\"http://www.craig.fr\",\"attribution\":\"Centre Régional Auvergnat de l'Information Géographique (CRAIG)\",\"logo\":\"https://wxs.ign.fr/static/logos/CRAIG/CRAIG.gif\",\"minZoom\":13,\"maxZoom\":20,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[2.0398402,44.60505,6.4295278,46.8038]},{\"minZoom\":20,\"maxZoom\":20,\"bbox\":[2.2243388,44.76621,2.7314367,45.11295]}]},\"e-Megalis\":{\"href\":\"http://www.e-megalisbretagne.org//\",\"attribution\":\"Syndicat mixte de coopération territoriale (e-Megalis)\",\"logo\":\"https://wxs.ign.fr/static/logos/e-Megalis/e-Megalis.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[-5.1937118,47.23789,-0.98568505,48.980812]}]},\"PPIGE\":{\"href\":\"http://www.ppige-npdc.fr/\",\"attribution\":\"PPIGE\",\"logo\":\"https://wxs.ign.fr/static/logos/PPIGE/PPIGE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[1.5212119,49.957302,4.2673664,51.090965]}]},\"CG06\":{\"href\":\"http://www.cg06.fr\",\"attribution\":\"Département Alpes Maritimes (06) en partenariat avec : Groupement Orthophoto 06 (NCA, Ville de Cannes, CARF, CASA,CG06, CA de Grasse) \",\"logo\":\"https://wxs.ign.fr/static/logos/CG06/CG06.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[6.6093955,43.44647,7.7436337,44.377018]}]},\"MEGALIS-BRETAGNE\":{\"href\":\"https://www.megalisbretagne.org/\",\"attribution\":\"Syndicat mixte Mégalis Bretagne\",\"logo\":\"https://wxs.ign.fr/static/logos/MEGALIS-BRETAGNE/MEGALIS-BRETAGNE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[-5.2086344,47.591938,-3.3396015,48.808697]}]},\"FEDER\":{\"href\":\"http://www.europe-en-france.gouv.fr/\",\"attribution\":\"Fonds européen de développement économique et régional\",\"logo\":\"https://wxs.ign.fr/static/logos/FEDER/FEDER.gif\",\"minZoom\":0,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[-1.9662633,42.316307,8.25674,50.18387]},{\"minZoom\":0,\"maxZoom\":12,\"bbox\":[-2.400665,41.333557,9.560094,50.366302]}]},\"LANGUEDOC-ROUSSILLON\":{\"href\":\"https://www.laregion.fr/\",\"attribution\":\"Région Occitanie\",\"logo\":\"https://wxs.ign.fr/static/logos/LANGUEDOC-ROUSSILLON/LANGUEDOC-ROUSSILLON.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[1.6784439,42.63972,4.208843,43.979004]}]},\"GRAND_EST\":{\"href\":\"https://www.grandest.fr/\",\"attribution\":\"Hauts-de-France\",\"logo\":\"https://wxs.ign.fr/static/logos/GRAND_EST/GRAND_EST.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[5.362788,47.390827,7.6924667,49.58011]}]},\"CNES_AUVERGNE\":{\"href\":\"http://www.cnes.fr/\",\"attribution\":\"Centre national d'études spatiales (CNES)\",\"logo\":\"https://wxs.ign.fr/static/logos/CNES_AUVERGNE/CNES_AUVERGNE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[2.2656832,45.279934,4.0227704,46.8038]}]},\"HAUTS_DE_FRANCE\":{\"href\":\"https://www.hautsdefrance.fr/\",\"attribution\":\"Hauts-de-France\",\"logo\":\"https://wxs.ign.fr/static/logos/HAUTS_DE_FRANCE/HAUTS_DE_FRANCE.gif\",\"minZoom\":13,\"maxZoom\":19,\"constraint\":[{\"minZoom\":13,\"maxZoom\":19,\"bbox\":[2.0740242,48.81521,4.3390365,51.11242]}]},\"MPM\":{\"href\":\"http://www.marseille-provence.com/\",\"attribution\":\"Marseille Provence Métropole\",\"logo\":\"https://wxs.ign.fr/static/logos/MPM/MPM.gif\",\"minZoom\":20,\"maxZoom\":20,\"constraint\":[{\"minZoom\":20,\"maxZoom\":20,\"bbox\":[5.076959,43.153347,5.7168245,43.454994]}]},\"DITTT\":{\"href\":\"http://www.dittt.gouv.nc/portal/page/portal/dittt/\",\"attribution\":\"Direction des Infrastructures, de la Topographie et des Transports Terrestres\",\"logo\":\"https://wxs.ign.fr/static/logos/DITTT/DITTT.gif\",\"minZoom\":13,\"maxZoom\":18,\"constraint\":[{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[163.47784,-22.767689,167.94624,-19.434975]}]},\"CNES_978\":{\"href\":\"http://www.cnes.fr/\",\"attribution\":\"Centre national d'études spatiales (CNES)\",\"logo\":\"https://wxs.ign.fr/static/logos/CNES_978/CNES_978.gif\",\"minZoom\":13,\"maxZoom\":18,\"constraint\":[{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[-63.160706,18.04345,-62.962185,18.133898]}]},\"CNES_ALSACE\":{\"href\":\"http://www.cnes.fr/\",\"attribution\":\"Centre national d'études spatiales (CNES)\",\"logo\":\"https://wxs.ign.fr/static/logos/CNES_ALSACE/CNES_ALSACE.gif\",\"minZoom\":13,\"maxZoom\":18,\"constraint\":[{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[6.8086324,47.39981,7.668318,48.32695]}]},\"CNES_974\":{\"href\":\"http://www.cnes.fr/\",\"attribution\":\"Centre national d'études spatiales (CNES)\",\"logo\":\"https://wxs.ign.fr/static/logos/CNES_974/CNES_974.gif\",\"minZoom\":13,\"maxZoom\":18,\"constraint\":[{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[55.205757,-21.401262,55.84643,-20.862825]}]},\"CNES_975\":{\"href\":\"http://www.cnes.fr/\",\"attribution\":\"Centre national d'études spatiales (CNES)\",\"logo\":\"https://wxs.ign.fr/static/logos/CNES_975/CNES_975.gif\",\"minZoom\":13,\"maxZoom\":18,\"constraint\":[{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[-56.410988,46.734093,-56.10308,47.149963]}]},\"CNES_976\":{\"href\":\"http://www.cnes.fr/\",\"attribution\":\"Centre national d'études spatiales (CNES)\",\"logo\":\"https://wxs.ign.fr/static/logos/CNES_976/CNES_976.gif\",\"minZoom\":13,\"maxZoom\":18,\"constraint\":[{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[44.916977,-13.089187,45.30442,-12.564543]}]},\"CNES_977\":{\"href\":\"http://www.cnes.fr/\",\"attribution\":\"Centre national d'études spatiales (CNES)\",\"logo\":\"https://wxs.ign.fr/static/logos/CNES_977/CNES_977.gif\",\"minZoom\":13,\"maxZoom\":18,\"constraint\":[{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[-62.952805,17.862621,-62.78276,17.98024]}]},\"CNES\":{\"href\":\"http://www.cnes.fr/\",\"attribution\":\"Centre national d'études spatiales (CNES)\",\"logo\":\"https://wxs.ign.fr/static/logos/CNES/CNES.gif\",\"minZoom\":13,\"maxZoom\":16,\"constraint\":[{\"minZoom\":13,\"maxZoom\":16,\"bbox\":[-55.01953,1.845384,-50.88867,6.053161]}]},\"ASTRIUM\":{\"href\":\"http://www.geo-airbusds.com/\",\"attribution\":\"Airbus Defence and Space\",\"logo\":\"https://wxs.ign.fr/static/logos/ASTRIUM/ASTRIUM.gif\",\"minZoom\":13,\"maxZoom\":16,\"constraint\":[{\"minZoom\":13,\"maxZoom\":16,\"bbox\":[-55.01953,1.845384,-50.88867,6.053161]}]},\"CNES_971\":{\"href\":\"http://www.cnes.fr/\",\"attribution\":\"Centre national d'études spatiales (CNES)\",\"logo\":\"https://wxs.ign.fr/static/logos/CNES_971/CNES_971.gif\",\"minZoom\":13,\"maxZoom\":18,\"constraint\":[{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[-61.82342,15.819616,-60.99497,16.521578]}]},\"CNES_972\":{\"href\":\"http://www.cnes.fr/\",\"attribution\":\"Centre national d'études spatiales (CNES)\",\"logo\":\"https://wxs.ign.fr/static/logos/CNES_972/CNES_972.gif\",\"minZoom\":13,\"maxZoom\":18,\"constraint\":[{\"minZoom\":13,\"maxZoom\":18,\"bbox\":[-61.247208,14.371855,-60.778458,14.899901]}]}}},\r\n  // Deprecated\r\n  \"GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-EXPRESS.STANDARD\": {\"server\":\"https://wxs.ign.fr/geoportail/wmts\",\"layer\":\"GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-EXPRESS.STANDARD\",\"title\":\"Carte IGN\",\"format\":\"image/jpeg\",\"style\":\"normal\",\"queryable\":false,\"tilematrix\":\"PM\",\"minZoom\":0,\"maxZoom\":18,\"bbox\":[-179.62723,-84.5047,179.74588,85.47958],\"desc\":\"Cartographie topographique multi-échelles du territoire français issue des bases de données vecteur de l’IGN - emprise nationale, visible du 1/200 au 1/130000000\",\"originators\":{\"IGN\":{\"href\":\"http://www.ign.fr\",\"attribution\":\"Institut national de l'information géographique et forestière\",\"logo\":\"https://wxs.ign.fr/static/logos/IGN/IGN.gif\",\"minZoom\":0,\"maxZoom\":18,\"constraint\":[{\"minZoom\":5,\"maxZoom\":5,\"bbox\":[-179.57285,-83.84196,178.4975,85.36646]},{\"minZoom\":0,\"maxZoom\":2,\"bbox\":[-175.99709,-84.42859,175.99709,84.2865]},{\"minZoom\":3,\"maxZoom\":3,\"bbox\":[-176.23093,-84.5047,179.08267,84.89126]},{\"minZoom\":4,\"maxZoom\":4,\"bbox\":[-179.62723,-84.0159,-179.21112,85.47958]},{\"minZoom\":6,\"maxZoom\":8,\"bbox\":[-179.49689,-84.02368,179.74588,85.30035]},{\"minZoom\":15,\"maxZoom\":18,\"bbox\":[-5.6663494,41.209736,10.819784,51.175068]},{\"minZoom\":14,\"maxZoom\":14,\"bbox\":[-5.713191,40.852314,11.429714,51.44377]},{\"minZoom\":13,\"maxZoom\":13,\"bbox\":[-63.37252,13.428586,11.429714,51.44377]},{\"minZoom\":11,\"maxZoom\":12,\"bbox\":[-63.37252,13.428586,11.496459,51.444122]},{\"minZoom\":9,\"maxZoom\":9,\"bbox\":[-64.81273,13.428586,11.496459,51.444016]},{\"minZoom\":10,\"maxZoom\":10,\"bbox\":[-63.37252,13.428586,11.496459,51.444016]}]}}},\r\n  // Need API key\r\n  \"GEOGRAPHICALGRIDSYSTEMS.MAPS\": {\"server\":\"https://wxs.ign.fr/geoportail/wmts\",\"layer\":\"GEOGRAPHICALGRIDSYSTEMS.MAPS\",\"title\":\"Cartes IGN\",\"format\":\"image/jpeg\",\"style\":\"normal\",\"queryable\":true,\"tilematrix\":\"PM\",\"minZoom\":0,\"maxZoom\":18,\"bbox\":[-180,-75,180,80],\"desc\":\"Cartes IGN\",\"originators\":{\"IGN\":{\"href\":\"http://www.ign.fr\",\"attribution\":\"Institut national de l'information géographique et forestière\",\"logo\":\"https://wxs.ign.fr/static/logos/IGN/IGN.gif\",\"minZoom\":0,\"maxZoom\":18,\"constraint\":[{\"minZoom\":7,\"maxZoom\":7,\"bbox\":[-178.20573,-68.138855,144.84375,51.909786]},{\"minZoom\":8,\"maxZoom\":8,\"bbox\":[-178.20573,-68.138855,168.24327,51.909786]},{\"minZoom\":13,\"maxZoom\":13,\"bbox\":[-178.20573,-67.101425,168.24327,51.44377]},{\"minZoom\":14,\"maxZoom\":14,\"bbox\":[-178.20573,-67.101425,168.23909,51.44377]},{\"minZoom\":11,\"maxZoom\":12,\"bbox\":[-178.20573,-67.101425,168.24327,51.444122]},{\"minZoom\":9,\"maxZoom\":10,\"bbox\":[-178.20573,-68.138855,168.24327,51.444016]},{\"minZoom\":15,\"maxZoom\":15,\"bbox\":[-178.20573,-46.502903,168.23909,51.175068]},{\"minZoom\":16,\"maxZoom\":16,\"bbox\":[-178.20573,-46.502903,168.29811,51.175068]},{\"minZoom\":0,\"maxZoom\":6,\"bbox\":[-180,-60,180,80]},{\"minZoom\":18,\"maxZoom\":18,\"bbox\":[-5.6663494,41.209736,10.819784,51.175068]},{\"minZoom\":17,\"maxZoom\":17,\"bbox\":[-179.5,-75,179.5,75]}]},\"DITTT\":{\"href\":\"http://www.dittt.gouv.nc/portal/page/portal/dittt/\",\"attribution\":\"Direction des Infrastructures, de la Topographie et des Transports Terrestres\",\"logo\":\"https://wxs.ign.fr/static/logos/DITTT/DITTT.gif\",\"minZoom\":8,\"maxZoom\":16,\"constraint\":[{\"minZoom\":8,\"maxZoom\":10,\"bbox\":[163.47784,-22.972307,168.24327,-19.402702]},{\"minZoom\":11,\"maxZoom\":13,\"bbox\":[163.47784,-22.972307,168.24327,-19.494438]},{\"minZoom\":14,\"maxZoom\":15,\"bbox\":[163.47784,-22.764496,168.23909,-19.493542]},{\"minZoom\":16,\"maxZoom\":16,\"bbox\":[163.47784,-22.809465,168.29811,-19.403923]}]}}},\r\n  // Other layers\r\n  \"GEOGRAPHICALGRIDSYSTEMS.SLOPES.MOUNTAIN\": {\"key\":\"altimetrie\",\"server\":\"https://wxs.ign.fr/geoportail/wmts\",\"layer\":\"GEOGRAPHICALGRIDSYSTEMS.SLOPES.MOUNTAIN\",\"title\":\"Carte des pentes\",\"format\":\"image/png\",\"style\":\"normal\",\"queryable\":false,\"tilematrix\":\"PM\",\"minZoom\":0,\"maxZoom\":17,\"bbox\":[-63.161392,-21.544624,56.001812,51.099052],\"desc\":\"Carte des zones ayant une valeur de pente supérieure à 30°-35°-40°-45° d'après la BD ALTI au pas de 5m\",\"originators\":{\"IGN\":{\"href\":\"http://www.ign.fr\",\"attribution\":\"Institut national de l'information géographique et forestière\",\"logo\":\"https://wxs.ign.fr/static/logos/IGN/IGN.gif\",\"minZoom\":0,\"maxZoom\":17,\"constraint\":[{\"minZoom\":0,\"maxZoom\":17,\"bbox\":[-5.1504726,41.32521,9.570543,51.099052]}]}}},\r\n  \"ADMINEXPRESS_COG_2018\": {\"server\":\"https://wxs.ign.fr/geoportail/wmts\",\"layer\":\"ADMINEXPRESS_COG_2018\",\"title\":\"ADMINEXPRESS_COG (2018)\",\"format\":\"image/png\",\"style\":\"normal\",\"queryable\":true,\"tilematrix\":\"PM\",\"minZoom\":6,\"maxZoom\":16,\"bbox\":[-63.37252,-21.475586,55.925865,51.31212],\"desc\":\"Limites administratives COG mises à jour en continu. État en Mai 2018.\",\"originators\":{\"IGN\":{\"href\":\"http://www.ign.fr\",\"attribution\":\"Institut national de l'information géographique et forestière\",\"logo\":\"https://wxs.ign.fr/static/logos/IGN/IGN.gif\",\"minZoom\":6,\"maxZoom\":16,\"constraint\":[{\"minZoom\":6,\"maxZoom\":16,\"bbox\":[-63.37252,-21.475586,55.925865,51.31212]}]}}},\r\n  \"ELEVATION.SLOPES\": {\"key\":\"altimetrie\",\"server\":\"https://wxs.ign.fr/geoportail/wmts\",\"layer\":\"ELEVATION.SLOPES\",\"title\":\"Altitude\",\"format\":\"image/jpeg\",\"style\":\"normal\",\"queryable\":true,\"tilematrix\":\"PM\",\"minZoom\":6,\"maxZoom\":14,\"bbox\":[-178.20589,-22.595179,167.43176,50.93085],\"desc\":\"La couche altitude se compose d'un MNT (Modèle Numérique de Terrain) affiché en teintes hypsométriques et issu de la BD ALTI®.\",\"originators\":{\"IGN\":{\"href\":\"http://www.ign.fr\",\"attribution\":\"Institut national de l'information géographique et forestière\",\"logo\":\"https://wxs.ign.fr/static/logos/IGN/IGN.gif\",\"minZoom\":6,\"maxZoom\":14,\"constraint\":[{\"minZoom\":6,\"maxZoom\":14,\"bbox\":[55.205746,-21.392344,55.846554,-20.86271]}]}}},\r\n  \"GEOGRAPHICALGRIDSYSTEMS.MAPS.BDUNI.J1\": { \"key\":\"cartes\", \"server\":\"https://wxs.ign.fr/geoportail/wmts\",\"layer\":\"GEOGRAPHICALGRIDSYSTEMS.MAPS.BDUNI.J1\",\"title\":\"Plan IGN j+1\",\"format\":\"image/png\",\"style\":\"normal\",\"queryable\":false,\"tilematrix\":\"PM\",\"minZoom\":0,\"maxZoom\":18,\"bbox\":[-179.5,-75,179.5,75],\"desc\":\"Plan IGN j+1\",\"originators\":{\"IGN\":{\"href\":\"http://www.ign.fr\",\"attribution\":\"Institut national de l'information géographique et forestière\",\"logo\":\"https://wxs.ign.fr/static/logos/IGN/IGN.gif\",\"minZoom\":0,\"maxZoom\":18,\"constraint\":[{\"minZoom\":0,\"maxZoom\":18,\"bbox\":[-179,-80,179,80]}]}}},\r\n  \"TRANSPORTNETWORKS.ROADS\": {\"server\":\"https://wxs.ign.fr/geoportail/wmts\",\"layer\":\"TRANSPORTNETWORKS.ROADS\",\"title\":\"Routes\",\"format\":\"image/png\",\"style\":\"normal\",\"queryable\":false,\"tilematrix\":\"PM\",\"minZoom\":6,\"maxZoom\":18,\"bbox\":[-63.969162,-21.49687,55.964417,71.584076],\"desc\":\"Affichage du réseau routier français et européen.\",\"originators\":{\"IGN\":{\"href\":\"http://www.ign.fr\",\"attribution\":\"Institut national de l'information géographique et forestière\",\"logo\":\"https://wxs.ign.fr/static/logos/IGN/IGN.gif\",\"minZoom\":6,\"maxZoom\":18,\"constraint\":[{\"minZoom\":15,\"maxZoom\":18,\"bbox\":[-63.37252,-21.475586,55.925865,51.31212]},{\"minZoom\":6,\"maxZoom\":14,\"bbox\":[-63.969162,-21.49687,55.964417,71.584076]}]}}},\r\n};\r\n/** Register new layer capability\r\n * @param {string} layer layer name\r\n * @param {*} capability\r\n */\r\nol.layer.Geoportail.register = function(layer, capability) {\r\n  ol.layer.Geoportail.capabilities[layer] = capability;\r\n};\r\n/** Check if a layer registered with a key?\r\n * @param {string} layer layer name\r\n * @returns {boolean} \r\n */\r\nol.layer.Geoportail.isRegistered = function(layer) {\r\n  return ol.layer.Geoportail.capabilities[layer] && ol.layer.Geoportail.capabilities[layer].key;\r\n};\r\n/** Load capabilities from the service\r\n * @param {string} gppKey the API key to get capabilities for\r\n * @return {*} Promise-like response\r\n */\r\nol.layer.Geoportail.loadCapabilities = function(gppKey, all) {\r\n  var onSuccess = function() {}\r\n  var onError = function() {}\r\n  var onFinally = function() {};\r\n  this.getCapabilities(gppKey,all).then(function(c) {\r\n    ol.layer.Geoportail.capabilities = c;\r\n    onSuccess(c);\r\n  }).catch(function(e) { \r\n    onError(e);\r\n  }).finally(function(c) {\r\n    onFinally(c);\r\n  });\r\n  var response = {\r\n    then: function (callback) {\r\n      if (typeof(callback)==='function') onSuccess = callback;\r\n      return response;\r\n    },\r\n    catch: function (callback) {\r\n      if (typeof(callback)==='function') onError = callback;\r\n      return response;\r\n    },\r\n    finally: function (callback) {\r\n      if (typeof(callback)==='function') onFinally = callback;\r\n      return response;\r\n    }\r\n  }\r\n  return response;\r\n};\r\n/** Get Key capabilities\r\n * @param {string} gppKey the API key to get capabilities for\r\n * @return {*} Promise-like response\r\n */\r\nol.layer.Geoportail.getCapabilities = function(gppKey) {\r\n  var capabilities = {};\r\n  var onSuccess = function() {}\r\n  var onError = function() {}\r\n  var onFinally = function() {}\r\n  var geopresolutions = [156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,0.5971642833948135,0.29858214169740677,0.14929107084870338];\r\n  // Transform resolution to zoom\r\n  function getZoom(res) {\r\n    res = Number(res) * 0.000281;\r\n    for (var r=0; r<geopresolutions.length; r++) \r\n      if (res>geopresolutions[r]) return r;\r\n  }\r\n  // Merge constraints \r\n  function mergeConstraints(ori) {\r\n    for (var i=ori.constraint.length-1; i>0; i--) {\r\n      for (var j=0; j<i; j++) {\r\n        var bok = true;\r\n        for (var k=0; k<4; k++) {\r\n          if (ori.constraint[i].bbox[k] != ori.constraint[j].bbox[k]) {\r\n            bok = false;\r\n            break;\r\n          }\r\n        }\r\n        if (!bok) continue;\r\n        if (ori.constraint[i].maxZoom == ori.constraint[j].minZoom \r\n        || ori.constraint[j].maxZoom == ori.constraint[i].minZoom \r\n        || ori.constraint[i].maxZoom+1 == ori.constraint[j].minZoom \r\n        || ori.constraint[j].maxZoom+1 == ori.constraint[i].minZoom\r\n        || ori.constraint[i].minZoom-1 == ori.constraint[j].maxZoom\r\n        || ori.constraint[j].minZoom-1 == ori.constraint[i].maxZoom) {\r\n          ori.constraint[j].maxZoom = Math.max(ori.constraint[i].maxZoom, ori.constraint[j].maxZoom);\r\n          ori.constraint[j].minZoom = Math.min(ori.constraint[i].minZoom, ori.constraint[j].minZoom);\r\n          ori.constraint.splice(i,1);\r\n          break;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  // Get capabilities\r\n  ol.ext.Ajax.get({\r\n    url: 'https://wxs.ign.fr/'+gppKey+'/autoconf/',\r\n    dataType: 'TEXT',\r\n    error: function (e) {\r\n      onError(e);\r\n      onFinally({});\r\n    },\r\n    success: function(resp) {\r\n      var parser = new DOMParser();\r\n      var config = parser.parseFromString(resp,\"text/xml\");\r\n      var layers = config.getElementsByTagName('Layer');\r\n      for (var i=0, l; l=layers[i]; i++) {\r\n        // WMTS ?\r\n        if (!/WMTS/.test(l.getElementsByTagName('Server')[0].attributes['service'].value)) continue;\r\n//        if (!all && !/geoportail\\/wmts/.test(l.find(\"OnlineResource\").attr(\"href\"))) continue;\r\n        var service = {\r\n          server: l.getElementsByTagName('gpp:Key')[0].innerHTML.replace(gppKey+\"/\",\"\"), \r\n          layer: l.getElementsByTagName('Name')[0].innerHTML,\r\n          title: l.getElementsByTagName('Title')[0].innerHTML,\r\n          format: l.getElementsByTagName('Format')[0].innerHTML,\r\n          style: l.getElementsByTagName('Style')[0].getElementsByTagName('Name')[0].innerHTML,\r\n          queryable: (l.attributes.queryable.value==='1'),\r\n          tilematrix: 'PM',\r\n          minZoom: getZoom(l.getElementsByTagName('sld:MaxScaleDenominator')[0].innerHTML),\r\n          maxZoom: getZoom(l.getElementsByTagName('sld:MinScaleDenominator')[0].innerHTML),\r\n          bbox: JSON.parse('['+l.getElementsByTagName('gpp:BoundingBox')[0].innerHTML+']'),\r\n          desc: l.getElementsByTagName('Abstract')[0].innerHTML.replace(/^<!\\[CDATA\\[(.*)\\]\\]>$/, '$1')\r\n        };\r\n        service.originators = {};\r\n        var origin = l.getElementsByTagName('gpp:Originator');\r\n        for (var k=0, o; o=origin[k]; k++) {\r\n          var ori = service.originators[o.attributes['name'].value] = {\r\n            href: o.getElementsByTagName('gpp:URL')[0].innerHTML,\r\n            attribution: o.getElementsByTagName('gpp:Attribution')[0].innerHTML,\r\n            logo: o.getElementsByTagName('gpp:Logo')[0].innerHTML,\r\n            minZoom: 20,\r\n            maxZoom: 0,\r\n            constraint: []\r\n          };\r\n          // Scale contraints\r\n          var constraint = o.getElementsByTagName('gpp:Constraint');\r\n          for (var j=0, c; c=constraint[j]; j++) {\r\n            var zmax = getZoom(c.getElementsByTagName('sld:MinScaleDenominator')[0].innerHTML);\r\n            var zmin = getZoom(c.getElementsByTagName('sld:MaxScaleDenominator')[0].innerHTML);\r\n            if (zmin > ori.maxZoom) ori.maxZoom = zmin;\r\n            if (zmin < ori.minZoom) ori.minZoom = zmin;\r\n            if (zmax>ori.maxZoom) ori.maxZoom = zmax;\r\n            if (zmax<ori.minZoom) ori.minZoom = zmax;\r\n            ori.constraint.push({\r\n              minZoom: zmin,\r\n              maxZoom: zmax,\r\n              bbox: JSON.parse('['+c.getElementsByTagName('gpp:BoundingBox')[0].innerHTML+']')\r\n            });\r\n          }\r\n          // Merge constraints\r\n          mergeConstraints(ori)\r\n        }\r\n        capabilities[service.layer] = service;\r\n      }\r\n      onSuccess(capabilities);\r\n      onFinally(capabilities);\r\n    }\r\n  });\r\n  // Promise like response\r\n  var response = {\r\n    then: function (callback) {\r\n      if (typeof(callback)==='function') onSuccess = callback;\r\n      return response;\r\n    },\r\n    catch: function (callback) {\r\n      if (typeof(callback)==='function') onError = callback;\r\n      return response;\r\n    },\r\n    finally: function (callback) {\r\n      if (typeof(callback)==='function') onFinally = callback;\r\n      return response;\r\n    },\r\n  }\r\n  return response;\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Return a preview image of the source.\r\n * @param {ol.Coordinate|undefined} lonlat The center of the preview.\r\n * @param {number} resolution of the preview.\r\n * @return {String} the preview url\r\n * @api\r\n */\r\nol.source.Source.prototype.getPreview = function(/*lonlat, resolution*/) {\r\n  return \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAk6QAAJOkBUCTn+AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANeSURBVHic7ZpPiE1RHMc/780MBhkik79JSUlIUbOxI+wkI2yRhYSUlJLNpJF/xcpiJBmZGBZsNM1CkmhKITGkGbH0/BuPmXnP4rxbb/TOn3fvOffeec6nfqvb/b7f93fveeec37ng8Xg8Ho/nf6Uu4d+fDswFssCvhHOJhaXAMeApMAQUyyIPPAdOAiuTStAVy4EHjDWsix5gdRLJ2mY34ulWYz6IEeA4kIk9awtkgTOEM/5vdAKT4k0/Ou3YMR/ELcbRm9AKFLBbgCJwNE4TYZkJfMG++SIwDCyLz0o4bI17WdyJz0r1TAZ+oDcxCBwAFgIzEIuhvcBbg3sLwOK4DFXLFvQGniCGSSUagS4DjUPOHESkA3XiOWCORqMR6Nfo9DjI3QqPUSd+ylBnv0Zn0GrWFvmIOvGNhjqrNDp/EAutyFgRKUM2tgO+Gur81FxvAKYZaimxXYBvmuuLDHWWaK4X0RfJCNsF6NdcbzXU2a65PohYFKWOc+jn8PUajbWIXaBKp9NB7lZYh34OzwFbFfd/NtDYYSth27urLGIm0M31AL3APWAAmIooymaDnPIl/Vz4NN1yHrd7gcvxWQnHAuA3bsyPop8hUsE13BSgK04TUViBeFo2zedJ8S6wElexW4D2eNOPTjNi6WvD/DtEr8E6tk6GGoAmxFY2iFHE9NZiQf8gogiB9gTEH23izAZuE77vHyU+ANucO1QwD3hD/MbLowAcdm20EmkwXx4n3NodS9rMB2HabYpEWs0HcRqHp0fNwAvJD+eBTZr7p6BvmQVxUaEzEbiruNfJekH15L8jtrEm7JJolEcOmKXRqQOuKDQuY7HZY8s8iNfzkSLxIuI43FTrkkLnOlBfRW4VsWk+oAX5weknxFAxJQNckGgVgZuIRVoomoGXEmGTMa+iQ6K7M4SW7k24QYgiuDQPYinbhugiF4H3RGtzZYCzyIvQXfpNI1ybLyeLpf5+iTbkRbiP2EcocTHm4+YI8iI8RFHwWjAfsA95Q+YZFU6wasl8wB7kReijtNbIILa0vcg/PRlGfPQwHmlCviDqAzaA+OREtzqr1ejOIDorxlNEjTGUBV4nnUWCvAJxGDlA8q9j3DEArAn2zvXAfOwfl6eVAmJrPpJ0Ih6Px+PxeJLjLwPul3vj5d0eAAAAAElFTkSuQmCC\";\r\n};\r\n/**\r\n * Return the tile image of the source.\r\n * @param {ol.Coordinate|undefined} lonlat The center of the preview.\r\n * @param {number} resolution of the preview.\r\n * @return {String} the preview url\r\n * @api\r\n */\r\nol.source.Tile.prototype.getPreview = function(lonlat, resolution) {\r\n  if (!lonlat) lonlat = [21020, 6355964];\r\n  if (!resolution) resolution = 150;\r\n  var coord = this.getTileGrid().getTileCoordForCoordAndResolution(lonlat, resolution);\r\n  var fn = this.getTileUrlFunction();\r\n  return fn.call(this, coord, this.getProjection());\r\n};\r\n/**\r\n * Return the tile image of the source.\r\n * @param {ol.Coordinate|undefined} lonlat The center of the preview.\r\n * @param {number} resolution of the preview.\r\n * @return {String} the preview url\r\n * @api\r\n */\r\nol.source.TileWMS.prototype.getPreview = function(lonlat, resolution) {\r\n  if (!lonlat) lonlat = [21020, 6355964];\r\n  if (!resolution) resolution = 150;\r\n  var fn = this.getTileUrlFunction();\r\n  if (fn) {\r\n    var tileGrid = this.getTileGrid() || this.getTileGridForProjection(this.getProjection());\r\n    var coord = tileGrid.getTileCoordForCoordAndResolution(lonlat, resolution);\r\n    return fn.call(this, coord, 1, this.getProjection());\r\n  }\r\n  // Use getfeature info instead\r\n  var url = this.getGetFeatureInfoUrl ? \r\n    this.getGetFeatureInfoUrl(lonlat, resolution, this.getProjection() || 'EPSG:3857', {})\r\n    : this.getFeatureInfoUrl(lonlat, resolution, this.getProjection() || 'EPSG:3857', {});\r\n  url = url.replace(/getfeatureinfo/i,\"GetMap\");\r\n  return url;\r\n};\r\n/**\r\n * Return a preview for the layer.\r\n * @param {ol.Coordinate|undefined} lonlat The center of the preview.\r\n * @param {number} resolution of the preview.\r\n * @return {Array<String>} list of preview url\r\n * @api\r\n */\r\nol.layer.Base.prototype.getPreview = function(lonlat, resolution, projection) {\r\n  if (this.get(\"preview\")) return [ this.get(\"preview\") ];\r\n  if (!resolution) resolution = 150;\r\n  // Get middle resolution\r\n  if (resolution < this.getMinResolution() || resolution > this.getMaxResolution()) {\r\n    var rmin = this.getMinResolution(),\r\n      rmax = this.getMaxResolution();\r\n    if (rmax>100000) rmax = 156543;\t// min zoom : world\r\n    if (rmin<0.15) rmin = 0.15;\t// max zoom \r\n    resolution = rmax;\r\n    while (rmax>rmin) {\r\n      rmin *= 2;\r\n      rmax /= 2;\r\n      resolution = rmin;\r\n    }\r\n  }\r\n  var e = this.getExtent();\r\n  if (!lonlat) lonlat = [21020, 6355964];\t// Default lonlat\r\n  if (e && !ol.extent.containsCoordinate(e,lonlat)) lonlat = [ (e[0]+e[2])/2, (e[1]+e[3])/2 ];\r\n  if (projection) lonlat = ol.proj.transform (lonlat, projection, this.getSource().getProjection());\r\n  if (this.getSource && this.getSource()) {\r\n    return [ this.getSource().getPreview(lonlat, resolution) ];\r\n  }\r\n  return [];\r\n};\r\n/**\r\n * Return a preview for the layer.\r\n * @param {_ol_coordinate_|undefined} lonlat The center of the preview.\r\n * @param {number} resolution of the preview.\r\n * @return {Array<String>} list of preview url\r\n * @api\r\n */\r\nol.layer.Group.prototype.getPreview = function(lonlat, resolution) {\r\n  if (this.get(\"preview\")) return [ this.get(\"preview\") ];\r\n  var t = [];\r\n  if (this.getLayers) {\r\n    var l = this.getLayers().getArray();\r\n    for (var i=0; i<l.length; i++) {\r\n      t = t.concat(l[i].getPreview(lonlat, resolution));\r\n    }\r\n  }\r\n  return t;\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Layer that use Maplibre GL as render\r\n * @constructor \r\n * @extends {ol.layer.Layer}\r\n * @param {any} options layer options\r\n *  @param {string} options.layer Geoportail layer name\r\n *  @param {string} options.gppKey Geoportail API key\r\n *  @param {olx.source.WMTSOptions=} tileoptions WMTS options if not defined default are used\r\n */\r\nol.layer.Maplibre = function(options) {\r\n  if (!ol.layer.Layer) {\r\n    console.error('[ol/layer/MapLibre] bad ol version (need ol@6+)');\r\n  }\r\n  options = options || {};\r\n  options.render = function (frameState) {\r\n    // Create map if not exists\r\n    if (!this._container) {\r\n      this._create(options.style);\r\n    } \r\n    /**/\r\n    var fac = 1\r\n    var dzoom = 1\r\n    //fac = Math.pow(2,.5);\r\n    //dzoom = .5;\r\n    /*/\r\n    var fac = 2\r\n    var dzoom = 0\r\n    /**/\r\n    this._container.style.width = fac*frameState.size[0]+'px';\r\n    this._container.style.height = fac*frameState.size[1]+'px';\r\n    var glMap = this.glMap;\r\n    if (!glMap) return null;\r\n    var canvas = glMap.getCanvas();\r\n    canvas.style.transform = 'scale('+(1/fac)+')';\r\n    // Force map to resize\r\n    if (frameState.size[0] !== canvas.width || frameState.size[1] !== canvas.height) {\r\n      glMap.resize();\r\n    }\r\n    canvas.style.opacity = this.getOpacity();\r\n    // adjust view parameters in mapbox\r\n    var viewState = frameState.viewState;\r\n    glMap.jumpTo({\r\n      center: ol.proj.toLonLat(viewState.center),\r\n      zoom: viewState.zoom - dzoom,\r\n      bearing: (-viewState.rotation * 180) / Math.PI,\r\n      animate: false,\r\n    });\r\n    // cancel the scheduled update & trigger synchronous redraw\r\n    // see https://github.com/mapbox/mapbox-gl-js/issues/7893#issue-408992184\r\n    // NOTE: THIS MIGHT BREAK IF UPDATING THE MAPBOX VERSION\r\n    if (glMap._frame) {\r\n      glMap._frame.cancel();\r\n      glMap._frame = null;\r\n    }\r\n    glMap._render();\r\n    return this._container;\r\n  }\r\n  ol.layer.Layer.call(this, options);\r\n};\r\nif (!ol.layer.Layer) ol.layer.Layer = function() {};\r\nol.ext.inherits (ol.layer.Maplibre, ol.layer.Layer);\r\n/** Get the Maplibre map\r\n * @return {Object}\r\n */\r\nol.layer.Maplibre.prototype.getMapGL = function() {\r\n  return this.glMap;\r\n}\r\n/** Set style\r\n * @param {Object|string} style Mapbox style Object or a URL to JSON\r\n */\r\nol.layer.Maplibre.prototype.setStyle = function(style) {\r\n  this.set('style', style);\r\n  if (this.getMapGL()) {\r\n    this.getMapGL().setStyle(style);\r\n  }\r\n  this.changed();\r\n}\r\n/** Returns the map's Mapbox style object.\r\n * @returns {Object} \r\n */\r\nol.layer.Maplibre.prototype.getStyle = function() {\r\n  return this.getMapGL().get('style');\r\n}\r\n/** Create the map libre map\r\n * @param {Object|string} style Mapbox style Object or a URL to JSON\r\n * @private\r\n */\r\nol.layer.Maplibre.prototype._create = function(style) {\r\n  this._container = ol.ext.element.create('DIV', {\r\n    className: 'ol-maplibre-gl',\r\n    style: {\r\n      position: 'absolute',\r\n      top: 0,\r\n      left: 0\r\n    },\r\n    parent: document.body\r\n  })\r\n  this.glMap = new mapboxgl.Map({\r\n    container: this._container,\r\n    style: style,\r\n    center: [3, 47],\r\n    zoom: 5,\r\n    pitch: 0,\r\n    antialias: true,\r\n    attributionControl: false,\r\n    boxZoom: false,\r\n    doubleClickZoom: false,\r\n    dragPan: false,\r\n    dragRotate: false,\r\n    interactive: false,\r\n    keyboard: false,\r\n    pitchWithRotate: false,\r\n    scrollZoom: false,\r\n    touchZoomRotate: false,\r\n  });\r\n};\r\n\r\n/** ol.layer.Vector.prototype.setRender3D\r\n * @extends {ol.layer.Vector}\r\n * @param {ol.render3D}\r\n */\r\nol.layer.Vector.prototype.setRender3D = function (r) {\r\n  r.setLayer(this);\r\n}\r\n/** \r\n * @classdesc\r\n *  3D vector layer rendering\r\n * @constructor\r\n * @param {Object} param\r\n *  @param {ol.layer.Vector} param.layer the layer to display in 3D\r\n *  @param {ol.style.Style} options.style drawing style\r\n *  @param {function|boolean} param.active a function that returns a boolean or a boolean ,default true\r\n *  @param {boolean} param.ghost use ghost style\r\n *  @param {number} param.maxResolution  max resolution to render 3D\r\n *  @param {number} param.defaultHeight default height if none is return by a propertie\r\n *  @param {function|string|Number} param.height a height function (returns height giving a feature) or a popertie name for the height or a fixed value\r\n */\r\nol.render3D = function (options) {\r\n  options = options || {};\r\n  options.maxResolution = options.maxResolution || 100\r\n  options.defaultHeight = options.defaultHeight || 0;\r\n  ol.Object.call (this, options);\r\n  this.setStyle(options.style);\r\n  this.set('ghost', options.ghost);\r\n  this.setActive(options.active || options.active!==false);\r\n  this.height_ = options.height = this.getHfn (options.height);\r\n  if (options.layer) this.setLayer(options.layer);\r\n}\r\nol.ext.inherits(ol.render3D, ol.Object);\r\n/**\r\n * Set style associated with the renderer\r\n * @param {ol.style.Style} s\r\n */\r\nol.render3D.prototype.setStyle = function(s) {\r\n  if (s instanceof ol.style.Style) this._style = s;\r\n  else this._style = new ol.style.Style ();\r\n  if (!this._style.getStroke()) {\r\n    this._style.setStroke(new ol.style.Stroke({\r\n      width: 1,\r\n      color: 'red'\r\n    }));\r\n  }\r\n  if (!this._style.getFill()) {\r\n    this._style.setFill( new ol.style.Fill({ color: 'rgba(0,0,255,0.5)'}) );\r\n  }\r\n  // Get the geometry\r\n  if (s && s.getGeometry()) {\r\n    var geom = s.getGeometry();\r\n    if (typeof(geom)==='function') {\r\n      this.set('geometry', geom);\r\n    } else {\r\n      this.set('geometry', function() { return geom; });\r\n    }\r\n  } else {\r\n    this.set('geometry', function(f) { return f.getGeometry(); });\r\n  }\r\n};\r\n/**\r\n * Get style associated with the renderer\r\n * @return {ol.style.Style}\r\n */\r\nol.render3D.prototype.getStyle = function() {\r\n  return this._style;\r\n};\r\n/** Set active\r\n * @param {function|boolean} active\r\n */\r\nol.render3D.prototype.setActive = function(active) {\r\n  if (typeof(active)==='function') {\r\n    this._active = active;\r\n  }\r\n  else {\r\n    this._active = function() { return active; };\r\n  }\r\n  if (this.layer_) this.layer_.changed();\r\n};\r\n/** Get active\r\n * @return {boolean} \r\n */\r\nol.render3D.prototype.getActive = function() {\r\n  return this._active();\r\n};\r\n/** Calculate 3D at potcompose\r\n * @private\r\n */\r\nol.render3D.prototype.onPostcompose_ = function(e) {\r\n  if (!this.getActive()) return;\r\n  var res = e.frameState.viewState.resolution;\r\n  if (res > this.get('maxResolution')) return;\r\n  this.res_ = res*400;\r\n  if (this.animate_) {\r\n    var elapsed = e.frameState.time - this.animate_;\r\n    if (elapsed < this.animateDuration_) {\r\n      this.elapsedRatio_ = this.easing_(elapsed / this.animateDuration_);\r\n      // tell OL3 to continue postcompose animation\r\n      e.frameState.animate = true;\r\n    } else {\r\n      this.animate_ = false;\r\n      this.height_ = this.toHeight_\r\n    }\r\n  }\r\n  var ratio = e.frameState.pixelRatio;\r\n  var ctx = e.context;\r\n  var m = this.matrix_ = e.frameState.coordinateToPixelTransform;\r\n  // Old version (matrix)\r\n  if (!m) {\r\n    m = e.frameState.coordinateToPixelMatrix,\r\n    m[2] = m[4];\r\n    m[3] = m[5];\r\n    m[4] = m[12];\r\n    m[5] = m[13];\r\n  }\r\n  this.center_ = [ ctx.canvas.width/2/ratio, ctx.canvas.height/ratio ];\r\n  var f = this.layer_.getSource().getFeaturesInExtent(e.frameState.extent);\r\n  ctx.save();\r\n    ctx.scale(ratio,ratio);\r\n    var s = this.getStyle();\r\n    ctx.lineWidth = s.getStroke().getWidth();\r\n    ctx.strokeStyle = ol.color.asString(s.getStroke().getColor());\r\n    ctx.fillStyle = ol.color.asString(s.getFill().getColor());\r\n    var builds = [];\r\n    for (var i=0; i<f.length; i++) {\r\n      var h = this.getFeatureHeight(f[i])\r\n      if (h) builds.push (this.getFeature3D_ (f[i], h));\r\n    }\r\n    if (this.get('ghost')) this.drawGhost3D_ (ctx, builds);\r\n    else this.drawFeature3D_ (ctx, builds);\r\n  ctx.restore();\r\n};\r\n/** Set layer to render 3D\r\n */\r\nol.render3D.prototype.setLayer = function(l) {\r\n  if (this._listener) {\r\n    this._listener.forEach( function(l) { \r\n      ol.Observable.unByKey(l); \r\n    });\r\n  }\r\n  this.layer_ = l;\r\n  this._listener = l.on (['postcompose', 'postrender'], this.onPostcompose_.bind(this));\r\n}\r\n/** Create a function that return height of a feature\r\n *\t@param {function|string|number} h a height function or a popertie name or a fixed value\r\n *\t@return {function} function(f) return height of the feature f\r\n */\r\nol.render3D.prototype.getHfn= function(h) {\r\n  switch (typeof(h)) {\r\n    case 'function': return h;\r\n    case 'string': {\r\n      var dh = this.get('defaultHeight');\r\n        return (function(f) {\r\n          return (Number(f.get(h)) || dh); \r\n        });\r\n      }\r\n    case 'number': return (function(/*f*/) { return h; });\r\n    default: return (function(/*f*/) { return 10; });\r\n  }\r\n}\r\n/** Animate rendering\r\n * @param {olx.render3D.animateOptions}\r\n *  @param {string|function|number} param.height an attribute name or a function returning height of a feature or a fixed value\r\n *  @param {number} param.duration the duration of the animatioin ms, default 1000\r\n *  @param {ol.easing} param.easing an ol easing function\r\n *\t@api\r\n */\r\nol.render3D.prototype.animate = function(options) {\r\n  options = options || {};\r\n  this.toHeight_ = this.getHfn(options.height);\r\n  this.animate_ = new Date().getTime();\r\n  this.animateDuration_ = options.duration ||1000;\r\n  this.easing_ = options.easing || ol.easing.easeOut;\r\n  // Force redraw\r\n  this.layer_.changed();\r\n}\r\n/** Check if animation is on\r\n *\t@return {bool}\r\n */\r\nol.render3D.prototype.animating = function() {\r\n  if (this.animate_ && new Date().getTime() - this.animate_ > this.animateDuration_) {\r\n    this.animate_ = false;\r\n  }\r\n  return !!this.animate_;\r\n}\r\n/** Get feature height\r\n * @param {ol.Feature} f\r\n */\r\nol.render3D.prototype.getFeatureHeight = function (f) {\r\n  if (this.animate_) {\r\n    var h1 = this.height_(f);\r\n    var h2 = this.toHeight_(f);\r\n    return (h1*(1-this.elapsedRatio_)+this.elapsedRatio_*h2);\r\n  }\r\n  else return this.height_(f);\r\n};\r\n/** Get elevation line\r\n * @private\r\n */\r\nol.render3D.prototype.hvector_ = function (pt, h) {\r\n  var p0 = [\r\n    pt[0]*this.matrix_[0] + pt[1]*this.matrix_[1] + this.matrix_[4],\r\n    pt[0]*this.matrix_[2] + pt[1]*this.matrix_[3] + this.matrix_[5]\r\n  ];\r\n  return {\r\n    p0: p0, \r\n    p1: [\r\n      p0[0] + h/this.res_ * (p0[0]-this.center_[0]),\r\n      p0[1] + h/this.res_ * (p0[1]-this.center_[1])\r\n    ]\r\n  };\r\n};\r\n/** Get drawing\r\n * @private\r\n */\r\nol.render3D.prototype.getFeature3D_ = function (f, h) {\r\n  var geom = this.get('geometry')(f);\r\n  var c = geom.getCoordinates();\r\n  switch (geom.getType()) {\r\n    case \"Polygon\":\r\n      c = [c];\r\n    // fallthrough\r\n    case \"MultiPolygon\":\r\n      var build = [];\r\n      for (var i=0; i<c.length; i++) {\r\n        for (var j=0; j<c[i].length; j++) {\r\n          var b = [];\r\n          for (var k=0; k<c[i][j].length; k++) {\r\n            b.push( this.hvector_(c[i][j][k], h) );\r\n          }\r\n          build.push(b);\r\n        }\r\n      }\r\n      return { type:\"MultiPolygon\", feature: f, geom: build, height: h };\r\n    case \"Point\":\r\n      return { type:\"Point\", feature: f, geom: this.hvector_(c,h), height: h };\r\n    default: return {};\r\n  }\r\n}\r\n/** Draw a feature\r\n * @param {CanvasRenderingContext2D} ctx\r\n * @param {ol.Feature} build\r\n * @private\r\n */\r\nol.render3D.prototype.drawFeature3D_ = function(ctx, build) {\r\n  var i,j, b, k;\r\n  // Construct\r\n  for (i=0; i<build.length; i++) {\t\r\n    switch (build[i].type) {\r\n      case \"MultiPolygon\": {\r\n        for (j=0; j<build[i].geom.length; j++) {\r\n          b = build[i].geom[j];\r\n          for (k=0; k < b.length; k++) {\r\n            ctx.beginPath();\r\n            ctx.moveTo(b[k].p0[0], b[k].p0[1]);\r\n            ctx.lineTo(b[k].p1[0], b[k].p1[1]);\r\n            ctx.stroke();\r\n          }\r\n        }\r\n        break;\r\n      }\r\n      case \"Point\": {\r\n        var g = build[i].geom;\r\n          ctx.beginPath();\r\n          ctx.moveTo(g.p0[0], g.p0[1]);\r\n          ctx.lineTo(g.p1[0], g.p1[1]);\r\n          ctx.stroke();\r\n          break;\r\n        }\r\n      default: break;\r\n    }\r\n  }\r\n  // Roof\r\n  for (i=0; i<build.length; i++) {\r\n    switch (build[i].type) {\r\n      case \"MultiPolygon\": {\r\n        ctx.beginPath();\r\n        for (j=0; j<build[i].geom.length; j++) {\r\n          b = build[i].geom[j];\r\n          if (j==0) {\r\n            ctx.moveTo(b[0].p1[0], b[0].p1[1]);\r\n            for (k=1; k < b.length; k++) {\r\n              ctx.lineTo(b[k].p1[0], b[k].p1[1]);\r\n            }\r\n          } else {\r\n            ctx.moveTo(b[0].p1[0], b[0].p1[1]);\r\n            for (k=b.length-2; k>=0; k--) {\r\n              ctx.lineTo(b[k].p1[0], b[k].p1[1]);\r\n            }\r\n          }\r\n          ctx.closePath();\r\n        }\r\n        ctx.fill(\"evenodd\");\r\n        ctx.stroke();\r\n        break;\r\n      }\r\n      case \"Point\": {\r\n        b = build[i];\r\n        var t = b.feature.get('label');\r\n        if (t) {\r\n          var p = b.geom.p1;\r\n          var f = ctx.fillStyle;\r\n          ctx.fillStyle = ctx.strokeStyle;\r\n          ctx.textAlign = 'center';\r\n          ctx.textBaseline = 'bottom';\r\n          ctx.fillText ( t, p[0], p[1] );\r\n          var m = ctx.measureText(t);\r\n          var h = Number (ctx.font.match(/\\d+(\\.\\d+)?/g).join([]));\r\n          ctx.fillStyle = \"rgba(255,255,255,0.5)\";\r\n          ctx.fillRect (p[0]-m.width/2 -5, p[1]-h -5, m.width +10, h +10)\r\n          ctx.strokeRect (p[0]-m.width/2 -5, p[1]-h -5, m.width +10, h +10)\r\n          ctx.fillStyle = f;\r\n          //console.log(build[i].feature.getProperties())\r\n        }\r\n        break;\r\n      }\r\n      default: break;\r\n    }\r\n  }\r\n};\r\n/**\r\n * @private\r\n */\r\nol.render3D.prototype.drawGhost3D_ = function(ctx, build) {\r\n  var i,j, b, k;\r\n  // Construct\r\n  for (i=0; i<build.length; i++) {\t\r\n    switch (build[i].type) {\r\n      case \"MultiPolygon\": {\r\n        for (j=0; j<build[i].geom.length; j++) {\r\n          b = build[i].geom[j];\r\n          for (k=0; k < b.length-1; k++) {\r\n            ctx.beginPath();\r\n              ctx.moveTo(b[k].p0[0], b[k].p0[1]);\r\n              ctx.lineTo(b[k].p1[0], b[k].p1[1]);\r\n              ctx.lineTo(b[k+1].p1[0], b[k+1].p1[1]);\r\n              ctx.lineTo(b[k+1].p0[0], b[k+1].p0[1]);\r\n              ctx.lineTo(b[k].p0[0], b[k].p0[1]);\r\n              var m = [(b[k].p0[0] + b[k+1].p0[0]) /2, (b[k].p0[1] + b[k+1].p0[1]) /2];\r\n              var h = [b[k].p0[1] - b[k+1].p0[1], - b[k].p0[0] + b[k+1].p0[0]];\r\n              var c = ol.coordinate.getIntersectionPoint(\r\n                [m, [m[0] + h[0], m[1]+ h[1]]],\r\n                [b[k].p1, b[k+1].p1]\r\n              );\r\n              var gradient = ctx.createLinearGradient(\r\n                m[0], m[1],              \r\n                c[0], c[1]\r\n              );\r\n              gradient.addColorStop(0, 'rgba(255,255,255,.2)');\r\n              gradient.addColorStop(1, 'rgba(255,255,255,0)');\r\n              ctx.fillStyle = gradient;\r\n              ctx.fill();\r\n          }\r\n        }\r\n        break;\r\n      }\r\n      case \"Point\": {\r\n        var g = build[i].geom;\r\n          ctx.beginPath();\r\n          ctx.moveTo(g.p0[0], g.p0[1]);\r\n          ctx.lineTo(g.p1[0], g.p1[1]);\r\n          ctx.stroke();\r\n          break;\r\n        }\r\n      default: break;\r\n    }\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A sketch layer used as overlay to handle drawing sketch (helper for drawing tools)\r\n * @constructor \r\n * @extends {ol/layer/Vector}\r\n * @fires drawstart\r\n * @fires drawend\r\n * @fires drawabort\r\n * @param {*} options \r\n *  @param {string} options.type Geometry type, default LineString\r\n *  @param {ol.style.Style|Array<ol.style.Style>} options.style Drawing style\r\n *  @param {ol.style.Style|Array<ol.style.Style>} options.sketchStyle Sketch style\r\n */\r\nol.layer.SketchOverlay = function(options) {\r\n  options = options || {};\r\n  var style = options.style || ol.style.Style.defaultStyle(true);\r\n  var sketchStyle = options.sketchStyle;\r\n  if (!sketchStyle) {\r\n    sketchStyle = ol.style.Style.defaultStyle();\r\n    sketchStyle = [\r\n      new ol.style.Style({\r\n        image: new ol.style.RegularShape ({\r\n          points: 4,\r\n          radius: 10,\r\n          radius2: 0,\r\n          stroke: new ol.style.Stroke({\r\n            color: [255,255,255, .5],\r\n            width: 3\r\n          })\r\n        })\r\n      }),\r\n      sketchStyle[0].clone()\r\n    ];\r\n    sketchStyle[1].setImage(new ol.style.RegularShape ({\r\n      points: 4,\r\n      radius: 10,\r\n      radius2: 0,\r\n      stroke: new ol.style.Stroke({\r\n        color: [0, 153, 255, 1],\r\n        width: 1.25\r\n      })\r\n    }));\r\n  }\r\n  this._geom = [];\r\n  ol.layer.Vector.call (this, {\r\n    name: 'sketch',\r\n    source: new ol.source.Vector({ useSpatialIndex: false }),\r\n    style: function(f) {\r\n      return (f.get('sketch') ? sketchStyle : style);\r\n    },\r\n    updateWhileAnimating: true,\r\n    updateWhileInteracting: true\r\n  });\r\n  // Sketch features\r\n  this.getSource().addFeatures([\r\n    new ol.Feature({\r\n      sketch: true,\r\n      geometry: new ol.geom.Point([])\r\n    }),\r\n    new ol.Feature({\r\n      sketch: true,\r\n      geometry: new ol.geom.LineString([])\r\n    }),\r\n    new ol.Feature(),\r\n    new ol.Feature(new ol.geom.Point([]))\r\n  ]);\r\n  this.setGeometryType(options.type);\r\n};\r\nol.ext.inherits (ol.layer.SketchOverlay, ol.layer.Vector);\r\n/** Set geometry type\r\n * @param {string} type Geometry type\r\n * @return {string} the current type\r\n */\r\nol.layer.SketchOverlay.prototype.setGeometryType = function(type) {\r\n  var t = /^Point$|^LineString$|^Polygon$|^Circle$/.test(type) ? type : 'LineString';\r\n  if (t !== this._type) {\r\n    this.abortDrawing();\r\n    this._type = t;\r\n  }\r\n  return this._type;\r\n};\r\n/** Get geometry type\r\n * @return {string} Geometry type\r\n */\r\nol.layer.SketchOverlay.prototype.getGeometryType = function() {\r\n  return this._type;\r\n};\r\n/** Add a new Point to the sketch\r\n * @param {ol.coordinate} coord\r\n * @return {boolean} true if point has been added, false if same coord\r\n */\r\nol.layer.SketchOverlay.prototype.addPoint = function(coord) {\r\n  if (this._lastCoord !== this._position) {\r\n    if (!this._geom.length) {\r\n      this.startDrawing();\r\n    }\r\n    this._geom.push(coord);\r\n    this._lastCoord = coord; \r\n    this._position = coord; \r\n    this.drawSketch();\r\n    if (this.getGeometryType() === 'Point') {\r\n      this.finishDrawing();\r\n    }\r\n    if (this.getGeometryType() === 'Circle' && this._geom.length>=2) {\r\n      this.finishDrawing();\r\n    }\r\n    return true;\r\n  }\r\n  return false;\r\n};\r\n/** Remove the last Point from the sketch\r\n */\r\nol.layer.SketchOverlay.prototype.removeLastPoint = function() {\r\n  this._geom.pop();\r\n  this._lastCoord = this._geom[this._geom.length-1];\r\n  this.drawSketch();\r\n};\r\n/** Strat a new drawing\r\n * @param {*} options\r\n *  @param {string} type Geometry type, default the current type\r\n *  @param {Array<ol.coordinate>} coordinates a list of coordinates to extend\r\n *  @param {ol.Feature} feature a feature to extend (LineString or Polygon only)\r\n *  @param {boolean} atstart extent coordinates or feature at start, default false (extend at end)\r\n */\r\nol.layer.SketchOverlay.prototype.startDrawing = function(options) {\r\n  options = options || {};\r\n  this._geom = [];\r\n  if (options.type) this.setGeometryType(options.type);\r\n  this.drawSketch();\r\n  if (!this._drawing) {\r\n    this.dispatchEvent({\r\n      type: 'drawstart',\r\n      feature: this.getFeature()\r\n    });\r\n  }\r\n  this._drawing = true;\r\n};\r\n/** Finish drawing\r\n * @return {ol.Feature} the drawed feature\r\n */\r\nol.layer.SketchOverlay.prototype.finishDrawing = function(valid) {\r\n  var f = this.getSource().getFeatures()[2].clone();\r\n  var isvalid = !!f;\r\n  switch (this.getGeometryType()) {\r\n    case 'Circle': \r\n    case 'LineString': {\r\n      isvalid = this._geom.length > 1;\r\n      break;\r\n    }\r\n    case 'Polygon': {\r\n      isvalid = this._geom.length > 2;\r\n      break;\r\n    }\r\n  }\r\n  if (valid && !isvalid) return false;\r\n  this._geom = [];\r\n  this._lastCoord = null;\r\n  this.drawSketch();\r\n  if (this._drawing) {\r\n    this.dispatchEvent({\r\n      type: 'drawend',\r\n      valid: isvalid,\r\n      feature: f\r\n    });\r\n  }\r\n  this._drawing = false\r\n  return f;\r\n};\r\n/** Abort drawing\r\n */\r\nol.layer.SketchOverlay.prototype.abortDrawing = function() {\r\n  if (this._drawing) {\r\n    this.dispatchEvent({\r\n      type: 'drawabort',\r\n      feature: this.getFeature()\r\n    });\r\n  }\r\n  this._drawing = false;\r\n  this._geom = [];\r\n  this._lastCoord = null;\r\n  this.drawSketch();\r\n};\r\n/** Set current position\r\n * @param {ol.coordinate} coord\r\n */\r\nol.layer.SketchOverlay.prototype.setPosition = function(coord) {\r\n  this._position = coord;\r\n  this.drawLink();\r\n};\r\n/** Get current position\r\n * @return {ol.coordinate} \r\n */\r\nol.layer.SketchOverlay.prototype.getPosition = function() {\r\n  return this._position;\r\n};\r\n/** Draw/refresh link\r\n */\r\nol.layer.SketchOverlay.prototype.drawLink = function() {\r\n  var features = this.getSource().getFeatures();\r\n  if (this._position) {\r\n    if (this._lastCoord && this._lastCoord === this._position) {\r\n      features[0].getGeometry().setCoordinates([]);\r\n    } else {\r\n      features[0].getGeometry().setCoordinates(this._position);\r\n    }\r\n    if (this._geom.length) {\r\n      if (this.getGeometryType()==='Circle') {\r\n        features[1].setGeometry(new ol.geom.Circle(this._geom[0], ol.coordinate.dist2d(this._geom[0], this._position)));\r\n      } else if (this.getGeometryType()==='Polygon') {\r\n        features[1].setGeometry(new ol.geom.LineString([ this._lastCoord, this._position, this._geom[0] ]));\r\n      } else {\r\n        features[1].setGeometry(new ol.geom.LineString([ this._lastCoord, this._position ]));\r\n      }\r\n    } else {\r\n      features[1].setGeometry(new ol.geom.LineString([]));\r\n    }\r\n  } else {\r\n    features[0].getGeometry().setCoordinates([]);\r\n    features[1].setGeometry(new ol.geom.LineString([]));\r\n  }\r\n};\r\n/** Get current feature\r\n */\r\nol.layer.SketchOverlay.prototype.getFeature = function() {\r\n  return this.getSource().getFeatures()[2];\r\n};\r\n/** Draw/refresh sketch\r\n */\r\nol.layer.SketchOverlay.prototype.drawSketch = function() {\r\n  this.drawLink();\r\n  var features = this.getSource().getFeatures();\r\n  if (!this._geom.length) {\r\n    features[2].setGeometry(null);\r\n    features[3].setGeometry(new ol.geom.Point([]));\r\n  } else {\r\n    if (!this._lastCoord) this._lastCoord = this._geom[this._geom.length-1];\r\n    features[3].getGeometry().setCoordinates(this._lastCoord);\r\n    switch (this._type) {\r\n      case 'Point': {\r\n        features[2].setGeometry(new ol.geom.Point(this._lastCoord));\r\n        break;\r\n      }\r\n      case 'Circle': {\r\n        if (!features[2].getGeometry()) {\r\n          features[2].setGeometry(new ol.geom.Circle(this._geom[0], ol.coordinate.dist2d(this._geom[0], this._geom[this._geom.length-1])));\r\n        } else {\r\n          features[2].getGeometry().setRadius(ol.coordinate.dist2d(this._geom[0], this._geom[this._geom.length-1]));\r\n        }\r\n        break;\r\n      }\r\n      case 'LineString': {\r\n        if (!features[2].getGeometry()) {\r\n          features[2].setGeometry(new ol.geom.LineString(this._geom));\r\n        } else {\r\n          features[2].getGeometry().setCoordinates(this._geom);\r\n        }\r\n        break;\r\n      }\r\n      case 'Polygon': {\r\n        this._geom.push(this._geom[0]);\r\n        if (!features[2].getGeometry()) {\r\n          features[2].setGeometry(new ol.geom.Polygon([this._geom]));\r\n        } else {\r\n          features[2].getGeometry().setCoordinates([this._geom]);\r\n        }\r\n        this._geom.pop();\r\n        break;\r\n      }\r\n      default: {\r\n        console.error('[ol/layer/SketchOverlay~drawSketch] geometry type not supported ('+this._type+')');\r\n        break;\r\n      }\r\n    }\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A map with a perspective\r\n * @constructor \r\n * @extends {ol.Map}\r\n * @fires change:perspective\r\n * @param {olx.MapOptions=} options \r\n *  @param {ol.events.condition} tiltCondition , default altKeyOnly\r\n */\r\nol.PerspectiveMap = function(options) {\r\n  // Map div\r\n  var divMap = options.target instanceof Element ? options.target : document.getElementById(options.target);\r\n  if (window.getComputedStyle(divMap).position !== 'absolute') {\r\n    divMap.style.position = 'relative';\r\n  }\r\n  divMap.style.overflow = 'hidden';\r\n  // Create map inside\r\n  var map = ol.ext.element.create('DIV', {\r\n    className: 'ol-perspective-map',\r\n    parent: divMap\r\n  });\r\n  var opts = {};\r\n  Object.assign(opts, options);\r\n  opts.target = map;\r\n  // enhance pixel ratio\r\n  //opts.pixelRatio = 2;\r\n  ol.Map.call (this, opts);\r\n  this._tiltCondition = options.tiltCondition || ol.events.condition.altKeyOnly;\r\n};\r\nol.ext.inherits (ol.PerspectiveMap, ol.Map);\r\n/** Get pixel ratio for the map\r\n */\r\nol.PerspectiveMap.prototype.getPixelRatio = function(){\r\n  return window.devicePixelRatio;\r\n};\r\n/** Set perspective angle\r\n * @param {number} angle the perspective angle 0 (vertical) - 30 (max), default 0\r\n * @param {*} options\r\n *  @param {number} options.duration The duration of the animation in milliseconds, default 500\r\n *  @param {function} options.easing The easing function used during the animation, defaults to ol.easing.inAndOut).\r\n */\r\nol.PerspectiveMap.prototype.setPerspective = function(angle, options) {\r\n  options = options || {};\r\n  // max angle\r\n  if (angle > 30) angle = 30;\r\n  else if (angle<0) angle = 0;\r\n  var fromAngle = this._angle || 0;\r\n  var toAngle = Math.round(angle*10)/10;\r\n  var style = this.getTarget().querySelector('.ol-layers').style;\r\n  cancelAnimationFrame(this._animatedPerspective)\r\n  requestAnimationFrame(function(t) {\r\n    this._animatePerpective(t, t, style, fromAngle, toAngle, options.duration, options.easing||ol.easing.inAndOut);\r\n  }.bind(this))\r\n};\r\n/** Animate the perspective\r\n * @param {number} t0 starting timestamp\r\n * @param {number} t current timestamp\r\n * @param {CSSStyleDeclaration} style style to modify\r\n * @param {number} fromAngle starting angle\r\n * @param {number} toAngle ending angle\r\n * @param {number} duration The duration of the animation in milliseconds, default 500\r\n * @param {function} easing The easing function used during the animation, defaults to ol.easing.inAndOut).\r\n * @private\r\n */\r\nol.PerspectiveMap.prototype._animatePerpective = function(t0, t, style, fromAngle, toAngle, duration, easing ) {\r\n  var dt, end;\r\n  if (duration === 0) {\r\n    dt = 1;\r\n    end = true;\r\n  } else {\r\n    dt = (t-t0)/(duration||500);\r\n    end = (dt>=1);\r\n  }\r\n  dt = easing(dt);\r\n  var angle;\r\n  if (end) {\r\n    angle = this._angle = toAngle;\r\n  } else {\r\n    angle = this._angle = fromAngle + (toAngle-fromAngle)*dt;\r\n  }\r\n  var fac = angle/30;\r\n  // apply transform to the style\r\n  style.transform = 'translateY(-'+(17*fac)+'%) perspective(200px) rotateX('+angle+'deg) scaleY('+(1-fac/2)+')';\r\n  this.getMatrix3D(true);\r\n  this.render();\r\n  if (!end) {\r\n    requestAnimationFrame(function(t) {\r\n      this._animatePerpective(t0, t, style, fromAngle, toAngle, duration||500, easing||ol.easing.inAndOut);\r\n    }.bind(this))  \r\n  }\r\n  // Dispatch event\r\n  this.dispatchEvent({\r\n    type: 'change:perspective', \r\n    angle: angle,\r\n    animating: !end\r\n  });\r\n};\r\n/** Convert to pixel coord according to the perspective\r\n * @param {MapBrowserEvent} mapBrowserEvent The event to handle.\r\n */\r\nol.PerspectiveMap.prototype.handleMapBrowserEvent = function(e) {\r\n  e.pixel = [\r\n    e.originalEvent.offsetX / this.getPixelRatio(), \r\n    e.originalEvent.offsetY / this.getPixelRatio()\r\n  ];\r\n  e.coordinate = this.getCoordinateFromPixel(e.pixel);\r\n  ol.Map.prototype.handleMapBrowserEvent.call (this, e);\r\n  // Change perspective on tilt condition\r\n  if (this._tiltCondition(e)) {\r\n    switch(e.type) {\r\n      case 'pointerdown': {\r\n        this._dragging = e.originalEvent.offsetY;\r\n        break;\r\n      }\r\n      case 'pointerup': {\r\n        this._dragging = false;\r\n        break;\r\n      }\r\n      case 'pointerdrag': {\r\n        if (this._dragging !== false) { \r\n          var angle = e.originalEvent.offsetY > this._dragging ? .5 : -.5;\r\n          if (angle) {\r\n            this.setPerspective((this._angle||0) + angle, { duration: 0 });\r\n          }\r\n          this._dragging = e.originalEvent.offsetY;\r\n        }\r\n        break;\r\n      }\r\n    }\r\n  } else {\r\n    this._dragging = false;\r\n  }\r\n};\r\n/** Get map full teansform matrix3D\r\n * @return {Array<Array<number>>} \r\n */\r\nol.PerspectiveMap.prototype.getMatrix3D = function (compute) {\r\n  if (compute) {\r\n    var ele = this.getTarget().querySelector('.ol-layers');\r\n    // Get transform matrix3D from CSS\r\n    var tx = ol.matrix3D.getTransform(ele);\r\n    // Get the CSS transform origin from the transformed parent - default is '50% 50%'\r\n    var txOrigin = ol.matrix3D.getTransformOrigin(ele);\r\n    // Compute the full transform that is applied to the transformed parent (-origin * tx * origin)\r\n    this._matrixTransform = ol.matrix3D.computeTransformMatrix(tx, txOrigin);\r\n  }\r\n  if (!this._matrixTransform) this._matrixTransform = ol.matrix3D.identity();\r\n  return this._matrixTransform;\r\n};\r\n/** Get pixel at screen from coordinate.\r\n * The default getPixelFromCoordinate get pixel in the perspective.\r\n * @param {ol.coordinate} coord\r\n * @param {ol.pixel} \r\n */\r\nol.PerspectiveMap.prototype.getPixelScreenFromCoordinate = function (coord) {\r\n  // Get pixel in the transform system\r\n  var px = this.getPixelFromCoordinate(coord);\r\n  // Get transform matrix3D from CSS\r\n  var fullTx = this.getMatrix3D();\r\n  // Transform the point using full transform\r\n  var pixel = ol.matrix3D.transformVertex(fullTx, px);\r\n  // Perform the homogeneous divide to apply perspective to the points (divide x,y,z by the w component).\r\n  pixel = ol.matrix3D.projectVertex(pixel);\r\n  return [pixel[0], pixel[1]];\r\n};\r\n/** Not working...\r\n * \r\n */\r\nol.PerspectiveMap.prototype.getPixelFromPixelScreen = function (px) {\r\n  // Get transform matrix3D from CSS\r\n  var fullTx = ol.matrix3D.inverse(this.getMatrix3D());\r\n  // Transform the point using full transform\r\n  var pixel = ol.matrix3D.transformVertex(fullTx, px);\r\n  // Perform the homogeneous divide to apply perspective to the points (divide x,y,z by the w component).\r\n  pixel = ol.matrix3D.projectVertex(pixel);\r\n  return [pixel[0], pixel[1]];  \r\n};\r\n/* Overwrited Overlay function to handle overlay positing in a perspective map */\r\n(function() {\r\nvar _updatePixelPosition = ol.Overlay.prototype.updatePixelPosition;\r\n/** Update pixel projection in a perspective map (apply projection to the position)\r\n * @private\r\n */\r\nol.Overlay.prototype.updatePixelPosition = function () {\r\n  var map = this.getMap();\r\n  if (map && map instanceof ol.PerspectiveMap) {\r\n    var position = this.getPosition();\r\n    if (!map || !map.isRendered() || !position) {\r\n      this.setVisible(false);\r\n      return;\r\n    }\r\n    // Get pixel at screen\r\n    var pixel = map.getPixelScreenFromCoordinate(position);\r\n    var mapSize = map.getSize();\r\n    pixel[0] -= mapSize[0]/4\r\n    pixel[1] -= mapSize[1]/4\r\n    /* for ol v6.2.x\r\n    // Offset according positioning\r\n    var pos = this.getPositioning();\r\n    if (/bottom/.test(pos)) {\r\n      pixel[1] += mapSize[1]/4\r\n    } else {\r\n      pixel[1] -= mapSize[1]/4\r\n    }\r\n    if (/right/.test(pos)) {\r\n      pixel[0] += mapSize[0]/4\r\n    } else {\r\n      pixel[0] -= mapSize[0]/4\r\n    }\r\n    */\r\n    // Update\r\n    this.updateRenderedPosition(pixel , mapSize);\r\n  } else {\r\n    _updatePixelPosition.call(this);\r\n  }\r\n};\r\n/**/\r\n})();\r\n\r\n/*\r\n  Copyright (c) 2020 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/*global ol*/\r\nif (window.ol && !ol.particule) {\r\n  ol.particule = {};\r\n}\r\n/** Abstract base class; normally only used for creating subclasses. \r\n * An object with coordinates, draw and update\r\n * @constructor\r\n * @extends {ol.Object}\r\n * @param {*} options\r\n *  @param {ol.Overlay} options.overlay\r\n *  @param {ol.pixel} coordinate the position of the particule\r\n */\r\nol.particule.Base = function(options) {\r\n  if (!options) options = {};\r\n  ol.Object.call(this);\r\n  this.setOverlay(options.overlay) ;\r\n  this.coordinate = options.coordinate || [0,0];\r\n};\r\nol.ext.inherits(ol.particule.Base, ol.Object);\r\n/** Set the particule overlay\r\n * @param {ol.Overlay} overl\r\n */\r\nol.particule.Base.prototype.setOverlay = function(overlay) {\r\n  this._overlay = overlay;\r\n};\r\n/** Get the particule overlay\r\n * @return {ol.Overlay}\r\n */\r\nol.particule.Base.prototype.getOverlay = function() {\r\n  return this._overlay;\r\n};\r\n/** Draw the particule\r\n * @param { CanvasRenderingContext2D } ctx\r\n */\r\nol.particule.Base.prototype.draw = function(/* ctx */) {\r\n};\r\n/** Update the particule\r\n * @param {number} dt timelapes since last call\r\n */\r\nol.particule.Base.prototype.update = function(/* dt */) {\r\n};\r\n/** Update the particule\r\n * @param {number} dt timelapes since last call\r\n */\r\nol.particule.Base.prototype.getRandomCoord = function(dt) {\r\n  if (this.getOverlay().randomCoord) return this.getOverlay().randomCoord();\r\n  else return [dt,0];\r\n};\r\n\r\n/*\r\n  Copyright (c) 2020 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A cloud particule to display clouds over the map\r\n * @constructor\r\n * @extends {ol.particule.Base}\r\n * @param {*} options\r\n *  @param {ol.Overlay} options.overlay\r\n *  @param {ol.pixel} coordinate the position of the particule\r\n */\r\nol.particule.Bird = function(options) {\r\n  if (!options) options = {};\r\n  ol.particule.Base.call(this, options);\r\n  this.bird = new Image();\r\n  this.bird.src = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAABDCAQAAAD+S8VaAAAAAnNCSVQICFXsRgQAAAAJcEhZcwAAAvMAAALzAdLpCioAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAG90lEQVR42uWaaVRTRxTHJ4AUUIoIiqISOArIDiIhBBfccCMoR0vVUpXjTqun4Fr1tO5i3YuodaFqRMECKm4VUHEhUvWgBYuilgpiRVZpCARI3r8fWA4hYY9AXu77+ObNzO/O8u787xDSyeYSTzSICpu+DjV0ogrze84PBneByuJv3JpbBlx6MEBbJfG/8S2RAACFXXtU0gERN1BjCc9UEN/e7I2w1gFPinv3UDkHbFiGOqOwJVjlHMALRT3LLJ7trGIOuHwFUsY7q2IOuJ0u7YB//pswWFn6/vnUcbOCAn7ctfnUrsijl85dv5pw786fd9OTsvg5/JykN3fTb6ZcTDgVvefIkqXmVvKr0NN/IUQDO7C1qwJrOwyftIZ7cmIiN21eZlB+SOUtFKNl9kF0hb9ujmyVM73FMmWv3m+2J4zxw74NDN5/5vT1qzeT7j3n5/Bz7mcmPk24cy32Ai8i9Pj2nwIX+jo4kc8UMMqeXr5bfC6N/2tUHrdsCQ4gAR/QNhNRJ8+6GklXH7xStlxW+ViLxrpjqBswJ/z4rYyCFrQnwJPCxGe/x53i+fO+XOth2xpsvQm+PkfGP3YuYIo1oInTyIJiLDFtoZfUP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oghFyKH47y/GHohtLf45ITvVuLyfyKLI5RlntyJSXx2+P+gaejt5O7FNCSEkcFHTuAmPom6/qqxJqFRee33wHGc6rVLjXtym8C8nTTcnDNMh/n5BfnN8mFY18jWdbPlceeBViEsPi16xxFSL7ncjukVelTvxUzsxjOlAUzsULv8/GfdEJa7G7D7YWLCcUzbNkfb42zaXNaG2h4XTHH/n9x+bjIHKqeAdNMZf55fbrKBYLNq+lqb433lkFrUk5hNKdu6mIf5XA1KetzibR+09TLcfonrMtVYlNKk9h2gV//FCW3tCFmMXT0nOe83bxpklbdDJqrD+BC1mwUzTtOw2Sl/UFjpsh8ci2pHirFgxV8nxV/oJxO2RwR6+HNFbmfkZ15PaqwQe/VmJ+R18Aql37XTAsQ9EefUBW6NeEk34IaWN8HkIQk+Jva0SzwGXP6p1XDeEoqB1qx/L0B3dKY+VSr0JDurDFNaK2ZoYg5142sx1m3LEYxUsq+Vv8ejVSv8bdJ/UXySds9eDB4JwEnFIRS6KUIi/8RJxCEEARte74GBR6DycFpGgtZNFPkHrHgOx61miSaPDEOtEn8qWwvepZMc5Mel3ItZmHbbM12wSXV/snMHZQ6eRlzEzI9d9rnftskwERhXVNxF7ik1Krd87pbLCbWYR9Y7v0f/htaJHbsoDhwAAAABJRU5ErkJggg==\";\r\n  this.set('size', [this.bird.width || 50, this.bird.height || 50]);\r\n};\r\nol.ext.inherits(ol.particule.Bird, ol.particule.Base);\r\n/** Draw the particule\r\n * @param {CanvasRenderingContext2D } ctx\r\n */\r\nol.particule.Bird.prototype.draw = function(ctx) {\r\n  //ctx.drawImage(this.bird, this.coordinate[0], this.coordinate[1]);\r\n  var angle = this.getOverlay().get('angle');\r\n  ctx.save();\r\n    ctx.translate (this.coordinate[0], this.coordinate[1]);\r\n    ctx.rotate(angle+Math.PI/2);\r\n    ctx.scale(.5,.5);\r\n    ctx.drawImage( this.bird, -this.bird.width/2, -this.bird.height/2 );\r\n  ctx.restore();\r\n};\r\n/** Update the particule\r\n * @param {number} dt timelapes since last call\r\n */\r\nol.particule.Bird.prototype.update = function(dt) {\r\n  var speed = this.getOverlay().get('speed') * dt / this.getOverlay()._fps;\r\n  var angle = this.getOverlay().get('angle');\r\n  this.coordinate[0] += speed * Math.cos(angle);\r\n  this.coordinate[1] += speed * Math.sin(angle);\r\n};\r\n\r\n/*\r\n  Copyright (c) 2020 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A cloud particule to display clouds over the map\r\n * @constructor\r\n * @extends {ol.particule.Base}\r\n * @param {*} options\r\n *  @param {ol.Overlay} options.overlay\r\n *  @param {ol.pixel} coordinate the position of the particule\r\n */\r\nol.particule.Cloud = function(options) {\r\n  if (!options) options = {};\r\n  ol.particule.Base.call(this, options);\r\n  this.set('size', [100,100])\r\n  var canvas = document.createElement('CANVAS');\r\n  canvas.width = 200;\r\n  canvas.height = 200;\r\n  var ctx = canvas.getContext('2d');\r\n  var grd = this.gradient = ctx.createRadialGradient(50,50, 0, 50,50, 50);\r\n  grd.addColorStop(0, 'rgba(255,255,255,.2');\r\n  grd.addColorStop(1, 'rgba(255,255,255,0');\r\n  // Create cloud image\r\n  this.image = canvas;\r\n  for (var k=0; k<7; k++) {\r\n    ctx.save();\r\n      var x = Math.random()*100;\r\n      var y = Math.random()*100;\r\n      ctx.translate (x,y);\r\n      ctx.fillStyle = grd;\r\n      ctx.fillRect(0,0,canvas.width,canvas.height);\r\n    ctx.restore();\r\n  }\r\n};\r\nol.ext.inherits(ol.particule.Cloud, ol.particule.Base);\r\n/** Draw the particule\r\n * @param {CanvasRenderingContext2D } ctx\r\n */\r\nol.particule.Cloud.prototype.draw = function(ctx) {\r\n  ctx.save();\r\n    ctx.translate (this.coordinate[0], this.coordinate[1]);\r\n    ctx.drawImage(this.image, -this.image.width/2, -this.image.width/2);\r\n  ctx.restore();\r\n};\r\n/** Update the particule\r\n * @param {number} dt timelapes since last call\r\n */\r\nol.particule.Cloud.prototype.update = function(dt) {\r\n  var speed = this.getOverlay().get('speed') * dt / this.getOverlay()._fps;\r\n  var angle = this.getOverlay().get('angle');\r\n  this.coordinate[0] += speed * Math.cos(angle);\r\n  this.coordinate[1] += speed * Math.sin(angle);\r\n};\r\n\r\n/*\r\n  Copyright (c) 2020 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Rain particules to display clouds over the map\r\n * @constructor\r\n * @extends {ol.particule.Base}\r\n * @param {*} options\r\n *  @param {ol.Overlay} options.overlay\r\n *  @param {ol.pixel} coordinate the position of the particule\r\n */\r\nol.particule.Rain = function(options) {\r\n  if (!options) options = {};\r\n  ol.particule.Base.call(this, options);\r\n  this.z = Math.floor(Math.random()*5) + 1;\r\n  var canvas = document.createElement('CANVAS');\r\n  canvas.width = 50;\r\n  canvas.height = 50;\r\n  var ctx = canvas.getContext('2d');\r\n  this.gradient = ctx.createRadialGradient(0,0, 0, 0,0, 25);\r\n  this.gradient.addColorStop(0, 'rgba(0,0,80,0)');\r\n  this.gradient.addColorStop(1, 'rgba(0,0,80,.3)');\r\n};\r\nol.ext.inherits(ol.particule.Rain, ol.particule.Base);\r\n/** Draw the particule\r\n * @param {CanvasRenderingContext2D } ctx\r\n */\r\nol.particule.Rain.prototype.draw = function(ctx) {\r\n  ctx.save();\r\n    var angle = this.getOverlay().get('angle');\r\n    ctx.beginPath();\r\n    var x1 = Math.cos(angle) * 10 * (1+this.z/2);\r\n    var y1 = Math.sin(angle) * 10 * (1+this.z/2);\r\n    ctx.lineWidth = Math.round(this.z/2);\r\n    ctx.strokeStyle = this.gradient;\r\n    ctx.translate (this.coordinate[0], this.coordinate[1]);\r\n    ctx.moveTo(0,0);\r\n    ctx.lineTo(x1, y1);\r\n    ctx.stroke();\r\n  ctx.restore();\r\n};\r\n/** Update the particule\r\n * @param {number} dt timelapes since last call\r\n */\r\nol.particule.Rain.prototype.update = function(dt) {\r\n  var dl = this.getOverlay().get('speed') * dt / this.getOverlay()._fps * this.z;\r\n  var angle = this.getOverlay().get('angle');\r\n  this.coordinate[0] += dl * Math.cos(angle);\r\n  this.coordinate[1] += dl * Math.sin(angle);\r\n};\r\n\r\n/*\r\n  Copyright (c) 2020 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Raindrop particules to display clouds over the map\r\n * @constructor\r\n * @extends {ol.particule.Base}\r\n * @param {*} options\r\n *  @param {ol.Overlay} options.overlay\r\n *  @param {ol.pixel} coordinate the position of the particule\r\n */\r\nol.particule.RainDrop = function(options) {\r\n  if (!options) options = {};\r\n  ol.particule.Base.call(this, options);\r\n  this.size = 0;\r\n  // Drops\r\n  var canvas = document.createElement('CANVAS');\r\n  canvas.width = 100;\r\n  canvas.height = 100;\r\n  var ctx = canvas.getContext('2d');\r\n  var grd = ctx.createRadialGradient(50,50, 0, 50,50, 50);\r\n  grd.addColorStop(0, 'rgba(128,128,192,.8');\r\n  grd.addColorStop(1, 'rgba(128,128,192,0');\r\n  this.image = canvas;\r\n  ctx.fillStyle = grd;\r\n  ctx.fillRect(0,0,canvas.width,canvas.height);\r\n};\r\nol.ext.inherits(ol.particule.RainDrop, ol.particule.Base);\r\n/** Draw the particule\r\n * @param {CanvasRenderingContext2D } ctx\r\n */\r\nol.particule.RainDrop.prototype.draw = function(ctx) {\r\n  if (this.size>0) {\r\n    ctx.save();\r\n      ctx.translate (this.coordinate[0], this.coordinate[1]);\r\n      ctx.globalAlpha = this.size/50;\r\n      ctx.scale(1-this.size/50,1-this.size/50);\r\n      ctx.drawImage(this.image, -50,-50);\r\n    ctx.restore();\r\n  }\r\n};\r\n/** Update the particule\r\n * @param {number} dt timelapes since last call\r\n */\r\nol.particule.RainDrop.prototype.update = function(dt) {\r\n  if (this.size>0 || Math.random() < .01) {\r\n    if (this.size<=0) {\r\n      this.size = 50;\r\n      this.coordinates = this.getRandomCoord();\r\n    }\r\n    this.size = this.size - Math.round(dt/20);\r\n  }\r\n};\r\n\r\n/*\r\n  Copyright (c) 2020 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Rain particules to display clouds over the map\r\n * @constructor\r\n * @extends {ol.particule.Base}\r\n * @param {*} options\r\n *  @param {ol.Overlay} options.overlay\r\n *  @param {ol.pixel} coordinate the position of the particule\r\n */\r\nol.particule.Snow = function(options) {\r\n  if (!options) options = {};\r\n  ol.particule.Base.call(this, options);\r\n  this.z = (Math.floor(Math.random()*5) + 1) / 5;\r\n  this.angle = Math.random() * Math.PI;\r\n  // Snow fakes\r\n  var canvas = document.createElement('CANVAS');\r\n  canvas.width = 20;\r\n  canvas.height = 20;\r\n  var ctx = canvas.getContext('2d');\r\n  var grd = ctx.createRadialGradient(10,10, 0, 10,10, 10);\r\n  grd.addColorStop(0, \"rgba(255, 255, 255,1)\");  // white\r\n  grd.addColorStop(.8, \"rgba(210, 236, 242,.8)\");  // bluish\r\n  grd.addColorStop(1, \"rgba(237, 247, 249,0)\");   // lighter bluish\r\n  this.image = canvas;\r\n  ctx.fillStyle = grd;\r\n  ctx.fillRect(0,0,canvas.width,canvas.height);\r\n};\r\nol.ext.inherits(ol.particule.Snow, ol.particule.Base);\r\n/** Draw the particule\r\n * @param {CanvasRenderingContext2D } ctx\r\n */\r\nol.particule.Snow.prototype.draw = function(ctx) {\r\n  ctx.save();\r\n    ctx.translate (this.coordinate[0], this.coordinate[1]);\r\n    ctx.globalAlpha = .4 + this.z/2;\r\n    ctx.scale(this.z,this.z);\r\n    ctx.drawImage(this.image, -10,-10);\r\n  ctx.restore();\r\n};\r\n/** Update the particule\r\n * @param {number} dt timelapes since last call\r\n */\r\nol.particule.Snow.prototype.update = function(dt) {\r\n  var speed = this.getOverlay().get('speed') * dt / this.getOverlay()._fps * this.z * 5;\r\n  var angle = this.getOverlay().get('angle');\r\n  this.angle = this.angle + dt / this.getOverlay()._fps / 100;\r\n  this.coordinate[0] += Math.sin(this.angle + this.z) * 2 + speed * Math.cos(angle);\r\n  this.coordinate[1] += Math.cos(this.angle) + speed * Math.sin(angle);\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc\r\n * A popup element to be displayed over the map and attached to a single map\r\n * location. The popup are customized using CSS.\r\n *\r\n * @example\r\nvar popup = new ol.Overlay.Popup();\r\nmap.addOverlay(popup);\r\npopup.show(coordinate, \"Hello!\");\r\npopup.hide();\r\n*\r\n* @constructor\r\n* @extends {ol.Overlay}\r\n* @fires show\r\n* @fires hide\r\n* @param {} options Extend Overlay options \r\n*\t @param {String} [options.popupClass] the a class of the overlay to style the popup.\r\n*\t @param {boolean} [options.anim Animate=false] the popup the popup, default false.\r\n*\t @param {bool} [options.closeBox=false] popup has a close box, default false.\r\n*\t @param {function|undefined} [options.onclose] callback function when popup is closed\r\n*\t @param {function|undefined} [options.onshow] callback function when popup is shown\r\n*\t @param {Number|Array<number>} [options.offsetBox] an offset box\r\n*\t @param {ol.OverlayPositioning | string | undefined} options.positioning \r\n*\t\tthe 'auto' positioning var the popup choose its positioning to stay on the map.\r\n*\t @param {boolean} [options.minibar=false] add a mini vertical bar\r\n* @api stable\r\n*/\r\nol.Overlay.Popup = function (options) {\r\n  options = options || {};\r\n  if (typeof(options.offsetBox)==='number') this.offsetBox = [options.offsetBox,options.offsetBox,options.offsetBox,options.offsetBox];\r\n  else this.offsetBox = options.offsetBox;\r\n  // Popup div\r\n  var element = document.createElement(\"div\");\r\n  //element.classList.add('ol-overlaycontainer-stopevent');\r\n  options.element = element;\r\n  // Closebox\r\n  this.closeBox = options.closeBox;\r\n  this.onclose = options.onclose;\r\n  this.onshow = options.onshow;\r\n  ol.ext.element.create('BUTTON', {\r\n    className: 'closeBox' + (options.closeBox ? ' hasclosebox':''),\r\n    type: 'button',\r\n    click: function() {\r\n      this.hide();\r\n    }.bind(this),\r\n    parent: element\r\n  });\r\n  // Anchor div\r\n  if (options.anchor!==false) {\r\n    ol.ext.element.create('DIV', {\r\n      className: 'anchor',\r\n      parent: element\r\n    })\r\n  }\r\n  // Content\r\n  this.content = ol.ext.element.create('DIV', { \r\n    html: options.html || '',\r\n    className: \"ol-popup-content\",\r\n    parent: element\r\n  });\r\n  if (options.minibar) {\r\n    ol.ext.element.scrollDiv(this.content, {\r\n      vertical: true,\r\n      mousewheel: true,\r\n      minibar: true\r\n    });\r\n  }\r\n  // Stop event\r\n  if (options.stopEvent) {\r\n    element.addEventListener(\"mousedown\", function(e){ e.stopPropagation(); });\r\n    element.addEventListener(\"touchstart\", function(e){ e.stopPropagation(); });\r\n  }\r\n  ol.Overlay.call(this, options);\r\n  this._elt = element;\r\n  // call setPositioning first in constructor so getClassPositioning is called only once\r\n  this.setPositioning(options.positioning || 'auto');\r\n  this.setPopupClass(options.popupClass || options.className || 'default');\r\n  if (options.anim) this.addPopupClass('anim');\r\n  // Show popup on timeout (for animation purposes)\r\n  if (options.position) {\r\n    setTimeout(function(){ this.show(options.position); }.bind(this));\r\n  }\r\n};\r\nol.ext.inherits(ol.Overlay.Popup, ol.Overlay);\r\n/**\r\n * Get CSS class of the popup according to its positioning.\r\n * @private\r\n */\r\nol.Overlay.Popup.prototype.getClassPositioning = function () {\r\n  var c = \"\";\r\n  var pos = this.getPositioning();\r\n  if (/bottom/.test(pos)) c += \"ol-popup-bottom \";\r\n  if (/top/.test(pos)) c += \"ol-popup-top \";\r\n  if (/left/.test(pos)) c += \"ol-popup-left \";\r\n  if (/right/.test(pos)) c += \"ol-popup-right \";\r\n  if (/^center/.test(pos)) c += \"ol-popup-middle \";\r\n  if (/center$/.test(pos)) c += \"ol-popup-center \";\r\n  return c;\r\n};\r\n/**\r\n * Set a close box to the popup.\r\n * @param {bool} b\r\n * @api stable\r\n */\r\nol.Overlay.Popup.prototype.setClosebox = function (b) {\r\n  this.closeBox = b;\r\n  if (b) this.element.classList.add(\"hasclosebox\");\r\n  else this.element.classList.remove(\"hasclosebox\");\r\n};\r\n/**\r\n * Set the CSS class of the popup.\r\n * @param {string} c class name.\r\n * @api stable\r\n */\r\nol.Overlay.Popup.prototype.setPopupClass = function (c) {\r\n  var classes = [\"ol-popup\"];\r\n  if (this.getVisible()) classes.push('visible');\r\n  this.element.className = \"\";\r\n  var classesPositioning = this.getClassPositioning().split(' ')\r\n    .filter(function(className) {\r\n      return className.length > 0;\r\n    });\r\n  if (c) {\r\n    c.split(' ').filter(function(className) {\r\n      return className.length > 0;\r\n    })\r\n    .forEach(function(className) {\r\n      classes.push(className);\r\n    });\r\n  } else {\r\n    classes.push(\"default\");\r\n  }\r\n  classesPositioning.forEach(function(className) {\r\n    classes.push(className);\r\n  });\r\n  if (this.closeBox) {\r\n    classes.push(\"hasclosebox\");\r\n  }\r\n  this.element.classList.add.apply(this.element.classList, classes);\r\n};\r\n/**\r\n * Add a CSS class to the popup.\r\n * @param {string} c class name.\r\n * @api stable\r\n */\r\nol.Overlay.Popup.prototype.addPopupClass = function (c) {\r\n  this.element.classList.add(c);\r\n};\r\n/**\r\n * Remove a CSS class to the popup.\r\n * @param {string} c class name.\r\n * @api stable\r\n */\r\nol.Overlay.Popup.prototype.removePopupClass = function (c) {\r\n  this.element.classList.remove(c);\r\n};\r\n/**\r\n * Set positionning of the popup\r\n * @param {ol.OverlayPositioning | string | undefined} pos an ol.OverlayPositioning \r\n * \t\tor 'auto' to var the popup choose the best position\r\n * @api stable\r\n */\r\nol.Overlay.Popup.prototype.setPositioning = function (pos) {\r\n  if (pos === undefined)\r\n    return;\r\n  if (/auto/.test(pos)) {\r\n    this.autoPositioning = pos.split('-');\r\n    if (this.autoPositioning.length==1) this.autoPositioning[1]=\"auto\";\r\n  } else {\r\n    this.autoPositioning = false;\r\n  }\r\n  pos = pos.replace(/auto/g,\"center\");\r\n  if (pos==\"center\") pos = \"bottom-center\";\r\n  this.setPositioning_(pos);\r\n};\r\n/** @private\r\n * @param {ol.OverlayPositioning | string | undefined} pos\r\n */\r\nol.Overlay.Popup.prototype.setPositioning_ = function (pos) {\r\n  if (this.element) {\r\n    ol.Overlay.prototype.setPositioning.call(this, pos);\r\n    this.element.classList.remove(\"ol-popup-top\", \"ol-popup-bottom\", \"ol-popup-left\", \"ol-popup-right\", \"ol-popup-center\", \"ol-popup-middle\");\r\n    var classes = this.getClassPositioning().split(' ')\r\n      .filter(function(className) {\r\n        return className.length > 0;\r\n      });\r\n    this.element.classList.add.apply(this.element.classList, classes);\r\n  }\r\n};\r\n/** Check if popup is visible\r\n* @return {boolean}\r\n*/\r\nol.Overlay.Popup.prototype.getVisible = function () {\r\n  return this.element.classList.contains(\"visible\");\r\n};\r\n/**\r\n * Set the position and the content of the popup.\r\n * @param {ol.Coordinate|string} coordinate the coordinate of the popup or the HTML content.\r\n * @param {string|undefined} html the HTML content (undefined = previous content).\r\n * @example\r\nvar popup = new ol.Overlay.Popup();\r\n// Show popup\r\npopup.show([166000, 5992000], \"Hello world!\");\r\n// Move popup at coord with the same info\r\npopup.show([167000, 5990000]);\r\n// set new info\r\npopup.show(\"New informations\");\r\n* @api stable\r\n*/\r\nol.Overlay.Popup.prototype.show = function (coordinate, html) {\r\n  if (!html && typeof(coordinate)=='string') {\r\n    html = coordinate; \r\n    coordinate = null;\r\n  }\r\n  if (coordinate===true) {\r\n    coordinate = this.getPosition();\r\n  }\r\n  var self = this;\r\n  var map = this.getMap();\r\n  if (!map) return;\r\n  if (html && html !== this.prevHTML) {\r\n    // Prevent flickering effect\r\n    this.prevHTML = html;\r\n    this.content.innerHTML = '';\r\n    if (html instanceof Element) {\r\n      this.content.appendChild(html);\r\n    } else {\r\n      ol.ext.element.create('DIV', {\r\n        html: html,\r\n        parent: this.content\r\n      })\r\n    }\r\n    // Refresh when loaded (img)\r\n    Array.prototype.slice.call(this.content.querySelectorAll('img'))\r\n      .forEach(function(image) {\r\n        image.addEventListener('load', function() {\r\n          try { map.renderSync(); } catch(e) { /* ok */ }\r\n          self.content.dispatchEvent(new Event('scroll'));\r\n        });\r\n      });\r\n  }\r\n  if (coordinate) {\r\n    // Auto positionning\r\n    if (this.autoPositioning) {\r\n      var p = map.getPixelFromCoordinate(coordinate);\r\n      var s = map.getSize();\r\n      var pos=[];\r\n      if (this.autoPositioning[0]=='auto') {\r\n        pos[0] = (p[1]<s[1]/3) ? \"top\" : \"bottom\";\r\n      }\r\n      else pos[0] = this.autoPositioning[0];\r\n      pos[1] = (p[0]<2*s[0]/3) ? \"left\" : \"right\";\r\n      this.setPositioning_(pos[0]+\"-\"+pos[1]);\r\n      if (this.offsetBox) {\r\n        this.setOffset([this.offsetBox[pos[1]==\"left\"?2:0], this.offsetBox[pos[0]==\"top\"?3:1] ]);\r\n      }\r\n    } else {\r\n      if (this.offsetBox){\r\n        this.setOffset(this.offsetBox);\r\n      }\r\n    }\r\n    // Show\r\n    this.setPosition(coordinate);\r\n    // Set visible class (wait to compute the size/position first)\r\n    this.element.parentElement.style.display = '';\r\n    if (typeof (this.onshow) == 'function') this.onshow();\r\n    this.dispatchEvent({ type: 'show' })\r\n    this._tout = setTimeout (function() {\r\n      self.element.classList.add('visible'); \r\n    }, 0);\r\n  }\r\n};\r\n/**\r\n * Hide the popup\r\n * @api stable\r\n */\r\nol.Overlay.Popup.prototype.hide = function () {\r\n  if (this.getPosition() == undefined) return;\r\n  if (typeof (this.onclose) == 'function') this.onclose();\r\n  this.setPosition(undefined);\r\n  if (this._tout) clearTimeout(this._tout);\r\n  this.element.classList.remove(\"visible\");\r\n  this.dispatchEvent({ type: 'hide' });\r\n};\r\n\r\n/*\tCopyright (c) 2020 Jean-Marc VIGLINO,\r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** An overlay to play animations on top of the map\r\n * The overlay define a set of particules animated on top of the map.\r\n * Particules are objects with coordinates.\r\n * They are dawn in a canvas using the draw particule method. \r\n * The update particule method updates the particule position according to the timelapse\r\n *\r\n * @constructor\r\n * @extends {ol.Overlay}\r\n * @param {*} options\r\n *  @param {String} options.className class of the Overlay\r\n *  @param {number} option.density particule density, default .5\r\n *  @param {number} option.speed particule speed, default 4\r\n *  @param {number} option.angle particule angle in radian, default PI/4\r\n *  @param {boolean} options.animate start animation, default true\r\n *  @param {number} options.fps frame per second, default 25\r\n */\r\nol.Overlay.AnimatedCanvas = function(options) {\r\n  if (!options) options = {};\r\n  this._canvas = ol.ext.element.create('CANVAS', {\r\n    className: ((options.className || '') + ' ol-animated-overlay').trim()\r\n  });\r\n  this._ctx = this._canvas.getContext('2d');\r\n  ol.Overlay.call(this, {\r\n    element: this._canvas,\r\n    stopEvent: false\r\n  });\r\n  this._listener = [];\r\n  this._time = 0;\r\n  this._particuleClass = options.particule || ol.particule.Base;\r\n  if (options.createParticule) this._createParticule = options.createParticule;\r\n  // 25fps\r\n  this._fps = 1000 / (options.fps || 25);\r\n  // Default particules properties\r\n  var p = this._createParticule();\r\n  this._psize = p.get('size') || [50,50];\r\n  this.set('density', options.density || .5);\r\n  this.set('speed', options.speed || 4);\r\n  this.set('angle', typeof(options.angle) === 'number' ? options.angle : Math.PI / 4);\r\n  if (options.animate !== false) this.setAnimation(true);\r\n  // Prevent animation when window on background\r\n  document.addEventListener(\"visibilitychange\", function() {\r\n    this._pause = true;\r\n  }.bind(this));\r\n};\r\nol.ext.inherits(ol.Overlay.AnimatedCanvas, ol.Overlay);\r\n/** Set the visibility\r\n * @param {boolean} b\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.setVisible = function (b) {\r\n  this.element.style.display = b ? 'block' : 'none';\r\n  if (b) this.setAnimation(this.get('animation'));\r\n}\r\n/** Get the visibility\r\n * @return {boolean} b\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.getVisible = function () {\r\n  return this.element.style.display != 'none';\r\n}\r\n/** No update for this overlay\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.updatePixelPosition = function () {};\r\n/**\r\n * Set the map instance the overlay is associated with\r\n * @param {ol.Map} map The map instance.\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.setMap = function (map) {\r\n  if (this.getMap()) {\r\n    this.getMap().getViewport().querySelector('.ol-overlaycontainer').removeChild(this._canvas);\r\n  }\r\n  this._listener.forEach(function(l) {\r\n    ol.Observable.unByKey(l);\r\n  });\r\n  this._listener = [];\r\n  ol.Overlay.prototype.setMap.call(this, map);\r\n  if (map) {\r\n    var size = map.getSize();\r\n    this._canvas.width = size[0];\r\n    this._canvas.height = size[1];\r\n    this.draw();\r\n    this._listener.push (map.on('change:size', function()  {\r\n      var size = map.getSize();\r\n      if (this._canvas.width !== size[0] || this._canvas.height !== size[1]) {\r\n        this._canvas.width = size[0];\r\n        this._canvas.height = size[1];\r\n        this.draw();\r\n      }\r\n    }.bind(this)));\r\n  }\r\n};\r\n/** Create particules or return exiting ones\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.getParticules = function() {\r\n  var w = this._psize[0];\r\n  var h = this._psize[1];\r\n  var d = (this.get('density') * this._canvas.width * this._canvas.height / w / h) << 0;\r\n  if (!this._particules) this._particules = [];\r\n  if (d > this._particules.length) {\r\n    for (var i=this._particules.length; i<d; i++) {\r\n      this._particules.push(this._createParticule(this, this.randomCoord()));\r\n    } \r\n  } else {\r\n    this._particules.length = d;\r\n  }\r\n  return this._particules;\r\n};\r\n/** Create a particule\r\n * @private\r\n */\r\nol.Overlay.AnimatedCanvas.prototype._createParticule = function(overlay, coordinate) {\r\n  return new this._particuleClass({\r\n    overlay: overlay, \r\n    coordinate: coordinate\r\n  });\r\n};\r\n/** Get random coordinates on canvas\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.randomCoord = function() {\r\n  return [ \r\n    Math.random()*(this._canvas.width + this._psize[0]) - this._psize[0]/2 , \r\n    Math.random()*(this._canvas.height + this._psize[1]) - this._psize[1]/2 \r\n  ];\r\n};\r\n/** Draw canvas overlay (draw each particules)\r\n * @param {number} dt timelapes since last call\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.draw = function(dt) {\r\n  var ctx = this._ctx;\r\n  this.clear();\r\n  ctx.beginPath();\r\n  this.getParticules().forEach(function(p) {\r\n    if (dt) {\r\n      p.update(dt);\r\n      this.testExit(p);\r\n    }\r\n    p.draw(this._ctx);\r\n  }.bind(this));\r\n};\r\n/** Test if particule exit the canvas and add it on other side\r\n * @param {*} p the point to test\r\n * @param {ol.size} size size of the overlap\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.testExit = function(p) {\r\n  var size = this._psize;\r\n  if (p.coordinate[0] < -size[0]) {\r\n    p.coordinate[0] = this._canvas.width + size[0];\r\n    p.coordinate[1] = Math.random() * (this._canvas.height+size[1]) - size[1]/2;\r\n  } else if (p.coordinate[0] > this._canvas.width +size[0]) {\r\n    p.coordinate[0] = -size[0];\r\n    p.coordinate[1] = Math.random() * (this._canvas.height+size[1]) - size[1]/2;\r\n  } else if (p.coordinate[1] < -size[1]) {\r\n    p.coordinate[0] = Math.random() * (this._canvas.width+size[0]) - size[0]/2;\r\n    p.coordinate[1] = this._canvas.height + size[1];\r\n  } else if (p.coordinate[1] > this._canvas.height +size[1]) {\r\n    p.coordinate[0] = Math.random() * (this._canvas.width+size[0]) - size[0]/2;\r\n    p.coordinate[1] = -size[1];\r\n  }\r\n};\r\n/** Clear canvas\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.clear = function() {\r\n  this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);\r\n};\r\n/** Get overlay canvas\r\n * @return {CanvasElement}\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.getCanvas = function() {\r\n  return this._canvas;\r\n};\r\n/** Set canvas animation\r\n * @param {boolean} anim, default true\r\n * @api\r\n */\r\nol.Overlay.AnimatedCanvas.prototype.setAnimation = function(anim) {\r\n  anim = (anim!==false);\r\n  this.set('animation', anim);\r\n  if (anim) {\r\n    this._pause = true;\r\n    requestAnimationFrame(this._animate.bind(this));\r\n  } else {\r\n    this.dispatchEvent({ type:'animation:stop', time: this._time });\r\n  }\r\n};\r\n/**\r\n * @private\r\n */\r\nol.Overlay.AnimatedCanvas.prototype._animate = function(time) {\r\n  if (this.getVisible() && this.get('animation')) {\r\n    if (this._pause) {\r\n      // reset time\r\n      requestAnimationFrame(function(time){\r\n        this._time = time;\r\n        requestAnimationFrame(this._animate.bind(this));\r\n      }.bind(this));  \r\n    } else {\r\n      // Test fps\r\n      if (time - this._time > this._fps) {\r\n        this.draw(time - this._time);\r\n        this._time = time;\r\n      }\r\n      requestAnimationFrame(this._animate.bind(this));\r\n    }\r\n  }\r\n  this._pause = false;\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc\r\n * An overlay fixed on the map. \r\n * Use setPosition(coord, true) to force the overlay position otherwise the position will be ignored.\r\n *\r\n * @example\r\nvar popup = new ol.Overlay.Fixed();\r\nmap.addOverlay(popup);\r\npopup.setposition(position, true);\r\n*\r\n* @constructor\r\n* @extends {ol.Overlay}\r\n* @param {} options Extend Overlay options \r\n* @api stable\r\n*/\r\nol.Overlay.Fixed = function (options) {\r\n  ol.Overlay.call(this, options);\r\n};\r\nol.ext.inherits(ol.Overlay.Fixed, ol.Overlay);\r\n/** Prevent modifying position and use a force argument to force positionning.\r\n * @param {ol.coordinate} position\r\n * @param {boolean} force true to change the position, default false\r\n */\r\nol.Overlay.Fixed.prototype.setPosition = function(position, force) {\r\n  if (this.getMap() && position) {\r\n    this._pixel = this.getMap().getPixelFromCoordinate(position);\r\n  }\r\n  ol.Overlay.prototype.setPosition.call(this, position)\r\n  if (force) {\r\n    ol.Overlay.prototype.updatePixelPosition.call(this);\r\n  } \r\n};\r\n/** Update position according the pixel position\r\n */\r\nol.Overlay.Fixed.prototype.updatePixelPosition = function() {\r\n  if (this.getMap() && this._pixel && this.getPosition()) {\r\n    var pixel = this.getMap().getPixelFromCoordinate(this.getPosition())\r\n    if (Math.round(pixel[0]*1000) !== Math.round(this._pixel[0]*1000) \r\n      || Math.round(pixel[0]*1000) !== Math.round(this._pixel[0]*1000) ) {\r\n      this.setPosition(this.getMap().getCoordinateFromPixel(this._pixel));\r\n    }\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * A popup element to be displayed over the map and attached to a single map\r\n * location. The popup are customized using CSS.\r\n *\r\n * @constructor\r\n * @extends {ol.Overlay.Popup}\r\n * @fires show\r\n * @fires hide\r\n * @param {} options Extend Overlay options \r\n *\t@param {String} options.popupClass the a class of the overlay to style the popup.\r\n *\t@param {ol.style.Style} options.style a style to style the link on the map.\r\n *\t@param {number} options.minScale min scale for the popup, default .5\r\n *\t@param {number} options.maxScale max scale for the popup, default 2\r\n *\t@param {bool} options.closeBox popup has a close box, default false.\r\n *\t@param {function|undefined} options.onclose: callback function when popup is closed\r\n *\t@param {function|undefined} options.onshow callback function when popup is shown\r\n *\t@param {Number|Array<number>} options.offsetBox an offset box\r\n *\t@param {ol.OverlayPositioning | string | undefined} options.positioning \r\n *\t\tthe 'auto' positioning var the popup choose its positioning to stay on the map.\r\n * @api stable\r\n */\r\nol.Overlay.FixedPopup = function (options) {\r\n  options.anchor = false;\r\n  options.positioning = options.positioning || 'center-center';\r\n  options.className = (options.className || '') + ' ol-fixPopup';\r\n  ol.Overlay.Popup.call(this, options);\r\n  this.set('minScale', options.minScale || .5);\r\n  this.set('maxScale', options.maxScale || 2);\r\n  var canvas = document.createElement('canvas');\r\n  this._overlay = new ol.layer.Image({\r\n    source: new ol.source.ImageCanvas({\r\n      canvasFunction: function(extent, res, ratio, size) {\r\n        canvas.width  = size[0];\r\n        canvas.height = size[1];\r\n        return canvas\r\n      }\r\n    })\r\n  });\r\n  this._style = options.style || new ol.style.Style({\r\n    fill: new ol.style.Fill({ color: [102,153,255] })\r\n  });\r\n  this._overlay.on(['postcompose','postrender'], function(e) {\r\n    if (this.getVisible() && this._pixel) {\r\n      var map = this.getMap();\r\n      var position = this.getPosition();\r\n      var pixel = map.getPixelFromCoordinate(position);\r\n      var r1 = this.element.getBoundingClientRect()\r\n      var r2 = this.getMap().getTargetElement().getBoundingClientRect();\r\n      var pixel2 = [r1.left-r2.left+r1.width/2, r1.top-r2.top+r1.height/2]\r\n      e.context.save();\r\n        var tr = e.inversePixelTransform;\r\n        if (tr) {\r\n          e.context.transform(tr[0],tr[1],tr[2],tr[3],tr[4],tr[5]);\r\n        } else {\r\n          // ol ~ v5.3.0\r\n          e.context.scale(e.frameState.pixelRatio,e.frameState.pixelRatio)\r\n        }\r\n        e.context.beginPath();\r\n        e.context.moveTo(pixel[0], pixel[1]);\r\n        if (Math.abs(pixel2[0]-pixel[0]) > Math.abs(pixel2[1]-pixel[1])) {\r\n          e.context.lineTo(pixel2[0],pixel2[1]-8);\r\n          e.context.lineTo(pixel2[0],pixel2[1]+8);\r\n        } else {\r\n          e.context.lineTo(pixel2[0]-8,pixel2[1]);\r\n          e.context.lineTo(pixel2[0]+8,pixel2[1]);\r\n        }\r\n        e.context.moveTo(pixel[0], pixel[1]);\r\n        if (this._style.getFill()) {\r\n          e.context.fillStyle = ol.color.asString(this._style.getFill().getColor());\r\n          e.context.fill();\r\n        }\r\n        if (this._style.getStroke()) {\r\n          e.context.strokeStyle = ol.color.asString(this._style.getStroke().getColor());\r\n          e.context.lineWidth = this._style.getStroke().width();\r\n          e.context.stroke();\r\n        }\r\n      e.context.restore();\r\n    }\r\n  }.bind(this));\r\n  var update = function() { \r\n    this.setPixelPosition();\r\n  }.bind(this);\r\n  this.on(['hide', 'show'], function() {\r\n    setTimeout(update)\r\n  }.bind(this))\r\n  // Get events centroid\r\n  function centroid(pevents) {\r\n    var clientX = 0;\r\n    var clientY = 0;\r\n    var length = 0;\r\n    for (var i in pevents) {\r\n      clientX += pevents[i].clientX;\r\n      clientY += pevents[i].clientY;\r\n      length++;\r\n    }\r\n    return [clientX / length, clientY / length];\r\n  }\r\n  // Get events angle\r\n  function angle() {\r\n    var p1,p2, v = Object.keys(pointerEvents);\r\n    if (v.length<2) return false;\r\n    p1 = pointerEvents[v[0]];\r\n    p2 = pointerEvents[v[1]];\r\n    var v1 = [p2.clientX - p1.clientX, p2.clientY - p1.clientY];\r\n    p1 = pointerEvents2[v[0]];\r\n    p2 = pointerEvents2[v[1]];\r\n    var v2 = [p2.clientX - p1.clientX, p2.clientY - p1.clientY];\r\n    var d1 = Math.sqrt(v1[0]*v1[0]+v1[1]*v1[1]);\r\n    var d2 = Math.sqrt(v2[0]*v2[0]+v2[1]*v2[1]);\r\n    var a = Math.acos((v1[0]*v2[0]+v1[1]*v2[1]) / (d1*d2)) * 360 / Math.PI;\r\n    if (v1[0]*v2[1]-v1[1]*v2[0] < 0) return -a;\r\n    else return a;\r\n  }\r\n  // Get distance beetween events\r\n  function distance(pevents) {\r\n    var v = Object.keys(pevents);\r\n    if (v.length<2) return false;\r\n    return ol.coordinate.dist2d([pevents[v[0]].clientX, pevents[v[0]].clientY], [pevents[v[1]].clientX, pevents[v[1]].clientY]);\r\n  }\r\n  // Handle popup move\r\n  var pointerEvents = {};\r\n  var pointerEvents2 = {};\r\n  var pixelPosition = [];\r\n  var distIni, rotIni, scaleIni, move;\r\n  // down\r\n  this.element.addEventListener('pointerdown', function(e) {\r\n    e.preventDefault();\r\n    e.stopPropagation();\r\n    // Reset events to this position\r\n    for (var i in pointerEvents) {\r\n      if (pointerEvents2[i]) {\r\n        pointerEvents[i] = pointerEvents2[i];\r\n      }\r\n    }\r\n    pointerEvents[e.pointerId] = e;\r\n    pixelPosition = this._pixel;\r\n    rotIni = this.get('rotation') || 0;\r\n    scaleIni = this.get('scale') || 1;\r\n    distIni = distance(pointerEvents);\r\n    move = false;\r\n  }.bind(this));\r\n  // Prevent click when move\r\n  this.element.addEventListener('click', function(e) {\r\n    if (move) {\r\n      e.preventDefault();\r\n      e.stopPropagation();\r\n    }\r\n  }, true);\r\n  // up / cancel\r\n  var removePointer = function(e) {\r\n    if (pointerEvents[e.pointerId]) {\r\n      delete pointerEvents[e.pointerId];\r\n      e.preventDefault();\r\n    }\r\n    if (pointerEvents2[e.pointerId]) {\r\n      delete pointerEvents2[e.pointerId];\r\n    }\r\n    /* Simulate a second touch pointer * /\r\n    if (e.metaKey || e.ctrlKey) {\r\n      pointerEvents['touch'] = e;\r\n      pointerEvents2['touch'] = e;\r\n    } else {\r\n      delete pointerEvents['touch'];\r\n      delete pointerEvents2['touch'];\r\n    }\r\n    /**/\r\n  }.bind(this);\r\n  document.addEventListener('pointerup', removePointer);\r\n  document.addEventListener('pointercancel', removePointer);\r\n  // move\r\n  document.addEventListener('pointermove', function(e) {\r\n    if (pointerEvents[e.pointerId]) {\r\n      e.preventDefault();\r\n      pointerEvents2[e.pointerId] = e;\r\n      var c1 = centroid(pointerEvents);\r\n      var c2 = centroid(pointerEvents2);\r\n      var dx = c2[0] - c1[0];\r\n      var dy = c2[1] - c1[1];\r\n      move = move || Math.abs(dx) > 3 || Math.abs(dy) > 3;\r\n      var a = angle();\r\n      if (a) {\r\n        this.setRotation(rotIni + a*1.5, false);\r\n      }\r\n      var d = distance(pointerEvents2);\r\n      if (d!==false && distIni) {\r\n        this.setScale(scaleIni * d / distIni, false);\r\n        distIni = scaleIni * d / this.get('scale');\r\n      }\r\n      this.setPixelPosition([pixelPosition[0]+dx, pixelPosition[1]+dy]);\r\n    }\r\n  }.bind(this));\r\n};\r\nol.ext.inherits(ol.Overlay.FixedPopup, ol.Overlay.Popup);\r\n/**\r\n * Set the map instance the control is associated with\r\n * and add its controls associated to this map.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.Overlay.FixedPopup.prototype.setMap = function (map) {\r\n  ol.Overlay.Popup.prototype.setMap.call(this, map);\r\n  this._overlay.setMap(this.getMap());\r\n  if (this._listener) {\r\n    ol.Observable.unByKey(this._listener);\r\n  }\r\n  if (map) {\r\n    // Force popup inside the viewport\r\n    this._listener = map.on('change:size', function() {\r\n      this.setPixelPosition();\r\n    }.bind(this))\r\n  }\r\n};\r\n/** Update pixel position\r\n * @return {boolean}\r\n * @private\r\n */\r\nol.Overlay.FixedPopup.prototype.updatePixelPosition = function () {\r\n  var map = this.getMap();\r\n  var position = this.getPosition();\r\n  if (!map || !map.isRendered() || !position) {\r\n    this.setVisible(false);\r\n    return;\r\n  }\r\n  if (!this._pixel) {\r\n    this._pixel = map.getPixelFromCoordinate(position);\r\n    var mapSize = map.getSize();\r\n    this.updateRenderedPosition(this._pixel, mapSize);\r\n  } else {\r\n    this.setVisible(true);\r\n  }\r\n};\r\n/** updateRenderedPosition\r\n * @private\r\n */\r\nol.Overlay.FixedPopup.prototype.updateRenderedPosition = function (pixel, mapsize) {\r\n  ol.Overlay.Popup.prototype.updateRenderedPosition.call(this, pixel, mapsize);\r\n  this.setRotation();\r\n  this.setScale()\r\n};\r\n/** Set pixel position\r\n * @param {ol.pixel} pix\r\n * @param {string} position top/bottom/middle-left/right/center\r\n */\r\nol.Overlay.FixedPopup.prototype.setPixelPosition = function (pix, position) {\r\n  var r, map = this.getMap();\r\n  var mapSize = map ? map.getSize() : [0,0];\r\n  if (position) {\r\n    this.setPositioning(position);\r\n    r = ol.ext.element.offsetRect(this.element);\r\n    r.width = r.height = 0;\r\n    if (/top/.test(position)) pix[1] += r.height/2;\r\n    else if (/bottom/.test(position)) pix[1] = mapSize[1] - r.height/2 - pix[1];\r\n    else pix[1] = mapSize[1]/2 + pix[1];\r\n    if (/left/.test(position)) pix[0] += r.width/2;\r\n    else if (/right/.test(position)) pix[0] = mapSize[0] - r.width/2 - pix[0];\r\n    else pix[0] = mapSize[0]/2 + pix[0];\r\n  }\r\n  if (pix) this._pixel = pix;\r\n  if (map && this._pixel) {\r\n    this.updateRenderedPosition(this._pixel, mapSize);\r\n    // Prevent outside\r\n    var outside = false;\r\n    r = ol.ext.element.offsetRect(this.element);\r\n    var rmap = ol.ext.element.offsetRect(map.getTargetElement());\r\n    if (r.left < rmap.left) {\r\n      this._pixel[0] = this._pixel[0] + rmap.left - r.left;\r\n      outside = true;\r\n    } else if (r.left + r.width > rmap.left + rmap.width) {\r\n      this._pixel[0] = this._pixel[0] + rmap.left - r.left + rmap.width - r.width;\r\n      outside = true;\r\n    } \r\n    if (r.top < rmap.top) {\r\n      this._pixel[1] = this._pixel[1] + rmap.top - r.top;\r\n      outside = true;\r\n    } else if (r.top + r.height > rmap.top + rmap.height) {\r\n      this._pixel[1] = this._pixel[1] + rmap.top - r.top + rmap.height - r.height;\r\n      outside = true;\r\n    }\r\n    if (outside) this.updateRenderedPosition(this._pixel, mapSize);\r\n    this._overlay.changed();\r\n  }\r\n};\r\n/** Set pixel position\r\n * @returns {ol.pixel}\r\n */\r\nol.Overlay.FixedPopup.prototype.getPixelPosition = function () {\r\n  return this._pixel;\r\n};\r\n/**\r\n * Set the CSS class of the popup.\r\n * @param {string} c class name.\r\n * @api stable\r\n */\r\nol.Overlay.FixedPopup.prototype.setPopupClass = function (c) {\r\n  ol.Overlay.Popup.prototype.setPopupClass.call(this, c);\r\n  this.addPopupClass('ol-fixPopup');\r\n};\r\n/** Set poppup rotation\r\n * @param {number} angle\r\n * @param {booelan} update update popup, default true\r\n * @api\r\n */\r\nol.Overlay.FixedPopup.prototype.setRotation = function (angle, update) {\r\n  if (typeof(angle) === 'number') this.set('rotation', angle);\r\n  if (update!==false) {\r\n    if (/rotate/.test(this.element.style.transform)) {\r\n      this.element.style.transform = this.element.style.transform.replace(/rotate\\((-?[\\d,.]+)deg\\)/,'rotate('+(this.get('rotation')||0)+'deg)')\r\n    } else {\r\n      this.element.style.transform = this.element.style.transform + ' rotate('+(this.get('rotation')||0)+'deg)';\r\n    }\r\n  }\r\n};\r\n/** Set poppup scale\r\n * @param {number} scale\r\n * @param {booelan} update update popup, default true\r\n * @api\r\n */\r\nol.Overlay.FixedPopup.prototype.setScale = function (scale, update) {\r\n  if (typeof(scale) === 'number') this.set('scale', scale);\r\n  scale = Math.min(Math.max(this.get('minScale')||0, this.get('scale')||1 ), this.get('maxScale')||2);\r\n  this.set('scale', scale);\r\n  if (update!==false) {\r\n    if (/scale/.test(this.element.style.transform)) {\r\n      this.element.style.transform = this.element.style.transform.replace(/scale\\(([\\d,.]+)\\)/,'scale('+(scale)+')')\r\n    } else {\r\n      this.element.style.transform = this.element.style.transform + ' scale('+(scale)+')';\r\n    }\r\n  }\r\n};\r\n/** Set link style\r\n * @param {ol.style.Style} style\r\n */\r\nol.Overlay.FixedPopup.prototype.setLinkStyle = function (style) {\r\n  this._style = style;\r\n  this._overlay.changed();\r\n};\r\n/** Get link style\r\n * @return {ol.style.Style} style\r\n */\r\nol.Overlay.FixedPopup.prototype.getLinkStyle = function () {\r\n  return this._style;\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc\r\n *\tThe Magnify overlay add a \"magnifying glass\" effect to an OL3 map that displays \r\n*\ta portion of the map in a different zoom (and actually display different content).\r\n*\r\n* @constructor\r\n* @extends {ol.Overlay}\r\n* @param {olx.OverlayOptions} options Overlay options \r\n* @api stable\r\n*/\r\nol.Overlay.Magnify = function (options) {\r\n  var elt = document.createElement(\"div\");\r\n      elt.className = \"ol-magnify\";\r\n  this._elt = elt;\r\n  ol.Overlay.call(this, {\r\n    positioning: options.positioning || \"center-center\",\r\n    element: this._elt,\r\n    stopEvent: false\r\n  });\r\n  // Create magnify map\r\n  this.mgmap_ = new ol.Map({\r\n    controls: new ol.Collection(),\r\n    interactions: new ol.Collection(),\r\n    target: options.target || this._elt,\r\n    view: new ol.View({ projection: options.projection }),\r\n    layers: options.layers\r\n  });\r\n  this.mgview_ = this.mgmap_.getView();\r\n  this.external_ = options.target?true:false;\r\n  this.set(\"zoomOffset\", options.zoomOffset||1);\r\n  this.set(\"active\", true);\r\n  this.on(\"propertychange\", this.setView_.bind(this));\r\n};\r\nol.ext.inherits(ol.Overlay.Magnify, ol.Overlay);\r\n/**\r\n * Set the map instance the overlay is associated with.\r\n * @param {ol.Map} map The map instance.\r\n */\r\nol.Overlay.Magnify.prototype.setMap = function(map) {\r\n  if (this.getMap()) {\r\n    this.getMap().getViewport().removeEventListener(\"mousemove\", this.onMouseMove_);\r\n  }\r\n  if (this._listener) ol.Observable.unByKey(this._listener);\r\n  this._listener = null;\r\n  ol.Overlay.prototype.setMap.call(this, map);\r\n  map.getViewport().addEventListener(\"mousemove\", this.onMouseMove_.bind(this));\r\n  this._listener = map.getView().on('propertychange', this.setView_.bind(this));\r\n  this.setView_();\r\n};\r\n/** Get the magnifier map\r\n*\t@return {_ol_Map_}\r\n*/\r\nol.Overlay.Magnify.prototype.getMagMap = function() {\r\n  return this.mgmap_;\r\n};\r\n/** Magnify is active\r\n*\t@return {boolean}\r\n*/\r\nol.Overlay.Magnify.prototype.getActive = function() {\r\n  return this.get(\"active\");\r\n};\r\n/** Activate or deactivate\r\n*\t@param {boolean} active\r\n*/\r\nol.Overlay.Magnify.prototype.setActive = function(active) {\r\n  return this.set(\"active\", active);\r\n};\r\n/** Mouse move\r\n * @private\r\n */\r\nol.Overlay.Magnify.prototype.onMouseMove_ = function(e) {\r\n  var self = this;\r\n  if (!self.get(\"active\")) {\r\n    self.setPosition();\r\n  } else {\r\n    var px = self.getMap().getEventCoordinate(e);\r\n    if (!self.external_) self.setPosition(px);\r\n    self.mgview_.setCenter(px);\r\n    if (!self._elt.querySelector('canvas') || self._elt.querySelector('canvas').style.display ==\"none\") self.mgmap_.updateSize();\r\n  }\r\n};\r\n/** View has changed\r\n * @private\r\n */\r\nol.Overlay.Magnify.prototype.setView_ = function(e) {\r\n  if (!this.get(\"active\")) {\r\n    this.setPosition();\r\n    return;\r\n  }\r\n  if (!e) {\r\n    // refresh all\r\n    this.setView_({key:'rotation'});\r\n    this.setView_({key:'resolution'});\r\n    return;\r\n  }\r\n  // Set the view params\r\n  switch (e.key) {\r\n    case 'rotation':\r\n      this.mgview_.setRotation(this.getMap().getView().getRotation());\r\n      break;\r\n    case 'zoomOffset':\r\n    case 'resolution': {\r\n      var z = Math.max(0,this.getMap().getView().getZoom()+Number(this.get(\"zoomOffset\")));\r\n      this.mgview_.setZoom(z);\r\n      break;\r\n    }\r\n    default: break;\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2018 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc\r\n * A placemark element to be displayed over the map and attached to a single map\r\n * location. The placemarks are customized using CSS.\r\n *\r\n * @example\r\nvar popup = new ol.Overlay.Placemark();\r\nmap.addOverlay(popup);\r\npopup.show(coordinate);\r\npopup.hide();\r\n*\r\n* @constructor\r\n* @extends {ol.Overlay}\r\n* @param {} options Extend ol/Overlay/Popup options \r\n*\t@param {String} options.color placemark color\r\n*\t@param {String} options.backgroundColor placemark color\r\n*\t@param {String} options.contentColor placemark color\r\n*\t@param {Number} options.radius placemark radius in pixel\r\n*\t@param {String} options.popupClass the a class of the overlay to style the popup.\r\n*\t@param {function|undefined} options.onclose: callback function when popup is closed\r\n*\t@param {function|undefined} options.onshow callback function when popup is shown\r\n* @api stable\r\n*/\r\nol.Overlay.Placemark = function (options) {\r\n  options = options || {};\r\n  options.popupClass = (options.popupClass || '') + ' placemark anim'\r\n  options.positioning = 'bottom-center',\r\n  ol.Overlay.Popup.call(this, options);\r\n  this.setPositioning = function(){};\r\n  if (options.color) this.element.style.color = options.color;\r\n  if (options.backgroundColor ) this.element.style.backgroundColor  = options.backgroundColor ;\r\n  if (options.contentColor ) this.setContentColor(options.contentColor);\r\n  if (options.size) this.setRadius(options.size);\r\n};\r\nol.ext.inherits(ol.Overlay.Placemark, ol.Overlay.Popup);\r\n/**\r\n * Set the position and the content of the placemark (hide it before to enable animation).\r\n * @param {ol.Coordinate|string} coordinate the coordinate of the popup or the HTML content.\r\n * @param {string|undefined} html the HTML content (undefined = previous content).\r\n */\r\nol.Overlay.Placemark.prototype.show = function(coordinate, html) {\r\n  if (coordinate===true) {\r\n    coordinate = this.getPosition();\r\n  }\r\n  this.hide();\r\n  ol.Overlay.Popup.prototype.show.apply(this, [coordinate, html]);\r\n};\r\n/**\r\n * Set the placemark color.\r\n * @param {string} color\r\n */\r\nol.Overlay.Placemark.prototype.setColor = function(color) {\r\n  this.element.style.color = color;\r\n};\r\n/**\r\n * Set the placemark background color.\r\n * @param {string} color\r\n */\r\nol.Overlay.Placemark.prototype.setBackgroundColor = function(color) {\r\n  this._elt.style.backgroundColor = color;\r\n};\r\n/**\r\n * Set the placemark content color.\r\n * @param {string} color\r\n */\r\nol.Overlay.Placemark.prototype.setContentColor = function(color) {\r\n  var c = this.element.getElementsByClassName('ol-popup-content')[0];\r\n  if (c) c.style.color = color;\r\n};\r\n/**\r\n * Set the placemark class.\r\n * @param {string} name\r\n */\r\nol.Overlay.Placemark.prototype.setClassName = function(name) {\r\n  var oldclass = this.element.className;\r\n  this.element.className = 'ol-popup placemark ol-popup-bottom ol-popup-center ' \r\n    + (/visible/.test(oldclass) ? 'visible ' : '')\r\n    + (/anim/.test(oldclass) ? 'anim ' : '')\r\n    + name;\r\n};\r\n/**\r\n * Set the placemark radius.\r\n * @param {number} size size in pixel\r\n */\r\nol.Overlay.Placemark.prototype.setRadius = function(size) {\r\n  this.element.style.fontSize = size + 'px';\r\n};\r\n\r\n/*\tCopyright (c) 2018 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Template attributes for popup\r\n * @typedef {Object} TemplateAttributes\r\n * @property {string} title\r\n * @property {function} format a function that takes an attribute and a feature and returns the formated attribute\r\n * @property {string} before string to instert before the attribute (prefix)\r\n * @property {string} after string to instert after the attribute (sudfix)\r\n * @property {boolean|function} visible boolean or a function (feature, value) that decides the visibility of a attribute entry\r\n */\r\n/** Template \r\n * @typedef {Object} Template\r\n * @property {string|function} title title of the popup, attribute name or a function that takes a feature and returns the title\r\n * @property {Object.<TemplateAttributes>} attributes a list of template attributes \r\n */\r\n/**\r\n * A popup element to be displayed on a feature.\r\n *\r\n * @constructor\r\n * @extends {ol.Overlay.Popup}\r\n * @fires show\r\n * @fires hide\r\n * @fires select\r\n * @param {} options Extend Popup options \r\n *  @param {String} options.popupClass the a class of the overlay to style the popup.\r\n *  @param {bool} options.closeBox popup has a close box, default false.\r\n *  @param {function|undefined} options.onclose: callback function when popup is closed\r\n *  @param {function|undefined} options.onshow callback function when popup is shown\r\n *  @param {Number|Array<number>} options.offsetBox an offset box\r\n *  @param {ol.OverlayPositioning | string | undefined} options.positionning \r\n *    the 'auto' positioning var the popup choose its positioning to stay on the map.\r\n *  @param {Template|function} options.template A template with a list of properties to use in the popup or a function that takes a feature and returns a Template\r\n *  @param {ol.interaction.Select} options.select a select interaction to get features from\r\n *  @param {boolean} options.keepSelection keep original selection, otherwise set selection to the current popup feature and add a counter to change current feature, default false\r\n *  @param {boolean} options.canFix Enable popup to be fixed, default false\r\n *  @param {boolean} options.showImage display image url as image, default false\r\n *  @param {boolean} options.maxChar max char to display in a cell, default 200\r\n *  @api stable\r\n */\r\nol.Overlay.PopupFeature = function (options) {\r\n  options = options || {};\r\n  ol.Overlay.Popup.call(this, options);\r\n  this.setTemplate(options.template);\r\n  this.set('canFix', options.canFix)\r\n  this.set('showImage', options.showImage)\r\n  this.set('maxChar', options.maxChar||200)\r\n  this.set('keepSelection', options.keepSelection)\r\n  // Bind with a select interaction\r\n  if (options.select && (typeof options.select.on ==='function')) {\r\n    this._select = options.select;\r\n    options.select.on('select', function(e){\r\n      if (!this._noselect) {\r\n        if (e.selected[0]) {\r\n          this.show(e.mapBrowserEvent.coordinate, options.select.getFeatures().getArray(), e.selected[0]);\r\n        } else {\r\n          this.hide();\r\n        }\r\n      }\r\n    }.bind(this));\r\n  }\r\n};\r\nol.ext.inherits(ol.Overlay.PopupFeature, ol.Overlay.Popup);\r\n/** Set the template\r\n * @param {Template} template A template with a list of properties to use in the popup\r\n */\r\nol.Overlay.PopupFeature.prototype.setTemplate = function(template) {\r\n  this._template = template;\r\n  this._attributeObject(this._template);\r\n}\r\n/**\r\n * @private\r\n */\r\n ol.Overlay.PopupFeature.prototype._attributeObject = function (temp) {\r\n  if (temp && temp.attributes instanceof Array) {\r\n    var att = {};\r\n    temp.attributes.forEach(function (a) {\r\n      att[a] = true;\r\n    });\r\n    temp.attributes = att;\r\n  }\r\n  return temp.attributes;\r\n};\r\n/** Show the popup on the map\r\n * @param {ol.coordinate|undefined} coordinate Position of the popup\r\n * @param {ol.Feature|Array<ol.Feature>} features The features on the popup\r\n * @param {ol.Feature} current The current feature if keepSelection = true, otherwise get the first feature\r\n */\r\nol.Overlay.PopupFeature.prototype.show = function(coordinate, features, current) {\r\n  if (coordinate instanceof ol.Feature \r\n    || (coordinate instanceof Array && coordinate[0] instanceof ol.Feature)) {\r\n    features = coordinate;\r\n    coordinate = null;\r\n  }\r\n  if (!(features instanceof Array)) features = [features];\r\n  this._features = features.slice();\r\n  if (!this._count) this._count = 1;\r\n  // Calculate html upon feaures attributes\r\n  this._count = 1;\r\n  var f = this.get('keepSelection') ? current || features[0] : features[0];\r\n  var html = this._getHtml(f);\r\n  if (html) {\r\n    if (!this.element.classList.contains('ol-fixed')) this.hide();\r\n    if (!coordinate || features[0].getGeometry().getType()==='Point') {\r\n      coordinate = features[0].getGeometry().getFirstCoordinate();\r\n    }\r\n    ol.Overlay.Popup.prototype.show.call(this, coordinate, html);\r\n  } else {\r\n    this.hide();\r\n  }\r\n};\r\n/**\r\n * @private\r\n */\r\nol.Overlay.PopupFeature.prototype._getHtml = function(feature) {\r\n  if (!feature) return '';\r\n  var html = ol.ext.element.create('DIV', { className: 'ol-popupfeature' });\r\n  if (this.get('canFix')) {\r\n    ol.ext.element.create('I', { className:'ol-fix', parent: html })\r\n      .addEventListener('click', function(){\r\n        this.element.classList.toggle('ol-fixed');\r\n      }.bind(this));\r\n  }\r\n  var template = this._template;\r\n  // calculate template\r\n  if (typeof(template) === 'function') {\r\n    template = template(feature, this._count, this._features.length);\r\n  } else if (!template || !template.attributes) {\r\n    template = template || {};\r\n    template. attributes = {};\r\n    for (var i in feature.getProperties()) if (i!='geometry') {\r\n      template.attributes[i] = i;\r\n    }\r\n  }  \r\n  // Display title\r\n  if (template.title) {\r\n    var title;\r\n    if (typeof template.title === 'function') {\r\n      title = template.title(feature);\r\n    } else {\r\n      title = feature.get(template.title);\r\n    }\r\n    ol.ext.element.create('H1', { html:title, parent: html });\r\n  }\r\n  // Display properties in a table\r\n  if (template.attributes) {\r\n    var tr, table = ol.ext.element.create('TABLE', { parent: html });\r\n    var atts = this._attributeObject(template);\r\n    var featureAtts = feature.getProperties();\r\n    for (var att in atts) {\r\n      if (featureAtts.hasOwnProperty(att)) {\r\n        var a = atts[att];\r\n        var content, val = featureAtts[att];\r\n        // Get calculated value\r\n        if (typeof(a.format)==='function') {\r\n          val = a.format(val, feature);\r\n        }\r\n        // Is entry visible?\r\n        var visible = true;\r\n        if (typeof(a.visible)==='boolean') {\r\n          visible = a.visible;\r\n        } else if (typeof(a.visible)==='function') {\r\n          visible = a.visible(feature, val);\r\n        }\r\n        if (visible) {\r\n          tr = ol.ext.element.create('TR', { parent: table });\r\n          ol.ext.element.create('TD', { html: a.title || att, parent: tr });\r\n          // Show image or content\r\n          if (this.get('showImage') && /(http(s?):)([/|.|\\w|\\s|-])*\\.(?:jpg|gif|png)/.test(val)) {\r\n            content = ol.ext.element.create('IMG',{\r\n              src: val\r\n            });\r\n          } else {\r\n            content = (a.before||'') + val + (a.after||'');\r\n            var maxc = this.get('maxChar') || 200;\r\n            if (typeof(content) === 'string' && content.length>maxc) content = content.substr(0,maxc)+'[...]';\r\n          }\r\n          // Add value\r\n          ol.ext.element.create('TD', {\r\n            html: content,\r\n            parent: tr\r\n          });\r\n        }\r\n      }\r\n    }\r\n  }\r\n  // Zoom button\r\n  ol.ext.element.create('BUTTON', { className: 'ol-zoombt', parent: html })\r\n    .addEventListener('click', function() {\r\n      if (feature.getGeometry().getType()==='Point') {\r\n        this.getMap().getView().animate({\r\n          center: feature.getGeometry().getFirstCoordinate(),\r\n          zoom:  Math.max(this.getMap().getView().getZoom(), 18)\r\n        });\r\n      } else  {\r\n        var ext = feature.getGeometry().getExtent();\r\n        this.getMap().getView().fit(ext, { duration:1000 });\r\n      }\r\n    }.bind(this));\r\n  // Counter\r\n  if (!this.get('keepSelection') && this._features.length > 1) {\r\n    var div = ol.ext.element.create('DIV', { className: 'ol-count', parent: html });\r\n    ol.ext.element.create('DIV', { \r\n      className: 'ol-prev', \r\n      parent: div,\r\n      click: function() {\r\n        this._count--;\r\n        if (this._count<1) this._count = this._features.length;\r\n        html = this._getHtml(this._features[this._count-1]);\r\n        setTimeout(function() { \r\n          ol.Overlay.Popup.prototype.show.call(this, this.getPosition(), html); \r\n        }.bind(this), 350 );\r\n      }.bind(this)\r\n    });\r\n    ol.ext.element.create('TEXT', { html:this._count+'/'+this._features.length, parent: div });\r\n    ol.ext.element.create('DIV', { \r\n      className: 'ol-next', \r\n      parent: div,\r\n      click: function() {\r\n        this._count++;\r\n        if (this._count>this._features.length) this._count = 1;\r\n        html = this._getHtml(this._features[this._count-1]);\r\n        setTimeout(function() { \r\n          ol.Overlay.Popup.prototype.show.call(this, this.getPosition(), html); \r\n        }.bind(this), 350 );\r\n      }.bind(this)\r\n    });\r\n  }\r\n  // Use select interaction\r\n  if (this._select && !this.get('keepSelection')) {\r\n    this._noselect = true;\r\n    this._select.getFeatures().clear();\r\n    this._select.getFeatures().push(feature);\r\n    this._noselect = false;\r\n  }\r\n  this.dispatchEvent({ type: 'select', feature: feature, index: this._count })\r\n  return html;\r\n};\r\n/** Fix the popup\r\n * @param {boolean} fix\r\n */\r\nol.Overlay.PopupFeature.prototype.setFix = function (fix) {\r\n  if (fix) this.element.classList.add('ol-fixed');\r\n  else this.element.classList.remove('ol-fixed');\r\n};\r\n/** Is a popup fixed\r\n * @return {boolean} \r\n */\r\nol.Overlay.PopupFeature.prototype.getFix = function () {\r\n  return this.element.classList.contains('ol-fixed');\r\n};\r\n/** Get a function to use as format to get local string for an attribute\r\n * if the attribute is a number: Number.toLocaleString()\r\n * if the attribute is a date: Date.toLocaleString()\r\n * otherwise the attibute itself\r\n * @param {string} locales string with a BCP 47 language tag, or an array of such strings\r\n * @param {*} options Number or Date toLocaleString options\r\n * @return {function} a function that takes an attribute and return the formated attribute\r\n */\r\nol.Overlay.PopupFeature.localString = function (locales , options) {\r\n  return function (a) {\r\n    if (a && a.toLocaleString) {\r\n      return a.toLocaleString(locales , options);\r\n    } else {\r\n      // Try to get a date from a string\r\n      var date = new Date(a);\r\n      if (isNaN(date)) return a;\r\n      else return date.toLocaleString(locales , options);\r\n    }\r\n  };\r\n};\r\n\r\n/*\tCopyright (c) 2018 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** A tooltip element to be displayed over the map and attached on the cursor position.\r\n * @constructor\r\n * @extends {ol.Overlay.Popup}\r\n * @param {} options Extend Popup options \r\n *\t@param {String} options.popupClass the a class of the overlay to style the popup.\r\n *  @param {number} options.maximumFractionDigits maximum digits to display on measure, default 2\r\n *  @param {function} options.formatLength a function that takes a number and returns the formated value, default length in meter\r\n *  @param {function} options.formatArea a function that takes a number and returns the formated value, default length in square-meter\r\n *  @param {function} options.getHTML a function that takes a feature and the info string and return a formated info to display in the tooltip, default display feature measure & info\r\n *\t@param {Number|Array<number>} options.offsetBox an offset box\r\n *\t@param {ol.OverlayPositioning | string | undefined} options.positionning \r\n *\t\tthe 'auto' positioning var the popup choose its positioning to stay on the map.\r\n * @api stable\r\n */\r\nol.Overlay.Tooltip = function (options) {\r\n  options = options || {};\r\n  options.popupClass = options.popupClass || options.className || 'tooltips black';\r\n  options.positioning = options.positioning || 'center-left';\r\n  options.stopEvent = !!(options.stopEvent);\r\n  ol.Overlay.Popup.call(this, options);\r\n  this.set('maximumFractionDigits', options.maximumFractionDigits||2);\r\n  if (typeof(options.formatLength)==='function') this.formatLength = options.formatLength;\r\n  if (typeof(options.formatArea)==='function') this.formatArea = options.formatArea;\r\n  if (typeof(options.getHTML)==='function') this.getHTML = options.getHTML;\r\n  this._interaction = new ol.interaction.Interaction({\r\n    handleEvent: function(e){\r\n      if (e.type==='pointermove' || e.type==='click') {\r\n        var info = this.getHTML(this._feature, this.get('info'));\r\n        if (info) {\r\n          this.show(e.coordinate, info);\r\n        }\r\n        else this.hide();\r\n        this._coord = e.coordinate;\r\n      }\r\n      return true;\r\n    }.bind(this)\r\n  });\r\n};\r\nol.ext.inherits(ol.Overlay.Tooltip, ol.Overlay.Popup);\r\n/**\r\n * Set the map instance the control is associated with\r\n * and add its controls associated to this map.\r\n * @param {_ol_Map_} map The map instance.\r\n */\r\nol.Overlay.Tooltip.prototype.setMap = function (map) {\r\n  if (this.getMap()) this.getMap().removeInteraction(this._interaction);\r\n  ol.Overlay.Popup.prototype.setMap.call(this, map);\r\n  if (this.getMap()) this.getMap().addInteraction(this._interaction);\r\n};\r\n/** Get the information to show in the tooltip\r\n * The area/length will be added if a feature is attached.\r\n * @param {ol.Feature|undefined} feature the feature\r\n * @param {string} info the info string\r\n * @api\r\n */\r\nol.Overlay.Tooltip.prototype.getHTML = function(feature, info) {\r\n  if (this.get('measure')) return this.get('measure') + (info ? '<br/>'+ info : '');\r\n  else return info || '';\r\n};\r\n/** Set the Tooltip info\r\n * If information is not null it will be set with a delay,\r\n * thus watever the information is inserted, the significant information will be set.\r\n * ie. ttip.setInformation('ok'); ttip.setInformation(null); will set 'ok' \r\n * ttip.set('info','ok'); ttip.set('info', null); will set null\r\n * @param {string} what The information to display in the tooltip, default remove information\r\n */\r\nol.Overlay.Tooltip.prototype.setInfo = function(what) {\r\n  if (!what) {\r\n    this.set('info','');\r\n    this.hide();\r\n  }\r\n  else setTimeout(function() { \r\n    this.set('info', what); \r\n    this.show(this._coord, this.get('info'));\r\n  }.bind(this));\r\n};\r\n/** Remove the current featue attached to the tip \r\n * Similar to setFeature() with no argument\r\n */\r\nol.Overlay.Tooltip.prototype.removeFeature = function() {\r\n  this.setFeature();\r\n};\r\n/** Format area to display in the popup. \r\n * Can be overwritten to display measure in a different unit (default: square-metter).\r\n * @param {number} area area in m2\r\n * @return {string} the formated area\r\n * @api\r\n */\r\nol.Overlay.Tooltip.prototype.formatArea = function(area) {\r\n  if (area > Math.pow(10,-1*this.get('maximumFractionDigits'))) {\r\n    if (area>10000) {\r\n      return (area/1000000).toLocaleString(undefined, {maximumFractionDigits: this.get('maximumFractionDigits)')}) + ' km²';\r\n    } else {\r\n      return area.toLocaleString(undefined, {maximumFractionDigits: this.get('maximumFractionDigits')}) + ' m²';\r\n    }\r\n  } else {\r\n    return '';\r\n  }\r\n};\r\n/** Format area to display in the popup\r\n * Can be overwritten to display measure in different unit (default: meter).\r\n * @param {number} length length in m\r\n * @return {string} the formated length\r\n * @api\r\n */\r\nol.Overlay.Tooltip.prototype.formatLength = function(length) {\r\n  if (length > Math.pow(10,-1*this.get('maximumFractionDigits'))) {\r\n    if (length>100) {\r\n      return (length/1000).toLocaleString(undefined, {maximumFractionDigits: this.get('maximumFractionDigits')}) + ' km';\r\n    } else {\r\n      return length.toLocaleString(undefined, {maximumFractionDigits: this.get('maximumFractionDigits')}) + ' m';\r\n    }\r\n  } else {\r\n    return '';\r\n  }\r\n};\r\n/** Set a feature associated with the tooltips, measure info on the feature will be added in the tooltip\r\n * @param {ol.Feature|ol.Event} feature an ol.Feature or an event (object) with a feature property\r\n */\r\nol.Overlay.Tooltip.prototype.setFeature = function(feature) {\r\n  // Handle event with a feature as property.\r\n  if (feature && feature.feature) feature = feature.feature;\r\n  // The feature\r\n  this._feature = feature;\r\n  if (this._listener) {\r\n    this._listener.forEach(function(l) {\r\n      ol.Observable.unByKey(l);\r\n    });\r\n  }\r\n  this._listener = [];\r\n  this.set('measure', '');\r\n  if (feature) {\r\n    this._listener.push(feature.getGeometry().on('change', function(e){ \r\n      var geom = e.target;\r\n      var measure;\r\n      if (geom.getArea) {\r\n        measure = this.formatArea(ol.sphere.getArea(geom, { projection: this.getMap().getView().getProjection() }));\r\n      } else if (geom.getLength) {\r\n        measure = this.formatLength(ol.sphere.getLength(geom, { projection: this.getMap().getView().getProjection() }));\r\n      }\r\n      this.set('measure', measure);\r\n    }.bind(this)));\r\n  }\r\n};\r\n\r\n/*\r\n\tCopyright (c) 2017 Jean-Marc VIGLINO,\r\n\treleased under the CeCILL-B license (http://www.cecill.info/).\r\n\tol.coordinate.convexHull compute a convex hull using Andrew's Monotone Chain Algorithm.\r\n\t@see https://en.wikipedia.org/wiki/Convex_hull_algorithms\r\n*/\r\nol.coordinate.convexHull;\r\n(function(){\r\n/** Tests if a point is left or right of line (a,b).\r\n* @param {ol.coordinate} a point on the line\r\n* @param {ol.coordinate} b point on the line\r\n* @param {ol.coordinate} o\r\n* @return {bool} true if (a,b,o) turns clockwise\r\n*/\r\nvar clockwise = function (a, b, o) {\r\n  return ((a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]) <= 0);\r\n};\r\n/** Compute a convex hull using Andrew's Monotone Chain Algorithm\r\n * @param {Array<ol.geom.Point>} points an array of 2D points\r\n * @return {Array<ol.geom.Point>} the convex hull vertices\r\n */\r\nol.coordinate.convexHull = function (points) {\t// Sort by increasing x and then y coordinate\r\n  var i;\r\n  points.sort(function(a, b) {\r\n    return a[0] == b[0] ? a[1] - b[1] : a[0] - b[0];\r\n  });\r\n  // Compute the lower hull\r\n  var lower = [];\r\n  for (i = 0; i < points.length; i++) {\r\n    while (lower.length >= 2 && clockwise(lower[lower.length - 2], lower[lower.length - 1], points[i])) {\r\n      lower.pop();\r\n    }\r\n    lower.push(points[i]);\r\n  }\r\n  // Compute the upper hull\r\n  var upper = [];\r\n  for (i = points.length - 1; i >= 0; i--) {\r\n    while (upper.length >= 2 && clockwise(upper[upper.length - 2], upper[upper.length - 1], points[i])) {\r\n      upper.pop();\r\n    }\r\n    upper.push(points[i]);\r\n  }\r\n  upper.pop();\r\n  lower.pop();\r\n  return lower.concat(upper);\r\n};\r\n/* Get coordinates of a geometry */\r\nvar getCoordinates = function (geom) {\r\n  var i, p\r\n  var h = [];\r\n  switch (geom.getType()) {\r\n    case \"Point\":h.push(geom.getCoordinates());\r\n      break;\r\n    case \"LineString\":\r\n    case \"LinearRing\":\r\n    case \"MultiPoint\":h = geom.getCoordinates();\r\n      break;\r\n    case \"MultiLineString\":\r\n      p = geom.getLineStrings();\r\n      for (i = 0; i < p.length; i++) h.concat(getCoordinates(p[i]));\r\n      break;\r\n    case \"Polygon\":\r\n      h = getCoordinates(geom.getLinearRing(0));\r\n      break;\r\n    case \"MultiPolygon\":\r\n      p = geom.getPolygons();\r\n      for (i = 0; i < p.length; i++) h.concat(getCoordinates(p[i]));\r\n      break;\r\n    case \"GeometryCollection\":\r\n      p = geom.getGeometries();\r\n      for (i = 0; i < p.length; i++) h.concat(getCoordinates(p[i]));\r\n      break;\r\n    default:break;\r\n  }\r\n  return h;\r\n};\r\n/** Compute a convex hull on a geometry using Andrew's Monotone Chain Algorithm\r\n * @return {Array<ol.geom.Point>} the convex hull vertices\r\n */\r\nol.geom.Geometry.prototype.convexHull = function() {\r\n  return ol.coordinate.convexHull(getCoordinates(this));\r\n};\r\n})();\r\n\r\n/*\r\n\tCopyright (c) 2018 Jean-Marc VIGLINO,\r\n\treleased under the CeCILL-B license (http://www.cecill.info/).\r\n*/\r\n/** Convert coordinate to French DFCI grid\r\n * @param {ol/coordinate} coord\r\n * @param {number} level [0-3]\r\n * @param {ol/proj/Projection} projection of the coord, default EPSG:27572\r\n * @return {String} the DFCI index\r\n */\r\nol.coordinate.toDFCI = function (coord, level, projection) {\r\n  if (!level && level !==0) level = 3;\r\n  if (projection) {\r\n    if (!ol.proj.get('EPSG:27572')) {\r\n      // Add Lambert IIe proj \r\n      if (!proj4.defs[\"EPSG:27572\"]) proj4.defs(\"EPSG:27572\",\"+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs\");\r\n      ol.proj.proj4.register(proj4);\r\n    }\r\n    coord = ol.proj.transform(coord, projection, 'EPSG:27572');\r\n  }\r\n  var x = coord[0];\r\n  var y = coord[1];\r\n  var s = '';\r\n  // Level 0\r\n  var step = 100000;\r\n  s += String.fromCharCode(65 + Math.floor((x<800000?x:x+200000)/step))\r\n    + String.fromCharCode(65 + Math.floor((y<2300000?y:y+200000)/step) - 1500000/step);\r\n  if (level === 0) return s;\r\n  // Level 1\r\n  var step1 = 100000/5;\r\n  s += 2*Math.floor((x%step)/step1);\r\n  s += 2*Math.floor((y%step)/step1);\r\n  if (level === 1) return s;\r\n  // Level 2\r\n  var step2 = step1 / 10;\r\n  var x0 = Math.floor((x%step1)/step2);\r\n  s += String.fromCharCode(65 + (x0<8 ? x0 : x0+2));\r\n  s += Math.floor((y%step1)/step2);\r\n  if (level === 2) return s;\r\n  // Level 3\r\n  var x3 = Math.floor((x%step2)/500);\r\n  var y3 = Math.floor((y%step2)/500);\r\n  if (x3<1) {\r\n    if (y3>1) s += '.1';\r\n    else s += '.4';\r\n  } else if (x3>2) {\r\n    if (y3>1) s += '.2';\r\n    else s += '.3';\r\n  } else if (y3>2) {\r\n    if (x3<2) s += '.1';\r\n    else s += '.2';\r\n  } else if (y3<1) {\r\n    if (x3<2) s += '.4';\r\n    else s += '.3';\r\n  } else {\r\n    s += '.5';\r\n  }\r\n  return s;\r\n};\r\n/** Get coordinate from French DFCI index\r\n * @param {String} index the DFCI index\r\n * @param {ol/proj/Projection} projection result projection, default EPSG:27572\r\n * @return {ol/coordinate} coord\r\n */\r\nol.coordinate.fromDFCI = function (index, projection) {\r\n  var coord;\r\n  // Level 0\r\n  var step = 100000;\r\n  var x = index.charCodeAt(0) - 65;\r\n  x = (x<8 ? x : x-2)*step;\r\n  var y = index.charCodeAt(1) - 65;\r\n  y = (y<8 ? y : y-2)*step + 1500000;\r\n  if (index.length===2) {\r\n    coord = [x+step/2, y+step/2];\r\n  } else {\r\n    // Level 1\r\n    step /= 5;\r\n    x += Number(index.charAt(2))/2*step;\r\n    y += Number(index.charAt(3))/2*step;\r\n    if (index.length===4) {\r\n      coord = [x+step/2, y+step/2];\r\n    } else {\r\n      // Level 2\r\n      step /= 10;\r\n      var x0 = index.charCodeAt(4) - 65;\r\n      x += (x0<8 ? x0 : x0-2)*step;\r\n      y += Number(index.charAt(5))*step;\r\n      if (index.length === 6) {\r\n        coord = [x+step/2, y+step/2];\r\n      } else {\r\n        // Level 3\r\n        switch (index.charAt(7)) {\r\n          case '1':\r\n            coord = [x+step/4, y+3*step/4];\r\n            break;\r\n          case '2':\r\n            coord = [x+3*step/4, y+3*step/4];\r\n            break;\r\n          case '3':\r\n            coord = [x+3*step/4, y+step/4];\r\n            break;\r\n          case '4':\r\n            coord = [x+step/4, y+step/4];\r\n            break;\r\n          default:\r\n            coord = [x+step/2, y+step/2];\r\n            break;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  // Convert ?\r\n  if (projection) {\r\n    if (!ol.proj.get('EPSG:27572')) {\r\n      // Add Lambert IIe proj \r\n      if (!proj4.defs[\"EPSG:27572\"]) proj4.defs(\"EPSG:27572\",\"+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs\");\r\n      ol.proj.proj4.register(proj4);\r\n    }\r\n    coord = ol.proj.transform(coord, 'EPSG:27572', projection);\r\n  }\r\n  return coord;\r\n};\r\n/** The string is a valid DFCI index\r\n * @param {string} index DFCI index\r\n * @return {boolean}\r\n */\r\nol.coordinate.validDFCI = function (index) {\r\n  if (index.length<2 || index.length>8) return false;\r\n  if (/[^A-H|^K-N]/.test(index.substr(0,1))) return false;\r\n  if (/[^B-H|^K-N]/.test(index.substr(1,1))) return false;\r\n  if (index.length>2) {\r\n    if (index.length<4) return false;\r\n    if (/[^0,^2,^4,^6,^8]/.test(index.substr(2,1))) return false;\r\n    if (/[^0,^2,^4,^6,^8]/.test(index.substr(3,1))) return false;\r\n  }\r\n  if (index.length>4) {\r\n    if (index.length<6) return false;\r\n    if (/[^A-H|^K-L]/.test(index.substr(4,1))) return false;\r\n    if (/[^0-9]/.test(index.substr(5,1))) return false;\r\n  }\r\n  if (index.length>6) {\r\n    if (index.length<8) return false;\r\n    if (index.substr(6,1)!=='.') return false;\r\n    if (/[^1-5]/.test(index.substr(7,1))) return false;\r\n  }\r\n  return true;\r\n}\r\n/** Coordinate is valid for DFCI \r\n * @param {ol/coordinate} coord\r\n * @param {ol/proj/Projection} projection result projection, default EPSG:27572\r\n * @return {boolean}\r\n */\r\nol.coordinate.validDFCICoord = function (coord, projection) {\r\n  if (projection) {\r\n    if (!ol.proj.get('EPSG:27572')) {\r\n      // Add Lambert IIe proj \r\n      if (!proj4.defs[\"EPSG:27572\"]) proj4.defs(\"EPSG:27572\",\"+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs\");\r\n      ol.proj.proj4.register(proj4);\r\n    }\r\n    coord = ol.proj.transform(coord, projection, 'EPSG:27572');\r\n  }\r\n  // Test extent\r\n  if (0 > coord[0] || coord[0] > 1200000 ) return false;\r\n  if (1600000 > coord[1] || coord[1] > 2700000 ) return false;\r\n  return true;\r\n};\r\n\r\n/*\r\n\tCopyright (c) 2018 Jean-Marc VIGLINO,\r\n\treleased under the CeCILL-B license (http://www.cecill.info/).\r\n*/\r\n/* Define namespace\r\n */\r\nol.graph = {};\r\n/** \r\n * @classdesc \r\n * Compute the shortest paths between nodes in a graph source\r\n * The source must only contains LinesString.\r\n * \r\n * It uses a A* optimisation.\r\n * You can overwrite methods to customize the result.\r\n * @see https://en.wikipedia.org/wiki/Dijkstras_algorithm\r\n * @constructor\r\n * @fires calculating \r\n * @fires start\r\n * @fires finish\r\n * @fires pause\r\n * @param {any} options\r\n *  @param {ol/source/Vector} options.source the source for the edges \r\n *  @param {integer} [options.maxIteration=20000] maximum iterations before a pause event is fired, default 20000\r\n *  @param {integer} [options.stepIteration=2000] number of iterations before a calculating event is fired, default 2000\r\n *  @param {number} [options.epsilon=1E-6] geometric precision (min distance beetween 2 points), default 1E-6\r\n */\r\nol.graph.Dijskra = function (options) {\r\n  options = options || {};\r\n  this.source = options.source;\r\n  this.nodes = new ol.source.Vector();\r\n  // Maximum iterations\r\n  this.maxIteration = options.maxIteration || 20000;\r\n  this.stepIteration = options.stepIteration || 2000;\r\n  // A* optimisation\r\n  this.astar = true;\r\n  this.candidat = [];\r\n  ol.Object.call (this);\r\n  this.set ('epsilon', options.epsilon || 1E-6);\r\n};\r\nol.ext.inherits(ol.graph.Dijskra, ol.Object);\r\n/** Get the weighting of the edge, for example a speed factor\r\n * The function returns a value beetween ]0,1]\r\n * - 1   = no weighting\r\n * - 0.5 = goes twice more faster on this road\r\n * \r\n * If no feature is provided you must return the lower weighting you're using\r\n * @param {ol/Feature} feature\r\n * @return {number} a number beetween 0-1 \r\n * @api\r\n */\r\nol.graph.Dijskra.prototype.weight = function(/* feature */) {\r\n  return 1;\r\n};\r\n/** Get the edge direction\r\n * -  0 : the road is blocked\r\n * -  1 : direct way\r\n * - -1 : revers way\r\n * -  2 : both way\r\n * @param {ol/Feature} feature\r\n * @return {Number} 0: blocked, 1: direct way, -1: revers way, 2:both way \r\n * @api\r\n */\r\nol.graph.Dijskra.prototype.direction = function(/* feature */) {\r\n  return 2;\r\n};\r\n/** Calculate the length of an edge\r\n * @param {ol/Feature|ol/geom/LineString} geom\r\n * @return {number}\r\n * @api\r\n */\r\nol.graph.Dijskra.prototype.getLength = function(geom) {\r\n  if (geom.getGeometry) geom = geom.getGeometry();\r\n  return geom.getLength();\r\n};\r\n/** Get the nodes source concerned in the calculation\r\n * @return {ol/source/Vector}\r\n */\r\nol.graph.Dijskra.prototype.getNodeSource = function() {\r\n  return this.nodes;\r\n};\r\n/** Get all features at a coordinate\r\n * @param {ol/coordinate} coord\r\n * @return {Array<ol/Feature>}\r\n */\r\nol.graph.Dijskra.prototype.getEdges = function(coord) {\r\n  var extent = ol.extent.buffer (ol.extent.boundingExtent([coord]), this.get('epsilon'));\r\n  var result = [];\r\n  this.source.forEachFeatureIntersectingExtent(extent, function(f){\r\n    result.push(f);\r\n  });\r\n  return result;\r\n};\r\n/** Get a node at a coordinate\r\n * @param {ol/coordinate} coord\r\n * @return {ol/Feature} the node\r\n */\r\nol.graph.Dijskra.prototype.getNode = function(coord) {\r\n  var extent = ol.extent.buffer (ol.extent.boundingExtent([coord]), this.get('epsilon'));\r\n  var result = [];\r\n  this.nodes.forEachFeatureIntersectingExtent(extent, function(f){\r\n    result.push(f);\r\n  });\r\n  return result[0];\r\n};\r\n/** Add a node\r\n * @param {ol/coorindate} p\r\n * @param {number} wdist the distance to reach this node\r\n * @param {ol/Feature} from the feature used to come to this node\r\n * @param {ol/Feature} prev the previous node\r\n * @return {ol/Feature} the node\r\n * @private\r\n */\r\nol.graph.Dijskra.prototype.addNode = function(p, wdist, dist, from, prev) {\r\n  // Final condition\r\n  if (this.wdist && wdist > this.wdist) return false;\r\n  // Look for existing point\r\n  var node = this.getNode(p);\r\n  // Optimisation ?\r\n  var dtotal = wdist + this.getLength(new ol.geom.LineString([this.end, p])) * this.weight();\r\n  if (this.astar && this.wdist && dtotal > this.wdist) return false;\r\n  if (node) {\r\n    // Allready there\r\n    if (node!==this.arrival && node.get('wdist') <= wdist) return node;\r\n    // New candidat\r\n    node.set('dist', dist);\r\n    node.set('wdist', wdist);\r\n    node.set('dtotal', dtotal);\r\n    node.set('from', from);\r\n    node.set('prev', prev);\r\n    if (node===this.arrival) {\r\n      this.wdist = wdist;\r\n    }\r\n    this.candidat.push (node);\r\n  } else {\r\n    // New candidat\r\n    node =  new ol.Feature({\r\n      geometry: new ol.geom.Point(p),\r\n      from: from, \r\n      prev: prev, \r\n      dist: dist || 0, \r\n      wdist: wdist, \r\n      dtotal: dtotal, \r\n    });\r\n    if (wdist<0) {\r\n      node.set('wdist', false);\r\n    }\r\n    else this.candidat.push (node);\r\n    // Add it in the node source\r\n    this.nodes.addFeature(node);\r\n  }\r\n  return node;\r\n};\r\n/** Get the closest coordinate of a node in the graph source (an edge extremity)\r\n * @param {ol/coordinate} p\r\n * @return {ol/coordinate} \r\n * @private\r\n */\r\nol.graph.Dijskra.prototype.closestCoordinate = function(p) {\r\n  var e = this.source.getClosestFeatureToCoordinate(p);\r\n  var p0 = e.getGeometry().getFirstCoordinate();\r\n  var p1 = e.getGeometry().getLastCoordinate();\r\n  if (ol.coordinate.dist2d(p, p0) < ol.coordinate.dist2d(p, p1)) return p0;\r\n  else return p1;\r\n};\r\n/** Calculate a path beetween 2 points\r\n * @param {ol/coordinate} start\r\n * @param {ol/coordinate} end\r\n * @return {boolean|Array<ol/coordinate>} false if don't start (still running) or start and end nodes\r\n */\r\nol.graph.Dijskra.prototype.path = function(start, end) {\r\n  if (this.running) return false;\r\n  // Starting nodes\r\n  start = this.closestCoordinate(start);\r\n  this.end = this.closestCoordinate(end);\r\n  if (start[0]===this.end[0] \r\n    && start[1]===this.end[1]) {\r\n      this.dispatchEvent({\r\n        type: 'finish',\r\n        route: [],\r\n        wDistance: -1,\r\n        distance: this.wdist\r\n      });\r\n      return false;\r\n    }\r\n  // Initialize\r\n  var self = this;\r\n  this.nodes.clear();\r\n  this.candidat = [];\r\n  this.wdist = 0;\r\n  this.running = true;\r\n  // Starting point\r\n  this.addNode(start, 0);\r\n  // Arrival\r\n  this.arrival = this.addNode(this.end, -1);\r\n  // Start\r\n  this.nb = 0;\r\n  this.dispatchEvent({\r\n    type: 'start'\r\n  });\r\n  setTimeout(function() { self._resume(); });\r\n  return [start, this.end];\r\n};\r\n/** Restart after pause\r\n */\r\nol.graph.Dijskra.prototype.resume = function() {\r\n  if (this.running) return;\r\n  if (this.candidat.length) {\r\n    this.running = true;\r\n    this.nb = 0;\r\n    this._resume();\r\n  }\r\n};\r\n/** Pause \r\n */\r\nol.graph.Dijskra.prototype.pause = function() {\r\n  if (!this.running) return;\r\n  this.nb = -1;\r\n};\r\n/** Get the current 'best way'.\r\n * This may be used to animate while calculating.\r\n * @return {Array<ol/Feature>}\r\n */\r\nol.graph.Dijskra.prototype.getBestWay = function() {\r\n  var node, max = -1;\r\n  for (var i=0, n; n = this.candidat[i]; i++) {\r\n    if (n.get('wdist') > max) {\r\n      node = n;\r\n      max = n.get('wdist');\r\n    }\r\n  }\r\n  // Calculate route to this node\r\n  return this.getRoute(node);\r\n};\r\n/** Go on searching new candidats\r\n * @private\r\n */\r\nol.graph.Dijskra.prototype._resume = function() {\r\n  if (!this.running) return;\r\n  while (this.candidat.length) {\r\n    // Sort by wdist\r\n    this.candidat.sort (function(a,b) {\r\n      return (a.get('dtotal') < b.get('dtotal') ? 1 : a.get('dtotal')===b.get('dtotal') ? 0 : -1);\r\n    });\r\n    // First candidate\r\n    var node = this.candidat.pop();\r\n    var p = node.getGeometry().getCoordinates();\r\n    // Find connected edges\r\n    var edges = this.getEdges(p);\r\n    for (var i=0, e; e=edges[i]; i++) {\r\n      if (node.get('from')!==e) {\r\n        var dist = this.getLength (e);\r\n        if (dist < 0) {\r\n          console.log ('distance < 0!');\r\n          // continue;\r\n        }\r\n        var wdist = node.get('wdist') + dist * this.weight(e);\r\n        dist = node.get('dist') + dist;\r\n        var pt1 = e.getGeometry().getFirstCoordinate();\r\n        var pt2 = e.getGeometry().getLastCoordinate();\r\n        var sens = this.direction(e);\r\n        if (sens!==0) {\r\n          if (p[0]===pt1[0] && p[1]===pt1[1] && sens!==-1) {\r\n            this.addNode(pt2, wdist, dist, e, node);\r\n          }\r\n          if (p[0]===pt2[0] && p[0]===pt2[0] && sens!==1) {\r\n            this.addNode(pt1, wdist, dist, e, node);\r\n          }\r\n        }\r\n      }\r\n      // Test overflow or pause\r\n      if (this.nb === -1 || this.nb++ > this.maxIteration) {\r\n        this.running = false;\r\n        this.dispatchEvent({\r\n          type: 'pause',\r\n          overflow: (this.nb !== -1)\r\n        });\r\n        return;\r\n      }\r\n      // Take time to do something\r\n      if (!(this.nb % this.stepIteration)){\r\n        var self = this;\r\n        window.setTimeout(function() { self._resume() }, 5);\r\n        this.dispatchEvent({\r\n          type: 'calculating'\r\n        });\r\n        return;\r\n      }\r\n    }\r\n  }\r\n  // Finish!\r\n  this.nodes.clear();\r\n  this.running = false;\r\n  this.dispatchEvent({\r\n    type: 'finish',\r\n    route: this.getRoute(this.arrival),\r\n    wDistance: this.wdist,\r\n    distance: this.arrival.get('dist')\r\n  });\r\n};\r\n/** Get the route to a node\r\n * @param {ol/Feature} node\r\n * @return {Array<ol/Feature>}\r\n * @private\r\n */\r\nol.graph.Dijskra.prototype.getRoute = function(node) {\r\n  var route = [];\r\n  while (node) {\r\n    route.unshift(node.get('from'));\r\n    node = node.get('prev');\r\n  }\r\n  route.shift();\r\n  return route;\r\n};\r\n\r\n/** French Geoportail alti coding\r\n * @param {ol.geom.Geometry} geom\r\n * @param {Object} options\r\n *  @param {ol/proj~ProjectionLike} [options.projection='EPSG:3857'] geometry projection, default 'EPSG:3857'\r\n *  @param {string} [options.apiKey='essentiels'] Geoportail API key\r\n *  @param {number} [options.sampling=0] number of resulting point, max 5000, if none keep input points or use samplingDist\r\n *  @param {number} [options.samplingDist=0] distance for sampling the line or use sampling if lesser\r\n *  @param {string} options.success a function that takes the resulting XYZ geometry\r\n *  @param {string} options.error\r\n */\r\nol.geom.GPAltiCode = function(geom, options) {\r\n  options = options || {};\r\n  var typeGeom = geom.getType();\r\n  if (typeGeom !== 'Point' && typeGeom !== 'LineString') {\r\n    console.warn('[GPAltiCode] '+typeGeom+' not supported...')\r\n    return;\r\n  }\r\n  var proj = options.projection || 'EPSG:3857';\r\n  var sampling = options.sampling || 0;\r\n  if (options.samplingDist) {\r\n    var d = geom.getLength();\r\n    sampling = Math.max(sampling, Math.round(d / options.samplingDist));\r\n  }\r\n  if (sampling > 5000) sampling = 5000;\r\n  if (sampling < 2) sampling = 0;\r\n  geom = geom.clone().transform(proj, 'EPSG:4326');\r\n  var g, lon = [], lat = [];\r\n  switch (typeGeom) {\r\n    case 'Point': {\r\n      g = [geom.getCoordinates()];\r\n      break;\r\n    }\r\n    case 'LineString': {\r\n      g = geom.getCoordinates();\r\n      break;\r\n    }\r\n    default: return;\r\n  }\r\n  if (sampling <= g.length) sampling = 0;\r\n  g.forEach(function(p) {\r\n    lon.push(Math.round(p[0]*1000000)/1000000);\r\n    lat.push(Math.round(p[1]*1000000)/1000000);\r\n  });\r\n  // Get elevation\r\n  var param = 'lon='+lon.join('|')+'&lat='+lat.join('|');\r\n  if (sampling) param += '&sampling='+sampling;\r\n  ol.ext.Ajax.get({\r\n    url: 'https://wxs.ign.fr/'+(options.apiKey || 'essentiels')+'/alti/rest/'+(lon.length>1 ? 'elevationLine' : 'elevation')+'.json?'+param,\r\n    success: function(res) {\r\n      var pts = [];\r\n      res.elevations.forEach(function(e, i) {\r\n        if (sampling) {\r\n          pts.push([e.lon, e.lat, e.z]);\r\n        } else {\r\n          pts.push([g[i][0], g[i][1], e.z]);\r\n        }\r\n      });\r\n      if (typeGeom==='Point') pts = pts[0];\r\n      var result = ol.geom.createFromType(typeGeom, pts);\r\n      result.transform('EPSG:4326', proj);\r\n      if (typeof(options.success) === 'function') options.success(result);\r\n    },\r\n    error: function(e) {\r\n      if (typeof(options.error) === 'function') options.error(e);\r\n    }\r\n  });\r\n}\r\n/** Calculate elevation on coordinates or on a set of coordinates\r\n * @param {ol.coordinate|Array<ol.coordinate>} coord coordinate or an array of coordinates\r\n * @param {Object} options\r\n *  @param {ol/proj~ProjectionLike} [options.projection='EPSG:3857'] geometry projection, default 'EPSG:3857'\r\n *  @param {string} [options.apiKey='essentiels'] Geoportail API key\r\n *  @param {number} [options.sampling=0] number of resulting point, max 5000, if none keep input points or use samplingDist\r\n *  @param {number} [options.samplingDist=0] distance for sampling the line or use sampling if lesser\r\n *  @param {string} options.success a function that takes the resulting XYZ coordinates\r\n *  @param {string} options.error\r\n */\r\nol.coordinate.GPAltiCode = function(coord, options) {\r\n  options = options || {};\r\n  var unique = !coord[0].length;\r\n  var g = unique ? new ol.geom.Point(coord) : new ol.geom.LineString(coord);\r\n  ol.geom.GPAltiCode(g, {\r\n    projection: options.projection,\r\n    apiKey: options.apiKey,\r\n    sampling: options.sampling,\r\n    samplingDist: options.samplingDist,\r\n    success: function(g) {\r\n      if (typeof(options.success) === 'function') {\r\n        options.success(g.getCoordinates())\r\n      }\r\n    },\r\n    error: options.error\r\n  })\r\n}\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n  Usefull function to handle geometric operations\r\n*/\r\n/** Distance beetween 2 points\r\n *\tUsefull geometric functions\r\n * @param {ol.Coordinate} p1 first point\r\n * @param {ol.Coordinate} p2 second point\r\n * @return {number} distance\r\n */\r\nol.coordinate.dist2d = function(p1, p2) {\r\n  var dx = p1[0]-p2[0];\r\n  var dy = p1[1]-p2[1];\r\n  return Math.sqrt(dx*dx+dy*dy);\r\n}\r\n/** 2 points are equal\r\n *\tUsefull geometric functions\r\n * @param {ol.Coordinate} p1 first point\r\n * @param {ol.Coordinate} p2 second point\r\n * @return {boolean}\r\n */\r\nol.coordinate.equal = function(p1, p2) {\r\n  return (p1[0]==p2[0] && p1[1]==p2[1]);\r\n}\r\n/** Get center coordinate of a feature\r\n * @param {ol.Feature} f\r\n * @return {ol.coordinate} the center\r\n */\r\nol.coordinate.getFeatureCenter = function(f) {\r\n  return ol.coordinate.getGeomCenter (f.getGeometry());\r\n};\r\n/** Get center coordinate of a geometry\r\n* @param {ol.geom.Geometry} geom\r\n* @return {ol.Coordinate} the center\r\n*/\r\nol.coordinate.getGeomCenter = function(geom) {\r\n  switch (geom.getType()) {\r\n    case 'Point': \r\n      return geom.getCoordinates();\r\n    case \"MultiPolygon\":\r\n      geom = geom.getPolygon(0);\r\n      // fallthrough\r\n    case \"Polygon\":\r\n      return geom.getInteriorPoint().getCoordinates();\r\n    default:\r\n      return geom.getClosestPoint(ol.extent.getCenter(geom.getExtent()));\r\n  }\r\n};\r\n/** Offset a polyline\r\n * @param {Array<ol.Coordinate>} coords\r\n * @param {number} offset\r\n * @return {Array<ol.Coordinate>} resulting coord\r\n * @see http://stackoverflow.com/a/11970006/796832\r\n * @see https://drive.google.com/viewerng/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxqa2dhZGdldHN0b3JlfGd4OjQ4MzI5M2Y0MjNmNzI2MjY\r\n */\r\nol.coordinate.offsetCoords = function (coords, offset) {\r\n  var path = [];\r\n  var N = coords.length-1;\r\n  var max = N;\r\n  var mi, mi1, li, li1, ri, ri1, si, si1, Xi1, Yi1;\r\n  var p0, p1, p2;\r\n  var isClosed = ol.coordinate.equal(coords[0],coords[N]);\r\n  if (!isClosed) {\r\n    p0 = coords[0];\r\n    p1 = coords[1];\r\n    p2 = [\r\n      p0[0] + (p1[1] - p0[1]) / ol.coordinate.dist2d(p0,p1) *offset,\r\n      p0[1] - (p1[0] - p0[0]) / ol.coordinate.dist2d(p0,p1) *offset\r\n    ];\r\n    path.push(p2);\r\n    coords.push(coords[N])\r\n    N++;\r\n    max--;\r\n  }\r\n  for (var i = 0; i < max; i++) {\r\n    p0 = coords[i];\r\n    p1 = coords[(i+1) % N];\r\n    p2 = coords[(i+2) % N];\r\n    mi = (p1[1] - p0[1])/(p1[0] - p0[0]);\r\n    mi1 = (p2[1] - p1[1])/(p2[0] - p1[0]);\r\n    // Prevent alignements\r\n    if (Math.abs(mi-mi1) > 1e-10) {\r\n      li = Math.sqrt((p1[0] - p0[0])*(p1[0] - p0[0])+(p1[1] - p0[1])*(p1[1] - p0[1]));\r\n      li1 = Math.sqrt((p2[0] - p1[0])*(p2[0] - p1[0])+(p2[1] - p1[1])*(p2[1] - p1[1]));\r\n      ri = p0[0] + offset*(p1[1] - p0[1])/li;\r\n      ri1 = p1[0] + offset*(p2[1] - p1[1])/li1;\r\n      si = p0[1] - offset*(p1[0] - p0[0])/li;\r\n      si1 = p1[1] - offset*(p2[0] - p1[0])/li1;\r\n      Xi1 = (mi1*ri1-mi*ri+si-si1) / (mi1-mi);\r\n      Yi1 = (mi*mi1*(ri1-ri)+mi1*si-mi*si1) / (mi1-mi);\r\n      // Correction for vertical lines\r\n      if(p1[0] - p0[0] == 0) {\r\n        Xi1 = p1[0] + offset*(p1[1] - p0[1])/Math.abs(p1[1] - p0[1]);\r\n        Yi1 = mi1*Xi1 - mi1*ri1 + si1;\r\n      }\r\n      if (p2[0] - p1[0] == 0 ) {\r\n        Xi1 = p2[0] + offset*(p2[1] - p1[1])/Math.abs(p2[1] - p1[1]);\r\n        Yi1 = mi*Xi1 - mi*ri + si;\r\n      }\r\n      path.push([Xi1, Yi1]);\r\n    }\r\n  }\r\n  if (isClosed) {\r\n    path.push(path[0]);\r\n  } else {\r\n    coords.pop();\r\n    p0 = coords[coords.length-1];\r\n    p1 = coords[coords.length-2];\r\n    p2 = [\r\n      p0[0] - (p1[1] - p0[1]) / ol.coordinate.dist2d(p0,p1) *offset,\r\n      p0[1] + (p1[0] - p0[0]) / ol.coordinate.dist2d(p0,p1) *offset\r\n    ];\r\n    path.push(p2);\r\n  }\r\n  return path;\r\n}\r\n/** Find the segment a point belongs to\r\n * @param {ol.Coordinate} pt\r\n * @param {Array<ol.Coordinate>} coords\r\n * @return {} the index (-1 if not found) and the segment\r\n */\r\nol.coordinate.findSegment = function (pt, coords) {\r\n  for (var i=0; i<coords.length-1; i++) {\r\n    var p0 = coords[i];\r\n    var p1 = coords[i+1];\r\n    if (ol.coordinate.equal(pt, p0) || ol.coordinate.equal(pt, p1)) {\r\n      return { index:1, segment: [p0,p1] };\r\n    } else {\r\n      var d0 = ol.coordinate.dist2d(p0,p1);\r\n      var v0 = [ (p1[0] - p0[0]) / d0, (p1[1] - p0[1]) / d0 ];\r\n      var d1 = ol.coordinate.dist2d(p0,pt);\r\n      var v1 = [ (pt[0] - p0[0]) / d1, (pt[1] - p0[1]) / d1 ];\r\n      if (Math.abs(v0[0]*v1[1] - v0[1]*v1[0]) < 1e-10) {\r\n        return { index:1, segment: [p0,p1] };\r\n      }\r\n    }\r\n  }\r\n  return { index: -1 };\r\n};\r\n/**\r\n * Split a Polygon geom with horizontal lines\r\n * @param {Array<ol.Coordinate>} geom\r\n * @param {number} y the y to split\r\n * @param {number} n contour index\r\n * @return {Array<Array<ol.Coordinate>>}\r\n */\r\nol.coordinate.splitH = function (geom, y, n) {\r\n  var x, abs;\r\n  var list = [];\r\n  for (var i=0; i<geom.length-1; i++) {\r\n    // Hole separator?\r\n    if (!geom[i].length || !geom[i+1].length) continue;\r\n    // Intersect\r\n    if (geom[i][1]<=y && geom[i+1][1]>y || geom[i][1]>=y && geom[i+1][1]<y) {\r\n      abs = (y-geom[i][1]) / (geom[i+1][1]-geom[i][1]);\r\n      x = abs * (geom[i+1][0]-geom[i][0]) + geom[i][0];\r\n      list.push ({ contour: n, index: i, pt: [x,y], abs: abs });\r\n    }\r\n  }\r\n  // Sort x\r\n  list.sort(function(a,b) { return a.pt[0] - b.pt[0] });\r\n  // Horizontal segment\r\n  var result = [];\r\n  for (var j=0; j<list.length-1; j += 2) {\r\n    result.push([list[j], list[j+1]])\r\n  }\r\n  return result;\r\n};\r\n/** Create a geometry given a type and coordinates */\r\nol.geom.createFromType = function (type, coordinates) {\r\n  switch (type) {\r\n    case 'LineString': return new ol.geom.LineString(coordinates);\r\n    case 'LinearRing': return new ol.geom.LinearRing(coordinates);\r\n    case 'MultiLineString': return new ol.geom.MultiLineString(coordinates);\r\n    case 'MultiPoint': return new ol.geom.MultiPoint(coordinates);\r\n    case 'MultiPolygon': return new ol.geom.MultiPolygon(coordinates);\r\n    case 'Point': return new ol.geom.Point(coordinates);\r\n    case 'Polygon': return new ol.geom.Polygon(coordinates);\r\n    default:\r\n      console.error('[createFromType] Unsupported type: '+type);\r\n      return null;\r\n  }\r\n};\r\n/** Intersect 2 lines\r\n * @param {Arrar<ol.coordinate>} d1\r\n * @param {Arrar<ol.coordinate>} d2\r\n */\r\nol.coordinate.getIntersectionPoint = function (d1, d2) {\r\n  var d1x = d1[1][0] - d1[0][0];\r\n  var d1y = d1[1][1] - d1[0][1];\r\n  var d2x = d2[1][0] - d2[0][0];\r\n  var d2y = d2[1][1] - d2[0][1];\r\n  var det = d1x * d2y - d1y * d2x;\r\n  if (det != 0) {\r\n    var k = (d1x * d1[0][1] - d1x * d2[0][1] - d1y * d1[0][0] + d1y * d2[0][0]) / det;\r\n    return [d2[0][0] + k*d2x, d2[0][1] + k*d2y];\r\n  } else {\r\n    return false;\r\n  }\r\n};\r\nol.extent.intersection;\r\n(function() {\r\n// Split at x\r\nfunction splitX(pts, x) {\r\n  var pt;\r\n  for (var i=pts.length-1; i>0; i--) {\r\n    if ((pts[i][0]>x && pts[i-1][0]<x) || (pts[i][0]<x && pts[i-1][0]>x)) {\r\n      pt = [ x, (x - pts[i][0]) / (pts[i-1][0]-pts[i][0]) * (pts[i-1][1]-pts[i][1]) + pts[i][1]];\r\n      pts.splice(i, 0, pt);\r\n    }\r\n  }\r\n}\r\n// Split at y\r\nfunction splitY(pts, y) {\r\n  var pt;\r\n  for (var i=pts.length-1; i>0; i--) {\r\n    if ((pts[i][1]>y && pts[i-1][1]<y) || (pts[i][1]<y && pts[i-1][1]>y)) {\r\n      pt = [ (y - pts[i][1]) / (pts[i-1][1]-pts[i][1]) * (pts[i-1][0]-pts[i][0]) + pts[i][0], y];\r\n      pts.splice(i, 0, pt);\r\n    }\r\n  }\r\n}\r\n/** Fast polygon intersection with an extent (used for area calculation)\r\n * @param {ol.extent.Extent} extent\r\n * @param {ol.geom.Polygon|ol.geom.MultiPolygon} polygon\r\n * @returns {ol.geom.Polygon|ol.geom.MultiPolygon|null} return null if not a polygon geometry\r\n */\r\nol.extent.intersection = function(extent, polygon) {\r\n  var poly = (polygon.getType() === 'Polygon');\r\n  if (!poly && polygon.getType() !== 'MultiPolygon') return null;\r\n  var geom = polygon.getCoordinates();\r\n  if (poly) geom = [geom];\r\n  geom.forEach(function(g) {\r\n    g.forEach(function(c) {\r\n      splitX(c, extent[0]);\r\n      splitX(c, extent[2]);\r\n      splitY(c, extent[1]);\r\n      splitY(c, extent[3]);\r\n    });\r\n  })\r\n  // Snap geom to the extent \r\n  geom.forEach(function(g) {\r\n    g.forEach(function(c) {\r\n      c.forEach(function(p) {\r\n        if (p[0]<extent[0]) p[0] = extent[0];\r\n        else if (p[0]>extent[2]) p[0] = extent[2];\r\n        if (p[1]<extent[1]) p[1] = extent[1];\r\n        else if (p[1]>extent[3]) p[1] = extent[3];\r\n      })\r\n    })\r\n  })\r\n  if (poly) {\r\n    return new ol.geom.Polygon(geom[0]);\r\n  } else {\r\n    return new ol.geom.MultiPolygon(geom);\r\n  }\r\n};\r\n})();\r\n/** Add points along a segment\r\n * @param {ol.Coordinate} p1 \r\n * @param {ol.Coordinate} p2 \r\n * @param {number} d \r\n * @param {boolean} start include starting point, default true\r\n * @returns {Array<ol.Coordinate>}\r\n */\r\nol.coordinate.sampleAt = function(p1, p2, d, start) {\r\n  var pts = [];\r\n  if (start!==false) pts.push(p1);\r\n  var dl = ol.coordinate.dist2d(p1,p2);\r\n  if (dl) {\r\n    var nb = Math.round(dl/d);\r\n    if (nb>1) {\r\n      var dx = (p2[0]-p1[0]) / nb;\r\n      var dy = (p2[1]-p1[1]) / nb;\r\n      for (var i=1; i<nb; i++) {\r\n        pts.push([p1[0] + dx*i, p1[1] + dy*i])\r\n      }\r\n    }\r\n  }\r\n  pts.push(p2);\r\n  return pts;\r\n};\r\n/** Sample a Polygon at a distance\r\n * @param {number} d\r\n * @returns {ol.geom.Polygon}\r\n */\r\nol.geom.Polygon.prototype.sampleAt = function(res) {\r\n  var poly = this.getCoordinates();\r\n  var result = [];\r\n  poly.forEach(function(p) {\r\n    var l = [];\r\n    for (var i=1; i<p.length; i++) {\r\n      l = l.concat(ol.coordinate.sampleAt(p[i-1], p[i], res, i===1));\r\n    }\r\n    result.push(l);\r\n  })\r\n  return new ol.geom.Polygon(result);\r\n};\r\n/** Sample a MultiPolygon at a distance\r\n * @param {number} res\r\n * @returns {ol.geom.MultiPolygon}\r\n */\r\nol.geom.MultiPolygon.prototype.sampleAt = function(res) {\r\n  var mpoly = this.getCoordinates();\r\n  var result = [];\r\n  mpoly.forEach(function(poly) {\r\n    var a = [];\r\n    result.push(a);\r\n    poly.forEach(function(p) {\r\n      var l = [];\r\n      for (var i=1; i<p.length; i++) {\r\n        l = l.concat(ol.coordinate.sampleAt(p[i-1], p[i], res, i===1));\r\n      }\r\n      a.push(l);\r\n    })\r\n  });\r\n  return new ol.geom.MultiPolygon(result);\r\n};\r\n/** Intersect a geometry using a circle\r\n * @param {ol.geom.Geometry} geom\r\n * @param {number} resolution circle resolution to sample the polygon on the circle, default 1\r\n * @returns {ol.geom.Geometry}\r\n */\r\nol.geom.Circle.prototype.intersection = function(geom, resolution) {\r\n  if (geom.sampleAt) {\r\n    var ext = ol.extent.buffer(this.getCenter().concat(this.getCenter()), this.getRadius());\r\n    geom = ol.extent.intersection(ext, geom);\r\n    geom = geom.simplify(resolution);\r\n    var c = this.getCenter();\r\n    var r = this.getRadius();\r\n    //var res = (resolution||1) * r / 100;\r\n    var g = geom.sampleAt(resolution).getCoordinates();\r\n    switch (geom.getType()) {\r\n      case 'Polygon': g = [g];\r\n        // fallthrough\r\n      case 'MultiPolygon': {\r\n        var hasout = false;\r\n        // var hasin = false;\r\n        var result = [];\r\n        g.forEach(function(poly) {\r\n          var a = [];\r\n          result.push(a);\r\n          poly.forEach(function(ring) {\r\n            var l = [];\r\n            a.push(l);\r\n            ring.forEach(function(p) {\r\n              var d = ol.coordinate.dist2d(c, p);\r\n              if (d > r) {\r\n                hasout = true;\r\n                l.push([\r\n                  c[0] + r / d * (p[0]-c[0]),\r\n                  c[1] + r / d * (p[1]-c[1])\r\n                ]);\r\n              } else {\r\n                // hasin = true;\r\n                l.push(p);\r\n              }\r\n            });\r\n          })\r\n        });\r\n        if (!hasout) return geom;\r\n        if (geom.getType() === 'Polygon') {\r\n          return new ol.geom.Polygon(result[0]);\r\n        } else {\r\n          return new ol.geom.MultiPolygon(result);\r\n        }\r\n      }\r\n    }\r\n  } else {\r\n    console.warn('[ol/geom/Circle~intersection] Unsupported geometry type: '+geom.getType());\r\n  }\r\n  return geom;\r\n};\r\n\r\n/** Split a lineString by a point or a list of points\r\n *\tNB: points must be on the line, use getClosestPoint() to get one\r\n* @param {ol.Coordinate | Array<ol.Coordinate>} pt points to split the line\r\n* @param {Number} tol distance tolerance for 2 points to be equal\r\n*/\r\nol.geom.LineString.prototype.splitAt = function(pt, tol) {\r\n  var i;\r\n  if (!pt) return [this];\r\n    if (!tol) tol = 1e-10;\r\n    // Test if list of points\r\n    if (pt.length && pt[0].length) {\r\n      var result = [this];\r\n      for (i=0; i<pt.length; i++) {\r\n        var r = [];\r\n        for (var k=0; k<result.length; k++) {\r\n          var ri = result[k].splitAt(pt[i], tol);\r\n          r = r.concat(ri);\r\n        }\r\n        result = r;\r\n      }\r\n      return result;\r\n    }\r\n    // Nothing to do\r\n    if (ol.coordinate.equal(pt,this.getFirstCoordinate())\r\n    || ol.coordinate.equal(pt,this.getLastCoordinate())) {\r\n      return [this];\r\n    }\r\n    // Get\r\n    var c0 = this.getCoordinates();\r\n    var ci=[c0[0]];\r\n    var c = [];\r\n    for (i=0; i<c0.length-1; i++) {\r\n      // Filter equal points\r\n      if (ol.coordinate.equal(c0[i],c0[i+1])) continue;\r\n      // Extremity found\r\n      if (ol.coordinate.equal(pt,c0[i+1])) {\r\n        ci.push(c0[i+1]);\r\n        c.push(new ol.geom.LineString(ci));\r\n        ci = [];\r\n      }\r\n      // Test alignement\r\n      else if (!ol.coordinate.equal(pt,c0[i])) {\r\n        var d1, d2, split=false;\r\n        if (c0[i][0] == c0[i+1][0]) {\r\n          d1 = (c0[i][1]-pt[1]) / (c0[i][1]-c0[i+1][1]);\r\n          split = (c0[i][0] == pt[0]) && (0 < d1 && d1 <= 1)\r\n        } else if (c0[i][1] == c0[i+1][1]) {\r\n          d1 = (c0[i][0]-pt[0]) / (c0[i][0]-c0[i+1][0]);\r\n          split = (c0[i][1] == pt[1]) && (0 < d1 && d1 <= 1)\r\n        } else {\r\n          d1 = (c0[i][0]-pt[0]) / (c0[i][0]-c0[i+1][0]);\r\n          d2 = (c0[i][1]-pt[1]) / (c0[i][1]-c0[i+1][1]);\r\n          split = (Math.abs(d1-d2) <= tol && 0 < d1 && d1 <= 1)\r\n        }\r\n        // pt is inside the segment > split\r\n        if (split) {\r\n          ci.push(pt);\r\n          c.push (new ol.geom.LineString(ci));\r\n          ci = [pt];\r\n        }\r\n      }\r\n      ci.push(c0[i+1]);\r\n    }\r\n    if (ci.length>1) c.push (new ol.geom.LineString(ci));\r\n    if (c.length) return c;\r\n    else return [this];\r\n}\r\n// import('ol-ext/geom/LineStringSplitAt')\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n\tUsefull function to handle geometric operations\r\n*/\r\n/*eslint no-constant-condition: [\"error\", { \"checkLoops\": false }]*/\r\n/**\r\n * Calculate a MultiPolyline to fill a Polygon with a scribble effect that appears hand-made\r\n * @param {} options\r\n *  @param {Number} options.interval interval beetween lines\r\n *  @param {Number} options.angle hatch angle in radian, default PI/2\r\n * @return {ol.geom.MultiLineString|null} the resulting MultiLineString geometry or null if none\r\n */\r\nol.geom.MultiPolygon.prototype.scribbleFill = function (options) {\r\n  var scribbles = [];\r\n  var poly = this.getPolygons();\r\n  var i, p, s;\r\n  for (i=0; p=poly[i]; i++) {\r\n    var mls = p.scribbleFill(options);\r\n    if (mls) scribbles.push(mls);\r\n  } \r\n  if (!scribbles.length) return null;\r\n  // Merge scribbles\r\n  var scribble = scribbles[0];\r\n    var ls;\r\n    for (i = 0; s = scribbles[i]; i++) {\r\n        ls = s.getLineStrings();\r\n        for (var k = 0; k < ls.length; k++) {\r\n            scribble.appendLineString(ls[k]);\r\n        }\r\n    }\r\n  return scribble;\r\n};\r\n/**\r\n * Calculate a MultiPolyline to fill a Polygon with a scribble effect that appears hand-made\r\n * @param {} options\r\n *  @param {Number} options.interval interval beetween lines\r\n *  @param {Number} options.angle hatch angle in radian, default PI/2\r\n * @return {ol.geom.MultiLineString|null} the resulting MultiLineString geometry or null if none\r\n */\r\nol.geom.Polygon.prototype.scribbleFill = function (options) {\r\n\tvar step = options.interval;\r\n  var angle = options.angle || Math.PI/2;\r\n  var i, k,l;\r\n  // Geometry + rotate\r\n\tvar geom = this.clone();\r\n\tgeom.rotate(angle, [0,0]);\r\n  var coords = geom.getCoordinates();\r\n  // Merge holes\r\n  var coord = coords[0];\r\n  for (i=1; i<coords.length; i++) {\r\n    // Add a separator\r\n    coord.push([]);\r\n    // Add the hole\r\n    coord = coord.concat(coords[i]);\r\n  }\r\n  // Extent \r\n\tvar ext = geom.getExtent();\r\n\t// Split polygon with horizontal lines\r\n  var lines = [];\r\n\tfor (var y = (Math.floor(ext[1]/step)+1)*step; y<ext[3]; y += step) {\r\n    l = ol.coordinate.splitH(coord, y, i);\r\n    lines = lines.concat(l);\r\n  }\r\n  if (!lines.length) return null;\r\n  // Order lines on segment index\r\n  var mod = coord.length-1;\r\n\tvar first = lines[0][0].index;\r\n\tfor (k=0; l=lines[k]; k++) {\r\n\t\tlines[k][0].index = (lines[k][0].index-first+mod) % mod;\r\n\t\tlines[k][1].index = (lines[k][1].index-first+mod) % mod;\r\n\t}\r\n  var scribble = [];\r\n  while (true) {\r\n    for (k=0; l=lines[k]; k++) {\r\n      if (!l[0].done) break;\r\n    }\r\n    if (!l) break;\r\n    var scrib = [];\r\n    while (l) {\r\n      l[0].done = true;\r\n      scrib.push(l[0].pt);\r\n      scrib.push(l[1].pt);\r\n      var nexty = l[0].pt[1] + step;\r\n      var d0 = Infinity;\r\n      var l2 = null;\r\n      while (lines[k]) {\r\n        if (lines[k][0].pt[1] > nexty) break;\r\n        if (lines[k][0].pt[1] === nexty) {\r\n          var d = Math.min(\r\n            (lines[k][0].index - l[0].index + mod) % mod,\r\n            (l[0].index - lines[k][0].index + mod) % mod\r\n          );\r\n          var d2 = Math.min(\r\n            (l[1].index - l[0].index + mod) % mod,\r\n            (l[0].index - l[1].index + mod) % mod\r\n          );\r\n          if (d<d0 && d<d2) {\r\n            d0 = d;\r\n            if (!lines[k][0].done) l2 = lines[k];\r\n            else l2 = null;\r\n          }\r\n        }\r\n        k++;\r\n      }\r\n      l = l2;\r\n    }\r\n    if (scrib.length) {\r\n      scribble.push(scrib);\r\n    }\r\n  }\r\n  // Return the scribble as MultiLineString\r\n  if (!scribble.length) return null;\r\n  var mline = new ol.geom.MultiLineString(scribble);\r\n  mline.rotate(-angle,[0,0]);\r\n\treturn mline.cspline({ pointsPerSeg:8, tension:.9 });\r\n};\r\n// import('ol-ext/geom/Scribble')\r\n/** Geohash encoding/decoding and associated functions\r\n * (c) Chris Veness 2014-2019 / MIT Licence\r\n * https://github.com/chrisveness/latlon-geohash\r\n */\r\nol.geohash = {\r\n  // (geohash-specific) Base32 map\r\n  base32: '0123456789bcdefghjkmnpqrstuvwxyz'\r\n};\r\n/** Encodes latitude/longitude to geohash, either to specified precision or to automatically\r\n * evaluated precision.\r\n * @param   {ol.coordinate} lonlat Longitude, Latitude in degrees.\r\n * @param   {number} [precision] Number of characters in resulting geohash.\r\n * @returns {string} Geohash of supplied latitude/longitude.\r\n */\r\nol.geohash.fromLonLat = function(lonlat, precision) {\r\n  var lon = lonlat[0];\r\n  var lat = lonlat[1];\r\n  // infer precision?\r\n  if (!precision) {\r\n    // refine geohash until it matches precision of supplied lat/lon\r\n    for (var p=1; p<=12; p++) {\r\n        var hash = ol.geohash.fromLonLat([lon, lat], p);\r\n        var posn = ol.geohash.toLonLat(hash);\r\n        if (posn.lat==lat && posn.lon==lon) return hash;\r\n    }\r\n    precision = 12; // set to maximum\r\n  }\r\n  if (precision < 1 || precision > 12) precision = 12;\r\n  var idx = 0; // index into base32 map\r\n  var bit = 0; // each char holds 5 bits\r\n  var evenBit = true;\r\n  var geohash = '';\r\n  var latMin =  -90, latMax =  90;\r\n  var lonMin = -180, lonMax = 180;\r\n  while (geohash.length < precision) {\r\n    if (evenBit) {\r\n      // bisect E-W longitude\r\n      var lonMid = (lonMin + lonMax) / 2;\r\n      if (lon >= lonMid) {\r\n        idx = idx*2 + 1;\r\n        lonMin = lonMid;\r\n      } else {\r\n        idx = idx*2;\r\n        lonMax = lonMid;\r\n      }\r\n    } else {\r\n      // bisect N-S latitude\r\n      var latMid = (latMin + latMax) / 2;\r\n      if (lat >= latMid) {\r\n        idx = idx*2 + 1;\r\n        latMin = latMid;\r\n      } else {\r\n        idx = idx*2;\r\n        latMax = latMid;\r\n      }\r\n    }\r\n    evenBit = !evenBit;\r\n    if (++bit == 5) {\r\n      // 5 bits gives us a character: append it and start over\r\n      geohash += ol.geohash.base32.charAt(idx);\r\n      bit = 0;\r\n      idx = 0;\r\n    }\r\n  }\r\n  return geohash;\r\n};\r\n/** Decode geohash to latitude/longitude \r\n * (location is approximate centre of geohash cell, to reasonable precision).\r\n * @param   {string} geohash - Geohash string to be converted to latitude/longitude.\r\n * @returns {ol.coordinate}\r\n */\r\nol.geohash.toLonLat = function(geohash) {\r\n  var extent = ol.geohash.getExtent(geohash); // <-- the hard work\r\n  // now just determine the centre of the cell...\r\n  var latMin = extent[1], lonMin = extent[0];\r\n  var latMax = extent[3], lonMax = extent[2];\r\n  // cell centre\r\n  var lat = (latMin + latMax)/2;\r\n  var lon = (lonMin + lonMax)/2;\r\n  // round to close to centre without excessive precision: ⌊2-log10(Δ°)⌋ decimal places\r\n  lat = lat.toFixed(Math.floor(2-Math.log(latMax-latMin)/Math.LN10));\r\n  lon = lon.toFixed(Math.floor(2-Math.log(lonMax-lonMin)/Math.LN10));\r\n  return [Number(lon), Number(lat)];\r\n};\r\n/** Returns SW/NE latitude/longitude bounds of specified geohash.\r\n * @param   {string} geohash Cell that bounds are required of.\r\n * @returns {ol.extent | false} \r\n */\r\nol.geohash.getExtent = function(geohash) {\r\n  if (!geohash) return false;\r\n  geohash = geohash.toLowerCase();\r\n  var evenBit = true;\r\n  var latMin =  -90, latMax =  90;\r\n  var lonMin = -180, lonMax = 180;\r\n  for (var i=0; i<geohash.length; i++) {\r\n    var chr = geohash.charAt(i);\r\n    var idx = ol.geohash.base32.indexOf(chr);\r\n    if (idx == -1) return false;\r\n    for (var n=4; n>=0; n--) {\r\n      var bitN = idx >> n & 1;\r\n      if (evenBit) {\r\n        // longitude\r\n        var lonMid = (lonMin+lonMax) / 2;\r\n        if (bitN == 1) {\r\n          lonMin = lonMid;\r\n        } else {\r\n          lonMax = lonMid;\r\n        }\r\n      } else {\r\n        // latitude\r\n        var latMid = (latMin+latMax) / 2;\r\n        if (bitN == 1) {\r\n          latMin = latMid;\r\n        } else {\r\n          latMax = latMid;\r\n        }\r\n      }\r\n      evenBit = !evenBit;\r\n    }\r\n  }\r\n  return [lonMin, latMin, lonMax, latMax];\r\n};\r\n/** Determines adjacent cell in given direction.\r\n * @param   {string} geohash Geohash cel\r\n * @param   {string} direction direction as char : N/S/E/W.\r\n * @returns {string|false} \r\n */\r\nol.geohash.getAdjacent = function (geohash, direction) {\r\n  // based on github.com/davetroy/geohash-js\r\n  geohash = geohash.toLowerCase();\r\n  direction = direction.toLowerCase();\r\n  if (!geohash) return false;\r\n  if ('nsew'.indexOf(direction) == -1) return false;\r\n  var neighbour = {\r\n      n: [ 'p0r21436x8zb9dcf5h7kjnmqesgutwvy', 'bc01fg45238967deuvhjyznpkmstqrwx' ],\r\n      s: [ '14365h7k9dcfesgujnmqp0r2twvyx8zb', '238967debc01fg45kmstqrwxuvhjyznp' ],\r\n      e: [ 'bc01fg45238967deuvhjyznpkmstqrwx', 'p0r21436x8zb9dcf5h7kjnmqesgutwvy' ],\r\n      w: [ '238967debc01fg45kmstqrwxuvhjyznp', '14365h7k9dcfesgujnmqp0r2twvyx8zb' ],\r\n  };\r\n  var border = {\r\n      n: [ 'prxz',     'bcfguvyz' ],\r\n      s: [ '028b',     '0145hjnp' ],\r\n      e: [ 'bcfguvyz', 'prxz'     ],\r\n      w: [ '0145hjnp', '028b'     ],\r\n  };\r\n  var lastCh = geohash.slice(-1);    // last character of hash\r\n  var parent = geohash.slice(0, -1); // hash without last character\r\n  var type = geohash.length % 2;\r\n  // check for edge-cases which don't share common prefix\r\n  if (border[direction][type].indexOf(lastCh) != -1 && parent != '') {\r\n    parent = ol.geohash.getAdjacent(parent, direction);\r\n  }\r\n  // append letter for direction to parent\r\n  return parent + ol.geohash.base32.charAt(neighbour[direction][type].indexOf(lastCh));\r\n}\r\n/** Returns all 8 adjacent cells to specified geohash.\r\n * @param   {string} geohash Geohash neighbours are required of.\r\n * @returns {{n,ne,e,se,s,sw,w,nw: string}}\r\n */\r\nol.geohash.getNeighbours = function(geohash) {\r\n  return {\r\n    'n':  ol.geohash.getAdjacent(geohash, 'n'),\r\n    'ne': ol.geohash.getAdjacent(ol.geohash.getAdjacent(geohash, 'n'), 'e'),\r\n    'e':  ol.geohash.getAdjacent(geohash, 'e'),\r\n    'se': ol.geohash.getAdjacent(ol.geohash.getAdjacent(geohash, 's'), 'e'),\r\n    's':  ol.geohash.getAdjacent(geohash, 's'),\r\n    'sw': ol.geohash.getAdjacent(ol.geohash.getAdjacent(geohash, 's'), 'w'),\r\n    'w':  ol.geohash.getAdjacent(geohash, 'w'),\r\n    'nw': ol.geohash.getAdjacent(ol.geohash.getAdjacent(geohash, 'n'), 'w'),\r\n  };\r\n}\r\n\r\n/** Compute great circle bearing of two points.\r\n * @See http://www.movable-type.co.uk/scripts/latlong.html for the original code\r\n * @param {ol.coordinate} origin origin in lonlat\r\n * @param {ol.coordinate} destination destination in lonlat\r\n * @return {number} bearing angle in radian\r\n */\r\nol.sphere.greatCircleBearing = function(origin, destination) {\r\n  var toRad = Math.PI/180;\r\n  var ori = [ origin[0]*toRad, origin[1]*toRad ];\r\n  var dest = [ destination[0]*toRad, destination[1]*toRad ];\r\n  var bearing = Math.atan2(\r\n    Math.sin(dest[0] - ori[0]) * Math.cos(dest[1]),\r\n    Math.cos(ori[1]) * Math.sin(dest[1]) - Math.sin(ori[1]) * Math.cos(dest[1]) * Math.cos(dest[0] - ori[0])\r\n  );\r\n  return bearing;\r\n};\r\n/** \r\n * Computes the destination point given an initial point, a distance and a bearing\r\n * @See http://www.movable-type.co.uk/scripts/latlong.html for the original code\r\n * @param {ol.coordinate} origin stating point in lonlat coords\r\n * @param {number} distance\r\n * @param {number} bearing bearing angle in radian\r\n * @param {*} options\r\n *  @param {booelan} normalize normalize longitude beetween -180/180, deafulet true\r\n *  @param {number|undefined} options.radius sphere radius, default 6371008.8\r\n */\r\nol.sphere.computeDestinationPoint = function(origin, distance, bearing, options) {\r\n  options = options || {};\r\n  var toRad = Math.PI/180;\r\n  var radius = options.radius || 6371008.8;\r\n  var phi1 = origin[1] * toRad;\r\n  var lambda1 = origin[0] * toRad;\r\n  var delta = distance / radius;\r\n  var phi2 = Math.asin(\r\n    Math.sin(phi1) * Math.cos(delta) +\r\n    Math.cos(phi1) * Math.sin(delta) * Math.cos(bearing)\r\n  );\r\n  var lambda2 = lambda1 +\r\n    Math.atan2(\r\n      Math.sin(bearing) * Math.sin(delta) * Math.cos(phi1),\r\n      Math.cos(delta) - Math.sin(phi1) * Math.sin(phi2)\r\n    );\r\n  var lon = lambda2 / toRad;\r\n  // normalise to >=-180 and <=180° \r\n  if (options.normalize!==false && (lon < -180 || lon > 180)) {\r\n    lon = ((lon * 540) % 360) - 180;\r\n  }\r\n  return [ lon, phi2 / toRad ];\r\n};\r\n/** Calculate a track along the great circle given an origin and a destination\r\n * @param {ol.coordinate} origin origin in lonlat\r\n * @param {ol.coordinate} destination destination in lonlat\r\n * @param {number} distance distance between point along the track in meter, default 1km (1000)\r\n * @param {number|undefined} radius sphere radius, default 6371008.8\r\n * @return {Array<ol.coordinate>}\r\n */\r\nol.sphere.greatCircleTrack = function(origin, destination, options) {\r\n  options = options || {};\r\n  var bearing = ol.sphere.greatCircleBearing(origin, destination);\r\n  var dist = ol.sphere.getDistance(origin, destination, options.radius);\r\n  var distance = options.distance || 1000;\r\n  var d = distance;\r\n  var geom = [origin];\r\n  while (d < dist) {\r\n    geom.push(ol.sphere.computeDestinationPoint(origin, d, bearing, { radius: options.radius, normalize: false }));\r\n    d += distance;\r\n  }\r\n  var pt = ol.sphere.computeDestinationPoint(origin, dist, bearing, { radius: options.radius, normalize: false });\r\n  if (Math.abs(pt[0]-destination[0]) > 1) {\r\n    if (pt[0] > destination[0]) destination[0] += 360;\r\n    else destination[0] -= 360;\r\n  } \r\n  geom.push(destination);\r\n  return geom;\r\n};\r\n/** Get map scale factor\r\n * @param {ol.Map} map\r\n * @param {number} [dpi=96] dpi, default 96\r\n * @return {number}\r\n */\r\nol.sphere.getMapScale = function (map, dpi) {\r\n  var view = map.getView();\r\n  var proj = view.getProjection();\r\n  var center = view.getCenter();\r\n  var px = map.getPixelFromCoordinate(center);\r\n  px[1] += 1;\r\n  var coord = map.getCoordinateFromPixel(px);\r\n  var d = ol.sphere.getDistance(\r\n    ol.proj.transform(center, proj, 'EPSG:4326'),\r\n    ol.proj.transform(coord, proj, 'EPSG:4326'));\r\n  d *= (dpi||96) /.0254\r\n  return d;\r\n};\r\n/** Set map scale factor\r\n * @param {ol.Map} map\r\n * @param {number|string} scale the scale factor or a scale string as 1/xxx\r\n * @param {number} [dpi=96] dpi, default 96\r\n * @return {number} scale factor\r\n */\r\nol.sphere.setMapScale = function (map, scale, dpi) {\r\n  if (map && scale) {\r\n    var fac = scale;\r\n    if (typeof(scale)==='string') {\r\n      fac = scale.split('/')[1];\r\n      if (!fac) fac = scale;\r\n      fac = fac.replace(/[^\\d]/g,'');\r\n      fac = parseInt(fac);\r\n    }\r\n    if (!fac) return;\r\n    // Calculate new resolution\r\n    var view = map.getView();\r\n    var proj = view.getProjection();\r\n    var center = view.getCenter();\r\n    var px = map.getPixelFromCoordinate(center);\r\n    px[1] += 1;\r\n    var coord = map.getCoordinateFromPixel(px);\r\n    var d = ol.sphere.getDistance(\r\n      ol.proj.transform(center, proj, 'EPSG:4326'),\r\n      ol.proj.transform(coord, proj, 'EPSG:4326'));\r\n    d *= (dpi || 96) /.0254\r\n    view.setResolution(view.getResolution()*fac/d);\r\n    return fac;\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Pulse an extent on postcompose\r\n*\t@param {ol.coordinates} point to pulse\r\n*\t@param {ol.pulse.options} options pulse options param\r\n*\t  @param {ol.projectionLike|undefined} options.projection projection of coords, default no transform\r\n*\t  @param {Number} options.duration animation duration in ms, default 2000\r\n*\t  @param {ol.easing} options.easing easing function, default ol.easing.upAndDown\r\n*\t  @param {ol.style.Stroke} options.style stroke style, default 2px red\r\n*/\r\nol.Map.prototype.animExtent = function(extent, options)\r\n{\tvar listenerKey;\r\n\toptions = options || {};\r\n\t// Change to map's projection\r\n\tif (options.projection)\r\n\t{\textent = ol.proj.transformExtent (extent, options.projection, this.getView().getProjection());\r\n\t}\r\n\t// options\r\n\tvar start = new Date().getTime();\r\n\tvar duration = options.duration || 1000;\r\n\tvar easing = options.easing || ol.easing.upAndDown;\r\n\tvar width = options.style ? options.style.getWidth() || 2 : 2;\r\n\tvar color = options.style ? options.style.getColr() || 'red' : 'red';\r\n\t// Animate function\r\n\tfunction animate(event) \r\n\t{\tvar frameState = event.frameState;\r\n\t\tvar ratio = frameState.pixelRatio;\r\n\t\tvar elapsed = frameState.time - start;\r\n\t\tif (elapsed > duration) ol.Observable.unByKey(listenerKey);\r\n\t\telse\r\n\t\t{\tvar elapsedRatio = elapsed / duration;\r\n\t\t\tvar p0 = this.getPixelFromCoordinate([extent[0],extent[1]]);\r\n\t\t\tvar p1 = this.getPixelFromCoordinate([extent[2],extent[3]]);\r\n\t\t\tvar context = event.context;\r\n\t\t\tcontext.save();\r\n\t\t\tcontext.scale(ratio,ratio);\r\n\t\t\tcontext.beginPath();\r\n\t\t\t// var e = easing(elapsedRatio)\r\n\t\t\tcontext.globalAlpha = easing(1 - elapsedRatio);\r\n\t\t\tcontext.lineWidth = width;\r\n\t\t\tcontext.strokeStyle = color;\r\n\t\t\tcontext.rect(p0[0], p0[1], p1[0]-p0[0], p1[1]-p0[1]);\r\n\t\t\tcontext.stroke();\r\n\t\t\tcontext.restore();\r\n\t\t\t// tell OL3 to continue postcompose animation\r\n\t\t\tframeState.animate = true;\r\n\t\t}\r\n\t}\r\n\t// Launch animation\r\n\tlistenerKey = this.on('postcompose', animate.bind(this));\r\n\ttry { this.renderSync(); } catch(e) { /* ok */ }\r\n}\r\n\r\n/** Create a cardinal spline version of this geometry.\r\n *\tOriginal https://github.com/epistemex/cardinal-spline-js\r\n *\t@see https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline\r\n *\r\n * @param {} options\r\n *\t@param {Number} options.tension a [0,1] number / can be interpreted as the \"length\" of the tangent, default 0.5\r\n *  @param {Number} options.resolution size of segment to split\r\n *\t@param {Integer} options.pointsPerSeg number of points per segment to add if no resolution is provided, default add 10 points per segment\r\n */\r\n/** Cache cspline calculation on a geometry\r\n * @param {} options\r\n *\t@param {Number} options.tension a [0,1] number / can be interpreted as the \"length\" of the tangent, default 0.5\r\n *  @param {Number} options.resolution size of segment to split\r\n *\t@param {Integer} options.pointsPerSeg number of points per segment to add if no resolution is provided, default add 10 points per segment\r\n * @return {ol.geom.Geometry}\r\n */\r\nol.geom.Geometry.prototype.cspline = function(options){\r\n  // Calculate cspline\r\n  if (this.calcCSpline_){\r\n    if (this.csplineGeometryRevision != this.getRevision() \r\n      || this.csplineOption != JSON.stringify(options)) {\r\n      this.csplineGeometry_ = this.calcCSpline_(options)\r\n      this.csplineGeometryRevision = this.getRevision();\r\n      this.csplineOption = JSON.stringify(options);\r\n    }\r\n    return this.csplineGeometry_;\r\n  } else {\t\r\n    // Default do nothing\r\n    return this;\r\n  }\r\n};\r\nol.geom.GeometryCollection.prototype.calcCSpline_ = function(options) {\r\n  var g=[], g0=this.getGeometries();\r\n  for (var i=0; i<g0.length; i++) {\r\n    g.push(g0[i].cspline(options));\r\n  }\r\n  return new ol.geom.GeometryCollection(g);\r\n};\r\nol.geom.MultiLineString.prototype.calcCSpline_ = function(options) {\r\n  var g=[], lines = this.getLineStrings();\r\n  for (var i=0; i<lines.length; i++) {\r\n    g.push(lines[i].cspline(options).getCoordinates());\r\n  }\r\n  return new ol.geom.MultiLineString(g);\r\n};\r\nol.geom.Polygon.prototype.calcCSpline_ = function(options){\r\n  var g=[], g0=this.getCoordinates();\r\n  for (var i=0; i<g0.length; i++){\r\n    g.push((new ol.geom.LineString(g0[i])).cspline(options).getCoordinates());\r\n  }\r\n  return new ol.geom.Polygon(g);\r\n};\r\nol.geom.MultiPolygon.prototype.calcCSpline_ = function(options) {\r\n  var g=[], g0=this.getPolygons();\r\n  for (var i=0; i<g0.length; i++) {\r\n    g.push(g0[i].cspline(options).getCoordinates());\r\n  }\r\n  return new ol.geom.MultiPolygon(g);\r\n}\r\n/** Calculate cspline on coordinates\r\n * @param {Array<ol.geom.Geometry.coordinate>} line\r\n * @param {} options\r\n *\t@param {Number} options.tension a [0,1] number / can be interpreted as the \"length\" of the tangent, default 0.5\r\n *  @param {Number} options.resolution size of segment to split\r\n *\t@param {Integer} options.pointsPerSeg number of points per segment to add if no resolution is provided, default add 10 points per segment\r\n * @return {Array<ol.geom.Geometry.coordinate>}\r\n */\r\nol.coordinate.cspline = function(line, options) {\r\n  if (!options) options={};\r\n  var tension = typeof options.tension === \"number\" ? options.tension : 0.5;\r\n  var length = 0;\r\n  var p0 = line[0];\r\n  line.forEach(function(p) {\r\n    length += ol.coordinate.dist2d(p0, p);\r\n    p0 = p;\r\n  })\r\n  var resolution = options.resolution || (length / line.length / (options.pointsPerSeg || 10));\r\n  var pts, res = [],    // clone array\r\n    x, y,               // our x,y coords\r\n    t1x, t2x, t1y, t2y,\t// tension vectors\r\n    c1, c2, c3, c4,     // cardinal points\r\n    st, t, i;           // steps based on num. of segments\r\n  // clone array so we don't change the original\r\n  //\r\n  pts = line.slice(0);\r\n  // The algorithm require a previous and next point to the actual point array.\r\n  // Check if we will draw closed or open curve.\r\n  // If closed, copy end points to beginning and first points to end\r\n  // If open, duplicate first points to beginning, end points to end\r\n  if (line.length>2 && line[0][0]==line[line.length-1][0] && line[0][1]==line[line.length-1][1]) {\r\n    pts.unshift(line[line.length-2]);\r\n    pts.push(line[1]);\r\n  } else {\r\n    pts.unshift(line[0]);\r\n    pts.push(line[line.length-1]);\r\n  }\r\n  // ok, lets start..\r\n  function dist2d(x1, y1, x2, y2) {\r\n    var dx = x2-x1;\r\n    var dy = y2-y1;\r\n    return Math.sqrt(dx*dx+dy*dy);\r\n  }\r\n  // 1. loop goes through point array\r\n  // 2. loop goes through each segment between the 2 pts + 1e point before and after\r\n  for (i=1; i < (pts.length - 2); i++) {\r\n    var d1 = dist2d (pts[i][0], pts[i][1], pts[i+1][0], pts[i+1][1]);\r\n    var numOfSegments = Math.round(d1/resolution);\r\n    var d=1;\r\n    if (options.normalize) {\r\n      d1 = dist2d (pts[i+1][0], pts[i+1][1], pts[i-1][0], pts[i-1][1]);\r\n      var d2 = dist2d (pts[i+2][0], pts[i+2][1], pts[i][0], pts[i][1]);\r\n      if (d1<d2) d = d1/d2;\r\n      else d = d2/d1;\r\n    }\r\n    // calc tension vectors\r\n    t1x = (pts[i+1][0] - pts[i-1][0]) * tension *d;\r\n    t2x = (pts[i+2][0] - pts[i][0]) * tension *d;\r\n    t1y = (pts[i+1][1] - pts[i-1][1]) * tension *d;\r\n    t2y = (pts[i+2][1] - pts[i][1]) * tension *d;\r\n    for (t=0; t <= numOfSegments; t++) {\r\n      // calc step\r\n      st = t / numOfSegments;\r\n      // calc cardinals\r\n      c1 =   2 * Math.pow(st, 3)  - 3 * Math.pow(st, 2) + 1; \r\n      c2 = -(2 * Math.pow(st, 3)) + 3 * Math.pow(st, 2); \r\n      c3 = \t   Math.pow(st, 3)    - 2 * Math.pow(st, 2) + st; \r\n      c4 = \t   Math.pow(st, 3)    - \t  Math.pow(st, 2);\r\n      // calc x and y cords with common control vectors\r\n      x = c1 * pts[i][0] + c2 * pts[i+1][0] + c3 * t1x + c4 * t2x;\r\n      y = c1 * pts[i][1] + c2 * pts[i+1][1] + c3 * t1y + c4 * t2y;\r\n      //store points in array\r\n      if (x && y) res.push([x,y]);\r\n    }\r\n  }\r\n  return res;\r\n};\r\n/** @private */\r\nol.geom.LineString.prototype.calcCSpline_ = function(options) {\r\n  var line = this.getCoordinates();\r\n  var res = ol.coordinate.cspline(line, options)\r\n  return new ol.geom.LineString(res);\r\n}\r\n// To use this module with ol/geom/Geometry\r\n// \r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** @typedef {'pointy' | 'flat'} HexagonLayout\r\n *  Layout of a Hexagon. Flat means the bottom part of the hexagon is flat.\r\n */\r\n/**\r\n* Hexagonal grids\r\n* @classdesc ol.HexGrid is a class to compute hexagonal grids\r\n* @see http://www.redblobgames.com/grids/hexagons\r\n*\r\n* @constructor ol.HexGrid\r\n* @extends {ol.Object}\r\n* @param {Object} [options]\r\n*\t@param {number} [options.size] size of the exagon in map units, default 80000\r\n*\t@param {ol.Coordinate} [options.origin] orgin of the grid, default [0,0]\r\n*\t@param {HexagonLayout} [options.layout] grid layout, default pointy\r\n*/\r\nol.HexGrid = function (options)\r\n{\toptions = options || {};\r\n\tol.Object.call (this, options);\r\n\t// Options\r\n\tthis.size_ = options.size||80000;\r\n\tthis.origin_ = options.origin || [0,0];\r\n\tthis.layout_ = this.layout[options.layout] || this.layout.pointy;\r\n};\r\nol.ext.inherits(ol.HexGrid, ol.Object);\r\n/** Layout\r\n*/\r\nol.HexGrid.prototype.layout =\r\n{\tpointy: \r\n\t[\tMath.sqrt(3), Math.sqrt(3)/2, 0, 3/2, \r\n\t\tMath.sqrt(3)/3, -1/3, 0, 2/3, \r\n\t\t// corners\r\n\t\tMath.cos(Math.PI / 180 * (60 * 0 + 30)), Math.sin(Math.PI / 180 * (60 * 0 + 30)), \r\n\t\tMath.cos(Math.PI / 180 * (60 * 1 + 30)), Math.sin(Math.PI / 180 * (60 * 1 + 30)), \r\n\t\tMath.cos(Math.PI / 180 * (60 * 2 + 30)), Math.sin(Math.PI / 180 * (60 * 2 + 30)), \r\n\t\tMath.cos(Math.PI / 180 * (60 * 3 + 30)), Math.sin(Math.PI / 180 * (60 * 3 + 30)), \r\n\t\tMath.cos(Math.PI / 180 * (60 * 4 + 30)), Math.sin(Math.PI / 180 * (60 * 4 + 30)), \r\n\t\tMath.cos(Math.PI / 180 * (60 * 5 + 30)), Math.sin(Math.PI / 180 * (60 * 5 + 30))\r\n\t],\r\n\tflat: \r\n\t[\t3/2, 0, Math.sqrt(3)/2, Math.sqrt(3), 2/3, \r\n\t\t0, -1/3, Math.sqrt(3) / 3, \r\n\t\t// corners\r\n\t\tMath.cos(Math.PI / 180 * (60 * 0)), Math.sin(Math.PI / 180 * (60 * 0)), \r\n\t\tMath.cos(Math.PI / 180 * (60 * 1)), Math.sin(Math.PI / 180 * (60 * 1)), \r\n\t\tMath.cos(Math.PI / 180 * (60 * 2)), Math.sin(Math.PI / 180 * (60 * 2)), \r\n\t\tMath.cos(Math.PI / 180 * (60 * 3)), Math.sin(Math.PI / 180 * (60 * 3)), \r\n\t\tMath.cos(Math.PI / 180 * (60 * 4)), Math.sin(Math.PI / 180 * (60 * 4)), \r\n\t\tMath.cos(Math.PI / 180 * (60 * 5)), Math.sin(Math.PI / 180 * (60 * 5))\r\n\t]\r\n};\r\n/** Set layout\r\n* @param {HexagonLayout | undefined} layout name, default pointy\r\n*/\r\nol.HexGrid.prototype.setLayout = function (layout)\r\n{\tthis.layout_ = this.layout[layout] || this.layout.pointy;\r\n\tthis.changed();\r\n}\r\n/** Get layout\r\n* @return {HexagonLayout} layout name\r\n*/\r\nol.HexGrid.prototype.getLayout = function ()\r\n{\treturn (this.layout_[9]!=0 ? 'pointy' : 'flat');\r\n}\r\n/** Set hexagon origin\r\n* @param {ol.Coordinate} coord origin\r\n*/\r\nol.HexGrid.prototype.setOrigin = function (coord)\r\n{\tthis.origin_ = coord;\r\n\tthis.changed();\r\n}\r\n/** Get hexagon origin\r\n* @return {ol.Coordinate} coord origin\r\n*/\r\nol.HexGrid.prototype.getOrigin = function ()\r\n{\treturn this.origin_;\r\n}\r\n/** Set hexagon size\r\n* @param {number} hexagon size\r\n*/\r\nol.HexGrid.prototype.setSize = function (s) {\r\n\tthis.size_ = s || 80000;\r\n\tthis.changed();\r\n}\r\n/** Get hexagon size\r\n* @return {number} hexagon size\r\n*/\r\nol.HexGrid.prototype.getSize = function () {\r\n\treturn this.size_;\r\n}\r\n/** Convert cube to axial coords\r\n* @param {ol.Coordinate} c cube coordinate\r\n* @return {ol.Coordinate} axial coordinate\r\n*/\r\nol.HexGrid.prototype.cube2hex = function (c)\r\n{\treturn [c[0], c[2]];\r\n};\r\n/** Convert axial to cube coords\r\n* @param {ol.Coordinate} h axial coordinate\r\n* @return {ol.Coordinate} cube coordinate\r\n*/\r\nol.HexGrid.prototype.hex2cube = function(h)\r\n{\treturn [h[0], -h[0]-h[1], h[1]];\r\n};\r\n/** Convert offset to axial coords\r\n* @param {ol.Coordinate} h axial coordinate\r\n* @return {ol.Coordinate} offset coordinate\r\n*/\r\nol.HexGrid.prototype.hex2offset = function (h)\r\n{\tif (this.layout_[9]) return [ h[0] + (h[1] - (h[1]&1)) / 2, h[1] ];\r\n\telse return [ h[0], h[1] + (h[0] + (h[0]&1)) / 2 ];\r\n}\r\n/** Convert axial to offset coords\r\n* @param {ol.Coordinate} o offset coordinate\r\n* @return {ol.Coordinate} axial coordinate\r\n*/\r\nol.HexGrid.prototype.offset2hex = function(o)\r\n{\tif (this.layout_[9]) return [ o[0] - (o[1] - (o[1]&1)) / 2,  o[1] ];\r\n\telse return [ o[0], o[1] - (o[0] + (o[0]&1)) / 2 ];\r\n}\r\n/** Convert offset to cube coords\r\n* @param {ol.Coordinate} c cube coordinate\r\n* @return {ol.Coordinate} offset coordinate\r\n* /\r\nol.HexGrid.prototype.cube2offset = function(c)\r\n{\treturn hex2offset(cube2hex(c));\r\n};\r\n/** Convert cube to offset coords\r\n* @param {ol.Coordinate} o offset coordinate\r\n* @return {ol.Coordinate} cube coordinate\r\n* /\r\nol.HexGrid.prototype.offset2cube = function (o)\r\n{\treturn hex2cube(offset2Hex(o));\r\n};\r\n/** Round cube coords\r\n* @param {ol.Coordinate} h cube coordinate\r\n* @return {ol.Coordinate} rounded cube coordinate\r\n*/\r\nol.HexGrid.prototype.cube_round = function(h)\r\n{\tvar rx = Math.round(h[0])\r\n\tvar ry = Math.round(h[1])\r\n\tvar rz = Math.round(h[2])\r\n\tvar x_diff = Math.abs(rx - h[0])\r\n\tvar y_diff = Math.abs(ry - h[1])\r\n\tvar z_diff = Math.abs(rz - h[2])\r\n\tif (x_diff > y_diff && x_diff > z_diff) rx = -ry-rz\r\n\telse if (y_diff > z_diff) ry = -rx-rz\r\n\telse rz = -rx-ry\r\n\treturn [rx, ry, rz];\r\n};\r\n/** Round axial coords\r\n* @param {ol.Coordinate} h axial coordinate\r\n* @return {ol.Coordinate} rounded axial coordinate\r\n*/\r\nol.HexGrid.prototype.hex_round = function(h)\r\n{\treturn this.cube2hex( this.cube_round( this.hex2cube(h )) );\r\n};\r\n/** Get hexagon corners\r\n*/\r\nol.HexGrid.prototype.hex_corner = function(center, size, i)\r\n{\treturn [ center[0] + size * this.layout_[8+(2*(i%6))], center[1] + size * this.layout_[9+(2*(i%6))]];\r\n};\r\n/** Get hexagon coordinates at a coordinate\r\n* @param {ol.Coordinate} coord\r\n* @return {Arrary<ol.Coordinate>}\r\n*/\r\nol.HexGrid.prototype.getHexagonAtCoord = function (coord)\r\n{\treturn (this.getHexagon(this.coord2hex(coord)));\r\n};\r\n/** Get hexagon coordinates at hex\r\n* @param {ol.Coordinate} hex\r\n* @return {Arrary<ol.Coordinate>}\r\n*/\r\nol.HexGrid.prototype.getHexagon = function (hex)\r\n{\tvar p = [];\r\n\tvar c = this.hex2coord(hex);\r\n\tfor (var i=0; i<=7; i++)\r\n\t{\tp.push(this.hex_corner(c, this.size_, i, this.layout_[8]));\r\n\t}\r\n\treturn p;\r\n};\r\n/** Convert hex to coord\r\n* @param {ol.hex} hex\r\n* @return {ol.Coordinate}\r\n*/\r\nol.HexGrid.prototype.hex2coord = function (hex)\r\n{\treturn [\r\n\t\tthis.origin_[0] + this.size_ * (this.layout_[0] * hex[0] + this.layout_[1] * hex[1]), \r\n\t\tthis.origin_[1] + this.size_ * (this.layout_[2] * hex[0] + this.layout_[3] * hex[1])\r\n\t];\r\n};\r\n/** Convert coord to hex\r\n* @param {ol.Coordinate} coord\r\n* @return {ol.hex}\r\n*/\r\nol.HexGrid.prototype.coord2hex = function (coord)\r\n{\tvar c = [ (coord[0]-this.origin_[0]) / this.size_, (coord[1]-this.origin_[1]) / this.size_ ];\r\n\tvar q = this.layout_[4] * c[0] + this.layout_[5] * c[1];\r\n\tvar r = this.layout_[6] * c[0] + this.layout_[7] * c[1];\r\n\treturn this.hex_round([q, r]);\r\n};\r\n/** Calculate distance between to hexagon (number of cube)\r\n* @param {ol.Coordinate} a first cube coord\r\n* @param {ol.Coordinate} a second cube coord\r\n* @return {number} distance\r\n*/\r\nol.HexGrid.prototype.cube_distance = function (a, b)\r\n{\t//return ( (Math.abs(a[0] - b[0]) + Math.abs(a[1] - b[1]) + Math.abs(a[2] - b[2])) / 2 );\r\n\treturn ( Math.max (Math.abs(a[0] - b[0]), Math.abs(a[1] - b[1]), Math.abs(a[2] - b[2])) );\r\n};\r\n(function(){\r\n/** Line interpolation\r\n*/\r\nfunction lerp(a, b, t)\r\n{\t// for floats\r\n    return a + (b - a) * t;\r\n}\r\nfunction cube_lerp(a, b, t)\r\n{\t// for hexes\r\n    return [ \r\n\t\tlerp (a[0]+1e-6, b[0], t), \r\n\t\tlerp (a[1]+1e-6, b[1], t),\r\n\t\tlerp (a[2]+1e-6, b[2], t)\r\n\t];\r\n}\r\n/** Calculate line between to hexagon\r\n* @param {ol.Coordinate} a first cube coord\r\n* @param {ol.Coordinate} b second cube coord\r\n* @return {Array<ol.Coordinate>} array of cube coordinates\r\n*/\r\nol.HexGrid.prototype.cube_line = function (a, b)\r\n{\tvar d = this.cube_distance(a, b);\r\n\tif (!d) return [a];\r\n    var results = []\r\n    for (var i=0; i<=d; i++) \r\n\t{\tresults.push ( this.cube_round ( cube_lerp(a, b, i/d) ) );\r\n\t}\r\n    return results;\r\n};\r\n})();\r\nol.HexGrid.prototype.neighbors =\r\n{\t'cube':\t[ [+1, -1,  0], [+1,  0, -1], [0, +1, -1], [-1, +1,  0], [-1,  0, +1], [0, -1, +1] ],\r\n\t'hex':\t[ [+1, 0], [+1,  -1], [0, -1], [-1, 0], [-1, +1], [0, +1] ]\r\n};\r\n/** Get the neighbors for an hexagon\r\n* @param {ol.Coordinate} h axial coord\r\n* @param {number} direction\r\n* @return { ol.Coordinate | Array<ol.Coordinate> } neighbor || array of neighbors\r\n*/\r\nol.HexGrid.prototype.hex_neighbors = function (h, d)\r\n{\tif (d!==undefined)\r\n\t{\treturn [ h[0] + this.neighbors.hex[d%6][0], h[1]  + this.neighbors.hex[d%6][1] ];\r\n\t}\r\n\telse\r\n\t{\tvar n = [];\r\n\t\tfor (d=0; d<6; d++)\r\n\t\t{\tn.push ([ h[0] + this.neighbors.hex[d][0], h[1]  + this.neighbors.hex[d][1] ]);\r\n\t\t}\r\n\t\treturn n;\r\n\t}\r\n};\r\n/** Get the neighbors for an hexagon\r\n* @param {ol.Coordinate} c cube coord\r\n* @param {number} direction\r\n* @return { ol.Coordinate | Array<ol.Coordinate> } neighbor || array of neighbors\r\n*/\r\nol.HexGrid.prototype.cube_neighbors = function (c, d)\r\n{\tif (d!==undefined)\r\n\t{\treturn [ c[0] + this.neighbors.cube[d%6][0], c[1]  + this.neighbors.cube[d%6][1], c[2]  + this.neighbors.cube[d%6][2] ];\r\n\t}\r\n\telse\r\n\t{\tvar n = [];\r\n\t\tfor (d=0; d<6; d++)\r\n\t\t{\tn.push ([ c[0] + this.neighbors.cube[d][0], c[1]  + this.neighbors.cube[d][1], c[2]  + this.neighbors.cube[d][2] ]);\r\n\t\t}\r\n\t\tfor (d=0; d<6; d++) n[d] = this.cube2hex(n[d])\r\n\t\treturn n;\r\n\t}\r\n};\r\n\r\n/*\tCopyright (c) 2017 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * French INSEE grids\r\n * @classdesc a class to compute French INSEE grids, ie. fix area (200x200m) square grid, \r\n * based appon EPSG:3035\r\n *\r\n * @requires proj4\r\n * @constructor \r\n * @extends {ol.Object}\r\n * @param {Object} [options]\r\n *  @param {number} [options.size] size grid size in meter, default 200 (200x200m)\r\n */\r\nol.InseeGrid = function (options) {\r\n  options = options || {};\r\n  // Define EPSG:3035 if none\r\n  if (!proj4.defs[\"EPSG:3035\"]) {\r\n    proj4.defs(\"EPSG:3035\",\"+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs\");\r\n    ol.proj.proj4.register(proj4);\r\n  }\r\n  ol.Object.call (this, options);\r\n  // Options\r\n  var size = Math.max(200, Math.round((options.size||0)/200) * 200);\r\n  this.set('size', size);\r\n};\r\nol.ext.inherits (ol.InseeGrid, ol.Object);\r\n/** Grid extent (in EPSG:3035)\r\n */\r\nol.InseeGrid.extent = [3200000,2000000,4300000,3140000];\r\n/** Get the grid extent\r\n * @param {ol.proj.ProjLike} [proj='EPSG:3857']\r\n */\r\nol.InseeGrid.prototype.getExtent = function (proj) {\r\n  return ol.proj.transformExtent(ol.InseeGrid.extent, proj||'EPSG:3035', 'EPSG:3857')\r\n};\r\n/** Get grid geom at coord\r\n * @param {ol.Coordinate} coord\r\n * @param {ol.proj.ProjLike} [proj='EPSG:3857']\r\n */\r\nol.InseeGrid.prototype.getGridAtCoordinate = function (coord, proj) {\r\n  var c = ol.proj.transform(coord, proj||'EPSG:3857', 'EPSG:3035')\r\n  var s = this.get('size');\r\n  var x = Math.floor(c[0]/s) * s;\r\n  var y = Math.floor(c[1]/s) * s;\r\n  var geom = new ol.geom.Polygon([[[x,y],[x+s,y],[x+s,y+s],[x,y+s],[x,y]]]);\r\n  geom.transform('EPSG:3035', proj||'EPSG:3857');\r\n  return geom;\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Show a markup a point on postcompose\r\n*\t@deprecated use map.animateFeature instead\r\n*\t@param {ol.coordinates} point to pulse\r\n*\t@param {ol.markup.options} pulse options param\r\n*\t\t- projection {ol.projection|String|undefined} projection of coords, default none\r\n*\t\t- delay {Number} delay before mark fadeout\r\n*\t\t- maxZoom {Number} zoom when mark fadeout\r\n*\t\t- style {ol.style.Image|ol.style.Style|Array<ol.style.Style>} Image to draw as markup, default red circle\r\n*\t@return Unique key for the listener with a stop function to stop animation\r\n*/\r\nol.Map.prototype.markup = function(coords, options)\r\n{\tvar listenerKey;\r\n\tvar self = this;\r\n\toptions = options || {};\r\n\t// Change to map's projection\r\n\tif (options.projection)\r\n\t{\tcoords = ol.proj.transform(coords, options.projection, this.getView().getProjection());\r\n\t}\r\n\t// options\r\n\tvar start = new Date().getTime();\r\n\tvar delay = options.delay || 3000;\r\n\tvar duration = 1000;\r\n\tvar maxZoom = options.maxZoom || 100;\r\n\tvar easing = ol.easing.easeOut;\r\n\tvar style = options.style;\r\n\tif (!style) style = new ol.style.Circle({ radius:10, stroke:new ol.style.Stroke({color:'red', width:2 }) });\r\n\tif (style instanceof ol.style.Image) style = new ol.style.Style({ image: style });\r\n\tif (!(style instanceof Array)) style = [style];\r\n\t// Animate function\r\n\tfunction animate(event) \r\n\t{\tvar frameState = event.frameState;\r\n\t\tvar elapsed = frameState.time - start;\r\n\t\tif (elapsed > delay+duration) \r\n\t\t{\tol.Observable.unByKey(listenerKey);\r\n\t\t\tlistenerKey = null;\r\n\t\t}\r\n\t\telse \r\n\t\t{\tif (delay>elapsed && this.getView().getZoom()>maxZoom) delay = elapsed;\r\n\t\t\tvar ratio = frameState.pixelRatio;\r\n\t\t\tvar elapsedRatio = 0;\r\n\t\t\tif (elapsed > delay) elapsedRatio = (elapsed-delay) / duration;\r\n\t\t\tvar context = event.context;\r\n\t\t\tcontext.save();\r\n\t\t\tcontext.beginPath();\r\n\t\t\tcontext.globalAlpha = easing(1 - elapsedRatio);\r\n\t\t\tfor (var i=0; i<style.length; i++)\r\n\t\t\t{\tvar imgs = style[i].getImage();\r\n\t\t\t\tvar sc = imgs.getScale(); \r\n\t\t\t\timgs.setScale(sc*ratio);\r\n\t\t\t\tevent.vectorContext.setStyle(style[i]);\r\n\t\t\t\tevent.vectorContext.drawGeometry(new ol.geom.Point(coords));\r\n\t\t\t\timgs.setScale(sc);\r\n\t\t\t}\r\n\t\t\tcontext.restore();\r\n\t\t\t// tell OL3 to continue postcompose animation\r\n\t\t\tif (elapsed >= delay) frameState.animate = true;\r\n\t\t}\r\n\t}\r\n\tsetTimeout (function() {\r\n\t\tif (listenerKey) {\r\n\t\t\ttry { self.renderSync(); } catch(e) { /* ok */ }\r\n\t\t}\r\n\t}, delay);\r\n\t// Launch animation\r\n\tlistenerKey = this.on('postcompose', animate.bind(this));\r\n\ttry { this.renderSync(); } catch(e) { /* ok */ }\r\n\tlistenerKey.stop = function()\r\n\t{\tdelay = duration = 0;\r\n\t\ttry { this.target.renderSync(); } catch(e) { /* ok */ }\r\n\t};\r\n\treturn listenerKey;\r\n}\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Ordering function for ol.layer.Vector renderOrder parameter\r\n*\tol.ordering.fn (options)\r\n*\tIt will return an ordering function (f0,f1)\r\n*\t@namespace\r\n*/\r\nol.ordering = {};\r\n/** y-Ordering\r\n*\t@return ordering function (f0,f1)\r\n*/\r\nol.ordering.yOrdering = function()\r\n{\treturn function(f0,f1)\r\n\t{\treturn f1.getGeometry().getExtent()[1] - f0.getGeometry().getExtent()[1] ;\r\n\t};\r\n};\r\n/** Order with a feature attribute\r\n * @param options\r\n *  @param {string} options.attribute ordering attribute, default zIndex\r\n *  @param {function} options.equalFn ordering function for equal values\r\n * @return ordering function (f0,f1)\r\n */\r\nol.ordering.zIndex = function(options)\r\n{\tif (!options) options = {};\r\n\tvar attr = options.attribute || 'zIndex';\r\n\tif (options.equalFn)\r\n\t{\treturn function(f0,f1)\r\n\t\t{\tif (f0.get(attr) == f1.get(attr)) return options.equalFn(f0,f1);\r\n\t\t\telse return f0.get(attr) < f1.get(attr) ? 1:-1;\r\n\t\t};\r\n\t}\r\n\telse\r\n\t{\treturn function(f0,f1)\r\n\t\t{\tif (f0.get(attr) == f1.get(attr)) return 0;\r\n\t\t\telse return f0.get(attr) < f1.get(attr) ? 1:-1;\r\n\t\t};\r\n\t}\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Pulse a point on postcompose\r\n*\t@deprecated use map.animateFeature instead\r\n*\t@param {ol.coordinates} point to pulse\r\n*\t@param {ol.pulse.options} pulse options param\r\n*\t\t- projection {ol.projection||String} projection of coords\r\n*\t\t- duration {Number} animation duration in ms, default 3000\r\n*\t\t- amplitude {Number} movement amplitude 0: none - 0.5: start at 0.5*radius of the image - 1: max, default 1\r\n*\t\t- easing {ol.easing} easing function, default ol.easing.easeOut\r\n*\t\t- style {ol.style.Image|ol.style.Style|Array<ol.style.Style>} Image to draw as markup, default red circle\r\n*/\r\nol.Map.prototype.pulse = function(coords, options)\r\n{\tvar listenerKey;\r\n\toptions = options || {};\r\n\t// Change to map's projection\r\n\tif (options.projection)\r\n\t{\tcoords = ol.proj.transform(coords, options.projection, this.getView().getProjection());\r\n\t}\r\n\t// options\r\n\tvar start = new Date().getTime();\r\n\tvar duration = options.duration || 3000;\r\n\tvar easing = options.easing || ol.easing.easeOut;\r\n\tvar style = options.style;\r\n\tif (!style) style = new ol.style.Circle({ radius:30, stroke:new ol.style.Stroke({color:'red', width:2 }) });\r\n\tif (style instanceof ol.style.Image) style = new ol.style.Style({ image: style });\r\n\tif (!(style instanceof Array)) style = [style];\r\n\tvar amplitude = options.amplitude || 1;\r\n\tif (amplitude<0) amplitude=0;\r\n\tvar maxRadius = options.radius || 15;\r\n\tif (maxRadius<0) maxRadius = 5;\r\n\t/*\r\n\tvar minRadius = maxRadius - (options.amplitude || maxRadius); //options.minRadius || 0;\r\n\tvar width = options.lineWidth || 2;\r\n\tvar color = options.color || 'red';\r\n\tconsole.log(\"pulse\")\r\n\t*/\r\n\t// Animate function\r\n\tfunction animate(event) \r\n\t{\tvar frameState = event.frameState;\r\n\t\tvar ratio = frameState.pixelRatio;\r\n\t\tvar elapsed = frameState.time - start;\r\n\t\tif (elapsed > duration) ol.Observable.unByKey(listenerKey);\r\n\t\telse\r\n\t\t{\tvar elapsedRatio = elapsed / duration;\r\n\t\t\tvar context = event.context;\r\n\t\t\tcontext.save();\r\n\t\t\tcontext.beginPath();\r\n\t\t\tvar e = easing(elapsedRatio)\r\n\t\t\tcontext.globalAlpha = easing(1 - elapsedRatio);\r\n\t\t\tconsole.log(\"anim\")\r\n\t\t\tfor (var i=0; i<style.length; i++)\r\n\t\t\t{\tvar imgs = style[i].getImage();\r\n\t\t\t\tvar sc = imgs.getScale(); \r\n\t\t\t\timgs.setScale(ratio*sc*(1+amplitude*(e-1)));\r\n\t\t\t\tevent.vectorContext.setStyle(style[i]);\r\n\t\t\t\tevent.vectorContext.drawGeometry(new ol.geom.Point(coords));\r\n\t\t\t\timgs.setScale(sc);\r\n\t\t\t}\r\n\t\t\tcontext.restore();\r\n\t\t\t// tell OL3 to continue postcompose animation\r\n\t\t\tframeState.animate = true;\r\n\t\t}\r\n\t}\r\n\t// Launch animation\r\n\tlistenerKey = this.on('postcompose', animate.bind(this));\r\n\ttry { this.renderSync(); } catch(e) { /* ok */ }\r\n}\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*\r\n*  Add a chart style to display charts (pies or bars) on a map \r\n*/\r\n/**\r\n * @requires ol.style.Circle\r\n * @requires ol.structs.IHasChecksum\r\n */\r\n/**\r\n * @classdesc\r\n * Set chart style for vector features.\r\n *\r\n * @constructor\r\n * @param {} options\r\n *\t@param {String} options.type Chart type: pie,pie3D, donut or bar\r\n *\t@param {number} options.radius Chart radius/size, default 20\r\n *\t@param {number} options.rotation Rotation in radians (positive rotation clockwise). Default is 0.\r\n *\t@param {bool} options.snapToPixel use integral numbers of pixels, default true\r\n *\t@param {_ol_style_Stroke_} options.stroke stroke style\r\n *\t@param {String|Array<ol.color>} options.colors predefined color set \"classic\",\"dark\",\"pale\",\"pastel\",\"neon\" / array of color string, default classic\r\n *\t@param {number} options.offsetX X offset in px\r\n *\t@param {number} options.offsetY Y offset in px\r\n *\t@param {number} options.animation step in an animation sequence [0,1]\r\n *\t@param {number} options.max maximum value for bar chart\r\n * @see [Statistic charts example](../../examples/style/map.style.chart.html)\r\n * @extends {ol.style.RegularShape}\r\n * @implements {ol.structs.IHasChecksum}\r\n * @api\r\n */\r\nol.style.Chart = function(opt_options) {\r\n  var options = opt_options || {};\r\n  var strokeWidth = 0;\r\n  if (opt_options.stroke) strokeWidth = opt_options.stroke.getWidth();\r\n  ol.style.RegularShape.call (this, {\r\n    radius: options.radius + strokeWidth, \r\n    fill: new ol.style.Fill({color: [0,0,0]}),\r\n    rotation: options.rotation,\r\n    snapToPixel: options.snapToPixel\r\n  });\r\n  if (options.scale) this.setScale(options.scale);\r\n  this._stroke = options.stroke;\r\n  this._radius = options.radius || 20;\r\n  this._donutratio = options.donutRatio || 0.5;\r\n  this._type = options.type;\r\n  this._offset = [options.offsetX ? options.offsetX : 0, options.offsetY ? options.offsetY : 0];\r\n  this._animation = (typeof(options.animation) == 'number') ? { animate:true, step:options.animation } : this._animation = { animate:false, step:1 };\r\n  this._max = options.max;\r\n  this._data = options.data;\r\n  if (options.colors instanceof Array) {\r\n    this._colors = options.colors;\r\n  } else {\r\n    this._colors = ol.style.Chart.colors[options.colors];\r\n    if(!this._colors) this._colors = ol.style.Chart.colors.classic;\r\n  }\r\n  this.renderChart_();\r\n};\r\nol.ext.inherits(ol.style.Chart, ol.style.RegularShape);\r\n/** Default color set: classic, dark, pale, pastel, neon\r\n*/\r\nol.style.Chart.colors = {\r\n  \"classic\":\t[\"#ffa500\",\"blue\",\"red\",\"green\",\"cyan\",\"magenta\",\"yellow\",\"#0f0\"],\r\n  \"dark\":\t\t[\"#960\",\"#003\",\"#900\",\"#060\",\"#099\",\"#909\",\"#990\",\"#090\"],\r\n  \"pale\":\t\t[\"#fd0\",\"#369\",\"#f64\",\"#3b7\",\"#880\",\"#b5d\",\"#666\"],\r\n  \"pastel\":\t[\"#fb4\",\"#79c\",\"#f66\",\"#7d7\",\"#acc\",\"#fdd\",\"#ff9\",\"#b9b\"], \r\n  \"neon\":\t\t[\"#ff0\",\"#0ff\",\"#0f0\",\"#f0f\",\"#f00\",\"#00f\"]\r\n}\r\n/**\r\n * Clones the style. \r\n * @return {ol.style.Chart}\r\n */\r\nol.style.Chart.prototype.clone = function() {\r\n  var s = new ol.style.Chart({\r\n    type: this._type,\r\n    radius: this._radius,\r\n    rotation: this.getRotation(),\r\n    scale: this.getScale(),\r\n    data: this.getData(),\r\n    snapToPixel: this.getSnapToPixel ? this.getSnapToPixel() : false,\r\n    stroke: this._stroke,\r\n    colors: this._colors,\r\n    offsetX: this._offset[0],\r\n    offsetY: this._offset[1],\r\n    animation: this._animation\r\n  });\r\n  s.setScale(this.getScale());\r\n  s.setOpacity(this.getOpacity());\r\n  return s;\r\n};\r\n/** Get data associatied with the chart\r\n*/\r\nol.style.Chart.prototype.getData = function() {\r\n  return this._data;\r\n}\r\n/** Set data associatied with the chart\r\n*\t@param {Array<number>}\r\n*/\r\nol.style.Chart.prototype.setData = function(data) {\r\n  this._data = data;\r\n  this.renderChart_();\r\n}\r\n/** Get symbol radius\r\n*/\r\nol.style.Chart.prototype.getRadius = function() {\r\n  return this._radius;\r\n}\r\n/** Set symbol radius\r\n*\t@param {number} symbol radius\r\n*\t@param {number} donut ratio\r\n*/\r\nol.style.Chart.prototype.setRadius = function(radius, ratio) {\r\n  this._radius = radius;\r\n  this.donuratio_ = ratio || this.donuratio_;\r\n  this.renderChart_();\r\n}\r\n/** Set animation step \r\n*\t@param {false|number} false to stop animation or the step of the animation [0,1]\r\n*/\r\nol.style.Chart.prototype.setAnimation = function(step) {\r\n  if (step===false) {\r\n    if (this._animation.animate == false) return;\r\n    this._animation.animate = false;\r\n  } else {\r\n    if (this._animation.step == step) return;\r\n    this._animation.animate = true;\r\n    this._animation.step = step;\r\n  }\r\n  this.renderChart_();\r\n}\r\n/** @private\r\n*/\r\nol.style.Chart.prototype.renderChart_ = function(pixelratio) {\r\n  if (!pixelratio) {\r\n    if (this.getPixelRatio) {\r\n      pixelratio = window.devicePixelRatio;\r\n      this.renderChart_(pixelratio);\r\n      if (this.getPixelRatio && pixelratio!==1) this.renderChart_(1); \r\n    } else {\r\n      this.renderChart_(1);\r\n    }\r\n    return;\r\n  }\r\n  var strokeStyle;\r\n  var strokeWidth = 0;\r\n  if (this._stroke)  {\r\n    strokeStyle = ol.color.asString(this._stroke.getColor());\r\n    strokeWidth = this._stroke.getWidth();\r\n  }\r\n  // no atlas manager is used, create a new canvas\r\n  var canvas = this.getImage(pixelratio);\r\n  // draw the circle on the canvas\r\n  var context = (canvas.getContext('2d'));\r\n  context.save();\r\n  // reset transform\r\n  context.setTransform(pixelratio, 0, 0, pixelratio, 0, 0);\r\n  context.clearRect(0, 0, canvas.width, canvas.height);\r\n  context.lineJoin = 'round';\r\n  var sum=0;\r\n  var i, c;\r\n  for (i=0; i<this._data.length; i++) {\r\n    sum += this._data[i];\r\n  }\r\n  // then move to (x, y)\r\n  context.translate(0,0);\r\n  var step = this._animation.animate ? this._animation.step : 1;\r\n  //console.log(this._animation.step)\r\n  // Draw pie\r\n  switch (this._type) {\r\n    case \"donut\":\r\n    case \"pie3D\":\r\n    case \"pie\": {\r\n      var a, a0 = Math.PI * (step-1.5);\r\n      c = canvas.width/2/pixelratio;\r\n      context.strokeStyle = strokeStyle;\r\n      context.lineWidth = strokeWidth;\r\n      context.save();\r\n      if (this._type==\"pie3D\") {\r\n        context.translate(0, c*0.3);\r\n        context.scale(1, 0.7);\r\n        context.beginPath();\r\n        context.fillStyle = \"#369\";\r\n        context.arc ( c, c*1.4, this._radius *step, 0, 2*Math.PI);\r\n        context.fill();\r\n        context.stroke();\r\n      }\r\n      if (this._type==\"donut\") {\r\n        context.save();\r\n        context.beginPath();\r\n        context.rect ( 0,0,2*c,2*c );\r\n        context.arc ( c, c, this._radius *step *this._donutratio, 0, 2*Math.PI);\r\n        context.clip(\"evenodd\");\r\n      }\r\n      for (i=0; i<this._data.length; i++) {\r\n        context.beginPath();\r\n        context.moveTo(c,c);\r\n        context.fillStyle = this._colors[i%this._colors.length];\r\n        a = a0 + 2*Math.PI*this._data[i]/sum *step;\r\n        context.arc ( c, c, this._radius *step, a0, a);\r\n        context.closePath();\r\n        context.fill();\r\n        context.stroke();\r\n        a0 = a;\r\n      }\r\n      if (this._type==\"donut\") {\r\n        context.restore();\r\n        context.beginPath();\r\n        context.strokeStyle = strokeStyle;\r\n        context.lineWidth = strokeWidth;\r\n        context.arc ( c, c, this._radius *step *this._donutratio, Math.PI * (step-1.5), a0);\r\n        context.stroke();\r\n      }\r\n      context.restore();\r\n      break;\r\n    }\r\n    case \"bar\":\r\n    default: {\r\n      var max=0;\r\n      if (this._max) {\r\n        max = this._max;\r\n      } else {\r\n        for (i=0; i<this._data.length; i++) {\r\n          if (max < this._data[i]) max = this._data[i];\r\n        }\r\n      }\r\n      var s = Math.min(5,2*this._radius/this._data.length);\r\n      c = canvas.width/2/pixelratio;\r\n      var b = canvas.width/pixelratio - strokeWidth;\r\n      var x, x0 = c - this._data.length*s/2\r\n      context.strokeStyle = strokeStyle;\r\n      context.lineWidth = strokeWidth;\r\n      for (i=0; i<this._data.length; i++) {\r\n        context.beginPath();\r\n        context.fillStyle = this._colors[i%this._colors.length];\r\n        x = x0 + s;\r\n        var h = this._data[i]/max*2*this._radius *step;\r\n        context.rect ( x0, b-h, s, h);\r\n        //console.log ( x0+\", \"+(b-this._data[i]/max*2*this._radius)+\", \"+x+\", \"+b);\r\n        context.closePath();\r\n        context.fill();\r\n        context.stroke();\r\n        x0 = x;\r\n      }\r\n    }\r\n  }\r\n  context.restore();\r\n  // Set Anchor\r\n  var anchor = this.getAnchor();\r\n  anchor[0] = c - this._offset[0];\r\n  anchor[1] = c - this._offset[1];\r\n};\r\n\r\n/*\tCopyright (c) 2016 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc\r\n * Fill style with named pattern\r\n *\r\n * @constructor\r\n * @param {olx.style.FillPatternOption=}  options\r\n *\t@param {ol.style.Image|undefined} options.image an image pattern, image must be preloaded to draw on first call\r\n*\t@param {number|undefined} options.opacity opacity with image pattern, default:1\r\n*\t@param {olx.style.fillPattern} options.pattern pattern name (override by image option)\r\n*\t@param {ol.color} options.color pattern color\r\n*\t@param {ol.style.Fill} options.fill fill color (background)\r\n*\t@param {number} options.offset pattern offset for hash/dot/circle/cross pattern\r\n*\t@param {number} options.size line size for hash/dot/circle/cross pattern\r\n*\t@param {number} options.spacing spacing for hash/dot/circle/cross pattern\r\n*\t@param {number|bool} options.angle angle for hash pattern / true for 45deg dot/circle/cross\r\n*\t@param {number} options.scale pattern scale \r\n* @extends {ol.style.Fill}\r\n* @implements {ol.structs.IHasChecksum}\r\n* @api\r\n*/\r\nol.style.FillPattern = function(options) {\r\n  if (!options) options = {};\r\n  var pattern;\r\n  var canvas = this.canvas_ = document.createElement('canvas');\r\n  var scale = Number(options.scale)>0 ? Number(options.scale) : 1;\r\n  var ratio = scale*ol.has.DEVICE_PIXEL_RATIO || ol.has.DEVICE_PIXEL_RATIO;\r\n  var ctx = canvas.getContext('2d');\r\n  if (options.image) {\r\n    options.image.load();\r\n    var i;\r\n    var img = options.image.getImage();\r\n    if (img.width) {\r\n      canvas.width = Math.round(img.width *ratio);\r\n      canvas.height = Math.round(img.height *ratio);\r\n      ctx.globalAlpha = typeof(options.opacity) == 'number' ? options.opacity:1;\r\n      ctx.drawImage(img, 0,0, img.width, img.height, 0, 0, canvas.width, canvas.height);\r\n      pattern = ctx.createPattern(canvas, 'repeat');\r\n    } else {\r\n      var self = this;\r\n      pattern = [0,0,0,0];\r\n      img.onload = function () {\r\n        canvas.width = Math.round(img.width *ratio);\r\n        canvas.height = Math.round(img.height *ratio);\r\n        ctx.globalAlpha = typeof(options.opacity) == 'number' ? options.opacity:1;\r\n        ctx.drawImage(img, 0,0, img.width, img.height, 0, 0, canvas.width, canvas.height);\r\n        pattern = ctx.createPattern(canvas, 'repeat');\r\n        self.setColor(pattern);\r\n      }\r\n    }\r\n  } else {\r\n    var pat = this.getPattern_(options);\r\n    canvas.width = Math.round(pat.width *ratio);\r\n    canvas.height = Math.round(pat.height *ratio);\r\n    ctx.beginPath();\r\n    if (options.fill) {\r\n      ctx.fillStyle = ol.color.asString(options.fill.getColor());\r\n      ctx.fillRect(0,0, canvas.width, canvas.height);\r\n    }\r\n    ctx.scale(ratio,ratio);\r\n    ctx.lineCap = \"round\";\r\n    ctx.lineWidth = pat.stroke || 1;\r\n    ctx.fillStyle = ol.color.asString(options.color||\"#000\");\r\n    ctx.strokeStyle = ol.color.asString(options.color||\"#000\");\r\n    if (pat.circles) for (i=0; i<pat.circles.length; i++) {\r\n      var ci = pat.circles[i]; \r\n      ctx.beginPath();\r\n      ctx.arc(ci[0], ci[1], ci[2], 0,2*Math.PI);\r\n      if (pat.fill) ctx.fill();\r\n      if (pat.stroke) ctx.stroke();\r\n    }\r\n    if (!pat.repeat) pat.repeat=[[0,0]];\r\n    if (pat.char) {\r\n      ctx.font = pat.font || (pat.width)+\"px Arial\";\r\n      ctx.textAlign = 'center';\r\n      ctx.textBaseline = 'middle';\r\n      if (pat.angle) {\r\n        ctx.fillText(pat.char, pat.width/4, pat.height/4);\r\n        ctx.fillText(pat.char, 5*pat.width/4, 5*pat.height/4);\r\n        ctx.fillText(pat.char, pat.width/4, 5*pat.height/4);\r\n        ctx.fillText(pat.char, 5*pat.width/4, pat.height/4);\r\n        ctx.fillText(pat.char, 3*pat.width/4, 3*pat.height/4);\r\n        ctx.fillText(pat.char, -pat.width/4, -pat.height/4);\r\n        ctx.fillText(pat.char, 3*pat.width/4, -pat.height/4);\r\n        ctx.fillText(pat.char, -pat.width/4, 3*pat.height/4);\r\n      }\r\n      else ctx.fillText(pat.char, pat.width/2, pat.height/2);\r\n    }\r\n    if (pat.lines) for (i=0; i<pat.lines.length; i++) for (var r=0; r<pat.repeat.length; r++) {\r\n      var li = pat.lines[i];\r\n      ctx.beginPath();\r\n      ctx.moveTo(li[0]+pat.repeat[r][0],li[1]+pat.repeat[r][1]);\r\n      for (var k=2; k<li.length; k+=2) {\r\n        ctx.lineTo(li[k]+pat.repeat[r][0],li[k+1]+pat.repeat[r][1]);\r\n      }\r\n      if (pat.fill) ctx.fill();\r\n      if (pat.stroke) ctx.stroke();\r\n      ctx.save()\r\n      ctx.strokeStyle = 'red';\r\n      ctx.strokeWidth = 0.1;\r\n      //ctx.strokeRect(0,0,canvas.width,canvas.height);\r\n      ctx.restore()\r\n    }\r\n    pattern = ctx.createPattern(canvas, 'repeat');\r\n    if (options.offset) {\r\n      var offset = options.offset;\r\n      if (typeof(offset) == \"number\") offset = [offset,offset];\r\n      if (offset instanceof Array) {\r\n        var dx = Math.round((offset[0]*ratio));\r\n        var dy = Math.round((offset[1]*ratio));\r\n        // New pattern\r\n        ctx.scale(1/ratio,1/ratio)\r\n        ctx.clearRect(0,0,canvas.width,canvas.height);\r\n        ctx.translate(dx,dy);\r\n        ctx.fillStyle = pattern;\r\n        ctx.fillRect(-dx, -dy, canvas.width,canvas.height);\r\n        pattern = ctx.createPattern(canvas, 'repeat');\r\n      }\r\n    }\r\n  }\r\n  ol.style.Fill.call (this, { color: pattern });\r\n};\r\nol.ext.inherits(ol.style.FillPattern, ol.style.Fill);\r\n/**\r\n * Clones the style. \r\n * @return {ol.style.FillPattern}\r\n */\r\nol.style.FillPattern.prototype.clone = function() {\r\n  var s = ol.style.Fill.prototype.clone.call(this);\r\n  s.canvas_ = this.canvas_;\r\n  return s;\r\n};\r\n/** Get canvas used as pattern\r\n*\t@return {canvas}\r\n*/\r\nol.style.FillPattern.prototype.getImage = function() {\r\n  return this.canvas_;\r\n}\r\n/** Get pattern\r\n*\t@param {olx.style.FillPatternOption}\r\n*/\r\nol.style.FillPattern.prototype.getPattern_ = function(options) {\r\n  var pat = ol.style.FillPattern.prototype.patterns[options.pattern]\r\n    || ol.style.FillPattern.prototype.patterns.dot;\r\n  var d = Math.round(options.spacing)||10;\r\n  var size;\r\n  switch (options.pattern) {\r\n    case 'dot':\r\n    // fallsthrough\r\n    case 'circle': {\r\n      size = options.size===0 ? 0 : options.size/2 || 2;\r\n      if (!options.angle) {\r\n        pat.width = pat.height = d;\r\n        pat.circles = [[ d/2, d/2, size ]]\r\n        if (options.pattern=='circle') {\r\n          pat.circles = pat.circles.concat([\r\n            [ d/2+d, d/2, size ],\r\n            [ d/2-d, d/2, size ],\r\n            [ d/2, d/2+d, size ],\r\n            [ d/2, d/2-d, size ],\r\n            [ d/2+d, d/2+d, size ],\r\n            [ d/2+d, d/2-d, size ],\r\n            [ d/2-d, d/2+d, size ],\r\n            [ d/2-d, d/2-d, size ] \r\n          ]);\r\n        }\r\n      } else {\r\n        d = pat.width = pat.height = Math.round(d*1.4);\r\n        pat.circles = [[ d/4, d/4, size ], [ 3*d/4, 3*d/4, size ]];\r\n        if (options.pattern=='circle') {\r\n          pat.circles = pat.circles.concat([\r\n            [ d/4+d, d/4, size ],\r\n            [ d/4, d/4+d, size ],\r\n            [ 3*d/4-d, 3*d/4, size ],\r\n            [ 3*d/4, 3*d/4-d, size ],\r\n            [ d/4+d, d/4+d, size ], \r\n            [ 3*d/4-d, 3*d/4-d, size ] \r\n          ]);\r\n        }\r\n      }\r\n      break;\r\n    }\r\n    case 'tile':\r\n    // fallsthrough\r\n    case 'square': {\r\n      size = options.size===0 ? 0 : options.size/2 || 2;\r\n      if (!options.angle) {\r\n        pat.width = pat.height = d;\r\n        pat.lines = [[ d/2-size, d/2-size, d/2+size, d/2-size, d/2+size, d/2+size, d/2-size,d/2+size, d/2-size, d/2-size ]]\r\n      } else {\r\n        pat.width = pat.height = d;\r\n        //size *= Math.sqrt(2);\r\n        pat.lines = [[ d/2-size,d/2, d/2,d/2-size, d/2+size,d/2, d/2,d/2+size, d/2-size,d/2 ]]\r\n      }\r\n      if (options.pattern=='square') pat.repeat = [[0,0], [0,d], [d,0], [0,-d], [-d,0], [-d,-d], [d,d], [-d,d], [d,-d] ]\r\n      break;\r\n    }\r\n    case 'cross': {\r\n      // Limit angle to 0 | 45\r\n      if (options.angle) options.angle = 45;\r\n    }\r\n    // fallsthrough\r\n    case 'hatch': {\r\n      var a = Math.round(((options.angle||0)-90)%360);\r\n      if (a>180) a -= 360;\r\n      a *= Math.PI/180;\r\n      var cos = Math.cos(a);\r\n      var sin = Math.sin(a);\r\n      if (Math.abs(sin)<0.0001) {\r\n        pat.width = pat.height = d;\t\r\n        pat.lines = [ [ 0,0.5, d, 0.5 ] ];\r\n        pat.repeat = [ [0,0], [0,d] ];\r\n      } else if (Math.abs(cos)<0.0001) {\r\n        pat.width = pat.height = d;\t\r\n        pat.lines = [ [ 0.5,0, 0.5, d] ];\r\n        pat.repeat = [ [0,0], [d,0] ];\r\n        if (options.pattern=='cross') {\r\n          pat.lines.push ([ 0,0.5, d, 0.5 ]);\r\n          pat.repeat.push([0,d]);\r\n        }\r\n      } else {\r\n        var w = pat.width = Math.round(Math.abs(d/sin)) || 1;\r\n        var h = pat.height = Math.round(Math.abs(d/cos)) || 1;\r\n        if (options.pattern=='cross') {\r\n          pat.lines = [ [-w,-h, 2*w,2*h], [2*w,-h, -w,2*h] ];\r\n          pat.repeat = [ [0,0] ];\r\n        } else if (cos*sin>0) {\r\n          pat.lines = [ [-w,-h, 2*w,2*h] ];\r\n          pat.repeat = [ [0,0], [w,0], [0,h] ];\r\n        } else  {\r\n          pat.lines = [ [2*w,-h, -w,2*h] ];\r\n          pat.repeat = [ [0,0], [-w,0], [0,h] ];\r\n        }\r\n      }\r\n      pat.stroke = options.size===0 ? 0 : options.size||4;\r\n      break;\r\n    }\r\n    default: break;\r\n  }\r\n  return pat\r\n}\r\n/** Static fuction to add char patterns\r\n * @param {title} \r\n * @param {*} options\r\n *  @param {integer} [options.size=10] default 10\r\n *  @param {integer} [options. width=10] default 10\r\n *  @param {integer} [options.height=10] default 10\r\n *  @param {Array<circles>} [options.circles]\r\n *  @param {Array<pointlist>} [options.lines]\r\n *  @param {integer} [options.stroke]\r\n *  @param {bool} [options.fill]\r\n *  @param {char} [option.char]\r\n *  @param {string} [font=\"10px Arial\"]\r\n */\r\nol.style.FillPattern.addPattern = function (title, options) {\r\n  if (!options) options={};\r\n  ol.style.FillPattern.prototype.patterns[title || options.char] = {\r\n    width: options.width || options.size || 10,\r\n    height: options.height || options.size || 10,\r\n    font: options.font,\r\n    char: options.char,\r\n    circles: options.circles,\r\n    lines: options.lines,\r\n    repeat: options.repeat,\r\n    stroke: options.stroke,\r\n    angle: options.angle,\r\n    fill: options.fill\r\n  }\r\n}\r\n/** Patterns definitions\r\n * @see pattern generator http://www.imagico.de/map/jsdotpattern.php\r\n */\r\nol.style.FillPattern.prototype.patterns = {\r\n  \"hatch\": {\r\n    width:5,\r\n    height:5,\r\n    lines:[[0,2.5,5,2.5]],\r\n    stroke:1\r\n  },\r\n  \"cross\": {\r\n    width:7,\r\n    height:7,\r\n    lines:[[0,3,10,3],[3,0,3,10]],\r\n    stroke:1\r\n  },\r\n  \"dot\": {\r\n    width:8,\r\n    height:8,\r\n    circles:[[5,5,2]],\r\n    stroke:false,\r\n    fill:true,\r\n  },\r\n  \"circle\": {\r\n    width:10,\r\n    height:10,\r\n    circles:[[5,5,2]],\r\n    stroke:1,\r\n    fill:false,\r\n  },\r\n  \"square\": {\r\n    width:10,\r\n    height:10,\r\n    lines:[[3,3, 3,8, 8,8, 8,3, 3,3]],\r\n    stroke:1,\r\n    fill:false,\r\n  },\r\n  \"tile\": {\r\n    width:10,\r\n    height:10,\r\n    lines:[[3,3, 3,8, 8,8, 8,3, 3,3]],\r\n    fill:true,\r\n  },\r\n  \"woven\": {\r\n    width: 12,\r\n    height: 12,\r\n    lines: [[ 3,3, 9,9 ],[0,12, 3,9], [9,3, 12,0], [-1,1,1,-1], [13,11,11,13]],\r\n    stroke: 1\r\n  },\r\n  \"crosses\": {\r\n    width: 8,\r\n    height: 8,\r\n    lines: [[ 2,2, 6,6 ],[2,6,6,2]],\r\n    stroke: 1\r\n  },\r\n  \"caps\": {\r\n    width: 8,\r\n    height: 8,\r\n    lines: [[ 2,6, 4,2, 6,6 ]],\r\n    stroke: 1\r\n  },\r\n  \"nylon\": {\r\n    width: 20,\r\n    height: 20,\r\n//\t\tlines: [[ 0,5, 0,0, 5,0 ],[ 5,10, 10,10, 10,5 ], [ 10,15, 10,20, 15,20 ],[ 15,10, 20,10, 20,15 ]],\r\n//\t\trepeat: [[0,0], [20,0], [0,20], [-20,0], [0,-20], [-20,-20]],\r\n    lines: [[ 1,6, 1,1, 6,1 ],[ 6,11, 11,11, 11,6 ], [ 11,16, 11,21, 16,21 ],[ 16,11, 21,11, 21,16 ]],\r\n    repeat: [[0,0], [-20,0], [0,-20] ],\r\n    stroke: 1\r\n  },\r\n  \"hexagon\": {\r\n    width: 20,\r\n    height: 12,\r\n    lines: [[ 0,10, 4,4, 10,4, 14,10, 10,16, 4,16, 0,10 ]],\r\n    stroke:1,\r\n    repeat:[[0,0],[10,6],[10,-6],[-10,-6]]\r\n  },\r\n  \"cemetry\": {\r\n    width:15,\r\n    height:19,\r\n    lines:[[0,3.5,7,3.5],[3.5,0,3.5,10],\r\n      //[7,12.5,14,12.5],[10.5,9,10.5,19]\r\n      ],\r\n    stroke:1,\r\n    repeat:[[0,0],[7,9]]\r\n  },\r\n  \"sand\": {\r\n    width: 20,\r\n    height: 20,\r\n    circles:[\r\n      [1,2,1],[9,3,1],[2,16,1],\r\n      [7,8,1],[6,14,1],[4,19,1],\r\n      [14,2,1],[12,10,1],[14,18,1],\r\n      [18,8,1],[18,14,1]\r\n    ],\r\n    fill:1\r\n  },\r\n  \"conglomerate\": {\r\n    width: 60,\r\n    height: 40,\r\n    circles:[[2,4,1],[17,3,1],[26,18,1],[12,17,1],[5,17,2],[28,11,2]],\r\n    lines:[[7,5, 6,7, 9,9, 11,8, 11,6, 9,5, 7,5], \r\n      [16,10, 15,13, 16,14, 19,15, 21,13, 22,9, 20,8, 19,8, 16,10], \r\n      [24,6, 26,7, 27,5, 26,4, 24,4, 24,6]],\r\n    repeat: [[30,0], [-15,20], [15,20], [45,20]],\r\n    stroke:1\r\n  },\r\n  \"conglomerate2\": {\r\n    width:60,\r\n    height:40,\r\n    circles:[[2,4,1],[17,3,1],[26,18,1],[12,17,1],[5,17,2],[28,11,2]],\r\n    lines:[\r\n      [7,5, 6,7, 9,9, 11,8, 11,6, 9,5, 7,5], \r\n      [16,10, 15,13, 16,14, 19,15, 21,13, 22,9, 20,8, 19,8, 16,10], \r\n      [24,6, 26,7, 27,5, 26,4, 24,4, 24,6]\r\n    ],\r\n    repeat: [[30,0], [-15,20], [15,20], [45,20]],\r\n    fill:1\r\n  },\r\n  \"gravel\": {\r\n    width:15,\r\n    height:10,\r\n    circles:[[4,2,1],[5,9,1],[1,7,1]],//[9,9,1],,[15,2,1]],\r\n    lines:[[7,5, 6,6, 7,7, 8,7, 9,7, 10,5, 9,4, 7,5], [11,2, 14,4, 14,1, 12,1, 11,2]],\r\n    stroke:1\r\n  },\r\n  \"brick\": {\r\n    width:18,\r\n    height:16,\r\n    lines:[\t[0,1,18,1],[0,10,18,10], [6,1,6,10],[12,10,12,18],[12,0,12,1]],\r\n    stroke:1\r\n  },\r\n  \"dolomite\": {\r\n    width:20,\r\n    height:16,\r\n    lines:[[0,1,20,1],[0,9,20,9],[1,9,6,1],[11,9,14,16],[14,0,14.4,1]],\r\n    stroke:1\r\n  },\r\n  \"coal\": {\r\n    width:20,\r\n    height:16,\r\n    lines:[[1,5, 7,1, 7,7], [11,10, 12,5, 18,9], [5,10, 2,15, 9,15,], [15,16, 15,13, 20,16], [15,0, 15,2, 20,0]],\r\n    fill:1\r\n  },\r\n  \"breccia\": {\r\n    width:20,\r\n    height:16,\r\n    lines:[[1,5, 7,1, 7,7, 1,5], [11,10, 12,5, 18,9, 11,10], [5,10, 2,15, 9,15, 5,10], [15,16, 15,13, 22,18], [15,0, 15,2, 20,0] ],\r\n    stroke:1,\r\n  },\r\n  \"clay\": {\r\n    width:20,\r\n    height:20,\r\n    lines:[[0,0, 3,11, 0,20], [11,0, 10,3, 13,13, 11,20], [0,0, 10,3, 20,0], [0,12, 3,11, 13,13, 20,12]],\r\n    stroke:1\r\n  },\r\n  \"flooded\": {\r\n    width:15,\r\n    height:10,\r\n    lines:[\t[0,1,10,1],[0,6,5,6], [10,6,15,6]],\r\n    stroke:1\r\n  },\r\n  \"chaos\": {\r\n    width:40,\r\n    height:40,\r\n    lines:[[40,2, 40,0, 38,0, 40,2], \r\n      [4,0, 3,2, 2,5, 0,0, 0,3, 2,7, 5,6, 7,7, 8,10, 9,12, 9,13, 9,14, 8,14, 6,15, 2,15, 0,20, 0,22, 2,20, 5,19, \r\n        8,15, 10,14, 11,12.25, 10,12, 10,10, 12,9, 13,7, 12,6, 13,4, 16,7, 17,4, 20,0, 18,0, 15,3, 14,2, 14,0,\r\n        12,1, 11,0, 10,1, 11,4, 10,7, 9,8, 8,5, 6,4, 5,3, 5,1, 5,0, 4,0],\r\n      [7,1, 7,3, 8,3, 8,2, 7,1], [4,3, 5,5, 4,5, 4,3], [34,5, 33,7, 38,10, 38,8, 36,5, 34,5], \r\n      [ 27,0, 23,2, 21,8, 30,0, 27,0], \r\n      [25,8, 26,12, 26,16, 22.71875,15.375, 20,13, 18,15, 17,18, 13,22, 17,21, 19,22, 21,20, 19,18, 22,17, 30,25, \r\n      26,26, 24,28, 21.75,33.34375, 20,36, 18,40, 20,40, 24,37, 25,32, 27,31, 26,38, 27,37, 30,32, 32,35, 36,37, \r\n      38,40, 38,39, 40,40, 37,36, 34,32, 37,31, 36,29, 33,27, 34,24, 39,21, 40,21, 40,16, 37,20, 31,22, 32,25, \r\n      27,20, 29,15, 30,20, 32,20, 34,18, 33,12, 31,11, 29,14, 26,9, 25,8], [39,24, 37,26, 40,28, 39,24], \r\n      [13,15, 9,19, 14,18, 13,15], [18,23, 14,27, 16,27, 17,25, 20,26, 18,23], \r\n      [6,24, 2,26, 1,28, 2,30, 5,28, 12,30, 16,32, 18,30, 15,30, 12,28, 9,25, 7,27, 6,24], \r\n      [29,27, 32,28, 33,31, 30,29, 27,28, 29,27], \r\n      [5,35, 1,33, 3,36, 13,38, 15,35, 10,36, 5,35]],\r\n    fill:1,\r\n  },\r\n  \"grass\": {\r\n    width:27,\r\n    height:22,\r\n    lines: [[0,10.5,13,10.5], [2.5,10,1.5,7], [4.5,10, 4.5,5, 3.5,4 ], [7,10, 7.5,6, 8.5,3], [10,10,11,6]],\r\n    repeat: [[0,0],[14,10]],\r\n    stroke:1\r\n  },\r\n  \"swamp\": {\r\n    width:24,\r\n    height:23,\r\n    lines:[ [0,10.5,9.5,10.5], [2.5,10,2.5,7], [4.5,10,4.5,4], [6.5,10,6.5,6], [3,12.5,7,12.5] ],\r\n    repeat: [[0,0],[14,10]],\r\n    stroke:1\r\n  },\r\n  \"reed\": {\r\n    width:26,\r\n    height:23,\r\n    lines:[ [2.5,10,2,7], [4.5,10,4.2,4], [6.5,10,6.8,4], [8.5,10,9,6],\r\n            [3.7,4,3.7,2.5], [4.7,4,4.7,2.5], [6.3,4,6.3,2.5], [7.3,4,7.3,2.5] ],\r\n    circles:[ [4.2,2.5,.5], [18.2,12.5,.5], [6.8,2.5,.5], [20.8,12.5,.5], [9,6,.5], [23,16,.5] ],\r\n    repeat: [[0,0],[14,10]],\r\n    stroke:1\r\n  },\r\n  \"wave\": {\r\n    width:10,\r\n    height:8,\r\n    lines:[ [0,0, 5,4, 10,0] ],\r\n    stroke:1\r\n  },\r\n  \"vine\": {\r\n    width:13,\r\n    height:13,\r\n    lines:[[3,0,3,6],[9,7,9,13]],\r\n    stroke:1.0\r\n  },\r\n  \"forest\": {\r\n    width:55,\r\n    height:30,\r\n    circles:[[7,7,3.5],[20,20,1.5],[42,22,3.5],[35,5,1.5]],\r\n    stroke:1\r\n  },\r\n  \"forest2\": {\r\n    width:55,\r\n    height:30,\r\n    circles:[[7,7,3.5],[20,20,1.5],[42,22,3.5],[35,5,1.5]],\r\n    fill:1,\r\n    stroke:1\r\n  },\r\n  \"scrub\": {\r\n    width:26,\r\n    height:20,\r\n    lines:[ [1,4, 4,8, 6,4] ],\r\n    circles:[[20,13,1.5]],\r\n    stroke:1,\r\n  },\r\n  \"tree\": {\r\n    width:30,\r\n    height:30,\r\n    lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,0.71,6.36,0,4.24,0.71,2.12,4.24,0,7.78,0.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78]],\r\n    repeat: [[3,1],[18,16]],\r\n    stroke:1\r\n  },\r\n  \"tree2\": {\r\n    width:30,\r\n    height:30,\r\n    lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,0.71,6.36,0,4.24,0.71,2.12,4.24,0,7.78,0.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61]],\r\n    repeat: [[3,1],[18,16]],\r\n    fill:1,\r\n    stroke:1\r\n  },\r\n  \"pine\": {\r\n    width:30,\r\n    height:30,\r\n    lines:[[5.66,11.31,2.83,11.31,2.83,8.49,0,8.49,2.83,0,5.66,8.49,2.83,8.49]],\r\n    repeat:[[3,1],[18,16]],\r\n    stroke:1\r\n  },\r\n  \"pine2\": {\r\n    width:30,\r\n    height:30,\r\n    lines:[[5.66,11.31,2.83,11.31,2.83,8.49,0,8.49,2.83,0,5.66,8.49,2.83,8.49,2.83,11.31,5.66,11.31]],\r\n    repeat:[[3,1],[18,16]],\r\n    fill:1,\r\n    stroke:1\r\n  },\r\n  \"mixtree\": {\r\n    width:30,\r\n    height:30,\r\n    lines:[\r\n      [7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,0.71,6.36,0,4.24,0.71,2.12,4.24,0,7.78,0.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61],\r\n      [23.66, 27.31, 20.83, 27.31, 20.83, 24.49, 18, 24.49, 20.83, 16, 23.66, 24.49, 20.83, 24.49, 20.83, 27.31, 23.66, 27.31]\r\n    ],\r\n    repeat: [[3,1]],\r\n    stroke:1\r\n  },\r\n  \"mixtree2\": {\r\n    width:30,\r\n    height:30,\r\n    lines:[\r\n      [7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,0.71,6.36,0,4.24,0.71,2.12,4.24,0,7.78,0.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61],\r\n      [23.66, 27.31, 20.83, 27.31, 20.83, 24.49, 18, 24.49, 20.83, 16, 23.66, 24.49, 20.83, 24.49, 20.83, 27.31, 23.66, 27.31]\r\n    ],\r\n    repeat: [[3,1]],\r\n    fill:1,\r\n    stroke:1\r\n  },\r\n  \"pines\": {\r\n    width:22,\r\n    height:20,\r\n    lines:[[1,4,3.5,1,6,4],[1,8,3.5,5,6,8],[3.5,1,3.5,11],[12,14.5,14.5,14,17,14.5],[12,18,17,18],[14.5,12,14.5,18]],\r\n    repeat: [[2,1]],\r\n    stroke:1\r\n  },\r\n  \"rock\": {\r\n    width:20,\r\n    height:20,\r\n    lines:[\t[1,0,1,9],[4,0,4,9],[7,0,7,9], \r\n        [10,1,19,1],[10,4,19,4],[10,7,19,7],\r\n        [0,11,9,11],[0,14,9,14],[0,17,9,17], \r\n        [12,10,12,19],[15,10,15,19],[18,10,18,19] ],\r\n    repeat:[[0.5,0.5]],\r\n    stroke:1\r\n  },\r\n  \"rocks\": {\r\n    width:20,\r\n    height:20,\r\n    lines:[\t[5,0, 3,0, 5,4, 4,6, 0,3, 0,5, 3,6, 5,9, 3.75,10, 2.5,10, 0,9, 0,10, 4,11, 5,14, 4,15, 0,13,\r\n      0,13, 0,13, 0,14, 0,14, 5,16, 5,18, 3,19, 0,19, -0.25,19.9375, 5,20, 10,19, 10,20, 11,20, 12,19,\r\n      14,20, 15,20, 17,19, 20,20, 20,19, 19,16, 20,15, 20,11, 20,10, 19,8, 20,5, 20,0, 19,0, 20,2, 19,4,\r\n      17,4, 16,3, 15,0, 14,0, 15,4, 11,5, 10,4, 11,0, 10,0, 9,4, 6,5, 5,0,],\r\n      [18,5, 19,6, 18,10, 16,10, 14,9, 16,5, 18,5], \r\n      [5,6, 9,5, 10,6, 10,9, 6,10, 5,6], \r\n      [14,5, 14,8, 13,9, 12,9, 11,7, 12,5, 14,5], \r\n      [ 5,11, 8,10, 9,11, 10,14, 6,15, 6,15, 5,11], \r\n      [13,10, 14,11, 15,14, 15,14, 15,14, 11,15, 10,11, 11,10, 13,10], \r\n      [15,12, 16,11, 19,11, 19,15, 16,14, 16,14, 15,12], \r\n      [6,16, 9,15, 10,18, 5,19, 6,16], \r\n      [10,16, 14,16, 14,18, 13,19, 11,18, 10,16], \r\n      [15,15, 18,16, 18,18, 16,19, 15,18, 15,15]],\r\n    stroke:1\r\n  }\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Flow line style\r\n * Draw LineString with a variable color / width\r\n * NB: the FlowLine style doesn't impress the hit-detection.\r\n * If you want your lines to be sectionable you have to add your own style to handle this.\r\n * (with transparent line: stroke color opacity to .1 or zero width)\r\n * @constructor\r\n * @extends {ol.style.Style}\r\n * @param {Object} options\r\n *  @param {boolean} options.visible draw only the visible part of the line, default true\r\n *  @param {number|function} options.width Stroke width or a function that gets a feature and the position (beetween [0,1]) and returns current width\r\n *  @param {number} options.width2 Final stroke width (if width is not a function)\r\n *  @param {number} options.arrow Arrow at start (-1), at end (1), at both (2), none (0), default geta\r\n *  @param {ol.colorLike|function} options.color Stroke color or a function that gets a feature and the position (beetween [0,1]) and returns current color\r\n *  @param {ol.colorLike} options.color2 Final sroke color if color is nor a function\r\n *  @param {ol.colorLike} options.arrowColor Color of arrows, if not defined used color or color2\r\n *  @param {string} options.lineCap CanvasRenderingContext2D.lineCap 'butt' | 'round' | 'square', default 'butt'\r\n *  @param {number|ol.size} options.arrowSize height and width of the arrow, default 16\r\n *  @param {boolean} [options.noOverlap=false] prevent segments overlaping\r\n *  @param {number} options.offset0 offset at line start\r\n *  @param {number} options.offset1 offset at line end\r\n */\r\nol.style.FlowLine = function(options) {\r\n  if (!options) options = {};\r\n  ol.style.Style.call (this, { \r\n    renderer: this._render.bind(this),\r\n    stroke: options.stroke,\r\n    text: options.text,\r\n    zIndex: options.zIndex,\r\n    geometry: options.geometry\r\n  });\r\n  // Draw only visible\r\n  this._visible = (options.visible !== false);\r\n  // Width\r\n  if (typeof options.width === 'function') {\r\n    this._widthFn = options.width;\r\n  } else {\r\n    this.setWidth(options.width);\r\n  }\r\n  this.setWidth2(options.width2);\r\n  // Color\r\n  if (typeof options.color === 'function') {\r\n    this._colorFn = options.color;\r\n  } else {\r\n    this.setColor(options.color);\r\n  }\r\n  this.setColor2(options.color2);\r\n  // LineCap\r\n  this.setLineCap(options.lineCap);\r\n  // Arrow\r\n  this.setArrow(options.arrow);\r\n  this.setArrowSize(options.arrowSize);\r\n  this.setArrowColor(options.arrowColor);\r\n  // Offset\r\n  this._offset = [0,0];\r\n  this.setOffset(options.offset0, 0);\r\n  this.setOffset(options.offset1, 1);\r\n  // Overlap\r\n  this._noOverlap = options.noOverlap;\r\n};\r\nol.ext.inherits(ol.style.FlowLine, ol.style.Style);\r\n/** Set the initial width\r\n * @param {number} width width, default 0\r\n */\r\nol.style.FlowLine.prototype.setWidth = function(width) {\r\n  this._width = width || 0;\r\n};\r\n/** Set the final width\r\n * @param {number} width width, default 0\r\n */\r\nol.style.FlowLine.prototype.setWidth2 = function(width) {\r\n  this._width2 = width;\r\n};\r\n/** Get offset at start or end\r\n * @param {number} where 0=start, 1=end\r\n * @return {number} width\r\n */\r\nol.style.FlowLine.prototype.getOffset = function(where) {\r\n  return this._offset[where];\r\n};\r\n/** Add an offset at start or end\r\n * @param {number} width\r\n * @param {number} where 0=start, 1=end\r\n */\r\nol.style.FlowLine.prototype.setOffset = function(width, where) {\r\n  width = Math.max(0, parseFloat(width));\r\n  switch(where) {\r\n    case 0: {\r\n      this._offset[0] = width;\r\n      break;\r\n    }\r\n    case 1: {\r\n      this._offset[1] = width;\r\n      break;\r\n    }\r\n  }\r\n};\r\n/** Set the LineCap\r\n * @param {steing} cap LineCap (round or butt), default butt\r\n */\r\nol.style.FlowLine.prototype.setLineCap = function(cap) {\r\n  this._lineCap = (cap==='round' ? 'round' : 'butt');\r\n};\r\n/** Get the current width at step\r\n * @param {ol.feature} feature\r\n * @param {number} step current drawing step beetween [0,1] \r\n * @return {number} \r\n */\r\nol.style.FlowLine.prototype.getWidth = function(feature, step) {\r\n  if (this._widthFn) return this._widthFn(feature, step);\r\n  var w2 = (typeof(this._width2) === 'number') ? this._width2 : this._width;\r\n  return this._width + (w2-this._width) * step;\r\n};\r\n/** Set the initial color\r\n * @param {ol.colorLike} color\r\n */\r\nol.style.FlowLine.prototype.setColor = function(color) {\r\n  try{\r\n    this._color = ol.color.asArray(color);\r\n  } catch(e) {\r\n    this._color = [0,0,0,1];\r\n  }\r\n};\r\n/** Set the final color\r\n * @param {ol.colorLike} color\r\n */\r\nol.style.FlowLine.prototype.setColor2 = function(color) {\r\n  try {\r\n    this._color2 = ol.color.asArray(color);\r\n  } catch(e) {\r\n    this._color2 = null;    \r\n  }\r\n};\r\n/** Set the arrow color\r\n * @param {ol.colorLike} color\r\n */\r\nol.style.FlowLine.prototype.setArrowColor = function(color) {\r\n  try {\r\n    this._acolor = ol.color.asString(color);\r\n  } catch(e) {\r\n    this._acolor = null;    \r\n  }\r\n};\r\n/** Get the current color at step\r\n * @param {ol.feature} feature\r\n * @param {number} step current drawing step beetween [0,1] \r\n * @return {string} \r\n */\r\nol.style.FlowLine.prototype.getColor = function(feature, step) {\r\n  if (this._colorFn) return ol.color.asString(this._colorFn(feature, step));\r\n  var color = this._color;\r\n  var color2 = this._color2 || this._color\r\n  return 'rgba('+\r\n          + Math.round(color[0] + (color2[0]-color[0]) * step) +','\r\n          + Math.round(color[1] + (color2[1]-color[1]) * step) +','\r\n          + Math.round(color[2] + (color2[2]-color[2]) * step) +','\r\n          + (color[3] + (color2[3]-color[3]) * step)\r\n          +')';\r\n};\r\n/** Get arrow\r\n */\r\nol.style.FlowLine.prototype.getArrow = function() {\r\n  return this._arrow;\r\n};\r\n/** Set arrow\r\n * @param {number} n -1 | 0 | 1 | 2, default: 0\r\n */\r\nol.style.FlowLine.prototype.setArrow = function(n) {\r\n  this._arrow = parseInt(n);\r\n  if (this._arrow < -1 || this._arrow > 2) this._arrow = 0;\r\n}\r\n/** getArrowSize\r\n * @return {ol.size}\r\n */\r\nol.style.FlowLine.prototype.getArrowSize = function() {\r\n  return this._arrowSize || [16,16];\r\n};\r\n/** setArrowSize\r\n * @param {number|ol.size} size\r\n */\r\nol.style.FlowLine.prototype.setArrowSize = function(size) {\r\n  if (Array.isArray(size)) this._arrowSize = size;\r\n  else if (typeof(size) === 'number') this._arrowSize = [size,size];\r\n};\r\n/** drawArrow\r\n * @param {CanvasRenderingContext2D} ctx \r\n * @param {ol.coordinate} p0 \r\n * @param ol.coordinate} p1 \r\n * @param {number} width \r\n * @param {number} ratio pixelratio\r\n * @private\r\n */\r\nol.style.FlowLine.prototype.drawArrow = function (ctx, p0, p1, width, ratio) {\r\n  var asize = this.getArrowSize()[0] * ratio;\r\n  var l = ol.coordinate.dist2d(p0, p1);\r\n  var dx = (p0[0]-p1[0])/l;\r\n  var dy = (p0[1]-p1[1])/l;\r\n  width = Math.max(this.getArrowSize()[1]/2, width/2) * ratio;\r\n  ctx.beginPath();\r\n  ctx.moveTo(p0[0],p0[1]);\r\n  ctx.lineTo(p0[0]-asize*dx+width*dy, p0[1]-asize*dy-width*dx);\r\n  ctx.lineTo(p0[0]-asize*dx-width*dy, p0[1]-asize*dy+width*dx);\r\n  ctx.lineTo(p0[0],p0[1]);\r\n  ctx.fill();\r\n};\r\n/** Renderer function\r\n * @param {Array<ol.coordinate>} geom The pixel coordinates of the geometry in GeoJSON notation\r\n * @param {ol.render.State} e The olx.render.State of the layer renderer\r\n */\r\nol.style.FlowLine.prototype._render = function(geom, e) {\r\n  if (e.geometry.getType()==='LineString') {\r\n    var i, g, p, ctx = e.context;\r\n    // Get geometry used at drawing\r\n    if (!this._visible) {\r\n      var a = e.pixelRatio / e.resolution;\r\n      var cos = Math.cos(e.rotation)\r\n      var sin = Math.sin(e.rotation)\r\n      g = e.geometry.getCoordinates();\r\n      var dx = geom[0][0] - g[0][0] * a *cos - g[0][1] * a *sin ;\r\n      var dy = geom[0][1] - g[0][0] * a * sin + g[0][1] * a * cos;\r\n      geom = [];\r\n      for (i=0; p=g[i]; i++) {\r\n        geom[i] = [\r\n          dx + p[0] * a * cos + p[1] * a * sin,\r\n          dy + p[0] * a * sin - p[1] * a * cos,\r\n          p[2]\r\n        ];\r\n      }\r\n    }\r\n    var asize = this.getArrowSize()[0] * e.pixelRatio;\r\n    ctx.save();\r\n      // Offsets\r\n      if (this.getOffset(0)) this._splitAsize(geom, this.getOffset(0) * e.pixelRatio)\r\n      if (this.getOffset(1)) this._splitAsize(geom, this.getOffset(1) * e.pixelRatio, true)\r\n      // Arrow 1\r\n      if (geom.length>1 && (this.getArrow()===-1 || this.getArrow()===2)) {\r\n        p = this._splitAsize(geom, asize);\r\n        if (this._acolor) ctx.fillStyle = this._acolor;\r\n        else ctx.fillStyle = this.getColor(e.feature, 0);\r\n        this.drawArrow(ctx, p[0], p[1], this.getWidth(e.feature, 0), e.pixelRatio);\r\n      }\r\n      // Arrow 2 \r\n      if (geom.length>1 && this.getArrow()>0) {\r\n        p = this._splitAsize(geom, asize, true);\r\n        if (this._acolor) ctx.fillStyle = this._acolor;\r\n        else ctx.fillStyle = this.getColor(e.feature, 1);\r\n        this.drawArrow(ctx, p[0], p[1], this.getWidth(e.feature, 1), e.pixelRatio);\r\n      }\r\n      // Split into\r\n      var geoms = this._splitInto(geom, 255, 2);\r\n      var k = 0;\r\n      var nb = geoms.length;\r\n      // Draw\r\n      ctx.lineJoin = 'round';\r\n      ctx.lineCap = this._lineCap || 'butt';\r\n      if (geoms.length > 1) {\r\n        for (k=0; k<geoms.length; k++) {\r\n          var step = k/nb;\r\n          g = geoms[k];\r\n          ctx.lineWidth = this.getWidth(e.feature, step) * e.pixelRatio;\r\n          ctx.strokeStyle = this.getColor(e.feature, step);\r\n          ctx.beginPath();\r\n          ctx.moveTo(g[0][0],g[0][1]);\r\n          for (i=1; p=g[i]; i++) {\r\n            ctx.lineTo(p[0],p[1]);\r\n          }\r\n          ctx.stroke();\r\n        }\r\n      }\r\n    ctx.restore();\r\n  }\r\n};\r\n/** Split extremity at\r\n * @param {ol.geom.LineString} geom\r\n * @param {number} asize\r\n * @param {boolean} end start=false or end=true, default false (start)\r\n */\r\nol.style.FlowLine.prototype._splitAsize = function(geom, asize, end) {\r\n  var p, p1, p0;\r\n  var dl, d = 0;\r\n  if (end) p0 = geom.pop();\r\n  else p0 = geom.shift();\r\n  p = p0;\r\n  while(geom.length) {\r\n    if (end) p1 = geom.pop();\r\n    else p1 = geom.shift();\r\n    dl = ol.coordinate.dist2d(p,p1);\r\n    if (d+dl > asize) {\r\n      p = [p[0]+(p1[0]-p[0])*(asize-d)/dl, p[1]+(p1[1]-p[1])*(asize-d)/dl];\r\n      dl = ol.coordinate.dist2d(p,p0);\r\n      if (end) {\r\n        geom.push(p1);\r\n        geom.push(p);\r\n        geom.push([p[0]+(p0[0]-p[0])/dl, p[1]+(p0[1]-p[1])/dl]);\r\n      } else {\r\n        geom.unshift(p1);\r\n        geom.unshift(p);\r\n        geom.unshift([p[0]+(p0[0]-p[0])/dl, p[1]+(p0[1]-p[1])/dl]);\r\n      }\r\n      break;\r\n    }\r\n    d += dl;\r\n    p = p1;\r\n  }\r\n  return [p0,p];\r\n};\r\n/** Split line geometry into equal length geometries\r\n * @param {Array<ol.coordinate>} geom\r\n * @param {number} nb number of resulting geometries, default 255\r\n * @param {number} nim minimum length of the resulting geometries, default 1\r\n */\r\nol.style.FlowLine.prototype._splitInto = function(geom, nb, min) {\r\n  var i, p;\r\n  var dt = this._noOverlap ? 1 : .9;\r\n  // Split geom into equal length geoms\r\n  var geoms = [];\r\n  var dl, l = 0;\r\n  for (i=1; p=geom[i]; i++) {\r\n    l += ol.coordinate.dist2d(geom[i-1], p);\r\n  }\r\n  var length = Math.max (min||2, l/(nb||255));\r\n  var p0 = geom[0];\r\n  l = 0;\r\n  var g = [p0];\r\n  i = 1;\r\n  p = geom[1];\r\n  while (i < geom.length) {\r\n    var dx = p[0]-p0[0];\r\n    var dy = p[1]-p0[1];\r\n    dl = Math.sqrt(dx*dx + dy*dy);\r\n    if (l+dl > length) {\r\n      var d = (length-l) / dl;\r\n      g.push([ \r\n        p0[0] + dx * d,  \r\n        p0[1] + dy * d \r\n      ]);\r\n      geoms.push(g);\r\n      p0 =[ \r\n        p0[0] + dx * d*dt,  \r\n        p0[1] + dy * d*dt\r\n      ];\r\n      g = [p0];\r\n      l = 0;\r\n    } else {\r\n      l += dl;\r\n      p0 = p;\r\n      g.push(p0);\r\n      i++;\r\n      p = geom[i];\r\n    }\r\n  }\r\n  geoms.push(g);\r\n  return geoms;\r\n}\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc\r\n * A marker style to use with font symbols.\r\n *\r\n * @constructor\r\n * @param {} options Options.\r\n *  @param {string} [options.color] default #000\r\n *  @param {string} options.glyph the glyph name or a char to display as symbol. \r\n *    The name must be added using the {@link ol.style.FontSymbol.addDefs} function.\r\n *  @param {string} [options.text] a text to display as a glyph\r\n *  @param {string} [options.font] font to use with the text option\r\n *  @param {string} options.form \r\n * \t  none|circle|poi|bubble|marker|coma|shield|blazon|bookmark|hexagon|diamond|triangle|sign|ban|lozenge|square\r\n * \t  a form that will enclose the glyph, default none\r\n *  @param {number} options.radius\r\n *  @param {number} options.rotation\r\n *  @param {boolean} options.rotateWithView\r\n *  @param {number} [options.opacity=1]\r\n *  @param {number} [options.fontSize=1] default 1\r\n *  @param {string} [options.fontStyle] the font style (bold, italic, bold italic, etc), default none\r\n *  @param {boolean} options.gradient true to display a gradient on the symbol\r\n *  @param {number} [options.offsetX=0] default 0\r\n *  @param {number} [options.offsetY=0] default 0\r\n *  @param {_ol_style_Fill_} options.fill\r\n *  @param {_ol_style_Stroke_} options.stroke\r\n * @extends {ol.style.RegularShape}\r\n * @implements {ol.structs.IHasChecksum}\r\n * @api\r\n */\r\nol.style.FontSymbol = function(options) {\r\n  options = options || {};\r\n  var strokeWidth = 0;\r\n  if (options.stroke) {\r\n    strokeWidth = options.stroke.getWidth();\r\n  }\r\n  ol.style.RegularShape.call (this, { \r\n    radius: options.radius, \r\n    fill:options.fill,\r\n    rotation:options.rotation, \r\n    rotateWithView: options.rotateWithView \r\n  });\r\n  if (typeof(options.opacity)==\"number\") this.setOpacity(options.opacity);\r\n  this.color_ = options.color;\r\n  this.fontSize_ = options.fontSize || 1;\r\n  this.fontStyle_ = options.fontStyle || '';\r\n  this.stroke_ = options.stroke;\r\n  this.fill_ = options.fill;\r\n  this.radius_ = options.radius -strokeWidth;\r\n  this.form_ = options.form || \"none\";\r\n  this.gradient_ = options.gradient;\r\n  this.offset_ = [options.offsetX ? options.offsetX :0, options.offsetY ? options.offsetY :0];\r\n  if (options.glyph) this.glyph_ = this.getGlyph(options.glyph);\r\n  else this.glyph_ = this.getTextGlyph(options.text||'', options.font);\r\n  this.renderMarker_();\r\n};\r\nol.ext.inherits(ol.style.FontSymbol, ol.style.RegularShape);\r\n/** Cool stuff to get the image symbol for a style\r\n */\r\nol.style.Image.prototype.getImagePNG = function() {\r\n  var canvas = this.getImage();\r\n  if (canvas) {\r\n    try { return canvas.toDataURL(\"image/png\"); }\r\n    catch(e) { return false; }\r\n  } else {\r\n    return false;\r\n  }\r\n}\r\n/** Font defs\r\n */\r\nol.style.FontSymbol.prototype.defs = { 'fonts':{}, 'glyphs':{} };\r\n/** Static function : add new font defs \r\n * @param {String|Object} font the font desciption\r\n * @param {} glyphs a key / value list of glyph definitions. \r\n * \t\tEach key is the name of the glyph, \r\n * \t\tthe value is an object that code the font, the caracter code, \r\n * \t\tthe name and a search string for the glyph.\r\n */\r\nol.style.FontSymbol.addDefs = function(font, glyphs) {\r\n  var thefont = font;\r\n  if (typeof(font) == 'string') thefont = { font:font, name:font, copyright:'' };\r\n  if (!thefont.font || typeof(thefont.font) !== 'string') {\r\n    console.log('bad font def');\r\n    return;\r\n  }\r\n  var fontname = thefont.font;\r\n  ol.style.FontSymbol.prototype.defs.fonts[fontname] = thefont;\r\n  for (var i in glyphs) {\r\n    var g = glyphs[i];\r\n    if (typeof(g) === 'string' && g.length==1) g = { char: g };\r\n    ol.style.FontSymbol.prototype.defs.glyphs[i] = {\r\n      font: thefont.font,\r\n      char: g.char || ''+String.fromCharCode(g.code) || '',\r\n      theme: g.theme || thefont.name,\r\n      name: g.name || i,\r\n      search: g.search || ''\r\n    };\r\n  }\r\n};\r\n/** Clones the style. \r\n * @return {ol.style.FontSymbol}\r\n */\r\nol.style.FontSymbol.prototype.clone = function() {\r\n  var g = new ol.style.FontSymbol({\r\n    glyph: '',\r\n    color: this.color_,\r\n    fontSize: this.fontSize_,\r\n    fontStyle: this.fontStyle_,\r\n    stroke: this.stroke_,\r\n    fill: this.fill_,\r\n    radius: this.radius_ + (this.stroke_ ? this.stroke_.getWidth():0),\r\n    form: this.form_,\r\n    gradient: this.gradient_,\r\n    offsetX: this.offset_[0],\r\n    offsetY: this.offset_[1],\r\n    opacity: this.getOpacity(),\r\n    rotation: this.getRotation(),\r\n    rotateWithView: this.getRotateWithView()\r\n  });\r\n  g.setScale(this.getScale());\r\n  g.glyph_ = this.glyph_;\r\n  g.renderMarker_();\r\n  return g;\r\n};\r\n/** Get the fill style for the symbol.\r\n * @return {ol.style.Fill} Fill style.\r\n * @api\r\n */\r\nol.style.FontSymbol.prototype.getFill = function() {\r\n  return this.fill_;\r\n};\r\n/** Get the stroke style for the symbol.\r\n * @return {_ol_style_Stroke_} Stroke style.\r\n * @api\r\n */\r\nol.style.FontSymbol.prototype.getStroke = function() {\r\n  return this.stroke_;\r\n};\r\n/** Get the glyph definition for the symbol.\r\n * @param {string|undefined} name a glyph name to get the definition, default return the glyph definition for the style.\r\n * @return {*}\r\n * @api\r\n */\r\nol.style.FontSymbol.prototype.getGlyph = function(name) {\r\n  if (name) return ol.style.FontSymbol.prototype.defs.glyphs[name] || { font:'sans-serif', char:name.charAt(0), theme:'none', name:'none', search:'' };\r\n  else return this.glyph_;\r\n};\r\n/** Get glyph definition given a text and a font\r\n * @param {string|undefined} text\r\n * @param {string} [font] the font for the text\r\n * @return {*}\r\n * @api\r\n */\r\nol.style.FontSymbol.prototype.getTextGlyph = function(text, font) {\r\n  return { font: font || 'sans-serif', char:String(text), theme:'none', name:'none', search:'' };\r\n};\r\n/**\r\n * Get the glyph name.\r\n * @return {string} the name\r\n * @api\r\n */\r\nol.style.FontSymbol.prototype.getGlyphName = function() {\r\n  for (var i in ol.style.FontSymbol.prototype.defs.glyphs) {\r\n    if (ol.style.FontSymbol.prototype.defs.glyphs[i] === this.glyph_) return i;\r\n  }\r\n  return '';\r\n};\r\n/**\r\n * Get the stroke style for the symbol.\r\n * @return {_ol_style_Stroke_} Stroke style.\r\n * @api\r\n */\r\nol.style.FontSymbol.prototype.getFontInfo = function(glyph) {\r\n  return ol.style.FontSymbol.prototype.defs.fonts[glyph.font];\r\n}\r\n/** @private\r\n */\r\nol.style.FontSymbol.prototype.renderMarker_ = function(pixelratio) {\r\n  if (!pixelratio) {\r\n    if (this.getPixelRatio) {\r\n      pixelratio = window.devicePixelRatio;\r\n      this.renderMarker_(pixelratio);\r\n      if (this.getPixelRatio && pixelratio!==1) this.renderMarker_(1); \r\n    } else {\r\n      this.renderMarker_(1);\r\n    }\r\n    return;\r\n  }\r\n  var strokeStyle;\r\n  var strokeWidth = 0;\r\n  if (this.stroke_) {\r\n    strokeStyle = ol.color.asString(this.stroke_.getColor());\r\n    strokeWidth = this.stroke_.getWidth();\r\n  }\r\n  // get canvas\r\n  var canvas = this.getImage(pixelratio);\r\n  //console.log(this.getImage().width+\" / \"+(2 * (this.radius_ + strokeWidth) + 1));\r\n  /** @type {ol.style.FontSymbol.RenderOptions} */\r\n  var renderOptions = {\r\n    strokeStyle: strokeStyle,\r\n    strokeWidth: strokeWidth,\r\n    size: canvas.width/pixelratio,\r\n  };\r\n  // draw the circle on the canvas\r\n  var context = (canvas.getContext('2d'));\r\n  context.clearRect(0, 0, canvas.width, canvas.height);\r\n  this.drawMarker_(renderOptions, context, 0, 0, pixelratio);\r\n  // Set Anchor\r\n  var a = this.getAnchor();\r\n  a[0] = canvas.width / 2 - this.offset_[0];\r\n  a[1] = canvas.width / 2 - this.offset_[1];\r\n  //this.createMarkerHitDetectionCanvas_(renderOptions);\r\n};\r\n/**\r\n * @private\r\n * @param {ol.style.FontSymbol.RenderOptions} renderOptions\r\n * @param {CanvasRenderingContext2D} context\r\n */\r\nol.style.FontSymbol.prototype.drawPath_ = function(renderOptions, context) {\r\n  var s = 2*this.radius_+renderOptions.strokeWidth+1;\r\n  var w = renderOptions.strokeWidth/2;\r\n  var c = renderOptions.size / 2;\r\n  // Transfo to place the glyph at the right place\r\n  var transfo = { fac:1, posX:renderOptions.size / 2, posY:renderOptions.size / 2 };\r\n  context.lineJoin = 'round';\r\n  context.beginPath();\r\n  // Draw the path with the form\r\n  switch (this.form_) {\r\n    case \"none\": {\r\n      transfo.fac=1;  \r\n      break;\r\n    }\r\n    case \"circle\":\r\n    case \"ban\": {\r\n      context.arc ( c, c, s/2, 0, 2 * Math.PI, true);\r\n      break;\r\n    }\r\n    case \"poi\": {\r\n      context.arc ( c, c -0.4*this.radius_, 0.6*this.radius_, 0.15*Math.PI, 0.85*Math.PI, true);\r\n      context.lineTo ( c-0.89*0.05*s, (0.95+0.45*0.05)*s+w);\r\n      context.arc ( c, 0.95*s+w, 0.05*s, 0.85*Math.PI, 0.15*Math.PI, true);\r\n      transfo = { fac:0.45, posX:c, posY:c -0.35*this.radius_ };\r\n      break;\r\n    }\r\n    case \"bubble\": {\r\n      context.arc ( c, c -0.2*this.radius_, 0.8*this.radius_, 0.4*Math.PI, 0.6*Math.PI, true);\r\n      context.lineTo ( 0.5*s+w, s+w);\r\n      transfo = { fac:0.7, posX:c, posY:c -0.2*this.radius_ };\r\n      break;\r\n    }\r\n    case \"marker\": {\r\n      context.arc ( c, c -0.2*this.radius_, 0.8*this.radius_, 0.25*Math.PI, 0.75*Math.PI, true);\r\n      context.lineTo ( 0.5*s+w, s+w);\r\n      transfo = { fac:0.7, posX: c, posY: c -0.2*this.radius_ };\r\n      break;\r\n    }\r\n    case \"coma\": {\r\n      context.moveTo ( c + 0.8*this.radius_, c -0.2*this.radius_);\r\n      context.quadraticCurveTo ( 0.95*s+w, 0.75*s+w, 0.5*s+w, s+w);\r\n      context.arc ( c, c -0.2*this.radius_, 0.8*this.radius_, 0.45*Math.PI, 0, false);\r\n      transfo = { fac:0.7, posX: c, posY: c -0.2*this.radius_ };\r\n      break;\r\n    }\r\n    default: {\r\n      var pts;\r\n      switch (this.form_) {\r\n        case \"shield\": {\r\n          pts = [ 0.05,0, 0.95,0, 0.95,0.8, 0.5,1, 0.05,0.8, 0.05,0 ]; \r\n          transfo.posY = 0.45*s+w ;\r\n          break;\r\n        }\r\n        case \"blazon\": {\r\n          pts = [ 0.1,0, 0.9,0, 0.9,0.8, 0.6,0.8, 0.5,1, 0.4,0.8, 0.1,0.8, 0.1,0 ]; \r\n          transfo.fac = 0.8;\r\n          transfo.posY = 0.4*s+w ;\r\n          break;\r\n        }\r\n        case \"bookmark\": {\r\n          pts = [ 0.05,0, 0.95,0, 0.95,1, 0.5,0.8, 0.05,1, 0.05,0 ]; \r\n          transfo.fac = 0.9;\r\n          transfo.posY = 0.4*s+w ;\r\n          break;\r\n        }\r\n        case \"hexagon\": {\r\n          pts = [ 0.05,0.2, 0.5,0, 0.95,0.2, 0.95,0.8, 0.5,1, 0.05,0.8, 0.05,0.2 ]; \r\n          transfo.fac = 0.9;\r\n          transfo.posY = 0.5*s+w ;\r\n          break;\r\n        }\r\n        case \"diamond\": {\r\n          pts = [ 0.25,0, 0.75,0, 1,0.2, 1,0.4, 0.5,1, 0,0.4, 0,0.2, 0.25,0 ]; \r\n          transfo.fac = 0.75 ;\r\n          transfo.posY = 0.35*s+w ;\r\n          break;\r\n        }\r\n        case \"triangle\": {\r\n          pts = [ 0,0, 1,0, 0.5,1, 0,0 ]; \r\n          transfo.fac = 0.6 ;\r\n          transfo.posY = 0.3*s+w ;\r\n          break;\r\n        }\r\n        case \"sign\": {\r\n          pts = [ 0.5,0.05, 1,0.95, 0,0.95, 0.5,0.05 ]; \r\n          transfo.fac = 0.7 ;\r\n          transfo.posY = 0.65*s+w ;\r\n          break;\r\n        }\r\n        case \"lozenge\": {\r\n          pts = [ 0.5,0, 1,0.5, 0.5,1, 0,0.5, 0.5,0 ]; \r\n          transfo.fac = 0.7;\r\n          break;\r\n        }\r\n        case \"square\": \r\n        default: {\r\n          pts = [ 0,0, 1,0, 1,1, 0,1, 0,0 ]; \r\n          break;\r\n        }\r\n      }\r\n      for (var i=0; i<pts.length; i+=2) context.lineTo ( pts[i]*s+w, pts[i+1]*s+w);\r\n    }\r\n  }\r\n  context.closePath();\r\n  return transfo;\r\n}\r\n/**\r\n * @private\r\n * @param {ol.style.FontSymbol.RenderOptions} renderOptions\r\n * @param {CanvasRenderingContext2D} context\r\n * @param {number} x The origin for the symbol (x).\r\n * @param {number} y The origin for the symbol (y).\r\n */\r\nol.style.FontSymbol.prototype.drawMarker_ = function(renderOptions, context, x, y, pixelratio) {\r\n  var fcolor = this.fill_ ? this.fill_.getColor() : \"#000\";\r\n  var scolor = this.stroke_ ? this.stroke_.getColor() : \"#000\";\r\n  if (this.form_ == \"none\" && this.stroke_ && this.fill_) {\r\n    scolor = this.fill_.getColor();\r\n    fcolor = this.stroke_.getColor();\r\n  }\r\n  // reset transform\r\n  context.setTransform(pixelratio, 0, 0, pixelratio, 0, 0);\r\n  // then move to (x, y)\r\n  context.translate(x, y);\r\n  var tr = this.drawPath_(renderOptions, context, pixelratio);\r\n  if (this.fill_) {\r\n    if (this.gradient_ && this.form_!=\"none\") {\r\n      var grd = context.createLinearGradient(0,0,renderOptions.size/2,renderOptions.size);\r\n      grd.addColorStop (1, ol.color.asString(fcolor));\r\n      grd.addColorStop (0, ol.color.asString(scolor));\r\n      context.fillStyle = grd;\r\n    } else {\r\n      context.fillStyle = ol.color.asString(fcolor);\r\n    }\r\n    context.fill();\r\n  }\r\n  if (this.stroke_ && renderOptions.strokeWidth) {\r\n    context.strokeStyle = renderOptions.strokeStyle;\r\n    context.lineWidth = renderOptions.strokeWidth;\r\n    context.stroke();\r\n  }\r\n  // Draw the symbol\r\n  if (this.glyph_.char) {\r\n    context.font = this.fontStyle_ +' '\r\n      + (2*tr.fac*(this.radius_)*this.fontSize_)+\"px \"\r\n      + this.glyph_.font;\r\n    context.strokeStyle = context.fillStyle;\r\n    context.lineWidth = renderOptions.strokeWidth * (this.form_ == \"none\" ? 2:1);\r\n    context.fillStyle = ol.color.asString(this.color_ || scolor);\r\n    context.textAlign = \"center\";\r\n    context.textBaseline = \"middle\";\r\n    var t = this.glyph_.char;\r\n    if (renderOptions.strokeWidth && scolor!=\"transparent\") context.strokeText(t, tr.posX, tr.posY);\r\n    context.fillText(t, tr.posX, tr.posY);\r\n  }\r\n  if (this.form_==\"ban\" && this.stroke_ && renderOptions.strokeWidth) {\r\n    context.strokeStyle = renderOptions.strokeStyle;\r\n    context.lineWidth = renderOptions.strokeWidth;\r\n    var r = this.radius_ + renderOptions.strokeWidth;\r\n    var d = this.radius_ * Math.cos(Math.PI/4);\r\n    context.moveTo(r + d, r - d);\r\n    context.lineTo(r - d, r + d);\r\n    context.stroke();\r\n  }\r\n};\r\n/**\r\n * @inheritDoc\r\n */\r\nol.style.FontSymbol.prototype.getChecksum = function() {\r\n  var strokeChecksum = (this.stroke_!==null) ? this.stroke_.getChecksum() : '-';\r\n  var fillChecksum = (this.fill_!==null) ? this.fill_.getChecksum() : '-';\r\n  var recalculate = (this.checksums_===null)\r\n    || (strokeChecksum != this.checksums_[1] \r\n    || fillChecksum != this.checksums_[2] \r\n    || this.radius_ != this.checksums_[3] \r\n    || this.form_+\"-\"+this.glyphs_ != this.checksums_[4]\r\n  );\r\n  if (recalculate) {\r\n    var checksum = 'c' + strokeChecksum + fillChecksum \r\n      + ((this.radius_ !== void 0) ? this.radius_.toString() : '-')\r\n      + this.form_+\"-\"+this.glyphs_;\r\n    this.checksums_ = [checksum, strokeChecksum, fillChecksum, this.radius_, this.form_+\"-\"+this.glyphs_];\r\n  }\r\n  return this.checksums_[0];\r\n};\r\n\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*\r\n*  Photo style for vector features\r\n*/\r\n/**\r\n * @classdesc\r\n * Set Photo style for vector features.\r\n *\r\n * @constructor\r\n * @param {} options\r\n *  @param { default | square | circle | anchored | folio } options.kind\r\n *  @param {boolean} options.crop crop within square, default is false\r\n *  @param {Number} options.radius symbol size\r\n *  @param {boolean} options.shadow drop a shadow\r\n *  @param {ol.style.Stroke} options.stroke\r\n *  @param {String} options.src image src\r\n *  @param {String} options.crossOrigin The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer.\r\n *  @param {Number} options.offsetX Horizontal offset in pixels. Default is 0.\r\n *  @param {Number} options.offsetY Vertical offset in pixels. Default is 0.\r\n *  @param {function} options.onload callback when image is loaded (to redraw the layer)\r\n * @extends {ol.style.RegularShape}\r\n * @implements {ol.structs.IHasChecksum}\r\n * @api\r\n */\r\nol.style.Photo = function(options) {\r\n  options = options || {};\r\n  this.sanchor_ = options.kind==\"anchored\" ? 8:0;\r\n  this._shadow = (Number(options.shadow) || 0);\r\n  if (!options.stroke) {\r\n    options.stroke = new ol.style.Stroke({ width: 0, color: \"#000\"})\r\n  }\r\n  var strokeWidth = options.stroke.getWidth();\r\n  if (strokeWidth<0) strokeWidth = 0;\r\n  if (options.kind=='folio') strokeWidth += 6;\r\n  options.stroke.setWidth(strokeWidth);\r\n  ol.style.RegularShape.call (this, {\r\n    radius: options.radius + strokeWidth + this.sanchor_/2 + this._shadow/2, \r\n    points: 0,\r\n    // No fill to create a hit detection Image (v5) or transparent (v6) \r\n    fill: ol.style.RegularShape.prototype.render ? new ol.style.Fill({ color: [0,0,0,0] }) : null\r\n  });\r\n  // Hack to get the hit detection Image (v4.6.5 ?)\r\n  if (!this.getHitDetectionImage) {\r\n    var img = this.getImage();\r\n    if (!this.hitDetectionCanvas_) {\r\n      for (var i in this) {\r\n        if (this[i] && this[i].getContext && this[i]!==img) {\r\n          this.hitDetectionCanvas_ = this[i];\r\n          break;\r\n        }\r\n      }\r\n    }\r\n    // Clone canvas for hit detection (old versions)\r\n    this.hitDetectionCanvas_ = document.createElement('canvas');\r\n    this.hitDetectionCanvas_.width = img.width;\r\n    this.hitDetectionCanvas_.height = img.height;\r\n    var hit = this.hitDetectionCanvas_\r\n    this.getHitDetectionImage = function() {\r\n      return hit;\r\n    }\r\n  }\r\n  this._stroke = options.stroke;\r\n  this._fill = options.fill;\r\n  this._crop = options.crop;\r\n  this._crossOrigin = options.crossOrigin;\r\n  this._kind = options.kind || \"default\";\r\n  this._radius = options.radius;\r\n  this._src = options.src;\r\n  this._offset = [options.offsetX ? options.offsetX :0, options.offsetY ? options.offsetY :0];\r\n  this._onload = options.onload;\r\n  if (typeof(options.opacity)=='number') this.setOpacity(options.opacity);\r\n  if (typeof(options.rotation)=='number') this.setRotation(options.rotation);\r\n  this.renderPhoto_();\r\n};\r\nol.ext.inherits(ol.style.Photo, ol.style.RegularShape);\r\n/** Set photo offset\r\n * @param {ol.pixel} offset\r\n */\r\nol.style.Photo.prototype.setOffset = function(offset) {\r\n  this._offset = [offset[0]||0, offset[1]||0];\r\n  this.renderPhoto_();\r\n};\r\n/**\r\n * Clones the style. \r\n * @return {ol.style.Photo}\r\n */\r\nol.style.Photo.prototype.clone = function() {\r\n  var i = new ol.style.Photo({\r\n    stroke: this._stroke,\r\n    fill: this._fill,\r\n    shadow: this._shadow,\r\n    crop: this._crop,\r\n    crossOrigin: this._crossOrigin,\r\n    kind: this._kind,\r\n    radius: this._radius,\r\n    src: this._src,\r\n    offsetX: this._offset[0],\r\n    offsetY: this._offset[1],\r\n    opacity: this.getOpacity(),\r\n    rotation: this.getRotation()\r\n  });\r\n  i.renderPhoto_();\r\n  return i;\r\n};\r\n/**\r\n * Draws a rounded rectangle using the current state of the canvas. \r\n * Draw a rectangle if the radius is null.\r\n * @param {Number} x The top left x coordinate\r\n * @param {Number} y The top left y coordinate \r\n * @param {Number} width The width of the rectangle \r\n * @param {Number} height The height of the rectangle\r\n * @param {Number} radius The corner radius.\r\n */\r\nCanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {\r\n  if (!r) {\r\n    this.rect(x,y,w,h);\r\n  } else {\r\n    if (w < 2 * r) r = w / 2;\r\n    if (h < 2 * r) r = h / 2;\r\n    this.beginPath();\r\n    this.moveTo(x+r, y);\r\n    this.arcTo(x+w, y, x+w, y+h, r);\r\n    this.arcTo(x+w, y+h, x, y+h, r);\r\n    this.arcTo(x, y+h, x, y, r);\r\n    this.arcTo(x, y, x+w, y, r);\r\n    this.closePath();\r\n  }\r\n  return this;\r\n};\r\n/**\r\n * Draw the form without the image\r\n * @private\r\n */\r\nol.style.Photo.prototype.drawBack_ = function(context, color, strokeWidth, pixelratio) {\r\n  var shadow = this._shadow;\r\n  var canvas = context.canvas;\r\n  context.beginPath();\r\n  context.fillStyle = color;\r\n  context.clearRect(0, 0, canvas.width, canvas.height);\r\n  var width = canvas.width/pixelratio;\r\n  var height = canvas.height/pixelratio;\r\n  switch (this._kind) {\r\n    case 'square': {\r\n      context.rect(0,0, width-shadow, height-shadow);\r\n      break;\r\n    }\r\n    case 'circle': {\r\n      context.arc(this._radius+strokeWidth, this._radius+strokeWidth, this._radius+strokeWidth, 0, 2 * Math.PI, false);\r\n      break;\r\n    }\r\n    case 'folio': {\r\n      var offset = 6;\r\n      strokeWidth -= offset;\r\n      context.strokeStyle = 'rgba(0,0,0,0.5)';\r\n      context.lineWidth = 1;\r\n      var w = width-shadow-2*offset;\r\n      var a = Math.atan(6/w);\r\n      context.save();\r\n      context.rotate(-a);\r\n      context.translate(-6,2);\r\n      context.beginPath();\r\n      context.rect(offset,offset,w,w);\r\n      context.stroke();\r\n      context.fill();\r\n      context.restore();\r\n      context.save();\r\n      context.translate(6,-1);\r\n      context.rotate(a);\r\n      context.beginPath();\r\n      context.rect(offset,offset,w,w);\r\n      context.stroke();\r\n      context.fill();\r\n      context.restore();\r\n      context.beginPath();\r\n      context.rect(offset,offset,w,w);\r\n      context.stroke();\r\n      break;\r\n    }\r\n    case 'anchored': {\r\n      context.roundRect(this.sanchor_/2,0,width-this.sanchor_-shadow, height-this.sanchor_-shadow, strokeWidth);\r\n      context.moveTo(width/2-this.sanchor_-shadow/2,height-this.sanchor_-shadow);\r\n      context.lineTo(width/2+this.sanchor_-shadow/2,height-this.sanchor_-shadow);\r\n      context.lineTo(width/2-shadow/2,height-shadow);break;\r\n    }\r\n    default: {\r\n      // roundrect\r\n      context.roundRect(0,0,width-shadow, height-shadow, strokeWidth);\r\n      break;\r\n    }\r\n  }\r\n  context.closePath();\r\n};\r\n/**\r\n * @private\r\n */\r\nol.style.Photo.prototype.renderPhoto_ = function(pixelratio) {\r\n  if (!pixelratio) {\r\n    if (this.getPixelRatio) {\r\n      pixelratio = window.devicePixelRatio;\r\n      this.renderPhoto_(pixelratio);\r\n    } else {\r\n      this.renderPhoto_(1);\r\n    }\r\n    return;\r\n  }\r\n  var strokeStyle;\r\n  var strokeWidth = 0;\r\n  if (this._stroke) {\r\n    strokeStyle = ol.color.asString(this._stroke.getColor());\r\n    strokeWidth = this._stroke.getWidth();\r\n  }\r\n  var canvas = this.getImage(pixelratio);\r\n  // Draw hitdetection image\r\n  var context = this.getHitDetectionImage().getContext('2d');\r\n  context.save();\r\n  context.setTransform(1,0,0,1,0,0)\r\n  this.drawBack_(context,\"#000\",strokeWidth, 1);\r\n  context.fill();\r\n  context.restore();\r\n  // Draw the image\r\n  context = canvas.getContext('2d');\r\n  context.save();\r\n  context.setTransform(pixelratio, 0, 0, pixelratio, 0, 0);\r\n  this.drawBack_(context,strokeStyle,strokeWidth, pixelratio);\r\n  // Draw a shadow\r\n  if (this._shadow) {\r\n    context.shadowColor = 'rgba(0,0,0,0.5)';\r\n    context.shadowBlur = pixelratio*this._shadow/2;\r\n    context.shadowOffsetX = pixelratio*this._shadow/2;\r\n    context.shadowOffsetY = pixelratio*this._shadow/2;\r\n  }\r\n  context.fill();\r\n  context.restore();\r\n  var self = this;\r\n  var img = this.img_ = new Image();\r\n  if (this._crossOrigin) img.crossOrigin = this._crossOrigin;\r\n  img.src = this._src;\r\n  // Draw image\r\n  if (img.width) {\r\n    self.drawImage_(img);\r\n  } else {\r\n    img.onload = function() {\r\n      self.drawImage_(img);\r\n      // Force change (?!)\r\n      // self.setScale(1);\r\n      if (self._onload) self._onload();\r\n    };\r\n  }\r\n  // Set anchor\r\n  var a = this.getAnchor();\r\n  a[0] = (canvas.width/pixelratio - this._shadow)/2  - this._offset[0];\r\n  if (this.sanchor_) {\r\n    a[1] = canvas.height/pixelratio - this._shadow - this._offset[1];\r\n  } else {\r\n    a[1] = (canvas.height/pixelratio - this._shadow)/2 - this._offset[1];\r\n  }\r\n};\r\n/**\r\n * Draw an timage when loaded\r\n * @private\r\n */\r\nol.style.Photo.prototype.drawImage_ = function(img) {\r\n  var pixelratio = window.devicePixelRatio;\r\n  var canvas = this.getImage(pixelratio);\r\n  // Remove the circle on the canvas\r\n  var context = (canvas.getContext('2d'));\r\n  var strokeWidth = 0;\r\n  if (this._stroke) strokeWidth = this._stroke.getWidth();\r\n  var size = 2*this._radius;\r\n  context.save();\r\n  if (ol.style.RegularShape.prototype.render) context.setTransform(pixelratio,0,0,pixelratio,0,0);\r\n  if (this._kind=='circle') {\r\n    context.beginPath();\r\n    context.arc(this._radius+strokeWidth, this._radius+strokeWidth, this._radius, 0, 2 * Math.PI, false);\r\n    context.clip();\r\n  }\r\n  var s, x, y, w, h, sx, sy, sw, sh;\r\n  // Crop the image to a square vignette\r\n  if (this._crop) {\r\n    s = Math.min (img.width/size, img.height/size);\r\n    sw = sh = s*size;\r\n    sx = (img.width-sw)/2;\r\n    sy = (img.height-sh)/2;\r\n    x = y = 0;\r\n    w = h = size+1;\r\n  } else {\r\n    // Fit the image to the size\r\n    s = Math.min (size/img.width, size/img.height);\r\n    sx = sy = 0;\r\n    sw = img.width;\r\n    sh = img.height;\r\n    w = s*sw;\r\n    h = s*sh;\r\n    x = (size-w)/2;\r\n    y = (size-h)/2;\r\n  }\r\n  x += strokeWidth + this.sanchor_/2;\r\n  y += strokeWidth;\r\n  context.drawImage(img, sx, sy, sw, sh, x, y, w, h);\r\n  // Draw a circle to avoid aliasing on clip\r\n  if (this._kind=='circle' && strokeWidth) {\r\n    context.beginPath();\r\n    context.strokeStyle = ol.color.asString(this._stroke.getColor());\r\n    context.lineWidth = strokeWidth/4;\r\n    context.arc(this._radius+strokeWidth, this._radius+strokeWidth, this._radius, 0, 2 * Math.PI, false);\r\n    context.stroke();\r\n  }\r\n  context.restore();\r\n};\r\n\r\n/*\tCopyright (c) 2019 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/** Profile style\r\n * Draw a profile on the map\r\n * @extends {ol.style.Style}\r\n * @constructor\r\n * @param {Object} options\r\n *  @param {ol.style.Stroke} options.stroke \r\n *  @param {ol.style.Fill} options.fill \r\n *  @param {number} options.scale z scale \r\n *  @param {number} options.zIndex \r\n *  @param {ol.geom.Geometry} options.geometry \r\n */\r\nol.style.Profile = function(options) {\r\n  if (!options) options = {};\r\n  ol.style.Style.call (this, { \r\n    renderer: this._render.bind(this),\r\n    zIndex: options.zIndex,\r\n    geometry: options.geometry\r\n  });\r\n  this.setStroke(options.stroke);\r\n  this.setFill(options.fill);\r\n  this.setScale(options.scale);\r\n};\r\nol.ext.inherits(ol.style.Profile, ol.style.Style);\r\n/** Set style stroke\r\n * @param {ol.style.Stroke}\r\n */\r\nol.style.Profile.prototype.setStroke = function(stroke) {\r\n  this._stroke = stroke || new ol.style.Stroke({ color: '#fff', width: 1 });\r\n}\r\n/** Get style stroke\r\n * @return {ol.style.Stroke}\r\n */\r\nol.style.Profile.prototype.getStroke = function() {\r\n  return this._stroke;\r\n}\r\n/** Set style stroke\r\n * @param {ol.style.Fill}\r\n */\r\nol.style.Profile.prototype.setFill = function(fill) {\r\n  this._fill = fill || new ol.style.Fill({ color: 'rgba(255,255,255,.3' });\r\n}\r\n/** Get style stroke\r\n * @return {ol.style.Fill}\r\n */\r\nol.style.Profile.prototype.getFill = function() {\r\n  return this._fill;\r\n}\r\n/** Set z scale\r\n * @param {number}\r\n */\r\nol.style.Profile.prototype.setScale = function(sc) {\r\n  this._scale = sc || .2;\r\n}\r\n/** Get z scale\r\n * @return {number}\r\n */\r\nol.style.Profile.prototype.getScale = function() {\r\n  return this._scale;\r\n}\r\n/** Renderer function\r\n * @param {Array<ol.coordinate>} geom The pixel coordinates of the geometry in GeoJSON notation\r\n * @param {ol.render.State} e The olx.render.State of the layer renderer\r\n */\r\nol.style.Profile.prototype._render = function(geom, e) {\r\n  if (!/Z/.test(e.feature.getGeometry().getLayout())) return;\r\n  var g = e.geometry.getCoordinates();\r\n  switch (e.geometry.getType()) {\r\n    case 'LineString': {\r\n      this._renderLine(geom, g, e.feature.getGeometry(), e);\r\n      break;\r\n    }\r\n    case 'MultiLineString': {\r\n      e.feature.getGeometry().getLineStrings().forEach(function(l, i) {\r\n        this._renderLine(geom[i], g[i], l, e);\r\n      }.bind(this));\r\n      break;\r\n    }\r\n    case 'Point': {\r\n      break;\r\n    }\r\n  }\r\n};\r\n/** @private */\r\nol.style.Profile.prototype._renderLine = function(geom, g, l, e) {\r\n  var i, p, ctx = e.context;\r\n  var cos = Math.cos(e.rotation)\r\n  var sin = Math.sin(e.rotation)\r\n  // var a = e.pixelRatio / e.resolution;\r\n  var a = ol.coordinate.dist2d(geom[0],geom[1]) / ol.coordinate.dist2d(g[0],g[1])\r\n  var dx = geom[0][0] - g[0][0] * a *cos - g[0][1] * a *sin ;\r\n  var dy = geom[0][1] - g[0][0] * a * sin + g[0][1] * a * cos;\r\n  geom = l.getCoordinates();\r\n  var dz = Infinity;\r\n  for (i=0; p=geom[i]; i++) {\r\n    var x = dx + p[0] * a * cos + p[1] * a * sin;\r\n    var y = dy + p[0] * a * sin - p[1] * a * cos;\r\n    dz = Math.min(dz, p[2]);\r\n    geom[i] = [x, y, p[2]];\r\n  }\r\n  ctx.save();\r\n    ctx.fillStyle = ol.color.asString(this.getFill().getColor());\r\n    ctx.strokeStyle = ol.color.asString(this.getStroke().getColor());\r\n    ctx.strokeWidth = this.getStroke().getWidth();\r\n    var p0 = geom[0];\r\n    var ez = this.getScale() * e.pixelRatio;\r\n    for (i=1; p=geom[i]; i++) {\r\n      ctx.beginPath();\r\n      ctx.moveTo(p0[0],p0[1]);\r\n      ctx.lineTo(p[0],p[1]);\r\n      ctx.lineTo(p[0],p[1]-(p[2]-dz)*ez);\r\n      ctx.lineTo(p0[0],p0[1]-(p0[2]-dz)*ez);\r\n      ctx.lineTo(p0[0],p0[1]);\r\n      ctx.fill();\r\n      p0 = p;\r\n    }\r\n    p0 = geom[0];\r\n    ctx.beginPath();\r\n    ctx.moveTo(p0[0],p0[1]-(p0[2]-dz)*ez);\r\n    for (i=1; p=geom[i]; i++) {\r\n      ctx.lineTo(p[0],p[1]-(p[2]-dz)*ez);\r\n    }\r\n    ctx.stroke();\r\n  ctx.restore();\r\n};\r\n\r\n/** Add a setTextPath style to draw text along linestrings\r\n@toto letterpadding/spacing, wordpadding/spacing\r\n*/\r\n(function()\r\n{\r\n/** Internal drawing function called on postcompose\r\n* @param {ol.eventPoscompose} e postcompose event\r\n*/\r\nfunction drawTextPath (e)\r\n{\t// Prent drawing at large resolution\r\n\tif (e.frameState.viewState.resolution > this.textPathMaxResolution_) return;\r\n\tvar extent = e.frameState.extent;\r\n\tvar c2p = e.frameState.coordinateToPixelTransform;\r\n\t// Get pixel path with coordinates\r\n\tvar k;\r\n\tfunction getPath(c, readable)\r\n\t{\tvar path1 = [];\r\n\t\tfor (k=0; k<c.length; k++) \r\n\t\t{\tpath1.push(c2p[0]*c[k][0]+c2p[1]*c[k][1]+c2p[4]);\r\n\t\t\tpath1.push(c2p[2]*c[k][0]+c2p[3]*c[k][1]+c2p[5]);\r\n\t\t}\r\n\t\t// Revert line ?\r\n\t\tif (readable && path1[0]>path1[path1.length-2])\r\n\t\t{\tvar path2 = [];\r\n\t\t\tfor (k=path1.length-2; k>=0; k-=2)\r\n\t\t\t{\tpath2.push(path1[k]);\r\n\t\t\t\tpath2.push(path1[k+1]);\r\n\t\t\t}\r\n\t\t\treturn path2;\r\n\t\t}\r\n\t\telse return path1;\r\n\t}\r\n\tvar ctx = e.context;\r\n\tctx.save();\r\n\tctx.scale(e.frameState.pixelRatio,e.frameState.pixelRatio);\r\n\tvar features = this.getSource().getFeaturesInExtent(extent);\r\n\tfor (var i=0, f; f=features[i]; i++)\r\n\t{\t{\tvar style = this.textPathStyle_(f,e.frameState.viewState.resolution);\r\n\t\t\tfor (var s,j=0; s=style[j]; j++)\r\n\t\t\t{\t\r\n\t\t\t\tvar g = s.getGeometry() || f.getGeometry();\r\n\t\t\t\tvar c;\r\n\t\t\t\tswitch (g.getType())\r\n\t\t\t\t{\tcase \"LineString\": c = g.getCoordinates(); break;\r\n\t\t\t\t\tcase \"MultiLineString\": c = g.getLineString(0).getCoordinates(); break;\r\n\t\t\t\t\tdefault: continue;\r\n\t\t\t\t}\r\n\t\t\t\tvar st = s.getText();\r\n\t\t\t\tvar path = getPath(c, st.getRotateWithView() );\r\n\t\t\t\tctx.font = st.getFont();\r\n\t\t\t\tctx.textBaseline = st.getTextBaseline();\r\n\t\t\t\tctx.textAlign = st.getTextAlign();\r\n\t\t\t\tctx.lineWidth = st.getStroke() ? (st.getStroke().getWidth()||0) : 0;\r\n\t\t\t\tctx.strokeStyle = st.getStroke() ? (st.getStroke().getColor()||\"#fff\") : \"#fff\";\r\n\t\t\t\tctx.fillStyle = st.getFill() ? st.getFill().getColor()||\"#000\" : \"#000\";\r\n\t\t\t\t// New params\r\n\t\t\t\tctx.textJustify = st.getTextAlign()==\"justify\";\r\n\t\t\t\tctx.textOverflow = st.getTextOverflow ? st.getTextOverflow():\"\";\r\n\t\t\t\tctx.minWidth = st.getMinWidth ? st.getMinWidth():0;\r\n\t\t\t\t// Draw textpath\r\n\t\t\t\tctx.textPath(st.getText()||f.get(\"name\"), path);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tctx.restore();\r\n}\r\n/** Set the style for features. \r\n*\tThis can be a single style object, an array of styles, or a function that takes a feature and resolution and \r\n*\treturns an array of styles. If it is undefined the default style is used. \r\n*\tIf it is null the layer has no style (a null style). \r\n*\tSee ol.style for information on the default style.\r\n*\t@param {ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction} style\r\n*\t@param {Number} maxResolution to display text, default: 0\r\n*/\r\nol.layer.Vector.prototype.setTextPathStyle = function(style, maxResolution)\r\n{\r\n\t// Remove existing style\r\n\tif (style===null)\r\n\t{\tif (this.textPath_) this.unByKey(this.textPath_);\r\n\t\tthis.textPath_ = null;\r\n\t\tthis.changed();\r\n\t\treturn;\r\n\t}\r\n\t// New postcompose\r\n\tif (!this.textPath_)\r\n\t{\tthis.textPath_ = this.on(['postcompose','postrender'], drawTextPath.bind(this));\r\n\t}\r\n\t// Set textPathStyle\r\n\tif (style===undefined)\r\n\t{\tstyle = [ new ol.style.Style({ text: new ol.style.Text()}) ];\r\n\t}\r\n\tif (typeof(style) == \"function\") this.textPathStyle_ = style;\r\n\telse this.textPathStyle_ = function() { return style; };\r\n\tthis.textPathMaxResolution_ = Number(maxResolution) || Number.MAX_VALUE;\r\n\t// Force redraw\r\n\tthis.changed();\r\n}\r\n/** Add new properties to ol.style.Text\r\n* to use with ol.layer.Vector.prototype.setTextPathStyle\r\n* @constructor\r\n* @param {} options\r\n*\t@param {visible|ellipsis|string} textOverflow\r\n*\t@param {number} minWidth minimum width (px) to draw text, default 0\r\n*/\r\nol.style.TextPath = function(options)\r\n{\tif (!options) options={};\r\n\tol.style.Text.call (this, options);\r\n\tthis.textOverflow_ = typeof(options.textOverflow)!=\"undefined\" ?  options.textOverflow : \"visible\";\r\n\tthis.minWidth_ = options.minWidth || 0;\r\n}\r\nol.ext.inherits(ol.style.TextPath, ol.style.Text);\r\nol.style.TextPath.prototype.getTextOverflow = function()\r\n{\treturn this.textOverflow_; \r\n};\r\nol.style.TextPath.prototype.getMinWidth = function()\r\n{\treturn this.minWidth_; \r\n};\r\n/**/\r\n})();\r\n/** CanvasRenderingContext2D: draw text along path\r\n* @param {string} text\r\n* @param {Array<Number>} path\r\n*/\r\nCanvasRenderingContext2D.prototype.textPath = function (text, path)\r\n{\r\n\tvar ctx = this;\r\n\tfunction dist2D(x1,y1,x2,y2)\r\n\t{\tvar dx = x2-x1;\r\n\t\tvar dy = y2-y1;\r\n\t\treturn Math.sqrt(dx*dx+dy*dy);\r\n\t}\r\n\tvar di, dpos=0;\r\n\tvar pos=2;\r\n\tfunction getPoint(path, dl)\r\n\t{\tif (!di || dpos+di<dl)\r\n\t\t{ for (; pos<path.length; )\r\n\t\t\t{\tdi = dist2D(path[pos-2],path[pos-1],path[pos],path[pos+1]);\r\n\t\t\t\tif (dpos+di>dl) break;\r\n\t\t\t\tpos += 2;\r\n\t\t\t\tif (pos>=path.length) break;\r\n\t\t\t\tdpos += di;\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar x, y, a, dt = dl-dpos;\r\n\t\tif (pos>=path.length) \r\n\t\t{\tpos = path.length-2;\r\n\t\t}\r\n\t\tif (!dt) \r\n\t\t{\tx = path[pos-2];\r\n\t\t\ty = path[pos-1];\r\n\t\t\ta = Math.atan2(path[pos+1]-path[pos-1], path[pos]-path[pos-2]);\r\n\t\t}\r\n\t\telse\r\n\t\t{\tx = path[pos-2]+ (path[pos]-path[pos-2])*dt/di;\r\n\t\t\ty = path[pos-1]+(path[pos+1]-path[pos-1])*dt/di;\r\n\t\t\ta = Math.atan2(path[pos+1]-path[pos-1], path[pos]-path[pos-2]);\r\n\t\t}\r\n\t\treturn [x,y,a];\r\n\t}\r\n\tvar letterPadding = ctx.measureText(\" \").width *0.25;\r\n\tvar start = 0;\r\n\tvar d = 0;\r\n\tfor (var i=2; i<path.length; i+=2)\r\n\t{\td += dist2D(path[i-2],path[i-1],path[i],path[i+1])\r\n\t}\r\n\tif (d < ctx.minWidth) return;\r\n\tvar nbspace = text.split(\" \").length -1;\r\n\t// Remove char for overflow\r\n\tif (ctx.textOverflow != \"visible\")\r\n\t{\tif (d < ctx.measureText(text).width + (text.length-1 + nbspace) * letterPadding)\r\n\t\t{\tvar overflow = (ctx.textOverflow==\"ellipsis\") ? '\\u2026' : ctx.textOverflow;\r\n\t\t\tdo\r\n\t\t\t{\tnbspace = text.split(\" \").length -1;\r\n\t\t\t\ttext = text.slice(0,text.length-1);\r\n\t\t\t} while (text && d < ctx.measureText(text+overflow).width + (text.length + overflow.length-1 + nbspace) * letterPadding)\r\n\t\t\ttext += overflow;\r\n\t\t}\r\n\t}\r\n\tswitch (ctx.textJustify || ctx.textAlign)\r\n\t{\tcase true: // justify\r\n\t\tcase \"center\":\r\n\t\tcase \"end\":\r\n\t\tcase \"right\":\r\n\t\t{\t// Text align\r\n\t\t\tif (ctx.textJustify) \r\n\t\t\t{\tstart = 0;\r\n\t\t\t\tletterPadding = (d - ctx.measureText(text).width) / (text.length-1 + nbspace);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\tstart = d - ctx.measureText(text).width - (text.length + nbspace) * letterPadding;\r\n\t\t\t\tif (ctx.textAlign == \"center\") start /= 2;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tdefault: break;\r\n\t}\r\n\tfor (var t=0; t<text.length; t++)\r\n\t{\tvar letter = text[t];\r\n\t\tvar wl = ctx.measureText(letter).width;\r\n\t\tvar p = getPoint(path, start+wl/2);\r\n\t\tctx.save();\r\n\t\tctx.textAlign = \"center\";\r\n\t\tctx.translate(p[0], p[1]);\r\n\t\tctx.rotate(p[2]);\r\n\t\tif (ctx.lineWidth) ctx.strokeText(letter,0,0);\r\n\t\tctx.fillText(letter,0,0);\r\n\t\tctx.restore();\r\n\t\tstart += wl+letterPadding*(letter==\" \"?2:1);\r\n\t}\r\n};\r\n//NB: (Not confirmed)To use this module, you just have to :\r\n//   import('ol-ext/layer/getpreview')\r\n/*\tCopyright (c) 2015 Jean-Marc VIGLINO, \r\n  released under the CeCILL-B license (French BSD license)\r\n  (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*\r\n*  Shadow image style for point vector features\r\n*/\r\n/**\r\n * @classdesc\r\n * Set Shadow style for point vector features.\r\n *\r\n * @constructor\r\n * @param {} options Options.\r\n *  @param {ol.style.Fill | undefined} options.fill fill style, default rgba(0,0,0,0.5)\r\n *  @param {number} options.radius point radius\r\n * \t@param {number} options.blur lur radius, default radius/3\r\n * \t@param {number} options.offsetX x offset, default 0\r\n * \t@param {number} options.offsetY y offset, default 0\r\n * @extends {ol.style.RegularShape}\r\n * @api\r\n */\r\nol.style.Shadow = function(options) {\r\n  options = options || {};\r\n  if (!options.fill) options.fill = new ol.style.Fill({ color: \"rgba(0,0,0,0.5)\" });\r\n  ol.style.RegularShape.call (this,{ radius: options.radius, fill: options.fill });\r\n  this._fill = options.fill;\r\n  this._radius = options.radius;\r\n  this._blur = options.blur===0 ? 0 : options.blur || options.radius/3;\r\n  this._offset = [options.offsetX ? options.offsetX : 0, options.offsetY ? options.offsetY : 0];\r\n  this.renderShadow_();\r\n};\r\nol.ext.inherits(ol.style.Shadow, ol.style.RegularShape);\r\n/**\r\n * Clones the style. \r\n * @return {ol.style.Shadow}\r\n */\r\nol.style.Shadow.prototype.clone = function() {\r\n  var s = new ol.style.Shadow({\r\n    fill: this._fill,\r\n    radius: this._radius,\r\n    blur: this._blur,\r\n    offsetX: this._offset[0],\r\n    offsetY: this._offset[1]\r\n  });\r\n  s.setScale(this.getScale());\r\n  s.setOpacity(this.getOpacity());\r\n  return s;\r\n};\r\n/**\r\n * @private\r\n */\r\nol.style.Shadow.prototype.renderShadow_ = function(pixelratio) {\t\r\n  if (!pixelratio) {\r\n    if (this.getPixelRatio) {\r\n      pixelratio = window.devicePixelRatio;\r\n      this.renderShadow_(pixelratio);\r\n      if (this.getPixelRatio && pixelratio!==1) this.renderShadow_(1); \r\n    } else {\r\n      this.renderShadow_(1);\r\n    }\r\n    return;\r\n  }\r\n  var radius = this._radius;\r\n  var canvas = this.getImage(pixelratio);\r\n  // Remove the circle on the canvas\r\n  var context = (canvas.getContext('2d'));\r\n  context.clearRect(0, 0, canvas.width, canvas.height);\r\n  context.save();\r\n  context.beginPath();\r\n    context.setTransform(pixelratio, 0, 0, pixelratio, 0, 0);\r\n    context.scale(1,0.5);\r\n    context.arc(radius, -radius, radius-this._blur, 0, 2 * Math.PI, false);\r\n    context.fillStyle = '#000';\r\n    context.shadowColor = this._fill.getColor();\r\n    context.shadowBlur = 0.7*this._blur*pixelratio;\r\n    context.shadowOffsetX = 0;\r\n    context.shadowOffsetY = 1.5*radius*pixelratio;\r\n  context.closePath();\r\n  context.fill();\r\n  context.shadowColor = 'transparent';\r\n  context.restore();\r\n  // Set anchor\r\n  var a = this.getAnchor();\r\n  a[0] = canvas.width /2 - this._offset[0];\r\n  a[1] = canvas.height /2 - this._offset[1];\r\n}\r\n\r\n/*\tCopyright (c) 2018 Jean-Marc VIGLINO, \r\n\treleased under the CeCILL-B license (French BSD license)\r\n\t(http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * @classdesc\r\n * Stroke style with named pattern\r\n *\r\n * @constructor\r\n * @param {any}  options\r\n *\t@param {ol.style.Image|undefined} options.image an image pattern, image must be preloaded to draw on first call\r\n *\t@param {number|undefined} options.opacity opacity with image pattern, default:1\r\n *\t@param {olx.style.fillPattern} options.pattern pattern name (override by image option)\r\n *\t@param {ol.colorLike} options.color pattern color\r\n *\t@param {ol.style.Fill} options.fill fill color (background)\r\n *\t@param {number} options.offset pattern offset for hash/dot/circle/cross pattern\r\n *\t@param {number} options.size line size for hash/dot/circle/cross pattern\r\n *\t@param {number} options.spacing spacing for hash/dot/circle/cross pattern\r\n *\t@param {number|bool} options.angle angle for hash pattern / true for 45deg dot/circle/cross\r\n *\t@param {number} options.scale pattern scale \r\n * @extends {ol.style.Fill}\r\n * @implements {ol.structs.IHasChecksum}\r\n * @api\r\n */\r\nol.style.StrokePattern = function(options)\r\n{\tif (!options) options = {};\r\n\tvar pattern, i;\r\n\tvar canvas = this.canvas_ = document.createElement('canvas');\r\n\tvar scale = Number(options.scale)>0 ? Number(options.scale) : 1;\r\n\tvar ratio = scale*ol.has.DEVICE_PIXEL_RATIO || ol.has.DEVICE_PIXEL_RATIO;\r\n\tvar ctx = canvas.getContext('2d');\r\n\tif (options.image)\r\n\t{\toptions.image.load();\r\n\t\tvar img = options.image.getImage();\r\n\t\tif (img.width)\r\n\t\t{\tcanvas.width = Math.round(img.width *ratio);\r\n\t\t\tcanvas.height = Math.round(img.height *ratio);\r\n\t\t\tctx.globalAlpha = typeof(options.opacity) == 'number' ? options.opacity:1;\r\n\t\t\tctx.drawImage(img, 0,0, img.width, img.height, 0, 0, canvas.width, canvas.height);\r\n\t\t\tpattern = ctx.createPattern(canvas, 'repeat');\r\n\t\t}\r\n\t\telse \r\n\t\t{\tvar self = this;\r\n\t\t\tpattern = [0,0,0,0];\r\n\t\t\timg.onload = function ()\r\n\t\t\t{\tcanvas.width = Math.round(img.width *ratio);\r\n\t\t\t\tcanvas.height = Math.round(img.height *ratio);\r\n\t\t\t\tctx.globalAlpha = typeof(options.opacity) == 'number' ? options.opacity:1;\r\n\t\t\t\tctx.drawImage(img, 0,0, img.width, img.height, 0, 0, canvas.width, canvas.height);\r\n\t\t\t\tpattern = ctx.createPattern(canvas, 'repeat');\r\n\t\t\t\tself.setColor(pattern);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\tvar pat = this.getPattern_(options);\r\n\t\tcanvas.width = Math.round(pat.width *ratio);\r\n\t\tcanvas.height = Math.round(pat.height *ratio);\r\n\t\tctx.beginPath();\r\n\t\tif (options.fill) \r\n\t\t{\tctx.fillStyle = ol.color.asString(options.fill.getColor());\r\n\t\t\tctx.fillRect(0,0, canvas.width, canvas.height);\r\n\t\t}\r\n\t\tctx.scale(ratio,ratio);\r\n\t\tctx.lineCap = \"round\";\r\n\t\tctx.lineWidth = pat.stroke || 1;\r\n\t\tctx.fillStyle = ol.color.asString(options.color||\"#000\");\r\n\t\tctx.strokeStyle = ol.color.asString(options.color||\"#000\");\r\n\t\tif (pat.circles) for (i=0; i<pat.circles.length; i++)\r\n\t\t{\tvar ci = pat.circles[i]; \r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.arc(ci[0], ci[1], ci[2], 0,2*Math.PI);\r\n\t\t\tif (pat.fill) ctx.fill();\r\n\t\t\tif (pat.stroke) ctx.stroke();\r\n\t\t}\r\n\t\tif (!pat.repeat) pat.repeat=[[0,0]];\r\n\t\tif (pat.char)\r\n\t\t{\tctx.font = pat.font || (pat.width)+\"px Arial\";\r\n\t\t\tctx.textAlign = 'center';\r\n\t\t\tctx.textBaseline = 'middle';\r\n\t\t\tif (pat.angle) \r\n\t\t\t{\tctx.fillText(pat.char, pat.width/4, pat.height/4);\r\n\t\t\t\tctx.fillText(pat.char, 5*pat.width/4, 5*pat.height/4);\r\n\t\t\t\tctx.fillText(pat.char, pat.width/4, 5*pat.height/4);\r\n\t\t\t\tctx.fillText(pat.char, 5*pat.width/4, pat.height/4);\r\n\t\t\t\tctx.fillText(pat.char, 3*pat.width/4, 3*pat.height/4);\r\n\t\t\t\tctx.fillText(pat.char, -pat.width/4, -pat.height/4);\r\n\t\t\t\tctx.fillText(pat.char, 3*pat.width/4, -pat.height/4);\r\n\t\t\t\tctx.fillText(pat.char, -pat.width/4, 3*pat.height/4);\r\n\t\t\t}\r\n\t\t\telse ctx.fillText(pat.char, pat.width/2, pat.height/2);\r\n\t\t}\r\n\t\tif (pat.lines) for (i=0; i<pat.lines.length; i++) for (var r=0; r<pat.repeat.length; r++)\r\n\t\t{\tvar li = pat.lines[i];\r\n\t\t\tctx.beginPath();\r\n\t\t\tctx.moveTo(li[0]+pat.repeat[r][0],li[1]+pat.repeat[r][1]);\r\n\t\t\tfor (var k=2; k<li.length; k+=2)\r\n\t\t\t{\tctx.lineTo(li[k]+pat.repeat[r][0],li[k+1]+pat.repeat[r][1]);\r\n\t\t\t}\r\n\t\t\tif (pat.fill) ctx.fill();\r\n\t\t\tif (pat.stroke) ctx.stroke();\r\n\t\t\tctx.save()\r\n\t\t\tctx.strokeStyle = 'red';\r\n\t\t\tctx.strokeWidth = 0.1;\r\n\t\t\t//ctx.strokeRect(0,0,canvas.width,canvas.height);\r\n\t\t\tctx.restore()\r\n\t\t}\r\n\t\tpattern = ctx.createPattern(canvas, 'repeat');\r\n\t\tif (options.offset)\r\n\t\t{\tvar offset = options.offset;\r\n\t\t\tif (typeof(offset) == \"number\") offset = [offset,offset];\r\n\t\t\tif (offset instanceof Array) \r\n\t\t\t{\tvar dx = Math.round((offset[0]*ratio));\r\n\t\t\t\tvar dy = Math.round((offset[1]*ratio));\r\n\t\t\t\t// New pattern\r\n\t\t\t\tctx.scale(1/ratio,1/ratio)\r\n\t\t\t\tctx.clearRect(0,0,canvas.width,canvas.height);\r\n\t\t\t\tctx.translate(dx,dy);\r\n\t\t\t\tctx.fillStyle = pattern;\r\n\t\t\t\tctx.fillRect(-dx, -dy, canvas.width,canvas.height);\r\n\t\t\t\tpattern = ctx.createPattern(canvas, 'repeat');\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\toptions.color = pattern;\r\n\tol.style.Stroke.call (this, options);\r\n};\r\nol.ext.inherits(ol.style.StrokePattern, ol.style.Stroke);\r\n/**\r\n * Clones the style. \r\n * @return {ol.style.StrokePattern}\r\n */\r\nol.style.StrokePattern.prototype.clone = function() {\r\n\tvar s = ol.style.Fill.prototype.clone.call(this);\r\n\ts.canvas_ = this.canvas_;\r\n\treturn s;\r\n};\r\n/** Get canvas used as pattern\r\n*\t@return {canvas}\r\n*/\r\nol.style.StrokePattern.prototype.getImage = function()\r\n{\treturn this.canvas_;\r\n}\r\n/** Get pattern\r\n*\t@param {olx.style.FillPatternOption}\r\n*/\r\nol.style.StrokePattern.prototype.getPattern_ = function(options)\r\n{\tvar pat = ol.style.FillPattern.prototype.patterns[options.pattern]\r\n\t\t|| ol.style.FillPattern.prototype.patterns.dot;\r\n\tvar d = Math.round(options.spacing)||10;\r\n\tvar size;\r\n//\tvar d2 = Math.round(d/2)+0.5;\r\n\tswitch (options.pattern)\r\n\t{\tcase 'dot':\r\n\t\tcase 'circle':\r\n\t\t{\tsize = options.size===0 ? 0 : options.size/2 || 2;\r\n\t\t\tif (!options.angle)\r\n\t\t\t{\tpat.width = pat.height = d;\r\n\t\t\t\tpat.circles = [[ d/2, d/2, size ]]\r\n\t\t\t\tif (options.pattern=='circle')\r\n\t\t\t\t{\tpat.circles = pat.circles.concat([\r\n\t\t\t\t\t\t[ d/2+d, d/2, size ],\r\n\t\t\t\t\t\t[ d/2-d, d/2, size ],\r\n\t\t\t\t\t\t[ d/2, d/2+d, size ],\r\n\t\t\t\t\t\t[ d/2, d/2-d, size ],\r\n\t\t\t\t\t\t[ d/2+d, d/2+d, size ],\r\n\t\t\t\t\t\t[ d/2+d, d/2-d, size ],\r\n\t\t\t\t\t\t[ d/2-d, d/2+d, size ],\r\n\t\t\t\t\t\t[ d/2-d, d/2-d, size ] ])\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\td = pat.width = pat.height = Math.round(d*1.4);\r\n\t\t\t\tpat.circles = [[ d/4, d/4, size ], [ 3*d/4, 3*d/4, size ]];\r\n\t\t\t\tif (options.pattern=='circle')\r\n\t\t\t\t{\tpat.circles = pat.circles.concat([\r\n\t\t\t\t\t\t[ d/4+d, d/4, size ],\r\n\t\t\t\t\t\t[ d/4, d/4+d, size ],\r\n\t\t\t\t\t\t[ 3*d/4-d, 3*d/4, size ],\r\n\t\t\t\t\t\t[ 3*d/4, 3*d/4-d, size ],\r\n\t\t\t\t\t\t[ d/4+d, d/4+d, size ], \r\n\t\t\t\t\t\t[ 3*d/4-d, 3*d/4-d, size ] ]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase 'tile':\r\n\t\tcase 'square':\r\n\t\t{\tsize = options.size===0 ? 0 : options.size/2 || 2;\r\n\t\t\tif (!options.angle)\r\n\t\t\t{\tpat.width = pat.height = d;\r\n\t\t\t\tpat.lines = [[ d/2-size, d/2-size, d/2+size, d/2-size, d/2+size, d/2+size, d/2-size,d/2+size, d/2-size, d/2-size ]]\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\tpat.width = pat.height = d;\r\n\t\t\t\t//size *= Math.sqrt(2);\r\n\t\t\t\tpat.lines = [[ d/2-size,d/2, d/2,d/2-size, d/2+size,d/2, d/2,d/2+size, d/2-size,d/2 ]]\r\n\t\t\t}\r\n\t\t\tif (options.pattern=='square') pat.repeat = [[0,0], [0,d], [d,0], [0,-d], [-d,0], [-d,-d], [d,d], [-d,d], [d,-d] ]\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase 'cross':\r\n\t\t{\t// Limit angle to 0 | 45\r\n\t\t\tif (options.angle) options.angle = 45;\r\n\t\t}\r\n\t\t// fallthrough\r\n\t\tcase 'hatch':\r\n\t\t{\tvar a = Math.round(((options.angle||0)-90)%360);\r\n\t\t\tif (a>180) a -= 360;\r\n\t\t\ta *= Math.PI/180;\r\n\t\t\tvar cos = Math.cos(a);\r\n\t\t\tvar sin = Math.sin(a);\r\n\t\t\tif (Math.abs(sin)<0.0001)\r\n\t\t\t{\tpat.width = pat.height = d;\t\r\n\t\t\t\tpat.lines = [ [ 0,0.5, d, 0.5 ] ];\r\n\t\t\t\tpat.repeat = [ [0,0], [0,d] ];\r\n\t\t\t}\r\n\t\t\telse  if (Math.abs(cos)<0.0001)\r\n\t\t\t{\tpat.width = pat.height = d;\t\r\n\t\t\t\tpat.lines = [ [ 0.5,0, 0.5, d] ];\r\n\t\t\t\tpat.repeat = [ [0,0], [d,0] ];\r\n\t\t\t\tif (options.pattern=='cross') \r\n\t\t\t\t{\tpat.lines.push ([ 0,0.5, d, 0.5 ]);\r\n\t\t\t\t\tpat.repeat.push([0,d]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\tvar w = pat.width = Math.round(Math.abs(d/sin)) || 1;\r\n\t\t\t\tvar h = pat.height = Math.round(Math.abs(d/cos)) || 1;\r\n\t\t\t\tif (options.pattern=='cross')\r\n\t\t\t\t{\tpat.lines = [ [-w,-h, 2*w,2*h], [2*w,-h, -w,2*h] ];\r\n\t\t\t\t\tpat.repeat = [ [0,0] ];\r\n\t\t\t\t}\r\n\t\t\t\telse if (cos*sin>0) \r\n\t\t\t\t{\tpat.lines = [ [-w,-h, 2*w,2*h] ];\r\n\t\t\t\t\tpat.repeat = [ [0,0], [w,0], [0,h] ];\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\tpat.lines = [ [2*w,-h, -w,2*h] ];\r\n\t\t\t\t\tpat.repeat = [ [0,0], [-w,0], [0,h] ];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpat.stroke = options.size===0 ? 0 : options.size||4;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tdefault: {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn pat\r\n};\r\n\r\nol.style.Style.defaultStyle;\r\n(function() {\r\n// Style\r\nvar white = [255, 255, 255, 1];\r\nvar blue = [0, 153, 255, 1];\r\nvar width = 3;\r\nvar defaultEditStyle = [\r\n  new ol.style.Style({\r\n    stroke: new ol.style.Stroke({ color: white, width: width + 2 })\r\n  }),\r\n  new ol.style.Style({\r\n    image: new ol.style.Circle({\r\n      radius: width * 2,\r\n      fill: new ol.style.Fill({ color: blue }),\r\n      stroke: new ol.style.Stroke({ color: white, width: width / 2 })\r\n    }),\r\n    stroke: new ol.style.Stroke({ color: blue, width: width }),\r\n    fill: new ol.style.Fill({\r\n      color: [255, 255, 255, 0.5]\r\n    })\r\n  })\r\n];\r\n/**\r\n * Get the default style\r\n * @param {boolean|*} [edit] true to get editing style or a { color, fillColor } object, default get default blue style\r\n * @return {Array<ol.style.Style>}\r\n */\r\nol.style.Style.defaultStyle = function(edit) {\r\n  if (edit===true) {\r\n    return defaultEditStyle;\r\n  } else {\r\n    edit = edit || {};\r\n    var fill = new ol.style.Fill({\r\n      color: edit.fillColor || 'rgba(255,255,255,0.4)'\r\n    });\r\n    var stroke = new ol.style.Stroke({\r\n      color: edit.color || '#3399CC',\r\n      width: 1.25\r\n    });\r\n    var style = new ol.style.Style({\r\n      image: new ol.style.Circle({\r\n        fill: fill,\r\n        stroke: stroke,\r\n        radius: 5\r\n      }),\r\n      fill: fill,\r\n      stroke: stroke\r\n    });\r\n    return [ style ];\r\n  }\r\n};\r\n})();\r\n\r\n/*\r\n* Copyright (c) 2015 Jean-Marc VIGLINO, \r\n* released under the CeCILL-B license (French BSD license)\r\n* (http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt).\r\n*/\r\n/**\r\n * Get a style for Geoportail WFS features\r\n *\r\n * @param {String} options.typeName \r\n * @param {any} options\r\n *  @param {boolean|number} options.sens true show flow direction or a max resolution to show it, default false\r\n *  @param {boolean} options.vert 'vert' road section (troncon_de_route) style, default false\r\n *  @param {boolean} options.symbol show symbol on buildings (batiment), default false\r\n * @return {Array<ol.style.Style>}\r\n */\r\nol.style.geoportailStyle;\r\n(function(){\r\nvar cache = {};\r\nvar styleCount = 0;\r\n// Troncon de route\r\nfunction troncon_de_route(options) {\r\n  // Get color according to road properties\r\n  var getColor = function (feature) {\r\n    if (options.vert && feature.get('itineraire_vert')) {\r\n      if (feature.get('position_par_rapport_au_sol') < 0) return [0, 128, 0, .7];\r\n      else if (feature.get('position_par_rapport_au_sol') > 0) return [0, 100, 0, 1];\r\n      else return [0, 128, 0, 1];\r\n    }\r\n    if (!feature.get('importance')) return \"magenta\";\r\n    if (feature.get('nature') === 'Piste cyclable') {\r\n      return [27,177,27,.5]\r\n    }\r\n    if (feature.get('position_par_rapport_au_sol') != \"0\") {\r\n      var col;\r\n      switch(feature.get('importance')) {\r\n        case \"1\": col = [177, 27, 177, 1]; break;\r\n        case \"2\": col = [177, 27, 27, 1]; break;\r\n        case \"3\": col = [217, 119, 0, 1]; break;\r\n        case \"4\": col = [255, 225, 0, 1]; break;\r\n        case \"5\": col = [204, 204, 204, 1]; break;\r\n        default: col = [211, 211, 211, 1]; break;\r\n      }\r\n      if (feature.get('position_par_rapport_au_sol') < 0) col[3] = .7;\r\n      return col;\r\n    } else {\r\n      switch(feature.get('importance')) {\r\n        case \"1\": return [255,0,255,1]; \r\n        case \"2\": return [255,0,0,1]; \r\n        case \"3\": return [255, 165, 0, 1];\r\n        case \"4\": return [255,255,0,1]; \r\n        case \"5\": return [255,255,255,1]; \r\n        default: return [211, 211, 211, 1];\r\n      }\r\n    }\r\n    // return \"#808080\";\r\n  }\r\n  // Get Width\r\n  var getWidth = function (feature) {\r\n    return Math.max ( feature.get('largeur_de_chaussee')||2 , 2 );\r\n  }\r\n  // Zindex\r\n  var getZindex = function (feature) {\r\n    if (!feature.get('position_par_rapport_au_sol')) return 100;\r\n    var pos = Number(feature.get('position_par_rapport_au_sol'));\r\n    if (pos>0) return 10 + pos*10 - (Number(feature.get('importance')) || 10);\r\n    else if (pos<0) return Math.max(4 + pos, 0);\r\n    else return 10 - (Number(feature.get('importance')) || 10);\r\n    // return 0;\r\n  }\r\n  // Get rotation on the center of the line\r\n  var lrot = function (geom) {\r\n    //if (sens != options.direct && sens != options.inverse) return 0;\r\n    var geo = geom.getCoordinates();\r\n    var x, y, dl=0, l = geom.getLength();\r\n    for (var i=0; i<geo.length-1; i++) {\r\n      x = geo[i+1][0]-geo[i][0];\r\n      y = geo[i+1][1]-geo[i][1];\r\n      dl += Math.sqrt(x*x+y*y);\r\n      if (dl>=l/2) break;\r\n    }\r\n    return -Math.atan2(y,x);\r\n  }\r\n  // Sens circulation\r\n  var getSens = function (feature) {\r\n    if (options.sens && !/double|sans/i.test(feature.get('sens_de_circulation'))) {\r\n      return new ol.style.Text({\r\n        text: (feature.get('sens_de_circulation') == 'Sens direct' ? '→' : '←'),\r\n        font: 'bold 12px sans-serif',\r\n        placement: 'point',\r\n        textAlign: 'center',\r\n        fill: new ol.style.Fill({ color: [0,0,0,.3] }),\r\n        stroke: new ol.style.Stroke({ color: [0,0,0,.3], width: 1.5 }),\r\n        rotateWithView: true\r\n      })\r\n    }\r\n    return null;\r\n  }\r\n  var getDash = function(feature) {\r\n    switch (feature.get('nature')) {\r\n      case 'Escalier': {\r\n        return [1,4]\r\n      }\r\n      case 'Sentier': {\r\n        return [8,10]\r\n      }\r\n    }\r\n  }\r\n  var styleId = 'ROUT-'+(styleCount++)+'-'\r\n  return function (feature, res) {\r\n    var useSens = (options.sens === true || res < options.sens);\r\n    var id = styleId\r\n      + feature.get('nature') + '-'\r\n      + feature.get('position_par_rapport_au_sol') + '-'\r\n      + (useSens ? feature.get('sens_de_circulation') : 'Sans objet') + '-'\r\n      + feature.get('position_par_rapport_au_sol') + '-'\r\n      + feature.get('importance') + '-'\r\n      + feature.get('largeur_de_chaussee') + '-'\r\n      + feature.get('itineraire_vert');\r\n    var style = cache[id];\r\n    if (!style) {\r\n      style = cache[id] = [\t\r\n        new ol.style.Style ({\r\n          text: useSens ? getSens(feature) : null,\r\n          stroke: new ol.style.Stroke({\r\n            color: getColor(feature),\r\n            width: getWidth(feature),\r\n            lineDash: getDash(feature)\r\n          }),\r\n          zIndex: getZindex(feature)-100\r\n        })\r\n      ];\r\n    }\r\n    // Rotation\r\n    if (style[0].getText()) style[0].getText().setRotation(lrot(feature.getGeometry()));\r\n    return style;\r\n  };\r\n}\r\n/** Style for batiments */\r\nfunction batiment(options) {\r\n  var getBatiColor = function (feature) {\r\n    switch (feature.get('nature')) {\r\n      case \"Industriel, agricole ou commercial\": return [51, 102, 153,1];\r\n      case \"Remarquable\": return [0,192,0,1];\r\n      default: \r\n        switch ( feature.get('usage_1') ) {\r\n          case 'Résidentiel':\r\n          case 'Indifférencié': \r\n            return [128,128,128,1];\r\n          case 'Industriel':\r\n          case 'Commercial et services': \r\n            return [51, 102, 153,1];\r\n          case \"Sportif\": \r\n            return [51,153,102,1];\r\n          case \"Religieux\": \r\n            return [153,102,51,1];\r\n          default: return [153,51,51,1];\r\n        }\r\n    }\r\n  }\r\n  var getSymbol = function (feature) {\r\n    switch ( feature.get('usage_1') ) {\r\n      case \"Commercial et services\": return \"\\uf217\";\r\n      case \"Sportif\": return \"\\uf1e3\";\r\n      default: return null;\r\n    }\r\n  }\r\n  var styleId = 'BATI-'+(styleCount++)+'-'\r\n  return function (feature) {\r\n    if (feature.get('detruit')) return [];\r\n    var id = styleId \r\n      + feature.get('usage_1') + '-'\r\n      + feature.get('nature') + '-'\r\n      + feature.get('etat_de_l_objet');\r\n    var style = cache[id];\r\n    if (!style) {\r\n      var col = getBatiColor(feature);\r\n      var colfill = [col[0], col[1], col[1], .5]\r\n      var projet = !/en service/i.test(feature.get('etat_de_l_objet'));\r\n      if (projet) colfill[3] = .1;\r\n      var symbol = (options.symbol ? getSymbol(feature): null);\r\n      return [\r\n        new ol.style.Style({\r\n          text: symbol ? new ol.style.Text({\r\n            text: symbol,\r\n            font: '12px FontAwesome',\r\n            fill: new ol.style.Fill({\r\n              color: [0,0,0, .6] //col\r\n            })\r\n          }) : null,\r\n          fill: new ol.style.Fill({\r\n            color: colfill\r\n          }),\r\n          stroke: new ol.style.Stroke ({\r\n            color: col,\r\n            width: 1.5,\r\n            lineDash: projet ? [5,5] : null\r\n          })\r\n        })\r\n      ]\r\n    }\r\n    return style\r\n  }\r\n}\r\n// Parcelle / cadastre\r\nfunction parcelle(options) {\r\n  var style = new ol.style.Style({\r\n    text: new ol.style.Text({\r\n      text: '0000',\r\n      font: 'bold 12px sans-serif',\r\n      fill: new ol.style.Fill({\r\n        color: [100, 0, 255, 1]\r\n      }),\r\n      stroke: new ol.style.Stroke ({\r\n        color: [255,255,255, .8],\r\n        width: 3\r\n      })\r\n    }),\r\n    stroke: new ol.style.Stroke ({\r\n      color: [255, 165, 0, 1],\r\n      width: 1.5\r\n    }),\r\n    fill: new ol.style.Fill({\r\n      color: [100, 0, 255, .1]\r\n    })\r\n  })\r\n  return function(feature, resolution) {\r\n    if (resolution < .8) style.getText().setFont('bold 12px sans-serif');\r\n    else style.getText().setFont('bold 10px sans-serif');\r\n    if (options.section) {\r\n      style.getText().setText(feature.get('section') +'-'+ (feature.get('numero')||'').replace(/^0*/,''));\r\n    } else {\r\n      style.getText().setText((feature.get('numero')||'').replace(/^0*/,''));\r\n    }\r\n    return style;\r\n  }\r\n}\r\n// Corine Land Cover Style\r\nvar clcColors = {\r\n  111: { color: [230,0,77,255], title: 'Continuous urban fabric'},\r\n  112: { color: [255,0,0,255], title: 'Discontinuous urban fabric'},\r\n  121: { color: [204,77,242,255], title: 'Industrial or commercial units'},\r\n  122: { color: [204,0,0,255], title: 'Road and rail networks and associated land'},\r\n  123: { color: [230,204,204,255], title: 'Port areas'},\r\n  124: { color: [230,204,230,255], title: 'Airports'},\r\n  131: { color: [166,0,204,255], title: 'Mineral extraction sites'},\r\n  132: { color: [166,77,0,255], title: 'Dump sites'},\r\n  133: { color: [255,77,255,255], title: 'Construction sites'},\r\n  141: { color: [255,166,255,255], title: 'Green urban areas'},\r\n  142: { color: [255,230,255,255], title: 'Sport and leisure facilities'},\r\n  211: { color: [255,255,168,255], title: 'Non-irrigated arable land'},\r\n  212: { color: [255,255,0,255], title: 'Permanently irrigated land'},\r\n  213: { color: [230,230,0,255], title: 'Rice fields'},\r\n  221: { color: [230,128,0,255], title: 'Vineyards'},\r\n  222: { color: [242,166,77,255], title: 'Fruit trees and berry plantations'},\r\n  223: { color: [230,166,0,255], title: 'Olive groves'},\r\n  231: { color: [230,230,77,255], title: 'Pastures'},\r\n  241: { color: [255,230,166,255], title: 'Annual crops associated with permanent crops'},\r\n  242: { color: [255,230,77,255], title: 'Complex cultivation patterns'},\r\n  243: { color: [230,204,77,255], title: 'Land principally occupied by agriculture with significant areas of natural vegetation'},\r\n  244: { color: [242,204,166,255], title: 'Agro-forestry areas'},\r\n  311: { color: [128,255,0,255], title: 'Broad-leaved forest'},\r\n  312: { color: [0,166,0,255], title: 'Coniferous forest'},\r\n  313: { color: [77,255,0,255], title: 'Mixed forest'},\r\n  321: { color: [204,242,77,255], title: 'Natural grasslands'},\r\n  322: { color: [166,255,128,255], title: 'Moors and heathland'},\r\n  323: { color: [166,230,77,255], title: 'Sclerophyllous vegetation'},\r\n  324: { color: [166,242,0,255], title: 'Transitional woodland-shrub'},\r\n  331: { color: [230,230,230,255], title: 'Beaches dunes sands'},\r\n  332: { color: [204,204,204,255], title: 'Bare rocks'},\r\n  333: { color: [204,255,204,255], title: 'Sparsely vegetated areas'},\r\n  334: { color: [0,0,0,255], title: 'Burnt areas'},\r\n  335: { color: [166,230,204,255], title: 'Glaciers and perpetual snow'},\r\n  411: { color: [166,166,255,255], title: 'Inland marshes'},\r\n  412: { color: [77,77,255,255], title: 'Peat bogs'},\r\n  421: { color: [204,204,255,255], title: 'Salt marshes'},\r\n  422: { color: [230,230,255,255], title: 'Salines'},\r\n  423: { color: [166,166,230,255], title: 'Intertidal flats'},\r\n  511: { color: [0,204,242,255], title: 'Water courses'},\r\n  512: { color: [128,242,230,255], title: 'Water bodies'},\r\n  521: { color: [0,255,166,255], title: 'Coastal lagoons'},\r\n  522: { color: [166,255,230,255], title: 'Estuaries'},\r\n  523: { color: [230,242,255,255], title: 'Sea and ocean'},\r\n};\r\nfunction corineLandCover (options) {\r\n  return function(feature) {\r\n    var code = feature.get('code_'+options.date);\r\n    var style = cache['CLC-'+code];\r\n    if (!style) {\r\n      var color = clcColors[code].color.slice();\r\n      color[3] = options.opacity || 1;\r\n      style = cache['CLC-'+code] = new ol.style.Style({\r\n        fill: new ol.style.Fill({\r\n          color: color || [255,255,255,.5]\r\n        })\r\n      })\r\n    }\r\n    return style;\r\n  }\r\n}\r\n/** Get ol style for an IGN WFS layer\r\n * @param {string} typeName\r\n * @param {Object} options\r\n */\r\nol.style.geoportailStyle = function(typeName, options) {\r\n  options = options || {};\r\n  switch (typeName) {\r\n    // Troncons de route\r\n    case 'BDTOPO_V3:troncon_de_route': return troncon_de_route(options);\r\n    // Bati\r\n    case 'BDTOPO_V3:batiment': return batiment(options);\r\n    // Parcelles\r\n    case 'CADASTRALPARCELS.PARCELLAIRE_EXPRESS:parcelle': return parcelle(options);\r\n    default: {\r\n      // CLC\r\n      if (/LANDCOVER/.test(typeName)) {\r\n        options.date = typeName.replace(/[^\\d]*(\\d*).*/,'$1');\r\n        return (corineLandCover(options));\r\n      } else {\r\n        // Default style\r\n        console.warn('[ol/style/geoportailStyle] no style defined for type: ' + typeName)\r\n        return ol.style.Style.defaultStyle(); \r\n      }\r\n    }\r\n  }\r\n};\r\n/** List of clc colors */\r\nol.style.geoportailStyle.clcColors = JSON.parse(JSON.stringify(clcColors));\r\n})();\r\n"]}