gis-common 3.1.2 → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/constant/ErrorTypeConstant.d.ts +23 -0
  2. package/dist/constant/EventTypeConstant.d.ts +24 -0
  3. package/dist/constant/GraphicConstant.d.ts +16 -0
  4. package/dist/constant/LayerType.d.ts +10 -0
  5. package/dist/constant/index.d.ts +4 -0
  6. package/dist/gis-common.es.js +1751 -0
  7. package/dist/gis-common.umd.js +1 -0
  8. package/dist/index.d.ts +9 -0
  9. package/dist/utils/Cookie.d.ts +6 -0
  10. package/dist/utils/MathUtils.d.ts +36 -0
  11. package/package.json +26 -28
  12. package/dist/resource.min.js +0 -1
  13. package/src/assets/images/location.png +0 -0
  14. package/src/constant/ErrorTypeConstant.js +0 -22
  15. package/src/constant/EventTypeConstant.js +0 -23
  16. package/src/constant/GraphicConstant.js +0 -16
  17. package/src/constant/LayerType.js +0 -9
  18. package/src/constant/index.js +0 -4
  19. package/src/core/AudioPlayer.js +0 -30
  20. package/src/core/CanvasDrawer.js +0 -51
  21. package/src/core/DevicePixelRatio.js +0 -86
  22. package/src/core/ElQuery.js +0 -88
  23. package/src/core/EventDispatcher.js +0 -93
  24. package/src/core/HashMap.js +0 -26
  25. package/src/core/MqttClient.js +0 -108
  26. package/src/core/WebSocketClient.js +0 -104
  27. package/src/core/WebStorage.js +0 -73
  28. package/src/index.js +0 -10
  29. package/src/utils/AnimateUtils.js +0 -78
  30. package/src/utils/ArrayUtils.js +0 -82
  31. package/src/utils/AssertUtils.js +0 -112
  32. package/src/utils/BrowserUtils.js +0 -107
  33. package/src/utils/CommUtils.js +0 -236
  34. package/src/utils/Cookie.js +0 -23
  35. package/src/utils/CoordsUtils.js +0 -145
  36. package/src/utils/DateUtils.js +0 -144
  37. package/src/utils/DomUtils.js +0 -94
  38. package/src/utils/FileUtils.js +0 -104
  39. package/src/utils/GeoUtils.js +0 -253
  40. package/src/utils/MathUtils.js +0 -49
  41. package/src/utils/OptimizeUtils.js +0 -94
  42. package/src/utils/StringUtils.js +0 -148
  43. package/src/utils/index.js +0 -14
