vis-core 0.25.0 → 0.25.1

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.
package/dist/index.d.ts CHANGED
@@ -8,4 +8,4 @@ export * from './getVisConfig';
8
8
  export declare const access: {
9
9
  token: string;
10
10
  };
11
- export declare const VERSION = "0.25.0";
11
+ export declare const VERSION = "0.25.1";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(){"use strict";try{if(typeof document!="undefined"){var t=document.createElement("style");t.appendChild(document.createTextNode(".-translate-x-1\\/2,.-translate-y-1\\/2{--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1 }.shadow{--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000 }.ring{--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000 }.invert,.filter{--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: }.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.left-1\\/2{left:50%}.top-1\\/2{top:50%}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.whitespace-nowrap{white-space:nowrap}.text-center{text-align:center}.text-sm{font-size:14px;line-height:20px}.text-xs{font-size:12px;line-height:16px}.leading-\\[1\\]{line-height:1}.text-\\[\\#809083\\]{--tw-text-opacity: 1;color:rgb(128 144 131 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-opacity-80{--tw-text-opacity: .8 }.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
- "use strict";var v1=Object.defineProperty,T1=Object.defineProperties;var M1=Object.getOwnPropertyDescriptors;var R1=Object.getOwnPropertySymbols,N1=Object.getPrototypeOf,F1=Object.prototype.hasOwnProperty,H1=Object.prototype.propertyIsEnumerable,w1=Reflect.get;var c1=(m,r)=>(r=Symbol[m])?r:Symbol.for("Symbol."+m),k1=m=>{throw TypeError(m)},qi=Math.pow,f1=(m,r,d)=>r in m?v1(m,r,{enumerable:!0,configurable:!0,writable:!0,value:d}):m[r]=d,D0=(m,r)=>{for(var d in r||(r={}))F1.call(r,d)&&f1(m,d,r[d]);if(R1)for(var d of R1(r))H1.call(r,d)&&f1(m,d,r[d]);return m},Ni=(m,r)=>T1(m,M1(r));var C0=(m,r,d)=>f1(m,typeof r!="symbol"?r+"":r,d);var Di=(m,r,d)=>w1(N1(m),d,r);var E0=(m,r,d)=>new Promise((h,S)=>{var v=be=>{try{O(d.next(be))}catch(Pe){S(Pe)}},w=be=>{try{O(d.throw(be))}catch(Pe){S(Pe)}},O=be=>be.done?h(be.value):Promise.resolve(be.value).then(v,w);O((d=d.apply(m,r)).next())}),J1=function(m,r){this[0]=m,this[1]=r};var S1=m=>{var r=m[c1("asyncIterator")],d=!1,h,S={};return r==null?(r=m[c1("iterator")](),h=v=>S[v]=w=>r[v](w)):(r=r.call(m),h=v=>S[v]=w=>{if(d){if(d=!1,v==="throw")throw w;return w}return d=!0,{done:!1,value:new J1(new Promise(O=>{var be=r[v](w);be instanceof Object||k1("Object expected"),O(be)}),1)}}),S[c1("iterator")]=()=>S,h("next"),"throw"in r?h("throw"):S.throw=v=>{throw v},"return"in r&&h("return"),S},L1=(m,r,d)=>(r=m[c1("asyncIterator")])?r.call(m):(m=m[c1("iterator")](),r={},d=(h,S)=>(S=m[h])&&(r[h]=v=>new Promise((w,O,be)=>(v=S.call(m,v),be=v.done,Promise.resolve(v.value).then(Pe=>w({value:Pe,done:be}),O)))),d("next"),d("return"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsrsasign=require("jsrsasign"),CryptoJS=require("crypto-js"),esusLite=require("esus-lite"),events=require("events"),lodashEs=require("lodash-es"),turf=require("@turf/turf"),world$1=require("geojson-cn/extra/countries-next.json"),json100000Lite=require("geojson-cn/extra/100000-lite-next.json"),json100000=require("geojson-cn/extra/100000-next.json"),continentsCountriesIsoOrigin=require("geojson-cn/extra/continents-countries-iso.json"),continents=require("geojson-cn/extra/continents.json"),geojsonCn=require("geojson-cn");Array.prototype.at||(Array.prototype.at=function(m){return m<0&&(m=this.length+m),this[m]});const publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[m,r,d]=this.token.split(":::"),h=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),S=CryptoJS.enc.Base64.parse(r),v=CryptoJS.enc.Base64.parse(d),w=CryptoJS.lib.WordArray.create(S.words.slice(0,4)),O=CryptoJS.lib.WordArray.create(S.words.slice(4)),be=jsrsasign.KJUR.crypto.Util.hashHex(S.toString(),"sha256"),Pe=h.verifyWithMessageHashPSS(be,jsrsasign.b64tohex(m),"sha256",32);if(!Pe)return this.token=void 0,"";const _e=CryptoJS.AES.decrypt({ciphertext:O},v,{iv:w,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),at=JSON.parse(_e),bt=Date.now();return!at.s||at.s>bt?(this.token=void 0,""):at.e&&at.e<bt?(this.token=void 0,""):(at.isValid=Pe,at)}},version="0.25.0";/**
2
+ "use strict";var v1=Object.defineProperty,T1=Object.defineProperties;var M1=Object.getOwnPropertyDescriptors;var R1=Object.getOwnPropertySymbols,N1=Object.getPrototypeOf,F1=Object.prototype.hasOwnProperty,H1=Object.prototype.propertyIsEnumerable,w1=Reflect.get;var c1=(m,r)=>(r=Symbol[m])?r:Symbol.for("Symbol."+m),k1=m=>{throw TypeError(m)},qi=Math.pow,f1=(m,r,d)=>r in m?v1(m,r,{enumerable:!0,configurable:!0,writable:!0,value:d}):m[r]=d,D0=(m,r)=>{for(var d in r||(r={}))F1.call(r,d)&&f1(m,d,r[d]);if(R1)for(var d of R1(r))H1.call(r,d)&&f1(m,d,r[d]);return m},Ni=(m,r)=>T1(m,M1(r));var C0=(m,r,d)=>f1(m,typeof r!="symbol"?r+"":r,d);var Di=(m,r,d)=>w1(N1(m),d,r);var E0=(m,r,d)=>new Promise((h,S)=>{var v=be=>{try{O(d.next(be))}catch(Pe){S(Pe)}},w=be=>{try{O(d.throw(be))}catch(Pe){S(Pe)}},O=be=>be.done?h(be.value):Promise.resolve(be.value).then(v,w);O((d=d.apply(m,r)).next())}),J1=function(m,r){this[0]=m,this[1]=r};var S1=m=>{var r=m[c1("asyncIterator")],d=!1,h,S={};return r==null?(r=m[c1("iterator")](),h=v=>S[v]=w=>r[v](w)):(r=r.call(m),h=v=>S[v]=w=>{if(d){if(d=!1,v==="throw")throw w;return w}return d=!0,{done:!1,value:new J1(new Promise(O=>{var be=r[v](w);be instanceof Object||k1("Object expected"),O(be)}),1)}}),S[c1("iterator")]=()=>S,h("next"),"throw"in r?h("throw"):S.throw=v=>{throw v},"return"in r&&h("return"),S},L1=(m,r,d)=>(r=m[c1("asyncIterator")])?r.call(m):(m=m[c1("iterator")](),r={},d=(h,S)=>(S=m[h])&&(r[h]=v=>new Promise((w,O,be)=>(v=S.call(m,v),be=v.done,Promise.resolve(v.value).then(Pe=>w({value:Pe,done:be}),O)))),d("next"),d("return"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsrsasign=require("jsrsasign"),CryptoJS=require("crypto-js"),esusLite=require("esus-lite"),events=require("events"),lodashEs=require("lodash-es"),turf=require("@turf/turf"),world$1=require("geojson-cn/extra/countries-next.json"),json100000Lite=require("geojson-cn/extra/100000-lite-next.json"),json100000=require("geojson-cn/extra/100000-next.json"),continentsCountriesIsoOrigin=require("geojson-cn/extra/continents-countries-iso.json"),continents=require("geojson-cn/extra/continents.json"),geojsonCn=require("geojson-cn");Array.prototype.at||(Array.prototype.at=function(m){return m<0&&(m=this.length+m),this[m]});const publicKeyPEM="LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEyTG1aVVQzVG9LZEVRRUdrdUU1QQo3dnlYTzRMM1Z6NDA5RFF2a2xzRHZ2SytNM2M2OGl4ZEVhZDZFcnZGS2FKQ1QrNTZNdU1XSXhUTnlDZDVQSkFGCjVYdzI4cW1iVkVCR3FGdXVIZTltSm5GUmRXN1NpK1Z1cTZvRWxwQkRkeEFIQ0dsWVVpU1R3WmhBbjJaVXJLSUYKd1J2c1k1bi9uWWNhZnl5QW9tRjhmNVRsTkpwS1JtbDU3WlRSWjBMdzdQRDFSeHFIbmJ0YWFETkpiSDV5eFd6cQpaVTBwQWhxMFNkNHdlOW1DUTJWWXc5czhtUERLbW4rU083eGovSUsrR1ZEaEJNOUpaZ3VIcGFZUGt3bWd5UkdwCkx6V0tHMkZULzJRalZUT1dRT09mRFVtVitDSVlsN1hVVlh1Q0toYWFNQ0ZVa1JQOHg4aEZucmNFeklHQ1JpM3IKK3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0t",accessToken={token:void 0,getInfo(){if(!this.token)return"";const[m,r,d]=this.token.split(":::"),h=jsrsasign.KEYUTIL.getKey(atob(publicKeyPEM)),S=CryptoJS.enc.Base64.parse(r),v=CryptoJS.enc.Base64.parse(d),w=CryptoJS.lib.WordArray.create(S.words.slice(0,4)),O=CryptoJS.lib.WordArray.create(S.words.slice(4)),be=jsrsasign.KJUR.crypto.Util.hashHex(S.toString(),"sha256"),Pe=h.verifyWithMessageHashPSS(be,jsrsasign.b64tohex(m),"sha256",32);if(!Pe)return this.token=void 0,"";const _e=CryptoJS.AES.decrypt({ciphertext:O},v,{iv:w,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8),at=JSON.parse(_e),bt=Date.now();return!at.s||at.s>bt?(this.token=void 0,""):at.e&&at.e<bt?(this.token=void 0,""):(at.isValid=Pe,at)}},version="0.25.1";/**
3
3
  * @license
4
4
  * Copyright 2010-2025 Three.js Authors
5
5
  * SPDX-License-Identifier: MIT
@@ -5529,7 +5529,7 @@ version 0.8.2
5529
5529
  gl_FragColor = vec4(ccccc, alpha * 0.65);
5530
5530
 
5531
5531
 
5532
- `)},O.needsUpdate=!0)}}setAreaEmissiveByProperty(d,h,S,v=1){if(!this.map)return;const w=this.map.areaArr.find(O=>O.userData[d]===h);w&&this.map.setAreaEmissive(w,S,v)}setLineColorByProperty(d,h,S){if(!this.map)return;const v=this.map.lineArr.find(w=>w.userData[d]===h);v&&this.map.setLineColor(v,S)}setLineWidthByProperty(d,h,S){if(!this.map)return;const v=this.map.lineArr.find(w=>w.userData[d]===h);v&&this.map.setLineWidth(v,S)}addAreaPlaneByProperty(v,w){return E0(this,arguments,function*(d,h,S={}){var Pe;if(!this.map)return;const be=this.map.options.geojson.features.find(Qe=>Qe.properties&&Qe.properties[d]===h);if(be){const Qe=`${h}`;let _e=!1;if(this.mList.objectList.forEach((xt,Lt)=>{if(xt.key==="planeCopyExtrudePolygon"+Qe){console.warn("已经存在复制面",Qe),_e=!0;return}}),_e)return;let at;S.material?f$1(S.material)?at=new MeshBasicMaterial(D0({},S.material)):at=S.material:at=new MeshBasicMaterial({color:"red"});let bt;S.lineMaterial?f$1(S.lineMaterial)?bt=new it$2(D0({},S.lineMaterial)):bt=S.lineMaterial:bt=new it$2({color:new Color$1("blue"),sizeAttenuation:0,lineWidth:this.options.lineWidth});const yt=yield this.map.addPlane(be,{material:at,lineMaterial:bt,topSegments:(Pe=S.topSegments)!=null?Pe:0});return yt.children.forEach(xt=>{xt instanceof je?(xt.object3d.name="复制面"+Qe,this.mList.setObject3d(xt.object3d,"planeCopyExtrudePolygon"+Qe,{baseObject:xt})):xt instanceof Ge&&(xt.object3d.name="复制线"+Qe,this.mList.setObject3d(xt.object3d,"planeCopyLine"+Qe,{baseObject:xt}),this.initBaseObjectUserData(xt))}),yt}})}showAction(){return E0(this,null,function*(){Di(n1.prototype,this,"showAction").call(this),this.useSaveCamera(`map-${this.options.adcode}`);const d=this.drawController.group;if(this.mapHistory[0]){const{stop:h,start:S}=sinusoidalInOut({onUpdate:v=>{if(!this.mapHistory[0]){h();return}d.position.z=-this.mapHistory[0].depth*(1-v)}});yield S()}this.handlePickTest()})}handlePickTest(){return E0(this,null,function*(){var d;this.playing||(d=this.mapArea)==null||d.forEach(h=>{h.onPointerEvent("down",S=>E0(this,null,function*(){var be,Pe,Qe;(Pe=(be=this.pencil)==null?void 0:be.helperController)==null||Pe.removeAllExcludeScene(),(Qe=this.pencil.helperController)==null||Qe.add(S.object3d),this.caId=S.userData.ISO_A2||S.userData.adcode;const v=this.mapLine.find(_e=>_e.userData.ISO_A2===this.caId||_e.userData.adcode===this.caId),O=S.object3d.material[0].color.getHexString();this.settings["测试板块颜色.color:::caId"]="#"+O,yield this.settings["测试板块颜色.color:::caId"],this.settings["测试边框颜色.color:::caId"]="#"+(v==null?void 0:v.material.color.getHexString()),yield this.settings["测试边框颜色.color:::caId"],this.settings["测试边框宽度:::caId"]=v==null?void 0:v.material.lineWidth,yield this.settings["测试边框宽度:::caId"],this.emit("settingsChanged")}))})})}hide(){return E0(this,null,function*(){if(!this.showState)return;const d=this.drawController.group;yield sinusoidalInOut({onUpdate:h=>{d.position.z=-this.mapHistory[0].depth*h}}).start(),setTimeout(()=>{Di(n1.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return E0(this,null,function*(){if(this.pencil.scene.userData.shadowMapEnabled)return;this.pencil.scene.userData.shadowMapEnabled=!0;const d=yield this.drawController.draw("Light",{type:"SpotLight",color:"#c1e6dd",intensity:1,distance:0,angle:.5,penumbra:1,decay:0}),h=d.object3d;this.mList.changeObject3dKey(h,"Shadow$1"),this.mList.changeObject3dKey(h.target,"Shadow$1"),this.shadowMapLight=d,d.object3d.position.set(.281,32.487,43.077),d.object3d.castShadow=!0;const S=yield this.drawController.draw("PlaneShadow");this.mList.setObject3d(S.object3d,"PlaneShadow",{baseObject:S}),this.planeShadow=S})}shadowMapDisabled(){this.pencil.scene.userData.shadowMapEnabled&&(this.pencil.scene.userData.shadowMapEnabled=!1,this.shadowMapLight&&(this.shadowMapLight.erase(),this.mList.delObject3d(this.shadowMapLight.object3d),this.shadowMapLight=void 0),this.planeShadow&&(this.mList.delObject3d(this.planeShadow.object3d),this.planeShadow.erase(),this.planeShadow=void 0))}getOptionsDepth(d){const h=this.getAdcodeShowLevel(d);let S=this.options.mapDepth;Array.isArray(S)||(S=new Array(3).fill(S));let v;return h==="country"?v=S[0]:h==="province"?v=S[1]:v=S[2],v}getDepth(d,h){let S=this.getOptionsDepth(d);if(this.options.depthReference&&this.options.bboxMap[d]){const v=this.options.depthReference,w=this.options.bboxMap[d];S=S*this.getReferenceScale(v,w)}else if(this.mapHistory.length&&this.options.bboxMap[this.mapHistory[0].mapInfo.adcode]){const v=this.options.bboxMap[this.mapHistory[0].mapInfo.adcode],w=this.getReferenceScale(v,h);S=S*w}return S}getReferenceScale(d,h){const S=Math.abs(h[3]-h[1])/Math.abs(d[3]-d[1]),v=Math.abs(h[2]-h[0])/Math.abs(d[2]-d[0]);return Math.max(S,v)}getAdcodeShowLevel(d,h=!0){var S;if((S=this.options.fixCity)!=null&&S[d]&&(d=this.options.fixCity[d]),d===0)return"world";if(d===1e5)return"country";if(/^\d{6}$/.test(`${d}`)){const{level:v,parent:w}=geojsonCn.adcodeMap[d],O=w&&geojsonCn.adcodeMap[w].level;return v==="district"&&O==="province"&&h?"city":v}else if(continentsType.find(v=>v.adcode===d))return"continent"}handleClick(d){const{drillDownRestrictions:h}=this.options;this.isAnimating||(d&&d.userData.adcode?this.getAdcodeShowLevel(d.userData.adcode,!1)!==h?this.showMap({adcode:d.userData.adcode}):this.emit("drilldownRestrictions",d.userData.adcode):!d&&this.mapHistory.length>1&&this.showMap({adcode:this.adcodes.at(-2)}))}beforeShowMap(d){return!0}getAdcodes(d){const h=[];let S=d;for(;S;)h.unshift(S),S=geojsonCn.adcodeMap[S].parent;return h}showMap(v){return E0(this,arguments,function*({adcode:d,adcodes:h,duration:S=1e3}){const w=h||this.getAdcodes(d);(yield this.beforeShowMap(w))!==!1&&(this.emit("beforeDrillDown",[...w]),yield this.setAdcode({adcodes:w,duration:S}),this.emit("afterDrillDown",[...w]))})}drawLabels(){return E0(this,null,function*(){var S;const d=this.options.showLabel;!((S=this.mapArea)!=null&&S.length)||!d||this.drawController.getAllObject("Node",{key:"mapLabel"}).length||(yield Promise.all(this.mapArea.map(v=>E0(this,null,function*(){let{name:w,adcode:O,centroid:be}=v.userData;const{DistrictID:Pe,DistName:Qe,NAME_CN:_e,CENTROID:at,center:bt}=v.userData;if(O=O||Pe,be=this.options.adcode===0?at:be||bt,w=this.options.adcode===0?_e:w||Qe,!be)return;const yt=this.getLocationPosition(be);if(this.drawController.getObject("Node",{key:`mapLabel-${O}`})||!yt)return;const[xt,Lt,ct]=yt;let St=w;d==="lite"&&St&&(St=w.replace("自治州","").replace("地区","").replace("自治区","").replace("省","").replace("市","").replace("壮族","").replace("特别行政区","").replace("回族","").replace("维吾尔",""));const It=St&&getLabelElement(St),vt=St!=null&&St.startsWith("澳门")?-1:0;yield this.drawController.draw("Node",{position:new Vector3(xt,Lt+vt,ct),children:It,key:`mapLabel#${this.options.adcode===0?w:O}`})}))))})}eraseLabels(){const d=this.drawController.getAllObject("Node",{key:"mapLabel"});this.drawController.erase(...d)}geAdcodePosition(d){var S;const h=(S=this.mapArea)==null?void 0:S.find(v=>v.userData.adcode===d);if(h){const{centroid:v,center:w}=h.userData;return this.getLocationPosition(v||w)}}getLocationPosition(d){const[h,S]=d,[v,w]=this.projection([h,S]);return[v,-w,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}getAdcodeScreenPosition(d){const h=this.geAdcodePosition(d);if(h){const[S,v,w]=h,O=new Vector3(S,v,w);O.project(this.pencil.camera);const{width:be,height:Pe}=this.pencil.getSize(),Qe=(O.x*.5+.5)*be,_e=(O.y*-.5+.5)*Pe;return{x:Qe,y:_e}}}booleanPointInCn(d){return chinaLiteJson.features[0].geometry.coordinates.some(h=>turf.booleanPointInPolygon(turf.point(d),turf.polygon(h)))}handleDrillDown(w){return E0(this,arguments,function*({adcode:d,duration:h,saveBackCamvasState:S,extrudelineBloom:v}){var O,be,Pe,Qe,_e,at,bt,yt;if(typeof d!="undefined"&&!this.isAnimating){const xt=(O=this.map)==null?void 0:O.findGroup(d,!0),Lt=findLevelJsonItem2(+d);if(this.isAnimating||!Lt)return;this.isAnimating=!0;const{name:ct}=Lt;let{res:St}=(be=this.options.geojsonMap)!=null&&be[d]?{res:(Pe=this.options.geojsonMap)==null?void 0:Pe[d]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json/${d}.json`),{res:It}=this.options.extrudeLine?(Qe=this.options.extrudeLineGeojsonMap)!=null&&Qe[d]?{res:(_e=this.options.extrudeLineGeojsonMap)==null?void 0:_e[d]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json-lite/${d}.json`):{res:void 0};if(!this.options.showDistrict&&this.getAdcodeShowLevel(d)==="city"&&(St=It,It=void 0),[St,It].filter(Boolean).forEach(Tt=>{if(!Tt.features[0].properties.adcode&&/^\d{6}$/.test(`${d}`)){const Mt=geojsonCn.adcodeMap[d];Tt.features[0].properties=Ni(D0(D0({},Tt.features[0].properties),Mt),{center:[Mt.lng,Mt.lat]})}}),St){const Tt=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if(Tt&&this.fixNear(d),(at=this.options.fixGeojson)!=null&&at[d]){const _t=(bt=this.options.fixGeojson)==null?void 0:bt[d];if(_t.startsWith("-")){const a0=+_t.slice(1);St.features=St.features.filter(G0=>G0.properties.adcode!==a0)}}let Mt=this.options.bboxMap[d]||turf.bbox(It||St);this.options.bboxMap[d]=Mt,this.mapHistory.length===1&&!this.options.drillDownSecondLevelMats?Mt=this.options.bboxMap[this.mapInfo.adcode]:this.mapHistory.length===2&&!this.options.drillDownThirdLevelMats&&(this.options.drillDownSecondLevelMats?Mt=this.options.bboxMap[this.mapInfo.adcode]:Mt=this.options.bboxMap[this.mapHistory[0].mapInfo.adcode]),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(_t=>{_t.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),(S!=null?S:this.options.handleBackKeepCamvasState)&&this.saveBackCamvasState(-1));const Ht=this.mapHistory.length,wt=Ht-1,Pt=this.getDepth(d,Mt),Et=(yt=this.mapHistory[wt])==null?void 0:yt.depth,At=Ht===0?0:this.mapHistory[wt].z+(this.options.showOneLevel?0:Et),i0=Ht===0?0:At-Pt,s0=turf.center(St).geometry.coordinates,[o0,n0]=this.projection(s0),Dt=yield this.drawPlaneMap({geojson:St,extrudeLineGeojson:It,depth:Pt,bbox:Mt,adcode:d,extrudelineBloom:v});Dt.position.setZ(i0),this.mapHistory.push({map:Dt,mapInfo:Lt,z:At,depth:Pt,cX:o0,cY:-n0});const t0=Dt.position.z;Tt&&(Dt.position.z=At,this.fitTo(Dt,{enableTransition:h!==0}),Dt.position.z=t0),xt==null||xt.hide(),this.map&&Ht!==0&&(h?yield sinusoidalInOut({onUpdate:_t=>{this.map.position.z=t0+(At-t0)*_t}}).start({duration:h}):this.map.position.z=At),this.drawLabels()}else console.log(`${ct}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:d,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveBackCamvasState(d){const h=this.mapHistory.at(d);h&&(h.cameraPositon=this.pencil.cameraPositon.clone(),h.cameraTarget=this.pencil.cameraTarget.clone())}fixNear(d){const h=this.getAdcodeShowLevel(d);d===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(h==="country"||h==="province")&&this.pencil.camera.near!==this.pencilConfig.camera.near*10?(this.pencil.camera.near=this.pencilConfig.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(h==="city"||h==="district")&&this.pencil.camera.near!==this.pencilConfig.camera.near&&(this.pencil.camera.near=this.pencilConfig.camera.near,this.pencil.camera.updateProjectionMatrix())}fitTo(w){return E0(this,arguments,function*(d,{polarAngle:h,azimuthAngle:S,enableTransition:v=!0}={}){var xt;if(!(d!=null&&d.object3d)||(yield this.useSaveCamera(`map-${(xt=this.mapInfo)==null?void 0:xt.adcode}`,v)))return;const be=this.options.mapPadding,{height:Pe,width:Qe}=this.pencil.getSize();Pe<be[0]+be[2]+100&&(be[0]=0,be[2]=0),Qe<be[1]+be[3]+100&&(be[1]=0,be[3]=0);const _e=h||this.options.polarAngle,at=S||this.options.azimuthAngle,bt=this.pencil.controls.azimuthAngle,yt=this.pencil.controls.polarAngle;yield Promise.all([this.paddingInCssPixel(d,be[0],be[1],be[2],be[3],v),this.pencil.controls.rotateTo(bt+this.absoluteAngle(at,bt),yt+this.absoluteAngle(_e,yt),v)])})}drawPlaneMap(be){return E0(this,arguments,function*({geojson:d,extrudeLineGeojson:h,bbox:S,depth:v,extrudelineBloom:w,adcode:O}){const Pe=[this.mList.getMaterialObj("plane"),this.mList.getMaterialObj("secondPlane"),this.mList.getMaterialObj("thirdPlane")];let Qe=this.mapHistory.length,_e;for(;!_e;)_e=Pe[Qe],Qe--;const at=this.mList.getMaterialObj("bgPlane"),bt=D0(D0({},_e),at?{bgTopMat:at.topMat,bgSideMat:at.sideMat,bgLineMat:at.lineMat,bgExtrudeLineMat:at.extrudeLineMat}:{});let yt=d,xt=h;this.options.cityOnMap&&h&&(yt=h,this.options.showCityOnMapInnerLine?xt=d:xt=void 0);const Lt=yield this.drawController.draw("PlaneMap",{geojson:yt,extrudeLineGeojson:xt,depth:v,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:bt,bbox:S,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return this.mapHistory.length===0?(this.mList.setFixMeshList("area",["plane#topMat","plane#sideMat"],{name:"板块"}),this.mList.setFixMeshList("line","plane#lineMat",{name:"板块线"}),Lt.extrudelineArr&&Lt.extrudelineArr.forEach(ct=>{ct.object3d.name="板块边线",this.mList.setObject3d(ct.object3d,"extrudeLine",{baseObject:ct,replace:!0}),this.initBaseObjectUserData(ct),w&&(ct.object3d.userData.bloom=!0)})):Lt.extrudelineArr&&w&&Lt.extrudelineArr.forEach(ct=>{this.initBaseObjectUserData(ct),ct.object3d.userData.bloom=!0}),Lt})}handleBack(){return E0(this,arguments,function*({duration:d=1e3,handleLookBack:h=!0,keepOne:S=!0}={}){if(this.isAnimating||(S?this.mapHistory.length<=1:this.mapHistory.length===0))return;this.isAnimating=!0;const v=this.mapHistory.pop();if(v!=null&&v.map){if(!this.options.drillDownPlateInCenter){const w=v.map.position.z,O=this.mapObj?this.mapObj.z+(this.mapObj.depth-v.depth):0;yield sinusoidalInOut({onUpdate:be=>{v.map.position.z=w+(O-w)*be}}).start({duration:d})}this.drawController.eraseWithoutMaterial(v.map),this.eraseLabels()}if(this.mapObj){const{map:w}=this.mapObj,O=w==null?void 0:w.findGroup(v==null?void 0:v.mapInfo.adcode,!0);O&&O.show(),w&&h&&(this.options.showOneLevel?w.show():w.active(),this.options.drillDownHideParent&&this.parentBg.forEach(be=>{be.show()}),yield this.handleLookBack(d),this.drawLabels())}this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1})}handleLookBack(d){return E0(this,null,function*(){var w;const{map:h,cameraPositon:S,cameraTarget:v}=this.mapObj;S&&v?yield(w=this.pencil.controls)==null?void 0:w.setLookAt(S.x,S.y,S.z,v.x,v.y,v.z,d!==0):yield this.fitTo(h,{enableTransition:d!==0})})}compareLocations(d,h){const S=d.filter(be=>be),v=h.filter(be=>be),w=[];let O=0;for(let be=0;be<Math.min(S.length,v.length)&&S[be]===v[be];be++)O++;for(let be=O;be<S.length;be++)w.push(-1);for(let be=O;be<v.length;be++)w.push(v[be]);return w}setAdcode(S){return E0(this,arguments,function*({adcodes:d,duration:h}){var w,O,be;const{adcodes:v}=this;if(!(JSON.stringify(d)===JSON.stringify(v)||this.isAnimating))if(JSON.stringify(d)===JSON.stringify([0]))try{yield this.handleDrillDown({adcode:0,duration:h})}catch(bt){console.error(bt)}else{const{continent:bt,country:yt,province:xt,city:Lt,district:ct}=d.reduce((Et,At)=>{const i0=this.getAdcodeShowLevel(At);return Et[i0]=At,Et},{}),{continent:St,country:It,province:vt,city:Tt,district:Mt}=v.reduce((Et,At)=>{const i0=this.getAdcodeShowLevel(At);return Et[i0]=At,Et},{}),Ht=bt||St,wt=(be=(O=(w=this.map)==null?void 0:w.extrudelineArr)==null?void 0:O[0])==null?void 0:be.object3d.userData.bloom,Pt=this.compareLocations([St,It,vt,Tt,Mt],[bt,yt,xt,Lt,ct]);try{for(var Pe=L1(Pt.entries()),Qe,_e,at;Qe=!(_e=yield Pe.next()).done;Qe=!1){const[Et,At]=_e.value;const i0=Et===Pt.length-1?h:0;At===-1?yield this.handleBack({duration:i0,handleLookBack:!!i0,keepOne:!Ht}):yield this.handleDrillDown({adcode:At,duration:i0,saveBackCamvasState:Pt.includes(-1)?!1:this.options.handleBackKeepCamvasState,extrudelineBloom:wt})}}catch(_e){at=[_e]}finally{try{Qe&&(_e=Pe.return)&&(yield _e.call(Pe))}finally{if(at)throw at[0]}}}})}setPadding(d,h=!1,S=!1){this.options.mapPadding=d,h&&this.fitTo(this.map,{enableTransition:S})}dispose(){var d,h;(d=this.map)==null||d.dispose(),this.parentBg.forEach(S=>{S.dispose()}),this.parentBg.length=0,(h=this.continentsBg)==null||h.dispose(),this.continentsBg=void 0,this.mapHistory.length=0,super.dispose()}};C0(n1,"VisName","map");let Map$2=n1;const PENCIL_CONFIG$3={camera:{near:.01,far:100,fov:45,up:new Vector3(0,0,1)}};function clipGeojson(m,r){const d=turf.flatten(m).features,h=turf.flatten(r).features,S={type:"FeatureCollection",features:[]};for(let v=d.length-1;v>=0;v--){const w=d[v];for(let O=h.length-1;O>=0;O--){const be=h[O];if(contains(w,be))S.features.push(be);else if(contains(be,w))w.properties=be.properties,S.features.push(w);else{const Pe=turf.intersect(w,be);Pe&&(Pe.properties=be.properties,S.features.push(Pe))}}}return S}function contains(m,r){let d=!0;const h=turf.explode(r).features;for(let S=h.length-1;S>=0;S--)if(!turf.inside(h[S],m)){d=!1;break}return d}const getBoxMultiPoly=m=>{const r=m.features.map(d=>d.geometry.type==="Polygon"?[d.geometry.coordinates]:d.geometry.coordinates).flat();return Array.from({length:r.length},(d,h)=>turf.polygon(r[h]))};class Building extends P$2{constructor(d){super();C0(this,"options");C0(this,"building",{});C0(this,"outJson",new Map);C0(this,"worldPositionZ",{value:0});this.options=D0({},d)}create(){return E0(this,null,function*(){const{json:d,projection:h,cacheKey:S,meters:v,grey:w,clip:O}=this.options,be=this.pencil.installPlugins.get("materialList"),Pe=this.pencil.getPlugin("worker"),Qe=this.pencil.getPlugin("draw"),_e=w?"-grey":"";this.createGroup();const at=be.getMaterialObj("building"+_e);let bt=S?yield Pe.getCachedGeometry({cacheKey:S}):[];if(bt.length)O&&this.outJson.set(1,!0);else{let yt;O&&(yt=getBoxMultiPoly(O));const xt={};(d.features||d).forEach(ct=>{const St=typeof ct.properties.h=="string"?ct.properties.h.split(".")[1]:0,It=Number(ct.properties.h)|0;xt[St]||(xt[St]={}),xt[St][It]||(xt[St][It]=[]),yt?yt.some(Tt=>{ct.geometry.coordinates[1]&&console.log(ct.geometry.coordinates[1]);const Mt=turf.polygon(ct.geometry.coordinates[0]);return turf.booleanContains(Tt,Mt)?(xt[St][It].push(ct),!0):!1})||this.outJson.set(ct,!1):xt[St][It].push(ct)});const Lt=Object.keys(xt).map(ct=>{const St=xt[ct];return Object.keys(St).map(It=>{const vt=St[It];return{z:+ct,h:+It,coordinatesArr:vt.map(Tt=>Tt.geometry.type==="Polygon"?Tt.geometry.coordinates[0]:Tt.geometry.coordinates[0][0])}})}).flat().filter(ct=>ct.coordinatesArr.length);bt=yield Promise.all(Lt.map(ct=>{const{h:St,z:It,coordinatesArr:vt}=ct,Tt=+St<=20?+St/18:+St<=60?+St/27:+St/12;return Pe.geoGeometry("extrudePolygon",{cacheKey:S,userData:{z:It,h:St},mesaage:{coordinatesArr:vt,projection:h,useGroups:2,depth:[Number(St)*(v||1)],hasBottom:!1,sideRepeat:Tt}})}))}yield Promise.all(bt.map(yt=>E0(this,null,function*(){const{h:xt,z:Lt}=yt.userData,ct=xt+Lt,St=ct<=20?"20":ct<=60?"60":"max";let It=this.options.material;It||(It=[at[St+"Top"],at[St+"Side"]]);const vt=yield Qe.draw("ExtrudePolygon",{key:"building",geometry:yt,material:It},this);this.building[xt]||(this.building[xt]=[]),this.building[xt].push(vt),vt.position.z=Number(Lt)*(v||1)}))),this.options.sideGradient&&this.sideGradient(),this.object3d.name="建筑组",w||be.setObject3d(this.object3d,`building${_e?"-grey":""}#group`)})}sideGradient(d="#052438",h=.05/100){this.traverse(S=>{if(S instanceof je){const v=S.object3d.material;v[1].onBeforeCompile=w=>{w.uniforms.gradientColor={value:new Color$1(d)},w.uniforms.maxGradientHeight={value:h},w.uniforms.worldPositionZ=this.worldPositionZ,w.vertexShader=`
5532
+ `)},O.needsUpdate=!0)}}setAreaEmissiveByProperty(d,h,S,v=1){if(!this.map)return;const w=this.map.areaArr.find(O=>O.userData[d]===h);w&&this.map.setAreaEmissive(w,S,v)}setLineColorByProperty(d,h,S){if(!this.map)return;const v=this.map.lineArr.find(w=>w.userData[d]===h);v&&this.map.setLineColor(v,S)}setLineWidthByProperty(d,h,S){if(!this.map)return;const v=this.map.lineArr.find(w=>w.userData[d]===h);v&&this.map.setLineWidth(v,S)}addAreaPlaneByProperty(v,w){return E0(this,arguments,function*(d,h,S={}){var Pe;if(!this.map)return;const be=this.map.options.geojson.features.find(Qe=>Qe.properties&&Qe.properties[d]===h);if(be){const Qe=`${h}`;let _e=!1;if(this.mList.objectList.forEach((xt,Lt)=>{if(xt.key==="planeCopyExtrudePolygon"+Qe){console.warn("已经存在复制面",Qe),_e=!0;return}}),_e)return;let at;S.material?f$1(S.material)?at=new MeshBasicMaterial(D0({},S.material)):at=S.material:at=new MeshBasicMaterial({color:"red"});let bt;S.lineMaterial?f$1(S.lineMaterial)?bt=new it$2(D0({},S.lineMaterial)):bt=S.lineMaterial:bt=new it$2({color:new Color$1("blue"),sizeAttenuation:0,lineWidth:this.options.lineWidth});const yt=yield this.map.addPlane(be,{material:at,lineMaterial:bt,topSegments:(Pe=S.topSegments)!=null?Pe:0});return yt.children.forEach(xt=>{xt instanceof je?(xt.object3d.name="复制面"+Qe,this.mList.setObject3d(xt.object3d,"planeCopyExtrudePolygon"+Qe,{baseObject:xt})):xt instanceof Ge&&(xt.object3d.name="复制线"+Qe,this.mList.setObject3d(xt.object3d,"planeCopyLine"+Qe,{baseObject:xt}),this.initBaseObjectUserData(xt),S.lineBloom&&(xt.object3d.userData.bloom=!0))}),yt}})}showAction(){return E0(this,null,function*(){Di(n1.prototype,this,"showAction").call(this),this.useSaveCamera(`map-${this.options.adcode}`);const d=this.drawController.group;if(this.mapHistory[0]){const{stop:h,start:S}=sinusoidalInOut({onUpdate:v=>{if(!this.mapHistory[0]){h();return}d.position.z=-this.mapHistory[0].depth*(1-v)}});yield S()}this.handlePickTest()})}handlePickTest(){return E0(this,null,function*(){var d;this.playing||(d=this.mapArea)==null||d.forEach(h=>{h.onPointerEvent("down",S=>E0(this,null,function*(){var be,Pe,Qe;(Pe=(be=this.pencil)==null?void 0:be.helperController)==null||Pe.removeAllExcludeScene(),(Qe=this.pencil.helperController)==null||Qe.add(S.object3d),this.caId=S.userData.ISO_A2||S.userData.adcode;const v=this.mapLine.find(_e=>_e.userData.ISO_A2===this.caId||_e.userData.adcode===this.caId),O=S.object3d.material[0].color.getHexString();this.settings["测试板块颜色.color:::caId"]="#"+O,yield this.settings["测试板块颜色.color:::caId"],this.settings["测试边框颜色.color:::caId"]="#"+(v==null?void 0:v.material.color.getHexString()),yield this.settings["测试边框颜色.color:::caId"],this.settings["测试边框宽度:::caId"]=v==null?void 0:v.material.lineWidth,yield this.settings["测试边框宽度:::caId"],this.emit("settingsChanged")}))})})}hide(){return E0(this,null,function*(){if(!this.showState)return;const d=this.drawController.group;yield sinusoidalInOut({onUpdate:h=>{d.position.z=-this.mapHistory[0].depth*h}}).start(),setTimeout(()=>{Di(n1.prototype,this,"hide").call(this)})})}shadowMapEnabled(){return E0(this,null,function*(){if(this.pencil.scene.userData.shadowMapEnabled)return;this.pencil.scene.userData.shadowMapEnabled=!0;const d=yield this.drawController.draw("Light",{type:"SpotLight",color:"#c1e6dd",intensity:1,distance:0,angle:.5,penumbra:1,decay:0}),h=d.object3d;this.mList.changeObject3dKey(h,"Shadow$1"),this.mList.changeObject3dKey(h.target,"Shadow$1"),this.shadowMapLight=d,d.object3d.position.set(.281,32.487,43.077),d.object3d.castShadow=!0;const S=yield this.drawController.draw("PlaneShadow");this.mList.setObject3d(S.object3d,"PlaneShadow",{baseObject:S}),this.planeShadow=S})}shadowMapDisabled(){this.pencil.scene.userData.shadowMapEnabled&&(this.pencil.scene.userData.shadowMapEnabled=!1,this.shadowMapLight&&(this.shadowMapLight.erase(),this.mList.delObject3d(this.shadowMapLight.object3d),this.shadowMapLight=void 0),this.planeShadow&&(this.mList.delObject3d(this.planeShadow.object3d),this.planeShadow.erase(),this.planeShadow=void 0))}getOptionsDepth(d){const h=this.getAdcodeShowLevel(d);let S=this.options.mapDepth;Array.isArray(S)||(S=new Array(3).fill(S));let v;return h==="country"?v=S[0]:h==="province"?v=S[1]:v=S[2],v}getDepth(d,h){let S=this.getOptionsDepth(d);if(this.options.depthReference&&this.options.bboxMap[d]){const v=this.options.depthReference,w=this.options.bboxMap[d];S=S*this.getReferenceScale(v,w)}else if(this.mapHistory.length&&this.options.bboxMap[this.mapHistory[0].mapInfo.adcode]){const v=this.options.bboxMap[this.mapHistory[0].mapInfo.adcode],w=this.getReferenceScale(v,h);S=S*w}return S}getReferenceScale(d,h){const S=Math.abs(h[3]-h[1])/Math.abs(d[3]-d[1]),v=Math.abs(h[2]-h[0])/Math.abs(d[2]-d[0]);return Math.max(S,v)}getAdcodeShowLevel(d,h=!0){var S;if((S=this.options.fixCity)!=null&&S[d]&&(d=this.options.fixCity[d]),d===0)return"world";if(d===1e5)return"country";if(/^\d{6}$/.test(`${d}`)){const{level:v,parent:w}=geojsonCn.adcodeMap[d],O=w&&geojsonCn.adcodeMap[w].level;return v==="district"&&O==="province"&&h?"city":v}else if(continentsType.find(v=>v.adcode===d))return"continent"}handleClick(d){const{drillDownRestrictions:h}=this.options;this.isAnimating||(d&&d.userData.adcode?this.getAdcodeShowLevel(d.userData.adcode,!1)!==h?this.showMap({adcode:d.userData.adcode}):this.emit("drilldownRestrictions",d.userData.adcode):!d&&this.mapHistory.length>1&&this.showMap({adcode:this.adcodes.at(-2)}))}beforeShowMap(d){return!0}getAdcodes(d){const h=[];let S=d;for(;S;)h.unshift(S),S=geojsonCn.adcodeMap[S].parent;return h}showMap(v){return E0(this,arguments,function*({adcode:d,adcodes:h,duration:S=1e3}){const w=h||this.getAdcodes(d);(yield this.beforeShowMap(w))!==!1&&(this.emit("beforeDrillDown",[...w]),yield this.setAdcode({adcodes:w,duration:S}),this.emit("afterDrillDown",[...w]))})}drawLabels(){return E0(this,null,function*(){var S;const d=this.options.showLabel;!((S=this.mapArea)!=null&&S.length)||!d||this.drawController.getAllObject("Node",{key:"mapLabel"}).length||(yield Promise.all(this.mapArea.map(v=>E0(this,null,function*(){let{name:w,adcode:O,centroid:be}=v.userData;const{DistrictID:Pe,DistName:Qe,NAME_CN:_e,CENTROID:at,center:bt}=v.userData;if(O=O||Pe,be=this.options.adcode===0?at:be||bt,w=this.options.adcode===0?_e:w||Qe,!be)return;const yt=this.getLocationPosition(be);if(this.drawController.getObject("Node",{key:`mapLabel-${O}`})||!yt)return;const[xt,Lt,ct]=yt;let St=w;d==="lite"&&St&&(St=w.replace("自治州","").replace("地区","").replace("自治区","").replace("省","").replace("市","").replace("壮族","").replace("特别行政区","").replace("回族","").replace("维吾尔",""));const It=St&&getLabelElement(St),vt=St!=null&&St.startsWith("澳门")?-1:0;yield this.drawController.draw("Node",{position:new Vector3(xt,Lt+vt,ct),children:It,key:`mapLabel#${this.options.adcode===0?w:O}`})}))))})}eraseLabels(){const d=this.drawController.getAllObject("Node",{key:"mapLabel"});this.drawController.erase(...d)}geAdcodePosition(d){var S;const h=(S=this.mapArea)==null?void 0:S.find(v=>v.userData.adcode===d);if(h){const{centroid:v,center:w}=h.userData;return this.getLocationPosition(v||w)}}getLocationPosition(d){const[h,S]=d,[v,w]=this.projection([h,S]);return[v,-w,this.mapObj?this.mapObj.z+this.mapObj.depth:0]}getAdcodeScreenPosition(d){const h=this.geAdcodePosition(d);if(h){const[S,v,w]=h,O=new Vector3(S,v,w);O.project(this.pencil.camera);const{width:be,height:Pe}=this.pencil.getSize(),Qe=(O.x*.5+.5)*be,_e=(O.y*-.5+.5)*Pe;return{x:Qe,y:_e}}}booleanPointInCn(d){return chinaLiteJson.features[0].geometry.coordinates.some(h=>turf.booleanPointInPolygon(turf.point(d),turf.polygon(h)))}handleDrillDown(w){return E0(this,arguments,function*({adcode:d,duration:h,saveBackCamvasState:S,extrudelineBloom:v}){var O,be,Pe,Qe,_e,at,bt,yt;if(typeof d!="undefined"&&!this.isAnimating){const xt=(O=this.map)==null?void 0:O.findGroup(d,!0),Lt=findLevelJsonItem2(+d);if(this.isAnimating||!Lt)return;this.isAnimating=!0;const{name:ct}=Lt;let{res:St}=(be=this.options.geojsonMap)!=null&&be[d]?{res:(Pe=this.options.geojsonMap)==null?void 0:Pe[d]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json/${d}.json`),{res:It}=this.options.extrudeLine?(Qe=this.options.extrudeLineGeojsonMap)!=null&&Qe[d]?{res:(_e=this.options.extrudeLineGeojsonMap)==null?void 0:_e[d]}:yield jsonFetch(`${this.options.assetsPrefix}/geojson/json-lite/${d}.json`):{res:void 0};if(!this.options.showDistrict&&this.getAdcodeShowLevel(d)==="city"&&(St=It,It=void 0),[St,It].filter(Boolean).forEach(Tt=>{if(!Tt.features[0].properties.adcode&&/^\d{6}$/.test(`${d}`)){const Mt=geojsonCn.adcodeMap[d];Tt.features[0].properties=Ni(D0(D0({},Tt.features[0].properties),Mt),{center:[Mt.lng,Mt.lat]})}}),St){const Tt=this.options.plateInCenter&&(this.mapHistory.length<1||this.options.drillDownPlateInCenter);if(Tt&&this.fixNear(d),(at=this.options.fixGeojson)!=null&&at[d]){const _t=(bt=this.options.fixGeojson)==null?void 0:bt[d];if(_t.startsWith("-")){const a0=+_t.slice(1);St.features=St.features.filter(G0=>G0.properties.adcode!==a0)}}let Mt=this.options.bboxMap[d]||turf.bbox(It||St);this.options.bboxMap[d]=Mt,this.mapHistory.length===1&&!this.options.drillDownSecondLevelMats?Mt=this.options.bboxMap[this.mapInfo.adcode]:this.mapHistory.length===2&&!this.options.drillDownThirdLevelMats&&(this.options.drillDownSecondLevelMats?Mt=this.options.bboxMap[this.mapInfo.adcode]:Mt=this.options.bboxMap[this.mapHistory[0].mapInfo.adcode]),this.eraseLabels(),this.map&&(this.options.drillDownHideParent&&this.parentBg.forEach(_t=>{_t.hide()}),this.options.showOneLevel?this.map.hide():this.map.deactive(),(S!=null?S:this.options.handleBackKeepCamvasState)&&this.saveBackCamvasState(-1));const Ht=this.mapHistory.length,wt=Ht-1,Pt=this.getDepth(d,Mt),Et=(yt=this.mapHistory[wt])==null?void 0:yt.depth,At=Ht===0?0:this.mapHistory[wt].z+(this.options.showOneLevel?0:Et),i0=Ht===0?0:At-Pt,s0=turf.center(St).geometry.coordinates,[o0,n0]=this.projection(s0),Dt=yield this.drawPlaneMap({geojson:St,extrudeLineGeojson:It,depth:Pt,bbox:Mt,adcode:d,extrudelineBloom:v});Dt.position.setZ(i0),this.mapHistory.push({map:Dt,mapInfo:Lt,z:At,depth:Pt,cX:o0,cY:-n0});const t0=Dt.position.z;Tt&&(Dt.position.z=At,this.fitTo(Dt,{enableTransition:h!==0}),Dt.position.z=t0),xt==null||xt.hide(),this.map&&Ht!==0&&(h?yield sinusoidalInOut({onUpdate:_t=>{this.map.position.z=t0+(At-t0)*_t}}).start({duration:h}):this.map.position.z=At),this.drawLabels()}else console.log(`${ct}的地图数据不存在`);this.event.emit("handleDrillDown",{adcode:d,z:this.mapObj.z+this.mapObj.depth})}this.isAnimating=!1})}saveBackCamvasState(d){const h=this.mapHistory.at(d);h&&(h.cameraPositon=this.pencil.cameraPositon.clone(),h.cameraTarget=this.pencil.cameraTarget.clone())}fixNear(d){const h=this.getAdcodeShowLevel(d);d===0?(this.pencil.camera.near=1,this.pencil.camera.far=1e3,this.pencil.camera.updateProjectionMatrix()):(h==="country"||h==="province")&&this.pencil.camera.near!==this.pencilConfig.camera.near*10?(this.pencil.camera.near=this.pencilConfig.camera.near*10,this.pencil.camera.updateProjectionMatrix()):(h==="city"||h==="district")&&this.pencil.camera.near!==this.pencilConfig.camera.near&&(this.pencil.camera.near=this.pencilConfig.camera.near,this.pencil.camera.updateProjectionMatrix())}fitTo(w){return E0(this,arguments,function*(d,{polarAngle:h,azimuthAngle:S,enableTransition:v=!0}={}){var xt;if(!(d!=null&&d.object3d)||(yield this.useSaveCamera(`map-${(xt=this.mapInfo)==null?void 0:xt.adcode}`,v)))return;const be=this.options.mapPadding,{height:Pe,width:Qe}=this.pencil.getSize();Pe<be[0]+be[2]+100&&(be[0]=0,be[2]=0),Qe<be[1]+be[3]+100&&(be[1]=0,be[3]=0);const _e=h||this.options.polarAngle,at=S||this.options.azimuthAngle,bt=this.pencil.controls.azimuthAngle,yt=this.pencil.controls.polarAngle;yield Promise.all([this.paddingInCssPixel(d,be[0],be[1],be[2],be[3],v),this.pencil.controls.rotateTo(bt+this.absoluteAngle(at,bt),yt+this.absoluteAngle(_e,yt),v)])})}drawPlaneMap(be){return E0(this,arguments,function*({geojson:d,extrudeLineGeojson:h,bbox:S,depth:v,extrudelineBloom:w,adcode:O}){const Pe=[this.mList.getMaterialObj("plane"),this.mList.getMaterialObj("secondPlane"),this.mList.getMaterialObj("thirdPlane")];let Qe=this.mapHistory.length,_e;for(;!_e;)_e=Pe[Qe],Qe--;const at=this.mList.getMaterialObj("bgPlane"),bt=D0(D0({},_e),at?{bgTopMat:at.topMat,bgSideMat:at.sideMat,bgLineMat:at.lineMat,bgExtrudeLineMat:at.extrudeLineMat}:{});let yt=d,xt=h;this.options.cityOnMap&&h&&(yt=h,this.options.showCityOnMapInnerLine?xt=d:xt=void 0);const Lt=yield this.drawController.draw("PlaneMap",{geojson:yt,extrudeLineGeojson:xt,depth:v,projection:{center:this.pcenter,scale:this.pscale,rotate:this.options.worldPacificCentre?[-160,0]:void 0,projectionType:this.options.projectionType},materialOptions:bt,bbox:S,topSegments:this.options.topSegments,lineOffset:this.options.lineOffset,mergeSide:this.options.mergeSide},this.group);return this.mapHistory.length===0?(this.mList.setFixMeshList("area",["plane#topMat","plane#sideMat"],{name:"板块"}),this.mList.setFixMeshList("line","plane#lineMat",{name:"板块线"}),Lt.extrudelineArr&&Lt.extrudelineArr.forEach(ct=>{ct.object3d.name="板块边线",this.mList.setObject3d(ct.object3d,"extrudeLine",{baseObject:ct,replace:!0}),this.initBaseObjectUserData(ct),w&&(ct.object3d.userData.bloom=!0)})):Lt.extrudelineArr&&w&&Lt.extrudelineArr.forEach(ct=>{this.initBaseObjectUserData(ct),ct.object3d.userData.bloom=!0}),Lt})}handleBack(){return E0(this,arguments,function*({duration:d=1e3,handleLookBack:h=!0,keepOne:S=!0}={}){if(this.isAnimating||(S?this.mapHistory.length<=1:this.mapHistory.length===0))return;this.isAnimating=!0;const v=this.mapHistory.pop();if(v!=null&&v.map){if(!this.options.drillDownPlateInCenter){const w=v.map.position.z,O=this.mapObj?this.mapObj.z+(this.mapObj.depth-v.depth):0;yield sinusoidalInOut({onUpdate:be=>{v.map.position.z=w+(O-w)*be}}).start({duration:d})}this.drawController.eraseWithoutMaterial(v.map),this.eraseLabels()}if(this.mapObj){const{map:w}=this.mapObj,O=w==null?void 0:w.findGroup(v==null?void 0:v.mapInfo.adcode,!0);O&&O.show(),w&&h&&(this.options.showOneLevel?w.show():w.active(),this.options.drillDownHideParent&&this.parentBg.forEach(be=>{be.show()}),yield this.handleLookBack(d),this.drawLabels())}this.emit("handleBack",{adcodes:this.adcodes}),this.isAnimating=!1})}handleLookBack(d){return E0(this,null,function*(){var w;const{map:h,cameraPositon:S,cameraTarget:v}=this.mapObj;S&&v?yield(w=this.pencil.controls)==null?void 0:w.setLookAt(S.x,S.y,S.z,v.x,v.y,v.z,d!==0):yield this.fitTo(h,{enableTransition:d!==0})})}compareLocations(d,h){const S=d.filter(be=>be),v=h.filter(be=>be),w=[];let O=0;for(let be=0;be<Math.min(S.length,v.length)&&S[be]===v[be];be++)O++;for(let be=O;be<S.length;be++)w.push(-1);for(let be=O;be<v.length;be++)w.push(v[be]);return w}setAdcode(S){return E0(this,arguments,function*({adcodes:d,duration:h}){var w,O,be;const{adcodes:v}=this;if(!(JSON.stringify(d)===JSON.stringify(v)||this.isAnimating))if(JSON.stringify(d)===JSON.stringify([0]))try{yield this.handleDrillDown({adcode:0,duration:h})}catch(bt){console.error(bt)}else{const{continent:bt,country:yt,province:xt,city:Lt,district:ct}=d.reduce((Et,At)=>{const i0=this.getAdcodeShowLevel(At);return Et[i0]=At,Et},{}),{continent:St,country:It,province:vt,city:Tt,district:Mt}=v.reduce((Et,At)=>{const i0=this.getAdcodeShowLevel(At);return Et[i0]=At,Et},{}),Ht=bt||St,wt=(be=(O=(w=this.map)==null?void 0:w.extrudelineArr)==null?void 0:O[0])==null?void 0:be.object3d.userData.bloom,Pt=this.compareLocations([St,It,vt,Tt,Mt],[bt,yt,xt,Lt,ct]);try{for(var Pe=L1(Pt.entries()),Qe,_e,at;Qe=!(_e=yield Pe.next()).done;Qe=!1){const[Et,At]=_e.value;const i0=Et===Pt.length-1?h:0;At===-1?yield this.handleBack({duration:i0,handleLookBack:!!i0,keepOne:!Ht}):yield this.handleDrillDown({adcode:At,duration:i0,saveBackCamvasState:Pt.includes(-1)?!1:this.options.handleBackKeepCamvasState,extrudelineBloom:wt})}}catch(_e){at=[_e]}finally{try{Qe&&(_e=Pe.return)&&(yield _e.call(Pe))}finally{if(at)throw at[0]}}}})}setPadding(d,h=!1,S=!1){this.options.mapPadding=d,h&&this.fitTo(this.map,{enableTransition:S})}dispose(){var d,h;(d=this.map)==null||d.dispose(),this.parentBg.forEach(S=>{S.dispose()}),this.parentBg.length=0,(h=this.continentsBg)==null||h.dispose(),this.continentsBg=void 0,this.mapHistory.length=0,super.dispose()}};C0(n1,"VisName","map");let Map$2=n1;const PENCIL_CONFIG$3={camera:{near:.01,far:100,fov:45,up:new Vector3(0,0,1)}};function clipGeojson(m,r){const d=turf.flatten(m).features,h=turf.flatten(r).features,S={type:"FeatureCollection",features:[]};for(let v=d.length-1;v>=0;v--){const w=d[v];for(let O=h.length-1;O>=0;O--){const be=h[O];if(contains(w,be))S.features.push(be);else if(contains(be,w))w.properties=be.properties,S.features.push(w);else{const Pe=turf.intersect(w,be);Pe&&(Pe.properties=be.properties,S.features.push(Pe))}}}return S}function contains(m,r){let d=!0;const h=turf.explode(r).features;for(let S=h.length-1;S>=0;S--)if(!turf.inside(h[S],m)){d=!1;break}return d}const getBoxMultiPoly=m=>{const r=m.features.map(d=>d.geometry.type==="Polygon"?[d.geometry.coordinates]:d.geometry.coordinates).flat();return Array.from({length:r.length},(d,h)=>turf.polygon(r[h]))};class Building extends P$2{constructor(d){super();C0(this,"options");C0(this,"building",{});C0(this,"outJson",new Map);C0(this,"worldPositionZ",{value:0});this.options=D0({},d)}create(){return E0(this,null,function*(){const{json:d,projection:h,cacheKey:S,meters:v,grey:w,clip:O}=this.options,be=this.pencil.installPlugins.get("materialList"),Pe=this.pencil.getPlugin("worker"),Qe=this.pencil.getPlugin("draw"),_e=w?"-grey":"";this.createGroup();const at=be.getMaterialObj("building"+_e);let bt=S?yield Pe.getCachedGeometry({cacheKey:S}):[];if(bt.length)O&&this.outJson.set(1,!0);else{let yt;O&&(yt=getBoxMultiPoly(O));const xt={};(d.features||d).forEach(ct=>{const St=typeof ct.properties.h=="string"?ct.properties.h.split(".")[1]:0,It=Number(ct.properties.h)|0;xt[St]||(xt[St]={}),xt[St][It]||(xt[St][It]=[]),yt?yt.some(Tt=>{ct.geometry.coordinates[1]&&console.log(ct.geometry.coordinates[1]);const Mt=turf.polygon(ct.geometry.coordinates[0]);return turf.booleanContains(Tt,Mt)?(xt[St][It].push(ct),!0):!1})||this.outJson.set(ct,!1):xt[St][It].push(ct)});const Lt=Object.keys(xt).map(ct=>{const St=xt[ct];return Object.keys(St).map(It=>{const vt=St[It];return{z:+ct,h:+It,coordinatesArr:vt.map(Tt=>Tt.geometry.type==="Polygon"?Tt.geometry.coordinates[0]:Tt.geometry.coordinates[0][0])}})}).flat().filter(ct=>ct.coordinatesArr.length);bt=yield Promise.all(Lt.map(ct=>{const{h:St,z:It,coordinatesArr:vt}=ct,Tt=+St<=20?+St/18:+St<=60?+St/27:+St/12;return Pe.geoGeometry("extrudePolygon",{cacheKey:S,userData:{z:It,h:St},mesaage:{coordinatesArr:vt,projection:h,useGroups:2,depth:[Number(St)*(v||1)],hasBottom:!1,sideRepeat:Tt}})}))}yield Promise.all(bt.map(yt=>E0(this,null,function*(){const{h:xt,z:Lt}=yt.userData,ct=xt+Lt,St=ct<=20?"20":ct<=60?"60":"max";let It=this.options.material;It||(It=[at[St+"Top"],at[St+"Side"]]);const vt=yield Qe.draw("ExtrudePolygon",{key:"building",geometry:yt,material:It},this);this.building[xt]||(this.building[xt]=[]),this.building[xt].push(vt),vt.position.z=Number(Lt)*(v||1)}))),this.options.sideGradient&&this.sideGradient(),this.object3d.name="建筑组",w||be.setObject3d(this.object3d,`building${_e?"-grey":""}#group`)})}sideGradient(d="#052438",h=.05/100){this.traverse(S=>{if(S instanceof je){const v=S.object3d.material;v[1].onBeforeCompile=w=>{w.uniforms.gradientColor={value:new Color$1(d)},w.uniforms.maxGradientHeight={value:h},w.uniforms.worldPositionZ=this.worldPositionZ,w.vertexShader=`
5533
5533
  varying vec3 vPosition;
5534
5534
  varying vec3 vWorldPosition;
5535
5535
  ${w.vertexShader}
@@ -90,7 +90,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
90
90
  ).toString(CryptoJS.enc.Utf8), at = JSON.parse(_e), bt = Date.now();
91
91
  return !at.s || at.s > bt ? (this.token = void 0, "") : at.e && at.e < bt ? (this.token = void 0, "") : (at.isValid = Pe, at);
92
92
  }
93
- }, version = "0.25.0";
93
+ }, version = "0.25.1";
94
94
  /**
95
95
  * @license
96
96
  * Copyright 2010-2025 Three.js Authors
@@ -137980,7 +137980,7 @@ const objs$4 = Ni(D0({}, objs$5), {
137980
137980
  }
137981
137981
  )) : xt instanceof Ge && (xt.object3d.name = "复制线" + Qe, this.mList.setObject3d(xt.object3d, "planeCopyLine" + Qe, {
137982
137982
  baseObject: xt
137983
- }), this.initBaseObjectUserData(xt));
137983
+ }), this.initBaseObjectUserData(xt), S.lineBloom && (xt.object3d.userData.bloom = !0));
137984
137984
  }), yt;
137985
137985
  }
137986
137986
  });
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.25.0";
1
+ declare const _default: "0.25.1";
2
2
  export default _default;
@@ -143,6 +143,7 @@ export default class extends Base {
143
143
  addAreaPlaneByProperty(key: string, value: any, options?: {
144
144
  material?: THREE.Material | Record<string, any>;
145
145
  lineMaterial?: MeshLineMaterial | Record<string, any>;
146
+ lineBloom?: boolean;
146
147
  topSegments?: number;
147
148
  }): Promise<Group | undefined>;
148
149
  caId: string | number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "scripts": {
5
5
  "start": "npm run version && PORT=5173 bundler-dev",
6
6
  "build:site": "npm run version && bundler",