@iweather-js/iweather-gl 0.0.12 → 0.0.14
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/core/layerMgr.d.ts +2 -3
- package/dist/core/layerMgr.d.ts.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +5 -5
- package/dist/layers/maplibre-gridWind/GridWindLayer.d.ts +1 -0
- package/dist/layers/maplibre-gridWind/GridWindLayer.d.ts.map +1 -1
- package/dist/layers/maplibre-gridWind/drawFs.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/core/layerMgr.d.ts
CHANGED
|
@@ -41,12 +41,11 @@ export declare abstract class ILayerMgr<DataT = any, LayerOptionsT extends IBase
|
|
|
41
41
|
static toLayerId(name: string): string;
|
|
42
42
|
toLayerId(name: string, suffix?: string): string;
|
|
43
43
|
toSourceId(name: string): string;
|
|
44
|
-
protected setLayerVisible(id: string, visible?: boolean, isToLayerId?: boolean): void;
|
|
45
|
-
isLayerVisible(id: string, isToLayerId?: boolean): boolean;
|
|
46
44
|
protected getBeforeLayerId(beforeId?: string): string | undefined;
|
|
47
|
-
protected removeLayerAndSource(id: string): void;
|
|
48
45
|
protected removeMapLayer(id: string): void;
|
|
49
46
|
protected removeMapSource(id: string): void;
|
|
47
|
+
protected setLayerVisible(layerId: string, visible?: boolean): void;
|
|
48
|
+
isLayerVisible(layerId: string): boolean;
|
|
50
49
|
protected addMapLayer<T>(layer: T, beforeId?: string): T;
|
|
51
50
|
unmount(): void;
|
|
52
51
|
timeChange(time?: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerMgr.d.ts","sourceRoot":"","sources":["../../src/core/layerMgr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,WAAW,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|
493
493
|
void main() {
|
|
494
494
|
if(checkMask()) discard;
|
|
495
|
+
if(!u_texture_exists) discard;
|
|
495
496
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
outColor = v_iconColor * outColor.a;
|
|
499
|
-
}
|
|
497
|
+
outColor = texture(u_texture, v_texcoord);
|
|
498
|
+
outColor = v_iconColor * outColor.a;
|
|
500
499
|
}`}function b3(e,t=""){return`#version 300 es
|
|
501
500
|
${e.shaderData.vertexShaderPrelude}
|
|
502
501
|
${e.shaderData.define}
|
|
@@ -569,7 +568,7 @@ void main() {
|
|
|
569
568
|
}else{
|
|
570
569
|
v_iconColor = vec4(u_iconColor.rgb / 255.0, u_iconColor.a);
|
|
571
570
|
}
|
|
572
|
-
}`}function X1(e,t,o){let p=e.getZoom(),y=o[t],i=y+(y-1)*(Math.pow(2,Math.floor(p))-1);return{rowCount:i,colCount:i}}import{uniq as d8}from"lodash-es";function K1(e,t,o,p){let y=M8(e,o,p),i=new Float32Array(t*4);try{i.set(y.flat())}catch(n){console.info("ERROR:",t,y.flat().length,n)}return{buffer:i,list:y}}function M8(e,t,o){let p=K2(e);if(p[2]>180){let i=[p[0],p[1],180,p[3]],n=[-180,p[1],p[2],p[3]],a={topLeft:[i[0],i[3]],bottomLeft:[i[0],i[1]],topRight:[i[2],i[3]],bottomRight:[i[2],i[1]]},s={topLeft:[n[0],n[3]],bottomLeft:[n[0],n[1]],topRight:[n[2],n[3]],bottomRight:[n[2],n[1]]},l=f2(a,t,o),g=f2(s,t,o),u=d8([...l,...g]);return f3(u,t,o)}else{let i=[p[0],p[3]],n=[p[0],p[1]],a=[p[2],p[3]],s=[p[2],p[1]],g=f2({topLeft:i,bottomLeft:n,topRight:a,bottomRight:s},t,o);return f3(g,t,o)}}function f3(e,t,o){return e.map((y)=>{let i=Math.floor(y/o),a=y%o/(o-1),s=i/(t-1);return[a,s]})}function f2(e,t,o){let p=q1(e.topLeft,t,o),y=q1(e.bottomLeft,t,o),i=q1(e.topRight,t,o),n=q1(e.bottomRight,t,o),a=Math.max(0,Math.min(Math.floor(p/o),Math.floor(y/o),Math.floor(i/o),Math.floor(n/o))),s=Math.min(t-1,Math.max(Math.floor(p/o),Math.floor(y/o),Math.floor(i/o),Math.floor(n/o))),l=Math.max(0,Math.min(p%o,y%o,i%o,n%o)),g=Math.min(o-1,Math.max(p%o,y%o,i%o,n%o)),u=[];for(let m=a;m<=s;m++)for(let c=l;c<=g;c++)u.push(m*o+c);return u}var P8=(e)=>{let t=e[0],o=e[1],p=(t+180)/360,y=o*Math.PI/180,i=(1-Math.log(Math.tan(y)+1/Math.cos(y))/Math.PI)/2;return[p,i]},q1=(e,t,o)=>{let[p,y]=P8(e),i=Math.round(y*(t-1)),n=Math.round(p*(o-1));return i*o+n};import*as k1 from"maplibre-gl";function Q1(e){let t=k1.MercatorCoordinate.fromLngLat({lng:e[0],lat:e[3]}),o=k1.MercatorCoordinate.fromLngLat({lng:e[0],lat:e[1]}),p=k1.MercatorCoordinate.fromLngLat({lng:e[2],lat:e[3]}),y=k1.MercatorCoordinate.fromLngLat({lng:e[2],lat:e[1]}),i=[Object.values(t).slice(0,2),Object.values(o).slice(0,2),Object.values(p).slice(0,2),Object.values(y).slice(0,2)].flat();return[t.x,t.y,y.x,y.y]}import*as x1 from"maplibre-gl";function F1(e,t){let o=e.getCenter(),p=new x1.LngLat(o.lng-1,o.lat),y=new x1.LngLat(o.lng+1,o.lat),i=e.project(p),n=e.project(y),a=x1.MercatorCoordinate.fromLngLat(p),s=x1.MercatorCoordinate.fromLngLat(y);return t/(n.x-i.x)*(s.x-a.x)/2}class F8 extends W{options={iconColor:O2,largeValueIconColor:G2,largeValue:k2,iconSize:27,gridDensity:3,iconOpacity:1,filterValue:0,gridType:"WindBarb"};iconColor=Object.values(new O(this.options.iconColor).toRgb());largeValueIconColor=Object.values(new O(this.options.largeValueIconColor).toRgb());SHADER_MAP=new Map;onMount(){this.loadWinnIconTexture()}onUnMount(){}getShader(e,t){let{shaderData:o}=t;if(e instanceof WebGLRenderingContext)throw Error("gl is not WebGL2RenderingContext");if(this.SHADER_MAP.has(o.variantName))return this.SHADER_MAP.get(o.variantName);let p=A.createProgramInfo(e,[P3(),h1],{transformFeedbackVaryings:["a_windInfoOut"]}),y=40000,i=A.createBufferInfoFromArrays(e,{a_windInfoOut:{numComponents:4,data:new Float32Array(y*4),drawType:e.DYNAMIC_DRAW},a_position:{numComponents:2,data:new Float32Array(y*2),drawType:e.DYNAMIC_DRAW}}),n=A.createTransformFeedback(e,p,i),a=this.createProgramInfo("grid-wind-draw",t,()=>b3(t,this.maskShaderData.vs),()=>F3(t,this.maskShaderData.fs)),s=A.createBufferInfoFromArrays(e,{...A.primitives.createXYQuadVertices(),windInfo:{numComponents:4,buffer:i.attribs.a_windInfoOut.buffer,divisor:1}}),l=A.createVertexArrayInfo(e,a,s);return this.SHADER_MAP.set(o.variantName,{feedbackProgramInfo:p,drawProgramInfo:a,feedback:n,drawVertexArrayInfo:l,tfBufferInfo:i,numInstances:y}),this.SHADER_MAP.get(o.variantName)}loadWinnIconTexture(e="/huishang/assets/map/icons/winds/v4/wind-icons.png"){let t=this.gl2;this.setTextureOptions(t,{u_texture:{src:e,mag:t.LINEAR,min:t.LINEAR,wrap:t.CLAMP_TO_EDGE}},()=>{this.map.triggerRepaint()})}setOptions(e){this.options={...this.options,...e},this.iconColor=Object.values(new O(this.options.iconColor).toRgb()),this.largeValueIconColor=Object.values(new O(this.options.largeValueIconColor).toRgb()),this.map.triggerRepaint()}onRender(e,t){if(!this.data||!this.nextData)return;if(!this.bounds)return;let o=this.gl2,{feedbackProgramInfo:p,drawProgramInfo:y,feedback:i,drawVertexArrayInfo:n,tfBufferInfo:a,numInstances:s}=this.getShader(o,e);o.bindBuffer(o.ARRAY_BUFFER,null),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,null),o.enable(o.RASTERIZER_DISCARD),o.useProgram(p.program),o.bindTransformFeedback(o.TRANSFORM_FEEDBACK,i),o.beginTransformFeedback(o.POINTS),A.setUniformsAndBindTextures(p,{...this.textures,u_image1_value_range:[this.data.minWindu,this.data.maxWindu,this.data.minWindv,this.data.maxWindv],u_image2_value_range:[this.nextData.minWindu,this.nextData.maxWindu,this.nextData.minWindv,this.nextData.maxWindv],u_bounds:Q1(this.bounds),u_filter_winds:this.options.filterValue,t:this.t});let l=F1(this.map,this.options.iconSize),g=X1(this.map,this.options.gridDensity,{1:18,2:22,3:28}),u=K1(this.map,s,g.rowCount,g.colCount);A.setAttribInfoBufferFromArray(o,a.attribs.a_position,u.buffer),A.setBuffersAndAttributes(o,p,a),A.drawBufferInfo(o,a,o.POINTS),o.endTransformFeedback(),o.bindTransformFeedback(o.TRANSFORM_FEEDBACK,null),o.disable(o.RASTERIZER_DISCARD);for(let m of t)A.drawObjectList(o,[{programInfo:y,vertexArrayInfo:n,uniforms:{bounds:this.bounds,u_projection_fallback_matrix:e.defaultProjectionData.fallbackMatrix,u_projection_matrix:e.defaultProjectionData.mainMatrix,u_projection_tile_mercator_coords:e.defaultProjectionData.tileMercatorCoords,u_projection_clipping_plane:e.defaultProjectionData.clippingPlane,u_projection_transition:e.defaultProjectionData.projectionTransition,offset:m,size:l,u_texture_exists
|
|
571
|
+
}`}function X1(e,t,o){let p=e.getZoom(),y=o[t],i=y+(y-1)*(Math.pow(2,Math.floor(p))-1);return{rowCount:i,colCount:i}}import{uniq as d8}from"lodash-es";function K1(e,t,o,p){let y=M8(e,o,p),i=new Float32Array(t*4);try{i.set(y.flat())}catch(n){console.info("ERROR:",t,y.flat().length,n)}return{buffer:i,list:y}}function M8(e,t,o){let p=K2(e);if(p[2]>180){let i=[p[0],p[1],180,p[3]],n=[-180,p[1],p[2],p[3]],a={topLeft:[i[0],i[3]],bottomLeft:[i[0],i[1]],topRight:[i[2],i[3]],bottomRight:[i[2],i[1]]},s={topLeft:[n[0],n[3]],bottomLeft:[n[0],n[1]],topRight:[n[2],n[3]],bottomRight:[n[2],n[1]]},l=f2(a,t,o),g=f2(s,t,o),u=d8([...l,...g]);return f3(u,t,o)}else{let i=[p[0],p[3]],n=[p[0],p[1]],a=[p[2],p[3]],s=[p[2],p[1]],g=f2({topLeft:i,bottomLeft:n,topRight:a,bottomRight:s},t,o);return f3(g,t,o)}}function f3(e,t,o){return e.map((y)=>{let i=Math.floor(y/o),a=y%o/(o-1),s=i/(t-1);return[a,s]})}function f2(e,t,o){let p=q1(e.topLeft,t,o),y=q1(e.bottomLeft,t,o),i=q1(e.topRight,t,o),n=q1(e.bottomRight,t,o),a=Math.max(0,Math.min(Math.floor(p/o),Math.floor(y/o),Math.floor(i/o),Math.floor(n/o))),s=Math.min(t-1,Math.max(Math.floor(p/o),Math.floor(y/o),Math.floor(i/o),Math.floor(n/o))),l=Math.max(0,Math.min(p%o,y%o,i%o,n%o)),g=Math.min(o-1,Math.max(p%o,y%o,i%o,n%o)),u=[];for(let m=a;m<=s;m++)for(let c=l;c<=g;c++)u.push(m*o+c);return u}var P8=(e)=>{let t=e[0],o=e[1],p=(t+180)/360,y=o*Math.PI/180,i=(1-Math.log(Math.tan(y)+1/Math.cos(y))/Math.PI)/2;return[p,i]},q1=(e,t,o)=>{let[p,y]=P8(e),i=Math.round(y*(t-1)),n=Math.round(p*(o-1));return i*o+n};import*as k1 from"maplibre-gl";function Q1(e){let t=k1.MercatorCoordinate.fromLngLat({lng:e[0],lat:e[3]}),o=k1.MercatorCoordinate.fromLngLat({lng:e[0],lat:e[1]}),p=k1.MercatorCoordinate.fromLngLat({lng:e[2],lat:e[3]}),y=k1.MercatorCoordinate.fromLngLat({lng:e[2],lat:e[1]}),i=[Object.values(t).slice(0,2),Object.values(o).slice(0,2),Object.values(p).slice(0,2),Object.values(y).slice(0,2)].flat();return[t.x,t.y,y.x,y.y]}import*as x1 from"maplibre-gl";function F1(e,t){let o=e.getCenter(),p=new x1.LngLat(o.lng-1,o.lat),y=new x1.LngLat(o.lng+1,o.lat),i=e.project(p),n=e.project(y),a=x1.MercatorCoordinate.fromLngLat(p),s=x1.MercatorCoordinate.fromLngLat(y);return t/(n.x-i.x)*(s.x-a.x)/2}class F8 extends W{options={iconColor:O2,largeValueIconColor:G2,largeValue:k2,iconSize:27,gridDensity:3,iconOpacity:1,filterValue:0,gridType:"WindBarb"};iconColor=Object.values(new O(this.options.iconColor).toRgb());largeValueIconColor=Object.values(new O(this.options.largeValueIconColor).toRgb());iconTextureLoaded=!1;SHADER_MAP=new Map;onMount(){this.loadWinnIconTexture()}onUnMount(){}getShader(e,t){let{shaderData:o}=t;if(e instanceof WebGLRenderingContext)throw Error("gl is not WebGL2RenderingContext");if(this.SHADER_MAP.has(o.variantName))return this.SHADER_MAP.get(o.variantName);let p=A.createProgramInfo(e,[P3(),h1],{transformFeedbackVaryings:["a_windInfoOut"]}),y=40000,i=A.createBufferInfoFromArrays(e,{a_windInfoOut:{numComponents:4,data:new Float32Array(y*4),drawType:e.DYNAMIC_DRAW},a_position:{numComponents:2,data:new Float32Array(y*2),drawType:e.DYNAMIC_DRAW}}),n=A.createTransformFeedback(e,p,i),a=this.createProgramInfo("grid-wind-draw",t,()=>b3(t,this.maskShaderData.vs),()=>F3(t,this.maskShaderData.fs)),s=A.createBufferInfoFromArrays(e,{...A.primitives.createXYQuadVertices(),windInfo:{numComponents:4,buffer:i.attribs.a_windInfoOut.buffer,divisor:1}}),l=A.createVertexArrayInfo(e,a,s);return this.SHADER_MAP.set(o.variantName,{feedbackProgramInfo:p,drawProgramInfo:a,feedback:n,drawVertexArrayInfo:l,tfBufferInfo:i,numInstances:y}),this.SHADER_MAP.get(o.variantName)}loadWinnIconTexture(e="/huishang/assets/map/icons/winds/v4/wind-icons.png"){let t=this.gl2;this.setTextureOptions(t,{u_texture:{src:e,mag:t.LINEAR,min:t.LINEAR,wrap:t.CLAMP_TO_EDGE}},()=>{this.iconTextureLoaded=!0,this.map.triggerRepaint()})}setOptions(e){this.options={...this.options,...e},this.iconColor=Object.values(new O(this.options.iconColor).toRgb()),this.largeValueIconColor=Object.values(new O(this.options.largeValueIconColor).toRgb()),this.map.triggerRepaint()}onRender(e,t){if(!this.data||!this.nextData)return;if(!this.bounds)return;let o=this.gl2,{feedbackProgramInfo:p,drawProgramInfo:y,feedback:i,drawVertexArrayInfo:n,tfBufferInfo:a,numInstances:s}=this.getShader(o,e);o.bindBuffer(o.ARRAY_BUFFER,null),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,null),o.enable(o.RASTERIZER_DISCARD),o.useProgram(p.program),o.bindTransformFeedback(o.TRANSFORM_FEEDBACK,i),o.beginTransformFeedback(o.POINTS),A.setUniformsAndBindTextures(p,{...this.textures,u_image1_value_range:[this.data.minWindu,this.data.maxWindu,this.data.minWindv,this.data.maxWindv],u_image2_value_range:[this.nextData.minWindu,this.nextData.maxWindu,this.nextData.minWindv,this.nextData.maxWindv],u_bounds:Q1(this.bounds),u_filter_winds:this.options.filterValue,t:this.t});let l=F1(this.map,this.options.iconSize),g=X1(this.map,this.options.gridDensity,{1:18,2:22,3:28}),u=K1(this.map,s,g.rowCount,g.colCount);A.setAttribInfoBufferFromArray(o,a.attribs.a_position,u.buffer),A.setBuffersAndAttributes(o,p,a),A.drawBufferInfo(o,a,o.POINTS),o.endTransformFeedback(),o.bindTransformFeedback(o.TRANSFORM_FEEDBACK,null),o.disable(o.RASTERIZER_DISCARD);for(let m of t)A.drawObjectList(o,[{programInfo:y,vertexArrayInfo:n,uniforms:{bounds:this.bounds,u_projection_fallback_matrix:e.defaultProjectionData.fallbackMatrix,u_projection_matrix:e.defaultProjectionData.mainMatrix,u_projection_tile_mercator_coords:e.defaultProjectionData.tileMercatorCoords,u_projection_clipping_plane:e.defaultProjectionData.clippingPlane,u_projection_transition:e.defaultProjectionData.projectionTransition,offset:m,size:l,u_texture_exists:this.iconTextureLoaded?1:0,u_iconColor:this.iconColor,u_iconOpacity:this.options.iconOpacity,u_large_value:this.options.largeValue,u_large_value_iconColor:this.largeValueIconColor,iconsTextureSize:[1188,54],iconSize:[54,54],...this.maskUniforms,...this.textures},instanceCount:u.list.length}])}}import*as N from"twgl.js";var H1=`
|
|
573
572
|
#define PI 3.1415926535897932384626433832795
|
|
574
573
|
|
|
575
574
|
// UV转经纬度 (UV是0-1范围)
|
|
@@ -1981,6 +1980,6 @@ void main() {
|
|
|
1981
1980
|
fColor = texture(u_image, v_uv);
|
|
1982
1981
|
fColor.a *= 0.85;
|
|
1983
1982
|
}
|
|
1984
|
-
`}}class u5{fetchers;mock;constructor(e){this.fetchers=e.fetchers,this.mock=e.mock}}class c5{getDefOptions(){let e=this.getDataReqOptions({}),t=this.getDataResOptions({}),o=Object.keys(e).reduce((y,i)=>{return y[i]={enable:!1},y},{}),p=Object.keys(t).reduce((y,i)=>{return y[i]=void 0,y},{});return{...o,...p}}}class d5{params;layerMgrMap=void 0;constructor(e){this.params=e}getDefLayerOptions(){let e=this.layerMgrMap||this.params.createLayers();return Object.keys(e).reduce((t,o)=>{return t[o]={enable:!1},t},{})}}class M5{productMap={};products=[];groupConfig;constructor(e){e.products.reduce((t,o)=>{return t[o.type]=o,t},this.productMap),this.groupConfig=e.groupConfig,this.products=Object.values(this.productMap)}initCtx(e){Object.values(this.productMap).forEach((t)=>{t.initCtx(e)})}findProduct(e){return this.productMap[e]}get firstProduct(){return Object.values(this.productMap)[0]}}class P5{cityList;boundsPadding;isAddCityMask;customCityCoordinate={};constructor(e){this.cityList=e.cityListOptions,this.boundsPadding=e.boundsPadding||{top:0,bottom:0,left:0,right:0},this.isAddCityMask=e.isAddCityMask||!1}findCityInfo(e){let{china:t,province:o,city:p,county:y}=e,i=t?.gb||o?.gb||p?.gb||y?.gb,n=e.county?.geojson_boundary||e.city?.geojson_boundary||e.province?.geojson_boundary||e.china?.geojson_boundary;return{...this.cityList.find((s)=>s.adcode===i),maskGeoJson:n}}}import{SubscribeMgr as F5}from"@iweather-js/iweather-lib";import{debounce as b5,isEqual as a4,pick as f5}from"lodash-es";class _5{ctx;subscribeMgr=new F5;enabledLayerMgrs={};async mount(e){this.ctx=e;let{gisStore:t,configStore:o}=e,{map:p}=e.gisStore.getState();if(!p)return;t.getState().apply({type:"changeValue",value:{allLayerMgrs:o.getState().layerMgrConfig.params.createLayers()}});let{allLayerMgrs:y}=t.getState(),{dataReqOptionsConfig:i}=this.ctx.configStore.getState();this.subscribeMgr.add(this.ctx.gisStore.subscribe((a)=>{return{dataReqOptions:i.getDataReqOptions(a),allLayerOptopns:a.query.allLayerOptopns()}},async(a,s)=>{let l=a.allLayerOptopns,g=t.getState().query.enabledLayerOptopns(),u=f5(y,Object.keys(g));if(await Promise.all(Object.keys(y).map(async(m)=>{let c=y[m],P=l[m];if(c.initCtx(e,m),c.setEnable(P.enable),c.enable)await c.mount(P),c.setLayerOptions(P);else c.unmount()})),!a4(a.dataReqOptions,s.dataReqOptions))Object.values(u).forEach((m)=>m.loadData());else Object.values(u).forEach((m)=>{if(m.checkIsLoadData())m.loadData()});this.enabledLayerMgrs=u,console.info("[enabled layerMgrs]:",this.enabledLayerMgrs)},{equalityFn:a4,fireImmediately:!0}));let n=b5(()=>{Object.values(this.enabledLayerMgrs).forEach((a)=>a.boundsChange(p.getBounds()))},100);p.on("moveend",n),this.subscribeMgr.add(()=>{p.off("moveend",n)})}onUnmount(){this.subscribeMgr.dispose(),Object.values(this.ctx.gisStore.getState().allLayerMgrs).forEach((e)=>e.unmount())}}import{SubscribeMgr as v5}from"@iweather-js/iweather-lib";import{isEqual as h2}from"lodash-es";class h5{layerMgrHub;ctx;subscribeMgr=new v5;constructor(e){this.layerMgrHub=e}async mount(e){this.ctx=e,this.subscribeMgr.add(this.ctx.gisStore.subscribe((t)=>{let o=this.ctx.gisStore.getState();return{layersData:t.layersData,productType:t.productType,playMode:t.playMode,dataReqOptions:this.ctx.configStore.getState().dataReqOptionsConfig.getDataReqOptions(o)}},(t)=>{let{productType:o,playMode:p}=t,{productConfig:y}=this.ctx.configStore.getState(),n=y.findProduct(o).getTimeBarInfo(this.ctx.gisStore.getState());this.ctx.gisStore.getState().apply({type:"changeValue",value:{timeBarInfo:n,currTm:n?p==="timing"?n.timingTimeBar.initTime:n.frameTimeBar?.initTime:void 0}})},{equalityFn:h2,fireImmediately:!0})),this.subscribeMgr.add(this.ctx.gisStore.subscribe((t)=>t.currTm,(t)=>Object.values(this.layerMgrHub.enabledLayerMgrs).forEach((o)=>o.timeChange(t)),{equalityFn:h2})),this.subscribeMgr.add(this.ctx.gisStore.subscribe((t)=>t.devCustomGrayImageByMercator,(t)=>{Object.values(this.layerMgrHub.enabledLayerMgrs).forEach((o)=>o.loadData())},{equalityFn:h2}))}onUnmount(){this.subscribeMgr.dispose()}}import{clamp as x5}from"lodash-es";function C5(e,t){let o=t[0],p=t[1];return(x5(e,o,p)-o)/(p-o)}class x2{isDestroyed=!1;data=[];curr=void 0;setData(e){this.data=e.sort((t,o)=>t.beginTm-o.beginTm)}addData(e){this.data=[...this.data,...e].sort((t,o)=>t.beginTm-o.beginTm)}first(){return this.data[0]}find(e){let t=this.data.findLastIndex((o)=>e>=o.beginTm);if(t===-1)this.curr={data1:void 0,data2:void 0,p:0};else{let o=this.data[t],p=this.data[t+1],y=C5(e,[o.beginTm,o.endTm]);this.curr={data1:o,data2:p,p:y}}return this.curr}isEmpty(){return this.data.length===0}destroy(){this.isDestroyed=!0,this.data=[]}}import{AbortControllersMgr as T5}from"@iweather-js/iweather-lib";class L5{abortControllersMgr=new T5;setDataRes(e,t){e.gisStore.getState().apply({type:"changeValue",value:t})}onBeforeLoadData(e){return}async loadData(e){this.onBeforeLoadData(e);let t=await this.onLoadData(e),o=await this.onChangeDataRes(e,t);if(o)this.setDataRes(e,o);return t}abort(){this.abortControllersMgr.abort()}async onChangeDataRes(e,t){return}async loadMaxValue(e,t){return null}}import{AbortControllersMgr as I5,SubscribeMgr as D5}from"@iweather-js/iweather-lib";import{debounce as O5,isEqual as G5}from"lodash-es";class k5{props;enable=!0;isMounted=!1;data;layerOptions;prevLayerOptions;ctx;layerName;subscribeMgr=D5.create();isReload=!1;abortControllersMgr=new I5;dataFindMgrs=[];constructor(e){this.props=e}initCtx(e,t){return this.ctx=e,this.layerName=t,this}getLayerInfo(e){return""}get dataLoaderMgr(){return this.props.dataLoaderMgr}get map(){return this.ctx.gisStore.getState().map}getGisValue(){return this.ctx.gisStore.getState()}setLayerOptions(e){if(this.prevLayerOptions=this.layerOptions,this.layerOptions=e,!this.enable)return;if(!this.isMounted)return;if(!this.map)return;if(!this.ctx.gisStore.getState().mapIsLoaded)return;if(G5(e,this.prevLayerOptions))return;this.onLayerOptionsChange(e,this.prevLayerOptions)}checkIsLoadData(){if(!this.layerOptions)return!1;return this.onIsLoadData(this.layerOptions,this.prevLayerOptions)}async mount(e){if(!this.enable)return this;if(this.isMounted)return this;if(!this.map)return this;if(!this.ctx.gisStore.getState().mapIsLoaded)return this;return await this.onMount(e),this.isMounted=!0,this}static toLayerId(e){return`${e}-layer`}toLayerId(e,t=""){if(t)return`${e}-${t}-layer`;return`${e}-layer`}toSourceId(e){return`${e}-source`}setLayerVisible(e,t,o=!0){let p=o?this.toLayerId(e):e;if(this.map&&!!this.map.getLayer(p))this.map.setLayoutProperty(p,"visibility",t?"visible":"none")}isLayerVisible(e,t=!0){let o=t?this.toLayerId(e):e;return this.map?.getLayoutProperty(o,"visibility")==="visible"}getBeforeLayerId(e){return e&&!!this.map.getLayer(e)?e:void 0}removeLayerAndSource(e){this.removeMapLayer(this.toLayerId(e)),this.removeMapSource(this.toSourceId(e))}removeMapLayer(e){try{if(this.map.getLayer(e))this.map.removeLayer(e)}catch(t){console.error("[removeMapLayer]",t)}}removeMapSource(e){try{if(this.map.getSource(e))this.map.removeSource(e)}catch(t){console.error("[removeMapSource]",t)}}addMapLayer(e,t){return this.map.addLayer(e,this.getBeforeLayerId(t)),e}unmount(){if(!this.isMounted)return;this.isMounted=!1,this.clear(),this.onUnmount(),this.clearStoreData(),this.layerOptions=void 0,this.dataLoaderMgr?.abort(),this.abortControllersMgr.abort(),this.subscribeMgr.dispose()}timeChange(e){if(!this.enable)return;if(!this.map)return;if(!this.isMounted)return;let t=e??this.ctx.gisStore.getState().currTm;if(t)this.onTimeChange(t)}playStateChange(e){if(!this.enable)return;this.onPlayStateChange(e)}onPlayStateChange(e){}saveDataToStore(e){if(!this.layerName)return;let t=this.onTimingData(e);this.ctx.gisStore.getState().apply({type:"setLayersData",name:this.layerName,data:t})}clearStoreData(){if(!this.layerName)return;this.ctx.gisStore.getState().apply({type:"setLayersData",name:this.layerName,data:void 0})}async initData(e){if(!this.enable)return;if(!this.isMounted)return;if(!this.map)return;this.data=e,this.saveDataToStore(e),await this.onInitData(e),this.timeChange()}beforeReloadData(){}async loadData(){if(!this.enable)return;if(!this.isMounted)return;if(!this.dataLoaderMgr)return;if(this.beforeReloadData(),this.clear(),this.dataLoaderMgr.loadData(this.ctx).then((e)=>{this.initData(e)}),this.isReload)this.reloadMaxValue();if(this.isReload===!1)this.isReload=!0}boundsChange(e){this.reloadMaxValue()}reloadMaxValue=O5(async()=>{if(!this.enable)return;if(!this.isMounted)return;if(!this.map)return;if(!this.dataLoaderMgr)return;let e=await this.dataLoaderMgr.loadMaxValue(this.ctx,this.map.getBounds());if(e)this.onMaxValueChange(e)},300);onMaxValueChange(e){}clear(){this.onClear(),this.destroyDataFindMgrs(),this.timeChange()}onClear(){}createDataFindMgr(){let e=new x2;return this.dataFindMgrs.push(e),e}destroyDataFindMgrs(){this.dataFindMgrs.forEach((e)=>e.destroy())}setEnable(e){this.enable=e}}import{format as s4}from"date-fns";class E5{type;_ctx;constructor(e){this.type=e}getUpdateGisValueEffect(e,t){return}getDisplayLayerInfos(e){return[]}getSubGroupName(){return""}supportedForecastModels(){return[]}isSupportedMultiModelContrast(){return this.supportedForecastModels().length>1}getDefConfig(e){return J1(this.ctx,{layerOptions:{...e?.layerOptions},gisStyleOptions:{...e?.gisStyleOptions}})}initCtx(e){this._ctx=e}get ctx(){if(!this._ctx)throw Error("ctx is not initialized");return this._ctx}formatCurrTime(e){return s4(new Date(e),"yyyy/MM/dd HH:mm")}formatTimeBar(e){let t=new Date(e).getHours();return{value:s4(new Date(e),"M/d HH:mm"),highlight:t===8}}isNew(){return!1}}function $(e,t){if(!e)return;switch(t.type){case"setProjectionType":e.setProjection({type:t.projectionType});break;case"setShowSky":if(t.showSky)e.setSky({"atmosphere-blend":["interpolate",["linear"],["zoom"],0,1,2,0,7,0]}),e.setLight({anchor:"map",position:[1.5,90,80]});else e.setSky(void 0),e.setLight(void 0);break;case"disableZoom":if(t.isDisable)e.scrollZoom.disable();else e.scrollZoom.enable();break;case"disableMove":if(t.isDisable)e.dragPan.disable();else e.dragPan.enable();break;case"setBaseState":{t.center!==void 0&&e.setCenter(t.center),t.zoom!==void 0&&e.setZoom(t.zoom),t.maxZoom!==void 0&&e.setMaxZoom(t.maxZoom),t.minZoom!==void 0&&e.setMinZoom(t.minZoom),t.bearing!==void 0&&e.setBearing(t.bearing),t.pitch!==void 0&&e.setPitch(t.pitch);break}case"flyTo":if(t.zoom!==void 0&&t.center!==void 0&&t.pitch!==void 0&&t.bearing!==void 0)e.flyTo({zoom:t.zoom,center:t.center,pitch:t.pitch,bearing:t.bearing},{animate:!!t.duration,duration:t.duration??0});break;case"fitBounds":if(t.bounds)e.fitBounds(t.bounds,{animate:!!t.duration,duration:t.duration??0});break}}import V5 from"maplibre-gl";function Cr(e,t){let{center:o,zoom:p,pitch:y,bearing:i,bounds:n}=t.gisStore.getState();return new V5.Map({container:e,style:{version:8,glyphs:"/huishang/assets/map/glyphs/{fontstack}/{range}.pbf",sources:{},layers:[]},center:o,zoom:p,pitch:y,bearing:i,bounds:n,maxPitch:80,maplibreLogo:!1,canvasContextAttributes:{preserveDrawingBuffer:!0}})}import A5 from"mitt";var c1=A5();function C1(e){let t=e.getPitch(),o=e.getBearing(),p=e.getBounds(),y=e.getCenter().toArray(),i=e.getZoom();return{pitch:t,bearing:o,zoom:i,bounds:[Number(p.getWest().toFixed(6)),Number(p.getSouth().toFixed(6)),Number(p.getEast().toFixed(6)),Number(p.getNorth().toFixed(6))],center:y}}function kr(e){let{gisStore:t}=e,{map:o}=t.getState();if(!o)return;let p=()=>{if(!o)return;let{enableScreenshot:y,screenshot:i}=t.getState(),{bounds:n}=C1(o);if(!n)return;if(!y)return;let a=o.getCanvas().toDataURL("image/jpeg",0.5);if(i&&!i.startsWith("data:image")){console.info("检测截图:",i);try{let s=i.substring(i.lastIndexOf("/")+1).split("_")[1];if(s.substring(0,s.lastIndexOf("."))===n.map((g)=>g.toFixed(2)).join("|")){console.info("截图未变化,不进行截图修改:",i);return}}catch(s){console.error("截图解析错误:",i);return}}t.getState().apply({type:"changeValue",value:{screenshot:a}})};return o.on("idle",p),()=>{o.off("idle",p)}}function Nr(e){let{gisStore:t}=e,{mapId:o,map:p,mapGroup:y}=t.getState();if(!p)return;let i=!1,n=()=>{if(!p)return;if(i)return;if(!t.getState().enableMapSync)return;c1.emit("syncMapMove",{fromMapGroup:y,fromMapId:o,state:C1(p)})},a=(s)=>{if(s.fromMapId===o)return;if(!s.fromMapGroup||s.fromMapGroup!==y)return;if(!t.getState().enableMapSync)return;i=!0,p.jumpTo({center:s.state.center,zoom:s.state.zoom,bearing:s.state.bearing,pitch:s.state.pitch}),i=!1};return p.on("move",n),c1.on("syncMapMove",a),()=>{p.off("move",n),c1.off("syncMapMove",a)}}import{isEqual as B5}from"lodash-es";function $r(e){let{gisStore:t,configStore:o}=e,{mapId:p,map:y,mapGroup:i}=t.getState();if(!y)return;let n=!1,a=t.subscribe((l)=>l.currTm,(l)=>{if(n)return;if(!t.getState().enableMapSyncTime)return;if(!l)return;c1.emit("syncTime",{fromMapGroup:i,fromMapId:p,currTm:l})},{equalityFn:B5}),s=(l)=>{if(l.fromMapId===p)return;if(!l.fromMapGroup||l.fromMapGroup!==i)return;if(!t.getState().enableMapSyncTime)return;if(!o.getState().dataReqOptionsConfig.enableTimeSync(t.getState()))return;n=!0,t.getState().apply({type:"changeValue",value:{currTm:l.currTm}}),n=!1};return c1.on("syncTime",s),()=>{c1.off("syncTime",s),a()}}import{debounce as g4}from"lodash-es";function qr(e){let{gisStore:t}=e,{map:o}=t.getState();if(!o)return;let p=!1,y=g4(()=>{p=!1},1000),i=g4(()=>{if(p)return;t.getState().apply({type:"changeValue",value:{mapStateToStoreSyncing:!0}}),t.getState().apply({type:"changeValue",value:C1(o)}),t.getState().apply({type:"changeValue",value:{mapStateToStoreSyncing:!1}})},500);o.on("zoomend",i),o.on("moveend",i),o.on("pitchend",i),o.on("resize",()=>{p=!0,$(o,{type:"fitBounds",bounds:t.getState().bounds}),y()})}import{isEqual as e2}from"lodash-es";function zr(e){let{gisStore:t}=e,{map:o}=t.getState();t.subscribe((p)=>p.projectionType,(p)=>{if(t.getState().mapStateToStoreSyncing)return;$(o,{type:"setProjectionType",projectionType:p})},{equalityFn:e2}),t.subscribe((p)=>p.showSky,(p)=>{if(t.getState().mapStateToStoreSyncing)return;$(o,{type:"setShowSky",showSky:p})},{equalityFn:e2}),t.subscribe((p)=>p.disableZoom,(p)=>{if(t.getState().mapStateToStoreSyncing)return;$(o,{type:"disableZoom",isDisable:p})},{equalityFn:e2}),t.subscribe((p)=>p.bounds,(p)=>{if(t.getState().mapStateToStoreSyncing)return;$(o,{type:"fitBounds",bounds:p,duration:1000})},{equalityFn:e2})}function ep(e,t){let{gisStore:o}=t;setTimeout(()=>{e.resize()},1);let{showSky:p,projectionType:y,disableZoom:i,disableMove:n,boundsPadding:a,bounds:s,maxZoom:l,minZoom:g,mapBackgroundColor:u,renderWorldCopies:m,boundsLockMinZoom:c}=o.getState();if(e.setMaxZoom(l),e.setMinZoom(g),$(e,{type:"setShowSky",showSky:p}),$(e,{type:"disableZoom",isDisable:i}),$(e,{type:"disableMove",isDisable:n}),$(e,{type:"setProjectionType",projectionType:y}),e.setRenderWorldCopies(m),s)e.fitBounds(s,{animate:!1,duration:0,padding:a});if(c&&s)e.setMinZoom(e.cameraForBounds(s,{padding:a})?.zoom);e.setStyle({...e.getStyle(),layers:[{id:"background",type:"background",layout:{visibility:"visible"},paint:{"background-color":u||"transparent","background-opacity":1}}]})}import N5 from"maplibre-gl";class N1{infoMarker=null;infoMarkerEl=null;static map={};static getInstance(e){if(!N1.map[e])N1.map[e]=new N1;return N1.map[e]}constructor(){this.infoMarkerEl=document.createElement("div"),this.infoMarkerEl.className="hidden",this.infoMarker=new N5.Marker({element:this.infoMarkerEl})}hide(e){try{this.infoMarker?.removeClassName("visible"),this.infoMarker?.addClassName("invisible"),e.getCanvas().style.cursor="grab"}catch(t){console.info("MarkerMgr hide error")}}show(e,t){try{this.infoMarker.setLngLat(t.lngLat).addTo(e),this.infoMarker.removeClassName("invisible"),this.infoMarker.addClassName("visible"),this.infoMarkerEl.innerHTML=t.html,e.getCanvas().style.cursor="pointer"}catch(o){console.info("MarkerMgr show error")}}setEnable(e){if(e)this.infoMarker.removeClassName("hidden");else this.infoMarker.addClassName("hidden")}}import w5 from"maplibre-gl";class b1{static timer=null;static infoMarker;static infoMarkerEl;static hide(e){if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(()=>{b1.infoMarker.removeClassName("marker_visible"),this.timer=null,e.getCanvas().style.cursor="grab"},300)}static show(e,t){if(this.timer)clearTimeout(this.timer);if(!b1.infoMarker)b1.infoMarkerEl=document.createElement("div"),b1.infoMarkerEl.className="marker font-[JinBuTi]",b1.infoMarker=new w5.Marker({element:b1.infoMarkerEl});let{lng:o,lat:p}=t;this.infoMarker.setLngLat({lat:p,lng:o}).addTo(e).addClassName("marker_visible"),this.infoMarkerEl.innerHTML=t.html,e.getCanvas().style.cursor="pointer"}}import{isEqual as W5}from"lodash-es";var w1=null,t2=!1,C2=!1,J5=0.1;function l4(e){let{gisStore:t}=e,{map:o}=t.getState();if(C2&&o){let p=o.getCenter();o.panTo([p.lng+J5,p.lat],{animate:!1})}requestAnimationFrame(()=>l4(e))}function sp(e){let{gisStore:t}=e,o=t.getState().map;if(!o)throw Error("map is not found");let p=()=>{let{autoRotation:n}=t.getState();if(!n)return;if(n.bounds)$(o,{type:"fitBounds",bounds:n.bounds,duration:500});else if(n.pos)$(o,{type:"flyTo",center:n.pos.center,zoom:n.pos.zoom,duration:500});setTimeout(()=>{if(t2)C2=!0},500)},y=()=>{if(w1)clearTimeout(w1);C2=!1},i=()=>{let n=t.getState().autoRotation?.speed;if(!n)return;if(w1)clearTimeout(w1);w1=setTimeout(()=>{if(t2)p()},n)};o.on("dragend",i),o.on("mouseup",i),o.on("zoomend",i),o.on("touchend",i),o.on("mousedown",y),o.on("dragstart",y),o.on("touchstart",y),o.on("wheel",y),t.subscribe((n)=>n.autoRotation?.enable&&n.projectionType==="globe",(n)=>{if(!n)t2=!1,y();else t2=!0,p()},{fireImmediately:!0,equalityFn:W5}),l4(e)}export{q2 as wrapLongitude,B4 as wrapBounds,V2 as toGisValue,n6 as toColorPaletteFns,K6 as toAdcodeInfoVo,zr as syncStoreStateToMapHandler,qr as syncMapStateToStoreHandler,l6 as scaleColorPaletteConfig,r6 as readImageWithWindExif,o6 as readImageWithCommonExif,U2 as parseExifDataRangeWithWind,Z2 as parseExifDataRange,u2 as parseExifBounds,Q7 as parseExif3dSize,G7 as mapgl,$r as mapSyncTimeHandler,Nr as mapSyncMoveHandler,c1 as mapSyncEvent,kr as mapScreenshotHandler,sp as mapAutoRotation,$ as mapAction,ep as initMapState,Q2 as getVisibleWraps,K2 as getViewportBounds,w6 as getProvinceNames,e3 as getProvince,C1 as getMapState,V6 as getLand,E2 as getInitValue,J1 as getGisValue,d4 as getDefLayerOptions,c4 as getDefGisStyleOptions,r3 as getCounty,t3 as getCity,R2 as getChina,x7 as createMultiMapStatusStore,Cr as createMap,H2 as createGridMesh,c7 as createGisStore,b7 as createConfigStore,q7 as createColorPalette,S4 as WindColorLayer,h5 as TimeMgrHub,L4 as StepRangeUnit,I2 as PlaySpeedByTiming,D2 as PlaySpeedByFrame,H5 as PROJECTION_TYPES,m5 as MaskedDataLayer,F2 as MaskLayer,N1 as MarkerMgr,i5 as Maplibre3DProfileLayerV3,r5 as Maplibre3DProfileLayerV0,e5 as Maplibre3DProfileLayer,f8 as MapLibreWindParticleLayer,_5 as LayerMgrHub,Q5 as LEVEL_MAP_HIGHLIGHT_VALUE,q5 as LEVELS,M5 as IProductConfig,E5 as IProduct,S as INFINITY_VALUE,d5 as ILayerMgrConfig,k5 as ILayerMgr,c5 as IDataReqOptionsConfig,u5 as IDataFetchConfig,P5 as ICityConfig,b1 as HoverMarker,l5 as GridWindValueLayer,F8 as GridWindLayer,g5 as GridValueLayer,y2 as GridRenderIconSize,W1 as GridDensity,S5 as GRID_ICON_SIZE_OPTIONS,z5 as GRID_DENSITY_TYPES,W as ExTimingLayer,o1 as ExCustomLayer,L5 as DataLoaderMgr,x2 as DataFindMgr,G2 as DEF_WIND_LARGE_VALUE_ICON_COLOR,k2 as DEF_WIND_LARGE_VALUE,O2 as DEF_WIND_ICON_COLOR,d1 as DEF_MAP_CONFIG,R5 as DEF_CHINA_LAYER_LINE_COLOR,l8 as ContourValueLayer,c8 as ContourLayerByValue,o8 as ContourLayer,R4 as CommonColorLayer,L2 as ColorRenderType,G1 as ColorLayer,L7 as COLOR_PALETTE_CONFIG,K5 as BASEMAP_TYPES};
|
|
1983
|
+
`}}class u5{fetchers;mock;constructor(e){this.fetchers=e.fetchers,this.mock=e.mock}}class c5{getDefOptions(){let e=this.getDataReqOptions({}),t=this.getDataResOptions({}),o=Object.keys(e).reduce((y,i)=>{return y[i]={enable:!1},y},{}),p=Object.keys(t).reduce((y,i)=>{return y[i]=void 0,y},{});return{...o,...p}}}class d5{params;layerMgrMap=void 0;constructor(e){this.params=e}getDefLayerOptions(){let e=this.layerMgrMap||this.params.createLayers();return Object.keys(e).reduce((t,o)=>{return t[o]={enable:!1},t},{})}}class M5{productMap={};products=[];groupConfig;constructor(e){e.products.reduce((t,o)=>{return t[o.type]=o,t},this.productMap),this.groupConfig=e.groupConfig,this.products=Object.values(this.productMap)}initCtx(e){Object.values(this.productMap).forEach((t)=>{t.initCtx(e)})}findProduct(e){return this.productMap[e]}get firstProduct(){return Object.values(this.productMap)[0]}}class P5{cityList;boundsPadding;isAddCityMask;customCityCoordinate={};constructor(e){this.cityList=e.cityListOptions,this.boundsPadding=e.boundsPadding||{top:0,bottom:0,left:0,right:0},this.isAddCityMask=e.isAddCityMask||!1}findCityInfo(e){let{china:t,province:o,city:p,county:y}=e,i=t?.gb||o?.gb||p?.gb||y?.gb,n=e.county?.geojson_boundary||e.city?.geojson_boundary||e.province?.geojson_boundary||e.china?.geojson_boundary;return{...this.cityList.find((s)=>s.adcode===i),maskGeoJson:n}}}import{SubscribeMgr as F5}from"@iweather-js/iweather-lib";import{debounce as b5,isEqual as a4,pick as f5}from"lodash-es";class _5{ctx;subscribeMgr=new F5;enabledLayerMgrs={};async mount(e){this.ctx=e;let{gisStore:t,configStore:o}=e,{map:p}=e.gisStore.getState();if(!p)return;t.getState().apply({type:"changeValue",value:{allLayerMgrs:o.getState().layerMgrConfig.params.createLayers()}});let{allLayerMgrs:y}=t.getState(),{dataReqOptionsConfig:i}=this.ctx.configStore.getState();this.subscribeMgr.add(this.ctx.gisStore.subscribe((a)=>{return{dataReqOptions:i.getDataReqOptions(a),allLayerOptopns:a.query.allLayerOptopns()}},async(a,s)=>{let l=a.allLayerOptopns,g=t.getState().query.enabledLayerOptopns(),u=f5(y,Object.keys(g));if(await Promise.all(Object.keys(y).map(async(m)=>{let c=y[m],P=l[m];if(c.initCtx(e,m),c.setEnable(P.enable),c.enable)await c.mount(P),c.setLayerOptions(P);else c.unmount()})),!a4(a.dataReqOptions,s.dataReqOptions))Object.values(u).forEach((m)=>m.loadData());else Object.values(u).forEach((m)=>{if(m.checkIsLoadData())m.loadData()});this.enabledLayerMgrs=u,console.info("[enabled layerMgrs]:",this.enabledLayerMgrs)},{equalityFn:a4,fireImmediately:!0}));let n=b5(()=>{Object.values(this.enabledLayerMgrs).forEach((a)=>a.boundsChange(p.getBounds()))},100);p.on("moveend",n),this.subscribeMgr.add(()=>{p.off("moveend",n)})}onUnmount(){this.subscribeMgr.dispose(),Object.values(this.ctx.gisStore.getState().allLayerMgrs).forEach((e)=>e.unmount())}}import{SubscribeMgr as v5}from"@iweather-js/iweather-lib";import{isEqual as h2}from"lodash-es";class h5{layerMgrHub;ctx;subscribeMgr=new v5;constructor(e){this.layerMgrHub=e}async mount(e){this.ctx=e,this.subscribeMgr.add(this.ctx.gisStore.subscribe((t)=>{let o=this.ctx.gisStore.getState();return{layersData:t.layersData,productType:t.productType,playMode:t.playMode,dataReqOptions:this.ctx.configStore.getState().dataReqOptionsConfig.getDataReqOptions(o)}},(t)=>{let{productType:o,playMode:p}=t,{productConfig:y}=this.ctx.configStore.getState(),n=y.findProduct(o).getTimeBarInfo(this.ctx.gisStore.getState());this.ctx.gisStore.getState().apply({type:"changeValue",value:{timeBarInfo:n,currTm:n?p==="timing"?n.timingTimeBar.initTime:n.frameTimeBar?.initTime:void 0}})},{equalityFn:h2,fireImmediately:!0})),this.subscribeMgr.add(this.ctx.gisStore.subscribe((t)=>t.currTm,(t)=>Object.values(this.layerMgrHub.enabledLayerMgrs).forEach((o)=>o.timeChange(t)),{equalityFn:h2})),this.subscribeMgr.add(this.ctx.gisStore.subscribe((t)=>t.devCustomGrayImageByMercator,(t)=>{Object.values(this.layerMgrHub.enabledLayerMgrs).forEach((o)=>o.loadData())},{equalityFn:h2}))}onUnmount(){this.subscribeMgr.dispose()}}import{clamp as x5}from"lodash-es";function C5(e,t){let o=t[0],p=t[1];return(x5(e,o,p)-o)/(p-o)}class x2{isDestroyed=!1;data=[];curr=void 0;setData(e){this.data=e.sort((t,o)=>t.beginTm-o.beginTm)}addData(e){this.data=[...this.data,...e].sort((t,o)=>t.beginTm-o.beginTm)}first(){return this.data[0]}find(e){let t=this.data.findLastIndex((o)=>e>=o.beginTm);if(t===-1)this.curr={data1:void 0,data2:void 0,p:0};else{let o=this.data[t],p=this.data[t+1],y=C5(e,[o.beginTm,o.endTm]);this.curr={data1:o,data2:p,p:y}}return this.curr}isEmpty(){return this.data.length===0}destroy(){this.isDestroyed=!0,this.data=[]}}import{AbortControllersMgr as T5}from"@iweather-js/iweather-lib";class L5{abortControllersMgr=new T5;setDataRes(e,t){e.gisStore.getState().apply({type:"changeValue",value:t})}onBeforeLoadData(e){return}async loadData(e){this.onBeforeLoadData(e);let t=await this.onLoadData(e),o=await this.onChangeDataRes(e,t);if(o)this.setDataRes(e,o);return t}abort(){this.abortControllersMgr.abort()}async onChangeDataRes(e,t){return}async loadMaxValue(e,t){return null}}import{AbortControllersMgr as I5,SubscribeMgr as D5}from"@iweather-js/iweather-lib";import{debounce as O5,isEqual as G5}from"lodash-es";class k5{props;enable=!0;isMounted=!1;data;layerOptions;prevLayerOptions;ctx;layerName;subscribeMgr=D5.create();isReload=!1;abortControllersMgr=new I5;dataFindMgrs=[];constructor(e){this.props=e}initCtx(e,t){return this.ctx=e,this.layerName=t,this}getLayerInfo(e){return""}get dataLoaderMgr(){return this.props.dataLoaderMgr}get map(){return this.ctx.gisStore.getState().map}getGisValue(){return this.ctx.gisStore.getState()}setLayerOptions(e){if(this.prevLayerOptions=this.layerOptions,this.layerOptions=e,!this.enable)return;if(!this.isMounted)return;if(!this.map)return;if(!this.ctx.gisStore.getState().mapIsLoaded)return;if(G5(e,this.prevLayerOptions))return;this.onLayerOptionsChange(e,this.prevLayerOptions)}checkIsLoadData(){if(!this.layerOptions)return!1;return this.onIsLoadData(this.layerOptions,this.prevLayerOptions)}async mount(e){if(!this.enable)return this;if(this.isMounted)return this;if(!this.map)return this;if(!this.ctx.gisStore.getState().mapIsLoaded)return this;return await this.onMount(e),this.isMounted=!0,this}static toLayerId(e){return`${e}-layer`}toLayerId(e,t=""){if(t)return`${e}-${t}-layer`;return`${e}-layer`}toSourceId(e){return`${e}-source`}getBeforeLayerId(e){return e&&!!this.map.getLayer(e)?e:void 0}removeMapLayer(e){if(this.map.getLayer(e))this.map.removeLayer(e)}removeMapSource(e){if(this.map.getSource(e))this.map.removeSource(e)}setLayerVisible(e,t){if(this.map&&!!this.map.getLayer(e))this.map.setLayoutProperty(e,"visibility",t?"visible":"none")}isLayerVisible(e){return this.map?.getLayoutProperty(e,"visibility")==="visible"}addMapLayer(e,t){return this.map.addLayer(e,this.getBeforeLayerId(t)),e}unmount(){if(!this.isMounted)return;this.isMounted=!1,this.clear(),this.onUnmount(),this.clearStoreData(),this.layerOptions=void 0,this.dataLoaderMgr?.abort(),this.abortControllersMgr.abort(),this.subscribeMgr.dispose()}timeChange(e){if(!this.enable)return;if(!this.map)return;if(!this.isMounted)return;let t=e??this.ctx.gisStore.getState().currTm;if(t)this.onTimeChange(t)}playStateChange(e){if(!this.enable)return;this.onPlayStateChange(e)}onPlayStateChange(e){}saveDataToStore(e){if(!this.layerName)return;let t=this.onTimingData(e);this.ctx.gisStore.getState().apply({type:"setLayersData",name:this.layerName,data:t})}clearStoreData(){if(!this.layerName)return;this.ctx.gisStore.getState().apply({type:"setLayersData",name:this.layerName,data:void 0})}async initData(e){if(!this.enable)return;if(!this.isMounted)return;if(!this.map)return;this.data=e,this.saveDataToStore(e),await this.onInitData(e),this.timeChange()}beforeReloadData(){}async loadData(){if(!this.enable)return;if(!this.isMounted)return;if(!this.dataLoaderMgr)return;if(this.beforeReloadData(),this.clear(),this.dataLoaderMgr.loadData(this.ctx).then((e)=>{this.initData(e)}),this.isReload)this.reloadMaxValue();if(this.isReload===!1)this.isReload=!0}boundsChange(e){this.reloadMaxValue()}reloadMaxValue=O5(async()=>{if(!this.enable)return;if(!this.isMounted)return;if(!this.map)return;if(!this.dataLoaderMgr)return;let e=await this.dataLoaderMgr.loadMaxValue(this.ctx,this.map.getBounds());if(e)this.onMaxValueChange(e)},300);onMaxValueChange(e){}clear(){this.onClear(),this.destroyDataFindMgrs(),this.timeChange()}onClear(){}createDataFindMgr(){let e=new x2;return this.dataFindMgrs.push(e),e}destroyDataFindMgrs(){this.dataFindMgrs.forEach((e)=>e.destroy())}setEnable(e){this.enable=e}}import{format as s4}from"date-fns";class E5{type;_ctx;constructor(e){this.type=e}getUpdateGisValueEffect(e,t){return}getDisplayLayerInfos(e){return[]}getSubGroupName(){return""}supportedForecastModels(){return[]}isSupportedMultiModelContrast(){return this.supportedForecastModels().length>1}getDefConfig(e){return J1(this.ctx,{layerOptions:{...e?.layerOptions},gisStyleOptions:{...e?.gisStyleOptions}})}initCtx(e){this._ctx=e}get ctx(){if(!this._ctx)throw Error("ctx is not initialized");return this._ctx}formatCurrTime(e){return s4(new Date(e),"yyyy/MM/dd HH:mm")}formatTimeBar(e){let t=new Date(e).getHours();return{value:s4(new Date(e),"M/d HH:mm"),highlight:t===8}}isNew(){return!1}}function $(e,t){if(!e)return;switch(t.type){case"setProjectionType":e.setProjection({type:t.projectionType});break;case"setShowSky":if(t.showSky)e.setSky({"atmosphere-blend":["interpolate",["linear"],["zoom"],0,1,2,0,7,0]}),e.setLight({anchor:"map",position:[1.5,90,80]});else e.setSky(void 0),e.setLight(void 0);break;case"disableZoom":if(t.isDisable)e.scrollZoom.disable();else e.scrollZoom.enable();break;case"disableMove":if(t.isDisable)e.dragPan.disable();else e.dragPan.enable();break;case"setBaseState":{t.center!==void 0&&e.setCenter(t.center),t.zoom!==void 0&&e.setZoom(t.zoom),t.maxZoom!==void 0&&e.setMaxZoom(t.maxZoom),t.minZoom!==void 0&&e.setMinZoom(t.minZoom),t.bearing!==void 0&&e.setBearing(t.bearing),t.pitch!==void 0&&e.setPitch(t.pitch);break}case"flyTo":if(t.zoom!==void 0&&t.center!==void 0&&t.pitch!==void 0&&t.bearing!==void 0)e.flyTo({zoom:t.zoom,center:t.center,pitch:t.pitch,bearing:t.bearing},{animate:!!t.duration,duration:t.duration??0});break;case"fitBounds":if(t.bounds)e.fitBounds(t.bounds,{animate:!!t.duration,duration:t.duration??0});break}}import V5 from"maplibre-gl";function Cr(e,t){let{center:o,zoom:p,pitch:y,bearing:i,bounds:n}=t.gisStore.getState();return new V5.Map({container:e,style:{version:8,glyphs:"/huishang/assets/map/glyphs/{fontstack}/{range}.pbf",sources:{},layers:[]},center:o,zoom:p,pitch:y,bearing:i,bounds:n,maxPitch:80,maplibreLogo:!1,canvasContextAttributes:{preserveDrawingBuffer:!0}})}import A5 from"mitt";var c1=A5();function C1(e){let t=e.getPitch(),o=e.getBearing(),p=e.getBounds(),y=e.getCenter().toArray(),i=e.getZoom();return{pitch:t,bearing:o,zoom:i,bounds:[Number(p.getWest().toFixed(6)),Number(p.getSouth().toFixed(6)),Number(p.getEast().toFixed(6)),Number(p.getNorth().toFixed(6))],center:y}}function kr(e){let{gisStore:t}=e,{map:o}=t.getState();if(!o)return;let p=()=>{if(!o)return;let{enableScreenshot:y,screenshot:i}=t.getState(),{bounds:n}=C1(o);if(!n)return;if(!y)return;let a=o.getCanvas().toDataURL("image/jpeg",0.5);if(i&&!i.startsWith("data:image")){console.info("检测截图:",i);try{let s=i.substring(i.lastIndexOf("/")+1).split("_")[1];if(s.substring(0,s.lastIndexOf("."))===n.map((g)=>g.toFixed(2)).join("|")){console.info("截图未变化,不进行截图修改:",i);return}}catch(s){console.error("截图解析错误:",i);return}}t.getState().apply({type:"changeValue",value:{screenshot:a}})};return o.on("idle",p),()=>{o.off("idle",p)}}function Nr(e){let{gisStore:t}=e,{mapId:o,map:p,mapGroup:y}=t.getState();if(!p)return;let i=!1,n=()=>{if(!p)return;if(i)return;if(!t.getState().enableMapSync)return;c1.emit("syncMapMove",{fromMapGroup:y,fromMapId:o,state:C1(p)})},a=(s)=>{if(s.fromMapId===o)return;if(!s.fromMapGroup||s.fromMapGroup!==y)return;if(!t.getState().enableMapSync)return;i=!0,p.jumpTo({center:s.state.center,zoom:s.state.zoom,bearing:s.state.bearing,pitch:s.state.pitch}),i=!1};return p.on("move",n),c1.on("syncMapMove",a),()=>{p.off("move",n),c1.off("syncMapMove",a)}}import{isEqual as B5}from"lodash-es";function $r(e){let{gisStore:t,configStore:o}=e,{mapId:p,map:y,mapGroup:i}=t.getState();if(!y)return;let n=!1,a=t.subscribe((l)=>l.currTm,(l)=>{if(n)return;if(!t.getState().enableMapSyncTime)return;if(!l)return;c1.emit("syncTime",{fromMapGroup:i,fromMapId:p,currTm:l})},{equalityFn:B5}),s=(l)=>{if(l.fromMapId===p)return;if(!l.fromMapGroup||l.fromMapGroup!==i)return;if(!t.getState().enableMapSyncTime)return;if(!o.getState().dataReqOptionsConfig.enableTimeSync(t.getState()))return;n=!0,t.getState().apply({type:"changeValue",value:{currTm:l.currTm}}),n=!1};return c1.on("syncTime",s),()=>{c1.off("syncTime",s),a()}}import{debounce as g4}from"lodash-es";function qr(e){let{gisStore:t}=e,{map:o}=t.getState();if(!o)return;let p=!1,y=g4(()=>{p=!1},1000),i=g4(()=>{if(p)return;t.getState().apply({type:"changeValue",value:{mapStateToStoreSyncing:!0}}),t.getState().apply({type:"changeValue",value:C1(o)}),t.getState().apply({type:"changeValue",value:{mapStateToStoreSyncing:!1}})},500);o.on("zoomend",i),o.on("moveend",i),o.on("pitchend",i),o.on("resize",()=>{p=!0,$(o,{type:"fitBounds",bounds:t.getState().bounds}),y()})}import{isEqual as e2}from"lodash-es";function zr(e){let{gisStore:t}=e,{map:o}=t.getState();t.subscribe((p)=>p.projectionType,(p)=>{if(t.getState().mapStateToStoreSyncing)return;$(o,{type:"setProjectionType",projectionType:p})},{equalityFn:e2}),t.subscribe((p)=>p.showSky,(p)=>{if(t.getState().mapStateToStoreSyncing)return;$(o,{type:"setShowSky",showSky:p})},{equalityFn:e2}),t.subscribe((p)=>p.disableZoom,(p)=>{if(t.getState().mapStateToStoreSyncing)return;$(o,{type:"disableZoom",isDisable:p})},{equalityFn:e2}),t.subscribe((p)=>p.bounds,(p)=>{if(t.getState().mapStateToStoreSyncing)return;$(o,{type:"fitBounds",bounds:p,duration:1000})},{equalityFn:e2})}function ep(e,t){let{gisStore:o}=t;setTimeout(()=>{e.resize()},1);let{showSky:p,projectionType:y,disableZoom:i,disableMove:n,boundsPadding:a,bounds:s,maxZoom:l,minZoom:g,mapBackgroundColor:u,renderWorldCopies:m,boundsLockMinZoom:c}=o.getState();if(e.setMaxZoom(l),e.setMinZoom(g),$(e,{type:"setShowSky",showSky:p}),$(e,{type:"disableZoom",isDisable:i}),$(e,{type:"disableMove",isDisable:n}),$(e,{type:"setProjectionType",projectionType:y}),e.setRenderWorldCopies(m),s)e.fitBounds(s,{animate:!1,duration:0,padding:a});if(c&&s)e.setMinZoom(e.cameraForBounds(s,{padding:a})?.zoom);e.setStyle({...e.getStyle(),layers:[{id:"background",type:"background",layout:{visibility:"visible"},paint:{"background-color":u||"transparent","background-opacity":1}}]})}import N5 from"maplibre-gl";class N1{infoMarker=null;infoMarkerEl=null;static map={};static getInstance(e){if(!N1.map[e])N1.map[e]=new N1;return N1.map[e]}constructor(){this.infoMarkerEl=document.createElement("div"),this.infoMarkerEl.className="hidden",this.infoMarker=new N5.Marker({element:this.infoMarkerEl})}hide(e){try{this.infoMarker?.removeClassName("visible"),this.infoMarker?.addClassName("invisible"),e.getCanvas().style.cursor="grab"}catch(t){console.info("MarkerMgr hide error")}}show(e,t){try{this.infoMarker.setLngLat(t.lngLat).addTo(e),this.infoMarker.removeClassName("invisible"),this.infoMarker.addClassName("visible"),this.infoMarkerEl.innerHTML=t.html,e.getCanvas().style.cursor="pointer"}catch(o){console.info("MarkerMgr show error")}}setEnable(e){if(e)this.infoMarker.removeClassName("hidden");else this.infoMarker.addClassName("hidden")}}import w5 from"maplibre-gl";class b1{static timer=null;static infoMarker;static infoMarkerEl;static hide(e){if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(()=>{b1.infoMarker.removeClassName("marker_visible"),this.timer=null,e.getCanvas().style.cursor="grab"},300)}static show(e,t){if(this.timer)clearTimeout(this.timer);if(!b1.infoMarker)b1.infoMarkerEl=document.createElement("div"),b1.infoMarkerEl.className="marker font-[JinBuTi]",b1.infoMarker=new w5.Marker({element:b1.infoMarkerEl});let{lng:o,lat:p}=t;this.infoMarker.setLngLat({lat:p,lng:o}).addTo(e).addClassName("marker_visible"),this.infoMarkerEl.innerHTML=t.html,e.getCanvas().style.cursor="pointer"}}import{isEqual as W5}from"lodash-es";var w1=null,t2=!1,C2=!1,J5=0.1;function l4(e){let{gisStore:t}=e,{map:o}=t.getState();if(C2&&o){let p=o.getCenter();o.panTo([p.lng+J5,p.lat],{animate:!1})}requestAnimationFrame(()=>l4(e))}function sp(e){let{gisStore:t}=e,o=t.getState().map;if(!o)throw Error("map is not found");let p=()=>{let{autoRotation:n}=t.getState();if(!n)return;if(n.bounds)$(o,{type:"fitBounds",bounds:n.bounds,duration:500});else if(n.pos)$(o,{type:"flyTo",center:n.pos.center,zoom:n.pos.zoom,duration:500});setTimeout(()=>{if(t2)C2=!0},500)},y=()=>{if(w1)clearTimeout(w1);C2=!1},i=()=>{let n=t.getState().autoRotation?.speed;if(!n)return;if(w1)clearTimeout(w1);w1=setTimeout(()=>{if(t2)p()},n)};o.on("dragend",i),o.on("mouseup",i),o.on("zoomend",i),o.on("touchend",i),o.on("mousedown",y),o.on("dragstart",y),o.on("touchstart",y),o.on("wheel",y),t.subscribe((n)=>n.autoRotation?.enable&&n.projectionType==="globe",(n)=>{if(!n)t2=!1,y();else t2=!0,p()},{fireImmediately:!0,equalityFn:W5}),l4(e)}export{q2 as wrapLongitude,B4 as wrapBounds,V2 as toGisValue,n6 as toColorPaletteFns,K6 as toAdcodeInfoVo,zr as syncStoreStateToMapHandler,qr as syncMapStateToStoreHandler,l6 as scaleColorPaletteConfig,r6 as readImageWithWindExif,o6 as readImageWithCommonExif,U2 as parseExifDataRangeWithWind,Z2 as parseExifDataRange,u2 as parseExifBounds,Q7 as parseExif3dSize,G7 as mapgl,$r as mapSyncTimeHandler,Nr as mapSyncMoveHandler,c1 as mapSyncEvent,kr as mapScreenshotHandler,sp as mapAutoRotation,$ as mapAction,ep as initMapState,Q2 as getVisibleWraps,K2 as getViewportBounds,w6 as getProvinceNames,e3 as getProvince,C1 as getMapState,V6 as getLand,E2 as getInitValue,J1 as getGisValue,d4 as getDefLayerOptions,c4 as getDefGisStyleOptions,r3 as getCounty,t3 as getCity,R2 as getChina,x7 as createMultiMapStatusStore,Cr as createMap,H2 as createGridMesh,c7 as createGisStore,b7 as createConfigStore,q7 as createColorPalette,S4 as WindColorLayer,h5 as TimeMgrHub,L4 as StepRangeUnit,I2 as PlaySpeedByTiming,D2 as PlaySpeedByFrame,H5 as PROJECTION_TYPES,m5 as MaskedDataLayer,F2 as MaskLayer,N1 as MarkerMgr,i5 as Maplibre3DProfileLayerV3,r5 as Maplibre3DProfileLayerV0,e5 as Maplibre3DProfileLayer,f8 as MapLibreWindParticleLayer,_5 as LayerMgrHub,Q5 as LEVEL_MAP_HIGHLIGHT_VALUE,q5 as LEVELS,M5 as IProductConfig,E5 as IProduct,S as INFINITY_VALUE,d5 as ILayerMgrConfig,k5 as ILayerMgr,c5 as IDataReqOptionsConfig,u5 as IDataFetchConfig,P5 as ICityConfig,b1 as HoverMarker,l5 as GridWindValueLayer,F8 as GridWindLayer,g5 as GridValueLayer,y2 as GridRenderIconSize,W1 as GridDensity,S5 as GRID_ICON_SIZE_OPTIONS,z5 as GRID_DENSITY_TYPES,W as ExTimingLayer,o1 as ExCustomLayer,L5 as DataLoaderMgr,x2 as DataFindMgr,G2 as DEF_WIND_LARGE_VALUE_ICON_COLOR,k2 as DEF_WIND_LARGE_VALUE,O2 as DEF_WIND_ICON_COLOR,d1 as DEF_MAP_CONFIG,R5 as DEF_CHINA_LAYER_LINE_COLOR,l8 as ContourValueLayer,c8 as ContourLayerByValue,o8 as ContourLayer,R4 as CommonColorLayer,L2 as ColorRenderType,G1 as ColorLayer,L7 as COLOR_PALETTE_CONFIG,K5 as BASEMAP_TYPES};
|
|
1985
1984
|
|
|
1986
|
-
//# debugId=
|
|
1985
|
+
//# debugId=D2069ECA209729AF64756E2164756E21
|