@@ -0,0 +1 @@
1
+ (function(u,D){typeof exports=="object"&&typeof module!="undefined"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(u=typeof globalThis!="undefined"?globalThis:u||self,D(u["gis-common"]={}))})(this,function(u){"use strict";var D={animate(t,e,n,r="swing",s=5){for(var a in e)e[a]={target:a==="opacity"?parseInt(e[a]*100):e[a],iNow:parseInt(a==="opacity"?getComputedStyle(t)[a]*100:getComputedStyle(t)[a])};r==="liner"&&(s=e[a].iNow<e[a].target?Math.abs(s):-Math.abs(s)),clearInterval(t.timer),t.timer=setInterval(function(){for(var i in e){var o=e[i].target,c=e[i].iNow;if(r==="swing"&&(s=(o-c)/20,s=s>0?Math.ceil(s):Math.floor(s)),Math.abs(o-c)<=Math.abs(s)){i==="opacity"?t.style[i]=o/100:t.style[i]=o+"px",delete e[i];for(var l in e)return!1;clearInterval(t.timer),typeof n=="function"&&n()}else e[i].iNow+=s,i==="opacity"?t.style[i]=e[i].iNow/100:t.style[i]=e[i].iNow+"px"}},30)}},v={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},g={LOGIN_EXPIRED:"\u767B\u5F55\u4FE1\u606F\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55",CROSS_ERROR:"\u8DE8\u57DF\u8BBF\u95EE",UNEXIST_RESOURCE:"\u8D44\u6E90\u4E0D\u5B58\u5728",TIMEOUT:"\u8BF7\u6C42\u8D85\u65F6",INTERNAL_ERROR:"\u5185\u90E8\u9519\u8BEF",NETWORK_ERROR:"\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u662F\u5426\u5DF2\u8FDE\u63A5",PROCESS_FAIL:"\u5904\u7406\u5931\u8D25",AUTH_VERIFY_ERROR:"\u6743\u9650\u9A8C\u8BC1\u5931\u8D25",NO_DATA_FOUND:"\u672A\u627E\u5230\u6570\u636E",DUPLICATE_INSTANCE:"\u5B9E\u4F8B\u4E3A\u5355\u4F8B\u6A21\u5F0F\uFF0C\u4E0D\u5141\u8BB8\u91CD\u590D\u6784\u5EFA",COORDINATE_ERROR:"\u5750\u6807\u9A8C\u8BC1\u5931\u8D25",JSON_PARSE_ERROR:"JSON\u89E3\u6790\u5931\u8D25\uFF0C\u683C\u5F0F\u6709\u8BEF",JSON_VALUE_ERROR:"JSON\u65E0\u6B64\u952E",PARAMETER_ERROR:"\u9A8C\u8BC1\u6570\u636E\u7C7B\u578B\u5931\u8D25",PARAMETER_ERROR_ARRAY:"\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF1A\u5FC5\u987B\u662F\u6570\u7EC4",PARAMETER_ERROR_STRING:"\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF1A\u5FC5\u987B\u662F\u5B57\u7B26",PARAMETER_ERROR_FUNCTION:"\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF1A\u5FC5\u987B\u662F\u51FD\u6570",PARAMETER_ERROR_OBJECT:"\u683C\u5F0F\u7C7B\u578B\u9A8C\u8BC1\u5931\u8D25\uFF1A\u5FC5\u987B\u662F\u5BF9\u8C61",PARAMETER_ERROR_LACK:"\u53C2\u6570\u7F3A\u5931",STRING_CHECK_LOSS:"\u5B57\u7B26\u7F3A\u5C11\u5173\u952E\u5B57"},$={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"};const G={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},z={DISTANCE:"distance",AREA:"area",HEIGHT:"height"};var E={getDataType(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty(t){if(t==null)return!0;switch(this.getDataType(t)){case"String":return t.trim()==="";case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty(t){return!this.isEmpty(t)},json2form(t){const e=new FormData;return Object.keys(t).forEach(n=>{e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])}),e},json2Query(t){var e=[];for(var n in t){var r=n,s=t[n];e.push(r+"="+s)}var a=e.join("&");return a},generateGuid(){const t=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict(...t){let e="";if(t.length>1){const n=t.slice(1,t.length%2===0?t.length-1:t.length);for(let r=0;r<n.length;r=r+2){const s=n[r];t[0]===s&&(e=n[r+1])}!e&&t.length%2===0&&(e=t[t.length-1])}else e=t[0];return e},extend(t,...e){let n,r,s,a;for(r=0,s=e.length;r<s;r++){a=e[r];for(n in a)t[n]=a[n]}return t},rgb2hex(t){var e="#"+(16777216+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1);return e},convertToTree2(t,e="id",n="parentId",r="children"){const s=[];function a(i){const o=i[e],c=t.filter(l=>l.hasOwnProperty(n)&&l[n]===o);c.length>0&&(c.forEach(a),i[r]=c)}for(const i of t)t.findIndex(o=>o[e]===i[n])===-1&&(a(i),s.push(i));return s},asyncLoadScript(t){return new Promise((e,n)=>{try{var r=document.createElement("script");r.readyState?r.onreadystatechange=function(){(r.readyState==="complete"||r.readyState==="loaded")&&e(r)}:r.onload=function(){e(r)},r.type="text/javascript",r.src=t,document.body.appendChild(r)}catch(s){n(s)}})},loadStyle(t){t.forEach(e=>{const n=document.createElement("link");n.href=e,n.rel="stylesheet",n.type="text/css",document.head.appendChild(n)})},template(t,e){const n=/\{ *([\w_-]+) *\}/g;return t.replace(n,function(r,s){var a=e[s];if(a===void 0)throw new Error(g.JSON_VALUE_ERROR+r);return typeof a=="function"&&(a=a(e)),a})},deleteEmptyProperty(t){return Object.fromEntries(Object.keys(t).filter(e=>!this.isEmpty(t[e])).map(e=>[e,t[e]]))},deepAssign(){let t=arguments.length,e=arguments[0];this.getDataType(e)!=="Object"&&(e={});for(let n=1;n<t;n++){let r=arguments[n];if(this.getDataType(r)==="Object")for(let s in r)s==="__proto__"||e===r[s]||(this.getDataType(r[s])==="Object"?e[s]=this.deepAssign(e[s],r[s]):e[s]=r[s])}return e},handleCopyValue(t){if(!navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);{const e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise((n,r)=>{document.execCommand("copy")?n():r(new Error("copy failed")),e.remove()})}}};Array.prototype.groupBy=function(t){var e={};return this.forEach(function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)}),Object.keys(e).map(n=>e[n])},Array.prototype.distinct=function(t=e=>e){const e=[],n={};return this.forEach(r=>{const s=t(r);!n[s]&&(n[s]=e.push(r))}),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((t=0,e=0)=>t+e):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(t=e=>e){return this.sort((e,n)=>t(n)-t(e))},Array.prototype.asc=function(t=e=>e){return this.sort((e,n)=>t(e)-t(n))},Array.prototype.clear=function(){return this.length=0,this};var j={asArray(t){return E.isEmpty(t)?[]:Array.isArray(t)?t:[t]},generateArray(t){return[...new Array(t).keys()]},union(...t){let e=[];return t.forEach(n=>{Array.isArray(n)&&(e=e.concat(n.filter(r=>!e.includes(r))))}),e},intersection(...t){let e=t[0]||[];return t.forEach(n=>{Array.isArray(n)&&(e=e.filter(r=>n.includes(r)))}),e},unionAll(...t){return[...t].flat().filter(e=>!!e)},difference(...t){return this.union(...t).filter(e=>!this.intersection(...t).includes(e))}},q={getUrlParams(t=window.location.href,e=!0){const n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,{search:r,hash:s}=new URL(t),a=[r,s];let i={};for(let o=0;o<a.length;o++){const c=a[o];if(c){const h=c.replace(/#|\//g,"").split("?");if(h.length>1)for(let d=1;d<h.length;d++){let f;for(;f=n.exec(h[d]);)i[f[1]]=e?decodeURIComponent(f[2]):f[2]}}}return i},getExplorer(){var t=window.navigator.userAgent;if(t.indexOf("MSIE")>=0||!!window.ActiveXObject||"ActiveXObject"in window)return"IE";if(t.indexOf("Firefox")>=0)return"Firefox";if(t.indexOf("Chrome")>=0)return"Chrome";if(t.indexOf("Opera")>=0)return"Opera";if(t.indexOf("Safari")>=0)return"Safari"},detectOS(){let t="";const e=navigator.userAgent.indexOf("Windows",0)!=-1?1:0,n=navigator.userAgent.indexOf("mac",0)!=-1?1:0,r=navigator.userAgent.indexOf("Linux",0)!=-1?1:0,s=navigator.userAgent.indexOf("X11",0)!=-1?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":s&&(t="Unix"),t},switchFullScreen(t){if(t){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},refreshScale(){const t=document.documentElement.clientWidth,e=document.documentElement.clientHeight,n=document.getElementById("app").style,r=t/e,s=16/9;let a=t/1920;r>s&&(a=e/1080),n.transformOrigin="left top",n.transform=`scale(${a}) translateX(-49.99%)`,n.width=`${t/a}px`},getHtmlFontSize(){const t=document.documentElement.clientWidth||document.body.clientWidth,e=document.querySelector("html");e.style.fontSize=t/192+"px"}},H={set:function(t,e,n=30){var r=new Date;r.setTime(r.getTime()+n*24*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toUTCString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);n!=null&&(document.cookie=t+"="+n+";expires="+e.toUTCString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return e!=null?e[2]:""}},Y={PI:3.141592653589793,XPI:3.141592653589793*3e3/180,delta(t,e){const r=.006693421622965943;let s=this.transformLat(e-105,t-35),a=this.transformLon(e-105,t-35);const i=t/180*this.PI;let o=Math.sin(i);o=1-r*o*o;const c=Math.sqrt(o);return s=s*180/(6378245*(1-r)/(o*c)*this.PI),a=a*180/(6378245/c*Math.cos(i)*this.PI),{lat:s,lng:a}},gcjEncrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};const n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact(t,e){let s=.01,a=.01,i=t-s,o=e-a,c=t+s,l=e+a,h,d,f=0;for(;;){h=(i+c)/2,d=(o+l)/2;const m=this.gcj_encrypt(h,d);if(s=m.lat-t,a=m.lng-e,Math.abs(s)<1e-9&&Math.abs(a)<1e-9||(s>0?c=h:i=h,a>0?l=d:o=d,++f>1e4))break}return{lat:h,lng:d}},bdEncrypt(t,e){const n=e,r=t,s=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),a=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),i=s*Math.cos(a)+.0065;return{lat:s*Math.sin(a)+.006,lng:i}},bdDecrypt(t,e){const n=e-.0065,r=t-.006,s=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),a=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),i=s*Math.cos(a);return{lat:s*Math.sin(a),lng:i}},mercatorEncrypt(t,e){const n=e*2003750834e-2/180;let r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return r=r*2003750834e-2/180,{lat:r,lng:n}},mercatorDecrypt(t,e){const n=e/2003750834e-2*180;let r=t/2003750834e-2*180;return r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),{lat:r,lng:n}},distance(t,e,n,r){const a=Math.cos(t*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((e-r)*this.PI/180),i=Math.sin(t*this.PI/180)*Math.sin(n*this.PI/180);let o=a+i;return o>1&&(o=1),o<-1&&(o=-1),Math.acos(o)*6371e3},outOfChina(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271},transformLat(t,e){let n=-100+2*t+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))*2/3,n+=(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))*2/3,n},transformLon(t,e){let n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))*2/3,n+=(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))*2/3,n+=(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))*2/3,n},randomCoordinate(t,e,n,r){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}}};Date.prototype.format=function(t){const e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(const n in e)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,RegExp.$1.length===1?e[n]:("00"+e[n]).substr((""+e[n]).length)));return t},Date.prototype.addDate=function(t,e){const n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+e*3);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+e*7);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e);break}return n};var K={lastMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()-1,1),thisMonthDate:new Date(new Date().getFullYear(),new Date().getMonth(),1),nextMonthDate:new Date(new Date().getFullYear(),new Date().getMonth()+1,1),lastWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-7-new Date().getDay()),thisWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1-new Date().getDay()),nextWeekDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1+7-new Date().getDay()),lastDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1),thisDayDate:new Date(new Date().setHours(0,0,0,0)),nextDayDate:new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()+1),parseDate(t){if(typeof t=="string"){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/),e&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if(e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/),e&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval(t,e){const n=new Date(t),s=new Date(e).getTime()-n.getTime(),a=Math.floor(s/(24*3600*1e3)),i=s%(24*3600*1e3),o=Math.floor(i/(3600*1e3)),c=i%(3600*1e3),l=Math.floor(c/(60*1e3)),h=c%(60*1e3),d=Math.round(h/1e3);let f="";return a>0&&(f+=a+"\u5929"),o>0&&(f+=o+"\u65F6"),l>0&&(f+=l+"\u5206"),d>0&&(f+=d+"\u79D2"),a===0&&o===0&&l===0&&d===0&&(f="\u5C11\u4E8E1\u79D2"),f},formatterCounter(t){const e=function(o){return(o>10?"":"0")+(o||0)},n=e(Math.floor(t/3600)),r=t%3600,s=e(Math.floor(r/60)),a=r%60,i=e(Math.round(a));return`${n}:${s}:${i}`},sleep(t){}};function B(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function P(t){return B(t).split(/\s+/)}var J={getStyle(t,e){let n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||n==="auto")&&document.defaultView){const r=document.defaultView.getComputedStyle(t,null);n=r?r[e]:null}return n==="auto"?null:n},create(t,e,n){const r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove(t){const e=t.parentNode;e&&e.removeChild(t)},empty(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal},hasClass(t,e){if(t.classList!==void 0)return t.classList.contains(e);const n=this.getClass(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)},addClass(t,e){if(t.classList!==void 0){const n=P(e);for(let r=0,s=n.length;r<s;r++)t.classList.add(n[r])}else if(!this.hasClass(t,e)){const n=this.getClass(t);this.setClass(t,(n?n+" ":"")+e)}},removeClass(t,e){t.classList!==void 0?P(e).forEach(r=>t.classList.remove(r)):this.setClass(t,B((" "+this.getClass(t)+" ").replace(" "+e+" "," ")))},setClass(t,e){t.className.baseVal===void 0?t.className=e:t.className.baseVal=e},parseFromString(t){return new DOMParser().parseFromString(t,"text/xml").children[0]}},M={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat(t,e){return t+Math.random()*(e-t)},degreesToRadians(t){return t*this.DEG2RAD},toRadians(t){return t*this.DEG2RAD},radiansToDegrees(t){return t*this.RAD2DEG},toDegrees(t){return t*this.RAD2DEG},formatFloat(t,e=2){return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}},L={toRadian:Math.PI/180,R:6371393,isLnglat(t,e){return t&&e&&+e>-90&&+e<90&&+t>-180&&+t<180},formatLnglat(t,e){let n="";function r(s){const a=parseFloat(s),i=parseInt(a);let o=parseInt((a-i)*60),c=(a-i)*3600-o*60;return i+"\xB0"+o+"\u2032"+c.toFixed(2)+"\u2033"}return t&&e&&(n=r(t)+","+r(e)),n},transformLnglat(t,e){function n(r){for(var s=/[sw]/i.test(r),a=s?-1:1,i=r.match(/[\d.]+/g),o=0,c=0,l=i.length;c<l;c++)o+=i[c]/a,a*=60;return o}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting(t,e){for(var n=t.x,r=t.y,s=!1,a=0,i=e.length,o=i-1;a<i;o=a,a++){var c=e[a].x,l=e[a].y,h=e[o].x,d=e[o].y;if(c===n&&l===r||h===n&&d===r)return"on";if(l<r&&d>=r||l>=r&&d<r){var f=c+(r-l)*(h-c)/(d-l);if(f===n)return"on";f>n&&(s=!s)}}return s?"in":"out"},wgs84PointsDistance(t,e){var n=Math.PI;function r(it){return it*n/180}if(arguments.length!=2)return 0;lon1=t.x,lat1=t.y,lon2=e.x,lat2=e.y;var s=6378137,a=63567523142e-4,i=1/298.257223563,o=r(lon2-lon1),c=Math.atan((1-i)*Math.tan(r(lat1))),l=Math.atan((1-i)*Math.tan(r(lat2))),h=Math.sin(c),d=Math.cos(c),f=Math.sin(l),m=Math.cos(l),C=o,N,k=100;do{var I=Math.sin(C),T=Math.cos(C),w=Math.sqrt(m*I*(m*I)+(d*f-h*m*T)*(d*f-h*m*T));if(w==0)return 0;var A=h*f+d*m*T,W=Math.atan2(w,A),F=d*m*I/w,O=1-F*F,p=A-2*h*f/O;isNaN(p)&&(p=0);var _=i/16*O*(4+i*(4-3*O));N=C,C=o+(1-_)*i*F*(W+_*w*(p+_*A*(-1+2*p*p)))}while(Math.abs(C-N)>1e-12&&--k>0);if(k==0)return NaN;var y=O*(s*s-a*a)/(a*a),rt=1+y/16384*(4096+y*(-768+y*(320-175*y))),x=y/1024*(256+y*(-128+y*(74-47*y))),at=x*w*(p+x/4*(A*(-1+2*p*p)-x/6*p*(-3+4*w*w)*(-3+4*p*p))),st=a*rt*(W-at);return st},rotatePoint(t,e,n){const r=(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,s=(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y;return{x:r,y:s}},calcBearAndDis(t,e){const{x:n,y:r}=t,{x:s,y:a}=e,i=s-n,o=a-r,c=Math.sqrt(i*i+o*o);return{angle:(Math.atan2(o,i)*(180/Math.PI)+360+90)%360,distance:c}},calcBearAndDisByPoints(t,e){var n=parseFloat(t.lat),r=parseFloat(t.lng),s=parseFloat(e.lat),a=parseFloat(e.lng),i=Math.sin((a-r)*this.toRadian)*Math.cos(s*this.toRadian),o=Math.cos(n*this.toRadian)*Math.sin(s*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.cos((a-r)*this.toRadian),c=Math.atan2(i,o)*(180/Math.PI),l=(s-n)*this.toRadian,h=(a-r)*this.toRadian,d=Math.sin(l/2)*Math.sin(l/2)+Math.cos(n*this.toRadian)*Math.cos(s*this.toRadian)*Math.sin(h/2)*Math.sin(h/2),f=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d)),m=this.R*f;return{angle:c,distance:m}},calcPointByBearAndDis(t,e,n){const r=M.toRadians(parseFloat(t.lat)),s=M.toRadians(parseFloat(t.lng));e=parseFloat(e),n=parseFloat(n);const a=n/this.R;e=M.toRadians(e);const i=Math.asin(Math.sin(r)*Math.cos(a)+Math.cos(r)*Math.sin(a)*Math.cos(e)),o=s+Math.atan2(Math.sin(e)*Math.sin(a)*Math.cos(r),Math.cos(a)-Math.sin(r)*Math.sin(i));return{lat:M.toDegrees(i),lng:M.toDegrees(o)}},mercatorTolonlat(t,e){const n=t/2003750834e-2*180;var r=e/2003750834e-2*180;const s=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2);return{lng:n,lat:s}},lonlatToMercator(t,e){var n=6378137;const r=t*Math.PI/180*n;var s=e*Math.PI/180;const a=n/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)));return{x:r,y:a}}},V={convertBase64ToBlob(t){for(var e=t.split(",")[0].split(":")[1].split(";")[0],n=window.atob(t.split(",")[1]),r=new ArrayBuffer(n.length),s=new Uint8Array(r),a=0;a<n.length;a++)s[a]=n.charCodeAt(a);var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;return i?(i=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder),i.append(r),i.getBlob(e)):(i=new Blob([r],{type:e}),i)},convertUrlToBase64(t,e,n){return new Promise(function(r,s){var a=new Image;a.crossOrigin="Anonymous",a.src=t,a.onload=function(){var i=document.createElement("canvas");i.width=e||a.width,i.height=n||a.height;var o=i.getContext("2d");o.drawImage(a,0,0,a.width,a.height);var c=a.src.substring(a.src.lastIndexOf(".")+1).toLowerCase(),l=i.toDataURL("image/"+c),h={dataURL:l,type:"image/"+c,ext:c};r(h)}})},convertBase64ToFile(t,e){for(var n=t.split(","),r=n[0].match(/:(.*?);/)[1],s=atob(n[1]),a=s.length,i=new Uint8Array(a);a--;)i[a]=s.charCodeAt(a);return new File([i],e,{type:r})},downloadFromFile(t,e){if(typeof t=="object")if(t instanceof Blob)t=URL.createObjectURL(t);else{const r=JSON.stringify(t),s=new Blob([r],{type:"text/json"});t=window.URL.createObjectURL(s)}else if(typeof t=="string"&&t.indexOf("http")===-1){const r=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(r)}var n=document.createElement("a");n.href=t,n.download=e||"",n.click(),window.URL.revokeObjectURL(n.href)}},Q={debounce(t,e,n=!0){let r,s,a,i,o;const c=function(){const l=+new Date-i;l<e&&l>0?r=setTimeout(c,e-l):(r=null,n||(o=t.apply(a,s),r||(a=s=null)))};return function(...l){a=this,i=+new Date;const h=n&&!r;return r||(r=setTimeout(c,e)),h&&(o=t.apply(a,l),a=l=null),o}},throttle(t,e,n){if(n===1)var r=0;else if(n===2)var s;return function(){let a=this,i=arguments;if(n===1){let o=Date.now();o-r>e&&(t.apply(a,i),r=o)}else n===2&&(s||(s=setTimeout(()=>{s=null,t.apply(a,i)},e)))}},recurve(t,e=500,n=5e3){let r=0;setTimeout(function s(){r++,r<Math.floor(n/e)&&(t.call(this),setTimeout(s,e))})}},U={checkStr(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase(t,e){switch(e=e||4,e){case 1:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toUpperCase()+n.substring(1).toLowerCase()});case 2:return t.replace(/\b\w+\b/g,function(n){return n.substring(0,1).toLowerCase()+n.substring(1).toUpperCase()});case 3:return t.split("").map(function(n){return/[a-z]/.test(n)?n.toUpperCase():n.toLowerCase()}).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag(t,...e){return e=e.map(n=>{switch(E.getDataType(n)){case"Object":return n||"{}";case"Array":return n||"[]";default:return n||""}}),t.reduce((n,r,s)=>`${n}${e[s-1]}${r}`)},getByteLength(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var s=Math.floor(n/2),a=s;a<t.length;a++){let i=t.substring(e,a);if(i.replace(r,"mm").length>=n)return i}return t},asString(t){if(E.isEmpty(t))return"";switch(E.getDataType()){case"Object":case"Array":return JSON.stringify(t);default:return t}}},X={notNull(t){if(E.isEmpty(t))throw Error("\u4E0D\u80FD\u4E3A\u7A7A:>>>"+t)},legalLnglat(t,e){if(!L.isLnglat(t,e))throw Error(g.COORDINATE_ERROR)},contain(t,...e){let n=!1;const r=e.length||0;for(let s=0,a=r;s<a;s++)n=t.indexOf(e[s])>=0;if(n)throw Error(g.STRING_CHECK_LOSS)},verify:{array(t){if(E.getDataType(t)!=="Array")throw Error(g.PARAMETER_ERROR_ARRAY+":>>>"+t)},function(t){if(E.getDataType(t)!=="Function")throw Error(g.PARAMETER_ERROR_FUNCTION+":>>>"+t)},object(t){if(E.getDataType(t)!=="Object")throw Error(g.PARAMETER_ERROR_OBJECT+":>>>"+t)}},legalJSON(t){try{JSON.parse(t)}catch{throw Error(g.JSON_PARSE_ERROR+":>>>"+t)}},legalData(t,e){const n=U.checkStr(t,e);let r="";switch(e){case"phone":r="\u7535\u8BDD";break;case"tel":r="\u5EA7\u673A";break;case"card":r="\u8EAB\u4EFD\u8BC1";break;case"pwd":r="\u5BC6\u7801";break;case"postal":r="\u90AE\u653F\u7F16\u7801";break;case"QQ":r="QQ";break;case"email":r="\u90AE\u7BB1";break;case"money":r="\u91D1\u989D";break;case"URL":r="\u7F51\u5740";break;case"IP":r="IP";break;case"date":r="\u65E5\u671F\u65F6\u95F4";break;case"number":r="\u6570\u5B57";break;case"english":r="\u82F1\u6587";break;case"chinese":r="\u4E2D\u6587";break;case"lower":r="\u5C0F\u5199";break;case"upper":r="\u5927\u5199";break;case"HTML":r="HTML\u6807\u8BB0";break}if(!n)throw Error(g.PARAMETER_ERROR+":>>>\u4E0D\u662F"+r)}};class Z{constructor(e){this.audio=new Audio,this.audio.src=e}play(){!this.muted&&this.audio.play()}pause(){this.audio.pause()}get muted(){return this.audio.muted}set muted(e){this.audio.muted=e}}class tt{constructor(e){E.getDataType(e)==="String"&&(e=document.querySelector("#"+e)),this.ctx=e.getContext("2d")}drawLine(e,n,r,s,a={}){this.cxt.beginPath();const i=a.width||1,o=a.color||"#000";this.cxt.lineWidth=i,this.cxt.fillStyle=o,this.cxt.moveTo(e,n),this.cxt.lineTo(r,s),this.cxt.closePath(),this.cxt.fill()}drawArc(e,n,r,s,a,i,o,c){o?(this.cxt.fillStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,r,M.degreesToRadians(s),M.degreesToRadians(a),i),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=c,this.cxt.beginPath(),this.cxt.arc(e,n,r,M.degreesToRadians(s),M.degreesToRadians(a),i),this.cxt.stroke())}}function b(){}Object.assign(b.prototype,{addEventListener(t,e,n,r=!1){this._listeners===void 0&&(this._listeners={}),this._mutex=this._mutex||{},this._context=n;const s=this._mutex,a=this._listeners;return a[t]===void 0&&(a[t]=[]),a[t].indexOf(e)===-1&&(r&&(s[t]=e),a[t].push(e)),this},hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1},removeEventListener(t,e){if(this._listeners===void 0)return;const r=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),r!==void 0){const s=r.map(a=>a.toString()).indexOf(e.toString());s!==-1&&r.splice(s,1)}},dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const r=n.slice(0);if(this._mutex[t.type]){r.find(a=>a===this._mutex[t.type]).call(this._context||this,t);return}for(let s=0,a=r.length;s<a;s++)r[s].call(this._context||this,t)}},removeAllListener(){this._mutex={};for(const t in this._listeners)this._listeners[t]=[]}}),Object.assign(Map.prototype,{isEmpty(){return this.size===0},_values(){return Array.from(Map.prototype.values.call(this))},_keys(){return Array.from(Map.prototype.keys.call(this))},_entries(){return Array.from(Map.prototype.entries.call(this))}});function S(){return new Map}S.fromEntries=function(t=[]){const e=new S;return t.forEach(n=>{Array.isArray(n)&&n.length===2&&e.set(n[0],n[1])}),e};class R extends b{constructor(e="ws://127.0.0.1:10088"){super(),this.maxCheckTimes=10,this.url=e,this.checkTimes=0,this.connectStatus=!1,this.connect(),this.connCheckStatus(this.maxCheckTimes),R.instance=this}connect(){if(this.disconnect(),this.url)try{if(console.info("\u521B\u5EFAws\u8FDE\u63A5>>>"+this.url),this.client=new WebSocket(this.url),this.client){const e=this;this.client.onopen=function(n){e.dispatchEvent({type:v.WEB_SOCKET_CONNECT,message:n})},this.client.onmessage=function(n){e.connectStatus=!0,e.dispatchEvent({type:v.WEB_SOCKET_MESSAGE,message:n})},this.client.onclose=function(n){e.dispatchEvent({type:v.WEB_SOCKET_CLOSE,message:n})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(n){e.dispatchEvent({type:v.WEB_SOCKET_ERROR,message:n})})}}catch(e){console.error("\u521B\u5EFAws\u8FDE\u63A5\u5931\u8D25"+this.url+":"+e)}}disconnect(){if(this.client)try{console.log("ws\u65AD\u5F00\u8FDE\u63A5"+this.url),this.client.close(),this.client=null}catch{this.client=null}}connCheckStatus(e){this.checkTimes>e||setTimeout(()=>{this.checkTimes++,this.client&&this.client.readyState!==0&&this.client.readyState!==1&&this.connect(),this.connCheckStatus(e)},2e3)}send(e){return this.client&&this.client.readyState===1?(this.client.send(e),!0):(console.error(this.url+"\u6D88\u606F\u53D1\u9001\u5931\u8D25\uFF1A"+e),!1)}heartbeat(){setTimeout(()=>{this.client&&this.client.readyState===1&&this.send("HeartBeat"),console.log("HeartBeat,"+this.url),setTimeout(this.heartbeat,3e4)},1e3)}static getInstance(){return R.instance?R.instance:Object.freeze(new R)}static get _instance(){return this.getInstance()}}class et{constructor(e=1){if(this.cacheType=e,e===1)this.storage=window.localStorage;else if(e===2)this.storage=window.sessionStorage;else throw new Error(g.PARAMETER_ERROR)}setItem(e,n,r){const s={key:e,value:n};if(this.cacheType===1){const a=Date.now();r&&(s.expired=a+r*1e3)}return this.storage[e]=JSON.stringify(s),s}getItem(e){const n=this.storage.getItem(e)||null,r=JSON.parse(n)||{};if(this.cacheType===1){const s=r.expired||Date.now();if(Date.now()>s)return this.remove(e),null}return r.value}remove(e){e&&(e.indexOf(",")>-1?e.split(",").forEach(n=>{this.storage.removeItem(n)}):this.storage.removeItem(e))}clear(){this.storage.clear()}}class nt{constructor(e=1){this.magnification=e}_getSystem(){var e=navigator.userAgent.toLowerCase();if(e.indexOf("windows")>=0)return!0}_addHandler(e,n,r){e.addEventListener?e.addEventListener(n,r,!1):e.attachEvent?e.attachEvent("on"+n,r):e["on"+n]=r}_correct(){let e=window.innerWidth;if(typeof e!="number"&&(document.compatMode=="CSS1Compat"?e=document.documentElement.clientWidth:e=document.body.clientWidth),e<=750){const r=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*75*Math.min(r,2)+"px"}else if(e>750&&e<=1200){const r=document.documentElement.clientWidth/e;document.documentElement.style.fontSize=this.magnification*85*Math.min(r,2)+"px"}else{const r=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=this.magnification*100*Math.min(r,2)+"px"}}_watch(){let e=this;e._addHandler(window,"resize",function(){e._correct()})}init(){let e=this;e._getSystem()&&(e._correct(),e._watch())}}u.AnimateUtils=D,u.ArrayUtils=j,u.AssertUtils=X,u.AudioPlayer=Z,u.BrowserUtils=q,u.CanvasDrawer=tt,u.Cookie=H,u.CoordsUtils=Y,u.DateUtils=K,u.DevicePixelRatio=nt,u.DomUtils=J,u.ErrorType=g,u.EventDispatcher=b,u.EventType=v,u.FileUtils=V,u.GeoUtils=L,u.GraphicType=G,u.HashMap=S,u.LayerType=$,u.MathUtils=M,u.MeasureMode=z,u.OptimizeUtils=Q,u.StringUtils=U,u.Utils=E,u.WebSocketClient=R,u.WebStorage=et,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,9 @@
1
+ export * from './utils';
2
+ export * from './constant';
3
+ export { default as AudioPlayer } from './core/AudioPlayer';
4
+ export { default as CanvasDrawer } from './core/CanvasDrawer';
5
+ export { default as EventDispatcher } from './core/EventDispatcher';
6
+ export { default as HashMap } from './core/HashMap';
7
+ export { default as WebSocketClient } from './core/WebSocketClient';
8
+ export { default as WebStorage } from './core/WebStorage';
9
+ export { default as DevicePixelRatio } from './core/DevicePixelRatio';
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ set: (name: string, value: string, Days?: number) => void;
3
+ remove: (name: string) => void;
4
+ get: (name: string) => string;
5
+ };
6
+ export default _default;
@@ -0,0 +1,36 @@
1
+ declare const _default: {
2
+ DEG2RAD: number;
3
+ RAD2DEG: number;
4
+ randInt(low: number, high: number): number;
5
+ randFloat(low: number, high: number): number;
6
+ /**
7
+ * 角度转弧度
8
+ *
9
+ * @param {*} degrees
10
+ * @returns {*}
11
+ */
12
+ degreesToRadians(degrees: number): number;
13
+ /**
14
+ * 角度转弧度
15
+ *
16
+ * @param {*} degrees
17
+ * @returns {*}
18
+ */
19
+ toRadians(degrees: number): number;
20
+ /**
21
+ * 弧度转角度
22
+ *
23
+ * @param {*} radians
24
+ * @returns {*}
25
+ */
26
+ radiansToDegrees(radians: number): number;
27
+ /**
28
+ * 弧度转角度
29
+ *
30
+ * @param {*} radians
31
+ * @returns {*}
32
+ */
33
+ toDegrees(radians: number): number;
34
+ formatFloat(value: number, n?: number): number;
35
+ };
36
+ export default _default;
package/package.json CHANGED
@@ -1,38 +1,36 @@
1
1
  {
2
2
  "name": "gis-common",
3
- "description": "gis-common",
4
- "main": "dist/resource.min.js",
5
- "version": "3.1.2",
3
+ "version": "3.1.4",
6
4
  "author": "Guo.Yan <luv02@vip.qq.com>",
7
5
  "license": "MIT",
8
6
  "private": false,
9
- "scripts": {
10
- "dev": "cross-env NODE_ENV=development webpack-dev-server --hot --port 7000",
11
- "build": "cross-env NODE_ENV=production webpack --progress"
12
- },
7
+ "module": "./dist/gis-common.es.js",
8
+ "main": "./dist/gis-common.umd.js",
9
+ "type": "module",
13
10
  "files": [
14
- "dist",
15
- "src"
11
+ "dist"
16
12
  ],
17
- "browserslist": [
18
- "> 1%",
19
- "last 2 versions",
20
- "not ie <= 8"
21
- ],
22
- "devDependencies": {
23
- "babel-core": "^6.26.0",
24
- "babel-loader": "^7.1.2",
25
- "babel-preset-env": "^1.6.0",
26
- "babel-preset-stage-3": "^6.24.1",
27
- "clean-webpack-plugin": "^4.0.0-alpha.0",
28
- "cross-env": "^5.0.5",
29
- "css-loader": "^0.28.7",
30
- "uglifyjs-webpack-plugin": "^2.2.0",
31
- "webpack": "^4.23.1",
32
- "webpack-cli": "^4.9.1",
33
- "webpack-dev-server": "^2.9.1"
13
+ "types": "dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/gis-common.es.js",
17
+ "require": "./dist/gis-common.umd.js",
18
+ "types": "./dist/index.d.ts"
19
+ },
20
+ "./style.css": "./dist/style.css"
34
21
  },
35
- "dependencies": {
36
- "mqtt": "^4.3.7"
22
+ "scripts": {
23
+ "dev": "vite",
24
+ "lib": "vite build --mode lib",
25
+ "serve": "vite preview"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": ""
30
+ },
31
+ "devDependencies": {
32
+ "typescript": "^5.5.4",
33
+ "vite": "^2.6.4",
34
+ "vite-plugin-dts": "^4.0.1"
37
35
  }
38
36
  }
@@ -1 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Gis",[],e):"object"==typeof exports?exports.Gis=e():t.Gis=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"AnimateUtils",(function(){return r})),n.d(e,"ArrayUtils",(function(){return h})),n.d(e,"BrowserUtils",(function(){return f})),n.d(e,"Cookie",(function(){return d})),n.d(e,"CoordsUtils",(function(){return p})),n.d(e,"DateUtils",(function(){return g})),n.d(e,"DomUtils",(function(){return m})),n.d(e,"GeoUtils",(function(){return w})),n.d(e,"FileUtils",(function(){return R})),n.d(e,"MathUtils",(function(){return M})),n.d(e,"OptimizeUtils",(function(){return b})),n.d(e,"StringUtils",(function(){return O})),n.d(e,"AssertUtils",(function(){return S})),n.d(e,"Utils",(function(){return u})),n.d(e,"EventType",(function(){return a})),n.d(e,"ErrorType",(function(){return i})),n.d(e,"LayerType",(function(){return o})),n.d(e,"GraphicType",(function(){return s})),n.d(e,"MeasureMode",(function(){return c})),n.d(e,"AudioPlayer",(function(){return D})),n.d(e,"CanvasDrawer",(function(){return x})),n.d(e,"EventDispatcher",(function(){return T})),n.d(e,"HashMap",(function(){return C})),n.d(e,"WebSocketClient",(function(){return N})),n.d(e,"WebStorage",(function(){return j})),n.d(e,"DevicePixelRatio",(function(){return G}));var r={animate:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"swing",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5;for(var i in e)e[i]={target:"opacity"===i?parseInt(100*e[i]):e[i],iNow:"opacity"===i?parseInt(100*getComputedStyle(t)[i]):parseInt(getComputedStyle(t)[i])};"liner"===r&&(a=e[i].iNow<e[i].target?Math.abs(a):-Math.abs(a)),clearInterval(t.timer),t.timer=setInterval((function(){for(var i in e){var o=e[i].target,s=e[i].iNow;if("swing"===r&&(a=(a=(o-s)/20)>0?Math.ceil(a):Math.floor(a)),Math.abs(o-s)<=Math.abs(a)){for(var c in t.style[i]="opacity"===i?o/100:o+"px",delete e[i],e)return!1;clearInterval(t.timer),"function"==typeof n&&n()}else e[i].iNow+=a,t.style[i]="opacity"===i?e[i].iNow/100:e[i].iNow+"px"}}),30)}},a={MAP_RENDER:"mapRender",MAP_READY:"mapReady",MOUSE_CLICK:"click",MOUSE_DOUBLE_CLICK:"dblclick",MOUSE_MOVE:"mousemove",MOUSE_IN:"mousein",MOUSE_OUT:"mouseout",MOUSE_RIGHT_CLICK:"mouseRightClick",KEY_DOWN:"keyDown",KEY_UP:"keyUp",DRAW_ACTIVE:"drawActive",DRAW_MOVE:"drawMove",DRAW_COMPLETE:"drawComplete",MQTT_CONNECT:"mqttConnect",MQTT_ERROR:"mqttError",MQTT_MESSAGE:"mqttMessage",MQTT_CLOSE:"mqttClose",WEB_SOCKET_CONNECT:"webSocketConnect",WEB_SOCKET_ERROR:"webSocketError",WEB_SOCKET_MESSAGE:"webSocketMessage",WEB_SOCKET_CLOSE:"webSocketClose"},i={LOGIN_EXPIRED:"登录信息过期,请重新登录",CROSS_ERROR:"跨域访问",UNEXIST_RESOURCE:"资源不存在",TIMEOUT:"请求超时",INTERNAL_ERROR:"内部错误",NETWORK_ERROR:"请求失败,请检查网络是否已连接",PROCESS_FAIL:"处理失败",AUTH_VERIFY_ERROR:"权限验证失败",NO_DATA_FOUND:"未找到数据",DUPLICATE_INSTANCE:"实例为单例模式,不允许重复构建",COORDINATE_ERROR:"坐标验证失败",JSON_PARSE_ERROR:"JSON解析失败,格式有误",JSON_VALUE_ERROR:"JSON无此键",PARAMETER_ERROR:"验证数据类型失败",PARAMETER_ERROR_ARRAY:"格式类型验证失败:必须是数组",PARAMETER_ERROR_STRING:"格式类型验证失败:必须是字符",PARAMETER_ERROR_FUNCTION:"格式类型验证失败:必须是函数",PARAMETER_ERROR_OBJECT:"格式类型验证失败:必须是对象",PARAMETER_ERROR_LACK:"参数缺失",STRING_CHECK_LOSS:"字符缺少关键字"},o={SUPER_MAP_IMAGES:"SuperMapImages",SUPER_MAP_DATA:"SuperMapData",ARC_GIS_MAP_IMAGES:"ArcGisMapImages",ARC_GIS_MAP_DATA:"ArcGisMapData",OSGB_LAYER:"OSGBLayer",S3M_GROUP:"S3MGroup",TERRAIN_LAYER:"TerrainFileLayer"},s={POINT:"point",POLYLINE:"polyline",POLYGON:"polygon",BILLBOARD:"billboard",CYLINDER:"cylinder",ELLIPSOID:"ellipsoid",LABEL:"label",MODEL:"model",WALL:"wall"},c={DISTANCE:"distance",AREA:"area",HEIGHT:"height"},u={getDataType:function(t){return Object.prototype.toString.call(t).slice(8,-1)},isEmpty:function(t){if(null==t)return!0;switch(this.getDataType(t)){case"String":return""===t.trim();case"Array":return!t.length;case"Object":return!Object.keys(t).length;case"Boolean":return!t;default:return!1}},isNotEmpty:function(t){return!this.isEmpty(t)},json2form:function(t){var e=new FormData;return Object.keys(t).forEach((function(n){e.append(n,t[n]instanceof Object?JSON.stringify(t[n]):t[n])})),e},json2Query:function(t){var e=[];for(var n in t){var r=n,a=t[n];e.push(r+"="+a)}return e.join("&")},generateGuid:function(){var t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+t()+t()+t()+t()+t()+t()},decodeDict:function(){for(var t="",e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];if(n.length>1){for(var a=n.slice(1,n.length%2==0?n.length-1:n.length),i=0;i<a.length;i+=2){var o=a[i];n[0]===o&&(t=a[i+1])}t||n.length%2!=0||(t=n[n.length-1])}else t=n[0];return t},extend:function(t){for(var e=void 0,n=void 0,r=void 0,a=void 0,i=arguments.length,o=Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];for(n=0,r=o.length;n<r;n++)for(e in a=o[n])t[e]=a[e];return t},rgb2hex:function(t){return"#"+((1<<24)+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1)},convertToTree2:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"id",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"parentId",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"children",a=[];function i(a){var o=a[e],s=t.filter((function(t){return t.hasOwnProperty(n)&&t[n]===o}));s.length>0&&(s.forEach(i),a[r]=s)}var o=function(r){-1===t.findIndex((function(t){return t[e]===r[n]}))&&(i(r),a.push(r))},s=!0,c=!1,u=void 0;try{for(var l,h=t[Symbol.iterator]();!(s=(l=h.next()).done);s=!0){var f=l.value;o(f)}}catch(t){c=!0,u=t}finally{try{!s&&h.return&&h.return()}finally{if(c)throw u}}return a},asyncLoadScript:function(t){return new Promise((function(e,n){try{var r=document.createElement("script");r.readyState?r.onreadystatechange=function(){"complete"!==r.readyState&&"loaded"!==r.readyState||e(r)}:r.onload=function(){e(r)},r.type="text/javascript",r.src=t,document.body.appendChild(r)}catch(t){n(t)}}))},loadStyle:function(t){t.forEach((function(t){var e=document.createElement("link");e.href=t,e.rel="stylesheet",e.type="text/css",document.head.appendChild(e)}))},template:function(t,e){return t.replace(/\{ *([\w_-]+) *\}/g,(function(t,n){var r=e[n];if(void 0===r)throw new Error(i.JSON_VALUE_ERROR+t);return"function"==typeof r&&(r=r(e)),r}))},deleteEmptyProperty:function(t){var e=this;return Object.fromEntries(Object.keys(t).filter((function(n){return!e.isEmpty(t[n])})).map((function(e){return[e,t[e]]})))},deepAssign:function(){var t=arguments.length,e=arguments[0];"Object"!==this.getDataType(e)&&(e={});for(var n=1;n<t;n++){var r=arguments[n];if("Object"===this.getDataType(r))for(var a in r)"__proto__"!==a&&e!==r[a]&&("Object"===this.getDataType(r[a])?e[a]=this.deepAssign(e[a],r[a]):e[a]=r[a])}return e},handleCopyValue:function(t){if(!navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(t);var e=document.createElement("textarea");return e.style.position="fixed",e.style.top=e.style.left="-100vh",e.style.opacity="0",e.value=t,document.body.appendChild(e),e.focus(),e.select(),new Promise((function(t,n){document.execCommand("copy")?t():n(new Error("copy failed")),e.remove()}))}};function l(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}Array.prototype.groupBy=function(t){var e={};return this.forEach((function(n){var r=JSON.stringify(t(n));e[r]=e[r]||[],e[r].push(n)})),Object.keys(e).map((function(t){return e[t]}))},Array.prototype.distinct=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},e=[],n={};return this.forEach((function(r){var a=t(r);!n[a]&&(n[a]=e.push(r))})),e},Array.prototype.max=function(){return Math.max.apply({},this)},Array.prototype.min=function(){return Math.min.apply({},this)},Array.prototype.sum=function(){return this.length>0?this.reduce((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t+e})):0},Array.prototype.avg=function(){return this.length?this.sum()/this.length:0},Array.prototype.desc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t};return this.sort((function(e,n){return t(n)-t(e)}))},Array.prototype.asc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t};return this.sort((function(e,n){return t(e)-t(n)}))},Array.prototype.clear=function(){return this.length=0,this};var h={asArray:function(t){return u.isEmpty(t)?[]:Array.isArray(t)?t:[t]},generateArray:function(t){return[].concat(l(new Array(t).keys()))},union:function(){for(var t=[],e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.forEach((function(e){Array.isArray(e)&&(t=t.concat(e.filter((function(e){return!t.includes(e)}))))})),t},intersection:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0]||[];return e.forEach((function(t){Array.isArray(t)&&(r=r.filter((function(e){return t.includes(e)})))})),r},unionAll:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return[].concat(l(e)).flat().filter((function(t){return!!t}))},difference:function(){for(var t=this,e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.union.apply(this,l(n)).filter((function(e){return!t.intersection.apply(t,l(n)).includes(e)}))}},f={getUrlParams:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=/([^&=]+)=([\w\W]*?)(&|$|#)/g,r=new URL(t),a=r.search,i=r.hash,o=[a,i],s={},c=0;c<o.length;c++){var u=o[c];if(u){var l=u.replace(/#|\//g,""),h=l.split("?");if(h.length>1)for(var f=1;f<h.length;f++)for(var d=void 0;d=n.exec(h[f]);)s[d[1]]=e?decodeURIComponent(d[2]):d[2]}}return s},getExplorer:function(){var t=window.navigator.userAgent;return t.indexOf("MSIE")>=0||window.ActiveXObject||"ActiveXObject"in window?"IE":t.indexOf("Firefox")>=0?"Firefox":t.indexOf("Chrome")>=0?"Chrome":t.indexOf("Opera")>=0?"Opera":t.indexOf("Safari")>=0?"Safari":void 0},detectOS:function(){var t="",e=-1!=navigator.userAgent.indexOf("Windows",0)?1:0,n=-1!=navigator.userAgent.indexOf("mac",0)?1:0,r=-1!=navigator.userAgent.indexOf("Linux",0)?1:0,a=-1!=navigator.userAgent.indexOf("X11",0)?1:0;return e?t="MS Windows":n?t="Apple mac":r?t="Linux":a&&(t="Unix"),t},switchFullScreen:function(t){if(t){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}else document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},refreshScale:function(){var t=document.documentElement.clientWidth,e=document.documentElement.clientHeight,n=document.getElementById("app").style,r=t/1920;t/e>16/9&&(r=e/1080),n.transformOrigin="left top",n.transform="scale("+r+") translateX(-49.99%)",n.width=t/r+"px"},getHtmlFontSize:function(){var t=document.documentElement.clientWidth||document.body.clientWidth;document.querySelector("html").style.fontSize=t/192+"px"}},d={set:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3),document.cookie=t+"="+escape(e)+";expires="+r.toGMTString()},remove:function(t){var e=new Date;e.setTime(e.getTime()-1);var n=this.get(t);null!=n&&(document.cookie=t+"="+n+";expires="+e.toGMTString())},get:function(t){var e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]*)(;|$)"));return null!=e?e[2]:""}},p={PI:3.141592653589793,XPI:52.35987755982988,delta:function(t,e){var n=6378245,r=.006693421622965943,a=this.transformLat(e-105,t-35),i=this.transformLon(e-105,t-35),o=t/180*this.PI,s=Math.sin(o);s=1-r*s*s;var c=Math.sqrt(s);return{lat:a=180*a/(n*(1-r)/(s*c)*this.PI),lng:i=180*i/(n/c*Math.cos(o)*this.PI)}},gcjEncrypt:function(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};var n=this.delta(t,e);return{lat:t+n.lat,lng:e+n.lng}},gcjDecrypt:function(t,e){if(this.outOfChina(t,e))return{lat:t,lng:e};var n=this.delta(t,e);return{lat:t-n.lat,lng:e-n.lng}},gcjDecryptExact:function(t,e){for(var n=.01,r=.01,a=t-n,i=e-r,o=t+n,s=e+r,c=void 0,u=void 0,l=0;;){c=(a+o)/2,u=(i+s)/2;var h=this.gcj_encrypt(c,u);if(n=h.lat-t,r=h.lng-e,Math.abs(n)<1e-9&&Math.abs(r)<1e-9)break;if(n>0?o=c:a=c,r>0?s=u:i=u,++l>1e4)break}return{lat:c,lng:u}},bdEncrypt:function(t,e){var n=e,r=t,a=Math.sqrt(n*n+r*r)+2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)+3e-6*Math.cos(n*this.XPI),o=a*Math.cos(i)+.0065;return{lat:a*Math.sin(i)+.006,lng:o}},bdDecrypt:function(t,e){var n=e-.0065,r=t-.006,a=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.XPI),i=Math.atan2(r,n)-3e-6*Math.cos(n*this.XPI),o=a*Math.cos(i);return{lat:a*Math.sin(i),lng:o}},mercatorEncrypt:function(t,e){var n=20037508.34*e/180,r=Math.log(Math.tan((90+t)*this.PI/360))/(this.PI/180);return{lat:r=20037508.34*r/180,lng:n}},mercatorDecrypt:function(t,e){var n=e/20037508.34*180,r=t/20037508.34*180;return{lat:r=180/this.PI*(2*Math.atan(Math.exp(r*this.PI/180))-this.PI/2),lng:n}},distance:function(t,e,n,r){var a=Math.cos(t*this.PI/180)*Math.cos(n*this.PI/180)*Math.cos((e-r)*this.PI/180)+Math.sin(t*this.PI/180)*Math.sin(n*this.PI/180);a>1&&(a=1),a<-1&&(a=-1);var i=6371e3*Math.acos(a);return i},outOfChina:function(t,e){return e<72.004||e>137.8347||(t<.8293||t>55.8271)},transformLat:function(t,e){var n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},transformLon:function(t,e){var n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},randomCoordinate:function(t,e,n,r){return{lat:Math.random()*(r-e)+e,lng:Math.random()*(n-t)+t}}};Date.prototype.format=function(t){var e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var n in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),e)new RegExp("("+n+")").test(t)&&(t=t.replace(RegExp.$1,1===RegExp.$1.length?e[n]:("00"+e[n]).substr((""+e[n]).length)));return t},Date.prototype.addDate=function(t,e){var n=new Date(this);switch(t){case"y":n.setFullYear(this.getFullYear()+e);break;case"q":n.setMonth(this.getMonth()+3*e);break;case"M":n.setMonth(this.getMonth()+e);break;case"w":n.setDate(this.getDate()+7*e);break;case"d":n.setDate(this.getDate()+e);break;case"h":n.setHours(this.getHours()+e);break;case"m":n.setMinutes(this.getMinutes()+e);break;case"s":n.setSeconds(this.getSeconds()+e);break;default:n.setDate(this.getDate()+e)}return n};var g={lastMonthDate:new Date((new Date).getFullYear(),(new Date).getMonth()-1,1),thisMonthDate:new Date((new Date).getFullYear(),(new Date).getMonth(),1),nextMonthDate:new Date((new Date).getFullYear(),(new Date).getMonth()+1,1),lastWeekDate:new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-7-(new Date).getDay()),thisWeekDate:new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1-(new Date).getDay()),nextWeekDate:new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1+7-(new Date).getDay()),lastDayDate:new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()-1),thisDayDate:new Date((new Date).setHours(0,0,0,0)),nextDayDate:new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate()+1),parseDate:function(t){if("string"==typeof t){var e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(e&&e.length>3)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]));if((e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/))&&e.length>6)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]));if((e=t.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/))&&e.length>7)return new Date(parseInt(e[1]),parseInt(e[2])-1,parseInt(e[3]),parseInt(e[4]),parseInt(e[5]),parseInt(e[6]),parseInt(e[7]))}return null},formatDateInterval:function(t,e){var n=new Date(t),r=new Date(e).getTime()-n.getTime(),a=Math.floor(r/864e5),i=r%864e5,o=Math.floor(i/36e5),s=i%36e5,c=Math.floor(s/6e4),u=s%6e4,l=Math.round(u/1e3),h="";return a>0&&(h+=a+"天"),o>0&&(h+=o+"时"),c>0&&(h+=c+"分"),l>0&&(h+=l+"秒"),0===a&&0===o&&0===c&&0===l&&(h="少于1秒"),h},formatterCounter:function(t){var e=function(t){return(t>10?"":"0")+(t||0)},n=t%3600,r=n%60;return e(Math.floor(t/3600))+":"+e(Math.floor(n/60))+":"+e(Math.round(r))},sleep:function(t){for(var e=Date.now();Date.now()-e<=t;);}};function v(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function y(t){return v(t).split(/\s+/)}var m={getStyle:function(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||"auto"===n)&&document.defaultView){var r=document.defaultView.getComputedStyle(t,null);n=r?r[e]:null}return"auto"===n?null:n},create:function(t,e,n){var r=document.createElement(t);return r.className=e||"",n&&n.appendChild(r),r},remove:function(t){var e=t.parentNode;e&&e.removeChild(t)},empty:function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},toFront:function(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)},toBack:function(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)},getClass:function(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal},hasClass:function(t,e){if(void 0!==t.classList)return t.classList.contains(e);var n=this.getClass(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)},addClass:function(t,e){if(void 0!==t.classList)for(var n=y(e),r=0,a=n.length;r<a;r++)t.classList.add(n[r]);else if(!this.hasClass(t,e)){var i=this.getClass(t);this.setClass(t,(i?i+" ":"")+e)}},removeClass:function(t,e){void 0!==t.classList?y(e).forEach((function(e){return t.classList.remove(e)})):this.setClass(t,v((" "+this.getClass(t)+" ").replace(" "+e+" "," ")))},setClass:function(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e},parseFromString:function(t){return(new DOMParser).parseFromString(t,"text/xml").children[0]}},M={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},degreesToRadians:function(t){return t*this.DEG2RAD},toRadians:function(t){return t*this.DEG2RAD},radiansToDegrees:function(t){return t*this.RAD2DEG},toDegrees:function(t){return t*this.RAD2DEG},formatFloat:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}},w={toRadian:Math.PI/180,R:6371393,isLnglat:function(t,e){return t&&e&&!!(+e>-90&&+e<90&&+t>-180&&+t<180)},formatLnglat:function(t,e){var n="";function r(t){var e=parseFloat(t),n=parseInt(e),r=parseInt(60*(e-n));return n+"°"+r+"′"+(3600*(e-n)-60*r).toFixed(2)+"″"}return t&&e&&(n=r(t)+","+r(e)),n},transformLnglat:function(t,e){function n(t){for(var e=/[sw]/i.test(t)?-1:1,n=t.match(/[\d.]+/g),r=0,a=0,i=n.length;a<i;a++)r+=n[a]/e,e*=60;return r}if(t&&e)return{lng:n(t),lat:n(e)}},rayCasting:function(t,e){for(var n=t.x,r=t.y,a=!1,i=0,o=e.length,s=o-1;i<o;s=i,i++){var c=e[i].x,u=e[i].y,l=e[s].x,h=e[s].y;if(c===n&&u===r||l===n&&h===r)return"on";if(u<r&&h>=r||u>=r&&h<r){var f=c+(r-u)*(l-c)/(h-u);if(f===n)return"on";f>n&&(a=!a)}}return a?"in":"out"},wgs84PointsDistance:function(t,e){var n=Math.PI;function r(t){return t*n/180}if(2!=arguments.length)return 0;lon1=t.x,lat1=t.y,lon2=e.x,lat2=e.y;var a,i=6378137,o=6356752.3142,s=1/298.257223563,c=r(lon2-lon1),u=Math.atan((1-s)*Math.tan(r(lat1))),l=Math.atan((1-s)*Math.tan(r(lat2))),h=Math.sin(u),f=Math.cos(u),d=Math.sin(l),p=Math.cos(l),g=c,v=100;do{var y=Math.sin(g),m=Math.cos(g),M=Math.sqrt(p*y*(p*y)+(f*d-h*p*m)*(f*d-h*p*m));if(0==M)return 0;var w=h*d+f*p*m,E=Math.atan2(M,w),R=f*p*y/M,b=1-R*R,O=w-2*h*d/b;isNaN(O)&&(O=0);var S=s/16*b*(4+s*(4-3*b));a=g,g=c+(1-S)*s*R*(E+S*M*(O+S*w*(2*O*O-1)))}while(Math.abs(g-a)>1e-12&&--v>0);if(0==v)return NaN;var A=b*(i*i-o*o)/(o*o),D=1+A/16384*(4096+A*(A*(320-175*A)-768)),_=A/1024*(256+A*(A*(74-47*A)-128)),x=_*M*(O+_/4*(w*(2*O*O-1)-_/6*O*(4*M*M-3)*(4*O*O-3))),I=o*D*(E-x);Math.atan2(p*y,f*d-h*p*m),Math.atan2(f*y,-h*p+f*d*m);return I},rotatePoint:function(t,e,n){return{x:(t.x-e.x)*Math.cos(Math.PI/180*-n)-(t.y-e.y)*Math.sin(Math.PI/180*-n)+e.x,y:(t.x-e.x)*Math.sin(Math.PI/180*-n)+(t.y-e.y)*Math.cos(Math.PI/180*-n)+e.y}},calcBearAndDis:function(t,e){var n=t.x,r=t.y,a=e.x-n,i=e.y-r,o=Math.sqrt(a*a+i*i);return{angle:(Math.atan2(i,a)*(180/Math.PI)+360+90)%360,distance:o}},calcBearAndDisByPoints:function(t,e){var n=parseFloat(t.lat),r=parseFloat(t.lng),a=parseFloat(e.lat),i=parseFloat(e.lng),o=Math.sin((i-r)*this.toRadian)*Math.cos(a*this.toRadian),s=Math.cos(n*this.toRadian)*Math.sin(a*this.toRadian)-Math.sin(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.cos((i-r)*this.toRadian),c=Math.atan2(o,s)*(180/Math.PI),u=(a-n)*this.toRadian,l=(i-r)*this.toRadian,h=Math.sin(u/2)*Math.sin(u/2)+Math.cos(n*this.toRadian)*Math.cos(a*this.toRadian)*Math.sin(l/2)*Math.sin(l/2),f=2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h));return{angle:c,distance:this.R*f}},calcPointByBearAndDis:function(t,e,n){var r=M.toRadians(parseFloat(t.lat)),a=M.toRadians(parseFloat(t.lng));e=parseFloat(e);var i=(n=parseFloat(n))/this.R;e=M.toRadians(e);var o=Math.asin(Math.sin(r)*Math.cos(i)+Math.cos(r)*Math.sin(i)*Math.cos(e)),s=a+Math.atan2(Math.sin(e)*Math.sin(i)*Math.cos(r),Math.cos(i)-Math.sin(r)*Math.sin(o));return{lat:M.toDegrees(o),lng:M.toDegrees(s)}},mercatorTolonlat:function(t,e){var n=e/20037508.34*180;return{lng:t/20037508.34*180,lat:180/Math.PI*(2*Math.atan(Math.exp(n*Math.PI/180))-Math.PI/2)}},lonlatToMercator:function(t,e){var n=t*Math.PI/180*6378137,r=e*Math.PI/180;return{x:n,y:3189068.5*Math.log((1+Math.sin(r))/(1-Math.sin(r)))}}},E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R={convertBase64ToBlob:function(t){for(var e=t.split(",")[0].split(":")[1].split(";")[0],n=window.atob(t.split(",")[1]),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);var o=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;return o?((o=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder)).append(r),o.getBlob(e)):o=new Blob([r],{type:e})},convertUrlToBase64:function(t,e,n){return new Promise((function(r,a){var i=new Image;i.crossOrigin="Anonymous",i.src=t,i.onload=function(){var t=document.createElement("canvas");t.width=e||i.width,t.height=n||i.height,t.getContext("2d").drawImage(i,0,0,i.width,i.height);var a=i.src.substring(i.src.lastIndexOf(".")+1).toLowerCase(),o=t.toDataURL("image/"+a);r({dataURL:o,type:"image/"+a,ext:a})}}))},convertBase64ToFile:function(t,e){for(var n=t.split(","),r=n[0].match(/:(.*?);/)[1],a=atob(n[1]),i=a.length,o=new Uint8Array(i);i--;)o[i]=a.charCodeAt(i);return new File([o],e,{type:r})},downloadFromFile:function(t,e){if("object"==(void 0===t?"undefined":E(t)))if(t instanceof Blob)t=URL.createObjectURL(t);else{var n=JSON.stringify(t),r=new Blob([n],{type:"text/json"});t=window.URL.createObjectURL(r)}else if("string"==typeof t&&-1===t.indexOf("http")){var a=new Blob([t],{type:"text/json"});t=window.URL.createObjectURL(a)}var i=document.createElement("a");i.href=t,i.download=e||"",i.click(),window.URL.revokeObjectURL(i.href)}},b={debounce:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=void 0,a=void 0,i=void 0,o=void 0,s=void 0,c=function c(){var u=+new Date-o;u<e&&u>0?r=setTimeout(c,e-u):(r=null,n||(s=t.apply(i,a),r||(i=a=null)))};return function(){for(var a=arguments.length,u=Array(a),l=0;l<a;l++)u[l]=arguments[l];i=this,o=+new Date;var h=n&&!r;return r||(r=setTimeout(c,e)),h&&(s=t.apply(i,u),i=u=null),s}},throttle:function(t,e,n){if(1===n)var r=0;else if(2===n)var a;return function(){var i=this,o=arguments;if(1===n){var s=Date.now();s-r>e&&(t.apply(i,o),r=s)}else 2===n&&(a||(a=setTimeout((function(){a=null,t.apply(i,o)}),e)))}},recurve:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,r=0;setTimeout((function a(){++r<Math.floor(n/e)&&(t.call(this),setTimeout(a,e))}))}},O={checkStr:function(t,e){switch(e){case"phone":return/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(t);case"tel":return/^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(t);case"card":return/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(t);case"pwd":return/^[a-zA-Z]\w{5,17}$/.test(t);case"postal":return/[1-9]\d{5}(?!\d)/.test(t);case"QQ":return/^[1-9][0-9]{4,9}$/.test(t);case"email":return/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(t);case"money":return/^\d*(?:\.\d{0,2})?$/.test(t);case"URL":return/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(t);case"IP":return/((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(t);case"date":return/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(t)||/^(\d{4})\-(\d{2})\-(\d{2})$/.test(t);case"number":return/^[0-9]$/.test(t);case"english":return/^[a-zA-Z]+$/.test(t);case"chinese":return/^[\u4E00-\u9FA5]+$/.test(t);case"lower":return/^[a-z]+$/.test(t);case"upper":return/^[A-Z]+$/.test(t);case"HTML":return/<("[^"]*"|'[^']*'|[^'">])*>/.test(t);default:return!0}},changeCase:function(t,e){switch(e=e||4){case 1:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toUpperCase()+t.substring(1).toLowerCase()}));case 2:return t.replace(/\b\w+\b/g,(function(t){return t.substring(0,1).toLowerCase()+t.substring(1).toUpperCase()}));case 3:return t.split("").map((function(t){return/[a-z]/.test(t)?t.toUpperCase():t.toLowerCase()})).join("");case 4:return t.toUpperCase();case 5:return t.toLowerCase();default:return t}},tag:function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n=n.map((function(t){switch(u.getDataType(t)){case"Object":return t||"{}";case"Array":return t||"[]";default:return t||""}})),t.reduce((function(t,e,r){return""+t+n[r-1]+e}))},getByteLength:function(t){return t.replace(/[\u0391-\uFFE5]/g,"aa").length},subStringByte:function(t,e,n){var r=/[^\x00-\xff]/g;if(t.replace(r,"mm").length<=n)return t;for(var a=Math.floor(n/2);a<t.length;a++){var i=t.substring(e,a);if(i.replace(r,"mm").length>=n)return i}return t},asString:function(t){if(u.isEmpty(t))return"";switch(u.getDataType()){case"Object":case"Array":return JSON.stringify(t);default:return t}}},S={notNull:function(t){if(u.isEmpty(t))throw Error("不能为空:>>>"+t)},legalLnglat:function(t,e){if(!w.isLnglat(t,e))throw Error(i.COORDINATE_ERROR)},contain:function(t){for(var e=!1,n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];for(var o=r.length||0,s=0,c=o;s<c;s++)e=t.indexOf(r[s])>=0;if(e)throw Error(i.STRING_CHECK_LOSS)},verify:{array:function(t){if("Array"!==u.getDataType(t))throw Error(i.PARAMETER_ERROR_ARRAY+":>>>"+t)},function:function(t){if("Function"!==u.getDataType(t))throw Error(i.PARAMETER_ERROR_FUNCTION+":>>>"+t)},object:function(t){if("Object"!==u.getDataType(t))throw Error(i.PARAMETER_ERROR_OBJECT+":>>>"+t)}},legalJSON:function(t){try{JSON.parse(t)}catch(e){throw Error(i.JSON_PARSE_ERROR+":>>>"+t)}},legalData:function(t,e){var n=O.checkStr(t,e),r="";switch(e){case"phone":r="电话";break;case"tel":r="座机";break;case"card":r="身份证";break;case"pwd":r="密码";break;case"postal":r="邮政编码";break;case"QQ":r="QQ";break;case"email":r="邮箱";break;case"money":r="金额";break;case"URL":r="网址";break;case"IP":r="IP";break;case"date":r="日期时间";break;case"number":r="数字";break;case"english":r="英文";break;case"chinese":r="中文";break;case"lower":r="小写";break;case"upper":r="大写";break;case"HTML":r="HTML标记"}if(!n)throw Error(i.PARAMETER_ERROR+":>>>不是"+r)}},A=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var D=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.audio=new Audio,this.audio.src=e}return A(t,[{key:"play",value:function(){!this.muted&&this.audio.play()}},{key:"pause",value:function(){this.audio.pause()}},{key:"muted",get:function(){return this.audio.muted},set:function(t){this.audio.muted=t}}]),t}(),_=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var x=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),"String"===u.getDataType(e)&&(e=document.querySelector("#"+e)),this.ctx=e.getContext("2d")}return _(t,[{key:"drawLine",value:function(t,e,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};this.cxt.beginPath();var i=a.width||1,o=a.color||"#000";this.cxt.lineWidth=i,this.cxt.fillStyle=o,this.cxt.moveTo(t,e),this.cxt.lineTo(n,r),this.cxt.closePath(),this.cxt.fill()}},{key:"drawArc",value:function(t,e,n,r,a,i,o,s){o?(this.cxt.fillStyle=s,this.cxt.beginPath(),this.cxt.arc(t,e,n,M.degreesToRadians(r),M.degreesToRadians(a),i),this.cxt.closePath(),this.cxt.fill()):(this.cxt.strokeStyle=s,this.cxt.beginPath(),this.cxt.arc(t,e,n,M.degreesToRadians(r),M.degreesToRadians(a),i),this.cxt.stroke())}}]),t}();function I(){}Object.assign(I.prototype,{addEventListener:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];void 0===this._listeners&&(this._listeners={}),this._mutex=this._mutex||{},this._context=n;var a=this._mutex,i=this._listeners;return void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&(r&&(a[t]=e),i[t].push(e)),this},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(this._mutex[t]===e&&(this._mutex[t]=null),void 0!==n){var r=n.map((function(t){return t.toString()})).indexOf(e.toString());-1!==r&&n.splice(r,1)}}},dispatchEvent:function(t){var e=this;if(void 0!==this._listeners){var n=this._listeners[t.type];if(void 0!==n){t.target=this;var r=n.slice(0);if(this._mutex[t.type])return void r.find((function(n){return n===e._mutex[t.type]})).call(this._context||this,t);for(var a=0,i=r.length;a<i;a++)r[a].call(this._context||this,t)}}},removeAllListener:function(){for(var t in this._mutex={},this._listeners)this._listeners[t]=[]}});var T=I;function C(){return new Map}Object.assign(Map.prototype,{isEmpty:function(){return 0===this.size},_values:function(){return Array.from(Map.prototype.values.call(this))},_keys:function(){return Array.from(Map.prototype.keys.call(this))},_entries:function(){return Array.from(Map.prototype.entries.call(this))}}),C.fromEntries=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=new C;return t.forEach((function(t){Array.isArray(t)&&2===t.length&&e.set(t[0],t[1])})),e};var P=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function k(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var N=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ws://127.0.0.1:10088";k(this,e);var n=L(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.maxCheckTimes=10,n.url=t,n.checkTimes=0,n.connectStatus=!1,n.connect(),n.connCheckStatus(n.maxCheckTimes),e.instance=n,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),P(e,[{key:"connect",value:function(){if(this.disconnect(),this.url)try{if(console.info("创建ws连接>>>"+this.url),this.client=new WebSocket(this.url),this.client){var t=this;this.client.onopen=function(e){t.dispatchEvent({type:a.WEB_SOCKET_CONNECT,message:e})},this.client.onmessage=function(e){t.connectStatus=!0,t.dispatchEvent({type:a.WEB_SOCKET_MESSAGE,message:e})},this.client.onclose=function(e){t.dispatchEvent({type:a.WEB_SOCKET_CLOSE,message:e})},this.checkTimes===this.maxCheckTimes&&(this.client.onerror=function(e){t.dispatchEvent({type:a.WEB_SOCKET_ERROR,message:e})})}}catch(t){console.error("创建ws连接失败"+this.url+":"+t)}}},{key:"disconnect",value:function(){if(this.client)try{console.log("ws断开连接"+this.url),this.client.close(),this.client=null}catch(t){this.client=null}}},{key:"connCheckStatus",value:function(t){var e=this;this.checkTimes>t||setTimeout((function(){e.checkTimes++,e.client&&0!==e.client.readyState&&1!==e.client.readyState&&e.connect(),e.connCheckStatus(t)}),2e3)}},{key:"send",value:function(t){return this.client&&1===this.client.readyState?(this.client.send(t),!0):(console.error(this.url+"消息发送失败:"+t),!1)}},{key:"heartbeat",value:function(){var t=this;setTimeout((function(){t.client&&1===t.client.readyState&&t.send("HeartBeat"),console.log("HeartBeat,"+t.url),setTimeout(t.heartbeat,3e4)}),1e3)}}],[{key:"getInstance",value:function(){return e.instance?e.instance:Object.freeze(new e)}},{key:"_instance",get:function(){return this.getInstance()}}]),e}(T),F=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function U(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var j=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(U(this,t),this.cacheType=e,1===e)this.storage=window.localStorage;else{if(2!==e)throw new Error(i.PARAMETER_ERROR);this.storage=window.sessionStorage}}return F(t,[{key:"setItem",value:function(t,e,n){var r={key:t,value:e};if(1===this.cacheType){var a=Date.now();n&&(r.expired=a+1e3*n)}return this.storage[t]=JSON.stringify(r),r}},{key:"getItem",value:function(t){var e=this.storage.getItem(t)||null,n=JSON.parse(e)||{};if(1===this.cacheType){var r=n.expired||Date.now();if(Date.now()>r)return this.remove(t),null}return n.value}},{key:"remove",value:function(t){var e=this;t&&(t.indexOf(",")>-1?t.split(",").forEach((function(t){e.storage.removeItem(t)})):this.storage.removeItem(t))}},{key:"clear",value:function(){this.storage.clear()}}]),t}(),B=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function W(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var G=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;W(this,t),this.magnification=e}return B(t,[{key:"_getSystem",value:function(){if(navigator.userAgent.toLowerCase().indexOf("windows")>=0)return!0}},{key:"_addHandler",value:function(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n}},{key:"_correct",value:function(){var t=window.innerWidth;if("number"!=typeof t&&(t="CSS1Compat"==document.compatMode?document.documentElement.clientWidth:document.body.clientWidth),t<=750){var e=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=75*this.magnification*Math.min(e,2)+"px"}else if(t>750&&t<=1200){var n=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=85*this.magnification*Math.min(n,2)+"px"}else{var r=document.documentElement.clientWidth/1920;document.documentElement.style.fontSize=100*this.magnification*Math.min(r,2)+"px"}}},{key:"_watch",value:function(){var t=this;t._addHandler(window,"resize",(function(){t._correct()}))}},{key:"init",value:function(){var t=this;t._getSystem()&&(t._correct(),t._watch())}}]),t}()}])}));
Binary file
@@ -1,22 +0,0 @@
1
- export default {
2
- LOGIN_EXPIRED: '登录信息过期,请重新登录',
3
- CROSS_ERROR: '跨域访问',
4
- UNEXIST_RESOURCE: '资源不存在',
5
- TIMEOUT: '请求超时',
6
- INTERNAL_ERROR: '内部错误',
7
- NETWORK_ERROR: '请求失败,请检查网络是否已连接',
8
- PROCESS_FAIL: '处理失败',
9
- AUTH_VERIFY_ERROR: '权限验证失败',
10
- NO_DATA_FOUND: '未找到数据',
11
- DUPLICATE_INSTANCE: '实例为单例模式,不允许重复构建',
12
- COORDINATE_ERROR: '坐标验证失败',
13
- JSON_PARSE_ERROR: 'JSON解析失败,格式有误',
14
- JSON_VALUE_ERROR: 'JSON无此键',
15
- PARAMETER_ERROR: '验证数据类型失败',
16
- PARAMETER_ERROR_ARRAY: '格式类型验证失败:必须是数组',
17
- PARAMETER_ERROR_STRING: '格式类型验证失败:必须是字符',
18
- PARAMETER_ERROR_FUNCTION: '格式类型验证失败:必须是函数',
19
- PARAMETER_ERROR_OBJECT: '格式类型验证失败:必须是对象',
20
- PARAMETER_ERROR_LACK: '参数缺失',
21
- STRING_CHECK_LOSS: '字符缺少关键字',
22
- }
@@ -1,23 +0,0 @@
1
- export default {
2
- MAP_RENDER: "mapRender",
3
- MAP_READY: "mapReady",
4
- MOUSE_CLICK: "click",
5
- MOUSE_DOUBLE_CLICK: "dblclick",
6
- MOUSE_MOVE: "mousemove",
7
- MOUSE_IN: "mousein",
8
- MOUSE_OUT: "mouseout",
9
- MOUSE_RIGHT_CLICK: "mouseRightClick",
10
- KEY_DOWN: "keyDown",
11
- KEY_UP: "keyUp",
12
- DRAW_ACTIVE: "drawActive",
13
- DRAW_MOVE: "drawMove",
14
- DRAW_COMPLETE: "drawComplete",
15
- MQTT_CONNECT: "mqttConnect",
16
- MQTT_ERROR: "mqttError",
17
- MQTT_MESSAGE: "mqttMessage",
18
- MQTT_CLOSE: "mqttClose",
19
- WEB_SOCKET_CONNECT: "webSocketConnect",
20
- WEB_SOCKET_ERROR: "webSocketError",
21
- WEB_SOCKET_MESSAGE: "webSocketMessage",
22
- WEB_SOCKET_CLOSE: "webSocketClose"
23
- };
@@ -1,16 +0,0 @@
1
- export const GraphicType = {
2
- POINT: 'point',
3
- POLYLINE: 'polyline',
4
- POLYGON: 'polygon',
5
- BILLBOARD: 'billboard',
6
- CYLINDER: 'cylinder',
7
- ELLIPSOID: 'ellipsoid',
8
- LABEL: 'label',
9
- MODEL: 'model',
10
- WALL: 'wall',
11
- }
12
- export const MeasureMode = {
13
- DISTANCE: 'distance',
14
- AREA: 'area',
15
- HEIGHT: 'height',
16
- }
@@ -1,9 +0,0 @@
1
- export default {
2
- SUPER_MAP_IMAGES: "SuperMapImages", // 超图影像服务 栅格数据
3
- SUPER_MAP_DATA: "SuperMapData", // 超图服务 矢量数据
4
- ARC_GIS_MAP_IMAGES: "ArcGisMapImages", // arcGis影像图层 栅格数据
5
- ARC_GIS_MAP_DATA: "ArcGisMapData", // arcGis图层 矢量数据
6
- OSGB_LAYER: "OSGBLayer",
7
- S3M_GROUP: "S3MGroup", // addS3MGroupLayer(url, options, index) 添加S3M分组图层。
8
- TERRAIN_LAYER: "TerrainFileLayer" // 地形图层, 需要单独处理
9
- };
@@ -1,4 +0,0 @@
1
- export { default as EventType } from './EventTypeConstant'
2
- export { default as ErrorType } from './ErrorTypeConstant'
3
- export { default as LayerType } from './LayerType'
4
- export * from './GraphicConstant'
@@ -1,30 +0,0 @@
1
- /**
2
- * @description 声音播放类
3
- * @export
4
- * @class AudioPlayer
5
- */
6
- export default class AudioPlayer {
7
- /**
8
- * Creates an instance of AudioPlayer.
9
- * @param {*} url
10
- */
11
- constructor(url) {
12
- this.audio = new Audio()
13
- this.audio.src = url
14
- }
15
- play() {
16
- !this.muted && this.audio.play()
17
- }
18
- pause() {
19
- this.audio.pause()
20
- }
21
- get muted() {
22
- return this.audio.muted
23
- }
24
- /**
25
- * @description 设置静音状态,如果静音,autoplay属性将失效
26
- */
27
- set muted(val) {
28
- this.audio.muted = val
29
- }
30
- }
@@ -1,51 +0,0 @@
1
- import CommUtils from '../utils/CommUtils'
2
- import MathUtils from '../utils/MathUtils';
3
- export default class CanvasDrawer {
4
- constructor(el) {
5
- if (CommUtils.getDataType(el) === 'String') {
6
- el = document.querySelector('#' + el)
7
- }
8
- this.ctx = el.getContext('2d')
9
- }
10
- drawLine(startX, startY, endX, endY, options = {}) {
11
- this.cxt.beginPath();
12
- const width = options.width || 1
13
- const color = options.color || '#000'
14
- this.cxt.lineWidth = width;
15
- this.cxt.fillStyle = color;// 经过测试不管是fillStyle还是StrokeStyle都是一样的
16
- this.cxt.moveTo(startX, startY);
17
- this.cxt.lineTo(endX, endY);
18
- this.cxt.closePath();
19
- this.cxt.fill();
20
- }
21
- /**
22
- * 绘制圆弧
23
- * @param {*} x 圆心X坐标
24
- * @param {*} y 圆心Y坐标
25
- * @param {*} radius 半径
26
- * @param {*} startAngle 开始的弧度
27
- * @param {*} endAngle 结束的弧度
28
- * @param {*} anticlockwise true为逆时针,false为顺时针
29
- * @param {boolean} isOnlyArc
30
- * @param {boolean} isFill 是否是填充,false为绘制边框,true为绘制填充
31
- * @param {*} bgColor 圆弧的颜色
32
- * @memberof CanvasDrawer
33
- */
34
- drawArc(x, y, radius, startAngle, endAngle, anticlockwise, isFill, bgColor) {
35
- if (isFill) {
36
- //为true绘制填充圆弧
37
- this.cxt.fillStyle = bgColor
38
- this.cxt.beginPath()
39
- this.cxt.arc(x, y, radius, MathUtils.degreesToRadians(startAngle), MathUtils.degreesToRadians(endAngle), anticlockwise)
40
- this.cxt.closePath()
41
- this.cxt.fill()
42
- } else {
43
- //为false绘制边框圆弧
44
- this.cxt.strokeStyle = bgColor
45
- this.cxt.beginPath()
46
- this.cxt.arc(x, y, radius, MathUtils.degreesToRadians(startAngle), MathUtils.degreesToRadians(endAngle), anticlockwise)
47
-
48
- this.cxt.stroke()
49
- }
50
- }
51
- }
@@ -1,86 +0,0 @@
1
- export default class DevicePixelRatio {
2
- constructor(magnification = 1) {
3
- this.magnification = magnification
4
- }
5
- // 获取系统类型
6
- _getSystem() {
7
- // let flag = false;
8
- var agent = navigator.userAgent.toLowerCase()
9
- // var isMac = /macintosh|mac os x/i.test(navigator.userAgent);
10
- // if(isMac) {
11
- // return false;
12
- // }
13
- // 现只针对windows处理,其它系统暂无该情况,如有,继续在此添加
14
- if (agent.indexOf('windows') >= 0) {
15
- return true
16
- }
17
- }
18
- // 获取页面缩放比例
19
- // _getDevicePixelRatio() {
20
- // let t = this;
21
- // }
22
- // 监听方法兼容写法
23
- _addHandler(element, type, handler) {
24
- if (element.addEventListener) {
25
- element.addEventListener(type, handler, false)
26
- } else if (element.attachEvent) {
27
- element.attachEvent('on' + type, handler)
28
- } else {
29
- element['on' + type] = handler
30
- }
31
- }
32
- // 校正浏览器缩放比例
33
- _correct() {
34
- // 配合px2rem插件进行自适应布局
35
- let pageWidth = window.innerWidth
36
- //为了ie也能拿到可视窗口宽度
37
- if (typeof pageWidth != 'number') {
38
- //标准模式
39
- if (document.compatMode == 'CSS1Compat') {
40
- pageWidth = document.documentElement.clientWidth
41
- //怪异模式
42
- } else {
43
- pageWidth = document.body.clientWidth
44
- }
45
- }
46
- if (pageWidth <= 750) {
47
- const baseSize = 75
48
- // 当前页面宽度相对于 750 宽的缩放比例,可根据自己需要修改。
49
- const scale = document.documentElement.clientWidth / pageWidth
50
- // 设置页面根节点字体大小
51
- document.documentElement.style.fontSize = this.magnification * baseSize * Math.min(scale, 2) + 'px'
52
- } else if (pageWidth > 750 && pageWidth <= 1200) {
53
- const baseSize = 85
54
- // 当前页面宽度相对于 750 宽的缩放比例,可根据自己需要修改。
55
- const scale = document.documentElement.clientWidth / pageWidth
56
- // 设置页面根节点字体大小
57
- document.documentElement.style.fontSize = this.magnification * baseSize * Math.min(scale, 2) + 'px'
58
- } else {
59
- const baseSize = 100
60
- // 当前页面宽度相对于 750 宽的缩放比例,可根据自己需要修改。
61
- const scale = document.documentElement.clientWidth / 1920
62
- // 设置页面根节点字体大小
63
- document.documentElement.style.fontSize = this.magnification * baseSize * Math.min(scale, 2) + 'px'
64
- }
65
- }
66
- // 监听页面缩放
67
- _watch() {
68
- let t = this
69
- t._addHandler(window, 'resize', function () {
70
- // 注意这个方法是解决全局有两个window.resize
71
- // 重新校正
72
- t._correct()
73
- })
74
- }
75
- // 初始化页面比例
76
- init() {
77
- let t = this
78
- if (t._getSystem()) {
79
- // 判断设备,目前只在windows系统下校正浏览器缩放比例
80
- // 初始化页面校正浏览器缩放比例
81
- t._correct()
82
- // 开启监听页面缩放
83
- t._watch()
84
- }
85
- }
86
- }