rajeev-extent
Version:
a JavaScript library for openlayers extent
8 lines • 119 kB
JavaScript
/*!
* author: FDD <smileFDD@gmail.com>
* ol-extent v2.0.1
* build-time: 2023-11-23 15:14
* LICENSE: MIT
* (c) 2017-2023 https://sakitam-fdd.github.io/ol-extent/
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("openlayers")):"function"==typeof define&&define.amd?define(["exports","openlayers"],t):t(e.ole={},e.ol)}(this,function(e,s){"use strict";s=s&&s.hasOwnProperty("default")?s.default:s;for(var I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},h=function(e,t){if(e)return!t||"object"!=typeof t&&"function"!=typeof t?e:t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")},F=arguments,O=/([\:\-\_]+(.))/g,Z=/^moz([A-Z])/,g=[],G=new Array(16),z=0;z<256;++z)g[z]=(z+256).toString(16).substr(1);function j(e){return(e||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")}function H(e){return e.replace(O,function(e,t,g,A){return A?g.toUpperCase():g}).replace(Z,"Moz$1")}function o(e,t,g){var A=t&&g||0,C=("string"==typeof e&&(t="binary"===e?new Array(16):null,e=null),(e=e||{}).random||(e.rng||te)());if(C[6]=15&C[6]|64,C[8]=63&C[8]|128,t)for(var I=0;I<16;++I)t[A+I]=C[I];return t||ee(C)}function V(e,t){var g=Math.random()*(t-e),g=Math.round(g+e);return Math.max(Math.min(g,t),e)}function W(e){for(var t=Object.keys(e),g={},A=0;A<t.length;A++){var C=t[A];"object"===I(e[C])?g[C]=W(e[C]):g[C]=e[C]}return g}function u(e,t,g,A){return e=document.createElement(e),A&&(e.id=A),t&&a(e,t),g&&g.appendChild(e),e}function U(e,t,g){var A;return"undefined"!=typeof document?((A=document.createElement("canvas")).width=e,A.height=t,A):new g(e,t)}function i(e){return"string"==typeof e?document.getElementById(e):e}function a(e,t){if(e){for(var g=e.className,A=(t||"").split(" "),C=0,I=A.length;C<I;C++){var i=A[C];i&&(e.classList?e.classList.add(i):ge(e,i)||(g+=" "+i))}e.classList||(e.className=g)}}function Y(e,t){if(e&&t){for(var g=t.split(" "),A=" "+e.className+" ",C=0,I=g.length;C<I;C++){var i=g[C];i&&(e.classList?e.classList.remove(i):ge(e,i)&&(A=A.replace(" "+i+" "," ")))}e.classList||(e.className=j(A))}}function B(t,g){if(!t||!g)return null;"float"===(g=H(g))&&(g="cssFloat");try{var e=document.defaultView.getComputedStyle(t,"");return t.style[g]||e?e[g]:null}catch(e){return t.style[g]}}function c(e,t,g){if(e&&t)if("object"===(void 0===t?"undefined":I(t)))for(var A in t)t.hasOwnProperty(A)&&c(e,A,t[A]);else"opacity"===(t=H(t))?e.style.filter=isNaN(g)?"":"alpha(opacity="+100*g+")":e.style[t]=g}function X(e,t,g){return"_dom_event_"+e+"_"+$(t)+(g?"_"+$(g):"")}function K(t,e,g,A,C){var I=X(e,g,A),i=t[I];return i?C||(i.callOnce=!1):(i=function(e){return g.call(A||t,e)},"addEventListener"in t?t.addEventListener(e,i,!1):"attachEvent"in t&&t.attachEvent("on"+e,i),t[I]=i),this}function Q(e,t,g,A){return g=X(t,g,A),(A=e[g])&&("removeEventListener"in e?e.removeEventListener(t,A,!1):"detachEvent"in e&&e.detachEvent("on"+t,A),e[g]=null),this}function J(e){return e.preventDefault?e.preventDefault():e.returnValue=!1,this}function p(e){return e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this}var q,$=function(e){var t="_event_id_";return e[t]=e[t]||o(),e[t]},ee=function(e,t){t=t||0;return g[e[t++]]+g[e[t++]]+g[e[t++]]+g[e[t++]]+"-"+g[e[t++]]+g[e[t++]]+"-"+g[e[t++]]+g[e[t++]]+"-"+g[e[t++]]+g[e[t++]]+"-"+g[e[t++]]+g[e[t++]]+g[e[t++]]+g[e[t++]]+g[e[t++]]+g[e[+t]]},te=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),G[t]=e>>>((3&t)<<3)&255;return G},ge=function(e,t){if(!e||!t)return!1;if(-1!==t.indexOf(" "))throw new Error("className should not contain space.");return e.classList?e.classList.contains(t):-1<(" "+e.className+" ").indexOf(" "+t+" ")},d=K,A=Q,Ae=Object.freeze({has:function(e,t){return"object"===(void 0===e?"undefined":I(e))&&e.hasOwnProperty(t)},merge:function(e){for(var t=1,g=F.length;t<g;t++){var A,C,I=F[t]||{};for(A in I)I.hasOwnProperty(A)&&void 0!==(C=I[A])&&(e[A]=C)}return e},stamp:$,uuid:o,trim:j,isNull:function(e){return null==e},isString:function(e){return null!=e&&("string"==typeof e||null!==e.constructor&&e.constructor===String)},isObject:function(e){var t=void 0===e?"undefined":I(e);return null!==e&&("object"===t||"function"===t)},isNumber:function(e){return"number"==typeof e&&!isNaN(e)},camelCase:H,getRandom:V,cloneDeep:W,create:u,createCanvas:U,getElement:i,remove:function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},empty:function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},createHidden:function(e,t,g){e=document.createElement(e);return e.style.display="none",g&&(e.id=g),t&&t.appendChild(e),e},hasClass:ge,addClass:a,removeClass:Y,getStyle:B,setStyle:c,on:d,once:function(e,t,g,A){return K(e,t,g,A,!0)},addListener:K,off:A,removeListener:Q,preventDefault:J,stopPropagation:p}),Ce=(q=s.layer.Image,t(C,q),C.prototype.redraw=function(){var e=this.options.extent||this._getMapExtent();this.setExtent(e)},C.prototype.getContext=function(){return this._canvas.getContext(this.get("context")||"2d")},C.prototype._getMapExtent=function(){var e,t;if(this.getMap())return e=this._getMapSize(),(t=this.getMap().getView())&&t.calculateExtent(e)},C.prototype._getMapSize=function(){if(this.getMap())return this.getMap().getSize()},C.prototype.canvasFunction=function(e,t,g,A,C){return this._canvas?(this._canvas.width=A[0],this._canvas.height=A[1]):this._canvas=U(A[0],A[1]),t<=this.get("maxResolution")&&(t=this.getContext(),this.get("render"))&&this.get("render")({context:t,extent:e,size:A,pixelRatio:g,projection:C}),this._canvas},C.prototype.setMap=function(e){s.layer.Image.prototype.setMap.call(this,e)},C.prototype.getMap=function(){return this.get("map")},C);function C(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,C),h(this,q.call(this,e)));return t._canvas=null,t.options=e,t.setSource(new s.source.ImageCanvas({logo:e.logo,state:e.state,attributions:e.attributions,resolutions:e.resolutions,canvasFunction:t.canvasFunction.bind(t),projection:e.hasOwnProperty("projection")?e.projection:"EPSG:3857",ratio:e.hasOwnProperty("ratio")?e.ratio:1})),t.on("precompose",t.redraw,t),t}Ie=s.layer.Image,t(n,Ie),n.prototype.addFeature=function(e){this.features.push(e)},n.prototype.addFeatures=function(e){this.features=this.features.concat(e)},n.prototype.getFeatures=function(){return this.features},n.prototype.getFeatureById=function(e){},n.prototype.getStyle=function(){return this._style},n.prototype.setStyle=function(e){this._style=e},n.prototype._drawFeature=function(){var e=this;if(this.getMap()){this._context||(this._context=this.getContext());var t=this.features.length,g=e._style.getImage();if(g){var A=new Image;if(A.src=g.getSrc(),A.complete)for(var C=A,I=0;I<t;I++){var i,o=e.features[I].getGeometry(),o=o&&o.getCoordinates();o&&(o=e.getMap().getPixelFromCoordinate(o),i=e._style.getImage().getSize(),e._context.drawImage(C,o[0],o[1],i[0],i[1]))}}}},n.prototype.redraw=function(){var e=this.options.extent||this._getMapExtent();this.setExtent(e)},n.prototype.getContext=function(){return this._canvas.getContext(this.get("context")||"2d")},n.prototype._getMapExtent=function(){var e,t;if(this.getMap())return e=this._getMapSize(),(t=this.getMap().getView())&&t.calculateExtent(e)},n.prototype._getMapSize=function(){if(this.getMap())return this.getMap().getSize()},n.prototype.canvasFunction=function(e,t,g,A,C){return this._canvas?(this._canvas.width=A[0],this._canvas.height=A[1]):this._canvas=U(A[0],A[1]),t<=this.get("maxResolution")&&(t=this.getContext(),this._drawFeature(),this.get("render"))&&this.get("render")({context:t,extent:e,size:A,pixelRatio:g,projection:C}),this._canvas},n.prototype.setMap=function(e){this.set("originMap",e)},n.prototype.getMap=function(){return this.get("originMap")};var Ie,ie=n;function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,n),h(this,Ie.call(this,e)));return t._canvas=null,t._context=null,t._style=null,t.features=[],t.options=e,t.setSource(new s.source.ImageCanvas({logo:e.logo,state:e.state,attributions:e.attributions,resolutions:e.resolutions,canvasFunction:t.canvasFunction.bind(t),projection:e.hasOwnProperty("projection")?e.projection:"EPSG:3857",ratio:e.hasOwnProperty("ratio")?e.ratio:1})),t.setStyle(e.style),t.on("precompose",t.redraw,t),t}s.layer.DozensLayer=ie;var oe,ne=Object.freeze({CanvasLayer:Ce,DozensLayer:ie}),re=(oe=s.source.TileImage,t(se,oe),se);function se(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,se),""),t=void 0!==e.attributions?e.attributions:[se.ATTRIBUTION];e.projection=e.projection||"EPSG:3857";for(var g=void 0!==e.crossOrigin?e.crossOrigin:"anonymous",A=void 0!==e.url?e.url:"http://online{0-3}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20170607&scaler=1&p=1",C=e.hidpi||1<(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI),A=A.replace("{styles}",C?"ph":"pl"),I=(I=e.tileUrlFunction||void 0)||function(e){var e=[e[0],e[2],e[1]],t=e[0],g=e[1],e=e[2];return e<0&&(e="M"+-e),g<0&&(g="M"+-g),A.replace("{0-3}",V(0,3)).replace("{x}",e.toString()).replace("{y}",g.toString()).replace("{z}",t.toString())},i=e.levels||19,o=[],n=0;n<i;n++)o[n]=Math.pow(2,i-1-n);var r=new s.tilegrid.TileGrid({tileSize:e.tileSize||256,origin:e.origin||[0,0],extent:e.extent||void 0,resolutions:o,minZoom:e.minZoom&&"number"==typeof e.minZoom?e.minZoom:0});return h(this,oe.call(this,{tileGrid:r,attributions:t,cacheSize:e.cacheSize,projection:e.projection,crossOrigin:g,opaque:void 0===e.opaque||e.opaque,maxZoom:void 0!==e.maxZoom?e.maxZoom:19,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileUrlFunction:I,url:A,wrapX:e.wrapX,tilePixelRatio:C?2:1}))}re.ATTRIBUTION=new s.Attribution({html:'© <a href="http://map.baidu.com/">\u767e\u5ea6\u5730\u56fe</a> contributors.'});ae=s.source.XYZ,t(he,ae);var ae,le=he;function he(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,he),""),t=void 0!==e.attributions?e.attributions:[he.ATTRIBUTION],g=(e.projection=e.projection||"EPSG:3857",void 0!==e.crossOrigin?e.crossOrigin:"anonymous"),A=void 0!==e.url?e.url:"http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=6&x={x}&y={y}&z={z}",C=e.tileUrlFunction||void 0;return h(this,ae.call(this,{attributions:t,cacheSize:e.cacheSize,crossOrigin:g,opaque:void 0===e.opaque||e.opaque,maxZoom:void 0!==e.maxZoom?e.maxZoom:19,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,tileUrlFunction:C,url:A,wrapX:e.wrapX}))}le.ATTRIBUTION=new s.Attribution({html:'© <a href="http://ditu.amap.com/">\u9ad8\u5fb7\u5730\u56fe</a> contributors.'});ue=s.source.XYZ,t(pe,ue);var ue,ce=pe;function pe(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,pe),""),t=void 0!==e.attributions?e.attributions:[pe.ATTRIBUTION],g=(e.projection=e.projection||"EPSG:3857",void 0!==e.crossOrigin?e.crossOrigin:"anonymous"),A=void 0!==e.url?e.url:"http://www.google.cn/maps/vt?lyrs=m@189&gl=cn&x={x}&y={y}&z={z}";return h(this,ue.call(this,{attributions:t,cacheSize:e.cacheSize,crossOrigin:g,opaque:void 0===e.opaque||e.opaque,maxZoom:void 0!==e.maxZoom?e.maxZoom:19,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,url:A,wrapX:e.wrapX}))}ce.ATTRIBUTION=new s.Attribution({html:'© <a href="http://www.google.cn/maps">\u8c37\u6b4c\u5730\u56fe</a> contributors.'});var de=Object.freeze({Baidu:re,Gaode:le,Google:ce}),me="ole-hidden",m="ole-selectable",y="ole-unselectable",r={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft",METERS_PER_UNIT:{}};r.METERS_PER_UNIT[r.DEGREES]=2*Math.PI*6370997/360,r.METERS_PER_UNIT[r.FEET]=.3048,r.METERS_PER_UNIT[r.METERS]=1,r.METERS_PER_UNIT[r.USFEET]=1200/3937;var ye=.1,fe=.75;(function(e){var I,t,g,A,C,i;I="undefined"!=typeof window&&void 0!==window.document?window.document:{},t=e.exports,g="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,A=function(){for(var e,t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],g=0,A=t.length,C={};g<A;g++)if((e=t[g])&&e[1]in I){for(g=0;g<e.length;g++)C[t[0][g]]=e[g];return C}return!1}(),C={change:A.fullscreenchange,error:A.fullscreenerror},i={request:function(e){var t=A.requestFullscreen;e=e||I.documentElement,/ Version\/5\.1(?:\.\d+)? Safari\//.test(navigator.userAgent)?e[t]():e[t](g?Element.ALLOW_KEYBOARD_INPUT:{})},exit:function(){I[A.exitFullscreen]()},toggle:function(e){this.isFullscreen?this.exit():this.request(e)},onchange:function(e){this.on("change",e)},onerror:function(e){this.on("error",e)},on:function(e,t){e=C[e];e&&I.addEventListener(e,t,!1)},off:function(e,t){e=C[e];e&&I.removeEventListener(e,t,!1)},raw:A},A?(Object.defineProperties(i,{isFullscreen:{get:function(){return Boolean(I[A.fullscreenElement])}},element:{enumerable:!0,get:function(){return I[A.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return Boolean(I[A.fullscreenEnabled])}}}),t?e.exports=i:window.screenfull=i):t?e.exports=!1:window.screenfull=!1})(we={exports:{}});var ve,_e=we.exports,we=(ve=s.control.Control,t(Me,ve),Me.prototype.handleClick_=function(e){var t=this;e.preventDefault(),this.getMap()&&(e=null,e=this.source_?"string"==typeof this.source_?document.getElementById(this.source_):this.source_:this.getMap().getTargetElement(),_e.enabled)&&(_e.toggle(e),_e.on("change",function(){_e.isFullscreen?t.element.firstElementChild.innerHTML=t.labelActive:t.element.firstElementChild.innerHTML=t.label}))},Me);function Me(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,Me),void 0!==e.label?e.label:"\u2922"),g=void 0!==e.labelActive?e.labelActive:"\xd7",A=void 0!==e.className?e.className:"ole-control-full-screen",C=u("div",A+" "+y),A=u("span",A+"-inner",C),A=(A.setAttribute("title","\u5168\u5c4f"),A.innerHTML=t,h(this,ve.call(this,{element:C,target:e.target})));return A.label=t,A.labelActive=g,A.keys_=void 0!==e.keys&&e.keys,A.size_=void 0!==e.size?e.size:[16,16],A.source_=e.source,d(C,"click",A.handleClick_,A),A}be=s.control.Control,t(f,be),f.prototype.setup=function(){var e,t,g,A=this;this.getMap()&&(this.setDomPosition(),this.getMap().on("change:size",this.setDomPosition,this),e=this.getMap().on("pointerdown",this.hide(),this),t=this.getMap().on("precompose",function(){A.isFirstRander&&(A.isFirstRander=!1,A.registerLayersLoadEvents_(),A.show(),A.onCustomStart)&&A.onCustomStart.apply(A,[])}),g=this.getMap().on("postrender",function(){A.updateLoadStatus_(),A.loadStatus_&&(A.onCustomEnd&&A.onCustomEnd.apply(A,[]),A.hide())}),this.mapListeners.push(e),this.mapListeners.push(t),this.mapListeners.push(g))},f.prototype.setDomPosition=function(){var e,t=this.getMap().getSize();t&&(e=[this.element.clientWidth,this.element.clientHeight],c(this.element,{left:String(Math.round((t[0]-e[0])/2))+"px",bottom:String(Math.round((t[1]-e[1])/2))+"px"}))},f.prototype.updateSourceLoadStatus_=function(e){return 100===Math.round(e.loaded/e.loading*100)},f.prototype.registerLayerLoadEvents_=function(e){var g=this;e.getSource().on("tileloadstart",function(e){var t;g.loadStatus_&&(g.loadStatus_=!1,g.loadProgress_=[0,1],"progressBar"===g.widget&&(g.element.value=g.loadProgress_[0],g.element.max=g.loadProgress_[1]),g.show(),g.onCustomStart)&&g.onCustomStart.apply(g,[]),this.loading=this.loading?this.loading+1:1,this.isLoaded=g.updateSourceLoadStatus_(this),g.loadProgressByTile_&&(this.loadProgress_[1]+=1,"progressBar"===this.widget)&&(g.element.max=g.loadProgress_[1],0<(t=g.element.getElementsByClassName("ole-progress-bar")).length)&&(t[0].children()[0].width=String(parseInt(100*g.progress(),0))+"%")}),e.getSource().on(["tileloadend","tileloaderror"],function(e){3===e.tile.getState()&&console.warn("Loading tile failed for resource '"+e.tile.src_+"'"),this.loaded=this.loaded?this.loaded+1:1,this.isLoaded=g.updateSourceLoadStatus_(this),g.loadProgressByTile_&&(g.loadProgress_[0]+=1,"progressBar"===g.widget&&(g.element.value=g.loadProgress_[0],0<(e=this.element.getElementsByClassName("ole-progress-bar")).length)&&(e[0].children()[0].width=String(parseInt(100*g.progress(),0))+"%"),g.onCustomProgress)&&g.onCustomProgress.apply(g,g.loadProgress_)})},f.prototype.registerLayersLoadEvents_=function(){for(var e=this.getMap().getLayers().getArray(),t=0;t<e.length;t++){var g=e[t];if(g instanceof s.layer.Group)for(var A=g.getLayers().getArray(),C=0;C<A.length;C++){var I=A[C];I instanceof s.layer.Vector||this.tileListeners.push(this.registerLayerLoadEvents_(I))}else g instanceof s.layer.Layer&&(g instanceof s.layer.Vector||this.tileListeners.push(this.registerLayerLoadEvents_(g)))}},f.prototype.updateLoadStatus_=function(){for(var t,e,g=[],A=this.getMap().getLayers().getArray(),C=0;C<A.length;C++){var I=A[C];if(I)if(I instanceof s.layer.Group)for(var i=I.getLayers().getArray(),o=0;o<i.length;o++){var n=i[o];n&&n.getSource()&&!(n instanceof s.layer.Vector)&&n.getSource().hasOwnProperty("isLoaded")&&g.push(n.getSource().isLoaded)}else I.getSource()&&I.getSource().hasOwnProperty("isLoaded")&&g.push(I.getSource().isLoaded)}this.loadStatus_=-1===g.indexOf(!1)&&-1!==g.indexOf(!0),this.loadProgressByTile_||(t={},g.forEach(function(e){t[e]=(t[e]||0)+1}),(e=t[!0]||0)>this.loadProgress_[0]&&(this.loadProgress_=[e,g.length],"progressBar"===this.widget&&(this.element.max=this.loadProgress_[1],this.element.value=this.loadProgress_[0]),this.onCustomProgress)&&this.onCustomProgress.apply(this,this.loadProgress_))},f.prototype.show=function(){this.showPanel&&(this.element.style.display="block")},f.prototype.hide=function(){this.showPanel&&(this.element.style.display="none")},f.prototype.progressDetails=function(){return this.loadProgress_},f.prototype.progress=function(){return this.loadProgress_[0]/this.loadProgress_[1]},f.prototype.setMap=function(e){var t=this;this.mapListeners&&0<this.mapListeners.length&&this.mapListeners.forEach(function(e){t.getMap().unByKey(e)}),this.mapListeners.length=0,be.prototype.setMap.call(this,e),e&&this.setup()};var be,Ee=f;function f(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,f),void 0!==e.className?e.className:"ole-loading-panel"),g=e.widget||"animatedGif",t=u("animatedGif"===g?"span":"progress",t+" "+y),t=h(this,be.call(this,{element:t,target:e.target}));if(t.mapListeners=[],t.tileListeners=[],t.loadStatus_=!1,t.isFirstRander=!0,t.loadProgress_=[0,1],t.widget=g,e.progressMode){if(-1===["tile","layer"].indexOf(e.progressMode))throw Error("\u4e0d\u652f\u6301\u7684\u8fdb\u5ea6\u6761\u6a21\u5f0f");t.loadProgressByTile_="layer"!==e.progressMode||!("layer"===e.progressMode)}return t.showPanel="boolean"!=typeof e.showPanel||e.showPanel,"progressBar"===t.widget&&(g=u("div","ole-progress-bar"),u("span","",g)),t.onCustomStart=e.onStart||!1,t.onCustomProgress=e.onProgress||!1,t.onCustomEnd=e.onEnd||!1,t}Le=s.control.Control,t(xe,Le),xe.prototype.handleClick_=function(e,t){t.preventDefault(),this.zoomByDelta_(e)},xe.prototype.zoomByDelta_=function(e){var t=this.getMap().getView();if(!t)throw new Error("can not get view!");var g=t.getResolution();g&&(g=t.constrainResolution(g,e),0<this.get("duration")?(t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:g,duration:this.get("duration"),easing:s.easing.easeOut})):t.setResolution(g))};var Le,Se=xe;function xe(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,xe),void 0!==e.className?e.className:"ole-control-zoom"),g=void 0!==e.delta?e.delta:1,t=u("div",t+" "+y),A=u("span","zoom-in",t),C=(A.setAttribute("title","\u653e\u5927"),A.innerHTML="+",u("span","zoom-out",t)),I=(C.setAttribute("title","\u7f29\u5c0f"),C.innerHTML="\u2212",void 0!==e.duration?e.duration:250),t=h(this,Le.call(this,{element:t,target:e.target}));return t.set("duration",I),d(A,"click",t.handleClick_.bind(t,g)),d(C,"click",t.handleClick_.bind(t,-g)),t}Pe=s.control.Control,t(v,Pe),v.prototype.getUnits=function(){return this.get(v.Property_.UNITS)},v.prototype.handleUnitsChanged_=function(){this.updateElement_()},v.prototype.setUnits=function(e){this.set(v.Property_.UNITS,e)},v.prototype.updateElement_=function(){var e=this.viewState_;if(e){for(var t=[e.center,e.projection],g=t[0],t=t[1],A=this.getUnits(),C=A===v.ScaleLineUnits.DEGREES?r.DEGREES:r.METERS,I=s.proj.getPointResolution(t,e.resolution,g,C),e=this.minWidth_*I,g="",i=(A===v.ScaleLineUnits.DEGREES?(C=s.proj.METERS_PER_UNIT[r.DEGREES],t.getUnits()===r.DEGREES?e*=C:I/=C,e<C/60?(g="\u2033",I*=3600):e<C?(g="\u2032",I*=60):g="\xb0"):A===v.ScaleLineUnits.IMPERIAL?e<.9144?(g="in",I/=.0254):e<1609.344?(g="ft",I/=.3048):(g="mi",I/=1609.344):A===v.ScaleLineUnits.NAUTICAL?(I/=1852,g="nm"):A===v.ScaleLineUnits.METRIC?e<.001?(g="\u03bcm",I*=1e6):e<1?(g="mm",I*=1e3):e<1e3?g="m":(g="km",I/=1e3):A===v.ScaleLineUnits.US?e<.9144?(g="in",I*=39.37):e<1609.344?(g="ft",I/=.30480061):(g="mi",I/=1609.3472):A===v.ScaleLineUnits.CHINESEMETRIC?e<.001?(g="\u5fae\u7c73",I*=1e6):e<1?(g="\u6beb\u7c73",I*=1e3):e<1e3?g="\u7c73":(g="\u5343\u7c73",I/=1e3):s.asserts.assert(!1,33),3*Math.floor(Math.log(this.minWidth_*I)/Math.log(10))),o=void 0,n=void 0;;){if(o=v.LEADING_DIGITS[(i%3+3)%3]*Math.pow(10,Math.floor(i/3)),n=Math.round(o/I),isNaN(n))return this.element.style.display="none",void(this.renderedVisible_=!1);if(n>=this.minWidth_)break;++i}t=o+" "+g;this.renderedHTML_!==t&&(this.innerElement_.innerHTML=t,this.renderedHTML_=t),this.renderedWidth_!==n&&(this.innerElement_.style.width=n+"px",this.renderedWidth_=n),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)};var Pe,De=v;function v(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,v),void 0!==e.className?e.className:"ole-scale-line-control"),g=u("div",t+" "+y),t=u("div",t+"-inner",g),A=e.render||v.render,g=h(this,Pe.call(this,{element:g,render:A,target:e.target}));return g.viewState_=null,g.minWidth_=void 0!==e.minWidth?e.minWidth:64,g.renderedVisible_=!1,g.renderedWidth_=void 0,g.renderedHTML_="",g.innerElement_=t,d(g,"change:"+v.Property_.UNITS,g.handleUnitsChanged_,g),g.setUnits(e.units||v.ScaleLineUnits.METRIC),g}De.render=function(e){e=e.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()},De.LEADING_DIGITS=[1,2,5],De.ScaleLineUnits={DEGREES:"degrees",IMPERIAL:"imperial",NAUTICAL:"nautical",METRIC:"metric",CHINESEMETRIC:"metric_cn",US:"us"},De.Property_={UNITS:"units"};Te=s.control.Control,t(_,Te),_.prototype.handleClick_=function(e,t){t.preventDefault(),this.resetNorth_(e)},_.prototype.resetNorth_=function(e){var t=0;"center"===e?void(t=0)!==this.callResetNorth_?this.callResetNorth_():this.rotationView_(t,e):"left"===e?this.rotationView_(t=-90):this.rotationView_(t=90)},_.prototype.rotationView_=function(e,t){var g=this.getMap().getView(),t="center"===t?0:g.getRotation()+e/180*Math.PI;if(!(g&&g instanceof s.View))throw new Error("can not get view!");void 0!==g.getRotation()&&(0<this.duration_?g.animate({rotation:t,duration:this.duration_,easing:s.easing.easeOut}):g.setRotation(0))};var Te,Re=_;function _(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,_),void 0!==e.className?e.className:"ole-rotate-control"),g=u("div",t+" "+y),A=u("button",t+"-inner right-button",g),C=u("button",t+"-inner center-button",g,t+"-inner-center"),t=u("button",t+"-inner left-button",g),I=e.render||_.render,g=h(this,Te.call(this,{element:g,render:I,target:e.target}));return g.callResetNorth_=e.resetNorth||void 0,g.duration_=void 0!==e.duration?e.duration:250,g.autoHide_=void 0===e.autoHide||e.autoHide,g.rotation_=void 0,g.label_=C,d(A,"click",g.handleClick_.bind(g,"right")),d(C,"click",g.handleClick_.bind(g,"center")),d(t,"click",g.handleClick_.bind(g,"left")),g}Re.render=function(e){var t,g,e=e.frameState;e&&((e=e.viewState.rotation)!==this.rotation_&&(t="rotate("+e+"rad)",this.autoHide_&&((g=ge(this.element,me))||0!==e?g&&0!==e&&Y(this.element,me):a(this.element,me)),c(this.label_,{transform:t,webkitTransform:t,msTransform:t})),this.rotation_=e)};ke=s.control.Control,t(w,ke),w.prototype.addOptionLayers_=function(e){var t=this.ovmap_;e.layers&&e.layers.forEach(function(e){t.addLayer(e)},this)},w.prototype.move_=function(e){var t=this.boxOverlay_.getElement(),e=this.ovmap_.getEventCoordinate(w.computeDesiredMousePosition(e,t));this.boxOverlay_.setPosition(e)},w.prototype.endMoving_=function(e){e=this.ovmap_.getEventCoordinate(e);this.getMap().getView().setCenter(e),A(window,"mousemove",this.move_,this),A(window,"mouseup",this.endMoving_,this)},w.prototype.addEvent_=function(){d(window,"mousemove",this.move_,this),d(window,"mouseup",this.endMoving_,this)},w.prototype.addBoxControl_=function(){var e=u("div","ole-overview-map-box");d(e,"mousedown",this.addEvent_,this),this.boxOverlay_=new s.Overlay({position:[0,0],positioning:"bottom-left",element:e}),this.ovmap_.addOverlay(this.boxOverlay_)},w.prototype.setMap=function(e){var t=this.getMap();e!==t&&(t&&((t=t.getView())&&this.unbindView_(t),this.ovmap_.setTarget(null)),ke.prototype.setMap.call(this,e),e)&&(this.ovmap_.setTarget(this.ovmapDiv_),e.on("propertychange",this.handleMapPropertyChange_,this),0===this.ovmap_.getLayers().getLength()&&this.ovmap_.setLayerGroup(e.getLayerGroup()),t=e.getView())&&(this.bindView_(t),this.isDef(t))&&(this.ovmap_.updateSize(),this.resetExtent_())},w.prototype.isDef=function(e){return!!e.getCenter()&&void 0!==e.getResolution()},w.prototype.handleMapPropertyChange_=function(e){"view"===e.key&&((e=e.oldValue)&&this.unbindView_(e),e=this.getMap().getView(),this.bindView_(e))},w.prototype.bindView_=function(e){e.on("change:rotation",this.handleRotationChanged_,this)},w.prototype.unbindView_=function(e){e.un("change:rotation",this.handleRotationChanged_,this)},w.prototype.handleRotationChanged_=function(){this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())},w.prototype.validateExtent_=function(){var e=this.getMap(),t=this.ovmap_,g=e.getSize(),e=e.getView().calculateExtent(g),g=t.getSize(),A=t.getView().calculateExtent(g),C=t.getPixelFromCoordinate(s.extent.getTopLeft(e)),t=t.getPixelFromCoordinate(s.extent.getBottomRight(e)),I=Math.abs(C[0]-t[0]),C=Math.abs(C[1]-t[1]),t=g[0],g=g[1];I<t*ye||C<g*ye||t*fe<I||g*fe<C?this.resetExtent_():s.extent.containsExtent(A,e)||this.recenter_()},w.prototype.resetExtent_=function(){var e,t,g;0!==fe&&0!==ye&&(e=this.getMap(),g=this.ovmap_,t=e.getSize(),e=e.getView().calculateExtent(t),t=g.getView(),g=Math.log(fe/ye)/Math.LN2,g=1/(Math.pow(2,g/2)*ye),this.scaleFromCenter(e,g),t.fit(e))},w.prototype.scaleFromCenter=function(e,t){var g=(e[2]-e[0])/2*(t-1),t=(e[3]-e[1])/2*(t-1);e[0]-=g,e[2]+=g,e[1]-=t,e[3]+=t},w.prototype.recenter_=function(){var e=this.getMap(),t=this.ovmap_,e=e.getView();t.getView().setCenter(e.getCenter())},w.prototype.updateBox_=function(){var e=this.getMap(),t=this.ovmap_,g=e.getSize(),e=e.getView(),t=t.getView(),A=e.getRotation(),C=this.boxOverlay_,I=this.boxOverlay_.getElement(),e=e.calculateExtent(g),g=t.getResolution(),t=s.extent.getBottomLeft(e),e=s.extent.getTopRight(e),A=this.calculateCoordinateRotate_(A,t);C.setPosition(A),I&&c(I,{width:Math.abs((t[0]-e[0])/g)+"px",height:Math.abs((e[1]-t[1])/g)+"px"})},w.prototype.calculateCoordinateRotate_=function(e,t){var g=void 0,A=this.getMap().getView().getCenter();return A&&(g=[t[0]-A[0],t[1]-A[1]],s.coordinate.rotate(g,e),s.coordinate.add(g,A)),g},w.prototype.handleClick_=function(e){e.preventDefault(),this.handleToggle_(e)},w.prototype.handleToggle_=function(e){this.collapsed_?(this.collapsed_=!1,e.target.style.backgroundPosition="-40px -405px",this.element.style.width="17px",this.element.style.height="17px"):(this.collapsed_=!0,e.target.style.backgroundPosition="-40px -386px",this.element.style.width="120px",this.element.style.height="120px");e=this.ovmap_;this.collapsed_||e||(e.updateSize(),this.resetExtent_(),e.once("postrender",this.updateBox_,this))},w.prototype.getCollapsible=function(){return this.collapsible_},w.prototype.setCollapsible=function(e){this.collapsible_!==e&&!(this.collapsible_=e)&&this.collapsed_&&this.handleToggle_()},w.prototype.setCollapsed=function(e){this.collapsible_&&this.collapsed_!==e&&this.handleToggle_()},w.prototype.getCollapsed=function(){return this.collapsed_},w.prototype.getOverviewMap=function(){return this.ovmap_};var ke,Ne=w;function w(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,w),void 0!==e.className?e.className:"ole-overview-map"),t=u("div",t+" "+y),g=e.render||w.render,g=h(this,ke.call(this,{element:t,render:g,target:e.target}));return g.collapsed_=void 0===e.collapsed||e.collapsed,g.collapsible_=void 0===e.collapsible||e.collapsible,g.collapsible_||(g.collapsed_=!1),g.ovmapDiv_=u("div","ole-overview-map-target",t),g.collapsible_&&(g.collapsElement_=u("div","ole-overview-map-button",t),d(g.collapsElement_,"click",g.handleClick_,g)),g.ovmap_=new s.Map({controls:new s.Collection,interactions:new s.Collection,view:e.view}),g.addBoxControl_(),g}Ne.render=function(e){this.validateExtent_(),this.updateBox_()},Ne.computeDesiredMousePosition=function(e,t){return{clientX:e.clientX-t.offsetWidth/2,clientY:e.clientY+t.offsetHeight/2}};Fe=s.control.Control,t(M,Fe),M.prototype.handleProjectionChanged_=function(){this.transform_=null},M.prototype.getCoordinateFormat=function(){return this.get(M.Property_.COORDINATE_FORMAT)},M.prototype.getProjection=function(){return this.get(M.Property_.PROJECTION)},M.prototype.handleMouseMove=function(e){var t=this.getMap();t&&(this.lastMouseMovePixel_=t.getEventPixel(e),this.lastMouseMovePixel_)&&(this.followMouse_?this.followMousePopver_(e):this.updateHTML_(this.lastMouseMovePixel_))},M.prototype.followMousePopver_=function(){var e,t=this.getHTML_(this.lastMouseMovePixel_),g=this.getMap(),A=g.getCoordinateFromPixel(this.lastMouseMovePixel_);this.popver_?((e=this.popver_.getElement()).innerHTML=t,e.offsetWidth>=this._bounds.width-this.lastMouseMovePixel_[0]?(this.popver_.setPositioning("center-right"),this.popver_.setOffset([-10,0])):(this.popver_.setPositioning("center-left"),this.popver_.setOffset([10,0])),this.popver_.setPosition(A),this.popver_.setElement(e)):((e=u("div",this.className_+"_overlay")).innerHTML=t,this.popver_=new s.Overlay({element:e,offset:[10,0],position:A,positioning:"center-left"}),g.addOverlay(this.popver_),g.render())},M.prototype.handleMouseOut=function(e){this.updateHTML_(null),this.lastMouseMovePixel_=null},M.prototype.setMap=function(e){var t;Fe.prototype.setMap.call(this,e),e&&(t=e.getViewport(),this._bounds=e.getTargetElement().getBoundingClientRect(),d(t,"mousemove",this.handleMouseMove,this),d(t,"mouseout",this.handleMouseOut,this))},M.prototype.setCoordinateFormat=function(e){this.set(M.Property_.COORDINATE_FORMAT,e)},M.prototype.setProjection=function(e){this.set(M.Property_.PROJECTION,s.proj.get(e))},M.prototype.setUnits=function(e){this.set(M.Property_.PROJECTION,e)},M.prototype.updateHTML_=function(e){e=this.getHTML_(e);this.renderedHTML_&&e===this.renderedHTML_||(this.element.innerHTML=e,this.renderedHTML_=e)},M.prototype.getHTML_=function(e){var t,g=this.undefinedHTML_;return e&&this.mapProjection_&&(this.transform_||(t=this.getProjection(),this.transform_=t?s.proj.getTransformFromProjections(this.mapProjection_,t):M.identityTransform),t=this.getMap().getCoordinateFromPixel(e))&&(this.transform_(t,t),g=(e=this.getCoordinateFormat())?e(t):M.Property_.UNITS[0]+"\uff1a"+t[0]+" "+M.Property_.UNITS[1]+"\uff1a"+t[1]),g};var Fe,Oe=M;function M(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,M),void 0!==e.className?e.className:"ole-mouse-position"),g=u("div",t+" "+y),A=e.render||M.render,A=h(this,Fe.call(this,{element:g,render:A,target:e.target}));return A.on("change:"+M.Property_.PROJECTION,A.handleProjectionChanged_,A),e.coordinateFormat&&A.setCoordinateFormat(e.coordinateFormat),e.projection&&A.setProjection(e.projection),e.units&&A.setUnits(e.units),A.undefinedHTML_=void 0!==e.undefinedHTML?e.undefinedHTML:"",A.renderedHTML_=g.innerHTML,A.mapProjection_=null,A.transform_=null,A.lastMouseMovePixel_=null,A.followMouse_=!0===e.followMouse&&e.followMouse,A.popver_=null,A._bounds=null,A.className_=t,A}Oe.Property_={PROJECTION:"projection",COORDINATE_FORMAT:"coordinateFormat",UNITS:["\u7ecf\u5ea6","\u7eac\u5ea6"]},Oe.render=function(e){e=e.frameState;e?this.mapProjection_!==e.viewState.projection&&(this.mapProjection_=e.viewState.projection,this.transform_=null):this.mapProjection_=null,this.getMap()&&this.lastMouseMovePixel_&&(this.followMouse_?this.followMousePopver_(this.lastMouseMovePixel_):this.updateHTML_(this.lastMouseMovePixel_))},Oe.identityTransform=function(e,t,g){if(void 0!==t&&e!==t){for(var A=0,C=e.length;A<C;++A)t[A]=e[A];e=t}return e};function Ze(e){var g=[];return 0<e.length&&e.forEach(function(e){var t;e instanceof s.layer.Group?(t=e.getLayers().getArray(),(t=Ze(t))&&(g=g.concat(t))):g.push(e)}),g}function Ge(e,t){var g=null;return e&&(e=e.getLayers().getArray(),g=ze(e,"layerName",t)),g}function ze(e,g,A){var C=null;return 0<e.length&&e.every(function(e){var t;return e instanceof s.layer.Group?(t=e.getLayers().getArray(),!(C=ze(t,g,A))):e.get(g)!==A||(C=e,!1)}),C}function je(e,t,g){var A=[];return e&&(e=e.getLayers().getArray(),A=Ue(e,t,g)),A}function He(e,g){var A=void 0;return e.every(function(t){var e;return t&&t instanceof s.layer.Vector&&t.getSource?((e=t.getSource()).getFeatures&&e.getFeatures().every(function(e){return e!==g||(A=t,!1)}),!1):!(t instanceof s.layer.Group&&(e=t.getLayers().getArray(),A=He(e,g)))}),A}function Ve(e,t,g){var A;if(e)return(A=(A=Ge(e,t))instanceof s.layer.Vector?A:null)||g&&g.create&&(A=new s.layer.Vector({layerName:t,params:g,layerType:"vector",source:new s.source.Vector({wrapX:!1}),style:new s.style.Style({fill:new s.style.Fill({color:"rgba(67, 110, 238, 0.4)"}),stroke:new s.style.Stroke({color:"#4781d9",width:2}),image:new s.style.Circle({radius:7,fill:new s.style.Fill({color:"#ffcc33"})})}),zIndex:g.zIndex})),e&&A&&(g&&g.hasOwnProperty("selectable")&&A.set("selectable",g.selectable),(g=Ge(e,t))&&g instanceof s.layer.Vector||e.addLayer(A)),A}var We,Ue=function g(e,A,C){var I=[];return 0<e.length&&e.forEach(function(e){var t;e instanceof s.layer.Group?(t=e.getLayers().getArray(),(t=g(t,A,C))&&(I=I.concat(t))):e.get(A)===C&&I.push(e)}),I},Ye=Object.freeze({getBaseLayers:function(){return je("isBaseLayer",!0)},getAllLayers:function(e){var t=[];return e&&(e=e.getLayers().getArray(),t=Ze(e)),t},getLayerByFeature:function(e,t){var g=void 0;return e&&t instanceof s.Feature&&(e=e.getLayers().getArray(),g=He(e,t)),g},getBaseLayerByLayerName:function(t){var g=null,e=je("isBaseLayer",!0);return e&&0<e.length&&e.every(function(e){return e.get("layerName")!==t||(g=e,!1)}),g},getLayerByLayerName:Ge,getLayerInternal:ze,getLayersArrayInternal:Ue,getLayerByKeyValue:function(e,t,g){var A=null;return e&&(e=e.getLayers().getArray(),A=ze(e,t,g)),A},getLayersArrayByKeyValue:je,createVectorLayer:Ve}),Be=(We=s.control.Control,t(b,We),b.prototype.initDomInternal=function(e,C,I){var i=this,o=this.options.itemWidth,n=this.options.itemHeight,r=e.length;this.innerElement_.style.width=o+10*(r-1)+"px",this.innerElement_.style.height=n+"px",e.forEach(function(e,t){var g,A;e&&e[I]&&(g=u("li",C+"-li-inner",i.innerElement_,C+"-li"+t+"-inner"),c(g,{background:"url("+e.icon+") 0px 0px no-repeat",width:o+"px",height:n+"px",zIndex:t+1,right:"0px",marginRight:10*(r-1-t)+"px"}),g.setAttribute("data-name",e[I]),d(g,"click",i.handleClick_,i),e.name&&((A=u("span","layer-name",g)).setAttribute("data-name",e[I]),A.innerHTML=e.name),i.isActionSelected_||e[i.isDefaultKey]&&(a(g,"selected-item"),i.isActionSelected_=!0),i.isActionSelected_||t!==r-1||(a(g,"selected-item"),i.isActionSelected_=!0))})},b.prototype.contentMouseOver_=function(e){var t=this.options.layers.length;if(0<t){for(var g=0;g<t-1;g++){var A=i(this.className_+"-li"+g+"-inner");A&&c(A,{marginRight:"0px",zIndex:"",right:(t-1-g)*(10+this.options.itemWidth)+"px"})}c(this.innerElement_,"width",this.options.itemWidth*t+10*(t-1)+"px")}},b.prototype.contentMouseOut_=function(e){var t=this.options.layers.length;if(0<t){for(var g=0;g<t-1;g++){var A=i(this.className_+"-li"+g+"-inner");A&&c(A,{marginRight:10*(t-1-g)+"px",zIndex:g+1,right:"0px"})}c(this.innerElement_,"width",this.options.itemWidth+10*(t-1)+"px")}},b.prototype.handleClick_=function(e){e=e.target.getAttribute("data-name");this.switcher(this.options.key,e)},b.prototype.updateBaseLayer_=function(){this.getMap()&&(this.baseLayers_=je(this.getMap(),this.baseLayerKey,!0),this.labelLayers_=je(this.getMap(),this.labelLayerKey,!0),this.baseLayers_&&0<this.baseLayers_.length&&this.baseLayers_.filter(function(e){return!!e}),this.labelLayers_)&&0<this.labelLayers_.length&&this.labelLayers_.filter(function(e){return!!e})},b.prototype.switcher=function(t,g){var A=this;if(this.forcedUpdate&&this.updateBaseLayer_(),!(0<this.baseLayers_.length&&this.baseLayers_.length===this.options.layers.length))throw new Error("\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u5e95\u56fe\u83b7\u53d6\u5e95\u56fe\u6570\u91cf\u662f\u5426\u548c\u914d\u7f6e\u76f8\u540c\uff01");this.labelLayers_&&0<this.labelLayers_.length&&this.labelLayers_.forEach(function(e){e&&e.get(A.labelAliasKey)===g?e.setVisible(!0):e.setVisible(!1)}),this.baseLayers_.forEach(function(e){e&&e.get(t)===g?(e.setVisible(!0),e.set(A.isDefaultKey,!0)):(e.setVisible(!1),e.set(A.isDefaultKey,!1))});var e=this.options.layers.length;if(0<e)for(var C=0;C<e;C++){var I=i(this.className_+"-li"+C+"-inner");(I&&I.getAttribute("data-name")===g?a:Y)(I,"selected-item")}},b.prototype.setMap=function(e){We.prototype.setMap.call(this,e),e&&e instanceof s.Map&&this.updateBaseLayer_()},b);function b(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,b),void 0!==e.className?e.className:"ole-layer-switcher"),g=u("div",t+" "+y),A=h(this,We.call(this,{element:g,target:e.target}));if(A.options=e,A.className_=t,d(g,"mouseover",A.contentMouseOver_,A),d(g,"mouseout",A.contentMouseOut_,A),A.options.itemWidth="number"===A.options.itemWidth?A.options.itemWidth:86,A.baseLayers_=[],A.labelLayers_=[],A.baseLayerKey=A.options.baseLayerKey||"isBaseLayer",A.isDefaultKey=A.options.isDefaultKey||"isDefault",A.labelAliasKey=A.options.labelAlias||"layerName",A.labelLayerKey=A.options.labelLayerKey||"isLabelLayer",A.isActionSelected_=!1,A.forcedUpdate=A.options.forcedUpdate,A.options.itemHeight="number"==typeof A.options.itemHeight?A.options.itemHeight:60,A.options.key=A.options.key||"layerName",A.labelLayerKey===A.baseLayerKey)throw new Error("\u6807\u6ce8\u56fe\u5c42\u5173\u952e\u5b57\u4e0d\u80fd\u548c\u5e95\u56fe\u76f8\u540c\uff01");return A.innerElement_=u("ul",t+"-ul-inner",g,t+"-ul-inner"),A.options.layers&&Array.isArray(A.options.layers)&&0<A.options.layers.length?A.initDomInternal(A.options.layers,t,A.options.key):A.element.style.display="none",A}Xe=s.control.Control,t(E,Xe),E.prototype.initDomInternal=function(e){this.htmlUtils(e,"",this.element),this.getMap()&&(this.mapContent=this.getMap().getViewport(),d(this.mapContent,"contextmenu",this.mouseDownHandle_,this))},E.prototype.mouseDownHandle_=function(e){var t=this,g=this;p(e),J(e),2===e.button&&(g.pixel=this.getMap().getEventPixel(e),g.dispatchEvent({type:"before-show",target:this,event:e}),window.setTimeout(function(){g.show(g.pixel),g.dispatchEvent({type:"show",target:t,event:e})},50)),d(e.target,"mousedown",function(){g.hide(),g.dispatchEvent({type:"hide",target:this,event:e})},this,!0)},E.prototype.show=function(e){c(this.element,{display:"block",top:e[1]+"px",left:e[0]+"px"});var e=this.getMap().getSize(),t=e[0]-this.element.offsetWidth,e=e[1]-this.element.offsetHeight;this.element.offsetTop>e&&c(this.element,{top:e+"px"}),this.element.offsetLeft>t&&c(this.element,{left:t+"px"})},E.prototype.hide=function(){this.element.style.display="none",this.pixel=[]},E.prototype.htmlUtils=function(e,I,t,g){var i=this,o=null;return e&&Array.isArray(e)&&0<e.length&&(o=u("ul",this.className_+"-ul"+I+"-inner",t,this.className_+"-ul"+I+"-inner"),g&&c(o,{position:"absolute",top:"0px",left:this.itemWidth+20+"px"}),e.forEach(function(e,t){var g,A,C;e&&e.name&&e.alias&&(g=u("li",i.className_+"-li-"+(t=I+"-"+t)+"-inner",o,i.className_+"-li-"+t+"-inner"),c(g,{width:i.itemWidth+"px",height:i.itemHeight+"px",lineHeight:i.itemHeight+"px"}),g.setAttribute("data-name",e.alias),d(g,"click",i.handleItemClick_.bind(i,e),i),e.icon&&(A=u("span","li-icon-content",g),"iconfont"===e.iconType?(C=e.fontName||"iconfont",a(A,C+" "+e.icon),e.iconColor&&(A.style.color=e.iconColor)):A.style.background="url("+e.icon+") 0px 0px no-repeat"),u("span","li-name-content",g).innerHTML=e.name,e.showLine&&(g.style.borderBottom="1px solid #CCCCCC"),e.items)&&(i.htmlUtils(e.items,t,g,!0),d(g,"mouseenter",i.handleItemMouseOver_,i),d(g,"mouseleave",i.handleItemMouseOut_,i))})),o},E.prototype.updateElement_=function(e,t,g){var A=i(this.className_+"-ul-inner"),C=W(this.options.items),I=null;switch(e){case"pop":this.element.removeChild(A),I=C.pop(),this.htmlUtils(C,"",this.element);break;case"push":this.element.removeChild(A),I=C=C.push(t),this.htmlUtils(C,"",this.element);break;case"shift":this.element.removeChild(A),I=C.shift(),this.htmlUtils(C,"",this.element);break;case"unshift":this.element.removeChild(A),I=C=C.unshift(t),this.htmlUtils(C,"",this.element);break;case"reverse":this.element.removeChild(A),I=C.reverse(),this.htmlUtils(C,"",this.element);break;default:this.element.removeChild(A),this.htmlUtils(I=g,"",this.element)}return I},E.prototype.getCurrentPixel=function(){return this.pixel},E.prototype.getCurrentCoordinates=function(){return this.getMap().getCoordinateFromPixel(this.getCurrentPixel())},E.prototype.handleItemClick_=function(e,t){var g=this;p(t),e&&e.callback&&"function"==typeof e.callback&&e.callback({type:"item-click",target:this,event:t,source:e,pixel:this.getCurrentPixel(),coordinates:this.getCurrentCoordinates()}),this.dispatchEvent({type:"item-click",event:t,source:e,pixel:this.getCurrentPixel(),coordinates:this.getCurrentCoordinates()}),window.setTimeout(function(){g.hide()},50)},E.prototype.handleItemMouseOver_=function(e){p(e),e.target&&e.target.childNodes&&(e=Array.prototype.slice.call(e.target.childNodes,0))&&0<e.length&&e.every(function(e){return!e||"ul"!==e.nodeName.toLowerCase()||!(e.style.display="block")})},E.prototype.handleItemMouseOut_=function(e){p(e),e.target&&e.target.childNodes&&(e=Array.prototype.slice.call(e.target.childNodes,0))&&0<e.length&&e.every(function(e){return!e||"ul"!==e.nodeName.toLowerCase()||!(e.style.display="none")})},E.prototype.setMap=function(e){Xe.prototype.setMap.call(this,e),e&&e instanceof s.Map&&this.initDomInternal(this.options.items)},E.prototype.pop=function(){return this.updateElement_("pop")},E.prototype.push=function(e){if(e&&"object"===(void 0===e?"undefined":I(e)))return this.updateElement_("push",e);throw new Error("\u4f20\u5165\u7684\u4e0d\u662f\u5bf9\u8c61")},E.prototype.shift=function(){return this.updateElement_("shift")},E.prototype.reverse=function(){return this.updateElement_("reverse")},E.prototype.unshift=function(e){if(e&&"object"===(void 0===e?"undefined":I(e)))return this.updateElement_("unshift",e);throw new Error("\u4f20\u5165\u7684\u4e0d\u662f\u5bf9\u8c61")},E.prototype.update=function(e){if(!(e&&Array.isArray(e)&&0<e.length))throw new Error("\u4f20\u5165\u7684\u6570\u7ec4\u6709\u8bef\uff01");this.updateElement_("","",e)},E.prototype.updateOption=function(e){if(!(e&&Array.isArray(e)&&0<e.length))throw new Error("\u4f20\u5165\u7684\u6570\u7ec4\u6709\u8bef\uff01");this.options.items=e,this.updateElement_("","",e)};var Xe,Ke=E;function E(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(l(this,E),void 0!==e.className?e.className:"ole-context-menu-content"),g=u("div",t+" "+y),g=(c(g,"display","none"),h(this,Xe.call(this,{element:g,target:e.target})));return g.options=e,g.className_=t,g.mapContent=null,g.pixel=[],g.itemWidth="number"==typeof g.options.itemWidth?g.options.itemWidth:160,g.itemHeight="number"==typeof g.options.itemHeight?g.options.itemHeight:30,g}Qe=s.control.Control,t(L,Qe),L.prototype.initControl=function(){this.getMap()&&(this._bounds=this.getMap().getTargetElement().getBoundingClientRect(),this.percent=.5,this._setPosition(this._bounds.width,this._bounds.width/2),this.getMap().on("change:size",this.resize,this),this.clipLayer())},L.prototype.handleDraggerStart_=function(e){!this.dragging_&&e.target&&(this.previousX_=e.clientX,this.previousY_=e.clientY,this.dragging_=!0)},L.prototype.handleDraggerDrag_=function(e){this.dragging_&&(this._bounds=this.getMap().getTargetElement().getBoundingClientRect(),this._setPosition(this._bounds.width,this._getX(e)),this.previousX_=e.clientX,this.previousY_=e.clientY)},L.prototype.handleDraggerEnd_=function(e){this.dragging_&&(this.dragging_=!1,this.previousX_=void 0,this.previousY_=void 0)},L.prototype.clipLayer=function(){var g=this;this.getMap().un("precompose",this.precompose),this.getMap().un("postcompose",this.postcompose),this.precompose=this.beforeMap.on("precompose",function(e){var e=e.context,t=e.canvas.width*g.initPosition;e.save(),e.beginPath(),e.rect(t,0,e.canvas.width-t,e.canvas.height),e.clip()}),this.postcompose=this.beforeMap.on("postcompose",function(e){e.context.restore()})},L.prototype._setPosition=function(e,t){var g="translate("+t+"px, 0)";this.element.style.transform=g,this.element.style.WebkitTransform=g,this._x=t,this.percent=t/e,this.initPosition=t/e,this.getMap().render()},L.prototype.resize=function(){this._bounds=this.getMap().getTargetElement().getBoundingClientRect(),this._setPosition(this._bounds.width,this._bounds.width*this.percent)},L.prototype._getX=function(e){e=(e=e.touches?e.touches[0]:e).clientX-this._bounds.left;return e=(e=e<0?0:e)>this._bounds.width?this._bounds.width:e},L.prototype.setMap=function(e){Qe.prototype.setMap.call(this,e),e&&e instanceof s.Map&&(e.render(),this.initControl())},L.prototype.setBeforeLayet=function(e){if(!e)throw Error("\u8bbe\u7f6e\u56fe\u5c42\u9519\u8bef\uff01");this.beforeMap=e,this.orderLayerZindex()},L.prototype.setAfterLayer=function(e){if(!e)throw Error("\u8bbe\u7f6e\u56fe\u5c42\u9519\u8bef\uff01");this.afterMap=e,this.orderLayerZindex()},L.prototype.orderLayerZindex=function(){var e,t,g;this.afterMap&&this.beforeMap&&(g=this.afterMap.getZIndex(),e=this.beforeMap.getZIndex(),(t=Math.max(g,e))===(g=Math.min(g,e))&&(t+=1),this.beforeMap.setZIndex(t),this.afterMap.setZIndex(g))};var Qe,Je=L;function L(e,t){var g=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},A=(l(this,L),void 0!==g.className?g.className:"ole-control-compare"),C=u("div",A+" "+y),A=u("div",A+"-inner",C),C=h(this,Qe.call(this,{element:C,target:g.target}));if(e&&t)return C.beforeMap=e,C.afterMap=t,C.orderLayerZindex(),C.initPosition=void 0!==g.initPosition?g.initPosition:.5,C.dragging_=!1,C.previousX_=null,C.previousY_=null,d(A,"pointerdown",C.handleDraggerStart_,C),d(A,"pointermove",C.handleDraggerDrag_,C),d(A,"pointerup",C.handleDraggerEnd_,C),d(window,"pointerup",C.handleDraggerEnd_,C),C;throw new Error("\u56fe\u5c42\u5fc5\u987b\u4f20\u5165\uff01")}qe=s.control.Control,t(S,qe),S.prototype.handleZoomClick_=function(e,t){J(t),this.zoomByDelta_(e)},S.prototype.handletranslateClick_=function(e,t){J(t);var t=this.getMap().getView(),g=t.getResolution()*this.pixelDelta_,A=0,C=0;switch(e){case"translateN":C=g;break;case"translateS":C=-g;break;case"translateW":A=g;break;case"translateE":A=-g}e=[A,C];s.coordinate.rotate(e,t.getRotation()),this.pan(t,e,this.duration_)},S.prototype.pan=function(e,t,g){var A=e.getCenter();A&&(A=e.constrainCenter([A[0]+t[0],A[1]+t[1]]),g?e.animate({duration:g,easing:s.easing.linear,center:A}):e.setCenter(A))},S.prototype.zoomByDelta_=function(e){var t,g=this.getMap().getView();g&&g instanceof s.View&&(t=g.getResolution())&&(t=g.constrainResolution(t,e),0<this.duration_?(g.getAnimating()&&g.cancelAnimations(),g.animate({resolution:t,duration:this.duration_,easing:s.easing.easeOut})):g.setResolution(t))},S.prototype.setMap=function(e){qe.prototype.setMap.call(this,e),e&&e.render()},S.prototype.disposeInternal=function(){d(this.silderContent,"pointercancel",function(e){},this),qe.prototype.disposeInternal.call(this)},S.prototype.initSlider_=function(){var e=this.silderContent,t=e.offsetWidth,e=e.offsetHeight,g=i("slider-bar"),A=g.offsetWidth+parseFloat(B(g,"marginRight"))+parseFloat(B(g,"marginLeft")),g=g.offsetHeight+parseFloat(B(g,"marginTop"))+parseFloat(B(g,"marginBottom"));this.thumbSize_=[A,g],e<t?(this.direction_=S.Direction_.HORIZONTAL,this.widthLimit_=t-A):(this.direction_=S.Direction_.VERTICAL,this.heightLimit_=e-g),this.sliderInitialized_=!0},S.prototype.handleC