!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("openlayers"),require("@angular/core"),require("rxjs/operators"),require("rxjs")):"function"==typeof define&&define.amd?define("ng-lmap",["exports","openlayers","@angular/core","rxjs/operators","rxjs"],e):e(t["ng-lmap"]={},null,t.ng.core,t.rxjs.operators,t.rxjs)}(this,function(t,_,e,r,o){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function i(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function M(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function a(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)a.push(n.value)}catch(s){o={error:s}}finally{try{n&&!n.done&&(r=i["return"])&&r.call(i)}finally{if(o)throw o.error}}return a}var S={PI:3.141592653589793,x_pi:52.35987755982988,delta:function(t,e){var r=.006693421622965943,n=this.transformLat(e-105,t-35),o=this.transformLon(e-105,t-35),i=t/180*this.PI,a=Math.sin(i);a=1-r*a*a;var s=Math.sqrt(a);return{lat:n=180*n/(6378245*(1-r)/(a*s)*this.PI),lon:o=180*o/(6378245/s*Math.cos(i)*this.PI)}},gcj_encrypt:function(t,e){if(this.outOfChina(t,e))return{lat:t,lon:e};var r=this.delta(t,e);return{lat:t+r.lat,lon:e+r.lon}},gcj_decrypt:function(t,e){if(this.outOfChina(t,e))return{lat:t,lon:e};var r=this.delta(t,e);return{lat:t-r.lat,lon:e-r.lon}},gcj_decrypt_exact:function(t,e){for(var r,n,o=.01,i=.01,a=t-o,s=e-i,l=t+o,c=e+i,u=0;;){r=(a+l)/2,n=(s+c)/2;var p=this.gcj_encrypt(r,n);if(o=p.lat-t,i=p.lon-e,Math.abs(o)<1e-9&&Math.abs(i)<1e-9)break;if(0<o?l=r:a=r,0<i?c=n:s=n,1e4<++u)break}return{lat:r,lon:n}},bd_encrypt:function(t,e){var r=e,n=t,o=Math.sqrt(r*r+n*n)+2e-5*Math.sin(n*this.x_pi),i=Math.atan2(n,r)+3e-6*Math.cos(r*this.x_pi),a=o*Math.cos(i)+.0065;return{lat:o*Math.sin(i)+.006,lon:a}},bd_decrypt:function(t,e){var r=e-.0065,n=t-.006,o=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_pi),i=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_pi),a=o*Math.cos(i);return{lat:o*Math.sin(i),lon:a}},distance:function(t,e,r,n){var o=Math.cos(t*Math.PI/180)*Math.cos(r*Math.PI/180)*Math.cos((e-n)*Math.PI/180)+Math.sin(t*Math.PI/180)*Math.sin(r*Math.PI/180);return 1<o&&(o=1),o<-1&&(o=-1),6371e3*Math.acos(o)},outOfChina:function(t,e){return e<72.004||137.8347<e||(t<.8293||55.8271<t)},transformLat:function(t,e){var r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,r+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},transformLon:function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,r+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},gauss:function(t,e){var r,n,o,i,a,s,l,c,u,p,h,y,d;return i=6*(r=t/6)+3,i*=d=.0174532925199433,n=t*d,o=e*d,(c=2*(l=1/298.3)-l*l)/(1-c),u=6378245/Math.sqrt(1-c*Math.sin(o)*Math.sin(o)),p=Math.tan(o)*Math.tan(o),h=.006738525414683491*Math.cos(o)*Math.cos(o),a=u*((y=(n-i)*Math.cos(o))+(1-p+h)*y*y*y/6+(5-18*p+p*p+14*h-58*p*h)*y*y*y*y*y/120),s=6378245*(.9983245386485315*o-.0025142464643137575*Math.sin(2*o)+2638289149946452e-21*Math.sin(4*o)-35*c*c*c/3072*Math.sin(6*o))+u*Math.tan(o)*(y*y/2+(5-p+9*h+4*h*h)*y*y*y*y/24+(61-58*p+p*p+270*h-330*p*h)*y*y*y*y*y*y/720),{xval:a+=1e6*(r+1)+5e5,yval:s+=0}},wgsToBd:function(t,e){var r=this.gcj_encrypt(parseFloat(e),parseFloat(t));return this.bd_encrypt(r.lat,r.lon)},bdToWgs:function(t,e){var r=this.bd_decrypt(e,t);return this.gcj_decrypt(r.lat,r.lon)},convertGCJ02:function(t){var e,r,n,o,i=new Array,a=new Array,s=t.geometry.coordinates,l=t.bbox;if(l)for(var c=0;c<2;c++){var u=this.gcj_encrypt(l[c+1],l[c+c]);i.push(u.lon,u.lat)}try{for(var p=M(s),h=p.next();!h.done;h=p.next()){var y=h.value;try{for(var d=M(y),f=d.next();!f.done;f=d.next()){var v=f.value,g=S.gcj_encrypt(v[1],v[0]),m=g.lat,_=g.lon;a.push([_,m])}}catch(w){n={error:w}}finally{try{f&&!f.done&&(o=d["return"])&&o.call(d)}finally{if(n)throw n.error}}}}catch(x){e={error:x}}finally{try{h&&!h.done&&(r=p["return"])&&r.call(p)}finally{if(e)throw e.error}}return t.bbox=i,t.geometry.coordinates=[a],t}},s=function $(t,e,r,n,o,i,a,s,l,c){void 0===t&&(t=[60,60]),void 0===e&&(e=[0,0,0,0]),void 0===r&&(r="#17A8A2"),void 0===n&&(n=.5),void 0===o&&(o="#17A8A2"),void 0===i&&(i=1),void 0===a&&(a="#fff"),void 0===s&&(s=3),void 0===l&&(l="string"),void 0===c&&(c=5),this.size=t,this.padding=e,this.fill=r,this.fillOpacity=n,this.stroke=o,this.strokeWidth=i,this.background=a,this.precision=s,this.output=l,this.radius=c},v=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function c(t,e){var r=[],n=!0,o=!1,i=undefined;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(l){o=!0,i=l}finally{try{!n&&s["return"]&&s["return"]()}finally{if(o)throw i}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},h={};function y(t,e,r,n,o,i,a,s){var l=s[3],c=s[0],u=v(e,2),p=u[0],h=u[1],y=(t[0]-a[0])/o+l,d=h-(t[1]-a[1])/o+c;n<r?d-=(h-(i[3]-i[1])/o)/2:y+=(p-(i[2]-i[0])/o)/2;return[y,d]}h.style=function(t,e){var r=e.fill,n=e.fillOpacity,o=e.stroke,i=e.strokeWidth,a=[t.split("/>")[0]];return a.push('fill="'+r+'"'),a.push('fill-opacity="'+n+'"'),a.push('stroke="'+o+'"'),a.push('stroke-width="'+i+'"'),a.join(" ")+" />"},h.createCircle=function(t,e){var r=v(t,2),n=r[0],o=r[1],i=e.radius,a=e.precision,s='<circle cx="'+n.toFixed(a)+'" cy="'+o.toFixed(a)+'" r="'+i.toFixed(a)+'" />';return h.style(s,e)},h.createPath=function(t,e){var r=e.precision,n='<path d="'+t.map(function(t,e){return(0===e?"M":"L")+t[0].toFixed(r)+" "+t[1].toFixed(r)}).join(" ")+'" />';return h.style(n,e)},h.parseSVG=function(t){var e=document.createElementNS("http://www.w3.org/1999/xhtml","div");e.innerHTML=t;for(var r=document.createDocumentFragment();e.firstChild;)r.appendChild(e.firstChild);return r};var l={convertBasicGeometry:function(t,e,r){switch(e){case"Point":return h.createCircle(t[0],r);case"LineString":case"Polygon":return h.createPath(t,r)}}};l.getCommonOpt=function(t,e){var r=v(e.size,2),n=r[0],o=r[1],i=v(e.padding,4),a=i[0],s=i[1],l=i[2],c=n-i[3]-s,u=o-a-l,p=function d(t){var o=[Infinity,Infinity,-Infinity,-Infinity];return t.forEach(function(t){var e=v(t,2),r=e[0],n=e[1];r<o[0]&&(o[0]=r),r>o[2]&&(o[2]=r),n<o[1]&&(o[1]=n),n>o[3]&&(o[3]=n)}),o}(function f(t){switch(t.type){case"Point":return[t.coordinates];case"MultiPoint":case"LineString":return t.coordinates;case"MultiLineString":case"Polygon":var e=t.coordinates;return e.reduce(function(t,e){return t.concat(e)},e[0]);case"MultiPolygon":var r=t.coordinates,n=r.reduce(function(t,e){return t.concat(e)},r[0]);return n.reduce(function(t,e){return t.concat(e)},n[0]);case"GeometryCollection":var o=t.geometries.map(function(t){return f(t)});return o.reduce(function(t,e){return t.concat(e)},o[0]);case"Feature":return f(t.geometry);case"FeatureCollection":var i=t.features.map(function(t){return f(t)});return i.reduce(function(t,e){return t.concat(e)},i[0])}}(t)),h=(p[2]-p[0])/c,y=(p[3]-p[1])/u;return{xRes:h,yRes:y,res:y<h?h:y,extent:p,origin:[p[0],p[1]],geometrySize:[c,u]}},l.convertPoint=function(t,e,r){var n=r.xRes,o=r.yRes,i=r.res,a=r.extent,s=r.origin,l=r.geometrySize,c=y(t.coordinates,l,n,o,i,a,s,e.padding);return h.createCircle(c,e)},l.convertMultiPoint=function(t,e,r){var n=r.xRes,o=r.yRes,i=r.res,a=r.extent,s=r.origin,l=r.geometrySize;return t.coordinates.map(function(t){return y(t,l,n,o,i,a,s,e.padding)}).map(function(t){return h.createCircle(t,e)}).join("")},l.convertLineString=function(t,e,r){var n=r.xRes,o=r.yRes,i=r.res,a=r.extent,s=r.origin,l=r.geometrySize,c=(Array.isArray(t)?t:t.coordinates).map(function(t){return y(t,l,n,o,i,a,s,e.padding)}),u={};return Object.assign(u,e),u.fillOpacity=0,h.createPath(c,u)},l.convertMultiLineString=function(t,e,r){return t.coordinates.map(function(t){return l.convertLineString(t,e,r)}).join("")},l.convertPolygon=function(n,o,t){var i=t.xRes,a=t.yRes,s=t.res,l=t.extent,c=t.origin,u=t.geometrySize,e=Array.isArray(n)?n:n.coordinates,p={};return Object.assign(p,o),p.fill=o.background,p.fillOpacity=1,e.map(function(t,e){var r=t.map(function(t){return y(t,u,i,a,s,l,c,o.padding)});return 0==e||Array.isArray(n)?h.createPath(r,o):h.createPath(r,p)}).join("")},l.convertMultiPolygon=function(t,r,n){return t.coordinates.map(function(t,e){return l.convertPolygon(t,r,n)}).join("")},l.convertGeometryCollection=function(t,r,n){return t.geometries.map(function(t){var e="convert"+t.type;return l[e](t,r,n)}).join("")},l.convertFeature=function(t,e,r){var n=t.geometry,o="convert"+n.type;return l[o](n,e,r)},l.convertFeatureCollection=function(t,e,r){return t.features.map(function(t){return l.convertFeature(t,e,r)}).join("")};var c=function(t,e){var r=t.type,n="convert"+r;if(!l[n])throw new Error("The type of input object is not supported.");var o=l.getCommonOpt(t,e),i='<svg xmlns="http://www.w3.org/2000/svg" style="background:'+e.background+'" width="'+e.size[0]+'" height="'+e.size[1]+'" >',a=l[n];("Point"===r||"GeometryCollection"===r&&1===t.geometries.length&&"Point"===t.geometries[0].type||"FeatureCollection"===r&&1===t.features.length&&"Point"===t.features[0].geometry.type)&&(a=function(t,e,r){r.xRes,r.yRes,r.res,r.extent,r.origin;var n=r.geometrySize,o=v(e.padding,4),i=o[0],a=(o[1],o[2],[o[3]+n[0]/2,i+n[1]/2]);return h.createCircle(a,e)}),i+=a(t,e,o);var s=i+="</svg>";return"element"==e.output&&(s=h.parseSVG(i)),s},u=function(){function t(t,e){this._map=t,this._callBack=e,this._position=[],this._overlayArr=new Array,this._overlay=null,this._dragPan=null,this._moveFun=null,this._poinFun=null}return t.prototype.serMarkerArr=function(t,e){var r=this;r._overlayArr[e]=t,r._overlay=r._overlayArr[e]._overlay,this._map.getInteractions().forEach(function(t){t instanceof _.interaction.DragPan&&(r._dragPan=t)}),r._dragPan.setActive(!1)},t.prototype.binDraftingEvent=function(){var e=this;e._moveFun=function(t){return e._overlay&&!0===e._overlay.get("dragging")&&(e._overlay.setPosition(t.coordinate),e._position=t.coordinate,e._callBack&&e._callBack.call(this,e._position)),!1},e._poinFun=function(t){return e._overlay&&!0===e._overlay.get("dragging")&&(e._dragPan.setActive(!0),e._overlay.set("dragging",!1)),!1},this._map.on("pointermove",e._moveFun),this._map.on("pointerup",e._poinFun)},t.prototype.removDraftingEvent=function(){"function"==typeof this._moveFun&&"function"==typeof this._poinFun&&(this._map.un("pointermove",this._moveFun),this._map.un("pointerup",this._poinFun))},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:_.Map},{type:Function}]},t}(),p=function(){function t(){this.ele=document.createElement("div"),this._overlay=new _.Overlay({positioning:"center-center",element:this.ele,stopEvent:!1}),this.setHTMLElementStyle()}return t.prototype.setId=function(t){this.ele.id=t},t.prototype.setAttribute=function(t){var e=JSON.stringify(t);this.ele.setAttribute("data-op",e)},t.prototype.setOffset=function(t){var e=a(t,2),r=e[0],n=e[1];this._overlay.setOffset([r,n])},t.prototype.getAttribute=function(){return JSON.parse(this.ele.dataset.op)},t.prototype.setPosition=function(t){var e=a(t,2),r=e[0],n=e[1];this._overlay.setPosition([r,n])},t.prototype.getPosition=function(){return this._overlay.getPosition()},t.prototype.getMarker=function(){return this._overlay},t.prototype.setText=function(t){this.ele.innerText=t},t.prototype.setHtml=function(t){this.ele.innerHTML=t},t.prototype.getId=function(){return this.ele.id},t.prototype.binEvent=function(t,e){this._fun=e,this.ele.addEventListener(t,this._fun,!1)},t.prototype.hover=function(t,e){t&&this.ele.addEventListener("mouseover",t,!1),e&&this.ele.addEventListener("mouseout",e,!1)},t.prototype.getDom=function(){return this.ele},t.prototype.show=function(){this.ele.style.display="block"},t.prototype.hide=function(){this.ele.style.display="none"},t.prototype.startDrag=function(t){var e=this;e.ele.style.cursor="move",t.binDraftingEvent(),e._func=function(){t.serMarkerArr(e,this.id),e._overlay.set("dragging",!0)},e.binEvent("mousedown",e._func)},t.prototype.stopDrag=function(t){this.ele.style.cursor="default",this.ele.removeEventListener("mousedown",this._func),t.removDraftingEvent()},t.prototype.removEvent=function(t){this._fun&&this.ele.removeEventListener(t,this._fun)},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[]},t}(),d=function(o){function t(t,e,r){void 0===e&&(e=16),void 0===r&&(r=16);var n=o.call(this)||this;return n.imgSrc=t,n.width=e,n.height=r,n.ele.style.position="relative",n.ele.style.cursor="pointer",n.ele.style.width=n.width+"px",n.ele.style.height=n.height+"px",n.ele.style.backgroundPosition="center center",n.ele.style.backgroundRepeat="no-repeat",n.ele.style.backgroundImage="url("+n.imgSrc+")",n}return i(t,o),t.prototype.setHTMLElementStyle=function(){},t.prototype.setImgSrc=function(t){this.ele.style.backgroundImage="url("+t+")"},t}(p),f=function(n){function t(t,e){void 0===e&&(e=12);var r=n.call(this)||this;return r.ele.style.fontSize="12px",r.ele.innerText=t,r.ele.style.position="relative",r.ele.style.width="80px",r.ele.style.height="15px",r.ele.style.borderRadius="50%",r.ele.style.backgroundColor="transparent",r.ele.style.cursor="pointer",r.ele.style.lineHeight="20px",r.ele.style.textAlign="center",r.ele.style.color="#fff",r}return i(t,n),t.prototype.setHTMLElementStyle=function(){},t}(p),g=function(o){function t(t,e,r){void 0===t&&(t=""),void 0===e&&(e=126),void 0===r&&(r=26);var n=o.call(this)||this;return n.width=e,n.height=r,n.ele.style.width=e+"px",n.ele.style.height=r+"px",n.ele.style.backgroundColor="#fff",n.ele.style.lineHeight=r+"px",n.ele.style.fontSize="12px",n.ele.style.color="rgba(72, 84, 101, 1)",n.ele.style.borderRadius="8px 14px 14px 0px",n.ele.style.padding="0px 10px",n.ele.style.whiteSpace="nowrap",n.ele.style.zIndex="999",n.ele.style.cursor="pointer",n.ele.style.marginLeft="0",n.ele.style.marginRight="0",n.setText(t),n}return i(t,o),t.prototype.setHTMLElementStyle=function(){},t}(p),m=function(o){function t(t,e,r){void 0===e&&(e=235),void 0===r&&(r=73);var n=o.call(this)||this;return n.width=e,n.height=r,n._ul=document.createElement("ul"),n._spans=new Array,n._options=t,n.ele.style.boxSizing="border-box",n.ele.style.width=e+"px",n.ele.style.height=r+"px",n.ele.style.backgroundColor="#fff",n.ele.style.fontSize="12px",n.ele.style.borderRadius="8px 14px 14px 0px",n.ele.style.padding="8.5px 10px",n.ele.style.whiteSpace="nowrap",n.ele.style.marginLeft="0",n.ele.style.marginRight="0",n._init(),n}return i(t,o),t.prototype.setHTMLElementStyle=function(){},t.prototype._init=function(){this.ele.parentElement.style.zIndex="9999",this._ul.style.listStyle="none",this.ele.appendChild(this._ul),this._createLiAndLabelAndSapn()},t.prototype._createLiAndLabelAndSapn=function(){for(var t=this._options.nameArr,e=this._options.valArr,r=0;r<t.length;r++){var n=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span");this._spans.push(i),o.innerText=t[r],i.innerText=e[r],n.appendChild(o),n.appendChild(i),0!==r&&(n.style.marginTop="2px"),this._ul.appendChild(n)}},t.prototype.setValues=function(t){var r=this;void 0===t&&(t=[]),t.forEach(function(t,e){return r._spans[e].innerText=t})},t}(p),w=function(s){function t(t,e,r){void 0===r&&(r=90);var n=s.call(this)||this;n._nameArr=t,n._callback=e,n.width=r,n._isDisableArr=new Array,n._pArr=new Array,n.ele.style.backgroundColor="#fff",n.ele.style.borderRadius="4px",n.ele.style.position="relative",n.ele.style.height=30*n._nameArr.length+"px",n.ele.style.width=n.width+"px",n.ele.style.boxShadow="0px 2px 4px 0px rgba(146, 158, 170, 1)";for(var o=function(t){i._isDisableArr[t]=!0,i._pArr[t]=document.createElement("p"),i._pArr[t].style.height="30px",i._pArr[t].style.lineHeight="30px",i._pArr[t].style.textAlign="center",i._pArr[t].style.color="rgba(72, 84, 101, 1)",i._pArr[t].style.fontSize="14px",i._pArr[t].style.fontFamily="PingFangSC-Regular",i._pArr[t].style.cursor="pointer",i._pArr[t].setAttribute("key",t.toString()),i.ele.appendChild(i._pArr[t]),1<=t&&(i._pArr[t].style.borderTop="1px solid rgba(211, 219, 222, 1)"),i._pArr[t].innerText=i._nameArr[t];var r=i;i._pArr[t].addEventListener("click",function(t){var e=this.getAttribute("key");r._callback(e),t.stopPropagation()})},i=this,a=0;a<n._nameArr.length;a++)o(a);return n}return i(t,s),t.prototype.setHTMLElementStyle=function(){},t.prototype.isDisables=function(t){this._isDisableArr=t;for(var e=0;e<this._nameArr.length;e++)this._isDisableArr[e]?(this._pArr[e].style.color="rgba(72, 84, 101, 1)",this._pArr[e].style.cursor="pointer"):(this._pArr[e].style.color="rgba(146, 158, 170, 1)",this._pArr[e].style.cursor="default")},t}(p);var x=function(){function t(t,e){this._layer=null,this._lineFeature=null,this._source=null,this._pointArr=new Array,this._color=t.color,this._polylineWidth=t.width,this._pointArr=t.pointArr,this._map=e,this._createPolyline()}return t.prototype._createPolyline=function(){this._source=new _.source.Vector,this._layer=new _.layer.Vector({source:this._source,style:new _.style.Style({stroke:new _.style.Stroke({color:this._color,width:this._polylineWidth})})});var t=new _.geom.LineString(this._pointArr);this._lineFeature=new _.Feature(t),this._layer.getSource().addFeatures([this._lineFeature]),this._map.addLayer(this._layer)},t.prototype.setPolylineColor=function(t){this._layer.getStyle().getStroke().setColor(t)},t.prototype.getLayer=function(){return this._layer},t.prototype.setPolylineWidth=function(t){this._layer.getStyle().getStroke().setWidth(t)},t.prototype.removePolyline=function(){this._map.removeLayer(this._layer),this._source.removeFeature(this._lineFeature),this._lineFeature=null,this._source=null,this._layer=null},t}(),b=function(){function t(){this.xMax=0,this.xMin=400,this.yMax=0,this.yMin=400}return t.prototype.getLngAndLatMaxMin=function(t){t.X>this.xMax&&(this.xMax=t.X),t.Y>this.yMax&&(this.yMax=t.Y),t.X<this.xMin&&(this.xMin=t.X),t.Y<this.yMin&&(this.yMin=t.Y)},t.prototype.getLngLats=function(){var t=[];return t.push([this.xMax],[this.yMax]),t.push([this.xMin],[this.yMin]),t},t}();function P(t,e){return void 0===e&&(e=["blue","Lime"]),t?e[1]:e[0]}function I(t,e,r,n){return void 0===n&&(n=["blue","red","Lime"]),e?r<=t?n[2]:n[1]:n[0]}var A=[];function E(t){var e=t.getView();e.animate({zoom:e.getZoom()+1,duration:200})}function k(t){var e=t.getView();e.animate({zoom:e.getZoom()-1,duration:200})}function L(t,e,r){void 0===e&&(e=!1),void 0===r&&(r=null);for(var n=[],o=0;o<t.length;o++){var i=t[o],a=i.X,s=i.Y;if(null!=a&&""!=a&&0!=a&&null!=s&&""!=s&&0!=s)if(null!=r&&r.getLngAndLatMaxMin(i),e){var l=S.gcj_encrypt(s,a);n.push([l.lon,l.lat])}else n.push([a,s])}return n}function T(t){for(var e=0,r=400,n=0,o=400,i=0;i<t.length;i++)for(var a=0;a<t[i].length;a++)t[i][a][0]>e&&(e=t[i][a][0]),t[i][a][1]>n&&(n=t[i][a][1]),t[i][a][0]<r&&(r=t[i][a][0]),t[i][a][1]<o&&(o=t[i][a][1]);return[e,n,400===r?0:r,400===o?0:o]}var O=new _.layer.Tile({source:new _.source.XYZ({url:"http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=8b00225817f9180eefe7661501017e74"}),zIndex:-10}),C=new _.layer.Tile({source:new _.source.XYZ({url:"http://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=8b00225817f9180eefe7661501017e74"}),zIndex:-10}),F=new _.layer.Tile({source:new _.source.XYZ({url:"http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=8b00225817f9180eefe7661501017e74"}),zIndex:-10}),D=new _.layer.Tile({source:new _.source.XYZ({url:"http://www.google.cn/maps/vt/pb=!1m4!1m3!1i{z}!2i{x}!3i{y}!2m3!1e0!2sm!3i345013117!3m8!2szh-CN!3scn!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e0"}),zIndex:-10}),z=new _.layer.Tile({source:new _.source.XYZ({url:"http://www.google.cn/maps/vt?lyrs=s@748&gl=cn&x={x}&y={y}&z={z}"}),zIndex:-10}),R=[[[O,F],[C],[C,F]],[[D],[z],[z,new _.layer.Tile({source:new _.source.XYZ({url:"http://www.google.cn/maps/vt/pb=!1m4!1m3!1i{z}!2i{x}!3i{y}!2m3!1e0!2sm!3i345013117!3m8!2szh-CN!3scn!5e1105!12m4!1e68!2m2!1sset!2sRoadmapSatellite!4e0"}),zIndex:-10})]],[[new _.layer.Tile({source:new _.source.XYZ({url:"http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}"}),zIndex:-10})]]],j=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=2),this.drawArr=[!1,!1],this.mapTypeArr=[!1,!1],this.lMap=null,this.currentArr=[!1,!1,!1],this.view=new _.View({projection:"EPSG:4326",center:[120.17550675,30.189238500000002],zoom:10,minZoom:1,maxZoom:18}),this.lastKey=2,this.mapTypeArr[t]=!0,this.currentArr[e]=!0,this.mapType=t,this.layerType=e,this.mapOptians={controls:_.control.defaults().extend([new _.control.ScaleLine]),layers:R[this.mapType][this.layerType]}}return t.prototype.removeLayer=function(){var t=this.lMap.getLayers(),e=[];t.forEach(function(t){t.getZIndex()<0&&e.push(t)});for(var r=0,n=e.length;r<n;r++)this.lMap.removeLayer(e[r])},t.prototype.setMapType=function(t){this.mapTypeArr[1-t]=!1,this.mapTypeArr[t]=!0,this.mapType=t,this.removeLayer();try{for(var e=M(R[t][this.lastKey]),r=e.next();!r.done;r=e.next()){var n=r.value;this.lMap.addLayer(n)}}catch(a){o={error:a}}finally{try{r&&!r.done&&(i=e["return"])&&i.call(e)}finally{if(o)throw o.error}}var o,i},t.prototype.zoomIn=function(t){E(this.lMap),t.stopPropagation()},t.prototype.zoomOut=function(t){k(this.lMap),t.stopPropagation()},t.prototype.setMapLayer=function(t,e){this.currentArr=this.currentArr.map(function(t){return!1}),this.currentArr[t]=!0,this.removeLayer(),this.lastKey=t;try{for(var r=M(R[this.mapType][t]),n=r.next();!n.done;n=r.next()){var o=n.value;this.lMap.addLayer(o)}}catch(s){i={error:s}}finally{try{n&&!n.done&&(a=r["return"])&&a.call(r)}finally{if(i)throw i.error}}var i,a;e.stopPropagation()},t.prototype.drawSartEvent=function(){this.drawArr[0]=!0},t.prototype.drawEndEvent=function(){this.drawArr[0]=!1},t.prototype.drawSartEvent1=function(){this.drawArr[1]=!0},t.prototype.drawEndEvent1=function(){this.drawArr[1]=!1},t}();var H=function(){function t(){}return t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[]},t.ngInjectableDef=e.defineInjectable({factory:function(){return new t},token:t,providedIn:"root"}),t}(),N=function(){function t(){}return t.prototype.ngOnInit=function(){},t.decorators=[{type:e.Component,args:[{selector:"l-ng-lmap",template:"\n    <p>\n      ng-lmap works!\n    </p>\n  ",styles:[]}]}],t.ctorParameters=function(){return[]},t}(),G=function(){function t(t){this._ele=t,this._lMap=null,this.onLoad=new e.EventEmitter}return t.prototype.ngOnInit=function(){this._initMap(),this.onLoad.emit(this._lMap)},t.prototype._initMap=function(){this._lMap=new _.Map(Object.assign({target:this._ele.nativeElement},this.lMapOptions))},t.decorators=[{type:e.Directive,args:[{selector:"[lLmap]"}]}],t.ctorParameters=function(){return[{type:e.ElementRef}]},t.propDecorators={lMapOptions:[{type:e.Input,args:["lLmap"]}],onLoad:[{type:e.Output}]},t}(),J=function(){function t(t){this._ele=t,this.resize=new e.EventEmitter}return t.prototype.ngOnInit=function(){var n=this;o.fromEvent(window,"resize").pipe(r.debounceTime(500)).subscribe(function(t){var e=n._ele.nativeElement.offsetWidth,r=n._ele.nativeElement.offsetHeight;n.resize.emit({width:e,height:r})})},t.decorators=[{type:e.Directive,args:[{selector:"[lSizeevent]"}]}],t.ctorParameters=function(){return[{type:e.ElementRef}]},t.propDecorators={resize:[{type:e.Output,args:["lSizeevent"]}]},t}(),V=function(){function t(t){this._ele=t,this.isStringConvertGeoJson=!1,this.svgModel=new s}return t.prototype.ngOnInit=function(){this.geoJson&&(this.isStringConvertGeoJson?this._ele.nativeElement.innerHTML=c(JSON.parse(this.geoJson),this.svgModel):this._ele.nativeElement.innerHTML=c(this.geoJson,this.svgModel))},t.decorators=[{type:e.Directive,args:[{selector:"[lGeoSvg]"}]}],t.ctorParameters=function(){return[{type:e.ElementRef}]},t.propDecorators={geoJson:[{type:e.Input,args:["lGeoSvg"]}],isStringConvertGeoJson:[{type:e.Input}],svgModel:[{type:e.Input}]},t}(),X=function(t){function e(){return t.call(this)||this}return i(e,t),e.prototype.setHTMLElementStyle=function(){this.ele.style.position="relative",this.ele.style.background="rgb(23, 168, 162)",this.ele.style.borderRadius="4px",this.ele.style.color="#fff",this.ele.style.padding="4px 30px 4px 8px",this.ele.style.whiteSpace="nowrap"},e}(p),Y=function(t){function e(){return t.call(this)||this}return i(e,t),e.prototype.setHTMLElementStyle=function(){this.ele.style.position="relative",this.ele.style.background="rgba(0, 0, 0, 0.5)",this.ele.style.borderRadius="4px",this.ele.style.color="#fff",this.ele.style.padding="4px 8px",this.ele.style.opacity="0.7",this.ele.style.whiteSpace="nowrap"},e}(p);var B=new Array;function Z(t){return new _.layer.Vector({source:t,style:new _.style.Style({fill:new _.style.Fill({color:"rgba(255, 255, 255, 0.4)"}),stroke:new _.style.Stroke({color:"#ffcc33",width:2}),image:new _.style.Circle({radius:7,fill:new _.style.Fill({color:"#ffcc33"})})})})}B.LineString=function tt(t){var e=_.Sphere.getLength(t,{projection:"EPSG:4326"});return 100<e?Math.round(e/1e3*100)/100+" km":Math.round(100*e)/100+" m"},B.Polygon=function et(t){var e=_.Sphere.getArea(t,{projection:"EPSG:4326"});return"总面积："+e.toFixed(1)+" 平方米<br/>约等于："+(e/666.67).toFixed(2)+"亩"};var q=function(){function t(t,e,r,n,o){void 0===t&&(t=""),this._darwType=t,this._callback=e,this._map=r,this._strokeColor=n,this._fillColor=o,this._source=new _.source.Vector,this._vector=Z(this._source),this._init()}return t.prototype._init=function(){this._addInteraction()},t.prototype._addInteraction=function(){var r=this;this._pointerMoveHandler=function(t){if(!t.dragging){var e="点击绘制图形";r._sketch&&(e="单击继续绘制，双击结束测量"),r._helpTooltip.getDom().innerHTML=e,r._helpTooltip.setPosition(t.coordinate)}},this._map.addLayer(this._vector),this._map.on("pointermove",this._pointerMoveHandler),this._draw=function o(t,e,r,n){return void 0===r&&(r="rgba(255, 255, 255, 0.4)"),void 0===n&&(n="rgba(255, 204, 51, 0.5)"),new _.interaction.Draw({source:e,type:t,style:new _.style.Style({fill:new _.style.Fill({color:r}),stroke:new _.style.Stroke({color:n,lineDash:[10,10],width:2}),image:new _.style.Circle({radius:5,stroke:new _.style.Stroke({color:"rgba(255, 255, 255, 1)"}),fill:new _.style.Fill({color:"rgba(200, 200, 200, 0.6)"})})})})}(this._darwType,this._source,this._fillColor,this._strokeColor),this._map.addInteraction(this._draw),this._createMarker(),this._drawBinDrawstart(),this._drawBinDrawend()},t.prototype._createMarker=function(){this._measureTooltip=new X,this._measureTooltip.setOffset([0,-30]),this._map.addOverlay(this._measureTooltip.getMarker()),this._helpTooltip=new Y,this._helpTooltip.setOffset([10,0]),this._map.addOverlay(this._helpTooltip.getMarker())},t.prototype._drawBinDrawstart=function(){var n=this;this._draw.once("drawstart",function(t){n._sketch=t.feature;var r=t.coordinate;n._sketch.getGeometry().on("change",function(t){var e=t.target;e instanceof _.geom.Polygon?r=e.getInteriorPoint().getCoordinates():e instanceof _.geom.LineString&&(r=e.getLastCoordinate()),n._measureTooltip.getDom().innerHTML=B[n._darwType](e),n._measureTooltip.setPosition(r)})},this)},t.prototype._drawBinDrawend=function(){var e=this;this._draw.once("drawend",function(t){e._map.removeInteraction(e._draw),e._measureTooltip.getDom().appendChild(function r(e){var t=document.createElement("sapn");return t.innerHTML=" X ",t.style.position="absolute",t.style.width="14px",t.style.height="14px",t.style.right="4px",t.style.top="4px",t.style.cursor="pointer",t.style.backgroundColor="#fff",t.style.color="red",t.style.lineHeight="14px",t.style.textAlign="center",t.addEventListener("click",function(t){e._clear(),t.stopPropagation()},!1),t}(e)),e._map.un("pointermove",e._pointerMoveHandler),e._map.removeOverlay(e._helpTooltip.getMarker()),e._helpTooltip=null,e._draw=null,e._sketch=null,e._callback(t)},this)},t.prototype._clear=function(){this._map.removeLayer(this._vector),this._map.removeOverlay(this._measureTooltip.getMarker()),this._measureTooltip=null,this._vector=null,this._source=null},t}(),W=function(){function t(t,e,r,n,o){void 0===t&&(t=""),this._darwType=t,this._callback=e,this._map=r,this._strokeColor=n,this._fillColor=o,this._source=new _.source.Vector,this._vector=Z(this._source),this._init()}return t.prototype._init=function(){this._addInteraction()},t.prototype._addInteraction=function(){var r=this;this._pointerMoveHandler=function(t){if(!t.dragging){var e="点击绘制图形";r._sketch&&(e="单击继续绘制，双击结束测量"),r._helpTooltip.getDom().innerHTML=e,r._helpTooltip.setPosition(t.coordinate)}},this._map.addLayer(this._vector),this._map.on("pointermove",this._pointerMoveHandler),this._draw=function o(t,e,r,n){return void 0===r&&(r="rgba(184, 233, 134, 0.56)"),void 0===n&&(n="rgba(23, 168, 162, 0.56)"),new _.interaction.Draw({source:e,type:t,style:new _.style.Style({fill:new _.style.Fill({color:r}),stroke:new _.style.Stroke({color:n,lineDash:[10,10],width:2})})})}(this._darwType,this._source,this._fillColor,this._strokeColor),this._map.addInteraction(this._draw),this._createMarker(),this._drawBinDrawstart(),this._drawBinDrawend()},t.prototype._createMarker=function(){this._helpTooltip=new Y,this._helpTooltip.setOffset([10,0]),this._map.addOverlay(this._helpTooltip.getMarker())},t.prototype._drawBinDrawstart=function(){var e=this;this._draw.once("drawstart",function(t){e._sketch=t.feature;t.coordinate;e._sketch.getGeometry().on("change",function(t){var e=t.target;e instanceof _.geom.Polygon?e.getInteriorPoint().getCoordinates():e instanceof _.geom.LineString&&e.getLastCoordinate()})},this)},t.prototype._drawBinDrawend=function(){var e=this;this._draw.once("drawend",function(t){e._map.removeInteraction(e._draw),e._map.un("pointermove",e._pointerMoveHandler),e._map.removeOverlay(e._helpTooltip.getMarker()),e._helpTooltip=null,e._draw=null,e._sketch=null,e._callback(t),e._clear()},this)},t.prototype._clear=function(){this._map.removeLayer(this._vector),this._vector=null,this._source=null},t}(),K=function(){function t(t){this._ele=t,this.drawSartEvent=new e.EventEmitter,this.drawEndEvent=new e.EventEmitter}return t.prototype.onClick=function(t){var e=this;this.drawSartEvent.emit();new q(this.drawType,function(t){e.drawEndEvent.emit(t),null},this.map)},t.decorators=[{type:e.Directive,args:[{selector:"[lDraw]"}]}],t.ctorParameters=function(){return[{type:e.ElementRef}]},t.propDecorators={drawType:[{type:e.Input,args:["lDraw"]}],map:[{type:e.Input}],strokeColor:[{type:e.Input}],fillColor:[{type:e.Input}],drawSartEvent:[{type:e.Output}],drawEndEvent:[{type:e.Output}],onClick:[{type:e.HostListener,args:["click"]}]},t}(),Q=function(){function t(t){this._ele=t,this.drawSartEvent=new e.EventEmitter,this.drawEndEvent=new e.EventEmitter}return t.prototype.onClick=function(t){var e=this;this.drawSartEvent.emit();new W(this.drawType,function(t){e.drawEndEvent.emit(t),null},this.map);t.stopPropagation()},t.decorators=[{type:e.Directive,args:[{selector:"[lPolygon]"}]}],t.ctorParameters=function(){return[{type:e.ElementRef}]},t.propDecorators={drawType:[{type:e.Input,args:["lPolygon"]}],map:[{type:e.Input}],strokeColor:[{type:e.Input}],fillColor:[{type:e.Input}],drawSartEvent:[{type:e.Output}],drawEndEvent:[{type:e.Output}],onClick:[{type:e.HostListener,args:["click"]}]},t}(),U=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{imports:[],declarations:[N,G,J,V,K,Q],exports:[N,G,J,V,K,Q]}]}],t}();t.GPS=S,t.SvgModel=s,t.geo2svg=c,t.DraftingEvent=u,t.Overlay=p,t.LMarker=d,t.CheckPoint=f,t.Label=g,t.LabelEr=m,t.MenuPanel=w,t.getFeatures=function rt(t,e){for(var r=e.getLayers().a,n=0;n<r.length;n++){var o=r[n].getSource();if(o instanceof _.source.Vector){var i=o.getFeatures();if(0<i.length)for(var a=0;a<i.length;a++)if(i[a]===t)return r[n]}}return null},t.Polyline=x,t.AM=b,t.getDeepColorNew=P,t.getDeepColor=I,t.addPolylinePoint=function nt(t,e,r){var n=null,o=[],i=t.gpsPoints,a=t.isNJOpt,s=-1;if(1<i.length){var l=[],c=void 0;-1===s?(s=0,l.push(i[0]),l.push(i[1]),c=P(a[1],r),s=1):(l.push(i[s]),c=P(a[s+1],r));for(var u=s+1;u<i.length;u++){var p=P(a[u],r);p===c?l.push(i[u]):(n=new x({color:c,width:2,pointArr:l},e),o.push(n),(l=[]).push(i[u-1]),l.push(i[u]),c=p)}0<l.length&&(n=new x({color:c,width:2,pointArr:l},e),o.push(n)),s=i.length-1}return o},t.addPolylinePointAndDepth=function ot(t,e,r,n){var o=null,i=[],a=t.gpsPoints,s=t.optRtDephts,l=t.isNJOpt,c=-1;if(1<a.length){var u=[],p=void 0;-1==c?(c=0,u.push(a[0]),u.push(a[1]),p=I(s[1],l[1],e,n),c=1):(u.push(a[c]),p=I(s[c+1],l[c+1],e,n));for(var h=c+1;h<a.length;h++){var y=I(s[h],l[h],e,n);y==p?u.push(a[h]):(o=new x({color:p,width:2,pointArr:u},r),i.push(o),(u=[]).push(a[h-1]),u.push(a[h]),p=y)}0<u.length&&(o=new x({color:p,width:2,pointArr:u},r),i.push(o)),c=a.length-1}return i},t.colorArr=A,t.polygonStyle=function(t){return new _.style.Style({stroke:new _.style.Stroke({color:"transparent",width:1}),fill:function e(t){return new _.style.Fill({color:function n(t,e){var r=e[t.get("code")];return r||"#62e4c7"}.apply(this,[t,A])})}.apply(this,[t])})},t.getLayer=function(t,e){return new _.layer.Vector({source:new _.source.Vector({url:t,format:new _.format.GeoJSON({defaultDataProjection:"EPSG:3875",geometryName:"EPSG:3875"})}),style:e})},t.createPolygon=function it(t,e,r,n){void 0===e&&(e=""),void 0===r&&(r="rgba(23, 168, 162, 0.56)"),void 0===n&&(n="rgba(184, 233, 134, 0.56)");var o=null,i=null,a=null,s=new _.style.Style({stroke:new _.style.Stroke({width:1,color:r}),fill:new _.style.Fill({color:n})});return a=new _.layer.Vector({source:new _.source.Vector,style:s}),(o=new _.geom.Polygon).setCoordinates(t),(i=new _.Feature(o)).setId(e),a.getSource().addFeature(i),a},t.createPolygonGeojson=function at(t,e,r){void 0===e&&(e="rgba(41, 212, 178, 0.4)"),void 0===r&&(r="rgba(23, 168, 162, 1)");var n={Polygon:new _.style.Style({fill:new _.style.Fill({color:e}),stroke:new _.style.Stroke({color:r,width:2})})},o=new _.source.Vector({features:(new _.format.GeoJSON).readFeatures(t)});return new _.layer.Vector({source:o,style:function(t){return n[t.getGeometry().getType()]}})},t.fit=function st(t,e,r){var n=e.length;if(!(n<=0)){var o=(r=r||{}).way;o===undefined&&(o=1);for(var i=r.padding||[50,50,50,50],a=180,s=-180,l=180,c=-180,u=0,p=0,h=0;h<n;h++){var y=e[h][0],d=e[h][1];u+=y,p+=d,s<y&&(s=y),y<a&&(a=y),c<d&&(c=d),d<l&&(l=d)}var f=t.getView();switch(o){case 1:f.fit([a,l,s,c],{padding:i});break;case 2:var v=[u/n,p/n],g=new _.Sphere(6378137).haversineDistance([a,l],[s,c]),m=18-Math.floor(g/3e3);f.setCenter(v),f.setZoom(m)}}},t.zoomIn=E,t.zoomOut=k,t.createGPSPoints=L,t.createPolylinePoints=function lt(t,e,r){void 0===e&&(e=!1),void 0===r&&(r=null);var n={gpsPoints:[],optRtDephts:[],isNJOpt:[],IsInFence:[],IsOverSpeed:[]};n.gpsPoints=L(t,e);for(var o=0;o<t.length;o++)if(t[o].OptRtDepth&&n.optRtDephts.push(t[o].OptRtDepth),1==t[o].IsNJOpt?n.isNJOpt.push(t[o].IsNJOpt):0==t[o].IsNJOpt&&n.isNJOpt.push(t[o].IsNJOpt),1==t[o].IsInFence?n.isNJOpt.push(t[o].IsInFence):0==t[o].IsInFence&&n.isNJOpt.push(t[o].IsInFence),1==t[o].IsOverSpeed?n.isNJOpt.push(t[o].IsOverSpeed):0==t[o].IsOverSpeed&&n.isNJOpt.push(t[o].IsOverSpeed),r&&0<parseInt(t[o].PId)){var i=parseFloat(t[o].X),a=parseFloat(t[o].Y);i&&a&&r.call(this,t[o].PId,[i,a])}return n},t.getLngAndLatMaxMin=T,t.createGeoJson=function ct(t,e,r){return void 0===e&&(e={}),void 0===r&&(r="Polygon"),{type:"Feature",properties:e,bbox:T(t),geometry:{type:r,coordinates:t}}},t.rayCasting=function ut(t,e){for(var r=t.x,n=t.y,o=!1,i=0,a=e.length,s=a-1;i<a;s=i,i++){var l=e[i].X,c=e[i].Y,u=e[s].X,p=e[s].Y;if(l===r&&c===n||u===r&&p===n)return!0;if(c<n&&n<=p||n<=c&&p<n){var h=l+(n-c)*(u-l)/(p-c);if(h===r)return!0;r<h&&(o=!o)}}return!!o},t.mapLayerArr=R,t.INITMap=j,t.createRectangle=function pt(t,e,r){void 0===e&&(e="transparent"),void 0===r&&(r="transparent");var n=null,o=null,i=null,a=t.pointmaxs,s=t.pointmins,l=new _.style.Style({stroke:new _.style.Stroke({width:1,color:e}),fill:new _.style.Fill({color:r})});return i||(i=new _.layer.Vector({source:new _.source.Vector,style:l})),n||(n=new _.geom.Polygon).setCoordinates([[a,[s[0],a[1]],s,[a[0],s[1]],a]]),o||(o=new _.Feature(n),i.getSource().addFeature(o)),i},t.getCoordinates=function ht(t){for(var e=new Array,r=0;r<t.length;r+=2)e.push([t[r],t[r+1]]);return[e]},t.NgLmapService=H,t.NgLmapComponent=N,t.NgLmapModule=U,t.ɵd=K,t.ɵc=V,t.ɵa=G,t.ɵe=Q,t.ɵb=J,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ng-lmap.umd.min.js.map