ol-extent
Version:
a JavaScript library for openlayers extent
8 lines • 122 kB
JavaScript
/*!
* author: FDD <smileFDD@gmail.com>
* ol-extent v2.0.0
* build-time: 2018-3-25 14:33
* LICENSE: MIT
* (c) 2017-2018 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,m){"use strict";m=m&&m.hasOwnProperty("default")?m.default:m;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},y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},l=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)},f=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},o=arguments,t=/([\:\-\_]+(.))/g,g=/^moz([A-Z])/,s=[],a=new Array(16),A=0;A<256;++A)s[A]=(A+256).toString(16).substr(1);var r=function(e){return(e||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")},i=function(e){return e.replace(t,function(e,t,g,A){return A?g.toUpperCase():g}).replace(g,"Moz$1")},C=function(e){var t="_event_id_";return e[t]=e[t]||h(),e[t]},h=function(e,t,g){var A=t&&g||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var C,i,I,o,r=(e=e||{}).random||(e.rng||function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),a[t]=e>>>((3&t)<<3)&255;return a})();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t)for(var n=0;n<16;++n)t[A+n]=r[n];return t||(I=i||0,(o=s)[(C=r)[I++]]+o[C[I++]]+o[C[I++]]+o[C[I++]]+"-"+o[C[I++]]+o[C[I++]]+"-"+o[C[I++]]+o[C[I++]]+"-"+o[C[I++]]+o[C[I++]]+"-"+o[C[I++]]+o[C[I++]]+o[C[I++]]+o[C[I++]]+o[C[I++]]+o[C[I++]])},u=function(e,t){var g=Math.random()*(t-e),A=Math.round(g+e);return A=Math.max(Math.min(A,t),e)},n=function e(t){for(var g=Object.keys(t),A={},C=0;C<g.length;C++){var i=g[C];"object"===I(t[i])?A[i]=e(t[i]):A[i]=t[i]}return A},v=function(e,t,g,A){var C=document.createElement(e);return A&&(C.id=A),t&&d(C,t),g&&g.appendChild(C),C},c=function(e,t,g){if("undefined"!=typeof document){var A=document.createElement("canvas");return A.width=e,A.height=t,A}return new g(e,t)},_=function(e){return"string"==typeof e?document.getElementById(e):e},p=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=function(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):p(e,I)||(g+=" "+I))}e.classList||(e.className=g)}},w=function(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):p(e,I)&&(A=A.replace(" "+I+" "," ")))}e.classList||(e.className=r(A))}},M=function(t,g){if(!t||!g)return null;"float"===(g=i(g))&&(g="cssFloat");try{var e=document.defaultView.getComputedStyle(t,"");return t.style[g]||e?e[g]:null}catch(e){return t.style[g]}},b=function e(t,g,A){if(t&&g)if("object"===(void 0===g?"undefined":I(g)))for(var C in g)g.hasOwnProperty(C)&&e(t,C,g[C]);else"opacity"===(g=i(g))?t.style.filter=isNaN(A)?"":"alpha(opacity="+100*A+")":t.style[g]=A},E=function(e,t,g){return"_dom_event_"+e+"_"+C(t)+(g?"_"+C(g):"")},L=function(t,e,g,A,C){var i=E(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},S=L,x=function(e,t,g,A){var C=E(t,g,A),i=e[C];return i&&("removeEventListener"in e?e.removeEventListener(t,i,!1):"detachEvent"in e&&e.detachEvent("on"+t,i),e[C]=null),this},T=x,P=function(e){return e.preventDefault?e.preventDefault():e.returnValue=!1,this},D=function(e){return e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this},R=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=o.length;t<g;t++){var A=o[t]||{};for(var C in A)if(A.hasOwnProperty(C)){var i=A[C];void 0!==i&&(e[C]=i)}}return e},stamp:C,uuid:h,trim:r,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:i,getRandom:u,cloneDeep:n,create:v,createCanvas:c,getElement:_,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){var A=document.createElement(e);return A.style.display="none",g&&(A.id=g),t&&t.appendChild(A),A},hasClass:p,addClass:d,removeClass:w,getStyle:M,setStyle:b,on:S,once:function(e,t,g,A){return L(e,t,g,A,!0)},addListener:L,off:T,removeListener:x,preventDefault:P,stopPropagation:D}),N=function(g){function A(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,A);var t=f(this,g.call(this,e));return t._canvas=null,t.options=e,t.setSource(new m.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}return l(A,g),A.prototype.redraw=function(){var e=this.options.extent||this._getMapExtent();this.setExtent(e)},A.prototype.getContext=function(){return this._canvas.getContext(this.get("context")||"2d")},A.prototype._getMapExtent=function(){if(this.getMap()){var e=this._getMapSize(),t=this.getMap().getView();return t&&t.calculateExtent(e)}},A.prototype._getMapSize=function(){if(this.getMap())return this.getMap().getSize()},A.prototype.canvasFunction=function(e,t,g,A,C){if(this._canvas?(this._canvas.width=A[0],this._canvas.height=A[1]):this._canvas=c(A[0],A[1]),t<=this.get("maxResolution")){var i=this.getContext();this.get("render")&&this.get("render")({context:i,extent:e,size:A,pixelRatio:g,projection:C})}return this._canvas},A.prototype.setMap=function(e){m.layer.Image.prototype.setMap.call(this,e)},A.prototype.getMap=function(){return this.get("map")},A}(m.layer.Image),k=function(g){function A(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,A);var t=f(this,g.call(this,e));return t._canvas=null,t._context=null,t._style=null,t.features=[],t.options=e,t.setSource(new m.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}return l(A,g),A.prototype.addFeature=function(e){this.features.push(e)},A.prototype.addFeatures=function(e){this.features=this.features.concat(e)},A.prototype.getFeatures=function(){return this.features},A.prototype.getFeatureById=function(e){},A.prototype.getStyle=function(){return this._style},A.prototype.setStyle=function(e){this._style=e},A.prototype._drawFeature=function(){var I=this;if(this.getMap()){this._context||(this._context=this.getContext());var o=this.features.length,e=I._style.getImage();if(e){var t=new Image;t.src=e.getSrc(),t.complete&&function(e){for(var t=0;t<o;t++){var g=I.features[t].getGeometry(),A=g&&g.getCoordinates();if(A){var C=I.getMap().getPixelFromCoordinate(A),i=I._style.getImage().getSize();I._context.drawImage(e,C[0],C[1],i[0],i[1])}}}(t)}}},A.prototype.redraw=function(){var e=this.options.extent||this._getMapExtent();this.setExtent(e)},A.prototype.getContext=function(){return this._canvas.getContext(this.get("context")||"2d")},A.prototype._getMapExtent=function(){if(this.getMap()){var e=this._getMapSize(),t=this.getMap().getView();return t&&t.calculateExtent(e)}},A.prototype._getMapSize=function(){if(this.getMap())return this.getMap().getSize()},A.prototype.canvasFunction=function(e,t,g,A,C){if(this._canvas?(this._canvas.width=A[0],this._canvas.height=A[1]):this._canvas=c(A[0],A[1]),t<=this.get("maxResolution")){var i=this.getContext();this._drawFeature(),this.get("render")&&this.get("render")({context:i,extent:e,size:A,pixelRatio:g,projection:C})}return this._canvas},A.prototype.setMap=function(e){this.set("originMap",e)},A.prototype.getMap=function(){return this.get("originMap")},A}(m.layer.Image);m.layer.DozensLayer=k;var F=Object.freeze({CanvasLayer:N,DozensLayer:k}),O=function(s){function a(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,a);var t="";t=void 0!==e.attributions?e.attributions:[a.ATTRIBUTION],e.projection=e.projection?e.projection:"EPSG:3857";var g=void 0!==e.crossOrigin?e.crossOrigin:"anonymous",i=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",A=e.hidpi||1<(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI);i=i.replace("{styles}",A?"ph":"pl");var C=e.tileUrlFunction?e.tileUrlFunction:void 0;C||(C=function(e){var t=[e[0],e[2],e[1]],g=t[0],A=t[1],C=t[2];return C<0&&(C="M"+-C),A<0&&(A="M"+-A),i.replace("{0-3}",u(0,3)).replace("{x}",C.toString()).replace("{y}",A.toString()).replace("{z}",g.toString())});for(var I=e.levels?e.levels:19,o=[],r=0;r<I;r++)o[r]=Math.pow(2,I-1-r);var n=new m.tilegrid.TileGrid({tileSize:e.tileSize?e.tileSize:256,origin:e.origin?e.origin:[0,0],extent:e.extent?e.extent:void 0,resolutions:o,minZoom:e.minZoom&&"number"==typeof e.minZoom?e.minZoom:0});return f(this,s.call(this,{tileGrid:n,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:C,url:i,wrapX:e.wrapX,tilePixelRatio:A?2:1}))}return l(a,s),a}(m.source.TileImage);O.ATTRIBUTION=new m.Attribution({html:'© <a href="http://map.baidu.com/">\u767e\u5ea6\u5730\u56fe</a> contributors.'});var Z=function(i){function I(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,I);var t="";t=void 0!==e.attributions?e.attributions:[I.ATTRIBUTION],e.projection=e.projection?e.projection:"EPSG:3857";var g=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?e.tileUrlFunction:void 0;return f(this,i.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}))}return l(I,i),I}(m.source.XYZ);Z.ATTRIBUTION=new m.Attribution({html:'© <a href="http://ditu.amap.com/">\u9ad8\u5fb7\u5730\u56fe</a> contributors.'});var G=function(C){function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,i);var t="";t=void 0!==e.attributions?e.attributions:[i.ATTRIBUTION],e.projection=e.projection?e.projection:"EPSG:3857";var g=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 f(this,C.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}))}return l(i,C),i}(m.source.XYZ);G.ATTRIBUTION=new m.Attribution({html:'© <a href="http://www.google.cn/maps">\u8c37\u6b4c\u5730\u56fe</a> contributors.'});var z=Object.freeze({Baidu:O,Gaode:Z,Google:G}),j={CLASS_HIDDEN:"ole-hidden",CLASS_SELECTABLE:"ole-selectable",CLASS_UNSELECTABLE:"ole-unselectable",CLASS_CONTROL:"ole-control"},U={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft",METERS_PER_UNIT:{}};U.METERS_PER_UNIT[U.DEGREES]=2*Math.PI*6370997/360,U.METERS_PER_UNIT[U.FEET]=.3048,U.METERS_PER_UNIT[U.METERS]=1,U.METERS_PER_UNIT[U.USFEET]=1200/3937;var B=.1,H=.75;var V,W=(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){var g=C[e];g&&i.addEventListener(g,t,!1)},off:function(e,t){var g=C[e];g&&i.removeEventListener(g,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}(V={exports:{}},V.exports),V.exports),Y=function(o){function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,r);var t=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=v("div",A+" "+j.CLASS_UNSELECTABLE),i=v("span",A+"-inner",C);i.setAttribute("title","\u5168\u5c4f"),i.innerHTML=t;var I=f(this,o.call(this,{element:C,target:e.target}));return I.label=t,I.labelActive=g,I.keys_=void 0!==e.keys&&e.keys,I.size_=void 0!==e.size?e.size:[16,16],I.source_=e.source,S(C,"click",I.handleClick_,I),I}return l(r,o),r.prototype.handleClick_=function(e){var t=this;if(e.preventDefault(),this.getMap()){var g=null;g=this.source_?"string"==typeof this.source_?document.getElementById(this.source_):this.source_:this.getMap().getTargetElement(),W.enabled&&(W.toggle(g),W.on("change",function(){W.isFullscreen?t.element.firstElementChild.innerHTML=t.labelActive:t.element.firstElementChild.innerHTML=t.label}))}},r}(m.control.Control),X=function(I){function o(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,o);var t=void 0!==e.className?e.className:"ole-loading-panel",g=e.widget?e.widget:"animatedGif",A=v("animatedGif"===g?"span":"progress",t+" "+j.CLASS_UNSELECTABLE),C=f(this,I.call(this,{element:A,target:e.target}));if(C.mapListeners=[],C.tileListeners=[],C.loadStatus_=!1,C.isFirstRander=!0,C.loadProgress_=[0,1],C.widget=g,e.progressMode){if(-1===["tile","layer"].indexOf(e.progressMode))throw Error("\u4e0d\u652f\u6301\u7684\u8fdb\u5ea6\u6761\u6a21\u5f0f");C.loadProgressByTile_="layer"!==e.progressMode||!("layer"===e.progressMode)}if(C.showPanel="boolean"!=typeof e.showPanel||e.showPanel,"progressBar"===C.widget){var i=v("div","ole-progress-bar");v("span","",i)}return C.onCustomStart=!!e.onStart&&e.onStart,C.onCustomProgress=!!e.onProgress&&e.onProgress,C.onCustomEnd=!!e.onEnd&&e.onEnd,C}return l(o,I),o.prototype.setup=function(){var e=this;if(this.getMap()){this.setDomPosition(),this.getMap().on("change:size",this.setDomPosition,this);var t=this.getMap().on("pointerdown",this.hide(),this),g=this.getMap().on("precompose",function(){if(e.isFirstRander&&(e.isFirstRander=!1,e.registerLayersLoadEvents_(),e.show(),e.onCustomStart)){e.onCustomStart.apply(e,[])}}),A=this.getMap().on("postrender",function(){if(e.updateLoadStatus_(),e.loadStatus_){if(e.onCustomEnd){e.onCustomEnd.apply(e,[])}e.hide()}});this.mapListeners.push(t),this.mapListeners.push(g),this.mapListeners.push(A)}},o.prototype.setDomPosition=function(){var e=this.getMap().getSize();if(e){var t=[this.element.clientWidth,this.element.clientHeight];b(this.element,{left:String(Math.round((e[0]-t[0])/2))+"px",bottom:String(Math.round((e[1]-t[1])/2))+"px"})}},o.prototype.updateSourceLoadStatus_=function(e){return 100===Math.round(e.loaded/e.loading*100)},o.prototype.registerLayerLoadEvents_=function(e){var g=this;e.getSource().on("tileloadstart",function(e){if(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,[])}if(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];var t=g.element.getElementsByClassName("ole-progress-bar");0<t.length&&(t[0].children()[0].width=String(parseInt(100*g.progress(),0))+"%")}}),e.getSource().on(["tileloadend","tileloaderror"],function(e){if(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_){if(g.loadProgress_[0]+=1,"progressBar"===g.widget){g.element.value=g.loadProgress_[0];var t=this.element.getElementsByClassName("ole-progress-bar");0<t.length&&(t[0].children()[0].width=String(parseInt(100*g.progress(),0))+"%")}g.onCustomProgress&&g.onCustomProgress.apply(g,g.loadProgress_)}})},o.prototype.registerLayersLoadEvents_=function(){for(var e=this.getMap().getLayers().getArray(),t=0;t<e.length;t++){var g=e[t];if(g instanceof m.layer.Group)for(var A=g.getLayers().getArray(),C=0;C<A.length;C++){var i=A[C];i instanceof m.layer.Vector||this.tileListeners.push(this.registerLayerLoadEvents_(i))}else g instanceof m.layer.Layer&&(g instanceof m.layer.Vector||this.tileListeners.push(this.registerLayerLoadEvents_(g)))}},o.prototype.updateLoadStatus_=function(){for(var e=[],t=this.getMap().getLayers().getArray(),g=0;g<t.length;g++){var A=t[g];if(A)if(A instanceof m.layer.Group)for(var C=A.getLayers().getArray(),i=0;i<C.length;i++){var I=C[i];I&&I.getSource()&&!(I instanceof m.layer.Vector)&&I.getSource().hasOwnProperty("isLoaded")&&e.push(I.getSource().isLoaded)}else A.getSource()&&A.getSource().hasOwnProperty("isLoaded")&&e.push(A.getSource().isLoaded)}if(this.loadStatus_=-1===e.indexOf(!1)&&-1!==e.indexOf(!0),!this.loadProgressByTile_){var o={};e.forEach(function(e){o[e]=(o[e]||0)+1});var r=o[!0]?o[!0]:0;r>this.loadProgress_[0]&&(this.loadProgress_=[r,e.length],"progressBar"===this.widget&&(this.element.max=this.loadProgress_[1],this.element.value=this.loadProgress_[0]),this.onCustomProgress&&this.onCustomProgress.apply(this,this.loadProgress_))}},o.prototype.show=function(){this.showPanel&&(this.element.style.display="block")},o.prototype.hide=function(){this.showPanel&&(this.element.style.display="none")},o.prototype.progressDetails=function(){return this.loadProgress_},o.prototype.progress=function(){return this.loadProgress_[0]/this.loadProgress_[1]},o.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,I.prototype.setMap.call(this,e),e&&this.setup()},o}(m.control.Control),K=function(r){function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,n);var t=void 0!==e.className?e.className:"ole-control-zoom",g=void 0!==e.delta?e.delta:1,A=v("div",t+" "+j.CLASS_UNSELECTABLE),C=v("span","zoom-in",A);C.setAttribute("title","\u653e\u5927"),C.innerHTML="+";var i=v("span","zoom-out",A);i.setAttribute("title","\u7f29\u5c0f"),i.innerHTML="\u2212";var I=void 0!==e.duration?e.duration:250,o=f(this,r.call(this,{element:A,target:e.target}));return o.set("duration",I),S(C,"click",o.handleClick_.bind(o,g)),S(i,"click",o.handleClick_.bind(o,-g)),o}return l(n,r),n.prototype.handleClick_=function(e,t){t.preventDefault(),this.zoomByDelta_(e)},n.prototype.zoomByDelta_=function(e){var t=this.getMap().getView();if(!t)throw new Error("can not get view!");var g=t.getResolution();if(g){var A=t.constrainResolution(g,e);0<this.get("duration")?(t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:A,duration:this.get("duration"),easing:m.easing.easeOut})):t.setResolution(A)}},n}(m.control.Control),Q=function(I){function u(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,u);var t=void 0!==e.className?e.className:"ole-scale-line-control",g=v("div",t+" "+j.CLASS_UNSELECTABLE),A=v("div",t+"-inner",g),C=e.render?e.render:u.render,i=f(this,I.call(this,{element:g,render:C,target:e.target}));return i.viewState_=null,i.minWidth_=void 0!==e.minWidth?e.minWidth:64,i.renderedVisible_=!1,i.renderedWidth_=void 0,i.renderedHTML_="",i.innerElement_=A,S(i,"change:"+u.Property_.UNITS,i.handleUnitsChanged_,i),i.setUnits(e.units||u.ScaleLineUnits.METRIC),i}return l(u,I),u.prototype.getUnits=function(){return this.get(u.Property_.UNITS)},u.prototype.handleUnitsChanged_=function(){this.updateElement_()},u.prototype.setUnits=function(e){this.set(u.Property_.UNITS,e)},u.prototype.updateElement_=function(){var e=this.viewState_;if(e){var t=[e.center,e.projection],g=t[0],A=t[1],C=this.getUnits(),i=C===u.ScaleLineUnits.DEGREES?U.DEGREES:U.METERS,I=m.proj.getPointResolution(A,e.resolution,g,i),o=this.minWidth_*I,r="";if(C===u.ScaleLineUnits.DEGREES){var n=m.proj.METERS_PER_UNIT[U.DEGREES];A.getUnits()===U.DEGREES?o*=n:I/=n,o<n/60?(r="\u2033",I*=3600):o<n?(r="\u2032",I*=60):r="\xb0"}else C===u.ScaleLineUnits.IMPERIAL?o<.9144?(r="in",I/=.0254):o<1609.344?(r="ft",I/=.3048):(r="mi",I/=1609.344):C===u.ScaleLineUnits.NAUTICAL?(I/=1852,r="nm"):C===u.ScaleLineUnits.METRIC?o<.001?(r="\u03bcm",I*=1e6):o<1?(r="mm",I*=1e3):o<1e3?r="m":(r="km",I/=1e3):C===u.ScaleLineUnits.US?o<.9144?(r="in",I*=39.37):o<1609.344?(r="ft",I/=.30480061):(r="mi",I/=1609.3472):C===u.ScaleLineUnits.CHINESEMETRIC?o<.001?(r="\u5fae\u7c73",I*=1e6):o<1?(r="\u6beb\u7c73",I*=1e3):o<1e3?r="\u7c73":(r="\u5343\u7c73",I/=1e3):m.asserts.assert(!1,33);for(var s=3*Math.floor(Math.log(this.minWidth_*I)/Math.log(10)),a=void 0,l=void 0;;){if(a=u.LEADING_DIGITS[(s%3+3)%3]*Math.pow(10,Math.floor(s/3)),l=Math.round(a/I),isNaN(l))return this.element.style.display="none",void(this.renderedVisible_=!1);if(l>=this.minWidth_)break;++s}var h=a+" "+r;this.renderedHTML_!==h&&(this.innerElement_.innerHTML=h,this.renderedHTML_=h),this.renderedWidth_!==l&&(this.innerElement_.style.width=l+"px",this.renderedWidth_=l),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},u}(m.control.Control);Q.render=function(e){var t=e.frameState;this.viewState_=t?t.viewState:null,this.updateElement_()},Q.LEADING_DIGITS=[1,2,5],Q.ScaleLineUnits={DEGREES:"degrees",IMPERIAL:"imperial",NAUTICAL:"nautical",METRIC:"metric",CHINESEMETRIC:"metric_cn",US:"us"},Q.Property_={UNITS:"units"};var J=function(r){function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,n);var t=void 0!==e.className?e.className:"ole-rotate-control",g=v("div",t+" "+j.CLASS_UNSELECTABLE),A=v("button",t+"-inner right-button",g),C=v("button",t+"-inner center-button",g,t+"-inner-center"),i=v("button",t+"-inner left-button",g),I=e.render?e.render:n.render,o=f(this,r.call(this,{element:g,render:I,target:e.target}));return o.callResetNorth_=e.resetNorth?e.resetNorth:void 0,o.duration_=void 0!==e.duration?e.duration:250,o.autoHide_=void 0===e.autoHide||e.autoHide,o.rotation_=void 0,o.label_=C,S(A,"click",o.handleClick_.bind(o,"right")),S(C,"click",o.handleClick_.bind(o,"center")),S(i,"click",o.handleClick_.bind(o,"left")),o}return l(n,r),n.prototype.handleClick_=function(e,t){t.preventDefault(),this.resetNorth_(e)},n.prototype.resetNorth_=function(e){var t=0;"center"===e?void(t=0)!==this.callResetNorth_?this.callResetNorth_():this.rotationView_(t,e):(t="left"===e?-90:90,this.rotationView_(t))},n.prototype.rotationView_=function(e,t){var g=this.getMap().getView(),A="center"===t?0:g.getRotation()+e/180*Math.PI;if(!(g&&g instanceof m.View))throw new Error("can not get view!");void 0!==g.getRotation()&&(0<this.duration_?g.animate({rotation:A,duration:this.duration_,easing:m.easing.easeOut}):g.setRotation(0))},n}(m.control.Control);J.render=function(e){var t=e.frameState;if(t){var g=t.viewState.rotation;if(g!==this.rotation_){var A="rotate("+g+"rad)";if(this.autoHide_){var C=p(this.element,j.CLASS_HIDDEN);C||0!==g?C&&0!==g&&w(this.element,j.CLASS_HIDDEN):d(this.element,j.CLASS_HIDDEN)}b(this.label_,{transform:A,webkitTransform:A,msTransform:A})}this.rotation_=g}};var q=function(i){function I(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,I);var t=void 0!==e.className?e.className:"ole-overview-map",g=v("div",t+" "+j.CLASS_UNSELECTABLE),A=e.render?e.render:I.render,C=f(this,i.call(this,{element:g,render:A,target:e.target}));return C.collapsed_=void 0===e.collapsed||e.collapsed,C.collapsible_=void 0===e.collapsible||e.collapsible,C.collapsible_||(C.collapsed_=!1),C.ovmapDiv_=v("div","ole-overview-map-target",g),C.collapsible_&&(C.collapsElement_=v("div","ole-overview-map-button",g),S(C.collapsElement_,"click",C.handleClick_,C)),C.ovmap_=new m.Map({controls:new m.Collection,interactions:new m.Collection,view:e.view}),C.addBoxControl_(),C}return l(I,i),I.prototype.addOptionLayers_=function(e){var t=this.ovmap_;e.layers&&e.layers.forEach(function(e){t.addLayer(e)},this)},I.prototype.move_=function(e){var t=this.boxOverlay_.getElement(),g=this.ovmap_.getEventCoordinate(I.computeDesiredMousePosition(e,t));this.boxOverlay_.setPosition(g)},I.prototype.endMoving_=function(e){var t=this.ovmap_.getEventCoordinate(e);this.getMap().getView().setCenter(t),T(window,"mousemove",this.move_,this),T(window,"mouseup",this.endMoving_,this)},I.prototype.addEvent_=function(){S(window,"mousemove",this.move_,this),S(window,"mouseup",this.endMoving_,this)},I.prototype.addBoxControl_=function(){var e=v("div","ole-overview-map-box");S(e,"mousedown",this.addEvent_,this),this.boxOverlay_=new m.Overlay({position:[0,0],positioning:"bottom-left",element:e}),this.ovmap_.addOverlay(this.boxOverlay_)},I.prototype.setMap=function(e){var t=this.getMap();if(e!==t){if(t){var g=t.getView();g&&this.unbindView_(g),this.ovmap_.setTarget(null)}if(i.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());var A=e.getView();A&&(this.bindView_(A),this.isDef(A)&&(this.ovmap_.updateSize(),this.resetExtent_()))}}},I.prototype.isDef=function(e){return!!e.getCenter()&&void 0!==e.getResolution()},I.prototype.handleMapPropertyChange_=function(e){if("view"===e.key){var t=e.oldValue;t&&this.unbindView_(t);var g=this.getMap().getView();this.bindView_(g)}},I.prototype.bindView_=function(e){e.on("change:rotation",this.handleRotationChanged_,this)},I.prototype.unbindView_=function(e){e.un("change:rotation",this.handleRotationChanged_,this)},I.prototype.handleRotationChanged_=function(){this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())},I.prototype.validateExtent_=function(){var e=this.getMap(),t=this.ovmap_,g=e.getSize(),A=e.getView().calculateExtent(g),C=t.getSize(),i=t.getView().calculateExtent(C),I=t.getPixelFromCoordinate(m.extent.getTopLeft(A)),o=t.getPixelFromCoordinate(m.extent.getBottomRight(A)),r=Math.abs(I[0]-o[0]),n=Math.abs(I[1]-o[1]),s=C[0],a=C[1];r<s*B||n<a*B||s*H<r||a*H<n?this.resetExtent_():m.extent.containsExtent(i,A)||this.recenter_()},I.prototype.resetExtent_=function(){if(0!==H&&0!==B){var e=this.getMap(),t=this.ovmap_,g=e.getSize(),A=e.getView().calculateExtent(g),C=t.getView(),i=Math.log(H/B)/Math.LN2,I=1/(Math.pow(2,i/2)*B);this.scaleFromCenter(A,I),C.fit(A)}},I.prototype.scaleFromCenter=function(e,t){var g=(e[2]-e[0])/2*(t-1),A=(e[3]-e[1])/2*(t-1);e[0]-=g,e[2]+=g,e[1]-=A,e[3]+=A},I.prototype.recenter_=function(){var e=this.getMap(),t=this.ovmap_,g=e.getView();t.getView().setCenter(g.getCenter())},I.prototype.updateBox_=function(){var e=this.getMap(),t=this.ovmap_,g=e.getSize(),A=e.getView(),C=t.getView(),i=A.getRotation(),I=this.boxOverlay_,o=this.boxOverlay_.getElement(),r=A.calculateExtent(g),n=C.getResolution(),s=m.extent.getBottomLeft(r),a=m.extent.getTopRight(r),l=this.calculateCoordinateRotate_(i,s);I.setPosition(l),o&&b(o,{width:Math.abs((s[0]-a[0])/n)+"px",height:Math.abs((a[1]-s[1])/n)+"px"})},I.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]],m.coordinate.rotate(g,e),m.coordinate.add(g,A)),g},I.prototype.handleClick_=function(e){e.preventDefault(),this.handleToggle_(e)},I.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");var t=this.ovmap_;this.collapsed_||t||(t.updateSize(),this.resetExtent_(),t.once("postrender",this.updateBox_,this))},I.prototype.getCollapsible=function(){return this.collapsible_},I.prototype.setCollapsible=function(e){this.collapsible_!==e&&!(this.collapsible_=e)&&this.collapsed_&&this.handleToggle_()},I.prototype.setCollapsed=function(e){this.collapsible_&&this.collapsed_!==e&&this.handleToggle_()},I.prototype.getCollapsed=function(){return this.collapsed_},I.prototype.getOverviewMap=function(){return this.ovmap_},I}(m.control.Control);q.render=function(e){this.validateExtent_(),this.updateBox_()},q.computeDesiredMousePosition=function(e,t){return{clientX:e.clientX-t.offsetWidth/2,clientY:e.clientY+t.offsetHeight/2}};var $=function(i){function I(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,I);var t=void 0!==e.className?e.className:"ole-mouse-position",g=v("div",t+" "+j.CLASS_UNSELECTABLE),A=e.render?e.render:I.render,C=f(this,i.call(this,{element:g,render:A,target:e.target}));return C.on("change:"+I.Property_.PROJECTION,C.handleProjectionChanged_,C),e.coordinateFormat&&C.setCoordinateFormat(e.coordinateFormat),e.projection&&C.setProjection(e.projection),e.units&&C.setUnits(e.units),C.undefinedHTML_=void 0!==e.undefinedHTML?e.undefinedHTML:"",C.renderedHTML_=g.innerHTML,C.mapProjection_=null,C.transform_=null,C.lastMouseMovePixel_=null,C.followMouse_=!0===e.followMouse&&e.followMouse,C.popver_=null,C._bounds=null,C.className_=t,C}return l(I,i),I.prototype.handleProjectionChanged_=function(){this.transform_=null},I.prototype.getCoordinateFormat=function(){return this.get(I.Property_.COORDINATE_FORMAT)},I.prototype.getProjection=function(){return this.get(I.Property_.PROJECTION)},I.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_)))},I.prototype.followMousePopver_=function(){var e=this.getHTML_(this.lastMouseMovePixel_),t=this.getMap(),g=t.getCoordinateFromPixel(this.lastMouseMovePixel_);if(this.popver_){var A=this.popver_.getElement();A.innerHTML=e,A.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(g),this.popver_.setElement(A)}else{var C=v("div",this.className_+"_overlay");C.innerHTML=e,this.popver_=new m.Overlay({element:C,offset:[10,0],position:g,positioning:"center-left"}),t.addOverlay(this.popver_),t.render()}},I.prototype.handleMouseOut=function(e){this.updateHTML_(null),this.lastMouseMovePixel_=null},I.prototype.setMap=function(e){if(i.prototype.setMap.call(this,e),e){var t=e.getViewport();this._bounds=e.getTargetElement().getBoundingClientRect(),S(t,"mousemove",this.handleMouseMove,this),S(t,"mouseout",this.handleMouseOut,this)}},I.prototype.setCoordinateFormat=function(e){this.set(I.Property_.COORDINATE_FORMAT,e)},I.prototype.setProjection=function(e){this.set(I.Property_.PROJECTION,m.proj.get(e))},I.prototype.setUnits=function(e){this.set(I.Property_.PROJECTION,e)},I.prototype.updateHTML_=function(e){var t=this.getHTML_(e);this.renderedHTML_&&t===this.renderedHTML_||(this.element.innerHTML=t,this.renderedHTML_=t)},I.prototype.getHTML_=function(e){var t=this.undefinedHTML_;if(e&&this.mapProjection_){if(!this.transform_){var g=this.getProjection();this.transform_=g?m.proj.getTransformFromProjections(this.mapProjection_,g):I.identityTransform}var A=this.getMap().getCoordinateFromPixel(e);if(A){this.transform_(A,A);var C=this.getCoordinateFormat();t=C?C(A):I.Property_.UNITS[0]+"\uff1a"+A[0]+" "+I.Property_.UNITS[1]+"\uff1a"+A[1]}}return t},I}(m.control.Control);$.Property_={PROJECTION:"projection",COORDINATE_FORMAT:"coordinateFormat",UNITS:["\u7ecf\u5ea6","\u7eac\u5ea6"]},$.render=function(e){var t=e.frameState;t?this.mapProjection_!==t.viewState.projection&&(this.mapProjection_=t.viewState.projection,this.transform_=null):this.mapProjection_=null,this.getMap()&&this.lastMouseMovePixel_&&(this.followMouse_?this.followMousePopver_(this.lastMouseMovePixel_):this.updateHTML_(this.lastMouseMovePixel_))},$.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};var ee=function(e,t){var g=null;if(e){var A=e.getLayers().getArray();g=te(A,"layerName",t)}return g},te=function g(e,A,C){var i=null;return 0<e.length&&e.every(function(e){if(e instanceof m.layer.Group){var t=e.getLayers().getArray();return!(i=g(t,A,C))}return e.get(A)!==C||(i=e,!1)}),i},ge=function A(e,C,i){var I=[];return 0<e.length&&e.forEach(function(e){if(e instanceof m.layer.Group){var t=e.getLayers().getArray(),g=A(t,C,i);g&&(I=I.concat(g))}else e.get(C)===i&&I.push(e)}),I},Ae=function(e,t,g){var A=[];if(e){var C=e.getLayers().getArray();A=ge(C,t,g)}return A},Ce=function A(e,C){var i=void 0;return e.every(function(t){if(t&&t instanceof m.layer.Vector&&t.getSource){var e=t.getSource();if(e.getFeatures)e.getFeatures().every(function(e){return e!==C||(i=t,!1)});return!1}if(t instanceof m.layer.Group){var g=t.getLayers().getArray();return!(i=A(g,C))}return!0}),i},ie=function(e,t,g){if(e){var A=ee(e,t);if(A instanceof m.layer.Vector||(A=null),A||g&&g.create&&(A=new m.layer.Vector({layerName:t,params:g,layerType:"vector",source:new m.source.Vector({wrapX:!1}),style:new m.style.Style({fill:new m.style.Fill({color:"rgba(67, 110, 238, 0.4)"}),stroke:new m.style.Stroke({color:"#4781d9",width:2}),image:new m.style.Circle({radius:7,fill:new m.style.Fill({color:"#ffcc33"})})}),zIndex:g.zIndex})),e&&A){g&&g.hasOwnProperty("selectable")&&A.set("selectable",g.selectable);var C=ee(e,t);C&&C instanceof m.layer.Vector||e.addLayer(A)}return A}},Ie=Object.freeze({getBaseLayers:function(){return Ae("isBaseLayer",!0)},getAllLayers:function(e){var t=[];e&&(t=function A(e){var C=[];return 0<e.length&&e.forEach(function(e){if(e instanceof m.layer.Group){var t=e.getLayers().getArray(),g=A(t);g&&(C=C.concat(g))}else C.push(e)}),C}(e.getLayers().getArray()));return t},getLayerByFeature:function(e,t){var g=void 0;if(e&&t instanceof m.Feature){var A=e.getLayers().getArray();g=Ce(A,t)}return g},getBaseLayerByLayerName:function(t){var g=null,e=Ae("isBaseLayer",!0);return e&&0<e.length&&e.every(function(e){return e.get("layerName")!==t||(g=e,!1)}),g},getLayerByLayerName:ee,getLayerInternal:te,getLayersArrayInternal:ge,getLayerByKeyValue:function(e,t,g){var A=null;if(e){var C=e.getLayers().getArray();A=te(C,t,g)}return A},getLayersArrayByKeyValue:Ae,createVectorLayer:ie}),oe=function(C){function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,i);var t=void 0!==e.className?e.className:"ole-layer-switcher",g=v("div",t+" "+j.CLASS_UNSELECTABLE),A=f(this,C.call(this,{element:g,target:e.target}));if(A.options=e,A.className_=t,S(g,"mouseover",A.contentMouseOver_,A),S(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?A.options.baseLayerKey:"isBaseLayer",A.isDefaultKey=A.options.isDefaultKey?A.options.isDefaultKey:"isDefault",A.labelAliasKey=A.options.labelAlias?A.options.labelAlias:"layerName",A.labelLayerKey=A.options.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?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_=v("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}return l(i,C),i.prototype.initDomInternal=function(e,C,i){var I=this,o=this.options.itemWidth,r=this.options.itemHeight,n=e.length;this.innerElement_.style.width=o+10*(n-1)+"px",this.innerElement_.style.height=r+"px",e.forEach(function(e,t){if(e&&e[i]){var g=v("li",C+"-li-inner",I.innerElement_,C+"-li"+t+"-inner");if(b(g,{background:"url("+e.icon+") 0px 0px no-repeat",width:o+"px",height:r+"px",zIndex:t+1,right:"0px",marginRight:10*(n-1-t)+"px"}),g.setAttribute("data-name",e[i]),S(g,"click",I.handleClick_,I),e.name){var A=v("span","layer-name",g);A.setAttribute("data-name",e[i]),A.innerHTML=e.name}I.isActionSelected_||e[I.isDefaultKey]&&(d(g,"selected-item"),I.isActionSelected_=!0),I.isActionSelected_||t!==n-1||(d(g,"selected-item"),I.isActionSelected_=!0)}})},i.prototype.contentMouseOver_=function(e){var t=this.options.layers.length;if(0<t){for(var g=0;g<t-1;g++){var A=_(this.className_+"-li"+g+"-inner");A&&b(A,{marginRight:"0px",zIndex:"",right:(t-1-g)*(10+this.options.itemWidth)+"px"})}b(this.innerElement_,"width",this.options.itemWidth*t+10*(t-1)+"px")}},i.prototype.contentMouseOut_=function(e){var t=this.options.layers.length;if(0<t){for(var g=0;g<t-1;g++){var A=_(this.className_+"-li"+g+"-inner");A&&b(A,{marginRight:10*(t-1-g)+"px",zIndex:g+1,right:"0px"})}b(this.innerElement_,"width",this.options.itemWidth+10*(t-1)+"px")}},i.prototype.handleClick_=function(e){var t=e.target.getAttribute("data-name");this.switcher(this.options.key,t)},i.prototype.updateBaseLayer_=function(){this.getMap()&&(this.baseLayers_=Ae(this.getMap(),this.baseLayerKey,!0),this.labelLayers_=Ae(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}))},i.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=_(this.className_+"-li"+C+"-inner");i&&i.getAttribute("data-name")===g?d(i,"selected-item"):w(i,"selected-item")}},i.prototype.setMap=function(e){C.prototype.setMap.call(this,e),e&&e instanceof m.Map&&this.updateBaseLayer_()},i}(m.control.Control),re=function(C){function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,i);var t=void 0!==e.className?e.className:"ole-context-menu-content",g=v("div",t+" "+j.CLASS_UNSELECTABLE);b(g,"display","none");var A=f(this,C.call(this,{element:g,target:e.target}));return A.options=e,A.className_=t,A.mapContent=null,A.pixel=[],A.itemWidth="number"==typeof A.options.itemWidth?A.options.itemWidth:160,A.itemHeight="number"==typeof A.options.itemHeight?A.options.itemHeight:30,A}return l(i,C),i.prototype.initDomInternal=function(e){this.htmlUtils(e,"",this.element),this.getMap()&&(this.mapContent=this.getMap().getViewport(),S(this.mapContent,"contextmenu",this.mouseDownHandle_,this))},i.prototype.mouseDownHandle_=function(e){var t=this,g=this;D(e),P(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)),S(e.target,"mousedown",function(){g.hide(),g.dispatchEvent({type:"hide",target:this,event:e})},this,!0)},i.prototype.show=function(e){b(this.element,{display:"block",top:e[1]+"px",left:e[0]+"px"});var t=this.getMap().getSize(),g=t[0]-this.element.offsetWidth,A=t[1]-this.element.offsetHeight;this.element.offsetTop>A&&b(this.element,{top:A+"px"}),this.element.offsetLeft>g&&b(this.element,{left:g+"px"})},i.prototype.hide=function(){this.element.style.display="none",this.pixel=[]},i.prototype.htmlUtils=function(e,I,t,g){var o=this,r=null;return e&&Array.isArray(e)&&0<e.length&&(r=v("ul",this.className_+"-ul"+I+"-inner",t,this.className_+"-ul"+I+"-inner"),g&&b(r,{position:"absolute",top:"0px",left:this.itemWidth+20+"px"}),e.forEach(function(e,t){if(e&&e.name&&e.alias){var g=I+"-"+t,A=v("li",o.className_+"-li-"+g+"-inner",r,o.className_+"-li-"+g+"-inner");if(b(A,{width:o.itemWidth+"px",height:o.itemHeight+"px",lineHeight:o.itemHeight+"px"}),A.setAttribute("data-name",e.alias),S(A,"click",o.handleItemClick_.bind(o,e),o),e.icon){var C=v("span","li-icon-content",A);if("iconfont"===e.iconType){var i=e.fontName?e.fontName:"iconfont";d(C,i+" "+e.icon),e.iconColor&&(C.style.color=e.iconColor)}else C.style.background="url("+e.icon+") 0px 0px no-repeat"}v("span","li-name-content",A).innerHTML=e.name,e.showLine&&(A.style.borderBottom="1px solid #CCCCCC"),e.items&&(o.htmlUtils(e.items,g,A,!0),S(A,"mouseenter",o.handleItemMouseOver_,o),S(A,"mouseleave",o.handleItemMouseOut_,o))}})),r},i.prototype.updateElement_=function(e,t,g){var A=_(this.className_+"-ul-inner"),C=n(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),i=g,this.htmlUtils(g,"",this.element)}return i},i.prototype.getCurrentPixel=function(){return this.pixel},i.prototype.getCurrentCoordinates=function(){return this.getMap().getCoordinateFromPixel(this.getCurrentPixel())},i.prototype.handleItemClick_=function(e,t){var g=this;D(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)},i.prototype.handleItemMouseOver_=function(e){if(D(e),e.target&&e.target.childNodes){var t=Array.prototype.slice.call(e.target.childNodes,0);t&&0<t.length&&t.every(function(e){return!e||"ul"!==e.nodeName.toLowerCase()||!(e.style.display="block")})}},i.prototype.handleItemMouseOut_=function(e){if(D(e),e.target&&e.target.childNodes){var t=Array.prototype.slice.call(e.target.childNodes,0);t&&0<t.length&&t.every(function(e){return!e||"ul"!==e.nodeName.toLowerCase()||!(e.style.display="none")})}},i.prototype.setMap=function(e){C.prototype.setMap.call(this,e),e&&e instanceof m.Map&&this.initDomInternal(this.options.items)},i.prototype.pop=function(){return this.updateElement_("pop")},i.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")},i.prototype.shift=function(){return this.updateElement_("shift")},i.prototype.reverse=function(){return this.updateElement_("reverse")},i.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")},i.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)},i.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)},i}(m.control.Control),ne=function(o){function r(e,t){var g=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};y(this,r);var A=void 0!==g.className?g.className:"ole-control-compare",C=v("div",A+" "+j.CLASS_UNSELECTABLE),i=v("div",A+"-inner",C),I=f(this,o.call(this,{element:C,target:g.target}));if(!e||!t)throw new Error("\u56fe\u5c42\u5fc5\u987b\u4f20\u5165\uff01");return I.beforeMap=e,I.afterMap=t,I.orderLayerZindex(),I.initPosition=void 0!==g.initPosition?g.initPosition:.5,I.dragging_=!1,I.previousX_=null,I.previousY_=null,S(i,"pointerdown",I.handleDraggerStart_,I),S(i,"pointermove",I.handleDraggerDrag_,I),S(i,"pointerup",I.handleDraggerEnd_,I),S(window,"pointerup",I.handleDraggerEnd_,I),I}return l(r,o),r.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())},r.prototype.handleDraggerStart_=function(e){!this.dragging_&&e.target&&(this.previousX_=e.clientX,this.previousY_=e.clientY,this.dragging_=!0)},r.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)},r.prototype.handleDraggerEnd_=function(e){this.dragging_&&(this.dragging_=!1,this.previousX_=void 0,this.previousY_=void 0)},r.prototype.clipLayer=function(){var A=this;this.getMap().un("precompose",this.precompose),this.getMap().un("postcompose",this.postcompose),this.precompose=this.beforeMap.on("precompose",function(e){var t=e.context,g=t.canvas.width*A.initPosition;t.save(),t.beginPath(),t.rect(g,0,t.canvas.width-g,t.canvas.height),t.clip()}),this.postcompose=this.beforeMap.on("postcompose",function(e){e.context.restore()})},r.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()},r.prototype.resize=function(){this._bounds=this.getMap().getTargetElement().getBoundingClientRect(),this._setPosition(this._bounds.width,this._bounds.width*this.percent)},r.prototype._getX=function(e){var t=(e=e.touches?e.touches[0]:e).clientX-this._bounds.left;return t<0&&(t=0),t>this._bounds.width&&(t=this._bounds.width),t},r.prototype.setMap=function(e){o.prototype.setMap.call(this,e),e&&e instanceof m.Map&&(e.render(),this.initControl())},r.prototype.setBeforeLayet=function(e){if(!e)throw Error("\u8bbe\u7f6e\u56fe\u5c42\u9519\u8bef\uff01");this.beforeMap=e,this.orderLayerZindex()},r.prototype.setAfterLayer=function(e){if(!e)throw Error("\u8bbe\u7f6e\u56fe\u5c42\u9519\u8bef\uff01");this.afterMap=e,this.orderLayerZindex()},r.prototype.orderLayerZindex=function(){if(this.afterMap&&this.beforeMap){var e=this.afterMap.getZIndex(),t=this.beforeMap.getZIndex(),g=Math.max(e,t),A=Math.min(e,t);g===A&&(g+=1),this.beforeMap.setZIndex(g),this.afterMap.setZIndex(A)}},r}(m.control.Control),se=function(p){function d(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};y(this,d);var t=void 0!==e.className?e.className:"ole-zoom-slider",g=v("div",t+" "+j.CLASS_UNSELECTABLE),A=v("div","ole-zoom-slider-translate-content "+j.CLASS_SELECTABLE,g),C=v("div","ole-zoom-slider-content "+j.CLASS_SELECTABLE,g),i=v("div","ole-zoom-slider-button ole-zoom-slider-translate-n "+j.CLASS_SELECTABLE,A);i.setAttribute("title","\u5411\u4e0a\u5e73\u79fb");var I=v("div","ole-zoom-slider-button ole-zoom-slider-t